define("core/utils/getEmbeddedData",[],function(){"use strict";return function(a){var b=window.document.getElementById("disqus-"+a);try{return b&&JSON.parse(b.textContent||b.innerHTML)}catch(c){return null}}}),define("core/analytics/jester",["jquery","underscore","backbone","core/analytics/identity","core/config/urls"],function(a,b,c,d,e){"use strict";var f=c.Model.extend({url:e.jester+"/event.js",defaults:{experiment:"default",variant:"control"},setHostReferrer:function(a){a&&-1!==a.indexOf("http")&&this.set("page_referrer",a)},decoratePayload:function(c){c.event||(c.event="activity"),c=b.extend(this.toJSON(),c),b.extend(c,{imp:d.impression.impId,prev_imp:d.impression.prevImp}),c.section||(c.section="default"),c.area||(c.area="n/a");var e=a.param(c).length;if(e>2048&&this.has("page_referrer")){var f=window.document.createElement("a");f.href=this.get("page_referrer");var g=f.hostname;g&&(c.page_referrer_domain=g),delete c.page_referrer}return c},emit:function(c){return a.ajax({url:b.result(this,"url"),data:this.decoratePayload(c),dataType:"script",cache:!0})}}),g=function(b){var c=new window.Image;return c.src=e.jester+"/stat.gif?"+a.param({event:b}),c},h=function(c,d){if(!b.any(d,function(a){return 0>a})){b.each(d,function(a,b){d[b]=Math.round(a)});var f=new window.Image;return f.src=e.jester+"/telemetry/"+c+".gif?"+a.param(d),f}},i=new f;return{ActivityClient:f,client:i,logStat:g,telemetry:h}}),define("core/utils/isAdBlockEnabled",["jquery","underscore"],function(a,b){"use strict";var c="adsbox",d=100,e=window.document;return b.memoize(function(){var b=a.Deferred(),f=e.createElement("div");return f.innerHTML=" ",f.className=c,e.body.appendChild(f),setTimeout(function(){b.resolve(0===f.offsetHeight),e.body.removeChild(f)},d),b.promise()})}),define("core/utils/html/toRGBColorString",[],function(){"use strict";var a="Color components should be numbers.";return function(b){var c=Number(b.red),d=Number(b.green),e=Number(b.blue);if(isNaN(c)||isNaN(d)||isNaN(e))throw new Error(a);var f="rgb",g=[c,d,e],h=b.alpha;if(h){if(h=Number(h),isNaN(h))throw new Error(a);f+="a",g.push(h)}return f+"("+g+")"}}),define("lounge/tracking",["jquery","underscore","core/analytics/identity","core/analytics/jester","core/bus","core/utils/url/serialize","core/utils/isAdBlockEnabled","core/utils/html/toRGBColorString","remote/config","common/intelligence","common/urls","common/utils","common/main"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";function n(i,n){function p(a,d,e){var g=a.user.id,h=l.isDNTEnabled(),j=b.extend({event:"init_embed",thread:v,forum:s,forum_id:t,imp:c.impression.impId,prev_imp:c.impression.prevImp,thread_slug:u.get("slug"),user_type:a.user.get("user_type")||"anon",referrer:i.document.referrer,theme:"next",dnt:h?"1":"0",abe:e?"1":"0",tracking_enabled:d?"1":"0",embed_hidden:n.config.isBehindClick?"1":"0"},n.config.experiment);g&&"0"!==g&&(j.user_id=g);var m=r.get("settings");m&&b.has(m,"organicDiscoveryEnabled")&&b.extend(j,{organic_enabled:m.organicDiscoveryEnabled,promoted_enabled:m.promotedDiscoveryEnabled,max_enabled:m.discoveryMax,thumbnails_enabled:m.discoveryThumbnailsEnabled}),(new i.Image).src=f(k.jester+"/event.gif",j,!1)}var q=new j.Intelligence,r=n.forum,s=r.id,t=r.get("pk"),u=n.thread,v=u.id;n.session.on("change:id",function(a){d.client.set("user_id",a.id)}),n.session.once("change:id",function(){var a=this,b=o.shouldTrack(r,this.user);b&&o.load3rdParties(u),q.init({version:"next",forum:s,features:n.initialData.features,session:a.user}),n.session.on("change:id",function(a){q.setSession(a),q.trackEvent(a.id?"login":"logout")}),g().then(function(c){p(a,b,c)})}),d.client.set({product:"embed",thread:v,thread_id:v,forum:s,forum_id:t,zone:"thread",version:m.version}),n.once("bootstrap:complete",function(){d.client.set({page_url:n.config.referrer});var a=n.config.experiment;a&&d.client.set({experiment:a.experiment,variant:a.variant,service:a.service}),d.client.setHostReferrer(n.config.hostReferrer)});var w={inViewport:function(){var c=n.config;q.trackEvent("view_embed");var e={color_scheme:c.colorScheme,anchor_color:h(c.anchorColor),typeface:c.typeface,width:a(i.document).width()};e=b.pick(e,function(a,c){switch(c){case"width":return b.isNumber(a);default:return b.isString(a)&&""!==a}}),d.client.emit({verb:"view",object_type:"product",object_id:"embed",extra_data:JSON.stringify(e)}),n.off("inViewport")},"uiAction:createPost":function(a){n.session.user.id||q.setSession("guest"),a.get("parent")?q.trackEvent("post_comment_reply"):q.trackEvent("post_comment")},"uiCallback:postCreated":function(a,c){c=c||{},b.extend(c,{object_type:"post",object_id:a.id,verb:"post"}),a.has("parent")&&(c.target_type="post",c.target_id=a.get("parent")),d.client.emit(c)},"uiAction:seeMore":function(a){d.client.emit({verb:"open",object_type:"section",object_id:"thread/page-"+a})},"uiAction:postUpvote":function(a,b){q.trackEvent("like_comment"),d.client.emit({verb:"like",object_type:"post",object_id:a.id,area:o.getEventTrackingArea(b)})},"uiAction:postUnvote":function(a,b){d.client.emit({verb:"unlike",object_type:"post",object_id:a.id,area:o.getEventTrackingArea(b)})},"uiAction:postDownvote":function(a,b){q.trackEvent("dislike_comment"),d.client.emit({verb:"dislike",object_type:"post",object_id:a.id,area:o.getEventTrackingArea(b)})},"uiAction:upvotersCardShow":function(){q.trackEvent("upvoters_card_shown")},"uiAction:showProfileFromUpvotes":function(){q.trackEvent("upvoters_profile_click")},"uiAction:threadUnlike":function(){d.client.emit({verb:"unlike",object_type:"thread",zone:"thread"})},"uiAction:threadLike":function(){q.trackEvent("like_thread"),d.client.emit({verb:"like",object_type:"thread"})},"uiAction:postShare":function(a,b){q.trackEvent("share_comment_"+b),d.client.emit({verb:"share",object_type:"post",object_id:a.id,target_type:"service",target_id:b})},"uiAction:threadShare":function(a){q.trackEvent("share_thread_"+a),d.client.emit({verb:"share",object_type:"thread",target_type:"service",target_id:a})},"uiAction:clickLink":function(a,b){d.client.emit({verb:"click",object_type:"link",object_id:a[0].href,area:o.getEventTrackingArea(b)})},"uiAction:followUser":function(a){q.trackEvent("follow_user"),d.client.emit({verb:"follow",object_type:"user",object_id:a.id})},"uiAction:unfollowUser":function(a){d.client.emit({verb:"stop-following",object_type:"user",object_id:a.id})},"uiAction:openLogin":function(a){q.trackEvent("open_login_"+a),d.client.emit({verb:"open",object_type:"login",object_id:a})},"uiAction:finishRegistrationEmbed":function(){q.trackEvent("finish_registration_embed")},"uiAction:finishRegistrationWindow":function(){q.trackEvent("finish_registration_window")},"uiAction:finishAccountComplete":function(){q.trackEvent("finish_account_complete")},"uiAction:onboardAlertShow":function(){d.client.emit({verb:"view",object_type:"area",object_id:"onboard_alert"})},"uiAction:onboardAlertDismiss":function(){d.client.emit({verb:"close",object_type:"area",object_id:"onboard_alert"})},"uiAction:openHome":function(){d.client.emit({verb:"open",object_type:"product",object_id:"bridge"})},viewActivity:function(a,b){var c={verb:"view",object_type:a,object_id:b};d.client.emit(c)}};n.on(w),e.on(w)}var o={};return o.init=function(a){n(window,a)},o.getEventTrackingArea=function(b){return a(b.currentTarget).closest("[data-tracking-area]").attr("data-tracking-area")},o.load3rdParties=function(c){if(k.glitter){var d=i.lounge.tracking||{},e=d.iframe_limit||0;a.ajax({dataType:"jsonp",cache:!0,url:k.glitter,data:{forum_shortname:c.forum.id,thread_id:c.id},jsonpCallback:"dsqGlitterResponseHandler",success:function(c){var d=a("body");b.each(c,function(b){("img"===b.type||"iframe"===b.type)&&("iframe"===b.type&&(e-=1,0>e)||d.append(a("<"+b.type+">").hide().attr("src",b.url)))})}})}},o.shouldTrack=function(a,b){return!(a&&a.get("settings").disable3rdPartyTrackers||b&&b.get("disable3rdPartyTrackers")||"1"===l.cookies.read("disqus_tracking_optout")||l.isDNTEnabled())},o}),define("core/utils/uniqueId",[],function(){"use strict";var a=0;return function(b){a+=1;var c=String(a);return b?b+c:c}}),define("core/Events",["require","core/utils/collection/each","core/utils/object/has","core/utils/uniqueId"],function(a){"use strict";var b=a("core/utils/collection/each"),c=a("core/utils/object/has"),d=a("core/utils/uniqueId"),e=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},f=Object.keys||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var d in a)c(a,d)&&(b[b.length]=d);return b},g=[].slice,h={on:function(a,b,c){if(!j(this,"on",a,[b,c])||!b)return this;this._events=this._events||{};var d=this._events[a]||(this._events[a]=[]);return d.push({callback:b,context:c,ctx:c||this}),this},once:function(a,b,c){if(!j(this,"once",a,[b,c])||!b)return this;var d=this,f=e(function(){d.off(a,f),b.apply(this,arguments)});return f._callback=b,this.on(a,f,c)},off:function(a,b,c){var d,e,g,h,i,k,l,m;if(!this._events||!j(this,"off",a,[b,c]))return this;if(!a&&!b&&!c)return this._events={},this;for(h=a?[a]:f(this._events),i=0,k=h.length;k>i;i++)if(a=h[i],g=this._events[a]){if(this._events[a]=d=[],b||c)for(l=0,m=g.length;m>l;l++)e=g[l],(c&&c!==e.context||b&&b!==e.callback&&b!==e.callback._callback)&&d.push(e);d.length||delete this._events[a]}return this},trigger:function(a){if(!this._events)return this;var b=g.call(arguments,1);if(!j(this,"trigger",a,b))return this;var c=this._events[a],d=this._events.all;return c&&k(c,b),d&&k(d,arguments),this},stopListening:function(a,b,c){var d=this._listeners;if(!d)return this;var e=!b&&!c;"object"==typeof b&&(c=this),a&&((d={})[a._listenerId]=a);for(var f in d)d[f].off(b,c,this),e&&delete this._listeners[f];return this}},i=/\s+/,j=function(a,b,c,d){if(!c)return!0;if("object"==typeof c){for(var e in c)a[b].apply(a,[e,c[e]].concat(d));return!1}if(i.test(c)){for(var f=c.split(i),g=0,h=f.length;h>g;g++)a[b].apply(a,[f[g]].concat(d));return!1}return!0},k=function(a,b){var c,d,e=a.length,f=b[0],g=b[1],h=b[2];switch(b.length){case 0:for(d=0;e>d;d++)(c=a[d]).callback.call(c.ctx);return;case 1:for(d=0;e>d;d++)(c=a[d]).callback.call(c.ctx,f);return;case 2:for(d=0;e>d;d++)(c=a[d]).callback.call(c.ctx,f,g);return;case 3:for(d=0;e>d;d++)(c=a[d]).callback.call(c.ctx,f,g,h);return;default:for(d=0;e>d;d++)(c=a[d]).callback.apply(c.ctx,b)}},l={listenTo:"on",listenToOnce:"once"};return b(l,function(a,b){h[b]=function(b,c,e){var f=this._listeners||(this._listeners={}),g=b._listenerId||(b._listenerId=d("l"));return f[g]=b,"object"==typeof c&&(e=this),b[a](c,e,this),this}}),h.bind=h.on,h.unbind=h.off,h}),define("core/utils/function/debounce",[],function(){"use strict";return function(a,b,c){var d,e,f,g,h,i=function(){var j=(new Date).getTime()-g;b>j&&j>=0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=(new Date).getTime();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}}}),define("core/utils/function/throttle",[],function(){"use strict";return function(a,b,c){c||(c=0);var d,e,f,g,h=0,i=function(){h=new Date,f=null,g=a.apply(d,e)};return function(){var j=new Date,k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(f),f=null,h=j,g=a.apply(d,e)):f||(f=setTimeout(i,k+c)),g}}}),define("core/utils/html/addEvent",[],function(){"use strict";return function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else{if(!a.attachEvent)throw new Error("No event support.");a.attachEvent("on"+b,c)}}}),define("core/utils/html/removeEvent",[],function(){"use strict";return function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else{if(!a.detachEvent)throw new Error("No event support.");a.detachEvent("on"+b,c)}}}),define("core/utils/array/indexOf",[],function(){"use strict";return function(a,b){for(var c=0;ce;return!f&&!g||f&&g?c=1:f?c=(b.height-(d-b.visibleTop))/b.height:g&&(c=(e-b.visibleTop)/b.height),Math.round(100*c)}}),define("stance/tracking",["core/utils/array/indexOf","core/utils/array/some","core/utils/html/isVisible","core/utils/object/result","./utils","exports"],function(a,b,c,d,e,f){"use strict";f.events=[],f.lastPos=null,f.clearCache=function(a){if(void 0===a)f.getElementOffset.cache={};else{var b=e.getId(a);b&&(f.getElementOffset.cache[b]=null)}},f.calculateOffset=function(a){if(!a)return null;if(!c(a))return null;var b=a.ownerDocument.documentElement;return{height:a.offsetHeight,top:a.getBoundingClientRect().top+window.pageYOffset-(b.clientTop||0)}},f._getElementOffset=function(a){var b=e.getElement(a);if(!b)return null;var c=f.calculateOffset(b);return c?{visibleTop:c.top+(d(a,"topEdgeOffset")||0),visibleBottom:c.top+c.height-(d(a,"bottomEdgeOffset")||0),offsetTop:c.top,height:c.height}:null},f.getElementOffset=function(){var a=function(b){var c=a.cache,d=e.getId(b);if(d&&c[d])return c[d];var g=f._getElementOffset(b);return d&&g&&(c[d]=g),g};return a.cache={},a}(),f.EVENT_NAMES=["enter","exit","visible","invisible","all"],f.updateTracking=function(c){var d,e=function(a){return a?function(b){return a[b]}:function(){}};b(f.EVENT_NAMES,e(c._events))?(d=a(f.events,c),-1===d&&f.events.push(c)):(d=a(f.events,c),-1!==d&&f.events.splice(d,1))},f.processEvents=function(a){f.lastPos=a;var b=f.events;if(b.length)for(var c=b.length-1;c>=0;--c){var d=b[c],e=d.isVisible(a);null!==e&&(e!==d.lastVisible&&d.trigger(e?"enter":"exit",d,a),d.trigger(e?"visible":"invisible",d,a),d.lastVisible=e)}}}),define("stance/main",["core/Events","core/utils/function/debounce","core/utils/function/throttle","core/utils/html/addEvent","core/utils/html/removeEvent","core/utils/object/extend","./tracking"],function(a,b,c,d,e,f,g){"use strict";function h(a){return this instanceof h?(this.obj=a,void(this.lastVisible=!1)):new h(a)}var i=b(function(){g.processEvents(g.lastPos)},250);return f(h.prototype,a,{on:function(b){var c=!(this._events&&this._events[b]),d=a.on.apply(this,arguments);return c&&g.updateTracking(this),i(),d},off:function(b){var c=a.off.apply(this,arguments);return this._events&&this._events[b]||g.updateTracking(this),c},offset:function(){return g.getElementOffset(this.obj)},isVisible:function(a){if(a=a||g.lastPos,!a)return null;var b=a.top,c=b+a.height,d=this.offset();return d?d.offsetTop>=b&&d.visibleTopb:null},invalidate:function(){return g.clearCache(this.obj),this}}),f(h,{invalidate:g.clearCache,scroll:g.processEvents,_windowScrollHandlerBound:!1,_ignoreCache:!1,_windowScrollHandler:c(function(){h._ignoreCache&&h.invalidate(),g.processEvents({top:window.pageYOffset,height:window.document.documentElement.clientHeight})},250),bindWindowEvents:function(a){this._windowScrollHandlerBound||("undefined"!=typeof a&&(h._ignoreCache=a),d(window,"scroll",this._windowScrollHandler),d(window,"resize",this._windowScrollHandler),this._windowScrollHandlerBound=!0,this._windowScrollHandler())},unbindWindowEvents:function(){h._ignoreCache=!1,e(window,"scroll",this._windowScrollHandler),e(window,"resize",this._windowScrollHandler),this._windowScrollHandlerBound=!1}}),h}),define("stance",["stance/main"],function(a){return a}),define("core/templates/handlebars.partials",["handlebars"],function(a){a.registerPartial("cardGuestUpvoterText",a.template({1:function(a,b,c,d,e){return" "+a.escapeExpression(c.gettext.call(null!=b?b:{},"%(guestCount)s Guest Votes",{name:"gettext",hash:{guestCount:null!=b?b.guestCount:b},data:e}))+" "},3:function(a,b,c,d,e){return" "+a.escapeExpression(c.gettext.call(null!=b?b:{},"1 Guest Vote",{name:"gettext",hash:{},data:e}))+" "},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=null!=b?b:{};return(null!=(f=c["if"].call(g,c.gt.call(g,null!=b?b.guestCount:b,1,{name:"gt",hash:{},data:e}),{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.program(3,e,0),data:e}))?f:"")+"\n"},useData:!0})),a.registerPartial("cardGuestUser",a.template({1:function(a,b,c,d,e){var f,g=null!=b?b:{},h=a.lambda,i=a.escapeExpression;return'
  • \n\n'+i(c.gettext.call(g,\n\n\n'+i(h(null!=b?b.guestText:b,b))+"\n\n
  • \n"},2:function(a,b,c,d,e){return"highlight"},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f;return null!=(f=c["if"].call(null!=b?b:{},null!=b?b.guestCount:b,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:""},useData:!0})),a.registerPartial("cardOtherUserText",a.template({1:function(a,b,c,d,e){return" "+a.escapeExpression(c.gettext.call(null!=b?b:{},"%(guestCount)s Others",{name:"gettext",hash:{guestCount:null!=b?b.guestCount:b},data:e}))+" "},3:function(a,b,c,d,e){return" "+a.escapeExpression(c.gettext.call(null!=b?b:{},"1 Other",{name:"gettext",hash:{},data:e}))+" "},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=null!=b?b:{};return(null!=(f=c["if"].call(g,c.gt.call(g,null!=b?b.guestCount:b,1,{name:"gt",hash:{},data:e}),{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.program(3,e,0),data:e}))?f:"")+"\n"},useData:!0})),a.registerPartial("cardUser",a.template({1:function(a,b,c,d,e){return"highlight"},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=null!=b?b:{},h=a.lambda,i=a.escapeExpression;return'
  • \n\n'+i(c.gettext.call(g,\n\n\n'+i(h(null!=b?b.name:b,b))+"\n\n
  • \n"},useData:!0})),a.registerPartial("carouselArrowLeft",a.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){return'\n'},useData:!0})),a.registerPartial("carouselArrowRight",a.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){return'\n'},useData:!0})),a.registerPartial("channelsHeader",a.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f=null!=b?b:{},g=a.escapeExpression;return'
    \n
    \n\n
    \n
    \n

    '+g(c.gettext.call(f,"Channels",{name:"gettext",hash:{},data:e}))+'

    \n
    \n
    \n

    '+g(c.gettext.call(f,"Places to start your own discussions.",{name:"gettext",hash:{},data:e}))+"

    \n"},useData:!0})),a.registerPartial("genericFollowButton",a.template({1:function(a,b,c,d,e){return" active"},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=null!=b?b:{},h=a.escapeExpression;return'\n"},useData:!0}))}),define("core/templates/alert",["handlebars","core/templates/handlebars.partials","core/extensions/handlebars.helpers"],function(a){return a.template({1:function(a,b,c,d,e){return'\n'},3:function(a,b,c,d,e){var f;return(null!=(f=a.lambda(null!=b?b.message:b,b))?f:"")+"\n"},5:function(a,b,c,d,e){return a.escapeExpression(a.lambda(null!=b?b.message:b,b))+"\n"},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=null!=b?b:{};return'×\n\n'+(null!=(f=c["if"].call(g,null!=b?b.icon:b,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:"")+(null!=(f=c["if"].call(g,null!=b?b.safe:b,{name:"if",hash:{},fn:a.program(3,e,0),inverse:a.program(5,e,0),data:e}))?f:"")+"\n"},useData:!0})}),define("core/views/AlertView",["backbone","core/templates/alert"],function(a,b){"use strict";var c=a.View.extend({className:"alert",events:{"click [data-action=dismiss]":"dismiss"},initialize:function(a){this.options=a,this.message=a.message,this.safe=a.safe,this.type=a.type},render:function(){var a=this.$el;return a.html(b({message:this.message,safe:this.safe,icon:"error"===this.type})),a.attr("class",this.className),this.type&&a.addClass(this.type),this},dismiss:function(a){a&&a.preventDefault&&a.preventDefault(),this.remove(),this.trigger("dismiss")}});return c}),define("core/mixins/withAlert",["underscore","core/views/AlertView"],function(a,b){"use strict";var c={alert:function(c,d){a.isObject(d)||(d={});var e=d.target||this._alertSelector;this.dismissAlert();var f=this._alert=new b(a.extend({message:c},d));return f.render(),e?this.$el.find(e).prepend(f.el):this.el.parentNode&&this.el.parentNode.insertBefore(f.el,this.el),f},dismissAlert:function(a){this._alert&&(!a||a(this._alert))&&this._alert.dismiss()},setAlertSelector:function(a){this._alertSelector=a}},d=function(){return a.extend(this,c)};return d}),define("core/mixins/withEmailVerifyLink",["jquery","underscore","core/config","core/utils"],function(a,b,c,d){"use strict";var e=d.preventDefaultHandler,f={events:{"click [data-action=verify-email]":"showVerifyEmailPopup"},showVerifyEmailPopup:e(function(b){var e=a(b.target).attr("data-forum"),f=c.urls.verifyEmail;return e&&(f=f+"?f="+e),d.openWindow(f,"_blank",{width:460,height:355})})};return function(){this.events=b.defaults({},this.events,f.events),b.extend(this,b.pick(f,"showVerifyEmailPopup"))}}),define("lounge/common",[],function(){"use strict";var a,b=function(b){a=b},c=function(){return a};return{setLounge:b,getLounge:c}}),define("lounge/menu-handler",["jquery","core/bus"],function(a,b){"use strict";return{init:function(){function c(){a(".dropdown").removeClass("open")}a("html").on("click",c),a("body").delegate("[data-toggle]","click",function(b){b.stopPropagation(),b.preventDefault();var d=a(b.currentTarget),e=d.closest("."+d.attr("data-toggle")),f="disabled"!==e.attr("data-dropdown")&&!e.hasClass("open");e.attr("data-dropdown","enabled"),c(),f&&e.addClass("open")}),b.frame.on("window.click",c)}}}),define("lounge/mixins",["core/utils/url/serialize"],function(a){"use strict";var b={_sharePopup:function(a,b){return window.open(a,"_blank",b||"width=550,height=520")},share:function(a){this.sharers[a].call(this)},sharers:{twitter:function(){var b="https://twitter.com/intent/tweet",c=this.model.shortLink();this._sharePopup(a(b,{url:c,text:this.model.twitterText(c)}))},facebook:function(){this._sharePopup(a("https://www.facebook.com/sharer.php",{u:this.model.shortLink()}),"width=655,height=352")}}},c=function(){function a(){return this.collapseTarget&&this.collapseTarget.length||(this.collapseTarget=this.collapseTargetSelector?this[this.collapseScope].find(this.collapseTargetSelector):this[this.collapseScope]),this.collapseTarget}function b(){var b=this;if(b.isCollapseAllowed){var c=a.call(b);c&&c.length&&(c.height(b.collapsedHeight),e.call(b))}}function c(a){var b=this;if(b.collapseTarget&&b.collapseTarget.length){var c=b.collapseTarget;c.css("height","auto"),c.css("maxHeight","none"),f.call(b),a||(b.isCollapseAllowed=!1)}}function d(){return this.seeMoreButton&&this.seeMoreButton.length||(this.seeMoreButton=a.call(this).siblings("[data-action=see-more]")),this.seeMoreButton}function e(){var a=this;d.call(this).removeClass("hidden").on("click",function(){a.expand()})}function f(){d.call(this).addClass("hidden").off("click")}return function(a){var d=this;d.isCollapseAllowed=!0,d.collapsedHeight=a.collapsedHeight,d.collapseTargetSelector=a.collapseTargetSelector,d.collapseScope=a.collapseScope||"$el",d.collapse=b,d.expand=c}}();return{ShareMixin:b,asCollapsible:c}}),define("lounge/realtime",["jquery","underscore","backbone","loglevel","core/utils/url/serialize","common/utils","common/urls"],function(a,b,c,d,e,f,g){"use strict";function h(){n.apply(this,arguments),this.reqCounter=0,this.marker=0,this.interval=1,this._boundOnError=b.bind(this.onError,this),this._boundOnLoad=b.bind(this.onLoad,this),this._boundOnProgress=b.bind(this.onProgress,this)}function i(){n.apply(this,arguments),this.handshakeSuccess=null,this.interval=1,this._boundOnOpen=b.bind(this.onOpen,this),this._boundError=b.bind(this.onError,this),this._boundClose=b.bind(this.onClose,this),this._boundMessage=b.compose(b.bind(this.onMessage,this),function(a){return JSON.parse(a.data)})}var j=2,k=120,l=function(){},m=function(){throw new Error("Pipe class cannot be used directly.")},n=function(a,c){this.channel=a,this.since=c,this.connection=null,this.paused=!1,this._msgBuffer=[],this._boundOpen=b.bind(this.open,this)};b.extend(n.prototype,c.Events,{getUrl:function(a){var c={};return this.since&&(c.since=this.since),b.extend(c,a),e(this.baseUrl+this.channel,c)},onMessage:function(a){var b=a.message_type,c=a.firehose_id;this.lastEventId=c,d.debug("RT: new message:",b,c);var e={type:b,data:a.message_body,lastEventId:c};this.trigger(b,e)},_msgToBuffer:function(){this._msgBuffer.push(b.toArray(arguments))},pause:function(a){this.paused||(this.paused=!0,this._trigger=this.trigger,this.trigger=a===!1?l:this._msgToBuffer,d.debug("RT: paused, buffered: %s",a!==!1))},resume:function(){if(this.paused){this.paused=!1,this.trigger=this._trigger,d.debug("RT: resumed, buffered messages: %s",this._msgBuffer.length);for(var a;a=this._msgBuffer.shift();)this.trigger.apply(this,a)}},open:m,close:function(){var a=this.connection;return a?(this.connection=null,a):!1}}),b.extend(h.prototype,n.prototype,{baseUrl:g.realertime+"/api/2/",onError:function(){this.connection&&(this.connection=null,this.trigger("error",this),this.interval<=k&&(this.interval*=j),d.info("RT: Connection error, backing off %s secs",this.interval),b.delay(this._boundOpen,1e3*this.interval))},onLoad:function(){this.connection&&(this.connection=null,this.since=null,this.trigger("success",this),b.defer(this._boundOpen))},onProgress:function(){if(this.connection){var a,b,c,e,f=this.connection.responseText,g=0;if(f&&!(this.marker>=f.length)){a=f.slice(this.marker).split("\n");for(var h=a.length,i=0;h>i;i++)if(b=a[i],g+=b.length+1,c=b.replace(/^\s+|\s+$/g,"")){try{e=JSON.parse(c)}catch(j){if(i===h-1){g-=b.length+1;break}d.debug("RT: unable to parse: ",c,b);continue}this.onMessage(e)}else d.debug("RT: ignoring empty row...");g>0&&(this.marker+=g-1)}}},open:function(){this.close();var a=this.connection=f.CORS.request("GET",this.getUrl({bust:++this.reqCounter}),this._boundOnLoad,this._boundOnError);if(!a)return void d.debug("RT: Cannot use any cross-domain request tool with StreamPipe. Bailing out.");a.onprogress=this._boundOnProgress,this.connection=a,this.marker=0;try{a.send()}catch(b){this.connection=null,d.debug("RT: Attempt to send a CORS request failed.")}},close:function(){var a=n.prototype.close.apply(this);return a&&a.abort()}}),b.extend(i.prototype,n.prototype,{baseUrl:("https:"===window.location.protocol?"wss:":"ws:")+g.realertime+"/ws/2/",onOpen:function(){d.debug("RT: [Socket] Connection established."),this.handshakeSuccess=!0,this.since=null},onError:function(){if(this.connection){if(this.connection=null,!this.handshakeSuccess)return d.debug("RT: [Socket] Error before open, bailing out."),void this.trigger("fail");this.trigger("error"),this.interval<=k&&(this.interval*=j),d.error("RT: Connection error, backing off %s secs",this.interval),b.delay(this._boundOpen,1e3*this.interval)}},onClose:function(a){if(this.connection){if(!a.wasClean)return void this.onError();this.connection=null,d.debug("RT: [Socket] Connection closed. Restarting..."),this.trigger("close"),this.open()}},open:function(){this.close();var a=this.connection=new window.WebSocket(this.getUrl());a.onopen=this._boundOnOpen,a.onerror=this._boundError,a.onmessage=this._boundMessage,a.onclose=this._boundClose},close:function(){var a=n.prototype.close.apply(this);return a&&a.close()}});var o={_wsSupported:window.WebSocket&&2===window.WebSocket.CLOSING,initialize:function(a,c,d,e){this.close(),this._initArgs=[a,c,d,e];var f=this._wsSupported,g=f?i:h,j=this.pipe=new g(a,c);b.chain(d).pairs().each(function(a){j.on(a[0],a[1],e)}),f&&j.on("fail",function(){this._wsSupported=!1,j.off(),this.initialize.apply(this,this._initArgs)},this),j.open()},pause:function(a){this.pipe&&this.pipe.pause(a)},resume:function(){this.pipe&&this.pipe.resume()},close:function(){this.pipe&&(this.pipe.close(),this.pipe=null)}};return a(window).on("unload",b.bind(o.close,o)),{Pipe:n,StreamPipe:h,SocketPipe:i,Manager:o}}),define("core/models/MediaUpload",["backbone","core/models/Media"],function(a,b){"use strict";var c=a.Model.extend({defaults:{token:null,original_url:null, thumbnail_url:null,expires:null},validate:function(a){if(null===a.expires)return new Error("Upload is missing expiry timestamp");var b=Number(new Date);return a.expires= 4.0.0"],main:function(a,b,c,d,e){var f=null!=b?b:{},g=a.escapeExpression;return''+g(c.gettext.call(f,"Attach",{name:"gettext",hash:{},data:e}))+'\n\n'},useData:!0})}),define("core/views/media/UploadButtonView",["jquery","backbone","core/templates/postMediaUploadButton","core/utils"],function(a,b,c,d){"use strict";var e=d.stopEventHandler,f="input[type=file][data-role=media-upload]",g=b.View.extend({events:function(){var a={"click [data-action=attach]":"_attachMedia"};return a["change "+f]="_selectorChange",a}(),initialize:function(a){this.template=a&&a.template||c},render:function(){return this.$el.html(this.template()),this},_attachMedia:e(function(){this.$(f).click()}),_selectorChange:function(b){var c=b.target,d=c.files;d.length&&(this.trigger("uploader:attachMedia",d),a(c).replaceWith(c.cloneNode()))}});return g}),define("core/templates/postMediaUploadProgress",["handlebars","core/templates/handlebars.partials","core/extensions/handlebars.helpers"],function(a){return a.template({1:function(a,b,c,d,e){return'
  • \n
    \n
    \n
    \n
    \n
    \n
  • \n'},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f;return null!=(f=c.each.call(null!=b?b:{},null!=b?b.collection:b,{name:"each",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?f:""},useData:!0})}),define("core/views/media/UploadsProgressSubView",["backbone","core/templates/postMediaUploadProgress"],function(a,b){"use strict";var c=a.View.extend({initialize:function(){this.collection=new a.Collection,this.listenTo(this.collection,"add remove change",this.render)},hasVisible:function(){return Boolean(this.collection.length)},render:function(){return this.$el.html(b({collection:this.collection.toJSON()})),this}});return c}),define("core/collections/MediaUploadCollection",["backbone","core/models/MediaUpload"],function(a,b){"use strict";var c=a.Collection.extend({model:b});return c}),define("core/utils/media/MediaStore",["underscore","core/utils/storage"],function(a,b){"use strict";var c=function(a){if(!a)throw new Error("Cannot instantiate MediaStore without a valid storageKey!");this._storageKey=a};return a.extend(c.prototype,{getItems:function(){return b.get(this._storageKey)||{}},clear:function(){b.remove(this._storageKey)},getItem:function(a){return this.getItems()[a]},setItem:function(a,c){var d=this.getItems();return d[a]=c,b.set(this._storageKey,d),c},removeItem:function(a){var c=this.getItems();return a in c?(delete c[a],b.set(this._storageKey,c),!0):!1}}),c}),define("core/templates/postMediaUploadLegacy",["handlebars","core/templates/handlebars.partials","core/extensions/handlebars.helpers"],function(a){return a.template({compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f=a.lambda,g=a.escapeExpression;return'
  • \n
    \n
    \n
    \n'+g(c.gettext.call(null!=b?b:{},\n\n
    \n
    \n
    \n
  • \n'},useData:!0})}),define("core/views/media/UploadsLegacySubView",["jquery","underscore","backbone","core/collections/MediaUploadCollection","core/utils","core/utils/media/MediaStore","core/templates/postMediaUploadLegacy"],function(a,b,c,d,e,f,g){"use strict";var h=e.stopEventHandler,i=c.View.extend({events:{"click [data-action=detach]":"onDetach"},initialize:function(a){this.collection=new d;var c=a.mediaStorageKey;this.mediaStore=c&&new f(c),this.mediaStore&&this.collection.reset(b.values(this.mediaStore.getItems()),{validate:!0}),this.listenTo(this.collection,{add:this.onAdd,remove:this.onRemove,reset:this.onReset})},setElement:function(){var a=c.View.prototype.setElement.apply(this,arguments);return this.collection&&this.collection.each(this._addElement,this),a},hasVisible:function(){return Boolean(this.collection.length)},onDetach:h(function(b){var c=a(b.target).closest("li"),d=c.attr("data-media-id"),e=this.collection.where({original_url:d});this.collection.remove(e,{$el:c})}),_addElement:function(b){var c=a(g(b.toJSON()));c.attr("data-media-id",b.get("original_url")),this.$el.append(c)},onAdd:function(a){this.mediaStore&&this.mediaStore.setItem(a.get("original_url"),a),this._addElement(a)},onRemove:function(a,b,c){c.$el&&c.$el.remove();var d=this.mediaStore&&this.mediaStore.getItem(a.get("original_url"));d&&this.mediaStore.removeItem(a.get("original_url"))},onReset:function(){this.$el.empty(),this.mediaStore&&this.mediaStore.clear()}});return i}),define("core/templates/postMediaUploadRich",["handlebars","core/templates/handlebars.partials","core/extensions/handlebars.helpers"],function(a){return a.template({1:function(a,b,c,d,e){var f;return a.escapeExpression(a.lambda(null!=(f=null!=b?b.media:b)?f.title:f,b))},3:function(a,b,c,d,e){return a.escapeExpression(c.gettext.call(null!=b?b:{},"Media attachment",{name:"gettext",hash:{},data:e}))},compiler:[7,">= 4.0.0"],main:function(a,b,c,d,e){var f,g=a.lambda,h=a.escapeExpression;return'
  • \n
    \n
    \n
    \n\n'+(null!=(f=c[\n\n
    \n
    \n
    \n
  • \n'},useData:!0})}),define("core/views/media/UploadsRichSubView",["underscore","backbone","core/models/Media","core/UniqueModel","core/utils","core/templates/postMediaUploadRich"],function(a,b,c,d,e,f){"use strict";var g=b.View.extend({initialize:function(){this._hasVisible=!1,this.collection=new b.Collection([],{model:c,comparator:"index"}),this.listenTo(this.collection,"add remove reset sort change:thumbnailUrl change:mediaType change:editsFinished",this.render),this.listenTo(this.collection,"change:index",a.bind(this.collection.sort,this.collection))},render:function(){return this.$el.empty(),this._hasVisible=!1,this.collection.each(function(b){b.get("thumbnailUrl")&&(a.contains(c.WEBPAGE_TYPES,b.get("mediaType"))||b.get("editsFinished")&&(this.$el.append(f({media:b.toJSON()})),this._hasVisible=!0))},this),this},hasVisible:function(){return this._hasVisible},addMedia:function(a){var b=d.get(c,a.url);if(b)b.set(a);else{if(!a.editsFinished)return;b=new d(c,a),b.fetch()}return this.collection.add(b),b},updateFromText:function(b,c,d){if(!b)return void this.collection.reset();var f=e.bleachFindUrls(b);f=a.uniq(f,!1,function(a){return a.url});var g={};a.each(f,function(e){g[e.url]=!0;var f=a.pick(e,"index","url"),h=e.index= 4.0.0"],main:function(a,b,c,d,e){return'
      \n
        \n
          \n
          \n'+a.escapeExpression(c.gettext.call(null!=b?b:{},\n
          \n'},useData:!0})}),define("core/views/media/UploadsView",["backbone","core/views/media/UploadsProgressSubView","core/views/media/UploadsLegacySubView","core/views/media/UploadsRichSubView","core/templates/postMediaUploads"],function(a,b,c,d,e){"use strict";var f=a.View.extend({initialize:function(a){this.legacyView=new c({mediaStorageKey:a.mediaStorageKey}),this.legacy=this.legacyView.collection,this.richView=new d,this.rich=this.richView.collection,this.uploadProgressView=new b,this.uploadProgress=this.uploadProgressView.collection,this.listenTo(this.legacy,"all",this._updateEmpty),this.listenTo(this.rich,"all",this._updateEmpty),this.listenTo(this.uploadProgress,"all",this._updateEmpty)},render:function(){return this.legacyView.$el.detach(),this.richView.$el.detach(),this.uploadProgressView.$el.detach(),this.$el.html(e()),this._updateEmpty(),this.legacyView.setElement(this.$("[data-role=media-legacy-list]")[0]),this.richView.setElement(this.$("[data-role=media-rich-list]")[0]),this.uploadProgressView.setElement(this.$("[data-role=media-progress-list]")[0]),this},clear:function(){this.legacy.reset(),this.rich.reset(),this.uploadProgress.reset()},_updateEmpty:function(){this.legacyView.hasVisible()||this.richView.hasVisible()||this.uploadProgressView.hasVisible()?this.$el.removeClass("empty"):this.$el.addClass("empty")}});return f}),define("core/mixins/withUploadForm",["underscore","backbone","core/strings","core/utils","core/utils/media/upload","core/utils/storage","core/views/media/DragDropUploadView","core/views/media/UploadButtonView","core/views/media/UploadsView"],function(a,b,c,d,e,f,g,h,i){"use strict";var j=c.get,k=function(){a.defaults(this,k.bothProto,k.uploadsProto,k.previewsProto)};return k.previewsProto={initMediaPreviews:function(b,c,d){this.mediaUploadsView=new i({el:b[0],mediaStorageKey:c}),this.mediaUploadsView.render(),this.updateLiveMediaDebounced=a.partial(a.debounce(this.updateLiveMedia,500),d,!1),this.listenTo(d,{keychange:this.updateLiveMediaDebounced,paste:function(b,c){c&&c.fake||a.defer(a.bind(this.updateLiveMedia,this,d,!0))}}),this.updateLiveMedia(d,!0)},clearMediaPreviews:function(){this.mediaUploadsView&&this.mediaUploadsView.clear()},updateLiveMedia:function(a,b){if(this.mediaUploadsView){var c=a.get(),d=a.offset();this.mediaUploadsView.richView.updateFromText(c,d,{isPasteEvent:b})}}},k.uploadsProto={initMediaUploads:function(a,b,c){this.mediaDragDropView=new g({el:b[0]}),this.listenTo(this.mediaDragDropView,{"uploader:attachMedia":function(){f.set("usedDragDrop",1),this.handleAttachMedia.apply(this,arguments)},"uploader:dragEnter":function(){this.$el.addClass("expanded")},"uploader:showPlaceholder":function(){a.show()},"uploader:hidePlaceholder":function(){a.hide()},"uploader:dropError":function(){var a=j("Sorry we didn't catch that. Try again?");this.alert(a,{type:"error",isUploadError:!0})}}),this.mediaUploadButtonView=new h({el:c[0]}),this.listenTo(this.mediaUploadButtonView,{"uploader:attachMedia":this.handleUploadViaButton}),this.mediaUploadButtonView.render()},handleUploadViaButton:function(a){if(a&&f.isPersistent&&!f.get("usedDragDrop")&&!d.isMobileUserAgent()){var b=this.alert(j("Did you know you can drag and drop images too? Try it now!"));this.listenToOnce(b,"dismiss",function(){f.set("usedDragDrop",1)})}this.handleAttachMedia.apply(this,arguments)},handleAttachMedia:function(c,d){var f=this,g=new b.Model({remainingPerc:100});f.mediaUploadsView.uploadProgress.add(g),d=a.extend(d||{},{onProgress:function(a){g.set("remainingPerc",100-a)}});var h;h=a.result(f,"areUploadUrlsEnabled")?e.uploadMediaUrl(c,d).then(function(a){a.fetch(),f.textarea.insertAtCursor(a.get("url")),f.updateLiveMedia(f.textarea,!0),f.dismissUploadError()}).otherwise(function(){var a=j("Unfortunately your image upload failed. Please verify that your image is in a supported format (JPEG, PNG, or GIF). If you continue seeing this error, please try again later.");f.alert(a,{type:"error",isUploadError:!0})}):e.uploadMedia(c,d).then(function(a){f.mediaUploadsView.legacy.add(a),f.dismissUploadError()}).otherwise(function(){var a=j("Unfortunately your image upload failed. Please verify that your image is under 2MB. If you continue seeing this error, please try again later.");f.alert(a,{type:"error",isUploadError:!0})}),h.always(function(){f.mediaUploadsView.uploadProgress.remove(g)})},dismissUploadError:function(){this.dismissAlert(function(a){return a.options&&a.options.isUploadError})},uploadSupported:e.uploadSupported,isUploadInProgress:function(){return this.mediaUploadsView&&this.mediaUploadsView.uploadProgress.length},getMediaUploadTokens:function(){return this.mediaUploadsView?this.mediaUploadsView.legacy.pluck("token"):[]}},k.bothProto={initMediaViews:function(a){a.allowMedia&&this.initMediaPreviews(this.$("[data-role=media-preview]"),a.storageKey,a.textarea),a.allowUploads&&this.initMediaUploads(this.$("[data-role=drag-drop-placeholder]"),this.$("[data-role=textarea]"),this.$("[data-role=media-uploader]"))}},k}),define("core/editable",[],function(){"use strict";function a(a){return a.replace(f," ")}function b(c,d,e){var f,g,i,j,k="",l=[];for("string"!=typeof e&&(e="\n\n"),j=0;jb;b++)c=g[b],e=this.createParagraph(c),f.appendChild(e);f.lastChild.appendChild(d.createElement("br")),this.elem.innerHTML="",this.elem.appendChild(f);var i=window.getSelection&&window.getSelection();i&&i.anchorNode===this.elem&&i.modify&&i.modify("move","forward","line")},createParagraph:function(a){var b,c,e,f,g,h,i,j=d.createElement("p");for(e=a.split(/\r\n|\r|\n/),c=0,g=e.length;g>c;c++){for(f=e[c],i=this.getHtmlElements(f),b=0,h=i.length;h>b;b++)j.appendChild(i[b]);j.appendChild(d.createElement("br"))}return j.lastChild&&j.removeChild(j.lastChild),j},getHtmlElements:function(a){return[d.createTextNode(a)]},plainTextReformat:function(){if(!(this.elem.getElementsByTagName("p").length<=1)){this.emulateTextarea=!1;var a=this.text();this.emulateTextarea=!0,this.setText(a)}},removeNode:function(a){var b,c,e;window.getSelection?(b=a.previousSibling,a.parentNode.removeChild(a),c=window.getSelection(),e=d.createRange(),b&&(e.setStart(b,b.length),e.setEnd(b,b.length)),c.addRange(e)):a.parentNode.removeChild(a)},selectedTextNode:function(){var b,c,f,g,h,i,j,k,l,m=this.elem;if(window.getSelection)return b=window.getSelection(),b.anchorNode;if(d.selection.createRange){for(c=d.selection.createRange().duplicate();-1e3===c.moveStart(e,-1e3);)continue;var n=c.text;for(k=0;k-1)i=g,n=n.replace(j,"");else if(j.indexOf(n)>-1)return g;return i}},selectedTextNodeOffset:function(b){var c,f,g;if(window.getSelection){var h=window.getSelection();h&&h.anchorOffset&&(g=h.anchorOffset)}else if(b&&d.selection.createRange){var i=a(b.nodeValue);c=d.selection.createRange();var j=c.duplicate(),k=j.parentElement();for(f=0;0!==c.moveStart(e,-1)&&(0!==i.indexOf(a(c.text))&&k===c.parentElement());f++)j=c.duplicate(),k=j.parentElement();g=f}return isNaN(g)?0:g},offset:function(){function b(d,e){function f(a){i+=a[0];for(var b=1;b0&&h.moveStart(e,l+2),h.collapse()}for(;-1===h.moveStart(e,-1)&&0!==j.indexOf(a(h.text));)continue;for(;1===h.moveEnd(e,1)&&j!==a(h.text);)continue;return h.moveStart(e,c),h.moveEnd(e,-1*(f-c-h.text.length)),h.select(),h}}},j.normalizeSpace=a,j}),define("core/CappedStorage",["core/utils/storage"],function(a){"use strict";var b=function(a,b){this.max=a||10,this.queueKey=b||"__queue",this.getQueue()||this.setQueue([])};return b.prototype.set=function(b,c){var d=this.getQueue()||this.setQueue([]);d.length===this.max&&a.remove(d.shift()),a.set(b,c),d.push(b),this.setQueue(d)},b.prototype.get=function(b){return a.get(b)},b.prototype.remove=function(b){a.remove(b);for(var c=this.getQueue()||[],d=0;d":"\n",g=c.height(),h=function(){var d={};b.each(d,function(a,b){d[b]=c.css(b)});var e=a(c[0].cloneNode(!0));return e.removeAttr("id").removeAttr("name").css({visibility:"hidden",position:"absolute",top:"-9999px",left:"-9999px",contentEditable:!1}).css(d).attr("tabIndex","-1"),e.insertAfter(c[0]),e}(),i=null,j=function(){h[0].style.height=0,h[e](c[e]()+f),h.scrollTop(h[0].scrollHeight);var a=Math.max(h[0].scrollHeight,g)+parseInt(d.extraSpace,10);d.maxHeight&&(a>=d.maxHeight?(c.css("overflow",""),a=d.maxHeight):c.css("overflow","hidden")),i!==a&&(i=a,c.height(a),c.trigger&&c.trigger("resize"))},k=b.throttle(j,500),l=function(a){13===a.keyCode?j():k()};c.bind("keyup",l).bind("paste",j).css("overflow","hidden"),j()})},a}),define("core/views/TextareaView",["underscore","jquery","backbone","core/utils","core/CappedStorage","core/extensions/jquery.autoresize"],function(a,b,c,d,e){"use strict";var f=c.View.extend({events:{"keydown [data-role=editable]":"handleKeyDown","keyup [data-role=editable]":"handleKeyUp","paste [data-role=editable]":"handlePaste","focusin [data-role=editable]":"handleFocusIn","blur [data-role=editable]":"handleBlur"},initialize:function(b){b=b||{},this.storageKey=b.storageKey,this.value=b.value||this.getDraft()[0],this.placeholder=b.placeholder,this.listenTo(this,"keychange",a.debounce(this.saveDraft,this.constructor.SAVE_DRAFT_INTERVAL))},render:function(){return this.$input=this.createInput(),this.set(this.value),this.$el.append(this.$input),this.$input.autoresize({maxHeight:this.constructor.MAX_TEXTAREA_HEIGHT}),this},createInput:function(){return b("