/* YUI 3.17.2 (build 9c3c78e) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add("scrollview-base",function(e,t){function F(){F.superclass.constructor.apply(this,arguments)}var n=e.ClassNameManager.getClassName,r=e.config.doc,i=e.UA.ie,s=e.Transition.useNative,o=e.Transition._VENDOR_PREFIX,u="scrollview",a={vertical:n(u,"vert"),horizontal:n(u,"horiz")},f="scrollEnd",l="flick",c="drag",h="mousewheel",p="ui",d="top",v="left",m="px",g="axis",y="scrollY",b="scrollX",w="bounce",E="disabled",S="deceleration",x="x",T="y",N="boundingBox",C="contentBox",k="gesturemove",L="start",A="end",O="",M="0s",_="snapDuration",D="snapEasing",P="easing",H="frameDuration",B="bounceRange",j=function(e,t,n){return Math.min(Math.max(e,t),n)};e.ScrollView=e.extend(F,e.Widget,{_forceHWTransforms:e.UA.webkit?!0:!1,_prevent:{start:!1,move:!0,end:!1},lastScrolledAmt:0,_minScrollX:null,_maxScrollX:null,_minScrollY:null,_maxScrollY:null,initializer:function(){var e=this;e._bb=e.get(N),e._cb=e.get(C),e._cAxis=e.get(g),e._cBounce=e.get(w),e._cBounceRange=e.get(B),e._cDeceleration=e.get(S),e._cFrameDuration=e.get(H)},bindUI:function(){var e=this;e._bindFlick(e.get(l)),e._bindDrag(e.get(c)),e._bindMousewheel(!0),e._bindAttrs(),i&&e._fixIESelect(e._bb,e._cb),F.SNAP_DURATION&&e.set(_,F.SNAP_DURATION),F.SNAP_EASING&&e.set(D,F.SNAP_EASING),F.EASING&&e.set(P,F.EASING),F.FRAME_STEP&&e.set(H,F.FRAME_STEP),F.BOUNCE_RANGE&&e.set(B,F.BOUNCE_RANGE)},_bindAttrs:function(){var e=this,t=e._afterScrollChange,n=e._afterDimChange;e.after({scrollEnd:e._afterScrollEnd,disabledChange:e._afterDisabledChange,flickChange:e._afterFlickChange,dragChange:e._afterDragChange,axisChange:e._afterAxisChange,scrollYChange:t,scrollXChange:t,heightChange:n,widthChange:n})},_bindDrag:function(t){var n=this,r=n._bb;r.detach(c+"|*"),t&&r.on(c+"|"+k+L,e.bind(n._onGestureMoveStart,n))},_bindFlick:function(t){var n=this,r=n._bb;r.detach(l+"|*"),t&&(r.on(l+"|"+l,e.bind(n._flick,n),t),n._bindDrag(n.get(c)))},_bindMousewheel:function(t){var n=this,i=n._bb;i.detach(h+"|*"),t&&e.one(r).on(h,e.bind(n._mousewheel,n))},syncUI:function(){var e=this,t=e._getScrollDims(),n=t.offsetWidth,r=t.offsetHeight,i=t.scrollWidth,s=t.scrollHeight;e._cAxis===undefined&&(e._cAxis={x:i>n,y:s>r},e._set(g,e._cAxis)),e.rtl=e._cb.getComputedStyle("direction")==="rtl",e._cDisabled=e.get(E),e._uiDimensionsChange(),e._isOutOfBounds()&&e._snapBack()},_getScrollDims:function(){var e=this,t=e._cb,n=e._bb,r=F._TRANSITION,i=e.get(b),o=e.get(y),u,a;return s&&(t.setStyle(r.DURATION,M),t.setStyle(r.PROPERTY,O)),u=e._forceHWTransforms,e._forceHWTransforms=!1,e._moveTo(t,0,0),a={offsetWidth:n.get("offsetWidth"),offsetHeight:n.get("offsetHeight"),scrollWidth:n.get("scrollWidth"),scrollHeight:n.get("scrollHeight")},e._moveTo(t,-i,-o),e._forceHWTransforms=u,a},_uiDimensionsChange:function(){var e=this,t=e._bb,n=e._getScrollDims(),r=n.offsetWidth,i=n.offsetHeight,s=n.scrollWidth,o=n.scrollHeight,u=e.rtl,f=e._cAxis,l=u?Math.min(0,-(s-r)):0,c=u?0:Math.max(0,s-r),h=0,p=Math.max(0,o-i);f&&f.x&&t.addClass(a.horizontal),f&&f.y&&t.addClass(a.vertical),e._setBounds({minScrollX:l,maxScrollX:c,minScrollY:h,maxScrollY:p})},_setBounds:function(e){var t=this;t._minScrollX=e.minScrollX,t._maxScrollX=e.maxScrollX,t._minScrollY=e.minScrollY,t._maxScrollY=e.maxScrollY},_getBounds:function(){var e=this;return{minScrollX:e._minScrollX,maxScrollX:e._maxScrollX,minScrollY:e._minScrollY,maxScrollY:e._maxScrollY}},scrollTo:function(t,n,r,i,o){if(this._cDisabled)return;var u=this,a=u._cb,f=F._TRANSITION,l=e.bind(u._onTransEnd,u),c=0,h=0,g={},w;r=r||0,i=i||u.get(P),o=o||a,t!==null&&(u.set(b,t,{src:p}),c=-t),n!==null&&(u.set(y,n,{src:p}),h=-n),w=u._transform(c,h),s&&o.setStyle(f.DURATION,M).setStyle(f.PROPERTY,O),r===0?s?o.setStyle("transform",w):(t!==null&&o.setStyle(v,c+m),n!==null&&o.setStyle(d,h+m)):(g.easing=i,g.duration=r/1e3,s?g.transform=w:(g.left=c+m,g.top=h+m),o.transition(g,l))},_transform:function(e,t){var n="translate("+e+"px, "+t+"px)";return this._forceHWTransforms&&(n+=" translateZ(0)"),n},_moveTo:function(e,t,n){s?e.setStyle("transform",this._transform(t,n)):(e.setStyle(v,t+m),e.setStyle(d,n+m))},_onTransEnd:function(){var e=this;e._isOutOfBounds()?e._snapBack():e.fire(f)},_onGestureMoveStart:function(t){if(this._cDisabled)return!1;var n=this,r=n._bb,i=n.get(b),s=n.get(y),o=t.clientX,u=t.clientY;n._prevent.start&&t.preventDefault(),n._flickAnim&&(n._cancelFlick(),n._onTransEnd()),n.lastScrolledAmt=0,n._gesture={axis:null,startX:i,startY:s,startClientX:o,startClientY:u,endClientX:null,endClientY:null,deltaX:null,deltaY:null,flick:null,onGestureMove:r.on(c+"|"+k,e.bind(n._onGestureMove,n)),onGestureMoveEnd:r.on(c+"|"+k+A,e.bind(n._onGestureMoveEnd,n))}},_onGestureMove:function(e){var t=this,n=t._gesture,r=t._cAxis,i=r.x,s=r.y,o=n.startX,u=n.startY,a=n.startClientX,f=n.startClientY,l=e.clientX,c=e.clientY;t._prevent.move&&e.preventDefault(),n.deltaX=a-l,n.deltaY=f-c,n.axis===null&&(n.axis=Math.abs(n.deltaX)>Math.abs(n.deltaY)?x:T),n.axis===x&&i?t.set(b,o+n.deltaX):n.axis===T&&s&&t.set(y,u+n.deltaY)},_onGestureMoveEnd:function(e){var t=this,n=t._gesture,r=n.flick,i=e.clientX,s=e.clientY,o;t._prevent.end&&e.preventDefault(),n.endClientX=i,n.endClientY=s,n.onGestureMove.detach(),n.onGestureMoveEnd.detach(),r||n.deltaX!==null&&n.deltaY!==null&&(o=t._isOutOfBounds(),o?t._snapBack():(!t.pages||t.pages&&!t.pages.get(g)[n.axis])&&t._onTransEnd())},_flick:function(e){if(this._cDisabled)return!1;var t=this,n=t._cAxis,r=e.flick,i=r.axis,s=r.velocity,o=i===x?b:y,u=t.get(o);t._gesture&&(t._gesture.flick=r),n[i]&&t._flickFrame(s,i,u)},_flickFrame:function(t,n,r){var i=this,s=n===x?b:y,o=i._getBounds(),u=i._cBounce,a=i._cBounceRange,f=i._cDeceleration,l=i._cFrameDuration,c=t*f,h=r-l*c,p=n===x?o.minScrollX:o.minScrollY,d=n===x?o.maxScrollX:o.maxScrollY,v=h
p,w=h>d,E=h