// Last commit: 0bff5bc (2014-04-26 12:06:07 -0500) // Copyright: ©2012-2013 Erik Bryn, Yapp Inc., and contributors. !function(){function e(e,t){return e&&t&&e.x===t.x&&e.y===t.y}function t(){var t,n,r;Ember.instrument("view.updateContext.positionElement",this,function(){t=i(this,"element"),n=this.position,r=this._position,n&&t&&(e(n,r)||(Ember.run.schedule("render",this,this._parentView.applyTransform,t,n.x,n.y),this._position=n))},this)}var i=Ember.get;Ember.set,Ember.ListItemViewMixin=Ember.Mixin.create({init:function(){this._super(),this.one("didInsertElement",t)},classNames:["ember-list-item-view"],_position:null,updatePosition:function(e){this.position=e,this._positionElement()},_positionElement:t})}(),function(){function e(e){e.willInsertElement&&e.willInsertElement()}function t(e){e.didInsertElement&&e.didInsertElement()}function i(){var i,o,l,h;i=n(this,"element"),i&&(l=n(this,"context"),this.triggerRecursively("willClearRender"),this.lengthAfterRender>this.lengthBeforeRender&&(this.clearRenderedChildren(),this._childViews.length=this.lengthBeforeRender),l?(o=Ember.RenderBuffer(),o=this.renderToBuffer(o),h=this._childViews.length>0,h&&this.invokeRecursively(e,!1),i.innerHTML=o.innerString?o.innerString():s(o),r(this,"element",i),this.transitionTo("inDOM"),h&&this.invokeRecursively(t,!1)):i.innerHTML="")}var n=Ember.get,r=Ember.set,s=function(e){var t=[],i=e.childBuffers;return Ember.ArrayPolyfills.forEach.call(i,function(e){var i="string"==typeof e;i?t.push(e):e.array(t)}),t.join("")};Ember.ListItemView=Ember.View.extend(Ember.ListItemViewMixin,{updateContext:function(e){var t=n(this,"context");Ember.instrument("view.updateContext.render",this,function(){t!==e&&(r(this,"context",e),e&&e.isController&&r(this,"controller",e))},this)},rerender:function(){Ember.run.scheduleOnce("render",this,i)},_contextDidChange:Ember.observer(i,"context","controller")})}(),function(){var e=Ember.get,t=Ember.set;Ember.ReusableListItemView=Ember.View.extend(Ember.ListItemViewMixin,{init:function(){this._super();var e=Ember.ObjectProxy.create();this.set("context",e),this._proxyContext=e},isVisible:Ember.computed("context.content",function(){return!!this.get("context.content")}),updateContext:function(i){var n=e(this._proxyContext,"content");n!==i&&("inDOM"===this.state&&this.prepareForReuse(i),t(this._proxyContext,"content",i),i&&i.isController&&t(this,"controller",i))},prepareForReuse:Ember.K})}(),function(){function e(e){if(e in i)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),r=0;r'),this._super(e),e.push("")},willInsertElement:function(){if(!this.get("height")||!this.get("rowHeight"))throw new Error("A ListView must be created with a height and a rowHeight.");this._super()},style:Ember.computed("height","width",function(){var e,t,i,n;e=l(this,"height"),t=l(this,"width"),n=l(this,"css"),i="",e&&(i+="height:"+e+"px;"),t&&(i+="width:"+t+"px;");for(var r in n)n.hasOwnProperty(r)&&(i+=r+":"+n[r]+";");return i}),scrollTo:function(){throw new Error("must override to perform the visual scroll and effectively delegate to _scrollContentTo")},_scrollTo:Ember.K,_scrollContentTo:function(e){var t,i,n,r,s,o,h;if(o=a(0,e),this.scrollTop!==o){var u=a(0,l(this,"totalHeight")-l(this,"height"));o=c(o,u),h=l(this,"content"),s=l(h,"length"),t=this._startingIndex(s),Ember.instrument("view._scrollContentTo",{scrollTop:o,content:h,startingIndex:t,endingIndex:c(a(s-1,0),t+this._numChildViewsForViewport())},function(){return this.scrollTop=o,r=a(s-1,0),t=this._startingIndex(),n=t+this._numChildViewsForViewport(),i=c(r,n),t===this._lastStartingIndex&&i===this._lastEndingIndex?(this.trigger("scrollYChanged",e),void 0):(Ember.run(this,function(){this._reuseChildren(),this._lastStartingIndex=t,this._lastEndingIndex=i,this.trigger("scrollYChanged",e)}),void 0)},this)}},totalHeight:Ember.computed("content.length","rowHeight","columnCount","bottomPadding",function(){var e,t,i,n;return e=l(this,"content.length"),t=l(this,"rowHeight"),i=l(this,"columnCount"),n=l(this,"bottomPadding"),d(e/i)*t+n}),_prepareChildForReuse:function(e){e.prepareForReuse()},_reuseChildForContentIndex:function(e,t){var i,n,r,s;i=l(this,"content"),s=l(this,"enableProfiling"),r=this.positionForIndex(t),e.updatePosition(r),h(e,"contentIndex",t),s&&Ember.instrument("view._reuseChildForContentIndex",r,function(){},this),n=i.objectAt(t),e.updateContext(n)},positionForIndex:function(e){var t,i,n,r,s,o;return t=l(this,"elementWidth")||1,i=l(this,"width")||1,n=l(this,"columnCount"),r=l(this,"rowHeight"),s=r*u(e/n),o=e%n*t,{y:s,x:o}},_childViewCount:function(){var e,t;return e=l(this,"content.length"),t=this._numChildViewsForViewport(),c(e,t)},columnCount:Ember.computed("width","elementWidth",function(){var e,t,i;return e=l(this,"elementWidth"),t=l(this,"width"),i=e&&t>e?u(t/e):1}),columnCountDidChange:Ember.observer(function(){var e,t,i,n,r,s,o,h;s=this._lastColumnCount,t=this.scrollTop,o=l(this,"columnCount"),n=l(this,"maxScrollTop"),h=l(this,"element"),this._lastColumnCount=o,s&&(e=s/o,i=t*e,r=c(n,i),this._scrollTo(r),this.scrollTop=r),arguments.length>0&&Ember.run.schedule("afterRender",this,this._syncListContainerWidth)},"columnCount"),maxScrollTop:Ember.computed("height","totalHeight",function(){var e,t;return e=l(this,"totalHeight"),t=l(this,"height"),a(0,e-t)}),_isChildEmptyView:function(){var e=l(this,"emptyView");return e&&e instanceof Ember.View&&1===this._childViews.length&&0===this._childViews.indexOf(e)},_numChildViewsForViewport:function(){var e,t,i,n;return e=l(this,"height"),t=l(this,"rowHeight"),i=l(this,"paddingCount"),n=l(this,"columnCount"),d(e/t)*n+i*n},_startingIndex:function(e){var t,i,n,r,s,o;return s=void 0===e?l(this,"content.length"):e,t=this.scrollTop,i=l(this,"rowHeight"),n=l(this,"columnCount"),r=u(t/i)*n,o=a(s-1,0),c(r,o)},contentWillChange:Ember.beforeObserver(function(){var e;e=l(this,"content"),e&&e.removeArrayObserver(this)},"content"),contentDidChange:Ember.observer(function(){e.call(this),i.call(this)},"content"),needsSyncChildViews:Ember.observer(i,"height","width","columnCount"),_addItemView:function(){var e,t;e=l(this,"itemViewClass"),t=this.createChildView(e),this.pushObject(t)},_syncChildViews:function(){var e,i,n,r,h,c,a,u,d,f,p;if(!l(this,"isDestroyed")&&!l(this,"isDestroying")){if(u=l(this,"content.length"),d=l(this,"emptyView"),i=this._childViewCount(),e=this.positionOrderedChildViews(),this._isChildEmptyView()&&s.call(this),c=this._startingIndex(),a=c+i,r=i,n=e.length,p=r-n,0===p);else if(p>0)for(h=this._lastEndingIndex,f=0;p>f;f++,h++)this._addItemView(h);else m.call(e.splice(r,n),t,this);this._reuseChildren(),this._lastStartingIndex=c,this._lastEndingIndex=this._lastEndingIndex+p,(0===u||void 0===u)&&o.call(this)}},_syncListContainerWidth:function(){var e,t,i,n;e=l(this,"elementWidth"),t=l(this,"columnCount"),i=e*t,n=this.$(".ember-list-container"),i&&n&&n.css("width",i)},_reuseChildren:function(){var e,t,i,n,r,s,o,h,u,d,m;for(m=this.scrollTop,e=l(this,"content.length"),u=a(e-1,0),t=this.getReusableChildViews(),i=t.length,n=this._startingIndex(),h=n+this._numChildViewsForViewport(),r=c(u,h),d=c(h,n+i),o=n;d>o;o++)s=t[o%i],this._reuseChildForContentIndex(s,o)},getReusableChildViews:function(){return this._childViews},positionOrderedChildViews:function(){return this.getReusableChildViews().sort(n)},arrayWillChange:Ember.K,arrayDidChange:function(e,t){var n,r;s.call(this),"inDOM"===this.state&&((t>=this._lastStartingIndex||t .ember-list-container")[0]},willBeginScroll:function(e,t){this._isScrolling=!1,this.trigger("scrollingDidStart"),this.scroller.doTouchStart(e,t)},continueScroll:function(e,t){var i,n,r;this._isScrolling?this.scroller.doTouchMove(e,t):(i=this._scrollerTop,this.scroller.doTouchMove(e,t),n=this._scrollerTop,i!==n&&(r=Ember.$.Event("scrollerstart"),Ember.$(e[0].target).trigger(r),this._isScrolling=!0))},endScroll:function(e){this.scroller.doTouchEnd(e)},scrollTo:function(e,t){void 0===t&&(t=!0),this.scroller.scrollTo(0,e,t,1)},mouseWheel:function(e){var t,i,n;return t=e.webkitDirectionInvertedFromDevice,i=e.wheelDeltaY*(t?.8:-.8),n=this.scroller.__scrollTop+i,n>=0&&n<=this.scroller.__maxScrollTop&&(this.scroller.scrollBy(0,i,!0),e.stopPropagation()),!1}})}(),function(){Ember.Handlebars.registerHelper("ember-list",function(e){var t=e.hash,i=e.hashTypes;t.content=t.items,delete t.items,i.content=i.items,delete i.items,t.content||(t.content="this",i.content="ID");for(var n in t)if(/-/.test(n)){var r=Ember.String.camelize(n);t[r]=t[n],i[r]=i[n],delete t[n],delete i[n]}return Ember.Handlebars.helpers.collection.call(this,"Ember.ListView",e)})}(),"undefined"==typeof location||"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname||Ember.Logger.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. If you want full error messages please use the non-minified build provided on the Ember website.");