!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else if("object"==typeof Livefyre&&"function"==typeof Livefyre.define&&Livefyre.define.amd)Livefyre.define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,(g.Livefyre||(g.Livefyre={})).Sidenotes=f()}}(function(){var define;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;oe?-p:e>b?p:0,0))}t.continuous&&f.transitions&&(a(s(b-1),-p,0),a(s(b+1),p,0)),f.transitions||(x.style.left=b*-p+"px"),n.style.visibility="visible"}function i(){t.continuous?r(b-1):b&&r(b-1)}function o(){t.continuous?r(b+1):bb?n:b)-r-1),p*i,0);n=s(n),a(b,p*i,e||g),a(n,0,e||g),t.continuous&&a(s(n-i),-(p*i),0)}else n=s(n),c(b*-p,n*-p,e||g);b=n,h(t.callback&&t.callback(b,E[b]))}}function a(n,t,e){u(n,t,e),m[n]=t}function u(n,t,e){var i=E[n],o=i&&i.style;o&&(o.webkitTransitionDuration=o.MozTransitionDuration=o.msTransitionDuration=o.OTransitionDuration=o.transitionDuration=e+"ms",o.webkitTransform="translate("+t+"px,0)translateZ(0)",o.msTransform=o.MozTransform=o.OTransform="translateX("+t+"px)")}function c(n,e,i){if(!i)return void(x.style.left=e+"px");var o=+new Date,s=setInterval(function(){var r=+new Date-o;return r>i?(x.style.left=e+"px",L&&d(),t.transitionEnd&&t.transitionEnd.call(event,b,E[b]),void clearInterval(s)):void(x.style.left=(e-n)*(Math.floor(r/i*100)/100)+n+"px")},4)}function d(){T=setTimeout(o,L)}function l(){L=0,clearTimeout(T)}var v=function(){},h=function(n){setTimeout(n||v,0)},f={addEventListener:!!window.addEventListener,touch:"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,transitions:function(n){var t=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var e in t)if(void 0!==n.style[t[e]])return!0;return!1}(document.createElement("swipe"))};if(n){var E,m,p,w,x=n.children[0];t=t||{};var b=parseInt(t.startSlide,10)||0,g=t.speed||300;t.continuous=void 0===t.continuous||t.continuous;var T,y,L=t.auto||0,k={},D={},M={handleEvent:function(n){switch(n.type){case"touchstart":this.start(n);break;case"touchmove":this.move(n);break;case"touchend":h(this.end(n));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":h(this.transitionEnd(n));break;case"resize":h(e)}t.stopPropagation&&n.stopPropagation()},start:function(n){var t=n.touches[0];k={x:t.pageX,y:t.pageY,time:+new Date},y=void 0,D={},x.addEventListener("touchmove",this,!1),x.addEventListener("touchend",this,!1)},move:function(n){if(!(n.touches.length>1||n.scale&&1!==n.scale)){t.disableScroll&&n.preventDefault();var e=n.touches[0];D={x:e.pageX-k.x,y:e.pageY-k.y},"undefined"==typeof y&&(y=!!(y||Math.abs(D.x)0||b==E.length-1&&D.x<0?Math.abs(D.x)/p+1:1),u(b-1,D.x+m[b-1],0),u(b,D.x+m[b],0),u(b+1,D.x+m[b+1],0)))}},end:function(){var e=+new Date-k.time,i=Number(e)<250&&Math.abs(D.x)>20||Math.abs(D.x)>p/2,o=!b&&D.x>0||b==E.length-1&&D.x<0;t.continuous&&(o=!1);var r=D.x<0;y||(i&&!o?(r?(t.continuous?(a(s(b-1),-p,0),a(s(b+2),p,0)):a(b-1,-p,0),a(b,m[b]-p,g),a(s(b+1),m[s(b+1)]-p,g),b=s(b+1)):(t.continuous?(a(s(b+1),p,0),a(s(b-2),-p,0)):a(b+1,p,0),a(b,m[b]+p,g),a(s(b-1),m[s(b-1)]+p,g),b=s(b-1)),t.callback&&t.callback(b,E[b])):t.continuous?(a(s(b-1),-p,g),a(b,0,g),a(s(b+1),p,g)):(a(b-1,-p,g),a(b,0,g),a(b+1,p,g))),x.removeEventListener("touchmove",M,!1),x.removeEventListener("touchend",M,!1)},transitionEnd:function(n){parseInt(n.target.getAttribute("data-index"),10)==b&&(L&&d(),t.transitionEnd&&t.transitionEnd.call(n,b,E[b]))}};return e(),L&&d(),f.addEventListener?(f.touch&&x.addEventListener("touchstart",M,!1),f.transitions&&(x.addEventListener("webkitTransitionEnd",M,!1),x.addEventListener("msTransitionEnd",M,!1),x.addEventListener("oTransitionEnd",M,!1),x.addEventListener("otransitionend",M,!1),x.addEventListener("transitionend",M,!1)),window.addEventListener("resize",M,!1)):window.onresize=function(){e()},{setup:function(){e()},slide:function(n,t){l(),r(n,t)},prev:function(){l(),i()},next:function(){l(),o()},stop:function(){l()},getPos:function(){return b},getNumSlides:function(){return w},kill:function(){l(),x.style.width="",x.style.left="";for(var n=E.length;n--;){var t=E[n];t.style.width="",t.style.left="",f.transitions&&u(n,0,0)}f.addEventListener?(x.removeEventListener("touchstart",M,!1),x.removeEventListener("webkitTransitionEnd",M,!1),x.removeEventListener("msTransitionEnd",M,!1),x.removeEventListener("oTransitionEnd",M,!1),x.removeEventListener("otransitionend",M,!1),x.removeEventListener("transitionend",M,!1),window.removeEventListener("resize",M,!1)):window.onresize=null}}}}module.exports=Swipe},{}],2:[function(_dereq_,module){"use strict";function callableOnce(t,i){var e=0;return i=i||{},function(){return e++,e>1?void log(["This function is only meant to be called once, but it was called ",e," times"].join("")):void t.apply(i,arguments)}}var inherits=_dereq_("./../../inherits/inherits.js"),EventEmitter=_dereq_("./../../event-emitter/src/event-emitter"),log=_dereq_("./../../debug/debug.js")("auth"),bind=_dereq_("./util/bind"),Auth=module.exports=function(){var t,i=!1,e=!1;EventEmitter.apply(this),this._delegate=!1;var o=function(i){return i?t&&t[i]:t};this.on("login",function(o){t=o,i=!0,e=!0}),this.on("authenticate",function(){e=!0}),this.on("logout",function(){t=null,i=!1,e=!1}),this.on("error",function(t){log(t)}),this.get=o,this.isAuthenticated=function(){return e}};inherits(Auth,EventEmitter),Auth.prototype.delegate=function(t){return log("Auth#delegate",t),this._delegate={},t.login&&(this._delegate.login=bind(t.login,t)),t.logout&&(this._delegate.logout=bind(t.logout,t)),t.viewProfile&&(this._delegate.viewProfile=bind(t.viewProfile,t)),t.editProfile&&(this._delegate.editProfile=bind(t.editProfile,t)),t.forEachAuthentication&&t.forEachAuthentication(bind(function(t){this._authenticate(t)},this)),this.emit("delegate",t),this},Auth.prototype.hasDelegate=function(t){return"string"==typeof t?this._delegate&&this._delegate.hasOwnProperty(t):!!this._delegate},Auth.prototype.login=function(t){if(t&&"function"!=typeof t)return this._loginUser(t);var i=t;log("Auth#login");var e=this._delegate.login,o=bind(callableOnce(function(){this._finishLogin.apply(this,arguments),"function"==typeof i&&i.apply(this,arguments)},this));e(o)},Auth.prototype._loginUser=function(t){this.emit("login",t);for(var i in t)t.hasOwnProperty(i)&&this.emit("login."+i,t[i])},Auth.prototype._finishLogin=function(t,i){return log("Auth#_finishLogin",t,i),t?void this.emit("error",t):(i||log(["_finishLogin called without a truthy second parameter. The user","cannot be authenticated."].join(" ")),void this._authenticate(i))},Auth.prototype.logout=function(t){log("Auth#logout");var i=this._delegate.logout,e=new Error("No logout auth delegate");if(!i){if("function"!=typeof t)throw e;return void t(e)}var o=bind(callableOnce(function(){this._finishLogout.apply(this,arguments),"function"==typeof t&&t.apply(this,arguments)},this));i(o)},Auth.prototype._finishLogout=function(t,i){return log("Auth#_finishLogout",i),t?void this.emit("error",t):void this.emit("logout")},Auth.prototype.authenticate=function(t){this._authenticate(t)},Auth.prototype._authenticate=function(t){if(t){for(var i in t)t.hasOwnProperty(i)&&this.emit("authenticate."+i,t[i]);this.emit("authenticate",t)}},Auth.prototype.viewProfile=function(t){this._delegate.viewProfile(t)},Auth.prototype.editProfile=function(t){this._delegate.editProfile(t)},Auth.prototype.plugin=function(t){return t(this),this}},{"./../../debug/debug.js":6,"./../../event-emitter/src/event-emitter":10,"./../../inherits/inherits.js":11,"./util/bind":4}],3:[function(_dereq_,module,exports){var Auth=_dereq_("./auth"),createAuth=function(e){return new Auth(e)};exports=module.exports=createAuth(),exports.create=createAuth},{"./auth":2}],4:[function(_dereq_,module){module.exports=function(r,t){if(!r)throw new Error;if(arguments.length>2){var n=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(e,n),r.apply(t,e)}}return function(){return r.apply(t,arguments)}}},{}],5:[function(_dereq_,module){function InvalidCharacterError(r){this.message=r}var base64={},chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";InvalidCharacterError.prototype=new Error,InvalidCharacterError.prototype.name="InvalidCharacterError",base64.btoa=window.btoa?function(r){return window.btoa(r)}:function(r){for(var a,e,t=0,o=chars,n="";r.charAt(0|t)||(o="=",t%1);n+=o.charAt(63&a>>8-t%1*8)){if(e=r.charCodeAt(t+=.75),e>255)throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");a=a<<8|e}return n},base64.atob=window.atob?function(r){return window.atob(r)}:function(r){if(r=r.replace(/=+$/,""),r.length%4==1)throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");for(var a,e,t=0,o=0,n="";e=r.charAt(o++);~e&&(a=t%4?64*a+e:e,t++%4)?n+=String.fromCharCode(255&a>>(-2*t&6)):0)e=chars.indexOf(e);return n},base64.url={btoa:function(r){var a=base64.btoa(r);return a=a.replace(/\+/g,"-"),a=a.replace(/\//g,"_")},atob:function(r){var a=r;return a=a.replace(/-/g,"+"),a=a.replace(/_/g,"/"),base64.atob(a)}},module.exports=base64},{}],6:[function(_dereq_,module){function debug(e){return debug.enabled(e)?function(n){n=coerce(n);var u=new Date,o=u-(debug[e]||u);debug[e]=u,n=e+" "+n+" +"+debug.humanize(o),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function coerce(e){return e instanceof Error?e.stack||e.message:e}module.exports=debug,debug.names=[],debug.skips=[],debug.enable=function(e){try{localStorage.debug=e}catch(e){}for(var n=(e||"").split(/[\s,]+/),u=n.length,o=0;u>o;o++)e=n[o].replace("*",".*?"),"-"===e[0]?debug.skips.push(new RegExp("^"+e.substr(1)+"$")):debug.names.push(new RegExp("^"+e+"$"))},debug.disable=function(){debug.enable("")},debug.humanize=function(e){var n=1e3,u=6e4,o=60*u;return e>=o?(e/o).toFixed(1)+"h":e>=u?(e/u).toFixed(1)+"m":e>=n?(e/n|0)+"s":e+"ms"},debug.enabled=function(e){for(var n=0,u=debug.skips.length;u>n;n++)if(debug.skips[n].test(e))return!1;for(var n=0,u=debug.names.length;u>n;n++)if(debug.names[n].test(e))return!0;return!1};try{window.localStorage&&debug.enable(localStorage.debug)}catch(e){}},{}],7:[function(_dereq_,module){function Arc4(){this._state=[],this._index1=0,this._index2=0}Arc4.prototype.setKey=function(t,i){i||(i=t.length);for(var e=this._state,s=0;256>s;++s)e[s]=s;for(var n=0,s=0;256>s;++s){n=n+e[s]+t[s%i]&255;var r=e[s];e[s]=e[n],e[n]=r}this._index1=0,this._index2=0},Arc4.prototype.discard=function(t){for(var i=this._index1,e=this._index2,s=this._state,n=0;t>n;++n){i=i+1&255,e=e+s[i]&255;var r=s[i];s[i]=s[e],s[e]=r}this._index1=i,this._index2=e},Arc4.prototype.crypt=function(t,i){i||(i=t.length);for(var e=this._index1,s=this._index2,n=this._state,r=0;i>r;++r){e=e+1&255,s=s+n[e]&255;var h=n[e];n[e]=n[s],n[s]=h,t[r]^=n[n[e]+n[s]&255]}this._index1=e,this._index2=s},module.exports=Arc4},{}],8:[function(_dereq_,module){function ErefProcessor(e){this._keys=[],Transform.call(this,e)}function map(e,r){for(var t=[],o=0;o=ErefProcessor.BATCH_SIZE&&this.drainBuffer();var t=this;drainAfterWait&&clearTimeout(drainAfterWait),drainAfterWait=setTimeout(function(){t.drainBuffer()},ErefProcessor.TIMEOUT)}},ErefProcessor.prototype.maybeDecrypt=function(e){var r,t=this.getKeys(),o=[];return(r=eref.decryptErefs(e,t))?(o.push(r),o):void(encryptedSet[e.join()]||(encrypted.push(e),encryptedSet[e.join()]=!0))},ErefProcessor.prototype.processStorage=function(){for(var e=0;e255;)t[n++]=255&e,e>>=8;t[n++]=e}return t}function byteArrayToString(r){return String.fromCharCode.apply(null,r)}function arc4Decrypt(r,e){var t=new Arc4;return r=stringToByteArray(r),e=base64.atob(e),e=stringToByteArray(e),t.setKey(r),t.crypt(e),byteArrayToString(e)}function decryptEref(r,e){var t=arc4Decrypt(e,r),n=t.match(EREF_REGEX);return n?n[1]:null}var Arc4=_dereq_("./arc4"),base64=_dereq_("./../../base64/base64"),EREF_REGEX=/^eref:\/\/([^:\/]+:[^:\/]+\/[^:\/]+)$/,eref={};eref.decryptEref=function(r,e){for(var t,n=0,f=e.length;f>n;n++)if(t=decryptEref(r,e[n]))return t;return null},eref.decryptErefs=function(r,e){for(var t,n,f=0,a=r.length;a>f;f++)if(t=r[f],n=eref.decryptEref(t,e))return n},module.exports=eref},{"./../../base64/base64":5,"./arc4":7}],10:[function(_dereq_,module){function indexOf(t,e){if(Array.prototype.indexOf)return t.indexOf(e);for(var r=0,n=t.length;n>r;r++)if(t[r]===e)return r;return-1}function forEach(t,e,r){if(null!=t)for(var n=-1,i=t.length;++ni;i++)try{r[i].apply(this,n)}catch(e){switch(t){case"error":try{this.emit("errorOnError",e)}catch(t){throw new Error("event-emitter: There was an exceptionin the errorInOnError listener",e,this)}break;default:this.emit("error",e)}}}},{}],11:[function(_dereq_,module){module.exports=function(){function t(t,o){var r=function(){};r.prototype=o.prototype,t.prototype=new r,t.prototype.constructor=t}return t.parasitically=function(o,r){for(var e,n=t.keys(r.prototype),p=n.length,y=0;p>y;y++)e=n[y],o.prototype[e]||(o.prototype[e]=r.prototype[e])},t.keys=Object.keys||function(){var t=Object.prototype.hasOwnProperty,o=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],e=r.length;return function(n){if("object"!=typeof n&&"function"!=typeof n||null===n)throw new TypeError("Object.keys called on a non-object");var p=[];for(var y in n)t.call(n,y)&&p.push(y);if(o)for(var c=0;e>c;c++)t.call(n,r[c])&&p.push(r[c]);return p}}(),t}()},{}],12:[function(_dereq_,module){function isFyreOld(e){var n="function"==typeof e.loginByCookie,o=window.fyre&&"object"==typeof window.fyre.conv;return!!n&&!!o}function isBetaDelegate(e){var n="function"==typeof e.restoreSession,o=window.Livefyre&&"object"==typeof window.Livefyre.user;return n&&o}function isOld(e){return isFyreOld(e)||isBetaDelegate(e)}function adaptBetaDelegate(e){function n(e,n){"function"==typeof e&&e.apply(this,null,n)}function o(n){var o=new LivefyreUser;n.serverUrl=e.serverUrl,o=authApi.updateUser(o,n),auth.login({livefyre:o})}function t(){auth.emit("logout")}var i={},r=window.Livefyre;return r.user.on("login",o),r.user.on("logout",t),i.login=function(){var o=e.login;return function(t){o.call(e),r.user.once("login",function(e){n(t,[e])})}}(),i.logout=function(){var o=e.logout;return function(t){o.call(e),r.user.once("logout",function(){n(t)})}}(),i.viewProfile=bind(e.viewProfile,e),i.editProfile=bind(e.editProfile,e),i.destroy=function(){r.user.removeListener("login",o),r.user.removeListener("logout",t),e.destroy()},i}function adaptOldDelegate(e){function n(e,n){return n?void auth.login({livefyre:session.get()}):auth.emit("logout")}function o(e){return{success:function(){"function"==typeof e&&e.apply(this,null,arguments)},failure:function(){"function"==typeof e&&e.apply(this,arguments)}}}var t=window.fyre;t.conv.user.on("change:token",n),t.conv.user.id&&(auth.get("livefyre")||n(t.conv.user.get("token")));var i={success:function(){},failure:function(){}},r=Array.prototype.slice,u={};return u.login=function(){var n=e.login;return function(t){n.call(e,o(t))}}(),u.logout=function(){var n=e.logout;return function(o){n.call(e,i),o()}}(),u.viewProfile=function(){var n=e.viewProfile;return function(){var o=r.call(arguments);o.unshift(i),n.apply(e,o)}}(),u.editProfile=function(){var n=e.editProfile;return function(){var o=r.call(arguments);o.unshift(i),n.apply(e,o)}}(),u.destroy=function(){t.conv.user.off("change:token",n)},e.loginByCookie(i),u}function oldToNew(e){return isBetaDelegate(e)?adaptBetaDelegate(e):isFyreOld(e)?adaptOldDelegate(e):e}var auth=_dereq_("./../../auth/src/main"),authApi=_dereq_("./auth-api"),bind=_dereq_("./../../mout/src/function/bind"),LivefyreUser=_dereq_("./user"),session=_dereq_("./session");module.exports={oldToNew:oldToNew,isOld:isOld}},{"./../../auth/src/main":3,"./../../mout/src/function/bind":26,"./auth-api":13,"./session":16,"./user":17}],13:[function(_dereq_,module){function jsonpError(r){var e=r&&r.code;if(200!==e){var t=new Error("Error requesting with JSONP");return t.response=r,t.code=e,t}}function extend(r){for(var e,t=[].slice.call(arguments,1),o=0,n=t.length;n>o;o++){e=t[o];for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i])}return r}function qsParam(r,e){var t="{key}={value}".replace("{key}",r).replace("{value}",encodeURIComponent(e));return t}function networkFromToken(r){var e=r.split(".");if(3!==e.length)throw new Error("The provided lftoken is not a JWT: "+r);var t=base64.atob(e[1]),o=JSON.parse(t),n=o.domain;return n}function getDomain(r){return r.split(".")[0]}function serverUrlFromNetwork(r){var e=getDomain(r),t="http:"!==document.location.protocol?"https:":document.location.protocol;return"livefyre"===e?t+"//admin."+r:t+"//"+e+".admin.fyre.co"}function serverUrlFromToken(r){var e=networkFromToken(r);return serverUrlFromNetwork(e)}var base64=_dereq_("./../../base64/base64"),CollectionAuthorization=_dereq_("./collection-authorization"),filter=_dereq_("./../../mout/src/array/filter"),jsonp=_dereq_("./util/jsonp"),map=_dereq_("./../../mout/src/array/map"),authApi=module.exports={};authApi.authenticate=function(r,e){var t,o,n=[],i=r&&r.token,a=r&&r.serverUrl;i&&n.push(qsParam("lftoken",r.token)),r.network&&(a=serverUrlFromNetwork(r.network)),a||(a=i?serverUrlFromToken(i):"http://livefyre.com"),r.bpChannel&&n.push(qsParam("bp_channel",r.bpChannel)),r.articleId&&r.siteId&&n.push(qsParam("articleId",base64.btoa(r.articleId)),qsParam("siteId",r.siteId)),t=n.join("&"),o=[a,"/api/v3.0/auth/?",t].join(""),this._request(o,function(r,t){r||(r=jsonpError(t));var o=t&&t.data;e(r,o)})},authApi._request=function(r,e){jsonp.req(r,e)},authApi.updateUser=function(r,e,t){var o,n=e.profile,i=e.token,a=i&&i.value,s=i&&new Date(+new Date+1e3*i.ttl),u=e.collection_id,l=extend({},n,{serverUrl:e.serverUrl,token:a,tokenExpiresAt:s});r.set(l);var c=[];u&&(o=this.createCollectionAuthorization(t||{},e),o&&c.push(o));var p=this.createNetworkAuthorizations(e);p.length>0&&c.push.apply(c,p);var h=this.createSiteAuthorizations(e);h.length>0&&c.push.apply(c,h);var d=filter(c,function(e){return e.network?!r.isMod({network:e.network}):e.siteId?!r.isMod({siteId:e.siteId}):!(!e.collection||!e.collection.id||r.isMod({collectionId:e.collection.id}))});return d.length>0&&r.authorizations.push.apply(r.authorizations,d),r},authApi.createCollectionAuthorization=function(r,e){var t={network:r.network,id:e.collection_id,siteId:r.siteId,articleId:r.articleId},o=new CollectionAuthorization(t),n=e.permissions,i=n&&n.authors;i&&i.length>0&&o.authors.push.apply(o.authors,i);var a=n&&n.moderator_key;return a&&(o.moderatorKey=a),o},authApi.createNetworkAuthorizations=function(r){var e=r.modScopes,t=e&&e.networks;if(!(t&&t.length>0))return[];var o=map(t,function(r){var e={network:r,moderator:!0};return e});return o},authApi.createSiteAuthorizations=function(r){var e=r.modScopes,t=e&&e.sites;if(!(t&&t.length>0))return[];var o=map(t,function(r){var e={siteId:r,moderator:!0};return e});return o}},{"./../../base64/base64":5,"./../../mout/src/array/filter":21,"./../../mout/src/array/map":22,"./collection-authorization":14,"./util/jsonp":18}],14:[function(_dereq_,module){module.exports=function(o){this.collection=o,this.authors=[],this.moderatorKey=null}},{}],15:[function(_dereq_,module){"use strict";function validateCollection(r){for(var e=["siteId","articleId","network"],t=0,o=e.length;o>t;t++){var i=e[t];if(!r[i])throw collectionOptError(i,r)}}function collectionOptError(r,e){var t=new Error("Missing Collection option "+r);return t.collection=e,t.missingOption=r,t}var authApi=_dereq_("./auth-api"),map=_dereq_("./../../mout/src/array/map"),session=_dereq_("./session"),permissions=module.exports={};permissions.forCollection=function(r,e,t){validateCollection(e);var o={};o.token=r.get("token"),o.serverUrl=r.get("serverUrl"),o.siteId=e.siteId,o.articleId=e.articleId,authApi.authenticate(o,function(r,e){return r?t(r):e.profile?(e.serverUrl=o.serverUrl,void t(null,e)):(r=new Error("fetch-user got empty auth response"),t(r))})},permissions.getKeys=function(r,e,t){function o(r){var e=map(r.authors,function(r){return r.key});return r.moderatorKey?e.concat([r.moderatorKey]):e}var i=r.getAuthorizationByCollectionId(e.id);return i?t(null,o(i)):void permissions.forCollection(r,e,function(n,s){return n?t(n):(authApi.updateUser(r,s),session.save(s,r),i=r.getAuthorizationByCollectionId(e.id),void t(null,o(i)))})}},{"./../../mout/src/array/map":22,"./auth-api":13,"./session":16}],16:[function(_dereq_,module){{var authApi=_dereq_("./auth-api"),deepClone=_dereq_("./../../mout/src/lang/deepClone"),LivefyreUser=_dereq_("./user"),storage=_dereq_("./util/storage"),AUTH_COOKIE_KEY="fyre-auth",AUTH_CREDS="fyre-authentication-creds";module.exports={get:function(){var e=storage.get(AUTH_COOKIE_KEY)||{};if(!e.token)return null;var r=new LivefyreUser;return authApi.updateUser(r,e),r},save:function(e,r){var t=deepClone(e),a=e.token,o=+new Date+1e3*a.ttl;r&&(t.mod_map=r.get("modMap")),storage.set(AUTH_COOKIE_KEY,t,o);var n=e.token;n&&storage.set(AUTH_CREDS,n.value,+new Date+1e3*n.ttl)},clear:function(){storage.remove(AUTH_COOKIE_KEY),storage.remove(AUTH_CREDS)}}}},{"./../../mout/src/lang/deepClone":31,"./auth-api":13,"./user":17,"./util/storage":19}],17:[function(_dereq_,module){function LivefyreUser(){this._attributes={},this.authorizations=[],EventEmitter.call(this)}function isModByCollectionInfo(t){var e=some(this.authorizations,function(e){var i=e.collection;return Boolean(i&&e.moderatorKey&&i.network===t.network&&i.siteId===t.siteId&&i.articleId===t.articleId)});return e}function isModByCollectionId(t){var e=this.getAuthorizationByCollectionId(t);return Boolean(e&&e.moderatorKey)}function isModByNetwork(t){var e=some(this.authorizations,function(e){var i=e.network;return i&&i===t&&e.moderator});return e}function isModBySiteId(t){var e=some(this.authorizations,function(e){var i=e.siteId;return i&&i===t&&e.moderator});return e}var EventEmitter=_dereq_("./../../event-emitter/src/event-emitter"),inherits=_dereq_("./../../inherits/inherits.js"),some=_dereq_("./../../mout/src/array/some");inherits(LivefyreUser,EventEmitter),LivefyreUser.EVENTS={CHANGE:"change"},LivefyreUser.prototype.set=function(t,e){var i,r,o;"string"==typeof t&&(i=t,t={},t[i]=e);for(r in t)t.hasOwnProperty(r)&&(o=t[r],this._attributes[r]=o,this.emit(LivefyreUser.EVENTS.CHANGE+":"+r,o));this.emit(LivefyreUser.EVENTS.CHANGE,t)},LivefyreUser.prototype.get=function(t){return t?this._attributes[t]:this._attributes},LivefyreUser.prototype.unset=function(t){if(t in this._attributes){delete this._attributes[t];var e={};e[t]=void 0,this.emit(LivefyreUser.EVENTS.CHANGE+":"+t,e[t])}},LivefyreUser.prototype.isAuthenticated=function(){return!!this.get("id")},LivefyreUser.prototype.getAuthorizationByCollectionId=function(t){for(var e,i,r=0;r0?"&":"?";window[r]=function(e){t(),n(null,e)},o.type="text/javascript",o.async=!0,o.onerror=function(){t(),n("error")},o.src=e+a+"callback="+r,document.getElementsByTagName("head")[0].appendChild(o)}module.exports={req:req}},{}],19:[function(_dereq_,module){var STORAGE_AVAILABLE_KEY="__lfstorage__",canUseLocalStorage=function(){try{var e=localStorage||null;return e.setItem(STORAGE_AVAILABLE_KEY,"1"),e.removeItem(STORAGE_AVAILABLE_KEY),!0}catch(e){return!1}}(),html5Storage={set:function(e,t,r){try{localStorage.setItem(e,JSON.stringify({value:t,expiration:r||null}))}catch(e){}},get:function(e){try{var t=localStorage.getItem(e),r=t?JSON.parse(t):{};return r.expiration&&r.expiration<+new Date?void html5Storage.remove(e):r.value}catch(e){return}},remove:function(e){try{localStorage.removeItem(e)}catch(e){}}},cookieStorage={set:function(e,t,r){function o(e){return new Date(e).toUTCString()}var n,a=6048e5;n=r>0?o(r):0===r?";expires="+new Date(1970,1,1).toUTCString():+new Date+a,document.cookie=e+"="+JSON.stringify({value:t,expiration:n})},get:function(e){function t(){return document.cookie.split(/\s*;\s*/)}for(var r,o=e+"=",n=t(),a=0;r=n[a];++a){if(0===r.lastIndexOf(o,0))return r.substr(o.length);if(r===e)return""}},remove:function(e){cookieStorage.set(e,"",0)}};module.exports=canUseLocalStorage?html5Storage:cookieStorage},{}],20:[function(_dereq_,module){"use strict";var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),loader={},CLASSES={NOT_SUPPORTED:"lf-not-supported"},SIZES={MINI:"mini",SMALL:"small",LARGE:"large"},CLASS_PREFIX="lf-",DEFAULT_SIZE=SIZES.SMALL,LOADER_DOM=['
',"
","
"].join(""),VALID_SIZES=[SIZES.MINI,SIZES.SMALL,SIZES.LARGE];loader.isSupported=function(){return!(navigator.userAgent.match(/MSIE ([0-9]+)\./)&&RegExp.$1<=9)},loader.decorate=function(d,S){var i=$(LOADER_DOM);if($(d).html("").append(i),!loader.isSupported())return void i.html("").addClass(CLASSES.NOT_SUPPORTED);if(!S)return void i.addClass(CLASS_PREFIX+DEFAULT_SIZE);if("string"==typeof S)return-1===VALID_SIZES.indexOf(S)&&(S=DEFAULT_SIZE),void i.addClass(CLASS_PREFIX+S);if("number"==typeof S)return S%3!==0?void i.addClass(CLASS_PREFIX+DEFAULT_SIZE):void i.height(S).width(S);throw S+" is not a valid argument."},module.exports=loader},{"./../../../node_modules/jquery/dist/jquery":97}],21:[function(_dereq_,module){module.exports=function(r){function n(n,e,t){e=r(e,t);var u=[];if(null==n)return u;for(var o,f=-1,i=n.length;++f2,o=e;if(null==r||!r.length){if(t)return e;throw new Error("reduce of empty array with no initial value")}for(var u=-1,i=r.length;++ut?Math.max(r+t,0):Math.min(t,r),a=null==a?r:0>a?Math.max(r+a,0):Math.min(a,r);for(var u=[];a>t;)u.push(n[t++]);return u}return n}()},{}],25:[function(_dereq_,module){module.exports=function(r){function e(e,n,t){n=r(n,t);var u=!1;if(null==e)return u;for(var o=-1,f=e.length;++oa;a++)t[a]();delete t[e]},existsOnPage=function(e,t,a,l){var n,c=l||document,o=0,r=c.getElementsByTagName(e),d=r.length;for(a=a.toLowerCase();d>o;o++)if(n=r[o],"string"==typeof n[t]&&n[t].toLowerCase().indexOf(a)>-1)return!0;return!1};module.exports=Loader},{"./object":43}],45:[function(_dereq_,module){module.exports=function(e,i,l,t){function a(l){e.call(this,l),i.call(this,l),l&&l.readable===!1&&(this.readable=!1),l&&l.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,l&&l.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",r)}function r(){var e=this;this.allowHalfOpen||this._writableState.ended||l.nextTick(function(){e.end()})}return t(a,e),t.parasitically(a,i),a}(_dereq_("./readable"),_dereq_("./writable"),_dereq_("./util"),_dereq_("inherits"))},{"./readable":46,"./util":49,"./writable":50,inherits:96}],46:[function(_dereq_,module){module.exports=function(e,t,i,r){"use strict";function n(t){t=t||{},t.objectMode=!0,this._readableState=new a(t,this),this.readable=!0,e.call(this)}function a(e){e=e||{};var i=e.highWaterMark;this.highWaterMark=i||0===i?i:0,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.pipes=[],this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null}return r(n,e),n.prototype.pipe=function(e,r){function n(e){e===b&&d()}function a(){e.end()}function d(){e.removeListener("close",s),e.removeListener("finish",h),e.removeListener("drain",g),e.removeListener("error",l),e.removeListener("unpipe",n),b.removeListener("end",a),b.removeListener("end",d),b.removeListener("data",o),!c.awaitDrain||e._writableState&&!e._writableState.needDrain||g()}function o(t){var i=e.write(t);i===!1&&(b._readableState.awaitDrain++,b.pause())}function l(t){u(),0===i.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",h),u()}function h(){e.removeListener("close",s),u()}function u(){b.unpipe(e)}var f,p,b=this,c=this._readableState;c.pipes.push(e),f=!r||r.end!==!1,p=f?a:d,c.endEmitted?t.nextTick(p):b.once("end",p),e.on("unpipe",n);var g=this._pipeOnDrain();return e.on("drain",g),b.on("data",o),e.once("error",l),e.once("close",s),e.once("finish",h),e.emit("pipe",b),c.flowing||b.resume(),e},n.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipes.length)return this;if(1===t.pipes.length)return e&&e!==t.pipes[0]?this:(e||(e=t.pipes[0]),t.pipes=[],t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var i=t.pipes,r=i.length;t.pipes=[],t.flowing=!1;for(var n=0;r>n;n++)i[n].emit("unpipe",this);return this}var a=t.pipes.indexOf(e);return-1===a?this:(t.pipes.splice(a,1),e.emit("unpipe",this),this)},n.prototype._pipeOnDrain=function(){var e=this;return function(){var t=e._readableState;t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i.listenerCount(e,"data")&&(t.flowing=!0,e._flow())}},n.prototype._flow=function(){var e,t=this._readableState;if(t.flowing)do e=this.read();while(null!==e&&t.flowing)},n.prototype.push=function(){var t=Array.prototype.slice.call(arguments);return this._addToBuffer.apply(this,[!1].concat(t))},n.prototype.unshift=function(){var t=Array.prototype.slice.call(arguments);return this._addToBuffer.apply(this,[!0].concat(t))},n.prototype._addToBuffer=function(e,t){var i=Array.prototype.slice.call(arguments,1),r=this._readableState;return null===t?(r.reading=!1,r.ended||this._endReadable()):r.ended&&!e?this.emit("error",new Error("readable.push() called after EOF")):r.endEmitted&&e?this.emit("error",new Error("readable.unshift() called after end event")):(e?r.buffer.unshift.apply(r.buffer,i):(r.reading=!1,r.buffer.push.apply(r.buffer,i)),t&&r.needReadable&&this._emitReadable(),this._maybeReadMore()),!r.ended&&(r.needReadable||r.buffer.length0)&&(r.emittedReadable=!1),0===e&&r.needReadable&&(r.buffer.length>=r.highWaterMark||r.ended)?(0===r.buffer.length&&r.ended?this._endReadable():this._emitReadable(),null):(e=this._getSizeToRead(e),0===e&&r.ended?(0===r.buffer.length&&this._endReadable(),null):(t=r.needReadable,(0===r.buffer.length||r.buffer.length-e0?this._readFromBuffer(e):null,null===i&&(r.needReadable=!0,e=0),0!==r.buffer.length||r.ended||(r.needReadable=!0),r.ended&&!r.endEmitted&&0===r.buffer.length&&this._endReadable(),null!==i&&this.emit("data",i),i))},n.prototype._read=function(){this.emit("error",new Error("._read() not implemented"))},n.prototype._readFromBuffer=function(){var e=this._readableState,t=e.buffer;return 0===t.length?null:t.shift()},n.prototype._getSizeToRead=function(e){var t=this._readableState;return 0===t.buffer.length&&t.ended?0:0===e?0:1},n.prototype._emitReadable=function(){function e(){i.emit("readable"),i._flow()}var i=this,r=this._readableState;r.needReadable=!1,r.emittedReadable||(r.emittedReadable=!0,r.sync?t.nextTick(e):e())},n.prototype._endReadable=function(){var e=this._readableState;e.ended=!0,e.buffer.length?this._emitReadable():this._emitEnd()},n.prototype._emitEnd=function(){var e=this,i=this._readableState;if(i.buffer.length>0)throw new Error("Tried to emit end event on a non-empty Readable");!i.endEmitted&&i.calledRead&&(i.ended=!0,t.nextTick(function(){i.endEmitted||0!==i.buffer.length||(i.endEmitted=!0,e.readable=!1,e.emit("end"))}))},n}(_dereq_("./stream"),_dereq_("./util"),_dereq_("./../../event-emitter/src/event-emitter"),_dereq_("inherits"))},{"./../../event-emitter/src/event-emitter":10,"./stream":47,"./util":49,inherits:96}],47:[function(_dereq_,module){module.exports=function(e,t){"use strict";function r(){t.call(this)}return e(r,t),r}(_dereq_("inherits"),_dereq_("./../../event-emitter/src/event-emitter"))},{"./../../event-emitter/src/event-emitter":10,inherits:96}],48:[function(_dereq_,module){module.exports=function(r,t){function n(t){var n,i=this;r.call(this,t),n=this._transformState=new e(t,this),this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof i._flush?i._flush(function(){i._doneTransforming(err)}):i._doneTransforming()})}function e(r,t){this.afterTransform=function(r,n){return t._afterTransform(r,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}return t(n,r),n.prototype._transform=function(){this.emit("error",new Error("_transform not implemented!"))},n.prototype.push=function(){return this._transformState.needTransform=!1,r.prototype.push.apply(this,arguments)},n.prototype._read=function(){var r=this._transformState;null!==r.writechunk&&r.writecb&&!r.transforming?(r.transforming=!0,this._transform(r.writechunk,r.afterTransform)):r.needTransform=!0},n.prototype._write=function(r,t){var n=this._transformState,e=this._readableState;n.writecb=t,n.writechunk=r,n.transforming||(n.needTransform||e.needReadable||e.buffer.lengtht&&(t=null)}return t},c.prototype._getBootstrapClientOptions=function(){return{environment:this._collection.environment,network:this._collection.network,siteId:this._collection.siteId,articleId:this._collection.articleId,page:this._nextPage}},c.prototype._contentsFromBootstrapDoc=function(t,e){e=e||{},t=t||{};var r,o,n,i=this,a=t.content||[],c=[];this._collection&&(t.collection=this._collection);var u=this._createStateToContent(t);u.on("data",function(t){t&&-1===i._contentIdsInHeadDocument.indexOf(t.id)&&(e.isHead&&t.id&&i._contentIdsInHeadDocument.push(t.id),c.push(t))});for(var _=0,p=a.length;p>_;_++)r=a[_],o=r.content&&r.content.id,o&&-1!==this._contentIdsInHeadDocument.indexOf(o)||(n=u.write(r));return c=this._sortContents(c),s("created contents from bootstrapDoc",c),c},c.prototype._sortContents=function(t){var e,r;return e=this._comparator===c.comparators.CREATED_AT_ASCENDING?function(t,e){return t.createdAt-e.createdAt}:function(t,e){return e.createdAt-t.createdAt},r=t.sort(e)},c.prototype._createStateToContent=function(t){return t=t||{},t.replies=this._replies,new o(t)},c}(_dereq_("./../../jquery"),_dereq_("./../../../../stream/src/readable"),_dereq_("./../clients/bootstrap-client"),_dereq_("./../../content/state-to-content"),_dereq_("./../../debug"),_dereq_("./../../../../stream/src/util"),_dereq_("inherits"))},{"./../../../../stream/src/readable":46,"./../../../../stream/src/util":49,"./../../content/state-to-content":68,"./../../debug":77,"./../../jquery":78,"./../clients/bootstrap-client":54,inherits:96}],62:[function(_dereq_,module){module.exports=function(t,e,n,o,r,i){"use strict";var s=r("streamhub-sdk/collection/streams/featured-archive"),a=function(t){t=t||{},this._collection=t.collection,this._fetchedHead=!1,this._bootstrapClient=t.bootstrapClient||new n,this._contentIdsInHeadDocument=[],e.call(this,t)};return i(a,e),a.prototype._read=function(){var t=this;return s("_read","Buffer length is "+this._readableState.buffer.length),this._fetchedHead?null===this._nextPage?this.push(null):void(this._nextPage&&this._readNextPage()):this._collection.initFromBootstrap(function(e,n){var o=n.featured;if(!o)return t.push(null);t._nextPage=o.isComplete?null:"featured-all";var r=t._contentsFromBootstrapDoc(o,{isHead:!0});t._fetchedHead=!0,t.push.apply(t,r)})},a.prototype._readNextPage=function(){var t=this,e=this._getBootstrapClientOptions();this._nextPage=null,this._bootstrapClient.getContent(e,function(n,o){if(n||!o)return void t.emit("error",new Error("Error requesting Bootstrap page "+e.page));var r=t._contentsFromBootstrapDoc(o);return r.length?void t.push.apply(t,r):t._read()})},a.prototype._getBootstrapClientOptions=function(){return{environment:this._collection.environment,network:this._collection.network,siteId:this._collection.siteId,articleId:this._collection.articleId,page:this._nextPage}},a.prototype._contentsFromBootstrapDoc=function(t,e){e=e||{},t=t||{};var n,r,i=this,a=t.content||[],c=new o(t),l=[];c.on("data",function(t){t&&-1===i._contentIdsInHeadDocument.indexOf(t.id)&&(e.isHead&&t.id&&i._contentIdsInHeadDocument.push(t.id),l.push(t))});for(var u=0,d=a.length;d>u;u++)n=a[u],r=c.write(n);return s("created contents from bootstrapDoc",l),l},a}(_dereq_("./../../jquery"),_dereq_("./../../../../stream/src/readable"),_dereq_("./../clients/bootstrap-client"),_dereq_("./../../content/state-to-content"),_dereq_("./../../debug"),_dereq_("inherits"))},{"./../../../../stream/src/readable":46,"./../../content/state-to-content":68,"./../../debug":77,"./../../jquery":78,"./../clients/bootstrap-client":54,inherits:96}],63:[function(_dereq_,module){module.exports=function(t,e,n,r,o,i,a,s){"use strict";var c=s("streamhub-sdk/collection/streams/updater"),l=function(t){t=t||{},this._collection=t.collection,this._streamClient=t.streamClient||new o,this._request=null,this._replies=t.replies||!1,t.createStateToContent&&(this._createStateToContent=t.createStateToContent),t.createAnnotator&&(this._createAnnotator=t.createAnnotator),e.call(this,t)};return t(l,e),l.prototype._read=function(){var t=this;return c("_read","Buffer length is "+this._readableState.buffer.length),this._latestEvent&&this._collection.id?void t._stream():this._collection.initFromBootstrap(function(e,n){var r=n.collectionSettings,o=n.headDocument,i=o&&o.event;if(i=i||r&&r.event,!t._collection.id)throw new Error("Couldn't get Collection ID after initFromBootstrap");if(void 0===i)throw new Error("Couldn't get latestEvent after initFromBootstrap");t._latestEvent=i,t._stream()})},l.prototype._stream=function(){var t=this,e=this._streamClient,r=this._getStreamClientOptions(),o=e.getContent(r,function(e,r){function o(){t.push(),n.nextTick(function(){t.read(0)})}if(e&&"abort"===e.message)return c("stream request aborted"),void t.push();if(e)return t.emit("error",e);if(r.timeout)return c("long poll timeout, requesting again on next tick"),o();var i=t._contentsFromStreamData(r);return t._latestEvent=r.maxEventId,i.length?void t.push.apply(t,i):o()});this._request=o},l.prototype.pause=function(){return this._request&&(this._request.abort(),this._request=null),e.prototype.pause.apply(this,arguments)},l.prototype._contentsFromStreamData=function(t){var e,n,r,o=this._createAnnotator(),i=t.annotations,a=[],s=t.states,c=this._createStateToContent(t);c.on("data",function(t){a.push(t)});for(n in s)s.hasOwnProperty(n)&&(r=s[n],c.write(r));for(n in i)i.hasOwnProperty(n)&&(e=i[n],o.write({contentId:n,annotationDiff:e}));return a},l.prototype._getStreamClientOptions=function(){return{collectionId:this._collection.id,network:this._collection.network,environment:this._collection.environment,commentId:this._latestEvent}},l.prototype._createStateToContent=function(t){return t=t||{},t.replies=this._replies,t.collection=this._collection,new i(t)},l.prototype._createAnnotator=function(){return new a},l}(_dereq_("inherits"),_dereq_("./../../../../stream/src/readable"),_dereq_("./../../../../stream/src/util"),_dereq_("./../clients/bootstrap-client"),_dereq_("./../clients/stream-client"),_dereq_("./../../content/state-to-content"),_dereq_("./../../content/annotator"),_dereq_("./../../debug"))},{"./../../../../stream/src/readable":46,"./../../../../stream/src/util":49,"./../../content/annotator":66,"./../../content/state-to-content":68,"./../../debug":77,"./../clients/bootstrap-client":54,"./../clients/stream-client":57,inherits:96}],64:[function(_dereq_,module){module.exports=function(t,e,i,n){"use strict";var o=function(i){this._collection=i.collection,this._writeClient=i.writeClient||new e,t.call(this,i)};return n(o,t),o.prototype._write=function t(e,n){var o=this,r=this._collection,l=i.getToken(),a=this._writeClient.postContent,c=e.attachments&&e.attachments.length;if(!l)throw new i.UnauthorizedError("Collection cannot write until streamhub-sdk/auth.setToken has been called");if(!r.id)return r.initFromBootstrap(function(){t.call(o,e,n)});var s={body:e.body,collectionId:r.id,environment:r.environment,lftoken:i.getToken(),network:r.network};if(c){var d;s.media=[];for(var h=0;c>h;h++)d=e.attachments[h],"function"==typeof d.toJSON&&(d=d.toJSON()),s.media.push(d)}e.parentId&&(s.parent_id=e.parentId),e.tweetId&&(a=this._writeClient.postTweet,s.tweetId=e.tweetId),a.call(this._writeClient,s,function(t,i){return t?n(t):(e.set({collection:this._collection,id:i.data.messages[0].content.id}),void n())}.bind(this))},o}(_dereq_("./../../../../stream/src/writable"),_dereq_("./../clients/write-client"),_dereq_("./../../auth/main"),_dereq_("inherits"))},{"./../../../../stream/src/writable":50,"./../../auth/main":53,"./../clients/write-client":58,inherits:96}],65:[function(_dereq_,module){module.exports=function(){"use strict";function t(t){return t.value===i.vote.DOWNVOTE?1:0}function e(t){return t.value===i.vote.UPVOTE?1:0}function o(o,s,v){v&&(o.upvotes-=e(v),o.downvotes-=t(v)),s&&(o.upvotes+=e(s),o.downvotes+=t(s)),o.helpfulness=o.upvotes-o.downvotes}function s(t,e){for(var o=0,s=t.length;s>o;o++)if(t[o].author===e.author)return o;return-1}function v(t,e,v){var n,u=v.votes=v.votes||{},r=v.votes.list=v.votes.list||[];u.upvotes=u.upvotes||0,u.downvotes=u.downvotes||0,u.helpfulness=u.helpfulness||0;for(var i=0,f=e.length;f>i;i++)n=e[i],s(r,n)>-1||(r.push(n),o(u,n));t.votes=u}function n(t,e,v){for(var n,u,r,i=v.votes,f=v.votes.list,l=0,a=f.length;a>l;l++)u=f[l],n=s(e,u),-1!==n&&(r=e[n],o(i,r,u),f[l]=r);t.votes=i}function u(t,e,v){var n=v.votes,u=v.votes.list;u=u.filter(function(t){return-1===s(e,t)||(o(n,!1,t),!1)}),v.votes.list=u,t.votes=v.votes}function r(t){t.added.vote=v,t.updated.vote=n,t.removed.vote=u}var i={};return i.vote={UNSET:0,UPVOTE:1,DOWNVOTE:2},i.voteToCount={0:0,1:1,2:-1},{withVotes:r,voteEnums:i}}()},{}],66:[function(_dereq_,module){module.exports=function(e,t,o,r){"use strict";var d=function(e){e=e||{},o.call(this,e)};return r(d,o),d.prototype.annotate=function(e,o,r){var d,n,a,p,i,u={};for(i in o)if(o.hasOwnProperty(i)&&(n=o[i],t.objectKeys(n).length))for(a in n)n.hasOwnProperty(a)&&(d=n[a],p=this[i][a],p&&p(u,d,e));e.set(u,r)},d.prototype._write=function(t){var o=t.content||e.get(t.contentId);o&&this.annotate(o,t.annotationDiff,t.silence)},d.prototype.added={},d.prototype.updated={},d.prototype.removed={},d.prototype.added.featuredmessage=function(e,t){e.featured=t},d.prototype.updated.featuredmessage=d.prototype.added.featuredmessage,d.prototype.removed.featuredmessage=function(e){e.featured=!1},d.prototype.added.sortOrder=function(e,t){e.sortOrder=t},d.prototype.updated.sortOrder=function(e,t){e.sortOrder=t},d.prototype.removed.sortOrder=function(e){e.sortOrder=null},d.prototype.added.moderator=function(e){e.moderator=!0},d.prototype.removed.moderator=function(e){e.moderator=!1},d.prototype.added.geocode=function(e,t){e.geocode=t},d}(_dereq_("./../storage"),_dereq_("./../util"),_dereq_("./../../../stream/src/writable"),_dereq_("inherits"))},{"./../../../stream/src/writable":50,"./../storage":79,"./../util":80,inherits:96}],67:[function(_dereq_,module){module.exports=function(t,e,i){"use strict";var n=function(t){var i=t,s={};e.call(this),"object"==typeof t&&(i=i.body,s=t),this.body=i;var r="number"==typeof s.visibility?s.visibility:"number"==typeof s.vis?s.vis:1;this.visibility=n.enums.visibility[r],this.attachments=s.attachments||[],this.replies=s.replies||[],this.opines=s.opines||[]};return i(n,e),n.prototype.typeUrn="urn:livefyre:js:streamhub-sdk:content",n.prototype.addAttachment=function(t){this.attachments.push(t),this.emit("attachment",t)},n.prototype.removeAttachment=function(t){this.attachments.splice(this.attachments.indexOf(t),1),this.emit("removeAttachment",t)},n.prototype.addReply=function(t){this.replies.push(t),this.emit("reply",t)},n.prototype.set=function(t,e){t=t||{};var i,s,n,r={};for(var h in t)t.hasOwnProperty(h)&&"_"!==h.charAt(0)&&(i=r[h]=this[h],s=this[h]=t[h],s===i&&"object"!=typeof s||(e||this.emit("change:"+h,s,i),n=!0));n&&(e||this.emit("change",t,r))},n.enums={},n.enums.visibility=["NONE","EVERYONE","OWNER","GROUP"],n}(_dereq_("./../jquery"),_dereq_("./../../../event-emitter/src/event-emitter"),_dereq_("inherits"))},{"./../../../event-emitter/src/event-emitter":10,"./../jquery":78,inherits:96}],68:[function(_dereq_,module){module.exports=function(t,e,r,n,o,i,a,s,c,d,p){"use strict";function h(t){var e=/\/\/instagram\.com/i;try{return t.content.feedEntry.channelId.match(e)}catch(t){return!1}}var l=c("streamhub-sdk/content/state-to-content"),u=function(t){t=t||{},this._authors=t.authors||{},this._replies=t.replies,this._collection=t.collection,this._storage=t.storage||s,d.call(this,t)};return p(u,d),u.prototype._transform=function(t,e){var r;try{r=this.transform(t,this._authors,{replies:this._replies,collection:this._collection})}catch(t){this.emit("error transforming state-to-content",t),l("StateToContent.transform threw",t)}r&&r.length&&this.push.apply(this,r),e()},u.prototype.transform=function(t,e,r){r=r||{};var n,o="undefined"==typeof t.vis||1===t.vis,i=t.content.parentId,a=u.enums.type[t.type],s="OEMBED"===a,c="CONTENT"===a,d="OPINE"===a,p=t.childContent||[],h=[],l=[];if(s||c||d){if(n=this._createContent(t,e),n&&r.collection&&(n.collection=r.collection),n&&n.id){var y=this._storage.get(n.id);y?(c&&y.set(this._getUpdatedProperties(n)),n=y):this._storage.set(n.id,n),h=this._storage.get("children_"+n.id)||[]}p=t.childContent||[];for(var _=0,f=p.length;f>_;_++){var g=this.transform(p[_],e,r);l.push.apply(l,g||[])}if(h.length&&this._addChildren(n,h),s&&this._attachOrStore(n,t.content.targetId),i&&this._addReplyOrStore(n,t.content.parentId),d&&this._addOpineOrStore(n,t.content.targetId),!c)return this._handleNonContent(n);if(!o)return this._handleNonPublic(n);if(!i||r.replies)return r.collection&&(n.collection=r.collection),r.replies?[n].concat(l):[n]}},u.transform=function(t,e,r){var n=new u;return n.transform(t,e,r)},u.prototype._addChildren=function(e,r){for(var o,a=0,s=r.length;s>a;a++)o=r[a],o instanceof n?e.addAttachment(o):o instanceof t?e.addReply(o):o instanceof i&&e.addOpine(o)},u._addChildren=u.prototype._addChildren,u.prototype._createContent=function(n,s){var c,d=u.enums.source[n.source];return n.author=s&&s[n.content.authorId],"OEMBED"===u.enums.type[n.type]?new o(n):"OPINE"===u.enums.type[n.type]?new i(n):"twitter"===d?new e(n):"facebook"===d?new r(n):"instagram"===d?new a(n):"feed"===d?(c=t,h(n)&&(c=a),new c(n)):"livefyre"===d?new t(n):void l("StateToContent could not create content for state",n)},u._createContent=u.prototype._createContent,u.prototype._getUpdatedProperties=function(t){var e={visibility:t.visibility};return t.attachments&&t.attachments.length&&(e.attachments=t.attachments),t.body&&(e.body=t.body),t.author&&(e.author=t.author),t.createdAt&&(e.createdAt=t.createdAt),t.updatedAt&&(e.updatedAt=t.updatedAt),e},u._getUpdatedProperties=u.prototype._getUpdatedProperties,u.prototype._attachOrStore=function(t,e){var r=this._storage.get(e);r?(l("attaching attachment",arguments),r.addAttachment(t)):(l("storing attachment",arguments),this._storeChild(t,e))},u._attachOrStore=u.prototype._attachOrStore,u.prototype._addReplyOrStore=function(t,e){var r=this._storage.get(e);r?(l("adding reply",arguments),r.addReply(t)):(l("storing reply",arguments),this._storeChild(t,e))},u._addReplyOrStore=u.prototype._addReplyOrStore,u.prototype._addOpineOrStore=function(t,e){var r=s.get(e);r?(l("attaching attachment",arguments),r.addOpine(t)):(l("storing attachment",arguments),this._storeChild(t,e))},u.prototype._storeChild=function(t,e){var r="children_"+e,n=this._storage.get(r)||[];n.push(t),this._storage.set(r,n)},u._storeChild=u.prototype._storeChild,u.prototype._handleNonPublic=function(){},u.prototype._handleNonContent=function(){},u.enums={},u.enums.source=t.SOURCES,u.enums.type=["CONTENT","OPINE","SHARE","OEMBED"],u.Storage=s,u}(_dereq_("./types/livefyre-content"),_dereq_("./types/livefyre-twitter-content"),_dereq_("./types/livefyre-facebook-content"),_dereq_("./types/oembed"),_dereq_("./types/livefyre-oembed"),_dereq_("./types/livefyre-opine"),_dereq_("./types/livefyre-instagram-content"),_dereq_("./../storage"),_dereq_("./../debug"),_dereq_("./../../../stream/src/transform"),_dereq_("inherits"))},{"./../../../stream/src/transform":48,"./../debug":77,"./../storage":79,"./types/livefyre-content":69,"./types/livefyre-facebook-content":70,"./types/livefyre-instagram-content":71,"./types/livefyre-oembed":72,"./types/livefyre-opine":73,"./types/livefyre-twitter-content":74,"./types/oembed":75,inherits:96}],69:[function(_dereq_,module){module.exports=function(t,e,i,n,o){"use strict";var r=function(t,i){i=i||{},e.call(this),this._likes=0,this._annotator=i.annotator||this._createAnnotator(),t&&(t.content=t.content||{},t.content.annotations=t.content.annotations||{},this.id=t.content.id||t.id,this.author=t.author,this.createdAt=new Date(1e3*t.content.createdAt),this.updatedAt=new Date(1e3*t.content.updatedAt),this.lastVisibility=e.enums.visibility[t.lastVis],this.visibility=e.enums.visibility[t.vis],this.parentId=t.content.parentId,this.meta=t,this._annotator.annotate(this,{added:t.content.annotations},!0)),this.body=t?t.content.bodyHtml:"",this.source=t?r.SOURCES[t.source]:"livefyre"};return o(r,e),r.prototype.typeUrn="urn:livefyre:js:streamhub-sdk:content:types:livefyre",r.prototype._createAnnotator=function(){return new i},r.prototype.addAttachment=function(t){var e=!1;if(t.id)for(var i in this.attachments)this.attachments[i].id===t.id&&(e=!0);e||(this.attachments.push(t),this.emit("attachment",t))},r.prototype.addReply=function(t){var e=!1;if(t.id)for(var i in this.replies)this.replies[i].id===t.id&&(e=!0);e||(this.replies.push(t),this.emit("reply",t))},r.prototype.addOpine=function(t){if(0===t.vis)return void this.removeOpine(t);var e=!1;if(t.id)for(var i=0;i
");return t.append(r),t.html()}var n=function(t){var n;r.call(this,t);try{var n=e(this.body)}catch(e){}n&&n.length&&(n.find(".fyre-image, .fyre-link").remove(),this.body=i(n))};return t(n,r),n.prototype.typeUrn="urn:livefyre:js:streamhub-sdk:content:types:livefyre-facebook",n}(_dereq_("./../../jquery"),_dereq_("./livefyre-content"),_dereq_("inherits"))},{"./../../jquery":78,"./livefyre-content":69,inherits:96}],71:[function(_dereq_,module){module.exports=function(e,r){"use strict";var t=function(r){e.call(this,r)};return r(t,e),t.prototype.typeUrn="urn:livefyre:js:streamhub-sdk:content:types:livefyre-instagram",t}(_dereq_("./livefyre-content"),_dereq_("inherits"))},{"./livefyre-content":69,inherits:96}],72:[function(_dereq_,module){module.exports=function(t,e,r,i){"use strict";var l=function(t){r.call(this,t),e.call(this,t.content.oembed),"Facebook"===this.provider_name&&this.url&&this.thumbnail_url&&(""===this.html||null===this.html)&&(this.html="")};return i(l,e),t.extend(l.prototype,r.prototype),l}(_dereq_("./../../jquery"),_dereq_("./oembed"),_dereq_("./livefyre-content"),_dereq_("inherits"))},{"./../../jquery":78,"./livefyre-content":69,"./oembed":75,inherits:96}],73:[function(_dereq_,module){module.exports=function(e,i,t){"use strict";var r=function(t,n){if(n=n||{},i.call(this,this),t&&1!==t.type)throw new Error("Opines must be constructed with .type == 1 ");t=t||{},e.extend(this,t),void 0===n.opineType&&(this.relType=r.enums.type.indexOf("LIKE"))};return t(r,i),r.enums={},r.enums.type=["LIKE","FLAG_OFFENSIVE","FLAG_SPAM","FLAG_DISAGREE","FLAG_OFF_TOPIC","FLAG_PROFANE",void 0,void 0,void 0,void 0,"ANNOTATION","MODERATION_REASON","IS_SPAM_CONTENT","IS_NOT_SPAM_CONTENT"],r}(_dereq_("./../../jquery"),_dereq_("./../main"),_dereq_("inherits"))},{"./../../jquery":78,"./../main":67,inherits:96}],74:[function(_dereq_,module){module.exports=function(t,e,r,i){"use strict";var o=function(t){r.call(this,t),this.tweetId=o.tweetIdFromLivefyreId(this.id),this.author&&(this.author.twitterUserId=o.twitterUserIdFromLivefyreAuthorId(this.author.id)),this.twitterVerified=o.isVerified(this.meta)};return i(o,r),o.prototype.typeUrn="urn:livefyre:js:streamhub-sdk:content:types:livefyre-twitter",o.isVerified=function(t){var e=t.content.annotations.tweetMeta||{};return e.verified_user||!1},o.tweetIdFromLivefyreId=function(t){var e=/tweet-(\d+)@twitter.com/,r=t.match(e);if(!r)throw new Error("Can't parse tweet ID from Livefyre ID");return r[1]},o.twitterUserIdFromLivefyreAuthorId=function(t){var e=/([^@]+)@twitter.com/,r=t.match(e);if(!r)throw new Error("Can't parse twitterUserId from Livefyre authorId");return r[1]},o}(_dereq_("./../../jquery"),_dereq_("./twitter-content"),_dereq_("./livefyre-content"),_dereq_("inherits"))},{"./../../jquery":78,"./livefyre-content":69,"./twitter-content":76,inherits:96}],75:[function(_dereq_,module){module.exports=function(t,e,i){"use strict";var r=function(i){if(e.call(this,this),i&&-1===r.types.indexOf(i.type))throw new Error("Oembeds must be constructed with .type in "+r.types);i=i||{},t.extend(this,i),"undefined"!=typeof this.html&&""===t.trim(this.html)&&(this.html=null)};return i(r,e),r.types=["photo","video","link","rich"],r.properties=["type","version","title","author_name","author_url","provider_name","provider_url","cache_age","thumbnail_url","thumbnail_width","thumbnail_height","url","width","height","html"],r.prototype.toJSON=function(){var e=this,i={};return t.each(r.properties,function(t,r){"undefined"!=typeof e[r]&&(i[r]=e[r])}),i},r}(_dereq_("./../../jquery"),_dereq_("./../main"),_dereq_("inherits"))},{"./../../jquery":78,"./../main":67,inherits:96}],76:[function(_dereq_,module){module.exports=function(t,e){"use strict";var i=function(e){t.call(this,this),e=e||{},this.tweetId=e.tweetId};return e(i,t),i}(_dereq_("./../main"),_dereq_("inherits"))},{"./../main":67,inherits:96}],77:[function(_dereq_,module){module.exports=_dereq_("./../../debug/debug.js")},{"./../../debug/debug.js":6}],78:[function(_dereq_,module){module.exports=function(e){"use strict";if(!e.support.cors&&window.XDomainRequest){var t=/^https?:\/\//i,o=/^get|post$/i,n=new RegExp("^"+location.protocol,"i"),r=/\/xml/i,s=window.XDomainRequest,a=window.ActiveXObject;e.ajaxTransport("text html xml json",function(i,c){if(i.crossDomain&&i.async&&o.test(i.type)&&t.test(c.url)&&n.test(c.url)){var p=null,l=(c.dataType||"").toLowerCase();return{send:function(t,o){if(p=new s,/^\d+$/.test(c.timeout)&&(p.timeout=c.timeout),p.ontimeout=function(){o(500,"timeout")},p.onload=function(){var e="Content-Length: "+p.responseText.length+"\r\nContent-Type: "+p.contentType,t={code:200,message:"success"},n={text:p.responseText};try{if("json"===l)try{n.json=JSON.parse(p.responseText)}catch(e){t.code=500,t.message="parseerror"}else if("xml"===l||"text"!==l&&r.test(p.contentType)){var s=new a("Microsoft.XMLDOM");s.async=!1;try{s.loadXML(p.responseText)}catch(e){s=void 0}if(!s||!s.documentElement||s.getElementsByTagName("parsererror").length)throw t.code=500,t.message="parseerror","Invalid XML: "+p.responseText;n.xml=s}}catch(e){throw e}finally{o(t.code,t.message,n,e)}},p.onerror=function(){o(500,"error",{text:p.responseText})},p.open(i.type,i.url),p.onprogress=function(){},c.data&&"POST"===i.type){var n=c.data;"object"==typeof n&&(n=e.param(n)),p.send(n)}else p.send()},abort:function(){p&&p.abort()}}}})}return e}(_dereq_("./../../../node_modules/jquery/dist/jquery"))},{"./../../../node_modules/jquery/dist/jquery":97}],79:[function(_dereq_,module){module.exports=function(e,t){"use strict";var r={cache:{}};return t.call(r),e.extend(r,t.prototype),r.get=function(e,t){var r=this.cache[e];return t?void t(r):r},r.set=function(e,t,r){var i=this.cache[e];return this.cache[e]=t,i?this.emit("change",i,t):this.emit("add",t),r?void r(t):t},r}(_dereq_("./jquery"),_dereq_("./../../event-emitter/src/event-emitter"))},{"./../../event-emitter/src/event-emitter":10,"./jquery":78}],80:[function(_dereq_,module){module.exports=function(e,t){"use strict";var r=e("util"),n={};n.outerWidth=function(e){return r("Deprecated: util.outerWidth"),t(e).outerWidth(!0)},n.outerHeight=function(e){return r("Deprecated: util.outerHeight"),t(e).outerHeight(!0)},n.innerWidth=function(e){return r("Deprecated: util.innerWidth"),t(e).innerWidth()},n.innerHeight=function(e){return r("Deprecated: util.innerHeight"),t(e).innerHeight()};var o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return n.formatDate=function(e,t){t=t||new Date;var r,n=e.getTime()-t.getTime();return n>0?"":n>-6e4?Math.round(-1*n/1e3)+"s":n>-36e5?Math.round(-1*n/6e4)+"m":n>-864e5?Math.round(-1*n/36e5)+"h":(r=e.getDate()+" "+o[e.getMonth()],e.getFullYear()!==t.getFullYear()&&(r+=" "+e.getFullYear()),r)},n.objectKeys=Object.keys||function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=r.length;return function(o){if("object"!=typeof o&&"function"!=typeof o||null===o)throw new TypeError("objectKeys called on a non-object");var u=[];for(var i in o)e.call(o,i)&&u.push(i);if(t)for(var a=0;n>a;a++)e.call(o,r[a])&&u.push(r[a]);return u}}(),Array.prototype.indexOf=Array.prototype.indexOf||function(e){return t.inArray(e,this)},n}(_dereq_("./debug"),_dereq_("./jquery"))},{"./debug":77,"./jquery":78}],81:[function(_dereq_,module){function delegateEvents(e,t,n,E){undelegateEvents(e,n),t instanceof EventMap&&(t=t.withContext(E));for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if("string"==typeof o&&(o=E[o]),!o)throw"Undefined method for: "+r;o=$.proxy(o,E);var a=r.match(EVENT_SPLITTER);if(!a)throw"Invalid event/selector pair: "+r;var d=a[1],i=a[2];d+=EVENT_ANTENNA+n,""===i?e.on(d,o):e.on(d,i,o)}}function getUniqueId(){return++idCounts+""}function undelegateEvents(e,t){e.off(EVENT_ANTENNA+t)}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),EventMap=_dereq_("./event-map"),EVENT_ANTENNA=".delegateEvents",EVENT_SPLITTER=/^(\S+)\s*(.*)$/,idCounts=0;module.exports={delegateEvents:delegateEvents,getUniqueId:getUniqueId,undelegateEvents:undelegateEvents}},{"./../../../node_modules/jquery/dist/jquery":97,"./event-map":82}],82:[function(_dereq_,module){"use strict";function EventMap(t){this._factories=[],extend(this,[t])}function extend(t,e){var n,i,o,r;t=t||{},e=e||[],r=e.length;for(var s=0;r>s;s++)if(void 0!==(o=e[s])){if("function"==typeof o){t._factories.push(o);continue}for(i in o)o.hasOwnProperty(i)&&(n=o[i],"_factories"===i&&n.slice&&(n=n.slice()),t!==n&&void 0!==n&&(t[i]=n))}return t}EventMap.prototype.extended=function(){var t=new EventMap(this),e=[].slice.apply(arguments);return extend(t,e),t},EventMap.prototype.withContext=function(t){for(var e,n,i=[],o={},r=0,s=this._factories.length;s>r;r++)e=this._factories[r],n={},i.push(e.call(t,n)||n);return extend(o,[this].concat(i)),o},module.exports=EventMap},{}],83:[function(_dereq_,module){var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),delegate=_dereq_("./delegate"),EventEmitter=_dereq_("./../../event-emitter/src/event-emitter"),EventMap=_dereq_("./event-map"),inherits=_dereq_("./../../inherits/inherits.js"),View=function(e){EventEmitter.call(this),e=e||{},this.opts=e,this.uid=delegate.getUniqueId(),this.setElement(e.el||document.createElement(this.elTag))};inherits(View,EventEmitter);View.prototype.$=function(e){return this.$el.find(e)},View.prototype.getElementsByClass=function(e){return this.$el.find("."+e)},View.prototype.elTag="div",View.prototype.elClass="",View.prototype.events=new EventMap,View.prototype.getTemplateContext=function(){return this},View.prototype.template=null,View.prototype.setElement=function(e){return this.el&&(this.$el.removeClass(this.elClass),this.undelegateEvents()),this.$el=e instanceof $?e:$(e),this.el=this.$el[0],this.elClass&&this.$el.addClass(this.elClass),this.delegateEvents(),this},View.prototype.delegateEvents=function(e){return e||(e=this.events)?(delegate.delegateEvents(this.$el,e,this.uid,this),this):this},View.prototype.undelegateEvents=function(){return delegate.undelegateEvents(this.$el,this.uid),this},View.prototype.render=function(){var e;"function"==typeof this.template&&(e=this.getTemplateContext(),this.$el.html(this.template(e)))},View.prototype.detach=function(){this.$el.detach()},View.prototype.destroy=function(){this.$el.remove(),this.template=null,this.undelegateEvents(),this.removeAllListeners()},module.exports=View},{"./../../../node_modules/jquery/dist/jquery":97,"./../../event-emitter/src/event-emitter":10,"./../../inherits/inherits.js":11,"./delegate":81,"./event-map":82}],84:[function(_dereq_,module){function AbstractRange(){}var abstractMethod=_dereq_("./util/base").abstractMethod;AbstractRange.prototype._createNativeRange=abstractMethod,AbstractRange.prototype.addToSelection=abstractMethod,AbstractRange.prototype.backup=abstractMethod,AbstractRange.prototype.clearNativeSelection=abstractMethod,AbstractRange.prototype.deleteContents=abstractMethod,AbstractRange.prototype.getBoundingClientRect=abstractMethod,AbstractRange.prototype.getEndNode=abstractMethod,AbstractRange.prototype.getEndOffset=abstractMethod,AbstractRange.prototype.getOriginalString=abstractMethod,AbstractRange.prototype.getParentNode=abstractMethod,AbstractRange.prototype.getStartNode=abstractMethod,AbstractRange.prototype.getStartOffset=abstractMethod,AbstractRange.prototype.insertNode=abstractMethod,AbstractRange.prototype.selectNodeContents=abstractMethod,AbstractRange.prototype.setEnd=abstractMethod,AbstractRange.prototype.setStart=abstractMethod,AbstractRange.prototype.toHtmlString=abstractMethod,AbstractRange.prototype.toString=abstractMethod,module.exports=AbstractRange},{"./util/base":88}],85:[function(_dereq_,module){function Highlighter(e){this._className=e.className}var domUtil=_dereq_("./util/dom"),XRange=_dereq_("./xrange");Highlighter.prototype._highlightNode=function(e,t,i){var n=e.nodeValue,r=t||0,a=i||n.length,o=document.createDocumentFragment();r>0&&o.appendChild(document.createTextNode(n.substring(0,r)));var g=document.createElement("span");return g.className=this._className,g.innerHTML=n.substring(r,a),o.appendChild(g),a-1&&t.parentNode.replaceChild(e,t); }),domUtil.normalize(i),XRange.getRangeByString(e.getOriginalString(),i,e)},module.exports=Highlighter},{"./util/dom":89,"./xrange":90}],86:[function(_dereq_,module){function IERange(t){this._nativeRange=t||this._createNativeRange(),this._originalString=null,this._endNode=null,this._endOffset=0,this._startNode=null,this._startOffset=0}var AbstractRange=_dereq_("./abstractrange"),inherits=_dereq_("./../../inherits/inherits.js");inherits(IERange,AbstractRange),IERange.prototype._createNativeRange=function(){return document.selection.createRange()},IERange.prototype.addToSelection=function(){},IERange.prototype.backup=function(){this._originalString=this.toHtmlString()},IERange.prototype.clearNativeSelection=function(){},IERange.prototype.deleteContents=function(){},IERange.prototype.getBoundingClientRect=function(){},IERange.prototype.getEndNode=function(){return this._endNode},IERange.prototype.getEndOffset=function(){return this._endOffset},IERange.prototype.getOriginalString=function(){return this._originalString},IERange.prototype.getParentNode=function(){return this._nativeRange.parentElement()},IERange.prototype.getStartNode=function(){return this._startNode},IERange.prototype.getStartOffset=function(){return this._startOffset},IERange.prototype.insertNode=function(){},IERange.prototype.selectNodeContents=function(){},IERange.prototype.setEnd=function(t,e){this._endNode=t,this._endOffset=e},IERange.prototype.setStart=function(t,e){this._startNode=t,this._startOffset=e},IERange.prototype.toHtmlString=function(){return""},IERange.prototype.toString=function(){return""},module.exports=IERange},{"./../../inherits/inherits.js":11,"./abstractrange":84}],87:[function(_dereq_,module){function StandardRange(t){this._nativeRange=t||this._createNativeRange(),this._originalString=null}var AbstractRange=_dereq_("./abstractrange"),inherits=_dereq_("./../../inherits/inherits.js");inherits(StandardRange,AbstractRange),StandardRange.prototype._createNativeRange=function(){var t=window.getSelection();return!t.rangeCount||t.isCollapsed?document.createRange():t.getRangeAt(0)},StandardRange.prototype.addToSelection=function(){var t=window.getSelection();t.addRange(this._nativeRange)},StandardRange.prototype.backup=function(){this._originalString=this.toHtmlString()},StandardRange.prototype.clearNativeSelection=function(){var t=window.getSelection();t.empty&&t.empty(),t.removeAllRanges&&t.removeAllRanges()},StandardRange.prototype.deleteContents=function(){this._nativeRange.deleteContents()},StandardRange.prototype.getBoundingClientRect=function(){return this._nativeRange.getBoundingClientRect()},StandardRange.prototype.getEndNode=function(){return this._nativeRange.endContainer},StandardRange.prototype.getEndOffset=function(){return this._nativeRange.endOffset},StandardRange.prototype.getOriginalString=function(){return this._originalString},StandardRange.prototype.getParentNode=function(){var t=this._nativeRange.commonAncestorContainer;return 1!==t.nodeType&&(t=t.parentNode),t},StandardRange.prototype.getStartNode=function(){return this._nativeRange.startContainer},StandardRange.prototype.getStartOffset=function(){return this._nativeRange.startOffset},StandardRange.prototype.insertNode=function(t){this._nativeRange.insertNode(t)},StandardRange.prototype.selectNodeContents=function(t){this._nativeRange.selectNodeContents(t)},StandardRange.prototype.setEnd=function(t,n){this._nativeRange.setEnd(t,n)},StandardRange.prototype.setStart=function(t,n){this._nativeRange.setStart(t,n)},StandardRange.prototype.toHtmlString=function(){var t=document.createElement("div");return t.appendChild(this._nativeRange.cloneContents()),t.innerHTML},StandardRange.prototype.toString=function(){return this._nativeRange.toString()},module.exports=StandardRange},{"./../../inherits/inherits.js":11,"./abstractrange":84}],88:[function(_dereq_,module){var util={};util.abstractMethod=function(){throw"This function must be overridden"},util.memoize=function(t){return function(){var n=t.call(this);return t=function(){return n},n}},module.exports=util},{}],89:[function(_dereq_,module){function processNode(e,t,o){return e.hasChildNodes()?o(e,t):3===e.nodeType?t(e):void 0}var util={};util.findNodeInElement=function(e,t){var o,i=t?util.forEachNodeReverse:util.forEachNode;return i(e,function(e){return o=e,!0}),o},util.forEachNode=function(e,t){for(var o=e.childNodes,i=0;i=0;i--)if(processNode(o[i],t,util.forEachNodeReverse))return!0},util.forEachSibling=function(e,t){for(var o=e.nextSibling;o;){if(processNode(o,t,util.forEachNode))return!0;o=o.nextSibling}return!1},util.getBoundingClientRect=function(e){var t=e.getBoundingClientRect();return t.height||t.top||(t=e.getBoundingClientRect()),void 0===typeof t.height&&(t={top:t.top,right:t.right,bottom:t.bottom,left:t.left},t.height=t.bottom-t.top,t.width=t.right-t.left),t},util.normalize=function(e){var t,o,i,n,r=e.childNodes,l=[];for(t=0,o=r.length;o>t;t++)if(i=r[t],i.hasChildNodes())util.normalize(i),n=null;else if(n){if(3===i.nodeType){l.push(i),n.nodeValue+=i.nodeValue;continue}n=null}else 3===i.nodeType&&(n=i);for(t=0,o=l.length;o>t;t++)e.removeChild(l[t])},module.exports=util},{}],90:[function(_dereq_,module){var domUtil=_dereq_("./util/dom"),XRange=_dereq_(window.getSelection?"./standardrange":"./ierange");XRange.getRangeByString=function(e,n,r){function t(n,r){var t;o.setEnd(n,r);for(var i=0;i-1&&l.push([e,n]);var r=e.nodeValue.indexOf(d);return r>-1&&t(e,r+d.length)?!0:void 0});return u?o:null}},module.exports=XRange},{"./ierange":86,"./standardrange":87,"./util/dom":89}],91:[function(_dereq_,module){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex1)for(var u=1;ut;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}G=0}function f(){try{var t=_dereq_,e=t("vertx");return H=e.runOnLoop||e.runOnContext,i()}catch(t){return c()}}function l(t,e){var n=arguments,r=this,o=new this.constructor(p);void 0===o[et]&&k(o);var i=r._state;return i?!function(){var t=n[i-1];J(function(){return x(i,o,t,r._result)})}():E(r,o,t,e),o}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(t){return it.error=t,it}}function y(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}function m(t,e,n){J(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===rt?S(t,e._result):e._state===ot?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===it?j(t,it.error):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===nt&&(t._result=e,t._state=rt,0!==t._subscribers.length&&J(T,t))}function j(t,e){t._state===nt&&(t._state=ot,t._result=e,J(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+rt]=n,o[i+ot]=r,0===i&&t._state&&J(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;si;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function K(t){var e=this,n=new e(p);return j(n,t),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this[et]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&L(),this instanceof U?C(this,t):N())}function W(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=U}var z=void 0;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B=z,G=0,H=void 0,I=void 0,J=function(t,e){$[G]=t,$[G+1]=e,G+=2,2===G&&(I?I(a):tt())},Q="undefined"!=typeof window?window:void 0,R=Q||{},V=R.MutationObserver||R.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),tt=void 0;tt=X?o():V?s():Z?u():void 0===Q&&"function"==typeof _dereq_?f():c();var et=Math.random().toString(36).substring(16),nt=void 0,rt=1,ot=2,it=new M,st=new M,ut=0;return Y.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===nt&&t>n;n++)this._eachEntry(e[n],n)},Y.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==nt)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===U){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},Y.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===nt&&(this._remaining--,t===ot?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},Y.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(rt,e,t)},function(t){return n._settledAt(ot,e,t)})},U.all=F,U.race=D,U.resolve=h,U.reject=K,U._setScheduler=n,U._setAsap=r,U._asap=J,U.prototype={constructor:U,then:l,"catch":function(t){return this.then(null,t)}},W(),U.polyfill=W,U.Promise=U,U})}).call(this,_dereq_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:91}],93:[function(_dereq_,module,exports){!function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function r(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function e(t,n,r){if(n.charAt(r)!=t.charAt(0))return!1;for(var e=1,a=t.length;a>e;e++)if(n.charAt(r+e)!=t.charAt(e))return!1;return!0}function a(n,r,e,c){var o=[],u=null,l=null,f=null;for(l=e[e.length-1];n.length>0;){if(f=n.shift(),l&&"<"==l.tag&&!(f.tag in k))throw new Error("Illegal content in < super tag.");if(t.tags[f.tag]<=t.tags.$||i(f,c))e.push(f),f.nodes=a(n,f.tag,e,c);else{if("/"==f.tag){if(0===e.length)throw new Error("Closing tag without opener: /"+f.n);if(u=e.pop(),f.n!=u.n&&!s(f.n,u.n,c))throw new Error("Nesting error: "+u.n+" vs. "+f.n);return u.end=f.i,o}"\n"==f.tag&&(f.last=0==n.length||"\n"==n[0].tag)}o.push(f)}if(e.length>0)throw new Error("missing closing tag: "+e.pop().n);return o}function i(t,n){for(var r=0,e=n.length;e>r;r++)if(n[r].o==t.n)return t.tag="#",!0}function s(t,n,r){for(var e=0,a=r.length;a>e;e++)if(r[e].c==t&&r[e].o==n)return!0}function c(t){var n=[];for(var r in t)n.push('"'+u(r)+'": function(c,p,t,i) {'+t[r]+"}");return"{ "+n.join(",")+" }"}function o(t){var n=[];for(var r in t.partials)n.push('"'+u(r)+'":{name:"'+u(t.partials[r].name)+'", '+o(t.partials[r])+"}");return"partials: {"+n.join(",")+"}, subs: "+c(t.subs)}function u(t){return t.replace(b,"\\\\").replace(d,'\\"').replace(v,"\\n").replace(m,"\\r").replace(w,"\\u2028").replace(x,"\\u2029")}function l(t){return~t.indexOf(".")?"d":"f"}function f(t,n){var r="<"+(n.prefix||""),e=r+t.n+A++;return n.partials[e]={name:t.n,partials:{}},n.code+='t.b(t.rp("'+u(e)+'",c,p,"'+(t.indent||"")+'"));',e}function g(t,n){n.code+="t.b(t.t(t."+l(t.n)+'("'+u(t.n)+'",c,p,0)));'}function p(t){return"t.b("+t+");"}var h=/\S/,d=/\"/g,v=/\n/g,m=/\r/g,b=/\\/g,w=/\u2028/,x=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(a,i){function s(){b.length>0&&(w.push({tag:"_t",text:new String(b)}),b="")}function c(){for(var n=!0,r=A;r"==r.tag&&(r.indent=w[e].text.toString()),w.splice(e,1));else n||w.push({tag:"\n"});x=!1,A=w.length}function u(t,n){var e="="+y,a=t.indexOf(e,n),i=r(t.substring(t.indexOf("=",n)+1,a)).split(" ");return _=i[0],y=i[i.length-1],a+e.length-1}var l=a.length,f=0,g=1,p=2,d=f,v=null,m=null,b="",w=[],x=!1,k=0,A=0,_="{{",y="}}";for(i&&(i=i.split(" "),_=i[0],y=i[1]),k=0;l>k;k++)d==f?e(_,a,k)?(--k,s(),d=g):"\n"==a.charAt(k)?o(x):b+=a.charAt(k):d==g?(k+=_.length-1,m=t.tags[a.charAt(k+1)],v=m?a.charAt(k+1):"_v","="==v?(k=u(a,k),d=f):(m&&k++,d=p),x=k):e(y,a,k)?(w.push({tag:v,n:r(b),otag:_,ctag:y,i:"/"==v?x-_.length:k+y.length}),b="",k+=y.length-1,d=f,"{"==v&&("}}"==y?k++:n(w[w.length-1]))):b+=a.charAt(k);return o(x,!0),w};var k={_t:!0,"\n":!0,$:!0,"/":!0};t.stringify=function(n){return"{code: function (c,p,i) { "+t.wrapMain(n.code)+" },"+o(n)+"}"};var A=0;t.generate=function(n,r,e){A=0;var a={code:"",subs:{},partials:{}};return t.walk(n,a),e.asString?this.stringify(a,r,e):this.makeTemplate(a,r,e)},t.wrapMain=function(t){return'var t=this;t.b(i=i||"");'+t+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(t,n,r){var e=this.makePartials(t);return e.code=new Function("c","p","i",this.wrapMain(t.code)),new this.template(e,n,this,r)},t.makePartials=function(t){var n,r={subs:{},partials:t.partials,name:t.name};for(n in r.partials)r.partials[n]=this.makePartials(r.partials[n]);for(n in t.subs)r.subs[n]=new Function("c","p","t","i",t.subs[n]);return r},t.codegen={"#":function(n,r){r.code+="if(t.s(t."+l(n.n)+'("'+u(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(n.nodes,r),r.code+="});c.pop();}"},"^":function(n,r){r.code+="if(!t.s(t."+l(n.n)+'("'+u(n.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(n.nodes,r),r.code+="};"},">":f,"<":function(n,r){var e={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,e);var a=r.partials[f(n,r)];a.subs=e.subs,a.partials=e.partials},$:function(n,r){var e={subs:{},code:"",partials:r.partials,prefix:n.n};t.walk(n.nodes,e),r.subs[n.n]=e.code,r.inPartial||(r.code+='t.sub("'+u(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=p('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+l(t.n)+'("'+u(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=p('"'+u(t.text)+'"')},"{":g,"&":g},t.walk=function(n,r){for(var e,a=0,i=n.length;i>a;a++)e=t.codegen[n[a].tag],e&&e(n[a],r);return r},t.parse=function(t,n,r){return r=r||{},a(t,"",[],r.sectionTags||[])},t.cache={},t.cacheKey=function(t,n){return[t,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},t.compile=function(n,r){r=r||{};var e=t.cacheKey(n,r),a=this.cache[e];if(a){var i=a.partials;for(var s in i)delete i[s].instance;return a}return a=this.generate(this.parse(this.scan(n,r.delimiters),n,r),n,r),this.cache[e]=a}}("undefined"!=typeof exports?exports:Hogan)},{}],94:[function(_dereq_,module){var Hogan=_dereq_("./compiler");Hogan.Template=_dereq_("./template").Template,Hogan.template=Hogan.Template,module.exports=Hogan},{"./compiler":93,"./template":95}],95:[function(_dereq_,module,exports){var Hogan={};!function(t){function i(t,i,s){var e;return i&&"object"==typeof i&&(void 0!==i[t]?e=i[t]:s&&i.get&&"function"==typeof i.get&&(e=i.get(t))),e}function s(t,i,s,e,n,r){function o(){}function u(){}o.prototype=t,u.prototype=t.subs;var a,c=new o;c.subs=new u,c.subsText={},c.buf="",e=e||{},c.stackSubs=e,c.subsText=r;for(a in i)e[a]||(e[a]=i[a]);for(a in e)c.subs[a]=e[a];n=n||{},c.stackPartials=n;for(a in s)n[a]||(n[a]=s[a]);for(a in n)c.partials[a]=n[a];return c}function e(t){return String(null===t||void 0===t?"":t)}function n(t){return t=e(t),h.test(t)?t.replace(r,"&").replace(o,"<").replace(u,">").replace(a,"'").replace(c,"""):t}t.Template=function(t,i,s,e){t=t||{},this.r=t.code||this.r,this.c=s,this.options=e||{},this.text=i||"",this.partials=t.partials||{},this.subs=t.subs||{},this.buf=""},t.Template.prototype={r:function(){return""},v:n,t:e,render:function(t,i,s){return this.ri([t],i||{},s)},ri:function(t,i,s){return this.r(t,i,s)},ep:function(t,i){var e=this.partials[t],n=i[e.name];if(e.instance&&e.base==n)return e.instance;if("string"==typeof n){if(!this.c)throw new Error("No compiler available.");n=this.c.compile(n,this.options)}if(!n)return null;if(this.partials[t].base=n,e.subs){i.stackText||(i.stackText={});for(key in e.subs)i.stackText[key]||(i.stackText[key]=void 0!==this.activeSub&&i.stackText[this.activeSub]?i.stackText[this.activeSub]:this.text);n=s(n,e.subs,e.partials,this.stackSubs,this.stackPartials,i.stackText)}return this.partials[t].instance=n,n},rp:function(t,i,s,e){var n=this.ep(t,s);return n?n.ri(i,s,e):""},rs:function(t,i,s){var e=t[t.length-1];if(!f(e))return void s(t,i,this);for(var n=0;n=0;c--)if(o=s[c],r=i(t,o,a),void 0!==r){u=!0;break}return u?(n||"function"!=typeof r||(r=this.mv(r,s,e)),r):!n&&""},ls:function(t,i,s,n,r){var o=this.options.delimiters;return this.options.delimiters=r,this.b(this.ct(e(t.call(i,n)),i,s)),this.options.delimiters=o,!1},ct:function(t,i,s){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(i,s)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,i,s,e,n,r,o){var u,a=i[i.length-1],c=t.call(a);return"function"==typeof c?!!e||(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,a,s,u.substring(n,r),o)):c},mv:function(t,i,s){var n=i[i.length-1],r=t.call(n);return"function"==typeof r?this.ct(e(r.call(n)),n,s):r},sub:function(t,i,s,e){var n=this.subs[t];n&&(this.activeSub=t,n(i,s,this,e),this.activeSub=!1)}};var r=/&/g,o=//g,a=/\'/g,c=/\"/g,h=/[&<>\"\']/,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan)},{}],96:[function(_dereq_,module,exports){arguments[4][11][0].apply(exports,arguments)},{dup:11}],97:[function(_dereq_,module){!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=!!e&&"length"in e&&e.length,n=oe.type(e);return"function"!==n&&!oe.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function r(e,t,n){if(oe.isFunction(t))return oe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return oe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ge.test(t))return oe.filter(t,e,n);t=oe.filter(t,e)}return oe.grep(e,function(e){return Z.call(t,e)>-1!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function o(e){var t={};return oe.each(e.match(we)||[],function(e,n){t[n]=!0}),t}function s(){G.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s),oe.ready()}function a(){this.expando=oe.expando+a.uid++}function u(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(je,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:Se.test(n)?oe.parseJSON(n):n)}catch(e){}Ne.set(e,t,n)}else n=void 0;return n}function l(e,t,n,r){var i,o=1,s=20,a=r?function(){return r.cur()}:function(){return oe.css(e,t,"")},u=a(),l=n&&n[3]||(oe.cssNumber[t]?"":"px"),c=(oe.cssNumber[t]||"px"!==l&&+u)&&Ae.exec(oe.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do o=o||".5",c/=o,oe.style(e,t,c+l);while(o!==(o=a()/u)&&1!==o&&--s)}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function c(e,t){var n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&oe.nodeName(e,t)?oe.merge([e],n):n}function f(e,t){for(var n=0,r=e.length;r>n;n++)Ee.set(e[n],"globalEval",!t||Ee.get(t[n],"globalEval"))}function p(e,t,n,r,i){for(var o,s,a,u,l,p,d=t.createDocumentFragment(),h=[],g=0,v=e.length;v>g;g++)if(o=e[g],o||0===o)if("object"===oe.type(o))oe.merge(h,o.nodeType?[o]:o);else if(Re.test(o)){for(s=s||d.appendChild(t.createElement("div")),a=(Oe.exec(o)||["",""])[1].toLowerCase(),u=Pe[a]||Pe._default,s.innerHTML=u[1]+oe.htmlPrefilter(o)+u[2],p=u[0];p--;)s=s.lastChild;oe.merge(h,s.childNodes),s=d.firstChild,s.textContent=""}else h.push(t.createTextNode(o));for(d.textContent="",g=0;o=h[g++];)if(r&&oe.inArray(o,r)>-1)i&&i.push(o);else if(l=oe.contains(o.ownerDocument,o),s=c(d.appendChild(o),"script"),l&&f(s),n)for(p=0;o=s[p++];)Fe.test(o.type||"")&&n.push(o);return d}function d(){return!0}function h(){return!1}function g(){try{return G.activeElement}catch(e){}}function v(e,t,n,r,i,o){var s,a;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(a in t)v(e,a,n,r,t[a],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=h;else if(!i)return e;return 1===o&&(s=i,i=function(e){return oe().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=oe.guid++)),e.each(function(){oe.event.add(this,t,i,r,n)})}function m(e,t){return oe.nodeName(e,"table")&&oe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function y(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function x(e){var t=Xe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function b(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(Ee.hasData(e)&&(o=Ee.access(e),s=Ee.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)oe.event.add(t,i,l[i][n])}Ne.hasData(e)&&(a=Ne.access(e),u=oe.extend({},a),Ne.set(t,u))}}function w(e,t){var n=t.nodeName.toLowerCase();"input"===n&&He.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function T(e,t,n,r){t=J.apply([],t);var i,o,s,a,u,l,f=0,d=e.length,h=d-1,g=t[0],v=oe.isFunction(g);if(v||d>1&&"string"==typeof g&&!re.checkClone&&_e.test(g))return e.each(function(i){var o=e.eq(i);v&&(t[0]=g.call(this,i,o.html())),T(o,t,n,r)});if(d&&(i=p(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(s=oe.map(c(i,"script"),y),a=s.length;d>f;f++)u=i,f!==h&&(u=oe.clone(u,!0,!0),a&&oe.merge(s,c(u,"script"))),n.call(e[f],u,f);if(a)for(l=s[s.length-1].ownerDocument,oe.map(s,x),f=0;a>f;f++)u=s[f],Fe.test(u.type||"")&&!Ee.access(u,"globalEval")&&oe.contains(l,u)&&(u.src?oe._evalUrl&&oe._evalUrl(u.src):oe.globalEval(u.textContent.replace(ze,"")))}return e}function C(e,t,n){for(var r,i=t?oe.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||oe.cleanData(c(r)),r.parentNode&&(n&&oe.contains(r.ownerDocument,r)&&f(c(r,"script")),r.parentNode.removeChild(r));return e}function k(e,t){var n=oe(t.createElement(e)).appendTo(t.body),r=oe.css(n[0],"display");return n.detach(),r}function E(e){var t=G,n=Ve[e];return n||(n=k(e,t),"none"!==n&&n||(Ue=(Ue||oe("'),u.close(),c=u.w.frames[0].document,t=c.createElement("div")}catch(e){t=i.createElement("div"),c=i.body}var l=function(e){return function(){var n=Array.prototype.slice.call(arguments,0);n.unshift(t),c.appendChild(t),t.addBehavior("#default#userData"),t.load(o);var i=e.apply(r,n);return c.removeChild(t),i}},f=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),d=function(e){return e.replace(/^d/,"___$&").replace(f,"___")};r.set=l(function(e,t,n){return t=d(t),void 0===n?r.remove(t):(e.setAttribute(t,r.serialize(n)),e.save(o),n)}),r.get=l(function(e,t,n){t=d(t);var i=r.deserialize(e.getAttribute(t));return void 0===i?n:i}),r.remove=l(function(e,t){t=d(t),e.removeAttribute(t),e.save(o)}),r.clear=l(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(o);for(var r=t.length-1;r>=0;r--)e.removeAttribute(t[r].name);e.save(o)}),r.forEach=l(function(e,t){for(var n,i=e.XMLDocument.documentElement.attributes,o=0;n=i[o];++o)t(n.name,r.deserialize(e.getAttribute(n.name)))})}try{var s="__storejs__";r.set(s,s),r.get(s)!=s&&(r.disabled=!0),r.remove(s)}catch(e){r.disabled=!0}return r.enabled=!r.disabled,r}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],99:[function(_dereq_,module){var raf=function(){return"requestAnimationFrame"in window?window.requestAnimationFrame.bind(window):function(n){window.setTimeout(n,1e3/60)}}();module.exports={raf:raf}},{}],100:[function(_dereq_,module){function WorkerPool(e){function r(e,r,o){if("function"==typeof Worker){var t=new Worker(e);return t.onWorkerReady=o.bind(null,t),t.addEventListener("message",t.onWorkerReady),t}var n=document.createElement("iframe");return n.height=n.width=0,n.onWorkerReady=o.bind(null,n),window.addEventListener("message",n.onWorkerReady,!1),n.src=r,raf(function(){document.body.appendChild(n)}),n}function o(e,r){var o=r.data;try{o=JSON.parse(o)}catch(e){}"ack"===o.type&&("function"==typeof Worker?e.removeEventListener("message",e.onWorkerReady):window.removeEventListener("message",e.onWorkerReady),e.ready=!0,n.maybeDequeueJob())}this.workers=Array(e.workerCount),this.queuedJobs=[];for(var t,n=this,s=0;s=0;r--)n=e[SCOPE_CHAIN[r]],n&&(0===r&&(n=n.config),"number"==typeof n.editMode&&(i=1===n.editMode),o=n.editCommentInterval||o);t.settings.allowEditComments=i,t.settings.editCommentInterval=o||5,t.maxEventId=(e.headDocument||{}).event||0}function adaptAvatar(t){return t&&adaptAvatar.IS_SECURE?t.replace("http://avatars.fyre.co","https://lfavatar-a.akamaihd.net"):t}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),Author=_dereq_("../models/author"),auth=_dereq_("../util/auth"),Comment=_dereq_("../models/comment"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),nullFunction=_dereq_("../util/internals").nullFunction,StateToContent=_dereq_("./../../../lib/streamhub-sdk/src/content/state-to-content"),Storage=_dereq_("../util/storage"),visEnums=_dereq_("../enums").commentVisibility,BootstrapKeys={ANCHORS:"anchors",ANNOTATION:"annotation",AUTHORS:"authors",AUTHOR_ID:"authorId",BLOCK_ID:"blockId",BODY_HTML:"bodyHtml",CONTENT:"content",CREATED_AT:"createdAt",DATA:"data",EREFS:"erefs",HINTS:"hints",ID:"id",INDEX:"index",MESSAGES:"messages",META:"meta",MODERATOR:"moderator",NUM_ANNOTATIONS:"num_annotations",NUM_VISIBLE:"numVisible",PARENT_ID:"parentId",SIMHASH:"simhash",STATES:"states",URL:"url",VOTE:"vote"},AnnotationsStateToContent=function(t){t=t||{},this._erefProcessor=t.erefProcessor,t.replies=!0,t.storage=Storage,StateToContent.call(this,t)};inherits(AnnotationsStateToContent,StateToContent),AnnotationsStateToContent.prototype._addReplyOrStore=nullFunction,AnnotationsStateToContent.prototype._createContent=function(t,e){var o=e[t.content.authorId];return o instanceof Author||(o=new Author(o)),t.author=o,new Comment(t)},AnnotationsStateToContent.prototype._getUpdatedProperties=function(t){var e=Storage.get(t.id);if(t.erefs||t.visibility===visEnums.NONE)return{lastVisibility:e.visibility,visibility:t.visibility};if(t.meta.event-1||n.push(o)):void s.push(r[BootstrapKeys.CONTENT][BootstrapKeys.ID])}),n},AnnotationsStateToContent.prototype.updateAuthors=function(t){$.extend(this._authors,t)};var SCOPE_CHAIN=["collectionSettings","siteSettings","networkSettings"];adaptAvatar.IS_SECURE="https:"===location.protocol,module.exports={adaptPermalink:adaptPermalink,adaptSettings:adaptSettings,AnnotationsStateToContent:AnnotationsStateToContent,BootstrapKeys:BootstrapKeys,adaptAvatar:adaptAvatar}},{"../enums":122,"../models/author":143,"../models/comment":145,"../util/auth":181,"../util/internals":185,"../util/storage":193,"./../../../lib/inherits/inherits.js":11,"./../../../lib/streamhub-sdk/src/content/state-to-content":68,"./../../../node_modules/jquery/dist/jquery":97}],102:[function(_dereq_,module){function addAnnotationInfo(n,t){n.blockId=t.blockId,n.selectedText=t.selectedText||null}function withAnnotations(n){n.added.annotation=addAnnotationInfo}var Annotator=_dereq_("./../../../lib/streamhub-sdk/src/content/annotator"),AnnotatorExtensions=_dereq_("./../../../lib/streamhub-sdk/src/content/annotator-extensions"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),CommentAnnotator=function(){Annotator.call(this),AnnotatorExtensions.withVotes(this),withAnnotations(this)};inherits(CommentAnnotator,Annotator),module.exports=CommentAnnotator},{"./../../../lib/inherits/inherits.js":11,"./../../../lib/streamhub-sdk/src/content/annotator":66,"./../../../lib/streamhub-sdk/src/content/annotator-extensions":65}],103:[function(_dereq_,module){function BlockController(o){BaseController.call(this,o),this._elementIdToBlock={},this._blockCounts={},this._selectionPopover=null}var BaseController=(_dereq_("./../../../node_modules/jquery/dist/jquery"),_dereq_("../controller/base")),Block=_dereq_("../models/block"),BlockEvents=_dereq_("../events/events").block,BootstrapKeys=_dereq_("../adapters/adapters").BootstrapKeys,EventMap=_dereq_("./../../../lib/view/src/event-map"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),Storage=(_dereq_("../events/events").source,_dereq_("../util/storage")),ThreadEvents=_dereq_("../events/events").thread;inherits(BlockController,BaseController),BlockController.prototype.events=new EventMap(function(){var o={};return o[BlockEvents.UPDATE_COUNT]="_handleUpdateBlockCount",o}),BlockController.prototype._activateBlock=function(o){this.$antenna.trigger(ThreadEvents.ACTIVATE_THREAD),this._collection.block=o},BlockController.prototype._handleUpdateBlockCount=function(o,e){var t=Storage.get(e.blockId);t.updateNumAnnotations(e.inc,e.count);var n=this._blockCounts[t.id];n&&(n.num_annotations=t.numAnnotations),this.$antenna.trigger(BlockEvents.COUNT_UPDATED,{id:t.id,count:t.numAnnotations})},BlockController.prototype.updateManualBlock=function(o,e){var t=Storage.get(o);return t||(t=new Block,t.id=o,t.blockType=1,t.index=0),t.el=e,Storage.set(t.id,t),this._collection.block=t,t},BlockController.prototype.getBlockCount=function(o){var e=this._blockCounts[o];return e?e.num_annotations:0},BlockController.prototype.initializeBlocks=function(o,e){e()},BlockController.prototype.destroy=function(){BaseController.prototype.destroy.call(this),this._elementIdToBlock=null},BlockController.prototype.initialize=function(o){var e=o[BootstrapKeys.ANCHORS];e&&(this._blockCounts=e[BootstrapKeys.CONTENT])},module.exports=BlockController},{"../adapters/adapters":101,"../controller/base":116,"../events/events":123,"../models/block":144,"../util/storage":193,"./../../../lib/inherits/inherits.js":11,"./../../../lib/view/src/event-map":82,"./../../../node_modules/jquery/dist/jquery":97}],104:[function(_dereq_,module){function BlockController(e){BaseController.call(this,e),this._blockIdToThreadBtn={},this._elementIdToBlock={},this._highlightedBlock=null,this._highlightedText=null,this._highlighter=new Highlighter(e.config.selectors,this.$antenna),this._initAnchorContent=null,this._selectionPopover=null}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),BaseController=_dereq_("../controller/base"),Block=_dereq_("../models/block"),BlockDetector=_dereq_("./detector"),BlockEvents=_dereq_("../events/events").block,BootstrapKeys=_dereq_("../adapters/adapters").BootstrapKeys,EventMap=_dereq_("./../../../lib/view/src/event-map"),Highlighter=_dereq_("./highlighter"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),NumComments=_dereq_("./ui/counter/numcomments"),SelectionPopover=_dereq_("./ui/selectionpopover"),SourceEvents=_dereq_("../events/events").source,Storage=_dereq_("../util/storage"),ThreadBtn=_dereq_("./ui/thread-btn"),ThreadEvents=_dereq_("../events/events").thread,UserAgentUtil=_dereq_("../util/useragent"),XRange=_dereq_("./../../../lib/xrange/src/xrange");inherits(BlockController,BaseController),BlockController.CLASSES={MOBILE_THREAD_BUTTON:"lf-mobile-thread-btn",THREAD_BUTTON:"lf-thread-btn"},BlockController.prototype.events=new EventMap(function(){var e={};return e[BlockEvents.UPDATE_COUNT]="_handleUpdateBlockCount",e[SourceEvents.ADD_ANNOTATION_CLICK]="_handleAddAnnotationClick",e[SourceEvents.TEXT_HIGHLIGHTED]="_handleTextHighlighted",e[SourceEvents.THREAD_BTN_CLICK]="_handleThreadBtnClick",e[ThreadEvents.ACTIVATE_BLOCK]="_handleActivateBlock",e[ThreadEvents.ACTIVATE_HIGHLIGHTED_TEXT]="_handleActivateHighlightedText",e[ThreadEvents.DEACTIVATE_HIGHLIGHTED_TEXT]="_handleDeactivateHighlightedText",UserAgentUtil.isMobile()&&(e[SourceEvents.TEXT_HIGHLIGHTED]="_handleTextHighlightedMobile"),e}),BlockController.prototype.globalEvents=new EventMap(function(){var e={};return e.mousedown="_handleDeactivateHighlightedText",e[SourceEvents.THREAD_BTN_CLICK]="_handleGlobalThreadBtnClick",e[ThreadEvents.DESTROY_THREAD]="_deactivateBlock",e}),BlockController.prototype._activateBlock=function(e){this.$antenna.trigger(ThreadEvents.ACTIVATE_THREAD),this._toggleThreadBtn(e,!0)},BlockController.prototype._deactivateBlock=function(){var e=this._getActiveBlock();e&&(this._collection.block=null,this._toggleThreadBtn(e,!1),this._unfreezeHighlight())},BlockController.prototype._freezeHighlight=function(){this._highlightedRange&&this._highlighter.freezeHighlight(this._highlightedRange,this._highlightedText)},BlockController.prototype._handleActivateBlock=function(e,t){this._toggleThreadBtn(t.block,!0)},BlockController.prototype._handleActivateHighlightedText=function(e,t){if(!this._highlightedRange){t=t||{};var o=t.blockId||this._collection.block.id,l=t.selectedText||this._collection.selectedText;this._setRangeForText(o,l)}},BlockController.prototype._handleAddAnnotationClick=function(){this._deactivateBlock(),this._freezeHighlight();var t=this._collection.block=this._highlightedBlock;this._activateBlock(t)},BlockController.prototype._handleDeactivateHighlightedText=function(){this._unfreezeHighlight()},BlockController.prototype._handleGlobalThreadBtnClick=BaseController.onlyHandleExternalMessage(BlockController.prototype._deactivateBlock),BlockController.prototype._handleTextHighlightedBase=function(e,t){var o=this._elementIdToBlock[t.blockId],l=this._highlightedRange=t.range;return this._collection.selectedText=this._highlightedText=t.text,this._highlightedBlock=o,l},BlockController.prototype._handleTextHighlighted=function(e,t){if(!this._highlightedRange){this._selectionPopover||(this._selectionPopover=new SelectionPopover({antenna:this.$antenna}));var o=this._handleTextHighlightedBase(e,t);this._selectionPopover.onHide($.proxy(function(){this._selectionPopover.show(o)},this))}},BlockController.prototype._handleTextHighlightedMobile=function(e,t){if(this._handleTextHighlightedBase(e,t),!this._collection.block){var o=this._elementIdToBlock[t.blockId];this._collection.block=o,this.$antenna.trigger(ThreadEvents.ACTIVATE_THREAD,{forceWriteCard:!0})}},BlockController.prototype._handleThreadBtnClick=function(e,t){e.preventDefault();var o=t.blockId,l=this._blockIdToThreadBtn[o].isActive();if(l)return void this.$antenna.trigger(ThreadEvents.DESTROY_THREAD);this._deactivateBlock();var i=this._elementIdToBlock[o];this._collection.block=i,this._collection.selectedText=null,this._activateBlock(i)},BlockController.prototype._handleUpdateBlockCount=function(e,t){var o=Storage.get(t.blockId),l=o.updateNumAnnotations(t.inc,t.count);this._numComments&&this._numComments.updateNumAnnotations(l)},BlockController.prototype._setRangeForText=function(e,t){var o=this._blockIdToThreadBtn[e].el.parentNode,l=XRange.getRangeByString(t,o);l&&(this._highlightedRange=l,this._highlightedText=t,this._freezeHighlight())},BlockController.prototype._setThreadBtns=function(e){var t,o=this;$.each(e,function(e,l){t=new ThreadBtn({antenna:o.$antenna,block:l,el:l.el.appendChild(document.createElement("span")),iconVisibility:o._config.iconVisibility,threadBtnDelegate:o._config.threadBtnDelegate});var i=BlockController.CLASSES,n=UserAgentUtil.isMobile()?i.MOBILE_THREAD_BUTTON:i.THREAD_BUTTON;t.render(),t.$el.addClass(n);var r=l.id;o._elementIdToBlock[r]=l,o._blockIdToThreadBtn[r]=t})},BlockController.prototype._toggleThreadBtn=function(e,t){var o=this._blockIdToThreadBtn[e.getId()];o.setActiveState(t)},BlockController.prototype._unfreezeHighlight=function(){this._highlightedRange&&(this._highlighter.unfreezeHighlight(this._highlightedRange,this._highlightedText),this._highlightedRange=null,this._highlightedText=null)},BlockController.prototype._unwrapBlocks=function(){var e=this;$.each(this._elementIdToBlock,function(t,o){e._unwrapBlock(o)})},BlockController.prototype._unwrapBlock=function(e){var t=e.getId(),o=this._blockIdToThreadBtn[t];o.destroy(),BlockDetector.unwrapBlock(e)},BlockController.prototype.unwrapBlockByElement=function(e){var t=e.getAttribute(Block.DATA_ID)||e.getAttribute(BlockDetector.CUSTOM_BLOCK_ID_ATTR)||e.getAttribute(BlockDetector.CUSTOM_BLOCK_ID_ATTR_BACKCOMPAT);t&&t in this._elementIdToBlock&&this._unwrapBlock(this._elementIdToBlock[t]); },BlockController.prototype.destroy=function(){this._selectionPopover&&this._selectionPopover.destroy(),this._deactivateBlock(),this._unwrapBlocks(),this._elementIdToBlock=null,this._blockIdToThreadBtn=null,$("body").off("mousedown",$.proxy(this._handleDeactivateHighlightedText,this)),this.blockDetector&&this.blockDetector.destroy(),BaseController.prototype.destroy.call(this)},BlockController.prototype.initialize=function(e){var t=e[BootstrapKeys.ANCHORS],o=0,l=this._config.numSidenotesEl;t&&(this._initAnchorContent=t[BootstrapKeys.CONTENT],o=t[BootstrapKeys.NUM_VISIBLE]),l&&(this._numComments=this._numComments||new NumComments({numVisible:o}),this._numComments.decorate(l))},BlockController.prototype.initializeBlocks=function(e,t){this.blockDetector=new BlockDetector({content:this._initAnchorContent,selectors:e});var o=this;this.blockDetector.detect(function(e,l){if(e)throw e;o._setThreadBtns(l),t&&t()})},module.exports=BlockController},{"../adapters/adapters":101,"../controller/base":116,"../events/events":123,"../models/block":144,"../util/storage":193,"../util/useragent":195,"./../../../lib/inherits/inherits.js":11,"./../../../lib/view/src/event-map":82,"./../../../lib/xrange/src/xrange":90,"./../../../node_modules/jquery/dist/jquery":97,"./detector":105,"./highlighter":106,"./ui/counter/numcomments":107,"./ui/selectionpopover":109,"./ui/thread-btn":110}],105:[function(_dereq_,module){function applyDisplay(t,e){var r="display",o=e.css(r);"inline"===o&&(o="inline-block"),t.css(r,o)}function applyPosition(t,e){var r="position",o=e.css(r);-1===["relative","absolute"].indexOf(o)&&(o="relative"),t.css(r,o),e.css(r,"relative")}function getBlockSet(t){return t.map(function(t,e){var r=new Block,o=BlockDetector.CLASSES,i=e instanceof $?e[0]:e,s=$(i),n=(s.attr(CUSTOM_BLOCK_TYPE_ATTR)||s.attr(CUSTOM_BLOCK_TYPE_ATTR_BACKCOMPAT)||"text").toUpperCase();if(isMedia(i)||n===Block.TYPES.MEDIA?(r.el=wrapMedia(i),r.blockType=Block.TYPES.MEDIA):(r.el=wrapElement(i),r.blockType=Block.TYPES[n],$(r.el).addClass(o[n])),r.el){if($(r.el).addClass(o.BLOCK),s.is("img")){r.blockType=Block.TYPES.IMAGE;var a=s.attr("src");return 0===a.indexOf("/")&&(a=locationUtil.getOrigin()+a),r.content=a,r}return r.content=s.text(),r}}).get()}function isMedia(t){return-1!==$.inArray(t.tagName,MEDIA_ELEMENTS)}function wrapElement(t){if("#text"!==t.nodeName)return $(t)[0];if(!t.nodeValue.trim().length)return null;var e=$(wrap.render({content:t.nodeValue}))[0];return t.parentNode.replaceChild(e,t),e}function wrapMedia(t){var e=$(t);e.attr(SAVED_STYLE_ATTR,e.attr("style"));var r,o=e.wrap(mediaWrapper.render()).parent();$.each(IMG_STYLE_ATTRS,function(t,i){r=e.css(t),o.css(t,r||i),e.css(t,"inherit"===i?r:i)}),applyDisplay(o,e),applyPosition(o,e);var i=BlockDetector.CLASSES,s=t.tagName===MEDIA_ELEMENTS[0]?i.IMAGE:i.VIDEO;return o.addClass(s),o[0]}function unwrapElement(t){var e=$(t);return"SPAN"===t.tagName?void $(t.childNodes[0]).unwrap():($.each(BlockDetector.CLASSES,function(t,r){e.removeClass(r)}),void e.removeAttr(Block.DATA_ID))}function unwrapMedia(t){var e=$(t).children();e.attr("style",e.attr(SAVED_STYLE_ATTR)||""),e.removeAttr(SAVED_STYLE_ATTR),e.unwrap()}function filterBlocks(t,e){return filter(t,function(t){return t.type===e})}function updateIndices(t,e,r){e in t?t[e]+=isNumber(r)?r:1:t[e]=0,t[e]<0&&delete t[e]}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),Block=_dereq_("../models/block"),filter=_dereq_("./../../../lib/mout/src/array/filter"),isNumber=_dereq_("./../../../lib/mout/src/lang/isNumber"),KEYS=_dereq_("../adapters/adapters").BootstrapKeys,locationUtil=_dereq_("../util/location"),map=_dereq_("./../../../lib/mout/src/array/map"),mediaWrapper=_dereq_("../../templates/blocks/mediawrapper.mustache"),Promise=_dereq_("es6-promise").Promise,reduce=_dereq_("./../../../lib/mout/src/array/reduce"),SimhashLookup=_dereq_("../util/simhashlookup"),Storage=_dereq_("../util/storage"),wrap=_dereq_("../../templates/blocks/elementwrap.mustache"),BlockDetector=function(t){this._bootstrap=t.content||{},this._selectors=t.selectors,this._simhashLookup=new SimhashLookup(this._bootstrap)},BLOCK_MATCH_TYPE={CUSTOM:"custom",EXACT:"exact",NEW:"new",PARTIAL:"partial"},CUSTOM_BLOCK_ID_ATTR_BACKCOMPAT="data-lf-block-id",CUSTOM_BLOCK_ID_ATTR="data-lf-custom-anchor-id",CUSTOM_BLOCK_TYPE_ATTR_BACKCOMPAT="data-lf-block-type",CUSTOM_BLOCK_TYPE_ATTR="data-lf-custom-anchor-type",IMG_STYLE_ATTRS={bottom:0,"float":"none",left:0,margin:0,padding:0,right:0,top:0},MEDIA_ELEMENTS=["IMG"],MEDIA_TYPES=[Block.TYPES.IMAGE,Block.TYPES.MEDIA,Block.TYPES.VIDEO],SAVED_STYLE_ATTR="data-lf-saved-style";BlockDetector.CLASSES={BLOCK:"lf-block",IMAGE:"lf-image-block",MEDIA_WRAPPER:"lf-media-wrapper",RICH:"lf-rich-block",TEXT:"lf-text-block",VIDEO:"lf-video-block"},BlockDetector.SIMILARITY_THRESHOLD=.65,BlockDetector.prototype.buildBlockMap=function(t){return this._attachSimhashes(t).then(this._buildBlockMap.bind(this))},BlockDetector.prototype._attachSimhashes=function(t){var e=map(t,function(t){return this._simhashLookup.getSimhash(t.content).then(function(t,e){return t.$el=$(t.el),t.simhash=e,t}.bind(null,t))},this);return Promise.all(e).then(function(){return t})},BlockDetector.prototype._buildBlockMap=function(t){var e={},r={},o=this,i=function(t,r){t in e?e[t].push(r):e[t]=[r]},s=reduce(t,function(t,e){var s=e.$el.attr(CUSTOM_BLOCK_ID_ATTR)||e.$el.attr(CUSTOM_BLOCK_ID_ATTR_BACKCOMPAT);return t.then(s?function(){return updateIndices(r,e.simhash),e.type=BLOCK_MATCH_TYPE.CUSTOM,e.customId=s,i(s,e),e}:function(){return o._getBlockId(e,0,!1).then(function(t,e){return updateIndices(r,t.simhash),e.type===BLOCK_MATCH_TYPE.PARTIAL?(updateIndices(r,t.partialSimhash),updateIndices(r,t.simhash,-1),i(t.partialSimhash,t)):i(t.simhash,t),t}.bind(null,e))})},Promise.resolve());return s.then(function(){return e})},BlockDetector.prototype._buildBsMap=function(){var t,e,r={};for(t in this._bootstrap)this._bootstrap.hasOwnProperty(t)&&(e=t.split(":")[0],void 0===r[e]&&(r[e]=0),r[e]+=1);return r},BlockDetector.prototype._getBlockId=function(t,e,r){t.index=e;var o={type:BLOCK_MATCH_TYPE.EXACT},i=o.blockId=this._simhashLookup.getBlockId(t.simhash,e);return i?(t.type=o.type,Promise.resolve(o)):this._simhashLookup.getBlockIdWithThreshold(t.simhash,e,BlockDetector.SIMILARITY_THRESHOLD).then(function(e){return o.blockId=e,e&&!r?(t.type=o.type=BLOCK_MATCH_TYPE.PARTIAL,t.partialSimhash=e.split(":")[0]):t.type=o.type=BLOCK_MATCH_TYPE.NEW,o})},BlockDetector.prototype._processBlocks=function(t,e,r){var o={},i=this;return reduce(t,function(t,e){return t.then(e.type===BLOCK_MATCH_TYPE.CUSTOM?function(){var t=r?e.simhash:t;return updateIndices(o,t),e.index=o[t],e.generatedId=e.id=e.customId,Storage.set(e.generatedId,e),e.$el.attr(Block.DATA_ID,e.id),e}:function(){var t=r?e.simhash:t;return updateIndices(o,t),i._getBlockId(e,o[t],r).then(function(t){switch(t.type){case BLOCK_MATCH_TYPE.NEW:e.generatedId=e.id=e.simhash+":"+e.index,Storage.set(e.generatedId,e),e.$el.attr(Block.DATA_ID,e.id);break;default:var r=t.blockId;e.index=i._bootstrap[r][KEYS.HINTS][KEYS.INDEX],e.id=r,e.numAnnotations=i._bootstrap[r][KEYS.NUM_ANNOTATIONS],Storage.set(e.id,e),e.$el.attr(Block.DATA_ID,e.id)}return e})})},Promise.resolve())},BlockDetector.prototype.detect=function(t){var e=getBlockSet(this._selectors);if(0===e.length)return t(null,[]);var r=[];this.buildBlockMap(e).then(function(o){var i,s,n,a,l,c,u,p=this._buildBsMap(),T=0;for(u in o)o.hasOwnProperty(u)&&(i=o[u],s=filterBlocks(i,BLOCK_MATCH_TYPE.CUSTOM),s.length!==i.length?(n=filterBlocks(i,BLOCK_MATCH_TYPE.EXACT),T=n.length,l=p[u]||0,i.length<=l?r.push(this._processBlocks(i,u)):T>0&&T===l?(a=filterBlocks(i,BLOCK_MATCH_TYPE.NEW),c=filterBlocks(i,BLOCK_MATCH_TYPE.PARTIAL),r.push(this._processBlocks(n,u)),r.push(this._processBlocks(c,u,!0)),r.push(this._processBlocks(a,u,!0))):r.push(l>T?this._processBlocks(i,u):this._processBlocks(i,u,!0))):r.push(this._processBlocks(i,u)));Promise.all(r).then(function(){t(null,e)})}.bind(this))["catch"](function(e){t(e)})},BlockDetector.prototype.destroy=function(){this._simhashLookup.destroy(),this._simhashLookup=null,this._selectors=this._bootstrap=null},BlockDetector.unwrapBlock=function(t){return MEDIA_TYPES.indexOf(t.blockType)>-1?void unwrapMedia(t.el):void unwrapElement(t.el)},module.exports=BlockDetector,module.exports.CUSTOM_BLOCK_ID_ATTR=CUSTOM_BLOCK_ID_ATTR,module.exports.CUSTOM_BLOCK_ID_ATTR_BACKCOMPAT=CUSTOM_BLOCK_ID_ATTR_BACKCOMPAT},{"../../templates/blocks/elementwrap.mustache":196,"../../templates/blocks/mediawrapper.mustache":198,"../adapters/adapters":101,"../models/block":144,"../util/location":186,"../util/simhashlookup":190,"../util/storage":193,"./../../../lib/mout/src/array/filter":21,"./../../../lib/mout/src/array/map":22,"./../../../lib/mout/src/array/reduce":23,"./../../../lib/mout/src/lang/isNumber":34,"./../../../node_modules/jquery/dist/jquery":97,"es6-promise":92}],106:[function(_dereq_,module){function Highlighter(e,t){this._sourceElements=e,this.$antenna=t,this.delegateEvents(),this._highlighter=new XHighlighter({className:Highlighter.CLASSES.HIGHLIGHTED_TEXT}),EventEmitter.call(this)}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),Block=_dereq_("../models/block"),BlockDetector=_dereq_("./detector"),debounce=_dereq_("../util/internals").debounce,EventEmitter=_dereq_("./../../../lib/event-emitter/src/event-emitter"),highlighterTemplate=_dereq_("../../templates/blocks/highlight.mustache"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),SourceEvents=_dereq_("../events/events").source,UserAgentUtil=_dereq_("../util/useragent"),XHighlighter=_dereq_("./../../../lib/xrange/src/highlighter"),XRange=_dereq_("./../../../lib/xrange/src/xrange");inherits(Highlighter,EventEmitter),Highlighter.mouseEvents="mouseup.Highlighter",Highlighter.keyboardEvents="keyup.Highlighter",Highlighter.touchEvents="tapend.Highlighter",Highlighter.prototype.events=null,Highlighter.prototype.template=highlighterTemplate.render.bind(highlighterTemplate),Highlighter.CLASSES={HIGHLIGHTED_TEXT:"lf-highlight-text",MOBILE_THREAD_BUTTON:"lf-mobile-thread-btn",THREAD_BUTTON:"lf-thread-btn"},Highlighter.prototype._handleTextHighlighted=function(){var e=new XRange,t=Highlighter.CLASSES,i={range:e,text:e.toHtmlString()},h=e.getEndNode();if(!(i.text.indexOf(t.THREAD_BUTTON)>-1||i.text.indexOf(t.MOBILE_THREAD_BUTTON)>-1||$(h).hasClass(BlockDetector.CLASSES.BLOCK))){var r=e.getParentNode();if(r){var g=$(r).closest("."+BlockDetector.CLASSES.TEXT);i.blockId=g.attr(Block.DATA_ID),this.$antenna.trigger(SourceEvents.TEXT_HIGHLIGHTED,i)}}},Highlighter.prototype.delegateEvents=function(){var e=UserAgentUtil.isMobile();this.events=e?Highlighter.touchEvents:Highlighter.mouseEvents,this.undelegateEvents();var t=$.proxy(this._handleTextHighlighted,this);this._sourceElements.on(this.events,t),e?$(document).on("selectionchange.Highlighter",debounce(t,400,!0)):$("body").on(Highlighter.keyboardEvents,t)},Highlighter.prototype.destroy=function(){this.undelegateEvents(),this._sourceElements=null,this._highlighter=null},Highlighter.prototype.freezeHighlight=function(e){this._highlighter.highlight(e)},Highlighter.prototype.undelegateEvents=function(){this._sourceElements.off(this.events),$(document).off("selectionchange.Highlighter"),$("body").off(Highlighter.mouseEvents)},Highlighter.prototype.unfreezeHighlight=function(e){this._highlighter.unhighlight(e)},module.exports=Highlighter},{"../../templates/blocks/highlight.mustache":197,"../events/events":123,"../models/block":144,"../util/internals":185,"../util/useragent":195,"./../../../lib/event-emitter/src/event-emitter":10,"./../../../lib/inherits/inherits.js":11,"./../../../lib/xrange/src/highlighter":85,"./../../../lib/xrange/src/xrange":90,"./../../../node_modules/jquery/dist/jquery":97,"./detector":105}],107:[function(_dereq_,module){function NumComments(e){e=e||{},View.call(this,e),this._commentCount=e.numVisible||0,this._questionPopover}var inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),QuestionPopover=_dereq_("./questionpopover"),numCommentsTemplate=_dereq_("../../../../templates/blocks/numcomments.mustache"),textEnumeration=_dereq_("../../..//i18n/enumeration"),ThreadEvents=_dereq_("../../../events/events").thread,UserAgentUtil=_dereq_("../../../util/useragent"),View=_dereq_("./../../../../../lib/view/src/view.js"),viewEnum=_dereq_("../../../enums").navigableViews;inherits(NumComments,View),NumComments.CLASSES={MAIN:"lf-num-sidenotes"},NumComments.prototype._handleClick=function(){this._questionPopover||(this._questionPopover=new QuestionPopover,this._questionPopover.render()),this._questionPopover.isShowing()||this._questionPopover.isVisible()||this._questionPopover.show(this.el)},NumComments.prototype._handleTouch=function(){this.$el.trigger(ThreadEvents.CHANGE_VIEW,{value:viewEnum.QUESTION})},NumComments.prototype.decorate=function(e){this.render(),e.appendChild(this.el)},NumComments.prototype.destroy=function(){View.prototype.destroy.call(this),this._questionPopover&&this._questionPopover.destroy(),this._questionPopover=null,this._commentCount=null},NumComments.prototype.elClass=NumComments.CLASSES.MAIN,NumComments.prototype.events=function(){var e={};return UserAgentUtil.isMobile()?e.tap="_handleTouch":e.click="_handleClick",e}(),NumComments.prototype.getTemplateContext=function(){return{commentCount:this._commentCount,strings:{appName:textEnumeration.get(textEnumeration.KEYS.APP_NAME)}}},NumComments.prototype.template=numCommentsTemplate.render.bind(numCommentsTemplate),NumComments.prototype.updateNumAnnotations=function(e){this._commentCount+=e,this.render()},module.exports=NumComments},{"../../../../templates/blocks/numcomments.mustache":199,"../../..//i18n/enumeration":124,"../../../enums":122,"../../../events/events":123,"../../../util/useragent":195,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/view/src/view.js":83,"./questionpopover":108}],108:[function(_dereq_,module){function QuestionPopover(t){Popover.call(this,$.extend({sidePadding:10,topSpacing:10},t)),this._height,this._width,this._position=Popover.POSITIONS.SMART}var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),contentTemplate=_dereq_("../../../../templates/blocks/questionpopover.mustache"),domUtil=_dereq_("../../../util/dom"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),internals=_dereq_("../../../util/internals"),Popover=_dereq_("../../../ui/popover"),textEnumeration=_dereq_("../../../i18n/enumeration");inherits(QuestionPopover,Popover),QuestionPopover.CLASSES={EXPLANATION:"lf-explanation-text",TITLE:"lf-title-text",MAIN:"lf-question-popover"},$.extend(QuestionPopover.CLASSES,Popover.CLASSES),QuestionPopover.prototype._handleClick=function(t){t.stopPropagation()},QuestionPopover.prototype._getBottomPosition=function(){this._activePosition=Popover.POSITIONS.BOTTOM;var o=this._boundingRect.bottom+domUtil.getScrollY()+10,e=this._boundingRect.left+domUtil.getScrollX()+this._boundingRect.width/2-this._width/2;return{top:o,left:e}},QuestionPopover.prototype._getContentTemplateContext=function(){var t=textEnumeration.KEYS;return{strings:{explanation:textEnumeration.get(t.QUESTION_EXPLANATION),mockText:textEnumeration.get(t.QUESTION_MOCK_TEXT),title:textEnumeration.get(t.QUESTION_TITLE)}}},QuestionPopover.prototype._getRightPosition=function(){this._activePosition=Popover.POSITIONS.RIGHT;var o=this._boundingRect.top+domUtil.getScrollY()+this._boundingRect.height/2-this._height/2,e=this._boundingRect.right+domUtil.getScrollX()+10;return{top:o,left:e}},QuestionPopover.prototype._scrollIntoPosition=internals.nullFunction,QuestionPopover.prototype._getSmartPosition=function(t){if(this._boundingRect=domUtil.getBoundingClientRect(t),!this._height){var o=domUtil.getBoundingClientRect(this.el);this._height=o.height,this._width=o.width}var e=this._getRightPosition(t);return e.top<0?this._getBottomPosition(t):(this._boundingRect=null,e)},QuestionPopover.prototype.events=function(){var t={};return $.extend(t,Popover.prototype.events),t.click="_handleClick",t}(),QuestionPopover.prototype.destroy=function(){$(document.body).off("mousedown.QuestionPopover",$.proxy(this.hide,this)),Popover.prototype.destroy.call(this)},QuestionPopover.prototype.elClass=[Popover.CLASSES.BASE,QuestionPopover.CLASSES.MAIN].join(" "),QuestionPopover.prototype.hideInternal=function(t){$(document.body).off("mousedown.QuestionPopover",$.proxy(this.hide,this)),Popover.prototype.hideInternal.call(this,t)},QuestionPopover.prototype.render=function(){Popover.prototype.render.call(this),this.setContentNode($(contentTemplate.render(this._getContentTemplateContext())))},QuestionPopover.prototype.show=function(t,o){var e=$.proxy(this.hide,this);Popover.prototype.show.call(this,t,function(){$(document.body).one("mousedown.QuestionPopover",e),o&&o()})},module.exports=QuestionPopover},{"../../../../templates/blocks/questionpopover.mustache":200,"../../../i18n/enumeration":124,"../../../ui/popover":178,"../../../util/dom":183,"../../../util/internals":185,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../node_modules/jquery/dist/jquery":97}],109:[function(_dereq_,module){var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),actionsTemplate=_dereq_("../../../templates/blocks/selectionpopover.mustache"),domUtil=_dereq_("../../util/dom"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),Popover=_dereq_("../../ui/popover"),SourceEvents=_dereq_("../../events/events").source,SelectionPopover=function(e){Popover.call(this,e),this.$antenna=e.antenna};inherits(SelectionPopover,Popover),SelectionPopover.CLASSES={ADD_ANNOTATION:"lf-add-annotation",MAIN:"lf-selection-popover",SHARE_FACEBOOK:"lf-share-facebook",SHARE_TWITTER:"lf-share-twitter"},SelectionPopover.EVENT_MAP={annotation:SourceEvents.ADD_ANNOTATION_CLICK,facebook:SourceEvents.SHARE_CLICK,twitter:SourceEvents.SHARE_CLICK},SelectionPopover.prototype.elClass=[Popover.prototype.elClass,SelectionPopover.CLASSES.MAIN].join(" "),SelectionPopover.prototype._handlePress=function(e){if(13===e.which||"keyup"!==e.type){Popover.prototype._handlePress.call(this,e);var o=$(e.target).attr("data-value");o&&(this.$antenna.trigger(SelectionPopover.EVENT_MAP[o],{value:o}),this.hide())}},SelectionPopover.prototype.destroy=function(){$(document.body).off("mousedown.SelectionPopover",$.proxy(this.hide,this,null)),Popover.prototype.destroy.call(this)},SelectionPopover.prototype.hideInternal=function(e){$(document.body).off("mousedown.SelectionPopover",$.proxy(this.hide,this,null)),Popover.prototype.hideInternal.call(this,e)},SelectionPopover.prototype.render=function(){Popover.prototype.render.call(this),this.setContentNode($(actionsTemplate.render()))},SelectionPopover.prototype.resizeAndReposition=function(e){var o=domUtil.getBoundingClientRect(e),t=o.top+domUtil.getScrollY()-this.$el.height(),r=o.width/2,i=this.$el.width()/2,n=r+domUtil.getScrollX()+o.left-i;this.$el.css({top:t,left:n})},SelectionPopover.prototype.show=function(e){var o=$.proxy(this.hide,this,null);Popover.prototype.show.call(this,e,function(){$(document.body).one("mousedown.SelectionPopover",o)}),this.$el.focus()},module.exports=SelectionPopover},{"../../../templates/blocks/selectionpopover.mustache":201,"../../events/events":123,"../../ui/popover":178,"../../util/dom":183,"./../../../../lib/inherits/inherits.js":11,"./../../../../node_modules/jquery/dist/jquery":97}],110:[function(_dereq_,module){function ThreadBtn(t){View.call(this,t),this._active=!1,this._block=t.block,this._threadBtnDelegate=t.threadBtnDelegate,this.$antenna=t.antenna,Observer(this),this.listenTo(this._block,"change:numAnnotations",$.proxy(this.render,this))}var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),Block=_dereq_("../../models/block"),EventMap=_dereq_("./../../../../lib/view/src/event-map"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),Observer=_dereq_("./../../../../lib/observer/src/observer.js"),SourceEvents=_dereq_("../../events/events").source,textEnumeration=_dereq_("../../i18n/enumeration"),threadBtnTemplate=_dereq_("../../../templates/blocks/thread-btn.mustache"),UserAgentUtil=_dereq_("../../util/useragent"),View=_dereq_("./../../../../lib/view/src/view.js");inherits(ThreadBtn,View),ThreadBtn.CLASSES={ACTIVE:"lf-active",BUTTON:"fycon-action-view",CUSTOM_BTN:"lf-custom-thread-btn",HAS_NUM:"lf-has-num",HOVER:"lf-thread-vis-hover"};var ICON_VIS={HOVER:"hover",STATIC:"static"};ThreadBtn.prototype.template=threadBtnTemplate.render.bind(threadBtnTemplate),ThreadBtn.prototype.events=new EventMap(function(){var t=ThreadBtn.CLASSES,e={};return UserAgentUtil.isMobile()?(e["tap ."+t.BUTTON]="_handleThreadBtnClick",e["mousedown ."+t.BUTTON]="_handleClearMobileMousedown",e["tapstart ."+t.BUTTON]="_handleThreadBtnMousedown"):(e["click ."+t.BUTTON]="_handleThreadBtnClick",e["keyup ."+t.BUTTON]="_handleThreadEnter",e["mousedown ."+t.BUTTON]="_handleThreadBtnMousedown"),e}),ThreadBtn.prototype._handleClearMobileMousedown=function(t){t.stopPropagation()},ThreadBtn.prototype._handleThreadEnter=function(t){t.stopPropagation(),13===t.which&&"keyup"===t.type&&this.$antenna.trigger(SourceEvents.THREAD_BTN_CLICK,{blockId:this._block.id})},ThreadBtn.prototype._handleThreadBtnClick=function(t){t.stopPropagation(),this.$antenna.trigger(SourceEvents.THREAD_BTN_CLICK,{blockId:this._block.id})},ThreadBtn.prototype._handleThreadBtnMousedown=function(t){t.stopPropagation(),this.$antenna.trigger(SourceEvents.THREAD_BTN_MOUSEDOWN,{blockId:this._block.id})},ThreadBtn.prototype._isMedia=function(){return[Block.TYPES.MEDIA,Block.TYPES.IMAGE].indexOf(this._block.blockType)>-1},ThreadBtn.prototype.destroy=function(){View.prototype.destroy.call(this),this.stopListening()},ThreadBtn.prototype.getTemplateContext=function(){var t=textEnumeration.KEYS;return{active:this._active,blockType:this._block.blockType,count:Math.max(this._block.numAnnotations||0,0),isMedia:this._isMedia(),strings:{emptyImageBlockTxt:textEnumeration.get(t.EMPTY_IMAGE_BLOCK_TXT),emptyTextBlockTxt:textEnumeration.get(t.EMPTY_TEXT_BLOCK_TXT)}}},ThreadBtn.prototype.isActive=function(){return this._active},ThreadBtn.prototype.render=function(){var t=ThreadBtn.CLASSES,e=!1;if(this._threadBtnDelegate){var n=this._threadBtnDelegate(this.getTemplateContext());n&&(n="string"==typeof n?$(n)[0]:n,this.$el.html("").append(n).addClass(t.CUSTOM_BTN),e=!0)}e||View.prototype.render.call(this);var i=Math.max(this._block.numAnnotations||0,0)>0,r=this.opts.iconVisibility.empty===ICON_VIS.HOVER,o=this.opts.iconVisibility.num===ICON_VIS.HOVER&&i;this.$("."+t.BUTTON).attr(Block.DATA_ID,this._block.id),this.$el.toggleClass(t.HAS_NUM,i),this.$el.toggleClass(t.HOVER,o||r&&!i)},ThreadBtn.prototype.setActiveState=function(t){this._active=t,this.$el.toggleClass(ThreadBtn.CLASSES.ACTIVE,t)},module.exports=ThreadBtn},{"../../../templates/blocks/thread-btn.mustache":203,"../../events/events":123,"../../i18n/enumeration":124,"../../models/block":144,"../../util/useragent":195,"./../../../../lib/inherits/inherits.js":11,"./../../../../lib/observer/src/observer.js":42,"./../../../../lib/view/src/event-map":82,"./../../../../lib/view/src/view.js":83,"./../../../../node_modules/jquery/dist/jquery":97}],111:[function(_dereq_,module){function AnnotationsCollection(t){this.protocol=t.protocol,this.block=null,this.config=null,this.selectedText=null;var e=this._erefProcessor=new ErefProcessor;this._annotationsSTC=new Adapters.AnnotationsStateToContent({erefProcessor:e}),Observer(this),this.listenTo(auth,"login.livefyre",$.proxy(this.processStoredErefs,this)),this.listenTo(auth,"logout",function(){e.setKeys([])}),this.listenTo(e,"data",$.proxy(this.fetchErefs,this)),t.bootstrapClient=this._getClient("bootstrap"),t.maxInitAttempts=10,Collection.call(this,t)}function getDefaultHandler(t,e){return function(o,n){var i=this._getClient(t),r=this._getBaseOpts();$.extend(r,o),i[e].call(i,r,getMediatedCallback(n))}}function getMediatedCallback(t){return function(e,o){e||200===o.code||(e=o.error_type),t(e,o)}}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),Adapters=_dereq_("../adapters/adapters"),AnnotationsHttpClient=_dereq_("./annotationshttpclient"),auth=_dereq_("../util/auth"),BootstrapKeys=_dereq_("../adapters/adapters").BootstrapKeys,Collection=_dereq_("./../../../lib/streamhub-sdk/src/collection/main"),CommentAnnotator=_dereq_("../adapters/commentannotator"),ErefProcessor=_dereq_("./../../../lib/eref-js/src/erefprocessor"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),memoize=_dereq_("../util/internals").memoize,Observer=_dereq_("./../../../lib/observer/src/observer.js"),permissions=_dereq_("./../../../lib/livefyre-auth/src/permissions"),Storage=_dereq_("../util/storage");inherits(AnnotationsCollection,Collection),AnnotationsCollection.prototype._handleInitComplete=function(t,e){e&&Adapters.adaptSettings(this,e),Collection.prototype._handleInitComplete.call(this,t,e);var o=e.headDocument&&e.headDocument.event;o=o||e.collectionSettings&&e.collectionSettings.event,this._updater&&(this._updater._latestEvent=o||1),this.processStoredErefs()},AnnotationsCollection.prototype.createUpdater=function(t){t=t||{};var e,o=this;return t.createStateToContent=function(t){return t&&t.authors&&o._annotationsSTC.updateAuthors(t.authors),o._annotationsSTC},t.createAnnotator=function(){return new CommentAnnotator},e=Collection.prototype.createUpdater.call(this,t),e.on("error",function(){}),e},AnnotationsCollection.prototype._getBaseOpts=function(){var t=auth.get("livefyre");return{network:this.network,environment:this.environment,collectionId:this.id,lftoken:t?t.get("token"):""}},AnnotationsCollection.prototype._getClient=function(t){return new AnnotationsHttpClient({serviceName:t})},AnnotationsCollection.prototype.destroy=function(){Collection.prototype.pause.call(this),this.stopListening(),this._annotationsSTC=null,this._erefProcessor=null,this._handleUpdate=null,this._updater=null},AnnotationsCollection.prototype.fetchErefs=function(t,e){var o=this._getClient("bootstrap"),n=this,i=this._getBaseOpts();$.extend(i,{refs:t}),o.fetchErefs(i,getMediatedCallback(function(t,o){if(t)return void(e&&e(t));var i,r=n._annotationsSTC.adaptThread(o),s=[];$.each(r,function(t,e){i=e.erefs,!i||$.isArray(i)&&!i.length||s.push(i)}),n._erefProcessor.handleDecrypted(s),n.push.apply(n,r),e&&e(t,r)}))},AnnotationsCollection.prototype.fetchThread=function(t,e){var o=this._getClient("bootstrap"),n=this._getBaseOpts(),i=this;n.blockId=t,o.getAnnotations(n,getMediatedCallback(function(o,n){if(n){var r=Storage.get(t);r&&r.setFetchedState(!0),e(o,i._annotationsSTC.adaptThread(n,!0))}}))},AnnotationsCollection.prototype.generateAdminUrl=function(){var t=this._getClient("admin"),e=this._getBaseOpts(),o=auth.get("livefyre");return[t.getUrlBase(e),"/admin/content?lftoken=",o?o.get("token"):""].join("")},AnnotationsCollection.prototype.getPermalink=function(t,e){var o=this._getClient("bootstrap"),n=this._getBaseOpts();$.extend(n,t),o.getPermalink(n,getMediatedCallback(function(t,o){e(t,Adapters.adaptPermalink(o))}))},AnnotationsCollection.prototype.getThread=function(t,e){var o=this._getClient("bootstrap"),n=this._getBaseOpts(),i=this;$.extend(n,t),o.getThread(n,getMediatedCallback(function(t,o){if(!t){var n=i._annotationsSTC.adaptPermalinkThread(o);e(t,n.blockId,n.comments)}}))},AnnotationsCollection.prototype.isCustomNetwork=memoize(function(){return!!this.network.match(/fyre\.co$/)}),AnnotationsCollection.prototype.postAnnotation=function(t,e){var o=this._getClient("quill"),n=this._getBaseOpts(),i=this;$.extend(n,t),n.postData.lftoken=n.lftoken,o.postAnnotation(n,getMediatedCallback(function(t,o){return t?void e(t):void e(t,i._annotationsSTC.adaptThread(o))}))},AnnotationsCollection.prototype.postApprove=getDefaultHandler("quill","postApprove"),AnnotationsCollection.prototype.postDelete=getDefaultHandler("quill","postDelete"),AnnotationsCollection.prototype.postEdit=getDefaultHandler("quill","postEdit"),AnnotationsCollection.prototype.postFlag=getDefaultHandler("quill","postFlag"),AnnotationsCollection.prototype.postHide=getDefaultHandler("quill","postHide"),AnnotationsCollection.prototype.postVote=function(t,e){var o=this._getClient("quill"),n=this._getBaseOpts();$.extend(n,t),o.postVote(n,getMediatedCallback(function(t,o){return t?void e(t):(o=o[BootstrapKeys.DATA],void e(t,o))}))},AnnotationsCollection.prototype.processStoredErefs=function(){var t=this,e=auth.get("livefyre");this.id&&e&&permissions.getKeys(e,this,function(e,o){t._erefProcessor.setKeys(o||[]),t._erefProcessor.processStorage()})},module.exports=AnnotationsCollection},{"../adapters/adapters":101,"../adapters/commentannotator":102,"../util/auth":181,"../util/internals":185,"../util/storage":193,"./../../../lib/eref-js/src/erefprocessor":8,"./../../../lib/inherits/inherits.js":11,"./../../../lib/livefyre-auth/src/permissions":15,"./../../../lib/observer/src/observer.js":42,"./../../../lib/streamhub-sdk/src/collection/main":60,"./../../../node_modules/jquery/dist/jquery":97,"./annotationshttpclient":112}],112:[function(_dereq_,module){function AnnotationsHttpClient(t){LivefyreHttpClient.call(this,t)}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),base64=_dereq_("./../../../lib/base64/base64"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),LivefyreHttpClient=_dereq_("./../../../lib/streamhub-sdk/src/collection/clients/http-client");inherits(AnnotationsHttpClient,LivefyreHttpClient),AnnotationsHttpClient.prototype._getCollectionUrl=function(t,e){var n=[this._getUrlBase(t),"/api/v3.0/collection/",t.collectionId].join("");return n+e},AnnotationsHttpClient.prototype._getContentUrl=function(t,e){return[this._getUrlBase(t),"/api/v3.0/content"].join("")+e},AnnotationsHttpClient.prototype._getMessageUrl=function(t,e){var n=[this._getUrlBase(t),"/api/v3.0/message/",t.messageId].join("");return n+e},AnnotationsHttpClient.prototype.getUrlBase=function(t){return this._getUrlBase(t)},AnnotationsHttpClient.prototype.getAnnotations=function(t,e){this._request({url:this._getCollectionUrl(t,"/annotation/"+t.blockId+"/")},e)},AnnotationsHttpClient.prototype.getContent=function(t,e){t=t||{},e=e||function(){};var n=t.environment=t.environment||"livefyre.com",o="livefyre.com"!==n&&"fyre"!==n&&"fy.re"!==n,i=[this._getUrlBase(t),"/bs3/v3.1/",o?t.environment+"/":"",t.network,"/",t.siteId,"/",base64.btoa(t.articleId.toString()),"/","undefined"!=typeof t.page?t.page+".json":"init"].join("");this._request({url:i},e)},AnnotationsHttpClient.prototype.getPermalink=function(t,e){this._request({data:{collection_id:t.collectionId},url:this._getMessageUrl(t,"/permalink/")},e)},AnnotationsHttpClient.prototype.getThread=function(t,e){this._request({data:{collection_id:t.collectionId,content_id:t.contentId},url:this._getContentUrl(t,"/thread/")},e)},AnnotationsHttpClient.prototype.postAnnotation=function(t,e){this._request({method:"POST",url:this._getCollectionUrl(t,"/post/annotation/"),data:t.postData},e)},AnnotationsHttpClient.prototype.postApprove=function(t,e){this._request({method:"POST",url:this._getMessageUrl(t,"/approve/"),data:{lftoken:t.lftoken,collection_id:t.collectionId}},e)},AnnotationsHttpClient.prototype.postDelete=function(t,e){this._request({method:"POST",url:this._getMessageUrl(t,"/delete/"),data:{lftoken:t.lftoken,collection_id:t.collectionId}},e)},AnnotationsHttpClient.prototype.postEdit=function(t,e){this._request({method:"POST",url:this._getMessageUrl(t,t.model.id+"/edit/"),data:{body:t.body,lftoken:t.lftoken,collection_id:t.collectionId}},e)},AnnotationsHttpClient.prototype.postFlag=function(t,e){this._request({method:"POST",url:this._getMessageUrl(t,"/flag/"+t.value+"/"),data:{lftoken:t.lftoken,collection_id:t.collectionId}},e)},AnnotationsHttpClient.prototype.postHide=function(t,e){this._request({method:"POST",url:this._getMessageUrl(t,"/hide/"),data:{lftoken:t.lftoken,collection_id:t.collectionId}},e)},AnnotationsHttpClient.prototype.postVote=function(t,e){ var n={lftoken:t.lftoken,collection_id:t.collectionId,message_id:t.messageId,value:t.value};this._request({method:"POST",url:this._getMessageUrl(t,"/vote/"),data:n},e)},AnnotationsHttpClient.prototype.fetchErefs=function(t,e){e=e||function(){};var n=[this._getUrlBase(t),"/api/v3.0/collection/",t.collectionId,"/erefs/"].join("");this._request({url:n,data:$.param({ref:t.refs,expanded:1},!0)},e)},module.exports=AnnotationsHttpClient},{"./../../../lib/base64/base64":5,"./../../../lib/inherits/inherits.js":11,"./../../../lib/streamhub-sdk/src/collection/clients/http-client":56,"./../../../node_modules/jquery/dist/jquery":97}],113:[function(_dereq_,module){function LivefyreTranslationClient(e){e=e||{},this._version=e.version||"v4",LivefyreHttpClient.call(this,e)}function isLocaldev(e){return"fyre"===e||"fy.re"===e}var inherits=_dereq_("./../../../lib/inherits/inherits.js"),LivefyreHttpClient=_dereq_("./../../../lib/streamhub-sdk/src/collection/clients/http-client");inherits(LivefyreTranslationClient,LivefyreHttpClient),LivefyreTranslationClient.prototype._serviceName="bootstrap",LivefyreTranslationClient.prototype._getHost=function(e){var t=e.environment||"livefyre.com",i="bootstrap."+t;return isLocaldev(t)&&(i="bsserver."+t),i},LivefyreTranslationClient.prototype.getTranslations=function(e,t){e=e||{},t=t||function(){};var i=this._getUrlBase(e)+"/api/"+this._version+"/configuration/"+e.network+"/site/"+e.siteId+"/",n={data:{section:"translations","translations.lang_code":e.language||window.navigator.language},url:i};e.appType&&(n.data["translations.app"]=e.appType),this._request(n,t)},module.exports=LivefyreTranslationClient},{"./../../../lib/inherits/inherits.js":11,"./../../../lib/streamhub-sdk/src/collection/clients/http-client":56}],114:[function(_dereq_,module){function parseIconVisibility(e){function t(e){if(-1===$.inArray(e,SUPPORTED_VISIBILITY))throw new TypeError(ERRORS.SUPPORTED_VISIBILITY+SUPPORTED_VISIBILITY.join(", "))}if(!e)return{empty:"static",num:"static"};var r=e;return"string"==typeof e&&(r={empty:e,num:e}),t(r.empty),t(r.num),r}function throwErr(e){throw new TypeError([e,ERRORS.MISSING].join(" "))}var $=_dereq_("./../../node_modules/jquery/dist/jquery"),ASSET_SERVER="//cdn.livefyre.com/libs/sidenotes/v1.6.0",auth=_dereq_("./util/auth"),CDN="//cdn.livefyre.com",authAdapter=_dereq_("./../../lib/livefyre-auth/src/auth-adapters"),base64=_dereq_("./../../lib/base64/base64"),selectorUtil=_dereq_("./util/selector"),styleUtil=_dereq_("./util/style"),textEnumeration=_dereq_("./i18n/enumeration"),UserAgentUtil=_dereq_("./util/useragent"),CUSTOM_ICON_CFG={height:12,marginLeft:6,marginRight:2,marginTop:1,width:12},ERRORS={ARTICLE_ID:"articleId should be in collectionMeta or configuration",AUTH:"auth",COLLECTION_META:"collectionMeta",DELEGATE:"auth delegate",META:"The signed collectionMeta is not a properly formed JWT",META_PARSE:"collectionMeta does not parse properly",MISSING:"missing from Annotations App config",SELECTOR:"selectors string, object, or element(s)",SITE_ID:"siteId should be in collectionMeta or configuration",SUPPORTED_POSITION:"invalid placement, supported placements are: ",SUPPORTED_VISIBILITY:"invalid icon visibility, supported visibilities are: "},SUPPORTED_POSITION=["smart","left","right","bottom"],SUPPORTED_VISIBILITY=["hover","static"],util={};util.data={assetServer:ASSET_SERVER,cdn:CDN},util.parseCollMeta=function(e){var t=e.split(".");if(t.length<3)throw new TypeError(ERRORS.META);var r;try{r=JSON.parse(base64.url.atob(t[1]))}catch(e){throw new TypeError(ERRORS.META_PARSE)}return r},util.parseConfig=function(e){var t={},r=e.collectionMeta,i=e.collectionMeta||throwErr(ERRORS.COLLECTION_META);if("string"==typeof i&&(i=util.parseCollMeta(i)),e.inlineThreads&&!UserAgentUtil.isMobile()&&(t.inlineThreads=!0),e.threadContainerEl&&(t.threadContainerEl=selectorUtil.matchElement(e.threadContainerEl),t.inlineThreads=!1),"string"==typeof e.position){if(-1===$.inArray(e.position,SUPPORTED_POSITION))throw new TypeError(ERRORS.SUPPORTED_POSITION+SUPPORTED_POSITION.join(", "));t.position=e.position}"string"==typeof e.customIcon&&$("head").append(_dereq_("../templates/blocks/thread-btn-override.mustache").render({customIcon:e.customIcon,customIconCfg:$.extend({},CUSTOM_ICON_CFG,e.customIconCfg)})),t.iconVisibility=parseIconVisibility(e.iconVisibility),"boolean"==typeof e.disableStream&&(t.disableStream=e.disableStream),!e.disableStream&&UserAgentUtil.isMobile()&&(t.disableStream=!0),"object"==typeof e.customStyles&&styleUtil.parseStyles(e.customStyles||{}),e.numSidenotesEl&&(t.numSidenotesEl=selectorUtil.matchElement(e.numSidenotesEl)),"function"==typeof e.threadBtnDelegate&&(t.threadBtnDelegate=e.threadBtnDelegate),"function"==typeof e.permalinkScrollDelegate&&(t.permalinkScrollDelegate=e.permalinkScrollDelegate),t.commentsOnly=!!e.commentsOnly&&e.commentsOnly,e.onInit&&"[object Array]"===Object.prototype.toString.call(e.onInit)&&(t.onInit=e.onInit);var o=i.articleId||e.articleId||e.collection.siteId||throwErr(ERRORS.ARTICLE_ID),n=i.siteId||e.siteId||e.collection.siteId||throwErr(ERRORS.SITE_ID),l=i.network||e.network||e.collection.network||"livefyre.com",a=i.environment||e.environment||null;e.authDelegate&&authAdapter.isOld(e.authDelegate)&&(auth.delegate(authAdapter.oldToNew(e.authDelegate)),window.fyre&&window.fyre.conv&&(fyre.conv.initializeGlobalServices({articleId:o,siteId:n,networkId:l,authDelegate:e.authDelegate}),fyre.conv.ready.hasFired()||fyre.conv.ready.trigger()));var s=e.strings||{};return textEnumeration.set(s),"option.selectors_prompt"===e.selectors&&(e.selectors=window.prompt("Enter the anchor selectors for Sidenotes",".article > p")),$.extend(t,{collection:e.collection||{articleId:o,network:l,siteId:n,environment:a},collectionMeta:r,defaultAvatar:ASSET_SERVER+"/images/default-avatar.png",selectors:selectorUtil.parseSelectors(e.selectors),selectorString:e.selectors,servers:{assets:ASSET_SERVER,cdn:CDN},strings:s})},module.exports=util},{"../templates/blocks/thread-btn-override.mustache":202,"./../../lib/base64/base64":5,"./../../lib/livefyre-auth/src/auth-adapters":12,"./../../node_modules/jquery/dist/jquery":97,"./i18n/enumeration":124,"./util/auth":181,"./util/selector":189,"./util/style":194,"./util/useragent":195}],115:[function(_dereq_,module){function AnalyticsController(e){BaseController.call(this,e),this._initialize()}function getTypeFromEvent(e){return[e.type,e.namespace].join(".")}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),auth=_dereq_("../util/auth"),BaseController=_dereq_("./base"),events=_dereq_("../events/events"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),trackerTemplate=_dereq_("../../templates/tracker-js.mustache"),voteEnum=_dereq_("./../../../lib/streamhub-sdk/src/content/annotator-extensions").voteEnums.vote;inherits(AnalyticsController,BaseController),AnalyticsController.EVENT_TO_STAT_MAP=function(){var e={};return e[events.source.ADD_ANNOTATION_CLICK]=["button","click","selection thread"],e[events.source.SHARE_CLICK]=["button","click","selection share"],e[events.source.THREAD_BTN_CLICK]=["button","click","thread"],e[events.user.EDIT_PROFILE]=["button","click","edit profile"],e[events.user.LOGIN]=["button","click","login"],e[events.user.LOGOUT]=["button","click","logout"],e[events.user.VIEW_PROFILE]=["button","click","view profile"],e[events.write.POST_ANNOTATION]=["comment","post"],e[events.write.POST_APPROVE]=["comment","approve"],e[events.write.POST_DELETE]=["comment","delete"],e[events.write.POST_EDIT]=["comment","edit"],e[events.write.POST_FLAG]=["comment","flag",null],e[events.write.POST_HIDE]=["comment","trash"],e[events.write.POST_REPLY]=["comment","reply"],e[events.write.POST_SHARE]=["comment","share",null],e[events.write.POST_VOTE]="_handleCommentVote",e}(),AnalyticsController.prototype.events=function(){var e={};return $.each(AnalyticsController.EVENT_TO_STAT_MAP,function(t,n){e[t]=$.isArray(n)?"_handleEvent":n}),e}(),AnalyticsController.prototype._handleEvent=function(e,t){var n=t||{},o=AnalyticsController.EVENT_TO_STAT_MAP[getTypeFromEvent(e)];return void 0===n.value?void this._send(o):void this._send($.merge($.merge([],o),[n.value]))},AnalyticsController.prototype._handleCommentVote=function(e,t){function n(e){return e===voteEnum.UPVOTE?"like":e===voteEnum.DOWNVOTE?"dislike":void 0}var o;o=t.value===voteEnum.UNSET?"un"+n(t.lastValue):n(t.value),this._send(["comment",o])},AnalyticsController.prototype._handleUserLogin=function(){var e=auth.get("livefyre"),t=e?e.get("id"):null;t&&(window.lft("set","userId",t),this._send(["login"]))},AnalyticsController.prototype._handleUserLogout=function(){window.lft("set","userId",""),this._send(["logout"])},AnalyticsController.prototype._initialize=function(){window.lft||this.$antenna.append(trackerTemplate.render({cdn:this._config.servers.cdn}));var e=window.lft;e("set","app","sidenotes"),e("set","collectionId",this._collection.id),e("set","siteId",this._collection.siteId),e("set","networkId",this._collection.networkId),auth.on("login.livefyre",$.proxy(this._handleUserLogin,this)),auth.on("logout",$.proxy(this._handleUserLogout,this))},AnalyticsController.prototype._send=function(e){var t=window.lft;t.apply(t,$.merge(["send","event"],e))},module.exports=AnalyticsController},{"../../templates/tracker-js.mustache":251,"../events/events":123,"../util/auth":181,"./../../../lib/inherits/inherits.js":11,"./../../../lib/streamhub-sdk/src/content/annotator-extensions":65,"./../../../node_modules/jquery/dist/jquery":97,"./base":116}],116:[function(_dereq_,module){function BaseController(e){EventEmitter.call(this),this.$antenna=e.antenna,this.$globalAntenna=$(document.body),this._collection=e.collection,this._config=e.config,this._uid=delegate.getUniqueId(),this.delegateEvents(),this.delegateEvents(this.$globalAntenna,this.globalEvents)}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),delegate=_dereq_("./../../../lib/view/src/delegate"),EventEmitter=_dereq_("./../../../lib/event-emitter/src/event-emitter"),inherits=_dereq_("./../../../lib/inherits/inherits.js");inherits(BaseController,EventEmitter),BaseController.onlyHandleExternalMessage=function(e){return function(t,n){t.target!==this.$antenna[0]&&e.call(this,t,n)}},BaseController.prototype.events={},BaseController.prototype.globalEvents={},BaseController.prototype.bindListeners=function(e){if(this.containerEvents){var t=this;e.on(this.containerEvents.join(" "),function(e,n){t.$antenna.trigger([e.type,e.namespace].join("."),n)})}},BaseController.prototype.delegateEvents=function(e,t){delegate.delegateEvents(e||this.$antenna,t||this.events,this._uid,this)},BaseController.prototype._getActiveBlock=function(){return this._collection.block},BaseController.prototype.destroy=function(){delegate.undelegateEvents(this.$antenna,this._uid),delegate.undelegateEvents(this.$globalAntenna,this._uid),this.$antenna=this.$globalAntenna=null},module.exports=BaseController},{"./../../../lib/event-emitter/src/event-emitter":10,"./../../../lib/inherits/inherits.js":11,"./../../../lib/view/src/delegate":81,"./../../../node_modules/jquery/dist/jquery":97}],117:[function(_dereq_,module){function BodyController(e){BaseController.call(this,e)}var BaseController=_dereq_("./base"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),ThreadEvents=_dereq_("../events/events").thread;inherits(BodyController,BaseController),BodyController.prototype.globalEvents={"mousedown.BodyController":"_handleBodyMousedown"},BodyController.prototype._handleBodyMousedown=function(){this.$antenna.trigger(ThreadEvents.DESTROY_THREAD)},module.exports=BodyController},{"../events/events":123,"./../../../lib/inherits/inherits.js":11,"./base":116}],118:[function(_dereq_,module){function CommentController(e){BaseController.call(this,e)}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),BaseController=_dereq_("./base"),CommentEvents=_dereq_("../events/events").comment,inherits=_dereq_("./../../../lib/inherits/inherits.js"),internals=_dereq_("../util/internals"),requireAuth=_dereq_("../util/auth").requireAuth,SocialUtil=_dereq_("../util/social"),SourceEvents=_dereq_("../events/events").source,WriteEvents=_dereq_("../events/events").write;inherits(CommentController,BaseController);var COLLECTION_FN_MAP=function(){var e={};return e[CommentEvents.GET_PERMALINK]="getPermalink",e[WriteEvents.POST_APPROVE]="postApprove",e[WriteEvents.POST_DELETE]="postDelete",e[WriteEvents.POST_EDIT]="postEdit",e[WriteEvents.POST_FLAG]="postFlag",e[WriteEvents.POST_HIDE]="postHide",e[WriteEvents.POST_VOTE]="postVote",e}(),SUCCESS_EVENT_MAP=function(){var e={};return e[WriteEvents.POST_FLAG]=WriteEvents.COMMENT_FLAGGED,e[WriteEvents.POST_VOTE]=WriteEvents.COMMENT_VOTED,e}(),SHARE_POPUP_HEIGHT=420,SHARE_POPUP_WIDTH=550,SHARE_URLS={facebook:"https://www.facebook.com/dialog/feed",twitter:"https://twitter.com/intent/tweet"};CommentController.prototype.events=function(){var e={};return e[CommentEvents.GET_PERMALINK]="_handleEvent",e[SourceEvents.SHARE_CLICK]="_handleSourceShare",e[WriteEvents.POST_ANNOTATION]="_handlePostAnnotation",e[WriteEvents.POST_APPROVE]="_handleAuthenticatedEvent",e[WriteEvents.POST_EDIT]="_handleAuthenticatedEvent",e[WriteEvents.POST_DELETE]="_handleAuthenticatedEvent",e[WriteEvents.POST_FLAG]="_handleEvent",e[WriteEvents.POST_HIDE]="_handleAuthenticatedEvent",e[WriteEvents.POST_REPLY]="_handlePostAnnotation",e[WriteEvents.POST_SHARE]="_handleShare",e[WriteEvents.POST_VOTE]="_handleAuthenticatedEvent",e}(),CommentController.prototype._handleAuthenticatedEvent=requireAuth(function(e,t){this._handleEvent(e,t)}),CommentController.prototype._handleEvent=function(e,t){var n=e.type+"."+e.namespace,o=COLLECTION_FN_MAP[n],r=this,i=SUCCESS_EVENT_MAP[n];this._collection[o].call(this._collection,t,function(n,o){(t.callback||internals.nullFunction)(n,o),r.$antenna.trigger(CommentEvents.ACTION_SUCCESS,{event:e}),i&&r.$antenna.trigger(i,t)})},CommentController.prototype._handlePostAnnotation=requireAuth(function(e,t){t.postData=this._hydrateAnnotation(t);var n=this;this._collection.postAnnotation(t,function(e,o){e&&t.callback(e),!e&&n._collection.block&&(t.callback(e,o),n._collection.push.apply(n._collection,o),n.$antenna.trigger(WriteEvents.COMMENT_POSTED,o[0]))})}),CommentController.prototype._handleShare=function(e,t){var n=SHARE_URLS[t.value],o=["height=",SHARE_POPUP_HEIGHT,",width=",SHARE_POPUP_WIDTH].join(""),r=t.model||{author:{displayName:this._config.twitterHandle||""},body:t.body||this._collection.selectedText||"",isSource:t.isSource,permalink:window.location.href},i=SocialUtil.contentToShare(r,t.value);i.assetServer=this._config.servers.assets,i.provider=t.value;var l=SocialUtil.generateParams(i);window.open(n+l,"intent",o),this.$antenna.trigger(WriteEvents.COMMENT_SHARED,$.extend({},r,i))},CommentController.prototype._handleSourceShare=function(e,t){t.isSource=!0,this._handleShare(e,t)},CommentController.prototype._hydrateAnnotation=function(e){var t={},n=this._getActiveBlock();return t.block_id=n.getId(),t.body=e.body,t._bi=Math.random(),t.share_types=e.shareTypes,e.parentId?(t.parent_id=e.parentId,t):(t.block_type=n.blockType,t.index=n.index,t.hash=n.simhash,t.full_text=n.content,t.selected_text=this._collection.selectedText,t)},module.exports=CommentController},{"../events/events":123,"../util/auth":181,"../util/internals":185,"../util/social":191,"./../../../lib/inherits/inherits.js":11,"./../../../node_modules/jquery/dist/jquery":97,"./base":116}],119:[function(_dereq_,module){function CookieController(o){BaseController.call(this,o)}var auth=_dereq_("../util/auth"),BaseController=_dereq_("./base"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),permalinkUtil=_dereq_("../util/permalink"),Store=_dereq_("store"),UserEvents=_dereq_("../events/events").user;CookieController.prototype.COOKIE_KEY="sidenotes-auth",inherits(CookieController,BaseController),CookieController.prototype.COOKIE_KEY="sidenotes-auth",CookieController.prototype._permalinkUtil=permalinkUtil,CookieController.prototype.events=function(){var o={};return o[UserEvents.LOGIN]="_createCookie",o}(),CookieController.prototype.checkForCookie=function(){var o=Store.get(this.COOKIE_KEY);o&&o.collectionId&&void 0!==o.blockId&&this._collection.id===o.collectionId&&this._permalinkUtil.scrollToPermalink(o.blockId),this._removeCookie(),auth.on("login",this._removeCookie)},CookieController.prototype._createCookie=function(){auth.get("livefyre")||Store.set(this.COOKIE_KEY,{collectionId:this._collection.id,blockId:this._collection.block.id})},CookieController.prototype._removeCookie=function(){Store.remove(this.COOKIE_KEY)},CookieController.prototype.destroy=function(){auth.removeListener("login",this._removeCookie),BaseController.prototype.destroy.call(this)},module.exports=CookieController},{"../events/events":123,"../util/auth":181,"../util/permalink":188,"./../../../lib/inherits/inherits.js":11,"./base":116,store:98}],120:[function(_dereq_,module){function ExternalController(e){BaseController.call(this,e),this._app=e.app,Observer(this),this.listenTo(auth,"login.livefyre",$.proxy(this._onUserLoggedIn,this)),this.listenTo(auth,"logout",$.proxy(this._onUserLoggedOut,this))}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),auth=_dereq_("../util/auth"),BaseController=_dereq_("./base"),BlockEvents=_dereq_("../events/events").block,ExternalEvents=_dereq_("../events/events").external,inherits=_dereq_("./../../../lib/inherits/inherits.js"),Observer=_dereq_("./../../../lib/observer/src/observer.js"),UserEvents=_dereq_("../events/events").user,WriteEvents=_dereq_("../events/events").write;inherits(ExternalController,BaseController),ExternalController.prototype.events=function(){var e={};return e[BlockEvents.COUNT_UPDATED]="_onBlockCountUpdate",e[UserEvents.LOGIN]="_onUserLoggingIn",e[WriteEvents.COMMENT_FLAGGED]="_onCommentFlagged",e[WriteEvents.COMMENT_POSTED]="_onCommentPosted",e[WriteEvents.COMMENT_SHARED]="_onCommentShared",e[WriteEvents.COMMENT_VOTED]="_onCommentVoted",e}(),ExternalController.prototype._onBlockCountUpdate=function(e,t){this._app.emit(ExternalEvents.BLOCK_COUNT_UPDATE,t)},ExternalController.prototype._onCommentFlagged=function(e,t){this._app.emit(ExternalEvents.COMMENT_FLAGGED,{targetId:t.messageId,type:t.value})},ExternalController.prototype._onCommentPosted=function(e,t){this._app.emit(ExternalEvents.COMMENT_POSTED,{authorId:t.author.id,bodyHtml:t.body,id:t.id,parent:t.parentId})},ExternalController.prototype._onCommentShared=function(e,t){this._app.emit(ExternalEvents.COMMENT_SHARED,{targetId:t.id,sharedToFacebook:"facebook"===t.provider,sharedToTwitter:"twitter"===t.provider})},ExternalController.prototype._onCommentVoted=function(e,t){this._app.emit(ExternalEvents.COMMENT_VOTED,{targetId:t.messageId,targetAuthorId:t.authorId,type:t.value})},ExternalController.prototype._onUserLoggedIn=function(e){this._app.emit(ExternalEvents.USER_LOGGED_IN,{avatar:e.get("avatar"),displayName:e.get("displayName"),id:e.get("id"),isModerator:e.isMod({collectionId:this._collection.id})})},ExternalController.prototype._onUserLoggedOut=function(){this._app.emit(ExternalEvents.USER_LOGGED_OUT)},ExternalController.prototype._onUserLoggingIn=function(){this._app.emit(ExternalEvents.USER_LOGGING_IN)},ExternalController.prototype.destroy=function(){BaseController.prototype.destroy.call(this),this.stopListening()},module.exports=ExternalController},{"../events/events":123,"../util/auth":181,"./../../../lib/inherits/inherits.js":11,"./../../../lib/observer/src/observer.js":42,"./../../../node_modules/jquery/dist/jquery":97,"./base":116}],121:[function(_dereq_,module){function TranslationController(t){t=t||{},this._appType="sidenotes",this._client=new LivefyreTranslationClient,this._strings=t.strings||{}}var LivefyreTranslationClient=_dereq_("../clients/translationclient"),Promise=_dereq_("es6-promise").Promise,textEnumeration=_dereq_("../i18n/enumeration");TranslationController.prototype.fetchTranslations=function(t){var e=this;return t.appType=this._appType,new Promise(function(n){return"livefyre.com"===t.network?n():void e._client.getTranslations(t,function(t,i){t||200!==i.code||(textEnumeration.set((i.data.translations||{})[e._appType]||{}),textEnumeration.set(e._strings)),n()})})},module.exports=TranslationController},{"../clients/translationclient":113,"../i18n/enumeration":124,"es6-promise":92}],122:[function(_dereq_,module){var visibilityEnum=_dereq_("./../../lib/streamhub-sdk/src/content/main").enums.visibility,enums={};enums.commentVisibility={NONE:visibilityEnum[0],EVERYONE:visibilityEnum[1],OWNER:visibilityEnum[2],GROUP:visibilityEnum[3]},enums.navigableViews={AUTH:"auth",CONFIRM:"confirm",EDIT:"edit",EDITOR:"editor",ETC:"etc",FLAG:"flag",INFO:"info",REPLIES:"commentreplies",SHARE:"share",THREAD:"thread",USER:"user"},module.exports=enums},{"./../../lib/streamhub-sdk/src/content/main":67}],123:[function(_dereq_,module){var Events={};Events.block={UPDATE_COUNT:"block.update_count",COUNT_UPDATED:"block.manual_update_count"},Events.comment={ACTION_SUCCESS:"comment.action_success",HIDDEN:"comment.hidden",GET_PERMALINK:"comment.get_permalink"},Events.content={FETCH_EREFS:"content.fetch_erefs"},Events.editor={HIDE:"editor.hide"},Events.source={ADD_ANNOTATION_CLICK:"source.add_annotation_click",SHARE_CLICK:"source.share_click",TEXT_HIGHLIGHTED:"source.text_highlighted",THREAD_BTN_CLICK:"source.thread_btn_click",THREAD_BTN_MOUSEDOWN:"source.thread_btn_mousedown"},Events.thread={ACTIVATE_BLOCK:"thread.activate_block",ACTIVATE_HIGHLIGHTED_TEXT:"thread.activate_highlighted_text",ACTIVATE_THREAD:"thread.activate_thread",CHANGE_VIEW:"thread.change_view",DEACTIVATE_HIGHLIGHTED_TEXT:"thread.deactivate_highlighted_text",DESTROY_THREAD:"thread.destroy_thread",NAVIGATE:"thread.navigate",NAVIGATE_BACK:"thread.navigate_back",NAVIGATE_TO_THREAD:"thread.navigate_to_thread",PERMALINK_BACK:"thread.permalink_back",SHOW_QUEUED_CONTENT:"thread.show_queued_content",TUCK_THREAD:"thread.tuck",UNTUCK_THREAD:"thread.untuck"},Events.user={ADMIN:"user.admin",EDIT_PROFILE:"user.edit_profile",LOGIN:"user.login",LOGOUT:"user.logout",VIEW_PROFILE:"user.view_profile"},Events.write={COMMENT_FLAGGED:"write.comment_flagged",COMMENT_POSTED:"write.comment_posted",COMMENT_SHARED:"write.comment_shared",COMMENT_VOTED:"write.comment_voted",POST_ANNOTATION:"write.post_annotation",POST_APPROVE:"write.post_approve",POST_DELETE:"write.post_delete",POST_EDIT:"write.post_edit",POST_FLAG:"write.post_flag",POST_HIDE:"write.post_hide",POST_REPLY:"write.post_reply",POST_SHARE:"write.post_share",POST_VOTE:"write.post_vote"},Events.external={BLOCK_COUNT_UPDATE:"sidenotes.blockCountUpdate",COMMENT_FLAGGED:"sidenotes.commentFlagged",COMMENT_POSTED:"sidenotes.commentPosted",COMMENT_SHARED:"sidenotes.commentShared",COMMENT_VOTED:"sidenotes.commentVoted",INITIALIZED:"sidenotes.initialized",USER_LOGGED_IN:"sidenotes.userLoggedIn",USER_LOGGED_OUT:"sidenotes.userLoggedOut",USER_LOGGING_IN:"sidenotes.userLoggingIn"},module.exports=Events},{}],124:[function(_dereq_,module){var TextEnumeration=function(){this.values_={},this.set(TextEnumeration.VALUES)};TextEnumeration.prototype.KEYS={APP_NAME:"appName",APP_VERSION:"appVersion",COMMENT_MODERATOR_TAG:"commentModeratorTag",COMMENT_PENDING_TAG:"commentPendingTag",COMMENT_VOTE_COUNT:"commentVoteCount",COMMENT_VOTE_COUNT_SING:"commentVoteCountSing",COMMENT_READ_MORE:"commentReadMoreLink",COMMENT_REPLY_LINK:"commentReplyLink",COMMENT_REPLY_LINK_SING:"commentReplyLinkSing",DATETIME_MINUTE_ABBREVIATION:"datetimeMinutePrefix",DATETIME_MONTHS:"datetimeMonths",EDITOR_EDIT_BTN:"editorEditBtn",EDITOR_PLACEHOLDER:"editorPlaceholder",EDITOR_POST_BTN:"editorPostBtn",EDITOR_POST_BTN_MOBILE:"editorPostBtnMobile",EDITOR_POSTING:"editorPosting",EDITOR_REPLY_BTN:"editorReplyBtn",EDITOR_TITLE:"editorTitle",EDITOR_REPLY_TITLE:"editorReplyTitle",EDITOR_EDIT_POSTING:"editorEditPosting",EDITOR_EDIT_TITLE:"editorEditTitle",EDITOR_EDIT_REPLY_TITLE:"editorEditReplyTitle",EMPTY_IMAGE_BLOCK_TXT:"emptyImageBlockTxt",EMPTY_TEXT_BLOCK_TXT:"emptyTextBlockTxt",MENU_AUTH_SIGN_IN_BTN:"menuAuthSignInBtn",MENU_AUTH_SIGNED_IN_MSG:"menuAuthSignedInMsg",MENU_BACK_BTN:"menuBackBtn",MENU_CONFIRM_ACCEPT:"menuConfirmAccept",MENU_CONFIRM_CANCEL:"menuConfirmCancel",MENU_CONFIRM_TITLE:"menuConfirmTitle",MENU_ETC_OPTION_APPROVE:"menuEtcOptionApprove",MENU_ETC_OPTION_DELETE:"menuEtcOptionDelete",MENU_ETC_OPTION_EDIT:"menuEtcOptionEdit",MENU_ETC_OPTION_FLAG:"menuEtcOptionFlag",MENU_ETC_OPTION_SHARE:"menuEtcOptionShare",MENU_ETC_POSTED_AT:"menuEtcPostedAt",MENU_ETC_TITLE:"menuEtcTitle",MENU_FLAG_OPTION_DISAGREE:"menuFlagOptionDisagree",MENU_FLAG_OPTION_OFFENSIVE:"menuFlagOptionOffensive",MENU_FLAG_OPTION_OFF_TOPIC:"menuFlagOptionOffTopic",MENU_FLAG_OPTION_SPAM:"menuFlagOptionSpam",MENU_FLAG_TITLE:"menuFlagTitle",MENU_INFO_COPYRIGHT:"menuInfoCopyright",MENU_INFO_HELP:"menuInfoHelp",MENU_INFO_LF_LINK:"menuInfoLivefyreLink",MENU_REPLIES_VIEW_TITLE:"menuRepliesViewTitle",MENU_REPLIES_VIEW_REPLY:"menuRepliesViewReply",MENU_SHARE_OPTION_FACEBOOK:"menuShareOptionFacebook",MENU_SHARE_OPTION_TWITTER:"menuShareOptionTwitter",MENU_SHARE_TITLE:"menuShareTitle",MENU_USER_EDIT_PROFILE:"menuUserEditProfile",MENU_USER_ADMIN:"menuUserAdmin",MENU_USER_LOGOUT:"menuUserLogout",MENU_USER_BACK_BTN:"menuUserBackBtn",QUESTION_EXPLANATION:"questionExplanation",QUESTION_MOCK_TEXT:"questionMockText",QUESTION_TITLE:"questionTitle",QUEUED_COMMENTS_PLURAL:"queuedCommentsPlural",QUEUED_COMMENTS_SINGULAR:"queuedCommentsSingular",QUEUED_REPLIES_PLURAL:"queuedRepliesPlural",QUEUED_REPLIES_SINGULAR:"queuedRepliesSingular",REPLY_BTN:"replyBtn",SIGN_IN_TO_POST:"signInToPost",THREAD_COLLAPSE_BTN:"threadCollapseBtn",THREAD_EXPAND_BTN_PLURAL:"threadExpandBtnPlural",THREAD_EXPAND_BTN_SINGULAR:"threadExpandBtnSingular",THREAD_REPLY_BTN:"threadReplyBtn",PERMALINK_TITLE:"permalinkTitle",PERMALINK_BACK_BTN:"permalinkBackBtn",PERMALINK_MISSING:"permalinkMissing",NOTIFICATION_APPROVED:"notificationApproved",NOTIFICATION_DELETED:"notificationDeleted",NOTIFICATION_FLAGGED:"notificationFlagged",FACEBOOK_SHARE_DESCRIPTION:"facebookShareDescription",FACEBOOK_SHARE_DESCRIPTION_SOURCE:"facebookShareDescriptionSource",FACEBOOK_SHARE_CAPTION:"facebookShareCaption",SLIDER_COMMENT_TALLY:"sliderCommentTally",SLIDER_INVITE_READ:"sliderInviteRead",SLIDER_INVITE_WRITE:"sliderInviteWrite",SLIDER_LOADING:"sliderLoading",SLIDER_WRITE_TEXT:"sliderWriteText",ERROR_CONNECTION:"errorConnection",ERROR_DUPLICATE:"errorDuplicate",ERROR_GENERAL:"errorGeneral",ERROR_SERVER:"errorServer"},TextEnumeration.VALUES=function(){var E={},e=TextEnumeration.prototype.KEYS;return E[e.APP_NAME]="Sidenotes",E[e.APP_VERSION]="v1.2.1",E[e.COMMENT_MODERATOR_TAG]="Mod",E[e.COMMENT_PENDING_TAG]="Pending",E[e.COMMENT_READ_MORE]="Read More",E[e.COMMENT_REPLY_LINK]="See {number} replies",E[e.COMMENT_REPLY_LINK_SING]="See reply",E[e.COMMENT_VOTE_COUNT]="votes",E[e.COMMENT_VOTE_COUNT_SING]="vote",E[e.DATETIME_MINUTE_ABBREVIATION]="m",E[e.DATETIME_MONTHS]=["January","February","March","April","May","June","July","August","September","October","November","December"],E[e.EDITOR_EDIT_BTN]="Save",E[e.EDITOR_PLACEHOLDER]="What do you think?",E[e.EDITOR_POST_BTN]="Post Sidenote",E[e.EDITOR_POST_BTN_MOBILE]="Post",E[e.EDITOR_POSTING]="Posting...",E[e.EDITOR_REPLY_BTN]="Post Reply",E[e.EDITOR_TITLE]="Write Sidenote",E[e.EDITOR_REPLY_TITLE]="Write Reply",E[e.EDITOR_EDIT_POSTING]="Saving...",E[e.EDITOR_EDIT_TITLE]="Edit Sidenote",E[e.EDITOR_EDIT_REPLY_TITLE]="Edit Reply",E[e.EMPTY_IMAGE_BLOCK_TXT]="What do you think?",E[e.EMPTY_TEXT_BLOCK_TXT]="+",E[e.MENU_AUTH_SIGN_IN_BTN]="Sign in",E[e.MENU_AUTH_SIGNED_IN_MSG]="You must be signed in to {action}",E[e.MENU_BACK_BTN]="Back",E[e.MENU_CONFIRM_ACCEPT]="Yes, {action}",E[e.MENU_CONFIRM_CANCEL]="Cancel",E[e.MENU_CONFIRM_TITLE]="Are you sure?",E[e.MENU_ETC_OPTION_APPROVE]="Approve",E[e.MENU_ETC_OPTION_DELETE]="Delete",E[e.MENU_ETC_OPTION_EDIT]="Edit",E[e.MENU_ETC_OPTION_FLAG]="Flag",E[e.MENU_ETC_OPTION_SHARE]="Share",E[e.MENU_ETC_POSTED_AT]="Posted on {date}",E[e.MENU_ETC_TITLE]="More",E[e.MENU_INFO_COPYRIGHT]="© Livefyre, Inc. 2016",E[e.MENU_INFO_HELP]="Help",E[e.MENU_INFO_LF_LINK]="Visit Livefyre.com",E[e.MENU_FLAG_OPTION_DISAGREE]="Disagree",E[e.MENU_FLAG_OPTION_OFFENSIVE]="Offensive",E[e.MENU_FLAG_OPTION_OFF_TOPIC]="Off Topic",E[e.MENU_FLAG_OPTION_SPAM]="Spam",E[e.MENU_FLAG_TITLE]="Flag as...",E[e.MENU_REPLIES_VIEW_TITLE]="Details",E[e.MENU_REPLIES_VIEW_REPLY]="Reply to Conversation",E[e.MENU_SHARE_OPTION_FACEBOOK]="Facebook",E[e.MENU_SHARE_OPTION_TWITTER]="Twitter",E[e.MENU_SHARE_TITLE]="Share",E[e.MENU_USER_EDIT_PROFILE]="Edit Profile",E[e.MENU_USER_ADMIN]="Admin Console",E[e.MENU_USER_LOGOUT]="Sign Out",E[e.MENU_USER_BACK_BTN]="All",E[e.QUEUED_COMMENTS_PLURAL]="{number} New Sidenotes",E[e.QUEUED_COMMENTS_SINGULAR]="1 New Sidenote",E[e.QUEUED_REPLIES_PLURAL]="{number} New Replies",E[e.QUEUED_REPLIES_SINGULAR]="1 New Reply",E[e.QUESTION_TITLE]="What is a Sidenote?",E[e.QUESTION_EXPLANATION]='You can now read and write comments directly on sentences, paragraphs, images and quotes.

Highlight text and click the icon or click the icon at the end of each paragraph.',E[e.QUESTION_MOCK_TEXT]="What is “familiarly known” is not properly known, just for the reason that it is “familiar”.",E[e.REPLY_BTN]="Reply",E[e.SIGN_IN_TO_POST]="Sign in to write a sidenote",E[e.THREAD_COLLAPSE_BTN]="Collapse",E[e.THREAD_EXPAND_BTN_PLURAL]="Expand {number} Replies",E[e.THREAD_EXPAND_BTN_SINGULAR]="Expand 1 Reply",E[e.THREAD_REPLY_BTN]="Reply to Conversation",E[e.PERMALINK_TITLE]="Permalink",E[e.PERMALINK_BACK_BTN]="All",E[e.PERMALINK_MISSING]="This Sidenote is no longer visible.",E[e.NOTIFICATION_APPROVED]="Approved",E[e.NOTIFICATION_DELETED]="Deleted",E[e.NOTIFICATION_FLAGGED]="Flagged",E[e.FACEBOOK_SHARE_DESCRIPTION]='Check out this Sidenote: "{body}"',E[e.FACEBOOK_SHARE_DESCRIPTION_SOURCE]='"{body}"',E[e.FACEBOOK_SHARE_CAPTION]='Sidenotes on "{title}"',E[e.SLIDER_COMMENT_TALLY]="of",E[e.SLIDER_INVITE_READ]="Read",E[e.SLIDER_INVITE_WRITE]="Slide to Comment",E[e.SLIDER_LOADING]="Loading...",E[e.SLIDER_WRITE_TEXT]="What do you think? Tap to write.",E[e.ERROR_CONNECTION]="Uh-oh. You don't seem to have a good connection.",E[e.ERROR_DUPLICATE]="We like your note too, but you can't post it twice.",E[e.ERROR_GENERAL]="An error has occurred. Please try again.",E[e.ERROR_SERVER]="Something went wrong with our server. Try that again?",E}(),TextEnumeration.prototype.get=function(E){return this.values_[E]},TextEnumeration.prototype.getAndReplace=function(E,e){var _=this.get(E);if(!_||-1===_.indexOf("%s"))return _;for(var T=e.length,t=0;T>t;t++)_=_.replace(/\%s/,e[t]);return _},TextEnumeration.prototype.reset=function(){this.set(TextEnumeration.VALUES)},TextEnumeration.prototype.set=function(E,e){if("string"==typeof E)return void(this.values_[E]=e);var _;for(_ in E)E.hasOwnProperty(_)&&this.set(_,E[_])},module.exports=new TextEnumeration},{}],125:[function(_dereq_,module){function AnnotationApp(t){EventEmitter.call(this),this._initMessenger(),this._blockController=null,this._bodyController=null,this._commentController=null,this._externalController=null,this._streamRunning=!1,this._threadController=null,this._userController=null,this._config=null,this._initFlags={},Observer(this),this._config=parseConfig(t),this._initialize()}function createThreadController(t){var e;return new(e=_dereq_(UserAgentUtil.isMobile()?"./mobile/thread/controller":"./thread/controller"))(t)}var $=_dereq_("./../../node_modules/jquery/dist/jquery"),AnnotationsCollection=(_dereq_("./controller/analytics"),_dereq_("./clients/annotationscollection")),BlockController=_dereq_("./blocks/controller"),CommentController=_dereq_("./controller/comment"),CommentsOnlyController=_dereq_("./blocks/commentsonlycontroller"),CookieController=_dereq_("./controller/cookie"),domUtil=(_dereq_("./config").data, _dereq_("./util/dom")),EventEmitter=_dereq_("./../../lib/event-emitter/src/event-emitter"),ExternalController=_dereq_("./controller/external"),ExternalEvents=_dereq_("./events/events").external,inherits=_dereq_("./../../lib/inherits/inherits.js"),Observer=_dereq_("./../../lib/observer/src/observer.js"),parseConfig=_dereq_("./config").parseConfig,Promise=_dereq_("es6-promise").Promise,ScriptLoader=_dereq_("./../../lib/scriptloader/src/javascript/scriptloader.js"),selectorUtil=_dereq_("./util/selector"),TranslationController=_dereq_("./controller/translation"),UserAgentUtil=_dereq_("./util/useragent"),UserController=_dereq_("./user/controller");inherits(AnnotationApp,EventEmitter);var messengerId=0;AnnotationApp.prototype._createBodyController=function(t){var e;return this._config.inlineThreads?void 0:new(e=_dereq_(UserAgentUtil.isMobile()?"./mobile/controller/body":"./controller/body"))(t)},AnnotationApp.prototype._getControllerOptions=function(){return{app:this,antenna:this.$antenna,collection:this._collection,config:this._config}},AnnotationApp.prototype._initMessenger=function(){messengerId++;var t=this;this.$antenna=$('
'),domUtil.raf(function(){t.$antenna.appendTo(document.body)})},AnnotationApp.prototype._handleCollectionInitComplete=function(t,e){var o,n=this;UserAgentUtil.isMobile()?(o=this._config.servers.assets+"/css/mobile-block.css",_dereq_("./mobile/jquery-mobile-events")):o=this._config.servers.assets+"/css/block.css",this._blockController.initialize(t),this.updateAnchors(void 0,function(){n._executeOnInit({collectionInitialized:!0}),n.emit(ExternalEvents.INITIALIZED),n.cookieController&&n.cookieController.checkForCookie(),e&&e(),domUtil.raf(function(){ScriptLoader.loadCSS(o)})})},AnnotationApp.prototype._initialize=function(){var t=this._config.collection,e={environment:t.environment,network:t.network,siteId:t.siteId},o=new TranslationController({strings:this._config.strings}),n=this;this._collection=new AnnotationsCollection($.extend({},e,{articleId:this._config.collection.articleId,collectionMeta:this._config.collectionMeta,signed:"string"==typeof this._config.collectionMeta}));var r=new Promise(function(t,e){n._collection.initFromBootstrap(function(o,n,r){return o?e():void t([n,r])})});Promise.all([o.fetchTranslations(e),r]).then($.proxy(this._handleInitComplete,this))},AnnotationApp.prototype._handleInitComplete=function(t){this._loadControllers(),this.startStream(),this._executeOnInit({constructed:!0}),this._handleCollectionInitComplete.apply(this,t[1])},AnnotationApp.prototype._loadControllers=function(){var t=this._getControllerOptions();this._blockController=this._config.commentsOnly?new CommentsOnlyController(t):new BlockController(t),this._bodyController=this._createBodyController(t),this._commentController=new CommentController(t),this._cookieController=this._config.commentsOnly?null:new CookieController(t),this._externalController=new ExternalController(t),this._threadController=createThreadController(t),this._userController=new UserController(t)},AnnotationApp.prototype.destroy=function(){this.stopStream(),this._collection&&this._collection.destroy(),this._collection=null,this._config=null,this._blockController&&this._blockController.destroy(),this._blockController=null,this._bodyController&&this._bodyController.destroy(),this._bodyController=null,this._commentController&&this._commentController.destroy(),this._commentController=null,this._externalController&&this._externalController.destroy(),this._externalController=null,this._threadController&&this._threadController.destroy(),this._threadController=null,this._userController&&this._userController.destroy(),this._userController=null,this.$antenna.remove()},AnnotationApp.prototype.startStream=function(){if(!this._streamRunning){this._streamRunning=!0;var t=$.proxy(this._threadController.handleReadable,this._threadController);this.listenTo(this._collection,"readable",t),this._config.disableStream&&this._collection.pause()}},AnnotationApp.prototype.stopStream=function(){this._streamRunning&&(this._streamRunning=!1,this.stopListening())},AnnotationApp.prototype.updateAnchors=function(t,e){if(!this._blockController)throw"Sidenotes app has not initialized yet, please wait...";var o=t||this._config.selectorString;o=selectorUtil.parseSelectors(o),o=o.not(":has(.lf-thread-btn)").not(":has(.lf-mobile-thread-btn)"),this._blockController.initializeBlocks(o,e)},AnnotationApp.prototype.removeAnchors=function(t){if(!this._blockController)throw"Sidenotes app has not initialized yet, please wait...";var e=this;t=selectorUtil.parseSelectors(t),t.each(function(t,o){e._blockController.unwrapBlockByElement(o)})},AnnotationApp.prototype.manualActivateThread=function(t,e){this._config.commentsOnly&&(this._threadController.deactivating||(this._blockController.updateManualBlock(t,e),this._threadController._activateThread()))},AnnotationApp.prototype.manualDestroyThread=function(){this._config.commentsOnly&&this._threadController._destroyThread()},AnnotationApp.prototype.getBlockCount=function(t){return this._config.commentsOnly?this._blockController.getBlockCount(t):void 0},AnnotationApp.prototype._executeOnInit=function(t){var e=this._config.onInit;if($.extend(this._initFlags,t),e&&this._initFlags.constructed&&this._initFlags.collectionInitialized)for(var o=0;o-1&&(n.indexOf("windows")>-1||n.indexOf("macintosh")>-1||n.indexOf("linux")>-1)&&n.indexOf("mobile")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:"ontouchstart"in document.documentElement&&!o,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:"ontouchstart"in document.documentElement&&!o?"touchstart":"mousedown",endevent:"ontouchstart"in document.documentElement&&!o?"touchend":"mouseup",moveevent:"ontouchstart"in document.documentElement&&!o?"touchmove":"mousemove",tapevent:"ontouchstart"in document.documentElement&&!o?"tap":"click",scrollevent:"ontouchstart"in document.documentElement&&!o?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tap","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,n=e(t);n.on(i.startevent,function(e){if(n.data("callee",arguments.callee),e.which&&1!==e.which)return!1;var o=e.originalEvent,c={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};return a(t,"tapstart",e,c),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,n=e(t);n.on(i.moveevent,function(e){n.data("callee",arguments.callee);var o=e.originalEvent,c={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};return a(t,"tapmove",e,c),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,n=e(t);n.on(i.endevent,function(e){n.data("callee",arguments.callee);var o=e.originalEvent,c={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};return a(t,"tapend",e,c),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,n=this,o=e(n),c={x:0,y:0};o.on(i.startevent,function(e){if(e.which&&1!==e.which)return!1;o.data("tapheld",!1),t=e.target;var s=e.originalEvent,r=(new Date).getTime(),h={x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},u={x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY};return c.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,i.hold_timer=window.setTimeout(function(){var l=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,p=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY;if(e.target==t&&c.x==l&&c.y==p){o.data("tapheld",!0);var g=(new Date).getTime(),f={x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},d={x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY};duration=g-r;var v={startTime:r,endTime:g,startPosition:h,startOffset:u,endPosition:f,endOffset:d,duration:duration,target:e.target};o.data("callee1",arguments.callee),a(n,"taphold",e,v)}},i.taphold_threshold),!0}).on(i.endevent,function(){o.data("callee2",arguments.callee),o.data("tapheld",!1),window.clearTimeout(i.hold_timer)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.doubletap={setup:function(){var t,n,o,c,s=this,r=e(s);r.on(i.startevent,function(e){return!(e.which&&1!==e.which||(r.data("doubletapped",!1),t=e.target,r.data("callee1",arguments.callee),c=e.originalEvent,o={position:{x:i.touch_capable?c.touches[0].screenX:e.screenX,y:i.touch_capable?c.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?c.touches[0].pageX-c.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?c.touches[0].pageY-c.touches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target},0))}).on(i.endevent,function(e){var h=(new Date).getTime(),u=r.data("lastTouch")||h+1,l=h-u;if(window.clearTimeout(n),r.data("callee2",arguments.callee),l0&&e.target==t&&l>100){r.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var p={position:{x:i.touch_capable?c.touches[0].screenX:e.screenX,y:i.touch_capable?c.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?c.touches[0].pageX-c.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?c.touches[0].pageY-c.touches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target},g={firstTap:o,secondTap:p,interval:p.time-o.time};a(s,"doubletap",e,g)}else r.data("lastTouch",h),n=window.setTimeout(function(){window.clearTimeout(n)},i.doubletap_int,[e]);r.data("lastTouch",h)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,n=e(t),o=null,c=null,s={x:0,y:0};n.on(i.startevent,function(e){return!(e.which&&1!==e.which||(c=(new Date).getTime(),o=e.target,n.data("callee1",arguments.callee),s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,0))}).on(i.endevent,function(e){n.data("callee2",arguments.callee),e.target==o&&(end_pos_x=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,end_pos_y=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY,i.tap_timer=window.setTimeout(function(){if(!n.data("doubletapped")&&!n.data("tapheld")&&s.x==end_pos_x&&s.y==end_pos_y){var o=e.originalEvent,r={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};r.time-c=-i.tap_pixel_range&&diff_x<=i.tap_pixel_range&&diff_y>=-i.tap_pixel_range&&diff_y<=i.tap_pixel_range)){var l=e.originalEvent,p={position:{x:i.touch_capable?l.changedTouches[0].screenX:e.screenX,y:i.touch_capable?l.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?l.changedTouches[0].pageX-l.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?l.changedTouches[0].pageY-l.changedTouches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};a(n,"tap",e,p)}})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.swipe={setup:function(){function t(t){s=e(t.target),s.data("callee1",arguments.callee),u.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,u.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,l.x=u.x,l.y=u.y,r=!0;var a=t.originalEvent;o={position:{x:i.touch_capable?a.touches[0].screenX:t.screenX,y:i.touch_capable?a.touches[0].screenY:t.screenY},offset:{x:i.touch_capable?a.touches[0].pageX-a.touches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?a.touches[0].pageY-a.touches[0].target.offsetTop:t.offsetY},time:(new Date).getTime(),target:t.target};for(var n=new Date;new Date-n<100;);}function a(t){s=e(t.target),s.data("callee2",arguments.callee),l.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,l.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,window.clearTimeout(i.hold_timer);var a,n=s.data("xthreshold"),c=s.data("ythreshold"),p="undefined"!=typeof n&&n!==!1&&parseInt(n)?parseInt(n):i.swipe_h_threshold,g="undefined"!=typeof c&&c!==!1&&parseInt(c)?parseInt(c):i.swipe_v_threshold;if(u.y>l.y&&u.y-l.y>g&&(a="swipeup"),u.xp&&(a="swiperight"),u.yg&&(a="swipedown"),u.x>l.x&&u.x-l.x>p&&(a="swipeleft"),void 0!=a&&r){u.x=0,u.y=0,l.x=0,l.y=0,r=!1;var f=t.originalEvent;endEvnt={position:{x:i.touch_capable?f.touches[0].screenX:t.screenX,y:i.touch_capable?f.touches[0].screenY:t.screenY},offset:{x:i.touch_capable?f.touches[0].pageX-f.touches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?f.touches[0].pageY-f.touches[0].target.offsetTop:t.offsetY},time:(new Date).getTime(),target:t.target};var d=Math.abs(o.position.x-endEvnt.position.x),v=Math.abs(o.position.y-endEvnt.position.y),w={startEvnt:o,endEvnt:endEvnt,direction:a.replace("swipe",""),xAmount:d,yAmount:v,duration:endEvnt.time-o.time};h=!0,s.trigger("swipe",w).trigger(a,w)}}function n(t){s=e(t.target);var a="";if(s.data("callee3",arguments.callee),h){var n=s.data("xthreshold"),c=s.data("ythreshold"),u="undefined"!=typeof n&&n!==!1&&parseInt(n)?parseInt(n):i.swipe_h_threshold,l="undefined"!=typeof c&&c!==!1&&parseInt(c)?parseInt(c):i.swipe_v_threshold,p=t.originalEvent;endEvnt={position:{x:i.touch_capable?p.changedTouches[0].screenX:t.screenX,y:i.touch_capable?p.changedTouches[0].screenY:t.screenY},offset:{x:i.touch_capable?p.changedTouches[0].pageX-p.changedTouches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?p.changedTouches[0].pageY-p.changedTouches[0].target.offsetTop:t.offsetY},time:(new Date).getTime(),target:t.target},o.position.y>endEvnt.position.y&&o.position.y-endEvnt.position.y>l&&(a="swipeup"),o.position.xu&&(a="swiperight"),o.position.yl&&(a="swipedown"),o.position.x>endEvnt.position.x&&o.position.x-endEvnt.position.x>u&&(a="swipeleft");var g=Math.abs(o.position.x-endEvnt.position.x),f=Math.abs(o.position.y-endEvnt.position.y),d={startEvnt:o,endEvnt:endEvnt,direction:a.replace("swipe",""),xAmount:g,yAmount:f,duration:endEvnt.time-o.time};s.trigger("swipeend",d)}r=!1,h=!1}var o,c=this,s=e(c),r=!1,h=!1,u={x:0,y:0},l={x:0,y:0};s.on(i.startevent,t),s.on(i.moveevent,a),s.on(i.endevent,n)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){n=t,a(c,n?"scrollstart":"scrollend",e)}var n,o,c=this,s=e(c);s.on(i.scrollevent,function(e){s.data("callee",arguments.callee),n||t(e,!0),clearTimeout(o),o=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var c,s,r,h,u,l=e(window),p={0:!0,180:!0};if(i.orientation_support){var g=window.innerWidth||e(window).width(),f=window.innerHeight||e(window).height(),d=50;h=g>f&&g-f>d,u=p[window.orientation],(h&&u||!h&&!u)&&(p={"-90":!0,90:!0})}e.event.special.orientationchange=c={setup:function(){return!i.orientation_support&&(r=s(),l.on("throttledresize",t),!0)},teardown:function(){return!i.orientation_support&&(l.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=s(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=s=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?p[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",T)},teardown:function(){e(this).off("resize",T)}};var v,w,m,_=250,T=function(){w=(new Date).getTime(),m=w-x,m>=_?(x=w,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,_-m))},x=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(_dereq_("./../../../node_modules/jquery/dist/jquery"))},{"./../../../node_modules/jquery/dist/jquery":97}],128:[function(_dereq_,module){function MobileThreadController(e){ThreadController.call(this,e),this._range}var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),MobileEditorView=_dereq_("./ui/editorview"),MobileNotificationView=_dereq_("./ui/thread/notification"),MobileThreadPopover=_dereq_("./ui/threadpopover"),MobileThreadView=_dereq_("./ui/thread/view"),MobileQuestionMenu=_dereq_("./ui/menu/question"),RepliesThreadContainer=_dereq_("./ui/stream/repliesthreadcontainer"),ThreadController=_dereq_("../..//thread/controller"),ThreadEvents=_dereq_("../../events/events").thread,viewEnum=_dereq_("../../enums").navigableViews,WriteEvents=_dereq_("../../events/events").write,XRange=_dereq_("./../../../../lib/xrange/src/xrange");inherits(MobileThreadController,ThreadController);var HEADER_HEIGHT=56;MobileThreadController.prototype.events=function(){var e={};return e[ThreadEvents.TUCK_THREAD]="_handleTuckThread",e[ThreadEvents.UNTUCK_THREAD]="_handleUntuckThread",e}(),$.extend(MobileThreadController.prototype.events,ThreadController.prototype.events),MobileThreadController.prototype.threadCSS="/css/mobile-thread.css",MobileThreadController.prototype.VIEW_MAP=function(){var e={};return $.extend(e,ThreadController.prototype.VIEW_MAP),e[viewEnum.EDIT]=MobileEditorView,e[viewEnum.EDITOR]=MobileEditorView,e[viewEnum.QUESTION]=MobileQuestionMenu,e[viewEnum.REPLIES]=RepliesThreadContainer,e}(),MobileThreadController.prototype._applyScrollPosition=function(){window.scrollTo(0,this._scrollTop),this._scrollTop=0,this._range&&this._range.addToSelection(),this._range=null},MobileThreadController.prototype._handleCommentActionSuccess=function(e,r){var t=[r.event.type,r.event.namespace].join(".");t!==WriteEvents.POST_DELETE&&t!==WriteEvents.POST_HIDE||this.$antenna.trigger(ThreadEvents.DESTROY_THREAD),ThreadController.prototype._handleCommentActionSuccess.call(this,e,r)},MobileThreadController.prototype._handleNavigate=function(e,r){this._activeView&&this._activeView instanceof MobileThreadView&&(this._scrollTop=window.pageYOffset||document.documentElement.scrollTop),ThreadController.prototype._handleNavigate.call(this,e,r),this._range=new XRange,this._range.clearNativeSelection(),this._container.setFullScreen()},MobileThreadController.prototype._handleNavigateBack=function(e,r){ThreadController.prototype._handleNavigateBack.call(this,e,r),0===this._viewHistory.length&&(this._container.unsetFullScreen&&this._container.unsetFullScreen(),this._activeView instanceof MobileThreadView&&this._applyScrollPosition())},MobileThreadController.prototype._handleNavigateToThread=function(){ThreadController.prototype._handleNavigateToThread.call(this),this._container.unsetFullScreen(),this._activeView instanceof MobileThreadView&&this._applyScrollPosition()},MobileThreadController.prototype._handlePermalinkBack=function(){this._container.unsetFullScreen(),this._viewHistory=[],ThreadController.prototype._handlePermalinkBack.call(this)},MobileThreadController.prototype._handleTuckThread=function(){if(this._activeView instanceof MobileThreadView){var e=this._container.$el.outerHeight()-HEADER_HEIGHT,r=e+"px";0!==e&&(r="-"+r),this._container.$el.css("bottom",r)}},MobileThreadController.prototype._handleUntuckThread=function(){this._container.$el.css("bottom","")},MobileThreadController.prototype.createContainer=function(e){return new MobileThreadPopover(e)},MobileThreadController.prototype.createNotification=function(e){return new MobileNotificationView(e)},MobileThreadController.prototype.createPermalinkThreadContainer=function(){var e=new RepliesThreadContainer({permalinkView:!0});return this._container.setFullScreen(),this._viewHistory.push(e),e},MobileThreadController.prototype.createThreadView=function(){return new MobileThreadView({blockId:this._getActiveBlock().id})},module.exports=MobileThreadController},{"../..//thread/controller":146,"../../enums":122,"../../events/events":123,"./../../../../lib/inherits/inherits.js":11,"./../../../../lib/xrange/src/xrange":90,"./../../../../node_modules/jquery/dist/jquery":97,"./ui/editorview":133,"./ui/menu/question":134,"./ui/stream/repliesthreadcontainer":137,"./ui/thread/notification":140,"./ui/thread/view":141,"./ui/threadpopover":142}],129:[function(_dereq_,module){function MobileCommentActions(e){CommentActions.call(this,e)}var CommentActions=_dereq_("../../../../thread/ui/comment/actions"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),mobileActionsTemplate=_dereq_("../../../../../templates/mobile/actions.mustache"),MobileVoteContainer=_dereq_("./votecontainer");inherits(MobileCommentActions,CommentActions),MobileCommentActions.prototype.createVoteContainer=function(){return new MobileVoteContainer(this.opts)},MobileCommentActions.prototype.template=mobileActionsTemplate.render.bind(mobileActionsTemplate),module.exports=MobileCommentActions},{"../../../../../templates/mobile/actions.mustache":205,"../../../../thread/ui/comment/actions":149,"./../../../../../../lib/inherits/inherits.js":11,"./votecontainer":132}],130:[function(_dereq_,module){var BaseCommentView=_dereq_("../../../../thread/ui/comment/baseview"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),mobileReplyViewTemplate=_dereq_("../../../../../templates/mobile/reply.mustache"),ThreadEvents=_dereq_("../../../../events/events").thread,MobileReplyView=function(e){BaseCommentView.call(this,e)};inherits(MobileReplyView,BaseCommentView),MobileReplyView.prototype._handleMoreClick=function(){this.$el.trigger(ThreadEvents.NAVIGATE,{model:this._model,value:"etc"})},MobileReplyView.prototype.elClass=[BaseCommentView.CLASSES.COMMENT,BaseCommentView.CLASSES.REPLY].join(" "),MobileReplyView.prototype.events=function(){var e=BaseCommentView.CLASSES,i={};return i["tap ."+e.MORE_BTN]="_handleMoreClick",i}(),MobileReplyView.prototype.template=mobileReplyViewTemplate.render.bind(mobileReplyViewTemplate),module.exports=MobileReplyView},{"../../../../../templates/mobile/reply.mustache":213,"../../../../events/events":123,"../../../../thread/ui/comment/baseview":150,"./../../../../../../lib/inherits/inherits.js":11}],131:[function(_dereq_,module){function MobileCommentView(e){Observer(this),BaseCommentView.call(this,e)}var $=_dereq_("./../../../../../../node_modules/jquery/dist/jquery"),BaseCommentView=_dereq_("../../../../thread/ui/comment/baseview"),BaseThreadContainer=_dereq_("../../../../thread/ui/basethreadcontainer"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),MobileCommentActions=_dereq_("./actions"),mobileCommentViewTemplate=_dereq_("../../../../../templates/mobile/comment.mustache"),MobileReplyView=_dereq_("./reply"),MobileVoteContainer=_dereq_("./votecontainer"),Observer=_dereq_("./../../../../../../lib/observer/src/observer.js"),readMoreTemplate=_dereq_("../../../../../templates/mobile/readmore.mustache"),textEnumeration=_dereq_("../../../../i18n/enumeration"),ThreadEvents=_dereq_("../../../../events/events").thread;inherits(MobileCommentView,BaseCommentView),MobileCommentView.CLASSES={CARD:"lf-card",READ_MORE:"lf-read-more",REPLY_CONTAINER:"lf-reply-container",VOTE_COUNT:"lf-vote-count"},MobileCommentView.prototype._bodyOverflow=function(){var e=this.$bodyEl[0];return e.offsetHeight0,o.replyCount>1?(e=textEnumeration.get(i.COMMENT_REPLY_LINK),e=e.replace("{number}",o.replyCount)):e=textEnumeration.get(i.COMMENT_REPLY_LINK_SING),t=textEnumeration.get(1===o.voteCount?i.COMMENT_VOTE_COUNT_SING:i.COMMENT_VOTE_COUNT),o.strings=o.strings||{},o.strings.voteCount=t,o.strings.replyLink=e,o},MobileCommentView.prototype.getThreadContainer=function(){return this._replyContainer},MobileCommentView.prototype.render=function(){BaseCommentView.prototype.render.call(this),this.$bodyEl=this.$("."+BaseCommentView.CLASSES.BODY),this._replyContainer=new BaseThreadContainer({commentConstructor:MobileReplyView,el:this.$("."+MobileCommentView.CLASSES.REPLY_CONTAINER)}),this._replyContainer.render(),this.enterDocument()},MobileCommentView.prototype.template=mobileCommentViewTemplate.render.bind(mobileCommentViewTemplate),module.exports=MobileCommentView},{"../../../../../templates/mobile/comment.mustache":206,"../../../../../templates/mobile/readmore.mustache":211,"../../../../events/events":123,"../../../../i18n/enumeration":124,"../../../../thread/ui/basethreadcontainer":148,"../../../../thread/ui/comment/baseview":150,"./../../../../../../lib/inherits/inherits.js":11,"./../../../../../../lib/observer/src/observer.js":42,"./../../../../../../node_modules/jquery/dist/jquery":97,"./actions":129,"./reply":130,"./votecontainer":132}],132:[function(_dereq_,module){function MobileVoteContainer(e){VoteContainer.call(this,e)}var auth=_dereq_("../../../../util/auth"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),mobileVoteContainerTemplate=_dereq_("../../../../../templates/mobile/votecontainer.mustache"),VoteContainer=_dereq_("../../../../thread/ui/comment/votecontainer"); inherits(MobileVoteContainer,VoteContainer),MobileVoteContainer.CLASSES=VoteContainer.CLASSES,MobileVoteContainer.EVENTS={USER_VOTED:"votes.userVoted"},MobileVoteContainer.prototype.events={"tap a":"_handleVoteClick"},MobileVoteContainer.prototype.template=mobileVoteContainerTemplate.render.bind(mobileVoteContainerTemplate),MobileVoteContainer.prototype._instantFeedbackRender=function(e){if(auth.get("livefyre")){var t=this._getDiff(e);this._model.votes.helpfulness+=t,this.emit(MobileVoteContainer.EVENTS.USER_VOTED),this._updateVoteStatus(e)}},module.exports=MobileVoteContainer},{"../../../../../templates/mobile/votecontainer.mustache":218,"../../../../thread/ui/comment/votecontainer":153,"../../../../util/auth":181,"./../../../../../../lib/inherits/inherits.js":11}],133:[function(_dereq_,module){function MobileEditorView(e){BaseEditorView.call(this,e),this._setType(e),this._nav=new Navbar({actionDesc:this._actionStr,actionHandler:$.proxy(this.handlePostBtnClick,this),title:this._titleStr})}var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),BaseEditorView=_dereq_("../../../thread/ui/baseeditorview"),editorUtil=_dereq_("../../../util/editor"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),loader=_dereq_("./../../../../../lib/livefyre-bootstrap/src/loader"),loaderTemplate=_dereq_("../../../../templates/thread/loader.mustache"),mobileEditorViewTemplate=_dereq_("../../../../templates/mobile/editor.mustache"),Navbar=_dereq_("./navbar"),normalizeParagraphTags=_dereq_("../../../util/editor").normalizeParagraphTags,textEnumeration=_dereq_("../../../i18n/enumeration"),ThreadEvents=_dereq_("../../../events/events").thread,WriteEvents=_dereq_("../../../events/events").write;inherits(MobileEditorView,BaseEditorView),MobileEditorView.TYPES=BaseEditorView.TYPES,MobileEditorView.prototype._handleNavigateBack=function(){this._setDraft(this.opts.editorId,this.$textareaEl.val())},MobileEditorView.prototype._handlePostComplete=function(e){return e?void this.showError(BaseEditorView.ERRORS.GENERIC):(this._type===BaseEditorView.TYPES.EDIT&&this.opts.model.set({body:this._getContents()}),this._setDraft(this.opts.editorId,null),void this.$el.trigger(ThreadEvents.NAVIGATE_TO_THREAD))},MobileEditorView.prototype._setType=function(e){var t=textEnumeration.KEYS;if(e.parentId)this._postEvent=WriteEvents.POST_REPLY,this._titleStr=textEnumeration.get(t.EDITOR_REPLY_TITLE),this._actionStr=textEnumeration.get(t.EDITOR_POST_BTN_MOBILE),this._type=BaseEditorView.TYPES.REPLY;else if(e.model){this._postEvent=WriteEvents.POST_EDIT;var i=e.model.parentId?t.EDITOR_EDIT_REPLY_TITLE:t.EDITOR_EDIT_TITLE;this._titleStr=textEnumeration.get(i),this._actionStr=textEnumeration.get(t.EDITOR_EDIT_BTN),this._type=BaseEditorView.TYPES.EDIT}else this._postEvent=WriteEvents.POST_ANNOTATION,this._titleStr=textEnumeration.get(t.EDITOR_TITLE),this._actionStr=textEnumeration.get(t.EDITOR_POST_BTN_MOBILE),this._type=BaseEditorView.TYPES.WRITE},MobileEditorView.prototype.classes={EDITOR:"lf-mobile-editor",FIELD:"lf-editor-field",POST_BTN:"lf-editor-post-btn"},MobileEditorView.prototype.elClass=MobileEditorView.prototype.classes.EDITOR,MobileEditorView.prototype.events=function(){var e={};return e[ThreadEvents.NAVIGATE_BACK]="_handleNavigateBack",e}(),MobileEditorView.prototype.initialize=function(){this._type===MobileEditorView.TYPES.EDIT&&this.$textareaEl.val(normalizeParagraphTags(this.opts.model.body)),this.focus()},MobileEditorView.prototype.focus=function(){this.$textareaEl.one("focus",function(){window.scrollTo(0,0)}),editorUtil.focusAndPlaceCursorAtEnd(this.$textareaEl)},MobileEditorView.prototype.render=function(){BaseEditorView.prototype.render.call(this),this._nav.setElement(this.$("."+Navbar.CLASSES.HEADER)),this._nav.render();var e=this._getDraft(this.opts.editorId);return e?void this.$textareaEl.val(e):(this._type===BaseEditorView.TYPES.EDIT&&this.$textareaEl.val(normalizeParagraphTags(this.opts.model.body)),void window.scrollTo(0,0))},MobileEditorView.prototype.sendPostEvent=function(e){this.$el.trigger(this._postEvent,e);var t=$(loaderTemplate.render());loader.decorate(t,60),this.$textareaEl.replaceWith(t)},MobileEditorView.prototype.showError=function(e){window.alert(e)},MobileEditorView.prototype.template=mobileEditorViewTemplate.render.bind(mobileEditorViewTemplate),module.exports=MobileEditorView},{"../../../../templates/mobile/editor.mustache":207,"../../../../templates/thread/loader.mustache":233,"../../../events/events":123,"../../../i18n/enumeration":124,"../../../thread/ui/baseeditorview":147,"../../../util/editor":184,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/livefyre-bootstrap/src/loader":20,"./../../../../../node_modules/jquery/dist/jquery":97,"./navbar":135}],134:[function(_dereq_,module){function QuestionMenu(e){Navigable.call(this,e)}var $=_dereq_("./../../../../../../node_modules/jquery/dist/jquery"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),Navigable=_dereq_("../../../../thread/ui/navigable"),questionMenuTemplate=_dereq_("../../../../../templates/blocks/questionpopover.mustache"),textEnumeration=_dereq_("../../../../i18n/enumeration");inherits(QuestionMenu,Navigable),QuestionMenu.prototype.events=Navigable.prototype.events,QuestionMenu.prototype.getTemplateContext=function(){var e=Navigable.prototype.getTemplateContext.call(this),t=textEnumeration.KEYS;return $.extend(e.strings,{explanation:textEnumeration.get(t.QUESTION_EXPLANATION),mockText:textEnumeration.get(t.QUESTION_MOCK_TEXT),title:textEnumeration.get(t.QUESTION_TITLE)}),e},QuestionMenu.prototype.subTemplate=questionMenuTemplate,module.exports=QuestionMenu},{"../../../../../templates/blocks/questionpopover.mustache":200,"../../../../i18n/enumeration":124,"../../../../thread/ui/navigable":165,"./../../../../../../lib/inherits/inherits.js":11,"./../../../../../../node_modules/jquery/dist/jquery":97}],135:[function(_dereq_,module){function NavBar(a){Navigable.call(this,a)}var inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),Navigable=_dereq_("../../../thread/ui/navigable"),navBarTemplate=_dereq_("../../../../templates/mobile/navbar.mustache");inherits(NavBar,Navigable),NavBar.CLASSES=Navigable.CLASSES,NavBar.prototype.elClass=Navigable.CLASSES.HEADER,NavBar.prototype.template=navBarTemplate.render.bind(navBarTemplate),NavBar.prototype.elTag="header",module.exports=NavBar},{"../../../../templates/mobile/navbar.mustache":210,"../../../thread/ui/navigable":165,"./../../../../../lib/inherits/inherits.js":11}],136:[function(_dereq_,module){function MobileStreamFooter(e){View.call(this,e),this._streamCount=0,this._currIndex=0,this._loading=!0}var inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),mobileStreamFooterTemplate=_dereq_("../../../../../templates/mobile/streamfooter.mustache"),textEnumeration=_dereq_("../../../../i18n/enumeration"),View=_dereq_("./../../../../../../lib/view/src/view.js");inherits(MobileStreamFooter,View),MobileStreamFooter.CLASSES={STREAM_FOOTER:"lf-stream-footer"},MobileStreamFooter.prototype.elTag="footer",MobileStreamFooter.prototype.elClass=MobileStreamFooter.CLASSES.STREAM_FOOTER,MobileStreamFooter.prototype.getIndex=function(){return this._currIndex},MobileStreamFooter.prototype.getStreamCount=function(){return this._streamCount},MobileStreamFooter.prototype.getTemplateContext=function(){var e=textEnumeration.KEYS,t=this.getIndex(),o=this.getStreamCount();return{index:t,indexOne:1===t,inviteRead:o>0&&!t,inviteWrite:t===this._streamCount&&1!==this._streamCount,loading:this._loading,streamCount:this.getStreamCount(),strings:{loading:textEnumeration.get(e.SLIDER_LOADING),read:textEnumeration.get(e.SLIDER_INVITE_READ),tally:textEnumeration.get(e.SLIDER_COMMENT_TALLY),write:textEnumeration.get(e.SLIDER_INVITE_WRITE)}}},MobileStreamFooter.prototype.setIndex=function(e){this._currIndex=e},MobileStreamFooter.prototype.setStreamCount=function(e){this._loading=!1,this._streamCount=e},MobileStreamFooter.prototype.template=mobileStreamFooterTemplate.render.bind(mobileStreamFooterTemplate),module.exports=MobileStreamFooter},{"../../../../../templates/mobile/streamfooter.mustache":216,"../../../../i18n/enumeration":124,"./../../../../../../lib/inherits/inherits.js":11,"./../../../../../../lib/view/src/view.js":83}],137:[function(_dereq_,module){var inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),MobileCommentView=_dereq_("../comment/view"),Navbar=_dereq_("../navbar"),requireAuth=_dereq_("../../../../util/auth").requireAuth,repliesThreadContainerTemplate=_dereq_("../../../../../templates/mobile/repliesthreadcontainer.mustache"),SortingUtil=_dereq_("../../../../util/sorting"),textEnumeration=_dereq_("../../../../i18n/enumeration"),ThreadContainer=_dereq_("../../../../thread/ui/threadcontainer"),ThreadEvents=_dereq_("../../../../events/events").thread,viewEnum=_dereq_("../../../../enums").navigableViews,WriteEvents=_dereq_("../../../../events/events").write,RepliesThreadContainer=function(e){e=e||{},ThreadContainer.call(this,e),this._commentConstructor=MobileCommentView,this._topComment=e.topComment,this._replies=e.replies;var t=textEnumeration.KEYS;this._nav=new Navbar({backEvent:e.permalinkView&&ThreadEvents.PERMALINK_BACK,backStr:e.permalinkView&&textEnumeration.get(t.PERMALINK_BACK_BTN),title:textEnumeration.get(t.MENU_REPLIES_VIEW_TITLE)})};inherits(RepliesThreadContainer,ThreadContainer),RepliesThreadContainer.CLASSES={COMMENT_REPLIES:"lf-comment-replies",THREAD:"lf-thread",REPLY_BUTTON:"lf-reply-btn"},RepliesThreadContainer.prototype._handleReplyClick=requireAuth(function(){this.$el.trigger(ThreadEvents.NAVIGATE,{value:viewEnum.EDITOR,parentId:this._topComment.id,editorId:this._topComment.id})},WriteEvents.POST_REPLY),RepliesThreadContainer.prototype.comparator=SortingUtil.createdAtComparator,RepliesThreadContainer.prototype.elClass=RepliesThreadContainer.CLASSES.COMMENT_REPLIES,RepliesThreadContainer.prototype.elTag="section",RepliesThreadContainer.prototype.events=function(){var e={};return e["tap ."+RepliesThreadContainer.CLASSES.REPLY_BUTTON]="_handleReplyClick",e}(),RepliesThreadContainer.prototype.getContainerElement=function(){return this.$("."+RepliesThreadContainer.CLASSES.THREAD)},RepliesThreadContainer.prototype.getTemplateContext=function(){var e=textEnumeration.KEYS;return{strings:{backBtn:textEnumeration.get(e.MENU_BACK_BTN),reply:textEnumeration.get(e.MENU_REPLIES_VIEW_REPLY)}}},RepliesThreadContainer.prototype.initialize=function(e){if(e||(e=[],e.push(this._topComment),e.push.apply(e,this._replies)),!this._topComment)for(var t=0,r=e.length;r>t&&(this._topComment=e[t]).parentId;t++);ThreadContainer.prototype.initialize.call(this,e)},RepliesThreadContainer.prototype.render=function(){ThreadContainer.prototype.render.call(this),this._nav.setElement(this.$("."+Navbar.CLASSES.HEADER)),this._nav.render()},RepliesThreadContainer.prototype.template=repliesThreadContainerTemplate.render.bind(repliesThreadContainerTemplate),module.exports=RepliesThreadContainer},{"../../../../../templates/mobile/repliesthreadcontainer.mustache":212,"../../../../enums":122,"../../../../events/events":123,"../../../../i18n/enumeration":124,"../../../../thread/ui/threadcontainer":175,"../../../../util/auth":181,"../../../../util/sorting":192,"../comment/view":131,"../navbar":135,"./../../../../../../lib/inherits/inherits.js":11}],138:[function(_dereq_,module){var $=_dereq_("./../../../../../../node_modules/jquery/dist/jquery"),ArrayUtil=_dereq_("../../../../util/array"),BaseThreadContainer=_dereq_("../../../../thread/ui/basethreadcontainer"),CommentActions=_dereq_("../../../../thread/ui/comment/actions"),delegate=_dereq_("./../../../../../../lib/view/src/delegate"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),loader=_dereq_("./../../../../../../lib/livefyre-bootstrap/src/loader"),loadercardTemplate=_dereq_("../../../../../templates/mobile/loadercard.mustache"),MobileCommentView=_dereq_("../comment/view"),MobileStreamFooter=_dereq_("./footer"),mobileStreamViewTemplate=_dereq_("../../../../../templates/mobile/stream.mustache"),requireAuth=_dereq_("../../../../util/auth").requireAuth,slideTemplate=_dereq_("../../../../../templates/mobile/slide.mustache"),SortingUtil=_dereq_("../../../../util/sorting"),Swipe=_dereq_("./../../../../../../lib/Swipe/swipe.js"),ThreadEvents=_dereq_("../../../../events/events").thread,View=_dereq_("./../../../../../../lib/view/src/view.js"),viewEnum=_dereq_("../../../../enums").navigableViews,WriteEvents=_dereq_("../../../../events/events").write,WriteSlide=_dereq_("./writeslide"),MobileStreamView=function(e){e=e||{},e.commentConstructor=MobileCommentView,BaseThreadContainer.call(this,e),this._replies={},this._replyIds={},this._swipe=null,this._streamFooter=new MobileStreamFooter};inherits(MobileStreamView,BaseThreadContainer),MobileStreamView.CLASSES={CONTAINER_FOOTER:"lf-comment-container-footer",ESCAPE:"lf-escape-button",LOADER:"lf-loader-container",LOADER_CARD:"lf-loader-card",SLIDE:"lf-slide",STREAM:"lf-stream",STREAM_FOOTER:"lf-stream-footer",WRAPPER:"lf-swipe-wrapper"},MobileStreamView.SLIDE_OFFSET=1,MobileStreamView.MAX_COMMENT_HEIGHT=250,MobileStreamView.prototype._handleNewComment=function(e){if(!e.isPending()){var t=this._commentIds.indexOf(e.id);-1===t&&e.parentId&&(t=this._commentIds.indexOf(e.parentId)),-1!==t&&this._swipe.slide(t+MobileStreamView.SLIDE_OFFSET)}},MobileStreamView.prototype._addSlide=function(e,t,i){var r=i||this.getContainerElement(),o=r.children();e.render();var s=$(slideTemplate.render());s.append(e.$el),t>=o.length?r.append(s):o.eq(t).before(s)},MobileStreamView.prototype._handleReplyClick=requireAuth(function(){var i=this.getCurrentComment();this.$el.trigger(ThreadEvents.NAVIGATE,{value:viewEnum.EDITOR,parentId:i.id,editorId:i.id})},WriteEvents.POST_REPLY),MobileStreamView.prototype._addWriteCard=function(e){this._writeSlide=new WriteSlide,this._addSlide(this._writeSlide,0,$(e))},MobileStreamView.prototype._handleSlideMove=function(){this._setMaxHeight()},MobileStreamView.prototype._handleShowReplies=function(){var e=this.getCurrentComment();this.$el.trigger(ThreadEvents.NAVIGATE,{value:viewEnum.REPLIES,topComment:e,replies:this._replies[e.id]||[]})},MobileStreamView.prototype._handleSlideChange=function(){var e=this.getCurrentComment();this._highlightSelection(e),this._streamFooter.setIndex(this._swipe.getPos()),this._streamFooter.render()},MobileStreamView.prototype._handleWriteClick=function(e,t){e.target.className.indexOf(MobileStreamView.CLASSES.ESCAPE)>-1||this._handlePostAnnotation(e,t)},MobileStreamView.prototype._handlePostAnnotation=requireAuth(function(){this.$el.trigger(ThreadEvents.NAVIGATE,{value:viewEnum.EDITOR,editorId:this.opts.blockId})},WriteEvents.POST_ANNOTATION),MobileStreamView.prototype._handleThreadEscape=function(e){e.preventDefault(),this.$el.trigger(ThreadEvents.DESTROY_THREAD)},MobileStreamView.prototype._highlightSelection=function(e){var t;e&&(t=e.selectedText),this.$el.trigger(ThreadEvents.DEACTIVATE_HIGHLIGHTED_TEXT),t&&this.$el.trigger(ThreadEvents.ACTIVATE_HIGHLIGHTED_TEXT,{selectedText:t,blockId:e.blockId})},MobileStreamView.prototype._matchSlideHeight=function(){var e=this._swipe.getPos(),t=$(this.$wrapperEl.children()[e].firstChild).outerHeight();this.$wrapperEl.height(t)},MobileStreamView.prototype._setMaxHeight=function(){this.$wrapperEl.height(MobileStreamView.MAX_COMMENT_HEIGHT)},MobileStreamView.prototype.addComment=function(e){$.isArray(e)||(e=[e]),this.reinitialize(e),this._handleNewComment(e[0])},MobileStreamView.prototype.comparator=SortingUtil.helpfulnessComparator,MobileStreamView.prototype.destroy=function(){BaseThreadContainer.prototype.destroy.call(this),this._streamFooter&&this._streamFooter.destroy(),this._swipe.kill()},MobileStreamView.prototype.elClass=MobileStreamView.CLASSES.STREAM,MobileStreamView.prototype.elTag="section",MobileStreamView.prototype.enterDocument=function(){for(var e,t,i=this._commentIds.length-1;i>=0;i--)t=this._commentIds[i],e=this._comments[t],e.enterDocument()},MobileStreamView.prototype.delegateEvents=function(e){return this.$wrapperEl?e||(e=this.events)?(delegate.delegateEvents(this.$wrapperEl,e,this.uid,this),this):this:void 0},MobileStreamView.prototype.events=function(){var e={};return e["tap ."+MobileStreamView.CLASSES.ESCAPE]="_handleThreadEscape",e["tap ."+MobileStreamView.CLASSES.CONTAINER_FOOTER]="_handleShowReplies",e["tap ."+MobileCommentView.CLASSES.READ_MORE]="_handleShowReplies",e["tap ."+CommentActions.CLASSES.REPLY_BTN]="_handleReplyClick",e["tap ."+WriteSlide.prototype.elClass]="_handleWriteClick",e[ThreadEvents.SLIDE_TO_COMMENT]="_handleNewComment",e}(),MobileStreamView.prototype.getContainerElement=function(){return this.$wrapperEl},MobileStreamView.prototype.getCurrentComment=function(){var e=this._swipe.getPos(),t=this._commentIds[e-MobileStreamView.SLIDE_OFFSET];return t?this._comments[t].getModel():void 0},MobileStreamView.prototype.initialize=function(e){this._loaderView&&this._loaderView.destroy(),this._loaderView=null;var t,i,r=[];e=e||[];for(var o=e.length-1;o>=0;o--)t=e[o],i=t.parentId,i?(this._replies[i]=this._replies[i]||[],!this._replyIds[t.id]&&this._replies[i].push(t),this._replyIds[t.id]=!0):t.isVisible()&&r.push(t);var s=document.createDocumentFragment();$.each(r,$.proxy(this.processComment,this,!1,$(s))),this._addWriteCard(s),this.getContainerElement().append(s),this.enterDocument();var a=this._commentIds.length>0?1:0;this._swipe=Swipe(this.el,{callback:$.proxy(this._handleSlideChange,this),continuous:r.length>1,disableScroll:!0,slideMove:$.proxy(this._handleSlideMove,this),startSlide:a,stopPropagation:!0,transitionEnd:$.proxy(this._matchSlideHeight,this)}),this._streamFooter.setStreamCount(this._commentIds.length),this._handleSlideChange(),this._matchSlideHeight(),this.delegateEvents()},MobileStreamView.prototype.reinitialize=function(e){this._swipe&&this._swipe.kill(),this._setMaxHeight(),BaseThreadContainer.prototype.reinitialize.call(this,e)},MobileStreamView.prototype.template=mobileStreamViewTemplate.render.bind(mobileStreamViewTemplate),MobileStreamView.prototype.processComment=function(e,t,i,r){if(!this._comments[r.id]){var o=this._replies[r.id];o&&(r.replyCount=o.length);var s=new this._commentConstructor(this._getCommentOptions(r));this._comments[r.id]=s;var a=$.proxy(this.comparator,this),l=ArrayUtil.findIndex(this._commentIds,r.id,a);return this._addSlide(s,l,t),l>=this._commentIds.length?void this._commentIds.push(r.id):void this._commentIds.splice(l,0,r.id)}},MobileStreamView.prototype.render=function(){View.prototype.render.call(this);var e=MobileStreamView.CLASSES;this._streamFooter.setElement(this.$("."+e.STREAM_FOOTER)),this._streamFooter.render(),this.$wrapperEl=this.$("."+e.WRAPPER),this._loaderView=new View,this._loaderView.template=loadercardTemplate.render.bind(loadercardTemplate),this._loaderView.$el.addClass(MobileStreamView.CLASSES.LOADER_CARD),this._loaderView.render(),loader.decorate(this._loaderView.$("."+MobileStreamView.CLASSES.LOADER),60),this._streamFooter.$el.before(this._loaderView.$el)},module.exports=MobileStreamView},{"../../../../../templates/mobile/loadercard.mustache":209,"../../../../../templates/mobile/slide.mustache":214,"../../../../../templates/mobile/stream.mustache":215,"../../../../enums":122,"../../../../events/events":123,"../../../../thread/ui/basethreadcontainer":148,"../../../../thread/ui/comment/actions":149,"../../../../util/array":180,"../../../../util/auth":181,"../../../../util/sorting":192,"../comment/view":131,"./../../../../../../lib/Swipe/swipe.js":1,"./../../../../../../lib/inherits/inherits.js":11,"./../../../../../../lib/livefyre-bootstrap/src/loader":20,"./../../../../../../lib/view/src/delegate":81,"./../../../../../../lib/view/src/view.js":83,"./../../../../../../node_modules/jquery/dist/jquery":97,"./footer":136,"./writeslide":139}],139:[function(_dereq_,module){function WriteSlide(e){View.call(this,e),Observer(this),this.listenTo(auth,"login.livefyre",$.proxy(this.render,this)),this.listenTo(auth,"logout",$.proxy(this.render,this))}var $=_dereq_("./../../../../../../node_modules/jquery/dist/jquery"),auth=_dereq_("../../../../util/auth"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),Observer=_dereq_("./../../../../../../lib/observer/src/observer.js"),textEnumeration=_dereq_("../../../../i18n/enumeration"),ThreadEvents=_dereq_("../../../../events/events").thread,View=_dereq_("./../../../../../../lib/view/src/view.js"),writeSlideTemplate=_dereq_("../../../../../templates/mobile/writeslide.mustache");inherits(WriteSlide,View),WriteSlide.CLASSES={USER_SETTINGS:"lf-user-settings"},WriteSlide.prototype._handleSettingsTap=function(e){e.stopPropagation(),this.$el.trigger(ThreadEvents.NAVIGATE,{value:"user"})},WriteSlide.prototype.elClass="lf-write-card",WriteSlide.prototype.events=function(){var e={};return e["tap ."+WriteSlide.CLASSES.USER_SETTINGS]="_handleSettingsTap",e}(),WriteSlide.prototype.template=writeSlideTemplate.render.bind(writeSlideTemplate),WriteSlide.prototype.getTemplateContext=function(){var e=textEnumeration.KEYS;return{userLoggedIn:auth.get("livefyre"),strings:{title:textEnumeration.get(e.EDITOR_TITLE),text:textEnumeration.get(e.SLIDER_WRITE_TEXT)}}},WriteSlide.prototype.destroy=function(){View.prototype.destroy.call(this),this.stopListening()},module.exports=WriteSlide},{"../../../../../templates/mobile/writeslide.mustache":219,"../../../../events/events":123,"../../../../i18n/enumeration":124,"../../../../util/auth":181,"./../../../../../../lib/inherits/inherits.js":11,"./../../../../../../lib/observer/src/observer.js":42,"./../../../../../../lib/view/src/view.js":83,"./../../../../../../node_modules/jquery/dist/jquery":97}],140:[function(_dereq_,module){function MobileNotificationView(i){NotificationView.call(this,i)}var $=_dereq_("./../../../../../../node_modules/jquery/dist/jquery"),inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),NotificationView=_dereq_("../../../../thread/ui/thread/notification");inherits(MobileNotificationView,NotificationView),MobileNotificationView.prototype.decorate=function(){this.render(),$(document.body).append(this.$el)},module.exports=MobileNotificationView},{"../../../../thread/ui/thread/notification":173,"./../../../../../../lib/inherits/inherits.js":11,"./../../../../../../node_modules/jquery/dist/jquery":97}],141:[function(_dereq_,module){var inherits=_dereq_("./../../../../../../lib/inherits/inherits.js"),MobileStreamView=_dereq_("../stream/view"),nullFunction=_dereq_("../../../../util/internals").nullFunction,ThreadView=_dereq_("../../../../thread/ui/thread/baseview"),MobileThreadView=function(e){ThreadView.call(this,e)};inherits(MobileThreadView,ThreadView),MobileThreadView.prototype._handleUserLogin=nullFunction,MobileThreadView.prototype._handleUserLogout=nullFunction,MobileThreadView.prototype.createStreamView=function(){return new MobileStreamView({blockId:this.opts.blockId})},MobileThreadView.prototype.handleFetchThreadSuccess=function(e){this._streamView.initialize(e)},MobileThreadView.prototype.getThreadContainer=function(){return this._streamView},MobileThreadView.prototype.render=function(){ThreadView.prototype.render(this),this._streamView.render(),this.$el.prepend(this._streamView.$el)},module.exports=MobileThreadView},{"../../../../thread/ui/thread/baseview":172,"../../../../util/internals":185,"../stream/view":138,"./../../../../../../lib/inherits/inherits.js":11}],142:[function(_dereq_,module){function MobileThreadPopover(e){e=e||{},Popover.call(this,$.extend({minPopoverInView:MAX_COMMENT_HEIGHT,scrollDuration:500,topSpacing:10},e)),this.$_contentElements=null;var o=e.rootContentEl||document.body;this.$_rootContentEl=$(o)}var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),domUtil=_dereq_("../../../util/dom"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),MAX_COMMENT_HEIGHT=_dereq_("./stream/view").MAX_COMMENT_HEIGHT,mobileThreadPopoverTemplate=_dereq_("../../../../templates/mobile/threadpopover.mustache"),Popover=_dereq_("../../../ui/popover");inherits(MobileThreadPopover,Popover),MobileThreadPopover.CLASSES=function(){var e={};return $.extend(e,Popover.CLASSES),e.FULLSCREEN="lf-fullscreen",e.LF="lf",e.MAIN="lf-thread-popover",e.POPOVER="lf-mobile-popover",e}(),MobileThreadPopover.prototype.elClass=[MobileThreadPopover.CLASSES.POPOVER,MobileThreadPopover.CLASSES.MAIN].join(" "),MobileThreadPopover.prototype.template=mobileThreadPopoverTemplate.render.bind(mobileThreadPopoverTemplate),MobileThreadPopover.prototype.resizeAndReposition=function(e){var o=domUtil.getBoundingClientRect(e),t=o.bottom+domUtil.getScrollY()+10;this._scrollIntoPosition(t)},MobileThreadPopover.prototype.setFullScreen=function(){var e=MobileThreadPopover.CLASSES;this.$el.addClass(e.FULLSCREEN),this.$_contentNode.addClass(e.FULLSCREEN),this.$el.children().addClass(e.FULLSCREEN),this.$_contentElements||(this.$_contentElements=this.$_rootContentEl.children().filter(function(){return-1===this.className.indexOf(e.LF)&&$(this).is(":visible")}),this.$_contentElements.hide(),this.$el.show())},MobileThreadPopover.prototype.unsetFullScreen=function(){var e=MobileThreadPopover.CLASSES;this.$el.removeClass(e.FULLSCREEN),this.$_contentNode.removeClass(e.FULLSCREEN),this.$el.children().removeClass(e.FULLSCREEN),this.$_contentElements&&(this.$_contentElements.show(),this.$_contentElements=null)},module.exports=MobileThreadPopover},{"../../../../templates/mobile/threadpopover.mustache":217,"../../../ui/popover":178,"../../../util/dom":183,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../node_modules/jquery/dist/jquery":97,"./stream/view":138}],143:[function(_dereq_,module){var Author=function(a){a=a||{},this.avatar=a.avatar||"",this.displayName=a.displayName||"",this.handle=a.handle||"",this.id=a.id||"",this.profileUrl=a.profileUrl||""};module.exports=Author},{}],144:[function(_dereq_,module){var Content=_dereq_("./../../../lib/streamhub-sdk/src/content/main"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),Block=function(){Content.call(this),this.id=null,this.blockType=Block.TYPES.UNSET,this.numAnnotations=0,this.simhash="",this.index=-1,this.el=null,this.content=null,this.generatedId="",this.isFetched=!1};inherits(Block,Content),Block.DATA_ID="data-lf-anchor-id",Block.TYPES={UNSET:0,TEXT:1,IMAGE:2,MEDIA:3,RICH:4},Block.prototype.getId=function(){return this.id||this.generatedId},Block.prototype.setId=function(t){this.id=t},Block.prototype.isSaved=function(){return!!this.id},Block.prototype.setFetchedState=function(t){this.isFetched=t},Block.prototype.getFetchedState=function(){return this.isFetched},Block.prototype.updateNumAnnotations=function(t,n){var e="number"==typeof n,i=e?n:this.numAnnotations+t,o=i-this.numAnnotations;return this.set({numAnnotations:i}),o},module.exports=Block},{"./../../../lib/inherits/inherits.js":11,"./../../../lib/streamhub-sdk/src/content/main":67}],145:[function(_dereq_,module){function Comment(t){t=t||{},this.blockId=null,this.collectionId=t.collectionId,this.hasBeenRendered=!1,this.lastCount=0,this.origin=t.origin||Comment.ORIGIN.UNKNOWN,this.permalink=null,this.selectedText=null,this.votes={upvotes:0,downvotes:0,helpfulness:0,list:[]},this.erefs=t.erefs||null,this.replyCount=0,LivefyreContent.call(this,t)}var auth=_dereq_("../util/auth"),CommentAnnotator=_dereq_("../adapters/commentannotator"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),LivefyreContent=_dereq_("./../../../lib/streamhub-sdk/src/content/types/livefyre-content"),visEnums=_dereq_("../enums").commentVisibility;inherits(Comment,LivefyreContent),Comment.ORIGIN={UNKNOWN:0,BOOTSTRAP:1,STREAM:2},Comment.prototype._calculateVisibility=function(t){var i=auth.get("livefyre"),e=this.isUserAuthor(),n=i&&i.isMod({collectionId:this.collectionId});switch(t){case visEnums.EVERYONE:return!0;case visEnums.OWNER:return e;case visEnums.GROUP:return e||n;default:return!1}},Comment.prototype._createAnnotator=function(){return new CommentAnnotator},Comment.prototype.calculateCountIncrement=function(){var t=this._calculateVisibility(this.visibility),i=this._calculateVisibility(this.lastVisibility),e=!i&&t,n=i&&!t,s=e?1:n?-1:0,o=s===this.lastCount?0:s;return 0!==o&&(this.lastCount=o),o},Comment.prototype.isPending=function(){return this.visibility===visEnums.GROUP},Comment.prototype.isUserAuthor=function(t){var i=auth.get("livefyre"),e=t?t.id:i?i.get("id"):null;return this.author.id===e},Comment.prototype.isVisible=function(){return this._calculateVisibility(this.visibility)},module.exports=Comment},{"../adapters/commentannotator":102,"../enums":122,"../util/auth":181,"./../../../lib/inherits/inherits.js":11,"./../../../lib/streamhub-sdk/src/content/types/livefyre-content":69}],146:[function(_dereq_,module){function ThreadController(e){BaseController.call(this,e),this._cssLoaded=!1,this._activeView=null,this._container=this.createContainer(e.config),this.bindListeners(this._container.$el),this._scrollTop=0,this._threadView=null,this._viewHistory=[],this._initPermalink()}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),AuthMenu=_dereq_("./ui/menu/auth"),BaseController=_dereq_("../controller/base"),BlockEvents=_dereq_("../events/events").block,Comment=_dereq_("../models/comment"),CommentEvents=_dereq_("../events/events").comment,ConfirmMenu=_dereq_("./ui/menu/confirm"),Container=_dereq_("../ui/container"),EditMenu=_dereq_("./ui/menu/edit"),EtcMenu=_dereq_("./ui/menu/etc"),FlagMenu=_dereq_("./ui/menu/flag"),InfoMenu=_dereq_("./ui/menu/info"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),NotificationView=_dereq_("./ui/thread/notification"),objectUtil=_dereq_("../util/object"),PermalinkThreadContainer=_dereq_("./ui/permalinkthreadcontainer"),permalinkUtil=_dereq_("../util/permalink"),ScriptLoader=_dereq_("./../../../lib/scriptloader/src/javascript/scriptloader.js"),ShareMenu=_dereq_("./ui/menu/share"),SourceEvents=_dereq_("../events/events").source,Storage=_dereq_("../util/storage"),ThreadEvents=_dereq_("../events/events").thread,ThreadPopover=_dereq_("./ui/threadpopover"),ThreadView=_dereq_("./ui/thread/view"),userAgentUtil=_dereq_("../util/useragent"),UserEvents=_dereq_("../events/events").user,UserMenu=_dereq_("./ui/menu/user"),viewEnum=_dereq_("../enums").navigableViews,WriteEvents=_dereq_("../events/events").write;inherits(ThreadController,BaseController);var VALID_NOTIFICATION_EVENTS=function(){var e={};return e[WriteEvents.POST_APPROVE]=!0,e[WriteEvents.POST_DELETE]=!0,e[WriteEvents.POST_FLAG]=!0,e[WriteEvents.POST_HIDE]=!0,e}();ThreadController.prototype.containerEvents=function(){return $.map([CommentEvents,SourceEvents,ThreadEvents,UserEvents,WriteEvents],function(e){return objectUtil.getValues(e)})}(),ThreadController.prototype.events=function(){var e={};return e[CommentEvents.ACTION_SUCCESS]="_handleCommentActionSuccess",e[ThreadEvents.ACTIVATE_THREAD]="_activateThread",e[ThreadEvents.CHANGE_VIEW]="_handleViewChange",e[ThreadEvents.DESTROY_THREAD]="_destroyThread",e[ThreadEvents.NAVIGATE]="_handleNavigate",e[ThreadEvents.NAVIGATE_BACK]="_handleNavigateBack",e[ThreadEvents.NAVIGATE_TO_THREAD]="_handleNavigateToThread",e[ThreadEvents.PERMALINK_BACK]="_handlePermalinkBack",e[WriteEvents.POST_APPROVE]="_handleNavigateToThread",e[WriteEvents.POST_DELETE]="_handleNavigateToThread",e[WriteEvents.POST_FLAG]="_handleNavigateToThread",e[WriteEvents.POST_HIDE]="_handleNavigateToThread",e}(),ThreadController.prototype.globalEvents=function(){var e={};return e[SourceEvents.THREAD_BTN_CLICK]="_handleGlobalThreadBtnClick",e}(),ThreadController.prototype.threadCSS="/css/thread.css",ThreadController.prototype.VIEW_MAP=function(){var e={};return e[viewEnum.AUTH]=AuthMenu,e[viewEnum.CONFIRM]=ConfirmMenu,e[viewEnum.EDIT]=EditMenu,e[viewEnum.ETC]=EtcMenu,e[viewEnum.FLAG]=FlagMenu,e[viewEnum.INFO]=InfoMenu,e[viewEnum.SHARE]=ShareMenu,e[viewEnum.THREAD]=ThreadView,e[viewEnum.USER]=UserMenu, e}(),ThreadController.prototype._activateThread=function(e,t){if(this._getActiveBlock()&&!this._container.isShowing()){this._destroyThread();var i=this;this._destroyThread(),this._container.onHide(function(){i._initThread(function(){i._loadThreadContent({forceEmpty:!!(t||{}).forceWriteCard})})})}},ThreadController.prototype._applyScrollPosition=function(){this._activeView.getThreadContainer().$el.scrollTop(this._scrollTop),this._scrollTop=0},ThreadController.prototype._destroyThread=function(){this.deactivating=!0;var t=$.proxy(function(){this._threadView&&this._threadView.destroy(),this._threadView=null,this._activeView&&this._activeView.destroy(),this._activeView=null,$.each(this._viewHistory,function(e,t){t.destroy()}),this._viewHistory=[],this.deactivating=!1},this);return this._container.isVisible()?void this._container.hide(t):void t()},ThreadController.prototype._fetchThread=function(){var e=this._getActiveBlock(),t=$.proxy(this._handleThreadFetched,this,e);this._collection.fetchThread(e.id,t)},ThreadController.prototype._handleCommentActionSuccess=function(e,t){var i=t.event.type+"."+t.event.namespace;if(VALID_NOTIFICATION_EVENTS[i]&&this._activeView){var r=this.createNotification({event:i});r.decorate(this._activeView.$el)}},ThreadController.prototype._handleCommentBatch=function(e){var t,i=this._threadView.getThreadContainer();$.each(e,function(e,r){r.origin=r.origin||Comment.ORIGIN.STREAM,t=r.isUserAuthor()&&!r.parentId,i.addComment(r,t)})},ThreadController.prototype._handleGlobalThreadBtnClick=BaseController.onlyHandleExternalMessage(ThreadController.prototype._destroyThread),ThreadController.prototype._handleNavigate=function(e,t){var i=this.VIEW_MAP[t.value];i&&(this._activeView&&(this._activeView instanceof ThreadView&&(this._scrollTop=this._activeView.getThreadContainer().$el.scrollTop()),this._activeView.detach(),this._viewHistory.push(this._activeView)),t.collection=this._collection,this._activeView=new i(t),this._activeView.render(),this._container.setContentNode(this._activeView.$el),this._initializeView(this._activeView))},ThreadController.prototype._handleNavigateBack=function(){this._activeView.destroy(),this._activeView=this._viewHistory.pop(),this._activeView&&this._container.setContentNode(this._activeView.$el),this._activeView instanceof ThreadView&&this._applyScrollPosition()},ThreadController.prototype._handleNavigateToThread=function(){$.each(this._viewHistory,$.proxy(function(e,t){t instanceof this._threadView.constructor||t.destroy()},this)),this._activeView=this._threadView,this._container.setContentNode(this._activeView.$el),this._initializeView(this._activeView),this._viewHistory=[],this._activeView instanceof ThreadView&&this._applyScrollPosition()},ThreadController.prototype._handlePermalink=function(e){if(e){var t=this;this._collection.getThread({contentId:e},function(e,i,r){function n(){t._activeView=t._threadView=t.createPermalinkThreadContainer(),t._loadPopover(t._activeView),t._activeView.initialize(r)}var o=Storage.get(i),a=t._config.permalinkScrollDelegate;return t._collection.block=o,t.$antenna.trigger(ThreadEvents.ACTIVATE_BLOCK,{block:o}),a?void a({el:o.el},n):void permalinkUtil.scrollToPermalink(o.el,n)})}},ThreadController.prototype._initPermalink=function(){var e="annotations",t=window.addEventListener?"message":"onmessage",i=window.addEventListener||window.attachEvent,r=function(t){var i=null;if("object"==typeof t.data)i=t.data;else try{i=JSON.parse(t.data)}catch(e){return}i.to===e&&i.data&&"put"===i.action&&this._handlePermalink(i.data.contentId)},n=function(t){var i={from:e,to:"permalink",action:"post",data:{name:e,collectionId:t}};window.postMessage(JSON.stringify(i),"*")},o=this;i(t,function(e){r.call(o,e)},!1),n(this._collection.id)},ThreadController.prototype._handlePermalinkBack=function(){this._activeView.destroy(),this._initThread($.proxy(this._loadThreadContent,this))},ThreadController.prototype._handleThreadFetched=function(e,t){if(this._getActiveBlock().getId()===e.id){if(t)return void this._threadView.handleFetchThreadFailure(t);var i=Storage.getCommentsForBlock(e.id);this.$antenna.trigger(BlockEvents.UPDATE_COUNT,{blockId:e.id,count:Storage.getNumCommentsForBlock(e.id)}),this._threadView.handleFetchThreadSuccess(i)}},ThreadController.prototype._handleViewChange=function(e,t){this._viewHistory=[],this._handleNavigate(e,t)},ThreadController.prototype._initializeView=function(e){"function"==typeof e.initialize&&e.initialize()},ThreadController.prototype._initThread=function(e){var t=this;this._loadCSS(function(){t._threadView=t._activeView=t.createThreadView(),t._loadPopover(t._activeView),e()})},ThreadController.prototype._loadCSS=function(e){return this._cssLoaded?e():(this._cssLoaded=!0,ScriptLoader.loadCSS(this._config.servers.assets+this.threadCSS),userAgentUtil.isIE()&&8===userAgentUtil.getIEVersion()&&ScriptLoader.loadCSS(this._config.servers.assets+"/css/ie8.css"),void setTimeout(e,200))},ThreadController.prototype._loadPopover=function(e){this._container.show(this._getActiveBlock().el),e.render(),this._container.setContentNode(e.$el)},ThreadController.prototype._loadThreadContent=function(e){var t=this._getActiveBlock();if((e||{}).forceEmpty)return void this._threadView.handleFetchThreadSuccess();if(t.getFetchedState()){var i=Storage.getCommentsForBlock(t.id);return void this._threadView.handleFetchThreadSuccess(i)}this._fetchThread()},ThreadController.prototype._maybeCountComment=function(e,t){this._collection.maxEventId>=e.meta.event||this.$antenna.trigger(BlockEvents.UPDATE_COUNT,{blockId:t.id,inc:e.calculateCountIncrement()})},ThreadController.prototype.createContainer=function(e){return this._config.threadContainerEl?(e.parentEl=this._config.threadContainerEl,new Container(e)):this._config.inlineThreads?new Container(e):new ThreadPopover(e)},ThreadController.prototype.createNotification=function(e){return new NotificationView(e)},ThreadController.prototype.createPermalinkThreadContainer=function(){return new PermalinkThreadContainer},ThreadController.prototype.createThreadView=function(){return new ThreadView({assetServer:this._config.servers.assets,blockId:this._getActiveBlock().id,defaultAvatar:this._config.defaultAvatar,isCustomNetwork:this._collection.isCustomNetwork()})},ThreadController.prototype.destroy=function(){BaseController.prototype.destroy.call(this),this._destroyThread(),this._container.destroy(),this._collection=null,this._config=null},ThreadController.prototype.handleReadable=function(){for(var e,t,i,r=this._getActiveBlock(),n=[],o=r&&this._threadView;t=this._collection.read();)i=Storage.get(t.id),e=Storage.get(t.blockId||i.blockId),e&&(this._maybeCountComment(t,e),o&&e.id===r.id&&n.push(t));o&&this._handleCommentBatch(n)},module.exports=ThreadController},{"../controller/base":116,"../enums":122,"../events/events":123,"../models/comment":145,"../ui/container":177,"../util/object":187,"../util/permalink":188,"../util/storage":193,"../util/useragent":195,"./../../../lib/inherits/inherits.js":11,"./../../../lib/scriptloader/src/javascript/scriptloader.js":44,"./../../../node_modules/jquery/dist/jquery":97,"./ui/menu/auth":156,"./ui/menu/confirm":158,"./ui/menu/edit":159,"./ui/menu/etc":160,"./ui/menu/flag":161,"./ui/menu/info":162,"./ui/menu/share":163,"./ui/menu/user":164,"./ui/permalinkthreadcontainer":166,"./ui/thread/notification":173,"./ui/thread/view":174,"./ui/threadpopover":176}],147:[function(_dereq_,module){function BaseEditorView(e){Editor.call(this,e)}var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),Editor=_dereq_("./../../../../lib/streamhub-editor/src/javascript/editor"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),normalizeNewlines=_dereq_("../../util/editor").normalizeNewlines,textEnumeration=_dereq_("../../i18n/enumeration");inherits(BaseEditorView,Editor),BaseEditorView.TYPES={EDIT:"edit",REPLY:"reply",WRITE:"write"};var DRAFT_PREFIX="draft-",DRAFTS={};BaseEditorView.ERRORS={BODY:"Please enter a body",GENERIC:"There was an error"},BaseEditorView.prototype._getContents=function(){var e=this.$textareaEl.val();return normalizeNewlines(e,!0)},BaseEditorView.prototype.buildPostEventObj=function(){return{body:this._getContents(),callback:$.proxy(this._handlePostComplete,this),model:this.opts.model,parentId:this.opts.parentId,shareTypes:[]}},BaseEditorView.prototype._getDraft=function(e){return DRAFTS[DRAFT_PREFIX+e]},BaseEditorView.prototype._setDraft=function(e,t){return DRAFTS[DRAFT_PREFIX+e]=t},BaseEditorView.prototype.validate=function(e){var t=e.body;if(!t)return this.showError(BaseEditorView.ERRORS.BODY),!1;var r=textEnumeration.KEYS;return t!==textEnumeration.get(r.EDITOR_PLACEHOLDER)||(this.showError(BaseEditorView.ERRORS.BODY),!1)},module.exports=BaseEditorView},{"../../i18n/enumeration":124,"../../util/editor":184,"./../../../../lib/inherits/inherits.js":11,"./../../../../lib/streamhub-editor/src/javascript/editor":51,"./../../../../node_modules/jquery/dist/jquery":97}],148:[function(_dereq_,module){var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),ArrayUtil=_dereq_("../../util/array"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),SortingUtil=_dereq_("../../util/sorting"),View=_dereq_("./../../../../lib/view/src/view.js"),BaseThreadContainer=function(e){View.call(this,e),this._commentConstructor=this.opts.commentConstructor,this._commentIds=[],this._comments={}};inherits(BaseThreadContainer,View),BaseThreadContainer.prototype._getCommentOptions=function(e){return{assetServer:this.opts.assetServer,defaultAvatar:this.opts.defaultAvatar,model:e}},BaseThreadContainer.prototype.addComment=function(e,t,i){var r=i||this.getContainerElement();$.isArray(e)||(e=[e]),$.each(e,$.proxy(this.processComment,this,!!t,$(r)))},BaseThreadContainer.prototype.comparator=SortingUtil.createdAtComparator,BaseThreadContainer.prototype.getContainerElement=function(){return this.$el},BaseThreadContainer.prototype.initialize=function(e){var t=this.getContainerElement(),i=document.createDocumentFragment();this.addComment(e,!1,i),t.append(i)},BaseThreadContainer.prototype.processComment=function(e,t,i,r){if(!this._comments[r.id]){var n=new this._commentConstructor(this._getCommentOptions(r));if(n.render(),n.handleVisChange(),this._comments[r.id]=n,e)return this._commentIds.splice(0,0,r.id),void t.prepend(n.$el);var o=$.proxy(this.comparator,this),s=ArrayUtil.findIndex(this._commentIds,r.id,o);if(s>=this._commentIds.length)return this._commentIds.push(r.id),void t.append(n.$el);this._commentIds.splice(s,0,r.id),n.$el.insertBefore(t[0].childNodes[s])}},BaseThreadContainer.prototype.reinitialize=function(e){e=e||[];for(var t,i,r=[],n=0,o=this._commentIds.length;o>n;n++)i=this._comments[this._commentIds[n]],t=i.getModel(),r.push(t),i.destroy();this._commentIds=[],this._comments={},r.push.apply(r,e),this.getContainerElement().empty(),this.initialize(r)},module.exports=BaseThreadContainer},{"../../util/array":180,"../../util/sorting":192,"./../../../../lib/inherits/inherits.js":11,"./../../../../lib/view/src/view.js":83,"./../../../../node_modules/jquery/dist/jquery":97}],149:[function(_dereq_,module){var commentActionsTemplate=_dereq_("../../../../templates/thread/comment/actions.mustache"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),textEnumeration=_dereq_("../../../i18n/enumeration"),View=_dereq_("./../../../../../lib/view/src/view.js"),VoteContainer=_dereq_("./votecontainer"),CommentActions=function(t){View.call(this,t),this._model=t.model,this._voteContainer=this.createVoteContainer()};inherits(CommentActions,View),CommentActions.CLASSES={ACTIONS:"lf-comment-actions",REPLY_BTN:"lf-reply-btn",SEPARATOR:"lf-separator",VOTES:"lf-votes"},CommentActions.prototype.createVoteContainer=function(){return new VoteContainer(this.opts)},CommentActions.prototype.template=commentActionsTemplate.render.bind(commentActionsTemplate),CommentActions.prototype.getTemplateContext=function(){return{strings:{replyBtn:textEnumeration.get(textEnumeration.KEYS.REPLY_BTN)}}},CommentActions.prototype.getVoteContainer=function(){return this._voteContainer},CommentActions.prototype.hideReplyBtn=function(){this.$_replyBtn.hide(),this.$_separator.hide()},CommentActions.prototype.render=function(){View.prototype.render.call(this);var t=CommentActions.CLASSES;this._voteContainer.setElement(this.$("."+t.VOTES)[0]),this._voteContainer.render(),this.$_replyBtn=this.$("."+t.REPLY_BTN),this.$_separator=this.$("."+t.SEPARATOR)},module.exports=CommentActions},{"../../../../templates/thread/comment/actions.mustache":221,"../../../i18n/enumeration":124,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/view/src/view.js":83,"./votecontainer":153}],150:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),adaptAvatar=_dereq_("../../../adapters/adapters").adaptAvatar,auth=_dereq_("../../../util/auth"),commentViewTemplate=_dereq_("../../../../templates/thread/comment/comment.mustache"),baseCommentTemplate=_dereq_("../../../../templates/thread/comment/base.mustache"),BlockEvents=_dereq_("../../../events/events").block,CommentActions=_dereq_("./actions"),etcCommentTemplate=_dereq_("../../../../templates/thread/comment/etc.mustache"),footerCommentTemplate=_dereq_("../../../../templates/thread/comment/footer.mustache"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),tagsTemplate=_dereq_("../../../../templates/thread/comment/tags.mustache"),textEnumeration=_dereq_("../../../i18n/enumeration"),ThreadEvents=_dereq_("../../../events/events").thread,UserEvents=_dereq_("../../../events/events").user,View=_dereq_("./../../../../../lib/view/src/view.js"),visEnums=_dereq_("../../../enums").commentVisibility,BaseCommentView=function(e){View.call(this,e),this._model=e.model,this._model.on("change:visibility",$.proxy(this.handleVisChange,this)),this._model.on("change:body",$.proxy(this.render,this)),this._actions=this.createActions()};inherits(BaseCommentView,View),BaseCommentView.CLASSES={ACTIONS:"lf-comment-actions",AVATAR:"lf-comment-author-avatar",BODY:"lf-comment-body",COMMENT:"lf-comment",CONTAINER:"lf-comment-container",DISPLAY_NAME:"lf-comment-author-name",HEADER:"lf-comment-header",REPLY:"lf-reply",MORE_BTN:"lf-etc-btn",PENDING_TAG:"lf-comment-pending-tag",FOOTER:"lf-comment-footer"},BaseCommentView.prototype.elClass=BaseCommentView.CLASSES.COMMENT,BaseCommentView.prototype.elTag="article",BaseCommentView.prototype.events=function(){var e=BaseCommentView.CLASSES,t={};return t["click ."+e.AVATAR]="_handleViewProfile",t["click ."+e.DISPLAY_NAME]="_handleViewProfile",t["click ."+e.MORE_BTN]="_handleMoreClick",t["keydown ."+e.MORE_BTN]="_handleMoreClick",t}(),BaseCommentView.prototype.template=commentViewTemplate.render.bind(commentViewTemplate),BaseCommentView.prototype._handleMoreClick=function(e){9===e.which&&"keydown"===e.type&&this.hideEtcBtn(),13!==e.which&&"keydown"===e.type||this.$el.trigger(ThreadEvents.CHANGE_VIEW,{model:this._model,value:"etc"})},BaseCommentView.prototype.hideEtcBtn=function(){var e=this.$el.find("."+BaseCommentView.CLASSES.MORE_BTN);"block"===e.css("display")&&e.css("display","")},BaseCommentView.prototype._handleViewProfile=function(e){e.stopPropagation(),this.$el.trigger(UserEvents.VIEW_PROFILE,{author:this._model.author})},BaseCommentView.prototype._show=function(){this.$el.show()},BaseCommentView.prototype._triggerVisEvent=function(){this.$el.trigger(BlockEvents.UPDATE_COUNT,{blockId:this._model.blockId,inc:this._model.calculateCountIncrement()})},BaseCommentView.prototype.createActions=function(){return new CommentActions({model:this._model})},BaseCommentView.prototype.destroy=function(){View.prototype.destroy.call(this),this._actions&&this._actions.destroy(),this._actions=null},BaseCommentView.prototype.getModel=function(){return this._model},BaseCommentView.prototype.getTemplateContext=function(){var e=textEnumeration.KEYS;return{author:this._model.author,avatar:adaptAvatar(this._model.author.avatar),body:this._model.body,defaultAvatar:this.opts.defaultAvatar,moderator:this._model.moderator,pending:this._model.isPending(),strings:{commentModeratorTag:textEnumeration.get(e.COMMENT_MODERATOR_TAG),commentPendingTag:textEnumeration.get(e.COMMENT_PENDING_TAG)}}},BaseCommentView.prototype.handleVisChange=function(){switch(this._triggerVisEvent(),this._model.visibility){case visEnums.NONE:return this.handleVisNone();case visEnums.EVERYONE:return this.handleVisEveryone();case visEnums.OWNER:return this.handleVisOwner();case visEnums.GROUP:return this.handleVisGroup();default:throw"Not supported visibility type: "+this._model.visibility}},BaseCommentView.prototype.handleVisEveryone=function(){this.render(),this._show()},BaseCommentView.prototype.handleVisGroup=function(){var e=auth.get("livefyre"),t=!!e&&e.isMod({collectionId:this._model.collectionId});return this._model.isUserAuthor()||t?(this.render(),void this._show()):void this.hide()},BaseCommentView.prototype.handleVisNone=function(){this.hide()},BaseCommentView.prototype.handleVisOwner=function(){return this._model.isUserAuthor()?(this.render(),void this._show()):void this.hide()},BaseCommentView.prototype.hide=function(){this.$el.hide()},BaseCommentView.prototype.render=function(){this.$el.html(this.template(this.getTemplateContext(),{base:baseCommentTemplate,etc:etcCommentTemplate,footer:footerCommentTemplate,tags:tagsTemplate})),this.$footerEl=this.$("."+BaseCommentView.CLASSES.FOOTER),this._actions.setElement(this.$footerEl.find("."+BaseCommentView.CLASSES.ACTIONS)),this._actions.render(),this.$el.attr("id",this._model.id),this._model.hasBeenRendered=!0},BaseCommentView.prototype.shouldRender=function(){var e=auth.get("livefyre"),t=this._model.isUserAuthor(),i=!!e&&e.isMod({collectionId:this._model.collectionId});switch(this._model.visibility){case visEnums.NONE:return!1;case visEnums.EVERYONE:return!0;case visEnums.OWNER:return t;case visEnums.GROUP:return i||t;default:return!1}},module.exports=BaseCommentView},{"../../../../templates/thread/comment/base.mustache":222,"../../../../templates/thread/comment/comment.mustache":223,"../../../../templates/thread/comment/etc.mustache":224,"../../../../templates/thread/comment/footer.mustache":225,"../../../../templates/thread/comment/tags.mustache":226,"../../../adapters/adapters":101,"../../../enums":122,"../../../events/events":123,"../../../i18n/enumeration":124,"../../../util/auth":181,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/view/src/view.js":83,"./../../../../../node_modules/jquery/dist/jquery":97,"./actions":149}],151:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),BaseCommentView=_dereq_("./baseview"),commentTemplate=_dereq_("../../../../templates/thread/comment/comment.mustache"),etcTemplate=_dereq_("../../../../templates/thread/comment/etc.mustache"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),ReplyView=function(e){BaseCommentView.call(this,e)};inherits(ReplyView,BaseCommentView),ReplyView.prototype.elClass=[BaseCommentView.CLASSES.COMMENT,BaseCommentView.CLASSES.REPLY].join(" "),ReplyView.prototype.template=commentTemplate.render.bind(commentTemplate),ReplyView.prototype.render=function(){BaseCommentView.prototype.render.call(this);var e=this.$("."+BaseCommentView.CLASSES.BODY),t=e.children().last();t.append($(etcTemplate.render()))},module.exports=ReplyView},{"../../../../templates/thread/comment/comment.mustache":223,"../../../../templates/thread/comment/etc.mustache":224,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../node_modules/jquery/dist/jquery":97,"./baseview":150}],152:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),auth=_dereq_("../../../util/auth"),BaseCommentView=_dereq_("./baseview"),CommentActions=_dereq_("./actions"),CommentEvents=_dereq_("../../../events/events").comment,EditorEvents=_dereq_("../../../events/events").editor,EditorView=_dereq_("../editorview"),QueuedExpandableThreadContainer=_dereq_("../queued-expandable-thread-container"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),internals=_dereq_("../../../util/internals"),QueueButton=_dereq_("../queuebutton"),ReplyCommentView=_dereq_("./replyview"),textEnumeration=_dereq_("../../../i18n/enumeration"),ThreadEvents=_dereq_("../../../events/events").thread,topCommentTemplate=_dereq_("../../../../templates/thread/comment/topcomment.mustache"),viewEnum=_dereq_("../../../enums").navigableViews,WriteEvents=_dereq_("../../../events/events").write,TopCommentView=function(e){BaseCommentView.call(this,e),this._mouseEventsDisabled=!1,this._replyContainer=null,this._replyEditor=null};inherits(TopCommentView,BaseCommentView),TopCommentView.CLASSES={EDITOR_CONTAINER:"lf-editor-container",REPLY_CONTAINER:"lf-reply-container",ETC_BUTTON:"lf-etc-btn"},$.extend(TopCommentView.CLASSES,BaseCommentView.CLASSES),TopCommentView.prototype.events=function(){var e={},t=QueuedExpandableThreadContainer.EVENTS;return e["click ."+CommentActions.CLASSES.REPLY_BTN]="_toggleReplyEditor",e["keyup ."+CommentActions.CLASSES.REPLY_BTN]="_toggleReplyEditor",e["click ."+QueuedExpandableThreadContainer.CLASSES.REPLY_BTN]="_toggleReplyEditor",e["keyup ."+QueuedExpandableThreadContainer.CLASSES.REPLY_BTN]="_toggleReplyEditor",e[WriteEvents.POST_REPLY]="_interceptReply",e[t.HIDE_REPLY_BTN]="_handleHideReplyBtn",e[ThreadEvents.SHOW_QUEUED_CONTENT]="_handleShowQueuedContent",e.mouseenter="handleMouseEnter",e.mouseleave="handleMouseLeave",e}(),$.extend(TopCommentView.prototype.events,BaseCommentView.prototype.events),TopCommentView.prototype.template=topCommentTemplate.render.bind(topCommentTemplate),TopCommentView.prototype._handleHideReplyBtn=function(){this._actions.hideReplyBtn()},TopCommentView.prototype._handleShowQueuedContent=function(e){e.stopPropagation(),this._replyContainer.$el.trigger(ThreadEvents.SHOW_QUEUED_CONTENT)},TopCommentView.prototype._interceptReply=function(e,t){var i=this,n=t.callback||function(){};t.callback=function(e,t){n(e,t),e||(i.$_editorContainerEl.hide(),i.getThreadContainer().addComment(t))},t.parentId=this._model.id},TopCommentView.prototype._toggleReplyEditor=function(e){function t(){i.getThreadContainer().getReplyButton().show()}var i=this;if(9===e.which&&"keyup"===e.type&&this.showEtcBtn(),13===e.which||"keyup"!==e.type){if(!auth.get("livefyre"))return t(),void this.$el.trigger(ThreadEvents.NAVIGATE,{event:WriteEvents.POST_REPLY,value:viewEnum.AUTH});if(this._replyEditor&&this.$_editorContainerEl.is(":visible"))return void this.$_editorContainerEl.hide();this._replyEditor?this._replyEditor.reset():(this._replyEditor=new EditorView({editorId:this._model.id,el:this.$_editorContainerEl,hideOnBlur:!0,postEvent:WriteEvents.POST_REPLY,type:EditorView.TYPES.REPLY}),this._replyEditor.render()),this.$_editorContainerEl.show(),this._replyEditor.initialize(),$(e.target).hasClass(QueuedExpandableThreadContainer.CLASSES.REPLY_BTN)&&this._replyEditor.$el.one(EditorEvents.HIDE,t)}},TopCommentView.prototype.showEtcBtn=function(){this.$el.find("."+TopCommentView.CLASSES.ETC_BUTTON).css("display","block")},TopCommentView.prototype.destroy=function(){BaseCommentView.prototype.destroy.call(this),this._replyEditor&&this._replyEditor.destroy(),this._replyEditor=null},TopCommentView.prototype.disableMouseEvents=function(e){this._mouseEventsDisabled=e},TopCommentView.prototype.getThreadContainer=function(){return this._replyContainer},TopCommentView.prototype.handleMouseEnter=function(){if(!this._mouseEventsDisabled){var t=this._model.selectedText;if(t){var i=this;setTimeout(function(){i.$el.trigger(ThreadEvents.ACTIVATE_HIGHLIGHTED_TEXT,{selectedText:t,blockId:i._model.blockId})},1)}}},TopCommentView.prototype.handleMouseLeave=function(){this._model.selectedText&&!this._mouseEventsDisabled&&this.$el.trigger(ThreadEvents.DEACTIVATE_HIGHLIGHTED_TEXT)},TopCommentView.prototype.hide=function(){BaseCommentView.prototype.hide.call(this),this.$el.trigger(CommentEvents.HIDDEN,this._model)},TopCommentView.prototype.render=function(){var e=TopCommentView.CLASSES,t=textEnumeration.KEYS;BaseCommentView.prototype.render.call(this),this.$_editorContainerEl=this.$("."+e.EDITOR_CONTAINER);var i=new QueueButton({plural:textEnumeration.get(t.QUEUED_REPLIES_PLURAL),singular:textEnumeration.get(t.QUEUED_REPLIES_SINGULAR)});i.render().hide(),this.$footerEl.append(i.$el),this._replyContainer=new QueuedExpandableThreadContainer({assetServer:this.opts.assetServer,commentConstructor:ReplyCommentView,commentQueueBtn:i,defaultAvatar:this.opts.defaultAvatar,el:this.$("."+e.REPLY_CONTAINER)}),this._replyContainer.render()},TopCommentView.prototype.renderEtc=internals.nullFunction,module.exports=TopCommentView},{"../../../../templates/thread/comment/topcomment.mustache":227,"../../../enums":122,"../../../events/events":123,"../../../i18n/enumeration":124,"../../../util/auth":181,"../../../util/internals":185,"../editorview":154,"../queuebutton":167,"../queued-expandable-thread-container":168,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../node_modules/jquery/dist/jquery":97,"./actions":149,"./baseview":150,"./replyview":151}],153:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),auth=_dereq_("../../../util/auth"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),Observer=_dereq_("./../../../../../lib/observer/src/observer.js"),View=_dereq_("./../../../../../lib/view/src/view.js"),voteContainerTemplate=_dereq_("../../../../templates/thread/comment/votecontainer.mustache"),voteEnums=_dereq_("./../../../../../lib/streamhub-sdk/src/content/annotator-extensions").voteEnums,WriteEvents=_dereq_("../../../events/events").write,voteEnum=voteEnums.vote,voteToCount=voteEnums.voteToCount,VoteContainer=function(t){View.call(this,t),this._model=this.opts.model;var e=this._hasVoted();this._currentVote=e?e.value:voteEnum.UNSET,this._disabled=!1,this._processing=!1,this._model.on("change:votes",$.proxy(this._handleVotesUpdated,this)),Observer(this),this.listenTo(auth,"login.livefyre",$.proxy(this._handleUserLogin,this)),this.listenTo(auth,"logout",$.proxy(this._handleUserLogout,this))};inherits(VoteContainer,View),VoteContainer.CLASSES={COUNT:"lf-count",DISABLED:"lf-disabled",DOWNVOTE:"lf-downvote",MAIN:"lf-votes",UPVOTE:"lf-upvote",VOTED:"lf-voted"},VoteContainer.prototype.events={"click a":"_handleVoteClick","keyup a":"_handleVoteClick"},VoteContainer.prototype.template=voteContainerTemplate.render.bind(voteContainerTemplate),VoteContainer.prototype._handleUserLogin=function(){var t=this._hasVoted();this._currentVote=t?t.value:voteEnum.UNSET,this._updateVoteStatus(),this._updateButtonState()},VoteContainer.prototype._handleUserLogout=function(){this._currentVote=voteEnum.UNSET,this._updateVoteStatus(),this._updateButtonState()},VoteContainer.prototype._handleVoteClick=function(t){if(!(13!==t.which&&"keyup"===t.type||this._disabled||this._processing)){this._processing=!0;var e=VoteContainer.CLASSES,o=$(t.target),n=o.hasClass(e.DOWNVOTE),i=n?voteEnum.DOWNVOTE:voteEnum.UPVOTE,r=this._currentVote===i?voteEnum.UNSET:i;o.toggleClass(e.VOTED,r!==voteEnum.UNSET),this.$el.trigger(WriteEvents.POST_VOTE,{authorId:this._model.author.id,callback:$.proxy(this._handleVoteComplete,this),lastValue:this._currentVote,messageId:this._model.id,value:r}),this._instantFeedbackRender(r),this._processing=!1}},VoteContainer.prototype._handleVoteComplete=function(t,e){return t?void this.render():void this._setCurrentVote(e)},VoteContainer.prototype._handleVotesUpdated=function(){var o=this._hasVoted();this._setCurrentVote(o),this.render()},VoteContainer.prototype._hasVoted=function(){var t=auth.get("livefyre"),e=t?t.get("id"):null;if(!e)return null;for(var o,n=this._model.votes.list,i=0,r=n.length;r>i;i++)if(o=n[i],e===o.author)return o;return null},VoteContainer.prototype._instantFeedbackRender=function(t){if(auth.get("livefyre")){var e=this._getDiff(t);this._model.votes.helpfulness+=e,this._updateVoteCount(),this._updateVoteStatus(t)}},VoteContainer.prototype._getDiff=function(t){var e=-1*voteToCount[this._currentVote];return t!==voteEnum.UNSET&&(e+=voteToCount[t]),e},VoteContainer.prototype._setCurrentVote=function(t){this._currentVote=t?t.value:voteEnum.UNSET},VoteContainer.prototype._updateButtonState=function(){this._disabled=this._model.isUserAuthor(),this.$el.toggleClass(VoteContainer.CLASSES.DISABLED,this._disabled)},VoteContainer.prototype._updateVoteCount=function(t){var e=this._model.votes.helpfulness;void 0!==t&&(e=t),this.$("."+VoteContainer.CLASSES.COUNT).html(e)},VoteContainer.prototype._updateVoteStatus=function(t){var e,o=VoteContainer.CLASSES;if(e=void 0!==t?t:this._currentVote,this.$el.attr("class",o.MAIN),e!==voteEnum.UNSET&&!this._model.isUserAuthor()){var n=e===voteEnum.UPVOTE?o.UPVOTE:o.DOWNVOTE;this.$el.addClass(n)}},VoteContainer.prototype.destroy=function(){View.prototype.destroy.call(this),this.stopListening()},VoteContainer.prototype.getTemplateContext=function(){return{count:this._model.votes.helpfulness}},VoteContainer.prototype.render=function(){View.prototype.render.call(this),this._updateVoteStatus(),this._updateButtonState()},module.exports=VoteContainer},{"../../../../templates/thread/comment/votecontainer.mustache":228,"../../../events/events":123,"../../../util/auth":181,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/observer/src/observer.js":42,"./../../../../../lib/streamhub-sdk/src/content/annotator-extensions":65,"./../../../../../lib/view/src/view.js":83,"./../../../../../node_modules/jquery/dist/jquery":97}],154:[function(_dereq_,module){function EditorView(t){BaseEditorView.call(this,t),this._hideOnBlur=!!t.hideOnBlur,this._isPostBtnVisible=!0,this._isPosting=!1,this._originalHeight=null,this._placeholderSupported=!0,this._type=this.opts.type}var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),BaseEditorView=_dereq_("./baseeditorview"),EditorEvents=_dereq_("../../events/events").editor,editorUtil=_dereq_("../../util/editor"),editorViewTemplate=_dereq_("../../../templates/thread/editor.mustache"),errorTemplate=_dereq_("../../../templates/thread/editorerror.mustache"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),textEnumeration=_dereq_("../../i18n/enumeration"),ThreadEvents=_dereq_("../../events/events").thread;inherits(EditorView,BaseEditorView),EditorView.TYPES=BaseEditorView.TYPES,EditorView.prototype.classes={EDITOR:"lf-editor",FIELD:"lf-editor-field",FOCUS:"lf-editor-focus",POST_BTN:"lf-editor-post-btn",RESIZE:"lf-editor-resize"},EditorView.prototype.elClass=EditorView.prototype.classes.EDITOR,EditorView.prototype.events=function(){var t=EditorView.prototype.classes,e={};return e["blur ."+t.FIELD]="_handleEditorBlur",e["click ."+t.POST_BTN]="handlePostBtnClick",e["focus ."+t.FIELD]="_handleEditorFocus",e["keydown ."+t.FIELD]="_handleEditorKeydown",e["keyup ."+t.FIELD]="_handleEditorKeyup",e}(),EditorView.prototype.template=editorViewTemplate.render.bind(editorViewTemplate),EditorView.prototype._getPostBtnText=function(){var t,e=textEnumeration.KEYS;return t=textEnumeration.get(this._isPosting&&this._type===BaseEditorView.TYPES.EDIT?e.EDITOR_EDIT_POSTING:this._isPosting?e.EDITOR_POSTING:this._type===BaseEditorView.TYPES.REPLY?e.EDITOR_REPLY_BTN:this._type===BaseEditorView.TYPES.EDIT?e.EDITOR_EDIT_BTN:e.EDITOR_POST_BTN)},EditorView.prototype._handleEditorBlur=function(){if(this._hideOnBlur&&!this.$textareaEl.val())return this.$el.hide(),void this.$el.trigger(EditorEvents.HIDE);if(this.$el.toggleClass(this.classes.FOCUS,!1),!this._placeholderSupported&&""===this.$textareaEl.val()){var t=textEnumeration.KEYS,e=textEnumeration.get(t.EDITOR_PLACEHOLDER);this.$textareaEl.val(e)}},EditorView.prototype._handleEditorFocus=function(){if(this.$el.toggleClass(this.classes.FOCUS,!0),!this._placeholderSupported){var t=textEnumeration.KEYS,e=textEnumeration.get(t.EDITOR_PLACEHOLDER);this.$textareaEl.val()===e&&this.$textareaEl.val(""); }},EditorView.prototype._handleEditorKeydown=function(t){t.stopPropagation(),this._resize();var e=13===t.keyCode;e&&!t.shiftKey&&(t.preventDefault(),this.handlePostBtnClick())},EditorView.prototype._handleEditorKeyup=function(t){t.preventDefault(),t.stopPropagation();var e=this.$textareaEl.val();return this._setDraft(this.opts.editorId,e),this._resize(),0===e.length?void this._hidePostBtn():void this._showPostBtn()},EditorView.prototype._handlePostComplete=function(t){return this._isPosting=!1,this._updatePostBtnText(),t?void this.showError(t):(this._type===BaseEditorView.TYPES.EDIT&&(this.opts.model.set({body:this._getContents()}),this.$el.trigger(ThreadEvents.NAVIGATE_TO_THREAD)),void this.reset())},EditorView.prototype._hidePostBtn=function(){this._isPostBtnVisible&&this.$postBtnEl.hide(),this._isPostBtnVisible=!1},EditorView.prototype._processPlaceholders=function(){var t=textEnumeration.KEYS,e=textEnumeration.get(t.EDITOR_PLACEHOLDER);return void 0!==this.$textareaEl[0].placeholder?void this.$textareaEl.attr("placeholder",e):(this._placeholderSupported=!1,void this.$textareaEl.val(e))},EditorView.prototype._resize=function(){var t=this.$textareaEl.val(),e=0;t=editorUtil.escapeHTML(t),this.$resizeEl[0].innerHTML=editorUtil.normalizeNewlines(t),$.each(this.$resizeEl.children(),function(t,i){e+=$(i).height()}),this.$textareaEl.height(e)},EditorView.prototype._showPostBtn=function(){this._isPostBtnVisible||this.$postBtnEl.css("display","block"),this._isPostBtnVisible=!0},EditorView.prototype._updatePostBtnText=function(){this.$postBtnEl.html(this._getPostBtnText())},EditorView.prototype.focus=function(){editorUtil.focusAndPlaceCursorAtEnd(this.$textareaEl)},EditorView.prototype.getTemplateContext=function(){return{strings:{postBtn:this._getPostBtnText()}}},EditorView.prototype.initialize=function(){this._originalHeight=this.$textareaEl.height(),this._type!==BaseEditorView.TYPES.EDIT&&this._hidePostBtn(),this.focus()},EditorView.prototype.render=function(){BaseEditorView.prototype.render.call(this),this.$postBtnEl=this.$("."+this.classes.POST_BTN),this.$resizeEl=this.$("."+this.classes.RESIZE);var t=this.opts.model;if(t)return void this.$textareaEl.val(editorUtil.normalizeParagraphTags(t.body));var e=this._getDraft(this.opts.editorId);return e?void this.$textareaEl.val(e):void this._processPlaceholders()},EditorView.prototype.reset=function(){this.$resizeEl.html(""),this.$textareaEl.val(""),this._hidePostBtn(),this.$textareaEl.height(this._originalHeight),this._setDraft(this.opts.editorId,null)},EditorView.prototype.sendPostEvent=function(t){this._isPosting||(this._isPosting=!0,this._updatePostBtnText(),this.$el.trigger(this.opts.postEvent,t))},EditorView.prototype.showError=function(){this.$errorEl||(this.$errorEl=$(errorTemplate.render({msg:BaseEditorView.ERRORS.GENERIC})),this.$el.append(this.$errorEl),this.$errorEl.fadeTo(500,.98),this.$textareaEl.blur(),this.$errorEl.one("click",$.proxy(function(t){t.stopPropagation(),this.$errorEl.remove(),this.$errorEl=null,this.focus()},this)))},module.exports=EditorView},{"../../../templates/thread/editor.mustache":229,"../../../templates/thread/editorerror.mustache":230,"../../events/events":123,"../../i18n/enumeration":124,"../../util/editor":184,"./../../../../lib/inherits/inherits.js":11,"./../../../../node_modules/jquery/dist/jquery":97,"./baseeditorview":147}],155:[function(_dereq_,module){var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),BaseThreadContainer=_dereq_("./basethreadcontainer"),expandableThreadContainerTemplate=_dereq_("../../../templates/thread/expandablethreadcontainer.mustache"),QueueButton=_dereq_("./queuebutton"),textEnumeration=_dereq_("../../i18n/enumeration"),ThreadEvents=_dereq_("../../events/events").thread,ExpandableThreadContainer=function(e){BaseThreadContainer.call(this,e),this._expanded=!0,this._oldestCollapsedVisibleIdx=0;var t=textEnumeration.KEYS;this._toggleBtn=new QueueButton({plural:textEnumeration.get(t.THREAD_EXPAND_BTN_PLURAL),singular:textEnumeration.get(t.THREAD_EXPAND_BTN_SINGULAR)})};inherits(ExpandableThreadContainer,BaseThreadContainer),ExpandableThreadContainer.NUM_COLLAPSED_COMMENTS=2,ExpandableThreadContainer.CLASSES={CONTAINER:"lf-expandable-container",MAIN:"lf-expandable-thread-container",REPLY_BTN:"lf-expand-reply-btn",TOGGLE_BTN:"lf-expand-toggle-btn",TOGGLE_BTN_TEXT:"lf-expand-toggle-text"},ExpandableThreadContainer.EVENTS={HIDE_REPLY_BTN:"hideReplyBtn"},ExpandableThreadContainer.prototype.elClass=ExpandableThreadContainer.CLASSES.MAIN,ExpandableThreadContainer.prototype.events=function(){var e=ExpandableThreadContainer.CLASSES,t={};return t["click ."+e.REPLY_BTN]="_handleReplyClick",t[ThreadEvents.SHOW_QUEUED_CONTENT]="_handleToggleClick",t}(),ExpandableThreadContainer.prototype.template=expandableThreadContainerTemplate.render.bind(expandableThreadContainerTemplate),ExpandableThreadContainer.prototype._handleReplyClick=function(){this._$replyBtnEl.hide()},ExpandableThreadContainer.prototype._handleToggleClick=function(){this._expanded||(this._expanded=!0,this.expand(),this._updateButtonText())},ExpandableThreadContainer.prototype._updateButtonText=function(){this._expanded||this._toggleBtn.setCount(this.getNumQueued())},ExpandableThreadContainer.prototype.addComment=function(){BaseThreadContainer.prototype.addComment.apply(this,arguments),this.updateButtonVisibility()},ExpandableThreadContainer.prototype.expand=function(){var e,t=document.createDocumentFragment(),n=this._commentIds.slice(0,this._oldestCollapsedVisibleIdx),a=this;$.each(n,function(n,r){e=a._comments[r],e.render(),t.appendChild(e.el)}),this.getContainerElement().prepend(t.childNodes),this._toggleBtn.hide()},ExpandableThreadContainer.prototype.getContainerElement=function(){return this._$containerEl},ExpandableThreadContainer.prototype.getNumQueued=function(){return this._commentIds.length-ExpandableThreadContainer.NUM_COLLAPSED_COMMENTS},ExpandableThreadContainer.prototype.getReplyButton=function(){return this._$replyBtnEl},ExpandableThreadContainer.prototype.getTemplateContext=function(){var e=textEnumeration.KEYS;return{strings:{replyBtnText:textEnumeration.get(e.THREAD_REPLY_BTN),toggleBtnText:textEnumeration.get(e.THREAD_EXPAND_BTN_SINGULAR)}}},ExpandableThreadContainer.prototype.initialize=function(e){e.sort(function(e,t){var n=e.createdAt,a=t.createdAt;return a>n?-1:n>a?1:0});var t,n=this.getContainerElement(),a=e.length,r=0;$.each(e.reverse(),$.proxy(function(e,i){this._comments[i.id]||(t=new this._commentConstructor(this._getCommentOptions(i)),this._comments[i.id]=t,this._commentIds.splice(0,0,i.id),r!==ExpandableThreadContainer.NUM_COLLAPSED_COMMENTS&&(1===r&&(this._oldestCollapsedVisibleIdx=a-e-1),t.render(),n.prepend(t.$el),t.shouldRender()&&r++))},this));var i=this._commentIds.length;this._expanded=i<=ExpandableThreadContainer.NUM_COLLAPSED_COMMENTS,this._updateButtonText(),this.updateButtonVisibility()},ExpandableThreadContainer.prototype.render=function(){BaseThreadContainer.prototype.render.call(this),this._toggleBtn.render(),this.$el.prepend(this._toggleBtn.$el);var e=ExpandableThreadContainer.CLASSES;this._$containerEl=this.$("."+e.CONTAINER),this._$replyBtnEl=this.$("."+e.REPLY_BTN).css("display","inline-block"),this.updateButtonVisibility()},ExpandableThreadContainer.prototype.updateButtonVisibility=function(){var e=this._commentIds.length;return e?(this.$el.trigger(ExpandableThreadContainer.EVENTS.HIDE_REPLY_BTN),e<=ExpandableThreadContainer.NUM_COLLAPSED_COMMENTS?(this._toggleBtn.hide(),void this._$replyBtnEl.show()):(this._toggleBtn.show(),void this._$replyBtnEl.show())):(this._toggleBtn.hide(),void this._$replyBtnEl.hide())},module.exports=ExpandableThreadContainer},{"../../../templates/thread/expandablethreadcontainer.mustache":231,"../../events/events":123,"../../i18n/enumeration":124,"./../../../../lib/inherits/inherits.js":11,"./../../../../node_modules/jquery/dist/jquery":97,"./basethreadcontainer":148,"./queuebutton":167}],156:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),authMenuTemplate=_dereq_("../../../../templates/thread/menu/auth.mustache"),BaseMenu=_dereq_("./base"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),Navigable=_dereq_("../navigable"),textEnumeration=_dereq_("../../../i18n/enumeration"),ThreadEvents=_dereq_("../../../events/events").thread,UserAgentUtil=_dereq_("../../../util/useragent"),UserEvents=_dereq_("../../../events/events").user,WriteEvents=_dereq_("../../../events/events").write,AuthMenu=function(e){BaseMenu.call(this,e)};inherits(AuthMenu,BaseMenu),AuthMenu.CLASSES={AUTH:"lf-auth",SIGNED_IN:"lf-signed-in",SIGNIN_BTN:"lf-signin-btn"};var EVENT_TO_ACTION_MAP=function(){var e={};return e[WriteEvents.POST_ANNOTATION]="Post",e[WriteEvents.POST_APPROVE]="Approve",e[WriteEvents.POST_DELETE]="Delete",e[WriteEvents.POST_HIDE]="Hide",e[WriteEvents.POST_REPLY]="Reply",e[WriteEvents.POST_VOTE]="Vote",e}();AuthMenu.prototype.elClass=[BaseMenu.CLASSES.MENU,AuthMenu.CLASSES.AUTH].join(" "),AuthMenu.prototype.events=function(){var e={},t=UserAgentUtil.isMobile()?"tap":"click";return e[t+" ."+AuthMenu.CLASSES.SIGNIN_BTN]="_handleLoginClick",e}(),$.extend(AuthMenu.prototype.events,Navigable.prototype.events),AuthMenu.prototype._handleLoginClick=function(){this.$el.trigger(UserEvents.LOGIN),this.$el.trigger(ThreadEvents.NAVIGATE_BACK)},AuthMenu.prototype.getTemplateContext=function(){var e=BaseMenu.prototype.getTemplateContext.call(this),t=textEnumeration.KEYS,n=textEnumeration.get(t.MENU_AUTH_SIGNED_IN_MSG);return $.extend(e.strings,{signedInMsg:n.replace("{action}",EVENT_TO_ACTION_MAP[this.opts.event]),signInBtn:textEnumeration.get(t.MENU_AUTH_SIGN_IN_BTN)}),e},AuthMenu.prototype.subTemplate=authMenuTemplate,module.exports=AuthMenu},{"../../../../templates/thread/menu/auth.mustache":234,"../../../events/events":123,"../../../i18n/enumeration":124,"../../../util/useragent":195,"../navigable":165,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../node_modules/jquery/dist/jquery":97,"./base":157}],157:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),linkTemplate=_dereq_("../../../../templates/thread/menu/link.mustache"),Navigable=_dereq_("../navigable"),UserAgentUtil=_dereq_("../../../util/useragent"),BaseMenu=function(e){Navigable.call(this,e),this._model=e.model,this.postEvent=null};inherits(BaseMenu,Navigable),BaseMenu.CLASSES=Navigable.CLASSES,BaseMenu.prototype.events=function(){var e={},t=UserAgentUtil.isMobile()?"tap":"click";return e[t+" ."+BaseMenu.CLASSES.BODY+" > li"]="handleOptionClick",UserAgentUtil.isMobile()||(e["keyup ."+BaseMenu.CLASSES.BODY+" > li"]="handleOptionClick"),e}(),$.extend(BaseMenu.prototype.events,Navigable.prototype.events),BaseMenu.prototype._buildMenuLinks=function(){var e=this.getLinkConfig();if(!e.length)return null;var t=document.createDocumentFragment();return $.each(e,function(e,n){t.appendChild($(linkTemplate.render(n))[0])}),t},BaseMenu.prototype.buildEventData=function(e){return{messageId:this._model.id,model:this._model,value:$(e.currentTarget).attr("data-value")}},BaseMenu.prototype.getLinkConfig=function(){return[]},BaseMenu.prototype.handleOptionClick=function(e){e.stopPropagation(),13!==e.which&&"keyup"===e.type||this.$el.trigger(this.postEvent,this.buildEventData(e))},BaseMenu.prototype.loadMenuLinks=function(){var e=this._buildMenuLinks();e&&this.$("."+BaseMenu.CLASSES.BODY).prepend(e)},BaseMenu.prototype.render=function(){Navigable.prototype.render.call(this),this.loadMenuLinks()},module.exports=BaseMenu},{"../../../../templates/thread/menu/link.mustache":238,"../../../util/useragent":195,"../navigable":165,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../node_modules/jquery/dist/jquery":97}],158:[function(_dereq_,module){var BaseMenu=_dereq_("./base"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),textEnumeration=_dereq_("../../../i18n/enumeration"),ConfirmMenu=function(t){BaseMenu.call(this,t),this.postEvent=t.postEvent,this.callback=t.callback};inherits(ConfirmMenu,BaseMenu),ConfirmMenu.prototype.getLinkConfig=function(){var t=textEnumeration.KEYS,e=textEnumeration.get(t.MENU_CONFIRM_ACCEPT);return[{key:"confirm",str:e.replace("{action}",this.opts.actionStr)},{key:"cancel",str:textEnumeration.get(t.MENU_CONFIRM_CANCEL)}]},ConfirmMenu.prototype.getTemplateContext=function(){var t=BaseMenu.prototype.getTemplateContext.call(this),e=textEnumeration.KEYS;return t.strings.title=textEnumeration.get(e.MENU_CONFIRM_TITLE),t},ConfirmMenu.prototype.handleOptionClick=function(t){var e=this.buildEventData(t);return e.callback=this.callback,"cancel"===e.value?void this._handleBackClick(t):void this.$el.trigger(this.postEvent,e)},module.exports=ConfirmMenu},{"../../../i18n/enumeration":124,"./../../../../../lib/inherits/inherits.js":11,"./base":157}],159:[function(_dereq_,module){function EditMenu(e){BaseMenu.call(this,e),this.postEvent=WriteEvents.POST_EDIT}var BaseMenu=_dereq_("./base"),EditorView=_dereq_("../editorview"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),textEnumeration=_dereq_("../../../i18n/enumeration"),WriteEvents=_dereq_("../../../events/events").write;inherits(EditMenu,BaseMenu),EditMenu.prototype.getTemplateContext=function(){var e=BaseMenu.prototype.getTemplateContext.call(this),t=textEnumeration.KEYS;return e.strings.title=textEnumeration.get(this._model.parentId?t.EDITOR_EDIT_REPLY_TITLE:t.EDITOR_EDIT_TITLE),e},EditMenu.prototype.render=function(){BaseMenu.prototype.render.call(this),this._editorView=new EditorView({hideOnBlur:!1,model:this._model,postEvent:this.postEvent,type:EditorView.TYPES.EDIT}),this._editorView.render(),this.$("."+BaseMenu.CLASSES.BODY).append(this._editorView.$el)},EditMenu.prototype.initialize=function(){this._editorView.initialize()},module.exports=EditMenu},{"../../../events/events":123,"../../../i18n/enumeration":124,"../editorview":154,"./../../../../../lib/inherits/inherits.js":11,"./base":157}],160:[function(_dereq_,module){function isMod(t){var e=auth.get("livefyre");return!!e&&e.isMod({collectionId:t})}function EtcMenu(t){BaseMenu.call(this,t),this.postEvent=ThreadEvents.NAVIGATE}var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),auth=_dereq_("../../../util/auth"),BaseMenu=_dereq_("./base"),etcMenuTemplate=_dereq_("../../../../templates/thread/menu/etc.mustache"),etcMenuMobileTemplate=_dereq_("../../../../templates/mobile/etcmenu.mustache"),dateUtil=_dereq_("../../../util/date"),editLinkTemplate=_dereq_("../../../../templates/thread/menu/editlink.mustache"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),textEnumeration=_dereq_("../../../i18n/enumeration"),ThreadEvents=_dereq_("../../../events/events").thread,userAgentUtil=_dereq_("../../../util/useragent"),viewEnum=_dereq_("../../../enums").navigableViews,visEnums=_dereq_("../../../enums").commentVisibility,WriteEvents=_dereq_("../../../events/events").write;inherits(EtcMenu,BaseMenu);var EVENT_MAP={approve:WriteEvents.POST_APPROVE,edit:ThreadEvents.NAVIGATE,flag:ThreadEvents.NAVIGATE,share:ThreadEvents.NAVIGATE};EtcMenu.CLASSES={EDIT_COUNTDOWN:"lf-edit-countdown",POWERED_BY:"lf-powered-by"},EtcMenu.prototype._buildMenuLinks=function(){var t=BaseMenu.prototype._buildMenuLinks.call(this);if(!this._isEditable())return t;var e=!isMod(this._model.meta.collectionId);return this.$editLink=$(editLinkTemplate.render({key:"edit",str:textEnumeration.get(textEnumeration.KEYS.MENU_ETC_OPTION_EDIT),showTimeRemaining:e,timeRemaining:this._getEditTimeRemaining()})),e&&(this.$editCountdownEl=this.$editLink.find("."+EtcMenu.CLASSES.EDIT_COUNTDOWN),this._editCountDown=setInterval($.proxy(this._updateEditTimeRemaining,this),1e3)),t.appendChild(this.$editLink[0]),t},EtcMenu.prototype._buildPostedAt=function(){var t=dateUtil.getPrettyDate(this._model.createdAt),e=textEnumeration.get(textEnumeration.KEYS.MENU_ETC_POSTED_AT);return e.replace("{date}",t)},EtcMenu.prototype._getEditTimeRemaining=function(){var t=this._getEditWindow(),e=new Date,i=new Date(t-e).getMinutes();return i+textEnumeration.get(textEnumeration.KEYS.DATETIME_MINUTE_ABBREVIATION)},EtcMenu.prototype._getEditWindow=function(){var t=new Date(this._model.createdAt),e=this.opts.collection.settings.editCommentInterval;return new Date(t.setMinutes(t.getMinutes()+e))},EtcMenu.prototype._handleDeleteClick=function(){function t(){n.set({lastVisibility:n.visibility,visibility:visEnums.NONE})}var e=textEnumeration.KEYS,i=WriteEvents.POST_HIDE;this._isAuthor()&&(i=WriteEvents.POST_DELETE);var n=this._model;this.$el.trigger(this.postEvent,{actionStr:textEnumeration.get(e.MENU_ETC_OPTION_DELETE),model:n,postEvent:i,value:viewEnum.CONFIRM,callback:t})},EtcMenu.prototype._handlePoweredByClick=function(t){this.opts.collection.isCustomNetwork()||(t.preventDefault(),this.$el.trigger(ThreadEvents.NAVIGATE,{value:viewEnum.INFO}))},EtcMenu.prototype._isApprovable=function(){var t=this._model.meta.collectionId;return this._model.isPending()&&isMod(t)},EtcMenu.prototype._isAuthor=function(){return this._model.isUserAuthor()},EtcMenu.prototype._isDeletable=function(){var t=this._model.meta.collectionId;return isMod(t)||this._isAuthor()},EtcMenu.prototype._isEditable=function(){var t=this.opts.collection.settings.allowEditComments,e=this._model.meta.collectionId,i=this._model.visibility===visEnums.EVERYONE&&this._model.lastVisibility===visEnums.GROUP;return!i&&t&&(isMod(e)||this._isInEditWindow())},EtcMenu.prototype._isFlaggable=function(){return!this._model.isUserAuthor()},EtcMenu.prototype._isInEditWindow=function(){return!!this._isAuthor()&&new Datet&&(this._topComment=e[t],this._topComment.parentId);t++);var r=this._comments[this._topComment.id]; r.handleMouseEnter(),r.disableMouseEvents(!0)}},PermalinkThreadContainer.prototype.render=function(){ThreadContainer.prototype.render.call(this);var e=textEnumeration.KEYS;this._navbar=new NavBar({backEvent:ThreadEvents.PERMALINK_BACK,backStr:textEnumeration.get(e.PERMALINK_BACK_BTN),title:textEnumeration.get(e.PERMALINK_TITLE)}),this._navbar.render(),this.$el.prepend(this._navbar.$el)},module.exports=PermalinkThreadContainer},{"../../../templates/thread/permalinkmissing.mustache":244,"../../../templates/thread/threadcontainer.mustache":250,"../../events/events":123,"../../i18n/enumeration":124,"../../mobile/thread/ui/navbar":135,"../../models/comment":145,"./../../../../lib/inherits/inherits.js":11,"./../../../../node_modules/jquery/dist/jquery":97,"./threadcontainer":175}],167:[function(_dereq_,module){var inherits=_dereq_("./../../../../lib/inherits/inherits.js"),queueButtonTemplate=_dereq_("../../../templates/thread/queuebutton.mustache"),ThreadEvents=_dereq_("../../events/events").thread,View=_dereq_("./../../../../lib/view/src/view.js"),QueueButton=function(t){View.call(this,t),this._count=t.count||0,this._plural=t.plural,this._singular=t.singular};inherits(QueueButton,View),QueueButton.CLASSES={DOWN_ARROW:"fycon-arrow-down",MAIN:"lf-queue-btn",REPLY:"lf-reply-queue-btn",TEXT:"lf-btn-text"},QueueButton.prototype.elClass=QueueButton.CLASSES.MAIN,QueueButton.prototype.events={click:"_handleClick"},QueueButton.prototype.template=queueButtonTemplate.render.bind(queueButtonTemplate),QueueButton.prototype._handleClick=function(){this.$el.trigger(ThreadEvents.SHOW_QUEUED_CONTENT)},QueueButton.prototype.hide=function(){this.$el.hide()},QueueButton.prototype.render=function(){return View.prototype.render.call(this),this._btnTextEl=this.$("."+QueueButton.CLASSES.TEXT),this.setCount(),this},QueueButton.prototype.setCount=function(t){this._count=t||0;var e=1===this._count?this._singular:this._plural;this._btnTextEl.html(e.replace("{number}",this._count))},QueueButton.prototype.setReplyBtn=function(){this.$el.addClass(QueueButton.CLASSES.REPLY)},QueueButton.prototype.show=function(){this.$el.show()},module.exports=QueueButton},{"../../../templates/thread/queuebutton.mustache":245,"../../events/events":123,"./../../../../lib/inherits/inherits.js":11,"./../../../../lib/view/src/view.js":83}],168:[function(_dereq_,module){function addQueueNotifier(e){var t=QueuedExpandableThreadContainer.CLASSES;if(!e.$el.has("."+t.NEW).length){var n=document.createElement("span");n.className=t.NEW,e.$el.find(":first-child").after(n)}}var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),Comment=_dereq_("../../models/comment"),ExpandableThreadContainer=_dereq_("./expandablethreadcontainer"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),QueueButton=_dereq_("./queuebutton"),textEnumeration=_dereq_("../../i18n/enumeration"),ThreadEvents=_dereq_("../../events/events").thread,QueuedExpandableThreadContainer=function(e){ExpandableThreadContainer.call(this,e);var t=textEnumeration.KEYS;this._commentQueueBtn=e.commentQueueBtn,this._commentQueueBtn.setReplyBtn(),this._footerQueueBtn=new QueueButton({plural:textEnumeration.get(t.QUEUED_REPLIES_PLURAL),singular:textEnumeration.get(t.QUEUED_REPLIES_SINGULAR)}),this._footerQueueBtn.setReplyBtn(),this._queueBtns=[e.commentQueueBtn],this._queuedComments=[]};inherits(QueuedExpandableThreadContainer,ExpandableThreadContainer),QueuedExpandableThreadContainer.CLASSES={FOOTER:"lf-expandable-footer",NEW:"lf-toggle-btn-new"},$.extend(QueuedExpandableThreadContainer.CLASSES,ExpandableThreadContainer.CLASSES),QueuedExpandableThreadContainer.EVENTS=ExpandableThreadContainer.EVENTS,QueuedExpandableThreadContainer.prototype._queueComment=function(e){this._queuedComments.push(e);var t=this,n=function(e,n,a){n.setCount(a||t._queuedComments.length),addQueueNotifier(n)};n(null,this._toggleBtn,this.getNumQueued()),$.each(this._queueBtns,n),this.updateButtonVisibility()},QueuedExpandableThreadContainer.prototype._showQueuedComments=function(e){e&&e.stopPropagation();var t=this.getContainerElement();$.each(this._queuedComments,$.proxy(function(e,n){this.processComment(!1,t,null,n,!0)},this)),this._queuedComments=[],this.updateButtonVisibility()},QueuedExpandableThreadContainer.prototype.destroy=function(){ExpandableThreadContainer.prototype.destroy.call(this);var e=$.proxy(this._showQueuedComments,this);this.$el.off(ThreadEvents.SHOW_QUEUED_CONTENT,e)},QueuedExpandableThreadContainer.prototype.expand=function(){ExpandableThreadContainer.prototype.expand.call(this),this._showQueuedComments()},QueuedExpandableThreadContainer.prototype.getNumQueued=function(){var e=ExpandableThreadContainer.prototype.getNumQueued.call(this);return e+this._queuedComments.length},QueuedExpandableThreadContainer.prototype.processComment=function(e,t,n,a,o){return o=a.isUserAuthor()||o,o||a.origin!==Comment.ORIGIN.STREAM?void ExpandableThreadContainer.prototype.processComment.call(this,e,t,n,a):void this._queueComment(a)},QueuedExpandableThreadContainer.prototype.render=function(){ExpandableThreadContainer.prototype.render.call(this),this._footerQueueBtn.render().hide(),this._queueBtns.push(this._footerQueueBtn),this.$("."+QueuedExpandableThreadContainer.CLASSES.FOOTER).append(this._footerQueueBtn.$el);var e=$.proxy(this._showQueuedComments,this);this.$el.on(ThreadEvents.SHOW_QUEUED_CONTENT,e)},QueuedExpandableThreadContainer.prototype.updateButtonVisibility=function(){var e=this._commentIds.length,t=this._queuedComments.length>0;return this._toggleBtn.hide(),this._$replyBtnEl.hide(),this._footerQueueBtn.hide(),this._commentQueueBtn.hide(),e?(this.$el.trigger(ExpandableThreadContainer.EVENTS.HIDE_REPLY_BTN),e<=ExpandableThreadContainer.NUM_COLLAPSED_COMMENTS?(this._$replyBtnEl.show(),void(t&&this._footerQueueBtn.show())):(!this._expanded&&this._toggleBtn.show(),this._$replyBtnEl.show(),void(this._expanded&&t&&this._footerQueueBtn.show()))):void(t&&this._commentQueueBtn.show())},module.exports=QueuedExpandableThreadContainer},{"../../events/events":123,"../../i18n/enumeration":124,"../../models/comment":145,"./../../../../lib/inherits/inherits.js":11,"./../../../../node_modules/jquery/dist/jquery":97,"./expandablethreadcontainer":155,"./queuebutton":167}],169:[function(_dereq_,module){function decorateDestroy(e){var t=e.destroy;e.destroy=function(){t.call(this),this._queueBtn.$el.off(ThreadEvents.SHOW_QUEUED_CONTENT,$.proxy(this.showQueuedComments,this))}}function decorateProcessComment(e){var t=e.processComment;e.processComment=function(e,u,n,o,r){var s=o.hasBeenRendered,m=o.isUserAuthor(),i=!!o.parentId,a=o.origin===Comment.ORIGIN.STREAM;return r||i||s||m||!a?void t.call(this,e,u,n,o):void this.queueComment(o)}}function queueComment(e){this._queuedComments.push(e),this._queueBtn.el.parentNode||this._queueBtn.$el.insertBefore(this.$el.siblings("."+CLASSES.GRADIENT)),this._queueBtn.setCount(this._queuedComments.length),this._queueBtn.show()}function showQueuedComments(e){e&&e.stopPropagation();var t=this.getContainerElement();$.each(this._queuedComments,$.proxy(function(e,u){this.processComment(!0,t,null,u,!0)},this)),this._queuedComments=[],this._queueBtn.hide()}var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),Comment=_dereq_("../../models/comment"),QueueButton=_dereq_("./queuebutton"),textEnumeration=_dereq_("../../i18n/enumeration"),ThreadEvents=_dereq_("../../events/events").thread,QueueDecorator={},CLASSES={GRADIENT:"lf-thread-gradient"};QueueDecorator.decorate=function(e){var t=textEnumeration.KEYS,u=new QueueButton({plural:textEnumeration.get(t.QUEUED_COMMENTS_PLURAL),singular:textEnumeration.get(t.QUEUED_COMMENTS_SINGULAR)});u.render(),e._queueBtn=u,e._queuedComments=[],decorateDestroy(e),decorateProcessComment(e),e.queueComment=queueComment,e.showQueuedComments=showQueuedComments,e._queueBtn.$el.on(ThreadEvents.SHOW_QUEUED_CONTENT,$.proxy(e.showQueuedComments,e))},module.exports=QueueDecorator},{"../../events/events":123,"../../i18n/enumeration":124,"../../models/comment":145,"./../../../../node_modules/jquery/dist/jquery":97,"./queuebutton":167}],170:[function(_dereq_,module){var anonAuthorTemplate=_dereq_("../../../../templates/thread/thread/anonauthor.mustache"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),textEnumeration=_dereq_("../../../i18n/enumeration"),View=_dereq_("./../../../../../lib/view/src/view.js"),UserEvents=_dereq_("../../../events/events").user,AnonAuthorView=function(e){View.call(this,e)};inherits(AnonAuthorView,View),AnonAuthorView.CLASSES={ANON_AUTHOR:"lf-anon-author"},AnonAuthorView.prototype.elClass=AnonAuthorView.CLASSES.ANON_AUTHOR,AnonAuthorView.prototype.events={click:"_handleLogin"},AnonAuthorView.prototype.template=anonAuthorTemplate.render.bind(anonAuthorTemplate),AnonAuthorView.prototype._handleLogin=function(){this.$el.trigger(UserEvents.LOGIN)},AnonAuthorView.prototype.getTemplateContext=function(){return{assetServer:this.opts.assetServer,strings:{signInToPost:textEnumeration.get(textEnumeration.KEYS.SIGN_IN_TO_POST)}}},module.exports=AnonAuthorView},{"../../../../templates/thread/thread/anonauthor.mustache":246,"../../../events/events":123,"../../../i18n/enumeration":124,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/view/src/view.js":83}],171:[function(_dereq_,module){var adaptAvatar=_dereq_("../../../adapters/adapters").adaptAvatar,auth=_dereq_("../../../util/auth"),authorViewTemplate=_dereq_("../../../../templates/thread/thread/author.mustache"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),ThreadEvents=_dereq_("../../../events/events").thread,View=_dereq_("./../../../../../lib/view/src/view.js"),AuthorView=function(e){View.call(this,e)};inherits(AuthorView,View),AuthorView.CLASSES={AUTHOR:"lf-author-view"},AuthorView.prototype.elClass=AuthorView.CLASSES.AUTHOR,AuthorView.prototype.events={click:"_handleClick"},AuthorView.prototype.template=authorViewTemplate.render.bind(authorViewTemplate),AuthorView.prototype._handleClick=function(e){e.stopPropagation(),this.$el.trigger(ThreadEvents.NAVIGATE,{value:"user"})},AuthorView.prototype.getTemplateContext=function(){var e=auth.get("livefyre");return{avatar:e?adaptAvatar(e.get("avatar")):"",defaultAvatar:this.opts.defaultAvatar}},module.exports=AuthorView},{"../../../../templates/thread/thread/author.mustache":247,"../../../adapters/adapters":101,"../../../events/events":123,"../../../util/auth":181,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/view/src/view.js":83}],172:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),abstractMethod=_dereq_("../../../util/internals").abstractMethod,auth=_dereq_("../../../util/auth"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),Observer=_dereq_("./../../../../../lib/observer/src/observer.js"),View=_dereq_("./../../../../../lib/view/src/view.js"),ThreadView=function(e){View.call(this,e),this._streamView=this.createStreamView(),Observer(this),this.listenTo(auth,"login.livefyre",$.proxy(this._handleUserLogin,this)),this.listenTo(auth,"logout",$.proxy(this._handleUserLogout,this))};inherits(ThreadView,View),ThreadView.CLASSES={LOADER:"lf-loader",THREAD:"lf-thread"},ThreadView.prototype.elClass=ThreadView.CLASSES.THREAD,ThreadView.prototype.elTag="section",ThreadView.prototype._handleUserLogin=abstractMethod,ThreadView.prototype._handleUserLogout=abstractMethod,ThreadView.prototype.destroy=function(){View.prototype.destroy.call(this),this.stopListening()},ThreadView.prototype.handleFetchThreadFailure=abstractMethod,ThreadView.prototype.handleFetchThreadSuccess=abstractMethod,ThreadView.prototype.getStreamView=function(){return this._streamView},ThreadView.prototype.createStreamView=abstractMethod,module.exports=ThreadView},{"../../../util/auth":181,"../../../util/internals":185,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/observer/src/observer.js":42,"./../../../../../lib/view/src/view.js":83,"./../../../../../node_modules/jquery/dist/jquery":97}],173:[function(_dereq_,module){function NotificationView(t){View.call(this,t),this._event=t.event}var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),notificationViewTemplate=_dereq_("../../../../templates/thread/notification.mustache"),textEnumeration=_dereq_("../../../i18n/enumeration"),View=_dereq_("./../../../../../lib/view/src/view.js"),WriteEvents=_dereq_("../../../events/events").write;inherits(NotificationView,View);var CLASSES={APPROVE:"fycon-check-funky",DELETE:"fycon-admin-delete",FLAG:"fycon-admin-flag",ICON:"lf-notification-icon",MAIN:"lf-thread-notification",POPOVER:"lf-thread-popover"},EVENT_TO_CLASS_MAP=function(){var t={};return t[WriteEvents.POST_APPROVE]=CLASSES.APPROVE,t[WriteEvents.POST_DELETE]=CLASSES.DELETE,t[WriteEvents.POST_FLAG]=CLASSES.FLAG,t[WriteEvents.POST_HIDE]=CLASSES.DELETE,t}(),EVENT_TO_ENUMERATION_MAP=function(){var t=textEnumeration.KEYS,e={};return e[WriteEvents.POST_APPROVE]=t.NOTIFICATION_APPROVED,e[WriteEvents.POST_DELETE]=t.NOTIFICATION_DELETED,e[WriteEvents.POST_FLAG]=t.NOTIFICATION_FLAGGED,e[WriteEvents.POST_HIDE]=t.NOTIFICATION_DELETED,e}(),TTL=1500;NotificationView.prototype.elClass=CLASSES.MAIN,NotificationView.prototype.template=notificationViewTemplate.render.bind(notificationViewTemplate),NotificationView.prototype.decorate=function(t){this.render(),t.append(this.$el),this.position()},NotificationView.prototype.getTemplateContext=function(){return{strings:{title:textEnumeration.get(EVENT_TO_ENUMERATION_MAP[this._event])}}},NotificationView.prototype.position=function(){var t=this.$el.closest("."+CLASSES.POPOVER),e=(t.width()-this.$el.outerWidth())/2,i=(t.height()-this.$el.outerHeight())/2;this.$el.css({left:e+"px",top:i+"px"})},NotificationView.prototype.render=function(){View.prototype.render.call(this),this.$("."+CLASSES.ICON).addClass(EVENT_TO_CLASS_MAP[this._event]),setTimeout($.proxy(this.destroy,this),TTL)},module.exports=NotificationView},{"../../../../templates/thread/notification.mustache":243,"../../../events/events":123,"../../../i18n/enumeration":124,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/view/src/view.js":83,"./../../../../../node_modules/jquery/dist/jquery":97}],174:[function(_dereq_,module){var $=_dereq_("./../../../../../node_modules/jquery/dist/jquery"),AnonAuthorView=_dereq_("./anonauthorview"),auth=_dereq_("../../../util/auth"),AuthorView=_dereq_("./authorview"),EditorView=_dereq_("../editorview"),gradientTemplate=_dereq_("../../../../templates/thread/thread/gradient.mustache"),inherits=_dereq_("./../../../../../lib/inherits/inherits.js"),loader=_dereq_("./../../../../../lib/livefyre-bootstrap/src/loader"),loaderTemplate=_dereq_("../../../../templates/thread/loader.mustache"),Observer=_dereq_("./../../../../../lib/observer/src/observer.js"),QueueDecorator=_dereq_("../queuedecorator"),textEnumeration=_dereq_("../../../i18n/enumeration"),ThreadContainer=_dereq_("../threadcontainer"),ThreadEvents=_dereq_("../../../events/events").thread,threadViewTemplate=_dereq_("../../../../templates/thread/thread/view.mustache"),View=_dereq_("./../../../../../lib/view/src/view.js"),viewEnum=_dereq_("../../../enums").navigableViews,WriteEvents=_dereq_("../../../events/events").write,ThreadView=function(e){View.call(this,e),this._authorView=null,this._editorView=null,this._loggedIn=!1,this._streamView=this.createStreamView({assetServer:e.assetServer,defaultAvatar:e.defaultAvatar}),QueueDecorator.decorate(this._streamView),Observer(this),this.listenTo(auth,"login.livefyre",$.proxy(this._handleUserLogin,this)),this.listenTo(auth,"logout",$.proxy(this._handleUserLogout,this))};inherits(ThreadView,View),ThreadView.CLASSES={LOADER:"lf-loader-container",POWERED_BY:"lf-powered-by",THREAD:"lf-thread"},ThreadView.prototype.elClass=ThreadView.CLASSES.THREAD,ThreadView.prototype.elTag="section",ThreadView.prototype.events=function(){var e={};return e["click ."+ThreadView.CLASSES.POWERED_BY]="_handlePoweredByClick",e}(),ThreadView.prototype.template=threadViewTemplate.render.bind(threadViewTemplate),ThreadView.prototype._handlePoweredByClick=function(e){this.opts.isCustomNetwork||(e.preventDefault(),this.$el.trigger(ThreadEvents.NAVIGATE,{value:viewEnum.INFO}))},ThreadView.prototype._handleUserLogin=function(){this._loggedIn||(this._loggedIn=!0,this._authorView&&this._authorView.destroy(),this._authorView=new AuthorView({defaultAvatar:this.opts.defaultAvatar}),this._authorView.render(),this._editorView=new EditorView({editorId:this.opts.blockId,postEvent:WriteEvents.POST_ANNOTATION}),this._editorView.render(),this.$el.prepend(this._authorView.$el,this._editorView.$el),this._editorView.initialize())},ThreadView.prototype._handleUserLogout=function(){this._loggedIn=!1,this._authorView&&this._authorView.destroy(),this._editorView&&this._editorView.destroy(),this._editorView=null,this._authorView=new AnonAuthorView({assetServer:this.opts.assetServer}),this._authorView.render(),this.$el.prepend(this._authorView.$el)},ThreadView.prototype._renderChildren=function(){return this.$el.prepend($(gradientTemplate.render())),this._streamView.render(),this.$("."+ThreadView.CLASSES.LOADER).remove(),this.$el.children().first().after(this._streamView.$el),auth.get("livefyre")?void this._handleUserLogin():void this._handleUserLogout()},ThreadView.prototype.createStreamView=function(e){return new ThreadContainer(e)},ThreadView.prototype.destroy=function(){View.prototype.destroy.call(this),this._authorView&&this._authorView.destroy(),this._authorView=null,this._editorView&&this._editorView.destroy(),this._editorView=null,this.stopListening()},ThreadView.prototype.getTemplateContext=function(){return{strings:{appName:textEnumeration.get(textEnumeration.KEYS.APP_NAME)}}},ThreadView.prototype.getThreadContainer=function(){return this._streamView},ThreadView.prototype.handleFetchThreadFailure=function(){this._renderChildren()},ThreadView.prototype.handleFetchThreadSuccess=function(e){this._renderChildren(),e&&e.length&&(e.sort(function(e){return e.parentId?1:-1}),this._streamView.initialize(e))},ThreadView.prototype.render=function(){this.$el.html(this.template(this.getTemplateContext(),{loader:loaderTemplate})),loader.decorate(this.$("."+ThreadView.CLASSES.LOADER),60)},module.exports=ThreadView},{"../../../../templates/thread/loader.mustache":233,"../../../../templates/thread/thread/gradient.mustache":248,"../../../../templates/thread/thread/view.mustache":249,"../../../enums":122,"../../../events/events":123,"../../../i18n/enumeration":124,"../../../util/auth":181,"../editorview":154,"../queuedecorator":169,"../threadcontainer":175,"./../../../../../lib/inherits/inherits.js":11,"./../../../../../lib/livefyre-bootstrap/src/loader":20,"./../../../../../lib/observer/src/observer.js":42,"./../../../../../lib/view/src/view.js":83,"./../../../../../node_modules/jquery/dist/jquery":97,"./anonauthorview":170,"./authorview":171}],175:[function(_dereq_,module){var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),BaseThreadContainer=_dereq_("./basethreadcontainer"),inherits=_dereq_("./../../../../lib/inherits/inherits.js"),SortingUtil=_dereq_("../../util/sorting"),threadContainerTemplate=_dereq_("../../../templates/thread/threadcontainer.mustache"),ThreadEvents=_dereq_("../../events/events").thread,TopCommentView=_dereq_("./comment/topview"),ThreadContainer=function(e){e=e||{},e.commentConstructor=TopCommentView,BaseThreadContainer.call(this,e)};inherits(ThreadContainer,BaseThreadContainer),ThreadContainer.CLASSES={BASE:"lf-thread-container",GRADIENT:"lf-thread-gradient"},ThreadContainer.prototype.elClass=ThreadContainer.CLASSES.BASE,ThreadContainer.prototype.elTag="section",ThreadContainer.prototype.events={mouseenter:"_handleMouseEnter",mouseleave:"_handleMouseLeave"},ThreadContainer.prototype._getParentThreadContainer=function(e){var t=this._comments[e];return t?t.getThreadContainer():null},ThreadContainer.prototype._handleMouseEnter=function(){this.$el.trigger(ThreadEvents.DEACTIVATE_HIGHLIGHTED_TEXT)},ThreadContainer.prototype._handleMouseLeave=function(){this.$el.trigger(ThreadEvents.ACTIVATE_HIGHLIGHTED_TEXT)},ThreadContainer.prototype.comparator=SortingUtil.helpfulnessComparator,ThreadContainer.prototype.initialize=function(e){var t,r,n=$(threadContainerTemplate.render()),a={};$.each(e,function(e,t){r=t.parentId||"root",a[r]||(a[r]=[]),a[r].push(t)}),BaseThreadContainer.prototype.initialize.call(this,a.root,n),delete a.root;for(r in a)a.hasOwnProperty(r)&&(t=this._getParentThreadContainer(r),t&&t.initialize(a[r]))},ThreadContainer.prototype.processComment=function(e,t,r,n){if(!n.parentId)return void BaseThreadContainer.prototype.processComment.call(this,e,t,r,n);var a=this._getParentThreadContainer(n.parentId);a&&a.addComment(n,!1)},module.exports=ThreadContainer},{"../../../templates/thread/threadcontainer.mustache":250,"../../events/events":123,"../../util/sorting":192,"./../../../../lib/inherits/inherits.js":11,"./../../../../node_modules/jquery/dist/jquery":97,"./basethreadcontainer":148,"./comment/topview":152}],176:[function(_dereq_,module){function ThreadPopover(e){Popover.call(this,$.extend({leftPadding:30,maxWidth:e.maxWidth||600,minPopoverInView:200,minWidth:320,scrollDuration:500,sidePadding:10,topSpacing:20},e)),this._position=this.opts.position||Popover.POSITIONS.SMART}var $=_dereq_("./../../../../node_modules/jquery/dist/jquery"),debounce=_dereq_("../../util/internals").debounce,inherits=_dereq_("./../../../../lib/inherits/inherits.js"),Popover=_dereq_("../../ui/popover");inherits(ThreadPopover,Popover),ThreadPopover.CLASSES={MAIN:"lf-thread-popover",MEDIA_WRAPPER:"lf-media-wrapper",POSITION_PREFIX:"lf-pos-"},$.extend(ThreadPopover.CLASSES,Popover.CLASSES),ThreadPopover.prototype.elClass=[Popover.prototype.elClass,ThreadPopover.CLASSES.MAIN].join(" ");var resizeTimeout,WINDOW_RESIZE_DELAY=500;ThreadPopover.prototype._handleResize=debounce(function(){clearTimeout(resizeTimeout),resizeTimeout=setTimeout($.proxy(function(){this.resizeAndReposition(this._blockEl)},this),WINDOW_RESIZE_DELAY)},200),ThreadPopover.prototype.hide=function(e){Popover.prototype.hide.call(this,e),$(window).off("resize",$.proxy(this._handleResize,this))},ThreadPopover.prototype.show=function(e,o){this._blockEl=e,Popover.prototype.show.call(this,e,o),$(window).on("resize",$.proxy(this._handleResize,this)),this.$el.focus()},module.exports=ThreadPopover},{"../../ui/popover":178,"../../util/internals":185,"./../../../../lib/inherits/inherits.js":11,"./../../../../node_modules/jquery/dist/jquery":97}],177:[function(_dereq_,module){function Container(e){View.call(this,e),this._activeVisState=VIS_STATE.HIDDEN,this._queuedEvents={},this._queuedEvents[VIS_EVENT.HIDE]=[],this._queuedEvents[VIS_EVENT.SHOW]=[],this._hideTimeMS=0,this._showTimeMS=0,this.render();var t=this.el.parentNode||this.el;(this.opts.parentEl||document.body).appendChild(t)}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),containerTemplate=_dereq_("../../templates/container.mustache"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),UserAgentUtil=(_dereq_("../util/internals").nullFunction,_dereq_("../util/useragent")),View=_dereq_("./../../../lib/view/src/view.js"),lfWrapperTemplate=_dereq_("../../templates/thread/lfwrapper.mustache"),VIS_EVENT={HIDE:"hide",SHOW:"show"},VIS_STATE={HIDDEN:"hidden",HIDING:"hiding",SHOWING:"showing",VISIBLE:"visible"};inherits(Container,View),Container.CLASSES={ACTIVE:"lf-active",BASE:"lf-thread",CONTENT:"lf-thread-content",INLINE_CONTAINER:"lf-inline-thread",REMOVE:"lf-remove"},Container.prototype.elClass=Container.CLASSES.BASE,Container.prototype.events=function(){var e={};return UserAgentUtil.isMobile()||(e.mousedown="_handlePress",e.keyup="_handlePress"),e}(),Container.prototype.render=function(){View.prototype.render.call(this),this.$el.wrap(lfWrapperTemplate.render())},Container.prototype.template=containerTemplate.render.bind(containerTemplate),Container.prototype._handlePress=function(e){e.stopPropagation()},Container.prototype._processQueuedCallbacks=function(e){for(var t;this._queuedEvents[e].length;)(t=this._queuedEvents[e].pop())()},Container.prototype.hide=function(e){return this._activeVisState===VIS_STATE.HIDING?void(e&&this.onHide(e)):(this.$el.addClass(Container.CLASSES.REMOVE),void setTimeout($.proxy(this.hideInternal,this,e),this._hideTimeMS))},Container.prototype.hideInternal=function(e){this.$el.hide().attr("class",this.elClass),this._activeVisState=VIS_STATE.HIDDEN,"function"==typeof e&&e(),this._processQueuedCallbacks(VIS_EVENT.HIDE)},Container.prototype.isShowing=function(){return this._activeVisState===VIS_STATE.SHOWING},Container.prototype.isVisible=function(){return this._activeVisState===VIS_STATE.VISIBLE},Container.prototype.onHide=function(e){return this._activeVisState===VIS_STATE.HIDDEN?e():void this._queuedEvents[VIS_EVENT.HIDE].push(e)},Container.prototype.onShow=function(e){return this._activeVisState===VIS_STATE.VISIBLE?e():void this._queuedEvents[VIS_EVENT.SHOW].push(e)},Container.prototype.resizeAndReposition=function(e){this.opts.inlineThreads&&this.$el.closest(".lf").addClass(Container.CLASSES.INLINE_CONTAINER).insertAfter(e)},Container.prototype.setContentNode=function(e){var t=this.$("."+Container.CLASSES.CONTENT);t.empty(),t.append(e)},Container.prototype.show=function(e,t){this._activeVisState!==VIS_STATE.SHOWING&&(this._activeVisState=VIS_STATE.SHOWING,this.resizeAndReposition(e),this.$el.show(),this.$el.addClass(Container.CLASSES.ACTIVE),setTimeout($.proxy(function(){this._activeVisState=VIS_STATE.VISIBLE,t&&t(),this._processQueuedCallbacks(VIS_EVENT.SHOW)},this),this._showTimeMS))},module.exports=Container},{"../../templates/container.mustache":204,"../../templates/thread/lfwrapper.mustache":232,"../util/internals":185,"../util/useragent":195,"./../../../lib/inherits/inherits.js":11,"./../../../lib/view/src/view.js":83,"./../../../node_modules/jquery/dist/jquery":97}],178:[function(_dereq_,module){function Popover(t){Container.call(this,t),this._activePosition=null,this._hideTimeMS=300,this._showTimeMS=300}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),Container=_dereq_("./container"),domUtil=_dereq_("../util/dom"),inherits=_dereq_("./../../../lib/inherits/inherits.js"),popoverTemplate=_dereq_("../../templates/popover.mustache");inherits(Popover,Container),Popover.CLASSES={BASE:"lf-popover",CONTENT:"lf-popover-content",POSITION_PREFIX:"lf-pos-",LF:"lf"},Popover.POSITIONS={SMART:"smart",BOTTOM:"bottom",LEFT:"left",RIGHT:"right"},Popover.POSITION_FN_MAP={bottom:"_getBottomPosition",left:"_getLeftPosition",right:"_getRightPosition",smart:"_getSmartPosition"},Popover.prototype.elClass=Popover.CLASSES.BASE,Popover.prototype.template=popoverTemplate.render.bind(popoverTemplate),Popover.prototype._getBottomPosition=function(t){this._activePosition=Popover.POSITIONS.BOTTOM;var o=domUtil.getBoundingClientRect(t),i=o.bottom+domUtil.getScrollY()+10,e=o.right-o.left,r=ethis.opts.maxWidth?this.opts.maxWidth:t-=this.opts.sidePadding*(this._activePosition===Popover.POSITIONS.BOTTOM?2:1)},Popover.prototype._getRightPosition=function(t){this._activePosition=Popover.POSITIONS.RIGHT;var o=domUtil.getBoundingClientRect(t),i=o.top+domUtil.getScrollY(),e=o.right+domUtil.getScrollX()+10,r=document.body.clientWidth-e;return{top:i,left:e,width:r}},Popover.prototype._getSmartPosition=function(t){var o=this._getRightPosition(t);return o.widthi+this.opts.topSpacing;if(!r||!n){var p;r?n||(p=t-this.opts.topSpacing):p=i+(this.opts.minPopoverInView+t-e),o.animate({scrollTop:p},this.opts.scrollDuration)}}},Popover.prototype.render=function(){Container.prototype.render.call(this),this.$_contentNode=this.$("."+Popover.CLASSES.CONTENT)},Popover.prototype.resizeAndReposition=function(t){var o=this[Popover.POSITION_FN_MAP[this._position]].call(this,t),i=Popover.CLASSES.POSITION_PREFIX;o.width=this._getPopoverWidth(o.width),this.$el.css(o).removeClass(function(){var t=[];for(var o in Popover.POSITIONS)Popover.POSITIONS.hasOwnProperty(o)&&t.push(i+Popover.POSITIONS[o]);return t.join(" ")}).addClass(i+this._activePosition),this._scrollIntoPosition(o.top)},Popover.prototype.setContentNode=function(t){this.$_contentNode.empty(),this.$_contentNode.append(t)},module.exports=Popover},{"../../templates/popover.mustache":220,"../util/dom":183,"./../../../lib/inherits/inherits.js":11,"./../../../node_modules/jquery/dist/jquery":97,"./container":177}],179:[function(_dereq_,module){function UserController(e){BaseController.call(this,e)}var auth=(_dereq_("./../../../node_modules/jquery/dist/jquery"),_dereq_("../util/auth")),BaseController=(_dereq_("./../../../lib/base64/base64"),_dereq_("../controller/base")),inherits=_dereq_("./../../../lib/inherits/inherits.js"),UserEvents=_dereq_("../events/events").user;inherits(UserController,BaseController),UserController.prototype.events=function(){var e={};return e[UserEvents.ADMIN]="_handleAdmin",e[UserEvents.EDIT_PROFILE]="_handleEditProfile",e[UserEvents.LOGIN]="_handleLogin",e[UserEvents.LOGOUT]="_handleLogout",e[UserEvents.VIEW_PROFILE]="_handleViewProfile",e}(),UserController.prototype._handleAdmin=function(){window.open(this._collection.generateAdminUrl())},UserController.prototype._handleEditProfile=function(){auth.editProfile()},UserController.prototype._handleLogin=function(){auth.login()},UserController.prototype._handleLogout=function(){auth.logout()},UserController.prototype._handleViewProfile=function(e,r){auth.viewProfile(r.author)},UserController.prototype.destroy=function(){BaseController.prototype.destroy.call(this)},module.exports=UserController},{"../controller/base":116,"../events/events":123,"../util/auth":181,"./../../../lib/base64/base64":5,"./../../../lib/inherits/inherits.js":11,"./../../../node_modules/jquery/dist/jquery":97}],180:[function(_dereq_,module){var array={};array.defaultComparator=function(r,a){return a>r?-1:r>a?1:0},array.findIndex=function(r,a,t){for(var n=t||array.defaultComparator,e=0,o=r.length;o>e;e++)if(n(a,r[e])<=0)return e;return r.length},module.exports=array},{}],181:[function(_dereq_,module){var ThreadEvents=_dereq_("../events/events").thread,viewEnum=_dereq_("../enums").navigableViews,auth=function(){return"object"==typeof Livefyre&&Livefyre.auth?Livefyre.auth:_dereq_("./../../../lib/auth/src/main")}();auth.requireAuth=function(e,t){return function(r){var i=t||[r.type,r.namespace].join(".");if(!auth.get("livefyre")){var n=this.$antenna||this.$el;return void n.trigger(ThreadEvents.NAVIGATE,{event:i,value:viewEnum.AUTH})}e.apply(this,arguments)}},module.exports=auth},{"../enums":122,"../events/events":123,"./../../../lib/auth/src/main":3}],182:[function(_dereq_,module){var textEnumeration=_dereq_("../i18n/enumeration"),util={};util.getPrettyDate=function(t){var e=textEnumeration.get(textEnumeration.KEYS.DATETIME_MONTHS);return"string"==typeof e&&(e=e.indexOf(", ")>-1?e.split(", "):e.indexOf(",")>-1?e.split(","):e),[e[t.getMonth()]," ",t.getDate(),", ",t.getFullYear()].join("")},module.exports=util},{"../i18n/enumeration":124}],183:[function(_dereq_,module){var UserAgentUtil=_dereq_("./useragent"),dom={};dom.getBoundingClientRect=function(t){var e=t.getBoundingClientRect(); return e.height||e.top||(e=t.getBoundingClientRect()),UserAgentUtil.isIE()&&UserAgentUtil.getIEVersion()<9&&(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left},e.height=e.bottom-e.top,e.width=e.right-e.left),e},dom.getScrollX=function(){return void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft},dom.getScrollY=function(){return void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop},dom.raf=function(){return"requestAnimationFrame"in window?window.requestAnimationFrame.bind(window):function(t){window.setTimeout(t,1e3/60)}}(),module.exports=dom},{"./useragent":195}],184:[function(_dereq_,module){module.exports={normalizeNewlines:function(e,n){return n&&(e=e.replace(/^(\s*)/,"").replace(/(\s*)$/,"")),e="

"+e.split("\n").join("

")+"

"},normalizeParagraphTags:function(e){e=e.replace(/

/g,""),e=e.replace(/<\/p>/g,"\n");var n="\n";return-1!==e.indexOf(n,e.length=n.length)&&(e=e.slice(0,-1*n.length)),e},focusAndPlaceCursorAtEnd:function(e){var n=e[0];if(e.focus(),n.setSelectionRange){var l=2*e.val().length;n.setSelectionRange(l,l)}else e.val(e.val())},escapeHTML:function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}}},{}],185:[function(_dereq_,module){var util={};util.abstractMethod=function(){throw"This function must be overridden"},util.debounce=function(t,n,u){var i=!1;return function(){i||(i=!0,setTimeout(function(){i=!1,u&&t.call(this)},n),!u&&t.call(this))}},util.memoize=function(t){return function(){var n=t.call(this);return t=function(){return n},n}},util.nullFunction=function(){},module.exports=util},{}],186:[function(_dereq_,module){module.exports={getOrigin:function(){return window.location.origin||location.getOriginIE()},getOriginIE:function(){var o="";return window.location.port&&(o=":"+window.location.port),("http:"===window.location.protocol?"http://":"https://")+window.location.hostname+o}}},{}],187:[function(_dereq_,module){module.exports={getKeys:function(r){var e=[];for(var n in r)r.hasOwnProperty(n)&&e.push(n);return e},getValues:function(r){var e=[];for(var n in r)r.hasOwnProperty(n)&&e.push(r[n]);return e}}},{}],188:[function(_dereq_,module){var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),domUtil=_dereq_("./dom"),util={};util.scrollToPermalink=function(o,e){var l=o.offsetTop-20,r=Math.min(2*Math.abs(domUtil.getScrollY()-l),1e3);$("body").animate({scrollTop:l},r,e)},module.exports=util},{"./../../../node_modules/jquery/dist/jquery":97,"./dom":183}],189:[function(_dereq_,module){function process(e,r){for(var t,n=0,u=r.length;u>n;n++)if(t=PROCESSOR_MAP[r[n]](e))return t;return null}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),wrap=_dereq_("../../templates/blocks/elementwrap.mustache"),util={},TYPES={ARRAY:"Array",ELEMENT:"Element",JQUERY:"Jquery",OBJECT:"Object",STRING:"String"},ALL=[TYPES.JQUERY,TYPES.STRING,TYPES.ARRAY,TYPES.ELEMENT,TYPES.OBJECT],ARRAY_SUPPORTS=[TYPES.JQUERY,TYPES.STRING,TYPES.ELEMENT],OBJECT_INCLUDE_SUPPORTS=[TYPES.JQUERY,TYPES.STRING,TYPES.ARRAY],OBJECT_EXCLUDE_SUPPORTS=[TYPES.JQUERY,TYPES.STRING];util.processArray=function(e){if(!(e instanceof HTMLCollection||e instanceof NodeList||$.isArray(e)))return null;var r,t=[];if($.each(e,function(e,n){r=process(n,ARRAY_SUPPORTS),r&&t.push(r)}),!t.length)return null;var n=[];return $.each(t,function(e,r){n=n.concat(r)}),n},util.processElement=function(e){if(!(e instanceof Node))return null;if("#text"===e.nodeName){var r=$(wrap.render({content:e.nodeValue}))[0];return e.parentNode.replaceChild(r,e),r}return e},util.processJquery=function(e){return e instanceof $?e.toArray():null},util.processObject=function(e){if("object"!=typeof e)return null;if(!e.include)return null;var r=process(e.include,OBJECT_INCLUDE_SUPPORTS);if(!r)return null;var t="";return e.exclude&&(t=process(e.exclude,OBJECT_EXCLUDE_SUPPORTS)),$(r).not(t).toArray()},util.processString=function(e){return"string"==typeof e?$(e).toArray():null};var PROCESSOR_MAP=function(){var e={};return e[TYPES.ARRAY]=util.processArray,e[TYPES.ELEMENT]=util.processElement,e[TYPES.JQUERY]=util.processJquery,e[TYPES.OBJECT]=util.processObject,e[TYPES.STRING]=util.processString,e}();util.parseSelectors=function(e){var r=process(e,ALL);if(!r)throw new TypeError('Provided selector: "'+e+'" is not supported.');return $(r)},util.matchElement=function(e){return util.parseSelectors(e)[0]},module.exports=util},{"../../templates/blocks/elementwrap.mustache":196,"./../../../node_modules/jquery/dist/jquery":97}],190:[function(_dereq_,module){function createSimhashToBlockIdLookup(o){var e,r,t,s={};for(var i in o)o.hasOwnProperty(i)&&(e=o[i][KEYS.HINTS],r=e[KEYS.SIMHASH],t=e[KEYS.INDEX],s[r]=s[r]||[],s[r][t]=i);return s}function SimhashLookup(o){var e,r=window.location.protocol+"//cdn.livefyre.com/libs/sidenotes/v1.6.0",t="simhash-worker.min.js",s=r+"/"+t;"function"==typeof Blob&&(e=new Blob(['importScripts("'+r+"/"+t+'");'],{type:"text/javascript"}),s=URL.createObjectURL(e));var i=r+"/ie-worker.html",h=getKeys(o).length>100?2:1;this.workerPool=new WorkerPool({workerCount:h,workerPath:s,iframePath:i}),this.simhashToBlockIdLookup=createSimhashToBlockIdLookup(o)}var KEYS=_dereq_("../adapters/adapters").BootstrapKeys,getKeys=_dereq_("./object").getKeys,Promise=_dereq_("es6-promise").Promise,WorkerPool=_dereq_("worker-pool");SimhashLookup.prototype.getBlockId=function(o,e){if(this.simhashToBlockIdLookup.hasOwnProperty(o)){var r=this.simhashToBlockIdLookup[o];return r[e]||null}return null},SimhashLookup.prototype.getBlockIdWithThreshold=function(o,e,r){var t=getKeys(this.simhashToBlockIdLookup),s=this;return 0===t.length?Promise.resolve(this.getBlockId(void 0,e)):new Promise(function(i){s.workerPool.queueJob({type:"similarity",simhash:o,simhashes:t,threshold:r},function(o){var r=o.data.value;i(s.getBlockId(r,e))})})},SimhashLookup.prototype.getSimhash=function(o){var e=this;return new Promise(function(r){e.workerPool.queueJob({type:"simhash",value:o},function(o){r(o.data.value)})})},SimhashLookup.prototype.destroy=function(){this.workerPool.destroy(),this.simhashToBlockIdLookup=null},module.exports=SimhashLookup},{"../adapters/adapters":101,"./object":187,"es6-promise":92,"worker-pool":100}],191:[function(_dereq_,module){function cleanHtml(e){return e=e.replace(/\n/g," ").replace(//g," ").replace(/\s+/g," "),$("

").html(e).text()}function generateFacebookParams(e){var t=textEnumeration.get(textEnumeration.KEYS.FACEBOOK_SHARE_CAPTION),o=["http:"===window.location.protocol?"http:":"https:",e.assetServer,"/libs/share/facebook-uri.html"].join("");return t=encodeURIComponent(t.replace("{title}",document.title)),["?app_id=",FACEBOOK_APP_ID,"&caption=",t,"&description=",encodeURIComponent(e.body),"&display=popup","&link=",encodeURIComponent(e.url),"&redirect_uri=",encodeURIComponent(o)].join("")}function generateTwitterParams(e){return["?text=",encodeURIComponent(e.body),"&url=",encodeURIComponent(e.url)].join("")}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),textEnumeration=_dereq_("../i18n/enumeration"),FACEBOOK_APP_ID="595267417193679",Social={};Social.contentToShare=function(e,t){var o=Social.contentToTweet;return"facebook"===t&&(o=Social.contentToFacebookMessage),o(e)},Social.contentToFacebookMessage=function(e){var t=textEnumeration.KEYS,o=textEnumeration.get(t.FACEBOOK_SHARE_DESCRIPTION),n=textEnumeration.get(t.FACEBOOK_SHARE_DESCRIPTION_SOURCE);return{body:(e.isSource?n:o).replace("{body}",cleanHtml(e.body)),url:e.permalink}},Social.contentToTweet=function(e){var t=cleanHtml(e.body),o=e.author.displayName;o=o?"- "+o:"";var n=e.permalink,r=23;0===n.indexOf("https")&&r++;var a=140-r-o.length;return ao?-1:o>s?1:0},helpfulnessComparator:function(e,t){var o=this._comments[e].getModel(),s=this._comments[t].getModel(),r=o.votes.helpfulness,n=s.votes.helpfulness,d=n>r?1:r>n?-1:0;return 0!==d?d:(r=o.votes.downvotes,n=s.votes.downvotes,d=n>r?-1:r>n?1:0,0!==d?d:(r=o.createdAt,n=s.createdAt,n>r?1:r>n?-1:0))}}},{}],193:[function(_dereq_,module){function addCommentToMap(e,r,o){o[e]||(o[e]=[]),$.inArray(r,o[e])>-1||o[e].push(r)}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),Comment=_dereq_("../models/comment"),Storage=_dereq_("./../../../lib/streamhub-sdk/src/storage"),StorageWrapper={};StorageWrapper.blockToCommentMap={},StorageWrapper.get=function(e,r){return Storage.get(e,r)},StorageWrapper.getCommentsForBlock=function(e){return $.map(StorageWrapper.blockToCommentMap[e]||[],function(e){return Storage.get(e)})},StorageWrapper.getNumCommentsForBlock=function(e){var r,o=[];return $.each(StorageWrapper.blockToCommentMap[e]||[],function(e,t){r=Storage.get(t),r&&r.isVisible()&&o.push(t)}),o.length},StorageWrapper.set=function(e,r,o){return Storage.set(e,r,o),r instanceof Comment&&addCommentToMap(r.blockId,r.id,StorageWrapper.blockToCommentMap),r},StorageWrapper.reset=function(){Storage.cache={},StorageWrapper.blockToCommentMap={}},module.exports=StorageWrapper},{"../models/comment":145,"./../../../lib/streamhub-sdk/src/storage":79,"./../../../node_modules/jquery/dist/jquery":97}],194:[function(_dereq_,module){function borderRadius(E){var t=[];return t.push("-webkit-border-radius:"+E+" !important;"),t.push("-moz-border-radius:"+E+" !important;"),t.push("border-radius:"+E+" !important;"),t.join("")}function convertPixel(E){return"number"==typeof E?E+"px":E}function isSupportedElement(E){return E in ELEMENT_TO_PROPERTIES}function isSupportedProperty(E,t){return ELEMENT_TO_PROPERTIES[E].indexOf(t)>-1}var $=_dereq_("./../../../node_modules/jquery/dist/jquery"),util={},PROPERTY_MAP={backgroundColor:["background-color"],border:["border"],borderRadius:[null,borderRadius],fontColor:["color"],fontFamily:["font-family"],fontSize:["font-size",convertPixel],fontWeight:["font-weight"],height:["height"],left:["left"],lineHeight:["line-height"],padding:["padding"],position:["position"],right:["right"],top:["top"],width:["width"]},ELEMENT={BLOCK_BTN:"blockBtn",BLOCK_BTN_ACTIVE:"blockBtnActive",MEDIA_BLOCK_BTN:"mediaBlockBtn",MEDIA_BLOCK_BTN_ACTIVE:"mediaBlockBtnActive",ANONYMOUS_AVATAR:"anonymousAvatar",USER_AVATAR:"userAvatar",POPOVER:"popover",POPOVER_ARROW_LEFT:"popoverArrowLeft",POPOVER_ARROW_RIGHT:"popoverArrowRight",POPOVER_ARROW_TOP:"popoverArrowTop",EDITOR:"editorTextarea",STREAM_QUEUE_BTN:"streamQueueButton",POWERED_BY:"streamPoweredBy",COMMENT_AVATAR:"commentAvatar",COMMENT_BODY:"commentBody",COMMENT_DISPLAY_NAME:"commentDisplayName",COMMENT_TAGS:"commentTags",COMMENT_UPVOTE:"commentUpvote",COMMENT_DOWNVOTE:"commentDownvote",COMMENT_REPLIES_EXPAND:"commentReplyExpand",COMMENT_REPLY_AVATAR:"replyAvatar",NUM_SIDENOTES:"numSidenotes",NUM_SIDENOTES_POPOVER:"numSidenotesPopover"},ELEMENT_TO_SELECTOR=function(){var E={};return E[ELEMENT.BLOCK_BTN]=".lf-thread-btn",E[ELEMENT.BLOCK_BTN_ACTIVE]=".lf-thread-btn:hover, .lf-thread-btn.lf-active",E[ELEMENT.MEDIA_BLOCK_BTN]=".lf-media-wrapper .lf-thread-btn",E[ELEMENT.MEDIA_BLOCK_BTN_ACTIVE]=[".lf-media-wrapper .lf-thread-btn:hover",".lf-media-wrapper .lf-thread-btn.lf-active"].join(","),E[ELEMENT.ANONYMOUS_AVATAR]=".lf img.lf-anon-avatar",E[ELEMENT.USER_AVATAR]=".lf .lf-thread > img.lf-author-avatar",E[ELEMENT.POPOVER]=".lf-thread-popover",E[ELEMENT.POPOVER_ARROW_LEFT]=".lf-pos-right > .lf-popover-arrow",E[ELEMENT.POPOVER_ARROW_RIGHT]=".lf-pos-left > .lf-popover-arrow",E[ELEMENT.POPOVER_ARROW_TOP]=".lf-pos-bottom > .lf-popover-arrow",E[ELEMENT.EDITOR]=".lf textarea.lf-editor-field",E[ELEMENT.STREAM_QUEUE_BTN]=".lf .lf-thread > .lf-queue-btn",E[ELEMENT.POWERED_BY]=".lf .lf-thread .lf-powered-by",E[ELEMENT.COMMENT_AVATAR]=".lf article.lf-comment .lf-comment-author-avatar",E[ELEMENT.COMMENT_BODY]=".lf article.lf-comment .lf-comment-body p",E[ELEMENT.COMMENT_DISPLAY_NAME]=".lf article.lf-comment .lf-comment-author-name",E[ELEMENT.COMMENT_TAGS]=".lf article.lf-comment .lf-tag",E[ELEMENT.COMMENT_UPVOTE]=[".lf article.lf-comment .lf-comment-footer .lf-votes.lf-upvote .lf-count",".lf article.lf-comment .lf-comment-footer .lf-votes.lf-upvote .lf-upvote"].join(","),E[ELEMENT.COMMENT_DOWNVOTE]=[".lf article.lf-comment .lf-comment-footer .lf-votes.lf-downvote .lf-count",".lf article.lf-comment .lf-comment-footer .lf-votes.lf-downvote .lf-downvote"].join(","),E[ELEMENT.COMMENT_REPLIES_EXPAND]=".lf article.lf-comment .lf-reply-container .lf-queue-btn",E[ELEMENT.COMMENT_REPLY_AVATAR]=".lf article.lf-comment.lf-reply .lf-comment-author-avatar",E[ELEMENT.NUM_SIDENOTES]=".lf-num-sidenotes",E[ELEMENT.NUM_SIDENOTES_POPOVER]=".lf-question-popover",E}(),BLOCK_BTN_PROPERTIES=["border","borderRadius","fontColor","fontSize","height","left","lineHeight","padding","position","right","top","width"],FONT_PROPERTIES=["fontColor","fontFamily","fontSize","fontWeight","lineHeight"],POPOVER_ARROW_PROPERTIES=["backgroundImage","height","left","right","top","width"],QUEUE_BUTTON_PROPERTIES=$.merge(["backgroundColor","borderColor","borderWidth"],FONT_PROPERTIES),NUM_SIDENOTES_PROPERTIES=$.merge(["backgroundColor","borderColor","borderWidth","height","width"],FONT_PROPERTIES),ELEMENT_TO_PROPERTIES=function(){var E={};return E[ELEMENT.BLOCK_BTN]=BLOCK_BTN_PROPERTIES,E[ELEMENT.BLOCK_BTN_ACTIVE]=BLOCK_BTN_PROPERTIES,E[ELEMENT.MEDIA_BLOCK_BTN]=BLOCK_BTN_PROPERTIES,E[ELEMENT.MEDIA_BLOCK_BTN_ACTIVE]=BLOCK_BTN_PROPERTIES,E[ELEMENT.ANONYMOUS_AVATAR]=["height","width"],E[ELEMENT.USER_AVATAR]=["height","width"],E[ELEMENT.POPOVER]=["backgroundColor"],E[ELEMENT.POPOVER_ARROW_LEFT]=POPOVER_ARROW_PROPERTIES,E[ELEMENT.POPOVER_ARROW_RIGHT]=POPOVER_ARROW_PROPERTIES,E[ELEMENT.POPOVER_ARROW_TOP]=POPOVER_ARROW_PROPERTIES,E[ELEMENT.EDITOR]=$.extend(["height","width"],FONT_PROPERTIES),E[ELEMENT.STREAM_QUEUE_BTN]=QUEUE_BUTTON_PROPERTIES,E[ELEMENT.POWERED_BY]=["backgroundColor","borderColor","lineHeight"],E[ELEMENT.COMMENT_AVATAR]=["height","width"],E[ELEMENT.COMMENT_BODY]=FONT_PROPERTIES,E[ELEMENT.COMMENT_DISPLAY_NAME]=FONT_PROPERTIES,E[ELEMENT.COMMENT_TAGS]=FONT_PROPERTIES,E[ELEMENT.COMMENT_UPVOTE]=["fontColor","fontSize"],E[ELEMENT.COMMENT_DOWNVOTE]=["fontColor","fontSize"],E[ELEMENT.COMMENT_REPLIES_EXPAND]=QUEUE_BUTTON_PROPERTIES,E[ELEMENT.COMMENT_REPLY_AVATAR]=["height","width"],E[ELEMENT.NUM_SIDENOTES]=NUM_SIDENOTES_PROPERTIES,E[ELEMENT.NUM_SIDENOTES_POPOVER]=NUM_SIDENOTES_PROPERTIES,E}();util.applyStyles=function(E){$("head").append($('"))},util.parseStyles=function(E){var t,e,o="";$.each(E,function(E,T){isSupportedElement(E)&&(e=[],$.each(T,function(o,T){if(isSupportedProperty(E,o)){if(t=PROPERTY_MAP[o],!t[0])return void e.splice(e.length,0,t[1](T));e.splice(e.length,0,t[0],":"),T=t[1]?t[1](T):T,e.splice(e.length,0,T," !important;")}}),0!==e.length&&(e.splice(0,0,ELEMENT_TO_SELECTOR[E],"{"),e.push("}"),o+=e.join("")))}),o&&util.applyStyles(o)},module.exports=util},{"./../../../node_modules/jquery/dist/jquery":97}],195:[function(_dereq_,module){var internals=_dereq_("./internals"),userAgent={};userAgent.getIEVersion=internals.memoize(function(){return navigator.userAgent.match(/MSIE ([0-9]+)\./)?parseInt(RegExp.$1,10):null}),userAgent.isIE=internals.memoize(function(){return/MSIE ([0-9]+)\./.test(navigator.userAgent)}),userAgent.isMobile=internals.memoize(function(){var e=-1!==navigator.appVersion.indexOf("Mobile"),n=-1!==navigator.appVersion.indexOf("Android");return e||n}),module.exports=userAgent},{"./internals":185}],196:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,s){var t=this;return t.b(s=s||""),t.b(''),t.b(t.v(t.f("content",n,a,0))),t.b(""),t.b("\n"),t.fl()},partials:{},subs:{}},'{{ content }}\n',Hogan)},{"hogan.js":94}],197:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,s){var t=this;return t.b(s=s||""),t.b(''),t.b(t.v(t.f("originalText",a,n,0))),t.b(""),t.b("\n"),t.fl()},partials:{},subs:{}},'{{ originalText }}\n',Hogan)},{"hogan.js":94}],198:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b("\n"),i.fl()},partials:{},subs:{}},'
\n',Hogan)},{"hogan.js":94}],199:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,s,a){var p=this;return p.b(a=a||""),p.b(''),p.b("\n"+a),p.b(' '),p.b("\n"+a),p.b(""),p.b("\n"+a),p.b(''),p.b(p.v(p.f("commentCount",n,s,0))),p.b(" "),p.b(p.v(p.d("strings.appName",n,s,0))),p.b(""),p.b("\n"+a),p.b(''),p.b("\n"+a),p.b(' '),p.b("\n"+a),p.b(""),p.b("\n"),p.fl()},partials:{},subs:{}},'\n \n\n{{ commentCount }} {{ strings.appName }}\n\n \n\n',Hogan)},{"hogan.js":94}],200:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,s){var t=this;return t.b(s=s||""),t.b('
'),t.b(t.v(t.d("strings.title",n,a,0))),t.b("
"),t.b("\n"+s),t.b("
"),t.b("\n"+s),t.b('
'),t.b("\n"+s),t.b(' '),t.b("\n"+s),t.b(" "),t.b(t.v(t.d("strings.mockText",n,a,0))),t.b("\n"+s),t.b(" "),t.b("\n"+s),t.b(' 5'),t.b("\n"+s),t.b(" "),t.b("\n"+s),t.b(' '),t.b("\n"+s),t.b("
"),t.b("\n"+s),t.b("
"),t.b("\n"+s),t.b('
'),t.b(t.t(t.d("strings.explanation",n,a,0))),t.b("
"),t.b("\n"),t.fl()},partials:{},subs:{}},'
{{ strings.title }}
\n
\n
\n \n {{ strings.mockText }}\n \n 5\n \n \n
\n
\n
{{{ strings.explanation }}}
\n',Hogan)},{"hogan.js":94}],201:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,t,e){var o=this;return o.b(e=e||""),o.b(''),o.b("\n"+e),o.b(''),o.b("\n"+e),o.b(''),o.b("\n"),o.fl()},partials:{},subs:{}},'\n\n\n',Hogan)},{"hogan.js":94}],202:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(t,n,o){var i=this;return i.b(o=o||""),i.b('"),i.b("\n"),i.fl()},partials:{},subs:{}},'\n',Hogan)},{"hogan.js":94}],203:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,e){var i=this;return i.b(e=e||""),i.s(i.f("count",a,n,1),a,n,0,10,99,"{{ }}")&&(i.rs(a,n,function(a,n,i){i.b(''),i.b(i.v(i.f("count",a,n,0))),i.b(""),i.b("\n"+e)}),a.pop()),i.s(i.f("count",a,n,1),a,n,1,0,0,"")||(i.b(''),i.s(i.f("isMedia",a,n,1),a,n,0,205,237,"{{ }}")&&(i.rs(a,n,function(a,n,e){e.b(e.v(e.d("strings.emptyImageBlockTxt",a,n,0)))}),a.pop()),i.s(i.f("isMedia",a,n,1),a,n,1,0,0,"")||i.b(i.v(i.d("strings.emptyTextBlockTxt",a,n,0))),i.b("\n"+e),i.b(""),i.b("\n"+e)),i.fl()},partials:{},subs:{}},'{{#count}}\n{{ count }}\n{{/count}}\n{{^count}}\n{{#isMedia}}{{ strings.emptyImageBlockTxt }}{{/isMedia}}{{^isMedia}}{{ strings.emptyTextBlockTxt }}{{/isMedia}}\n\n{{/count}}\n',Hogan)},{"hogan.js":94}],204:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,e){var t=this;return t.b(e=e||""),t.b('
'),t.b("\n"),t.fl()},partials:{},subs:{}},'
\n',Hogan)},{"hogan.js":94}],205:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,l){var s=this;return s.b(l=l||""),s.b('
'),s.b("\n"+l),s.b(''),s.b("\n"),s.fl()},partials:{},subs:{}},'\n{{#hasReplies}}\n
\n {{ strings.replyLink }}\n
\n{{/hasReplies}}\n
\n',Hogan)},{"hogan.js":94}],207:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(e,a,r){var t=this;return t.b(r=r||""),t.b('
'),t.b("\n"+r),t.b(""),t.b("\n"),t.fl()},partials:{},subs:{}},"
\n\n",Hogan)},{"hogan.js":94}],208:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,s){var e=this;return e.b(s=s||""),e.b(''),e.b(e.t(e.d("strings.postedAt",a,n,0))),e.b(""),e.b("\n"+s),e.b('
'),e.b("\n"+s),e.b(" "),e.b(e.v(e.d("strings.appName",a,n,0))),e.b(" powered by"),e.b("\n"+s),e.b(""),e.b("\n"),e.fl()},partials:{},subs:{}},'{{{ strings.postedAt }}}\n\n {{ strings.appName }} powered by\n\n',Hogan)},{"hogan.js":94}],209:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,e){var o=this;return o.b(e=e||""),o.b('
'),o.b("\n"+e),o.b('
'),o.b("\n"),o.fl()},partials:{},subs:{}},'
\n
\n',Hogan)},{"hogan.js":94}],210:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(t,n,b){var o=this;return o.b(b=b||""),o.b('"),o.b("\n"+b),o.b("

"),o.b(o.t(o.d("strings.title",t,n,0))),o.b("

"),o.b("\n"+b),o.s(o.f("actionButton",t,n,1),t,n,0,173,290,"{{ }}")&&(o.rs(t,n,function(t,n,o){o.b(' "),o.b("\n"+b)}),t.pop()),o.fl()},partials:{},subs:{}},'\n

{{{ strings.title }}}

\n{{#actionButton}}\n \n{{/actionButton}}\n',Hogan)},{"hogan.js":94}],211:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,s,n){var e=this;return e.b(n=n||""),e.b(''),e.b("\n"+n),e.b(' '),e.b("\n"+n),e.b(' '),e.b(e.v(e.d("strings.readMore",a,s,0))),e.b(""),e.b("\n"+n),e.b(""),e.b("\n"),e.fl()},partials:{},subs:{}},'\n \n {{strings.readMore}}\n\n',Hogan)},{"hogan.js":94}],212:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,e){var l=this;return l.b(e=e||""),l.b('
'),l.b("\n"+e),l.b('
'),l.b("\n"+e),l.b('
'),l.b("\n"+e),l.b(' "),l.b("\n"+e),l.b("
"),l.b("\n"),l.fl()},partials:{},subs:{}},'
\n
\n
\n \n
\n',Hogan)},{"hogan.js":94}],213:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,s){var t=this;return t.b(s=s||""),t.b('
'),t.b("\n"+s),t.b(' '),t.b("\n"+s),t.b('
'),t.b("\n"+s),t.b(' '),t.b(t.t(t.d("author.displayName",a,n,0))),t.b(""),t.b("\n"+s),t.b(t.rp("'),t.b("\n"+s),t.b("
"),t.b("\n"+s),t.b('
'),t.b("\n"+s),t.b(" "),t.b(t.t(t.f("body",a,n,0))),t.b("\n"+s),t.b("
"),t.b("\n"+s),t.b("
"),t.b("\n"),t.fl()},partials:{"\n \n
\n {{{ author.displayName }}}\n {{> tags}}\n \n
\n
\n {{{ body }}}\n
\n
\n',Hogan)},{"hogan.js":94}],214:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(s,a,e){var i=this;return i.b(e=e||""),i.b('
'),i.b("\n"),i.fl()},partials:{},subs:{}},'
\n',Hogan)},{"hogan.js":94}],215:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(e,o,r){ var s=this;return s.b(r=r||""),s.b('
'),s.b("\n"+r),s.b('
'),s.b("\n"),s.fl()},partials:{},subs:{}},'
\n
\n',Hogan)},{"hogan.js":94}],216:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,s,a){var i=this;return i.b(a=a||""),i.s(i.f("index",n,s,1),n,s,0,10,78,"{{ }}")&&(i.rs(n,s,function(n,s,i){i.b(" "),i.b(i.v(i.f("index",n,s,0))),i.b(" "),i.b(i.v(i.d("strings.tally",n,s,0))),i.b(" "),i.b(i.v(i.f("streamCount",n,s,0))),i.b(""),i.b("\n"+a)}),n.pop()),i.s(i.f("loading",n,s,1),n,s,0,101,141,"{{ }}")&&(i.rs(n,s,function(n,s,i){i.b(" "),i.b(i.v(i.d("strings.loading",n,s,0))),i.b(""),i.b("\n"+a)}),n.pop()),i.s(i.f("indexOne",n,s,1),n,s,0,167,374,"{{ }}")&&(i.rs(n,s,function(n,s,i){i.b(' '),i.b("\n"+a),i.b(' '),i.b("\n"+a),i.b(' '),i.b(i.v(i.d("strings.write",n,s,0))),i.b(""),i.b("\n"+a),i.b(" "),i.b("\n"+a)}),n.pop()),i.s(i.f("inviteRead",n,s,1),n,s,0,403,597,"{{ }}")&&(i.rs(n,s,function(n,s,i){i.b(' '),i.b("\n"+a),i.b(' '),i.b(i.v(i.d("strings.read",n,s,0))),i.b(""),i.b("\n"+a),i.b(' '),i.b("\n"+a),i.b(" "),i.b("\n"+a)}),n.pop()),i.s(i.f("inviteWrite",n,s,1),n,s,0,629,839,"{{ }}")&&(i.rs(n,s,function(n,s,i){i.b(' '),i.b("\n"+a),i.b(' '),i.b(i.v(i.d("strings.write",n,s,0))),i.b(""),i.b("\n"+a),i.b(' '),i.b("\n"+a),i.b(" "),i.b("\n"+a)}),n.pop()),i.fl()},partials:{},subs:{}},'{{#index}}\n {{ index }} {{ strings.tally }} {{ streamCount }}\n{{/index}}\n{{#loading}}\n {{ strings.loading }}\n{{/loading}}\n{{#indexOne}}\n \n \n {{strings.write}}\n \n{{/indexOne}}\n{{#inviteRead}}\n \n {{strings.read}}\n \n \n{{/inviteRead}}\n{{#inviteWrite}}\n \n {{strings.write}}\n \n \n{{/inviteWrite}}\n',Hogan)},{"hogan.js":94}],217:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,o,e){var a=this;return a.b(e=e||""),a.b('
'),a.b("\n"),a.fl()},partials:{},subs:{}},'
\n',Hogan)},{"hogan.js":94}],218:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,o){var e=this;return e.b(o=o||""),e.b(''),e.b("\n"+o),e.b(''),e.b("\n"),e.fl()},partials:{},subs:{}},'\n\n',Hogan)},{"hogan.js":94}],219:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(s,e,n){var t=this;return t.b(n=n||""),t.b('
'),t.b("\n"+n),t.b(' '),t.b(t.v(t.d("strings.title",s,e,0))),t.b(""),t.b("\n"+n),t.b('
'),t.b("\n"+n),t.s(t.f("userLoggedIn",s,e,1),s,e,0,161,250,"{{ }}")&&(t.rs(s,e,function(s,e,t){t.b(' '),t.b("\n"+n)}),s.pop()),t.b("
"),t.b("\n"+n),t.b('
'),t.b("\n"+n),t.b(' '),t.b(t.v(t.d("strings.text",s,e,0))),t.b(""),t.b("\n"+n),t.b("
"),t.b("\n"),t.fl()},partials:{},subs:{}},'
\n {{strings.title}}\n
\n {{#userLoggedIn}}\n \n {{/userLoggedIn}}\n
\n
\n {{strings.text}}\n
\n',Hogan)},{"hogan.js":94}],220:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(o,a,e){var l=this;return l.b(e=e||""),l.b(''),l.b("\n"+e),l.b('
'),l.b("\n"),l.fl()},partials:{},subs:{}},'\n
\n',Hogan)},{"hogan.js":94}],221:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(s,a,n){var l=this;return l.b(n=n||""),l.b('
'),l.b("\n"+n),l.b('·'),l.b("\n"+n),l.b(''),l.b(l.v(l.d("strings.replyBtn",s,a,0))),l.b(""),l.b("\n"),l.fl()},partials:{},subs:{}},'
\n·\n{{ strings.replyBtn }}\n',Hogan)},{"hogan.js":94}],222:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,s,n){var t=this;return t.b(n=n||""),t.b('"),t.b("\n"+n),t.b('
'),t.b("\n"+n),t.b(' '),t.b(t.t(t.d("author.displayName",a,s,0))),t.b(""),t.b("\n"+n),t.b(t.rp(""),t.b("\n"+n),t.b('
'),t.b("\n"+n),t.b(" "),t.b(t.t(t.f("body",a,s,0))),t.b("\n"+n),t.b("
"),t.b("\n"),t.fl()},partials:{"\n
\n {{{ author.displayName }}}\n {{> tags}}\n
\n
\n {{{ body }}}\n
\n',Hogan)},{"hogan.js":94}],223:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,e){var s=this;return s.b(e=e||""),s.b('
'),s.b("\n"+e),s.b(s.rp(""),s.b("\n"),s.fl()},partials:{"\n {{> base}}\n
\n',Hogan)},{"hogan.js":94}],224:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,t){var e=this;return e.b(t=t||""),e.b(''),e.b("\n"),e.fl()},partials:{},subs:{}},'\n',Hogan)},{"hogan.js":94}],225:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,o,e){var s=this;return s.b(e=e||""),s.b('
'),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(s.rp(""),s.b("\n"),s.fl()},partials:{"\n \n {{> etc}}\n
\n',Hogan)},{"hogan.js":94}],226:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,l){var e=this;return e.b(l=l||""),e.s(e.f("moderator",n,a,1),n,a,0,14,126,"{{ }}")&&(e.rs(n,a,function(n,a,e){e.b(' '),e.b(e.v(e.d("strings.commentModeratorTag",n,a,0))),e.b(""),e.b("\n"+l)}),n.pop()),e.s(e.f("pending",n,a,1),n,a,0,153,264,"{{ }}")&&(e.rs(n,a,function(n,a,e){e.b(' '),e.b(e.v(e.d("strings.commentPendingTag",n,a,0))),e.b(""),e.b("\n"+l)}),n.pop()),e.fl()},partials:{},subs:{}},'{{#moderator}}\n {{ strings.commentModeratorTag }}\n{{/moderator}}\n{{#pending}}\n {{ strings.commentPendingTag }}\n{{/pending}}\n',Hogan)},{"hogan.js":94}],227:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,e){var s=this;return s.b(e=e||""),s.b('
'),s.b("\n"+e),s.b(s.rp(""),s.b("\n"+e),s.b('
'),s.b("\n"+e),s.b('
'),s.b("\n"),s.fl()},partials:{"\n {{> base }}\n {{> footer }}\n
\n
\n
\n',Hogan)},{"hogan.js":94}],228:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,o){var s=this;return s.b(o=o||""),s.b(''),s.b(s.v(s.f("count",a,n,0))),s.b(""),s.b("\n"+o),s.b(''),s.b("\n"+o),s.b(''),s.b("\n"),s.fl()},partials:{},subs:{}},'{{ count }}\n\n\n',Hogan)},{"hogan.js":94}],229:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(t,e,s){var a=this;return a.b(s=s||""),a.b('
'),a.b("\n"+s),a.b(""),a.b("\n"+s),a.b(""),a.b(a.v(a.d("strings.postBtn",t,e,0))),a.b(""),a.b("\n"),a.fl()},partials:{},subs:{}},"
\n\n{{ strings.postBtn }}\n",Hogan)},{"hogan.js":94}],230:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,s,a){var o=this;return o.b(a=a||""),o.b('
'),o.b("\n"+a),o.b(' '),o.b("\n"+a),o.b(" "),o.b(o.t(o.f("msg",n,s,0))),o.b(""),o.b("\n"+a),o.b("
"),o.b("\n"),o.fl()},partials:{},subs:{}},'
\n \n {{{ msg }}}\n
\n',Hogan)},{"hogan.js":94}],231:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,a,e){var l=this;return l.b(e=e||""),l.b('
'),l.b("\n"+e),l.b('"),l.b("\n"),l.fl()},partials:{},subs:{}},'
\n\n',Hogan)},{"hogan.js":94}],232:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,s){var e=this;return e.b(s=s||""),e.b('
'),e.b("\n"),e.fl()},partials:{},subs:{}},'
\n',Hogan)},{"hogan.js":94}],233:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(a,n,e){var o=this;return o.b(e=e||""),o.b('
'),o.b("\n"),o.fl()},partials:{},subs:{}},'
\n',Hogan)},{"hogan.js":94}],234:[function(_dereq_,module){var Hogan=_dereq_("hogan.js");module.exports=new Hogan.Template({code:function(n,s,t){var i=this;return i.b(t=t||""),i.b('
'),i.b("\n"+t),i.b(''),i.b(i.t(i.d("strings.signedInMsg",n,s,0))),i.b(""),i.b("\n"+t),i.b('