AdfRichUIPeer.createPeerClass(AdfRichUIPeer,"AdfDhtmlCarouselPeer",!1);
AdfDhtmlCarouselPeer.InitSubclass=function(){var a=AdfAgent.AGENT.getCapabilities()[AdfAgent.CAP_TOUCH_SCREEN];a&&a!=AdfAgent.CAP_TOUCH_SCREEN_NONE||AdfRichUIPeer.addDomEventHandlers(this,AdfDhtmlLookAndFeel.MOUSE_MOVE_EVENT_TYPE);AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.CLICK_EVENT_TYPE,AdfUIInputEvent.MOUSE_OUT_EVENT_TYPE,AdfUIInputEvent.MOUSE_DOWN_EVENT_TYPE,AdfUIInputEvent.MOUSE_UP_EVENT_TYPE,AdfUIInputEvent.KEY_DOWN_EVENT_TYPE);AdfRichUIPeer.addComponentPropertyChanges(this,
AdfRichCarousel.CURRENT_ITEM_KEY);this.MISSING_AFTER=1;this.MISSING_BEFORE=2;this.NO_BLOCKS=4;this.VIEWPORT_SATISFIED=0;this.DW_SUB_ID="dataW";this._ITEM_PADDING=10;this._MAX_PLACEHOLDERS_ON_ONE_SIDE=25;this._ROW_KEY="_afrRK";this._FETCH_MORE_ITEM_COUNT=5;this._FETCH_DELAY_TIMEOUT=300;this._INPUT_REGEXP=/^INPUT|SELECT|OPTION|BUTTON|^A\b|TEXTAREA/;this._NEEDS_REFRESH_ATTRIBUTE="_afrNdsRfr";this._UNDO_FETCH_ATTRIBUTE="_afrUndFch"};
AdfDhtmlCarouselPeer.prototype.InitDomElement=function(a,b){AdfDhtmlCarouselPeer.superclass.InitDomElement.call(this,a,b);if("yes"==b.getAttribute("data-nojs"))this._NO_JS=!0;else{this._SHRINK_FACTOR=a.getAuxiliaryScale();this._SHIFT_FACTOR=a.getAuxiliaryOffset();this._POP_OUT=a.getAuxiliaryPopOut();this._fetchId=0;this._unavailableRowIndex=-1;this._isVertical="vertical"==a.getOrientation();var d=AdfPage.PAGE.getLookAndFeel();this._useOpacity="none"!=d.getSkinProperty("af|carousel-tr-overlay-opacity");
this._popOutDuration=this._animDuration=0;this._animDuration=parseInt(d.getSkinProperty("af|carousel-tr-spin-animation-duration"),10);isNaN(this._animDuration)&&(this._animDuration=0);this._popOutDuration=parseInt(d.getSkinProperty("af|carousel-tr-pop-out-animation-duration"),10);isNaN(this._popOutDuration)&&(this._animDuration=0);this._setupInitialPositions(a,b);b.setAttribute("role","listbox")}};
AdfDhtmlCarouselPeer.prototype._setupInitialPositions=function(a,b){this._initiallyPositioned||(this._displayItems=a.getDisplayItems(),this._controlArea=a.getControlArea(),"small"==this._controlArea||"compact"==this._controlArea?this._setupInitialCompactOrSmallPositions(b,a.getClientId(),this._controlArea):"none"==this._controlArea?this._setupInitialNonePositions(b,a.getClientId()):this._setupInitialFullPositions(b,a.getClientId()))};
AdfDhtmlCarouselPeer.prototype._setupInitialFullPositions=function(a,b){var d=this._getItemTextDiv(b),e=this._getDataBody(a),f=this._getSpinInfoDiv(b),g=this._getSpinControlDiv(b),h=0,k;this._isVertical?(f.style.width="auto",k=15*f.offsetWidth,0!=k&&(this._initiallyPositioned=!0),f.style.width=k+"px",h+=k+4,AdfDhtmlCarouselPeer._isRTL()?g.style.left=h+"px":g.style.right=h+"px",k=AdfDomUtils.getFirstChildElement(g).offsetWidth,g.style.width=k+"px",h+=k,AdfDhtmlCarouselPeer._isRTL()?e.style.left=h+
"px":e.style.right=h+"px",this._nonDataBodySize=h,this._heightOfBoxUnderCurrentItem=d.offsetHeight):(f.style.height="auto",k=f.offsetHeight,0!=k&&(this._initiallyPositioned=!0),h+=k,g.style.bottom=h+"px",k=AdfDomUtils.getFirstChildElement(g).offsetHeight,g.style.height=k+"px",h+=k,d.style.left="0px",d.style.right="0px",d.style.bottom=h+"px",k=d.offsetHeight,h+=k,e.style.bottom=h+"px",this._nonDataBodySize=h)};
AdfDhtmlCarouselPeer.prototype._setupInitialNonePositions=function(a,b){var d=this._getItemTextDiv(b),e=d.offsetHeight,f=this._getDataBody(a);this._isVertical?(this._initiallyPositioned=!0,this._nonDataBodySize=0,this._heightOfBoxUnderCurrentItem=e):(this._initiallyPositioned=!0,d.style.left="0px",d.style.right="0px",d.style.bottom="10px",e+=10,f.style.bottom=e+"px",this._nonDataBodySize=e)};
AdfDhtmlCarouselPeer.prototype._setupInitialCompactOrSmallPositions=function(a,b,d){var e=AdfAgent.AGENT,f=this._getControlAreaDiv(a),g=e.getComputedStyle(f),h=parseInt(g.paddingLeft,10),k=parseInt(g.paddingRight,10),l=parseInt(g.paddingTop,10),g=parseInt(g.paddingBottom,10),m=this._getItemTextDiv(b),n=e.getComputedStyle(m),q=parseInt(n.paddingTop,10),r=parseInt(n.paddingBottom,10),n=e.getElementById(AdfRichUIPeer.CreateSubId(b,"sp")),e=e.getElementById(AdfRichUIPeer.CreateSubId(b,"sn"));a=this._getDataBody(a);
var t=0;"compact"!=d&&(d=this._getSpinInfoDiv(b),b=d.offsetHeight,t+=b,d.style.bottom=g+"px");b=m.offsetHeight;0!=b&&(this._initiallyPositioned=!0);b=Math.max(n.offsetHeight,b,e.offsetHeight);t+=b;d=AdfDhtmlCarouselPeer._isRTL();var u=n.style;u.top=l+"px";d?u.right=k+"px":u.left=h+"px";u=e.style;u.top=l+"px";d?u.left=h+"px":u.right=k+"px";m=m.style;m.top=l+"px";q=b-q-r;m.height=q+"px";m.lineHeight=q+"px";d?(m.right=k+n.offsetWidth+"px",m.left=h+e.offsetWidth+"px"):(m.left=h+n.offsetWidth+"px",m.right=
k+e.offsetWidth+"px");f.style.top="auto";f.style.height=t+"px";t=t+l+g;this._isVertical?(this._nonDataBodySize=0,this._heightOfBoxUnderCurrentItem=t):(f.style.bottom=AdfDhtmlCarouselPeer._ITEM_PADDING+"px",t+=AdfDhtmlCarouselPeer._ITEM_PADDING,a.style.bottom=t+"px",this._nonDataBodySize=t)};AdfDhtmlCarouselPeer.prototype.TruncateClientId=function(a,b,d,e){b=d.split(":");a=a.getClientId();a=AdfStrings.count(a,":")+1;(b=b[a])&&(isNaN(b)||e.push(a))};
AdfDhtmlCarouselPeer.prototype.ComponentRemoved=function(a){this._touchMoveManager&&this._touchMoveManager.unregister();this._stopAnimation(!0);this._removePlaceholders();AdfDhtmlCarouselPeer.superclass.ComponentRemoved.call(this,a)};AdfDhtmlCarouselPeer.prototype.needsChildVisibilityChanges=function(a){return!0};AdfDhtmlCarouselPeer.prototype.ChildVisibilityChanged=function(a,b,d){AdfPage.PAGE.addPartialTargets(this.getComponent());return!0};AdfDhtmlCarouselPeer.prototype.needsResizeNotify=function(a){return!this._NO_JS};
AdfDhtmlCarouselPeer.prototype._allRowsAvailableOnClient=function(a){var b=a.startRow+a.numRows,d=this._rowCount;return 0<d&&0==a.startRow&&b==d};
AdfDhtmlCarouselPeer.prototype.ResizeNotify=function(a,b,d,e){if(this._virtInitialized)a=this._getDataBody(),this._sizeDataBody(a,d,e),this._fillViewPort(a,!1);else if(this._isImmediateContentDelivery(this.getComponent())){a=this._getDataBody();this._unavailableRowIndex=this._getUnavailableRowIndex(a);d=a.childNodes;e=null;for(b=d.length-1;0<=b;b--){var f=d[b];if("DIV"==f.tagName&&null!=f.getAttribute("_startRow")){e=d[b];break}}null!=e&&0<e.childNodes.length?this._initVirtualization(e,!0):(this._addEmptyTextToDataBody(a,
a),this._isEmpty=!0)}else this._firstBlockRequested||(this._firstBlockRequested=!0,this._queueFetchEvent(!0,AdfCarouselDataFetchEvent.INITIAL_SUBTYPE,-1),AdfDhtmlCarouselPeer._setCursor(this._getDataBody(),"wait"),a=AdfPage.PAGE.getLookAndFeel().getTranslatedString("af_carousel.LABEL_FETCHING"),this._displayStatus(a))};
AdfDhtmlCarouselPeer.prototype.ReplaceDomElement=function(a,b){var d=a.id;if(0<d.indexOf(AdfDhtmlCarouselPeer.DW_SUB_ID)){var e=AdfAgent.AGENT,f=this._getDataBody(),g=AdfDhtmlCarouselPeer._findFirstChildByTagName(a,"DIV");this._unavailableRowIndex=this._getUnavailableRowIndex(a);var h=!1;if(this._virtInitialized){null==g&&(h=!0);for(var k=e.getIntAttribute(a,"_fetchId",-1),l=this._pendingFetch,m=b.firstChild;m;)this._unregisterNode(m),b.removeChild(m),m=b.firstChild;if(void 0!=l&&this._pendingId==
k){k=this._pendingRenderOnly;m=this._fetchIndex;this._cancelPendingFetch();if(e.getBooleanAttribute(a,AdfDhtmlCarouselPeer._NEEDS_REFRESH_ATTRIBUTE,!1)){AdfPage.PAGE.addPartialTargets(this.getComponent());return}if(e.getBooleanAttribute(a,AdfDhtmlCarouselPeer._UNDO_FETCH_ATTRIBUTE,!1)){l!=AdfCarouselDataFetchEvent.AT_INDEX_SUBTYPE&&l!=AdfCarouselDataFetchEvent.AFTER_KEY_SUBTYPE&&l!=AdfCarouselDataFetchEvent.BEFORE_KEY_SUBTYPE||this._undoSpin(a);AdfDhtmlCarouselPeer._setCursor(f,"");this._hideStatus();
return}a.removeChild(g);this._pruneKeyCache||(this._pruneKeyCache=e.getAttribute(g,"_pruneKeyCache",null));this._handleDataCallback(g,l,m,k);this._fillViewPort(f,!1,!k)}else this._addInvalidDataBlock(b,g,f)}else this._cancelPendingFetch(),g&&g.firstChild?(this._initVirtualization(g,!1),e.elementsAdded(g)):h=!0;h&&(this._virtInitialized?AdfLogger.LOGGER.severe("Empty data block received:"+d):this._addEmptyTextToDataBody(f,a))}else AdfDhtmlCarouselPeer.superclass.ReplaceDomElement.call(this,a,b)};
AdfDhtmlCarouselPeer.prototype.DomReplaceNotify=function(a){return 0<a.id.indexOf(AdfDhtmlCarouselPeer.DW_SUB_ID)?null:a};AdfDhtmlCarouselPeer.prototype._getUnavailableRowIndex=function(a){var b=-1,d=AdfAgent.AGENT,e=AdfDhtmlCarouselPeer._getChildBySubId(a,"unAvail");e&&(b=d.getIntAttribute(e,"_unavailableRowIndex",-1),a.removeChild(e));return b};
AdfDhtmlCarouselPeer.prototype._addEmptyTextToDataBody=function(a,b){if("oneByOne"==this._displayItems){var d=a.style;d.top="0px";d.bottom="0px";d.left="0px";d.right="0px"}var d=b.childNodes.length,e=a.ownerDocument,f=e.createElement("div");a.appendChild(f);var g=f.style;g.position="absolute";g.verticalAlign="middle";g.textAlign="center";g.left=g.right="0px";g.top="50%";e=e.createElement("div");f.appendChild(e);g=e.style;g.position="relative";AdfAgent.getAgent().getPlatform()!=AdfAgent.WEBKIT_PLATFORM&&
(g.top="-50%");for(f=0;f<d;f++)g=b.firstChild,b.removeChild(g),1==g.nodeType&&null!=g.getAttribute("_startRow")||e.appendChild(g);this._hideStatus();d=this.getComponent().getClientId();this._getItemTextDiv(d).style.display="none";"small"==this._controlArea||"compact"==this._controlArea?(d=this.getDomElement(),this._getControlAreaDiv(d).style.display="none"):"none"!=this._controlArea&&"oneByOne"==this._displayItems&&(this._getSpinControlDiv(d).style.display="none");this._isEmpty=!0;AdfDhtmlCarouselPeer._setCursor(a,
"")};
AdfDhtmlCarouselPeer.prototype._addInvalidDataBlock=function(a,b,d){var e=AdfAgent.AGENT,f=d.firstChild;d=f.startRow;var f=d+this._getNumberOfRows(f),g=e.getIntAttribute(b,"_startRow",0),h=g+b.childNodes.length,k=d==g&&f==h;if(k||g>=d&&g<f){for(var l=f-g,m=0;m<l;m++){var n=b.firstChild;this._updateFetchIntersectionItem(n,m,l,d,f,g,h);b.removeChild(n)}if(k)return}else if(h>=d&&h<f)for(k=h-d,l=0;l<k;l++)m=b.lastChild,this._updateFetchIntersectionItem(m,l,k,d,f,g,h),b.removeChild(m);a.appendChild(b);e.elementsAdded(b)};
AdfDhtmlCarouselPeer.prototype._updateFetchIntersectionItem=function(a,b,d,e,f,g,h){var k=AdfDomUtils.getFirstChildElement(a),l=k.id,m=AdfLogger.LOGGER;m.isLoggable(AdfLogger.FINE)&&m.fine("_addInvalidDataBlock: carousel fetch intersection item ("+b+":"+d+" "+e+"-"+f+" "+g+"-"+h+"): "+l);b=AdfPage.PAGE.findComponent(l);AdfAssert.assert(null!=b,"An existing intersection component could not be found to match the intersection node: "+l+" of "+a.innerHTML);b&&(a=b.getPeer(),a.bind(b),a=a.getDomElement(),
this._unregisterNode(a),a.parentNode.replaceChild(k,a),AdfAgent.AGENT.elementsAdded(k))};AdfDhtmlCarouselPeer.prototype._getFirstNonPlaceholder=function(a){a=a.childNodes;for(var b=0;b<a.length;b++){var d=a[b];if(!AdfDhtmlCarouselPeer._isPlaceholder(d))return d}return null};AdfDhtmlCarouselPeer.prototype._getLastNonPlaceholder=function(a){a=a.childNodes;for(var b=a.length-1;0<=b;b--){var d=a[b];if(!AdfDhtmlCarouselPeer._isPlaceholder(d))return d}return null};
AdfDhtmlCarouselPeer.prototype._getNumberOfRows=function(a){var b=0;a=a.childNodes;for(var d=0;d<a.length;d++)AdfDhtmlCarouselPeer._isPlaceholder(a[d])||++b;return b};AdfDhtmlCarouselPeer.prototype._getNumberOfLeadingPlaceholders=function(a){var b=0;a=a.childNodes;for(var d=0;d<a.length&&AdfDhtmlCarouselPeer._isPlaceholder(a[d]);d++)++b;return b};
AdfDhtmlCarouselPeer.prototype._initVirtualization=function(a,b){this._hideStatus();this._virtInitialized=!0;var d=AdfAgent.AGENT,e=d.getIntAttribute(a,"_startRow",0),f=this._getNumberOfRows(a),g=this.getComponent();this._updateComponentStartAndRowProperties(g,e,f);var h=this._getDataBody(),k=d.getIntAttribute(a,"_rowCount",-1);0==this._unavailableRowIndex?k=-1:0<this._unavailableRowIndex&&(k=this._unavailableRowIndex);this._rowCount=k;this._knownRowCount=-1==k?e+f:k;if(k=a.getAttribute("_currentItemKey"))g.setProperty("currentItemKey",
k,!1,AdfUIComponent.PROPAGATE_NEVER),this._currentItemKey=k;var l=this.getDomElement(),m=l.clientWidth,l=l.clientHeight;if(!b){for(var n=h.childNodes,q=n.length-1;0<=q;q--)h.removeChild(n[q]);h.appendChild(a)}a.startRow=e;a.numRows=f;g.getDisabled()||(e=this.getDomElement(),e.onmousewheel=AdfDhtmlCarouselPeer._handleMouseWheel,d.getPlatform()!=AdfAgent.IE_PLATFORM&&e.addEventListener("DOMMouseScroll",AdfDhtmlCarouselPeer._handleMouseWheel,!0),"none"!=this._controlArea&&(f=g.getClientId(),g=d.getElementById(AdfRichUIPeer.CreateSubId(f,
"sp")),f=d.getElementById(AdfRichUIPeer.CreateSubId(f,"sn")),d.addBubbleEventListener(g,"click",AdfDhtmlCarouselPeer._handlePreviousClick),d.addBubbleEventListener(f,"click",AdfDhtmlCarouselPeer._handleNextClick)),(g=d.getCapabilities()[AdfAgent.CAP_TOUCH_SCREEN])&&g!=AdfAgent.CAP_TOUCH_SCREEN_NONE&&(this._touchMoveManager=d.createTouchMoveManager(e,this.createCallback(this._handleTouchMovement),1),"hover"==this._POP_OUT&&this._touchMoveManager.setLongTouchEventCallback(this.createCallback(this._handleLongTouchEvent))));
h.onselectstart=this.createCallback(this._handleDataBodySelectStart);this._sizeDataBody(h,m,l);h.style.zIndex=1;this._fillViewPort(h,!1);k&&(this._needsResizeNotifyOnDisplayedChildren=!0,this._updateTextForNewCurrentItemKey(k))};AdfDhtmlCarouselPeer.prototype._handleLongTouchEvent=function(a){a&&a.target?this._updateHoverState(a.target):this._cleanUpHoverState()};AdfDhtmlCarouselPeer.prototype._handleTouchMovement=function(a,b){var d=a;this._isVertical&&(d=b);0!=d&&this._scrollByAmount(-d,!0)};
AdfDhtmlCarouselPeer.prototype.HandleDomMouseMove=function(a,b){if("hover"==this._POP_OUT&&"oneByOne"!=this._displayItems&&this._virtInitialized&&!this._duringThumbDrag&&!this._duringDataBodyDrag){var d=AdfAgent.AGENT.getEventTarget(b);this._updateHoverState(d)}};
AdfDhtmlCarouselPeer.prototype._updateHoverState=function(a){if(a&&!this._isEmpty){var b=this._getRowKeyAndRow(a,this.getDomElement());if(null!=b&&(a=b[0],b=b[1],null!=a))if(this._currentItemKey!=a&&null!=a){var d=this._findRowByKey(this._currentItemKey,!0);d?this._animateRowsForNewSelectedWrapperElement(d.row,null,!1,{hoverKey:a,hoverWrapper:b}):AdfLogger.LOGGER.severe('During _updateHoverState, a null rowData was found for "'+this._currentItemKey+'".')}else this._cleanUpHoverState()}};
AdfDhtmlCarouselPeer.prototype._cleanUpHoverState=function(){if(null!=this._lastHoverKey){var a=!0;this._currentItemKey==this._lastHoverKey&&(a=!1);this._lastHoverKey=null;a&&((a=this._findRowByKey(this._currentItemKey,!0))?this._animateRowsForNewSelectedWrapperElement(a.row,null,!1,{hoverKey:null,hoverWrapper:null}):AdfLogger.LOGGER.severe('During _cleanUpHoverState, a null rowData was found for "'+this._currentItemKey+'".'))}};
AdfDhtmlCarouselPeer.prototype.HandleComponentMouseOut=function(a){if(this._virtInitialized&&this._isOwnComponentEvent(a))if(this._incrementMouseHoldMode){var b=a.getNativeEvent();a=AdfAgent.AGENT;var b=a.getEventTarget(b),d=this.getComponent().getClientId(),e=a.getElementById(AdfRichUIPeer.CreateSubId(d,"sp"));a=a.getElementById(AdfRichUIPeer.CreateSubId(d,"sn"));if(b.id==e.id||b.id==a.id)self.clearInterval(this._incrementMouseHoldTimerId),this._incrementMouseHoldMode=this._incrementMouseHoldTimerId=
null}else this._cleanUpHoverState()};
AdfDhtmlCarouselPeer.prototype.HandleComponentMouseUp=function(a){if(this._virtInitialized&&this._isOwnComponentEvent(a)&&this._incrementMouseHoldMode){a=a.getNativeEvent();var b=AdfAgent.AGENT,d=b.getEventTarget(a),e=this.getComponent().getClientId(),f=b.getElementById(AdfRichUIPeer.CreateSubId(e,"sp")),e=b.getElementById(AdfRichUIPeer.CreateSubId(e,"sn"));if(d.id==f.id||d.id==e.id)self.clearInterval(this._incrementMouseHoldTimerId),this._incrementMouseHoldMode=this._incrementMouseHoldTimerId=null,
b.eatEvent(a)}};
AdfDhtmlCarouselPeer.prototype.HandleComponentMouseDown=function(a){if(this._virtInitialized&&this._isOwnComponentEvent(a)){var b=a.getNativeEvent(),d=AdfAgent.AGENT;a=d.getEventTarget(b);if(d.isLeftButton(b)){if(a&&a.id){var e=this.getComponent().getClientId();if("none"!=this._controlArea){if("small"!=this._controlArea&&"compact"!=this._controlArea){var f=d.getElementById(AdfRichUIPeer.CreateSubId(e,"st"));a.id==f.id&&(d.eatEvent(b),this._duringThumbDrag=!0,AdfPage.PAGE.startDrag(b,this.createCallback(this._handleThumbDragPositioning),
this.createCallback(this._finishThumbDrag)))}f=d.getElementById(AdfRichUIPeer.CreateSubId(e,"sp"));e=d.getElementById(AdfRichUIPeer.CreateSubId(e,"sn"));if(a.id==f.id||a.id==e.id){b="prev";a.id==e.id&&(b="next");this._incrementMouseHoldMode=b;this._incrementMouseHoldTimerId=self.setInterval(this.createCallback(this._initMouseHoldIncrementRepeat),1E3);return}}}e=this._getDataBody();AdfDomUtils.isAncestorOrSelf(e,a)&&this._currentItemKey&&(e=this._findRowByKey(this._currentItemKey,!1),null==e||AdfDomUtils.isAncestorOrSelf(e.row,
a)||(d.eatEvent(b),this._duringDataBodyDrag=!0,AdfPage.PAGE.startDrag(b,this.createCallback(this._handleDataBodyDragPositioning),this.createCallback(this._finishDataBodyDrag))))}}};AdfDhtmlCarouselPeer.prototype._initMouseHoldIncrementRepeat=function(){self.clearInterval(this._incrementMouseHoldTimerId);this._incrementMouseHoldTimerId=self.setInterval(this.createCallback(this._incrementCarouselPosition),100)};
AdfDhtmlCarouselPeer.prototype._incrementCarouselPosition=function(){"prev"==this._incrementMouseHoldMode?this._initiateSpinPreviousAnimation():"next"==this._incrementMouseHoldMode&&this._initiateSpinNextAnimation()};
AdfDhtmlCarouselPeer.prototype._handleThumbDragPositioning=function(a,b,d){b=AdfAgent.AGENT;d=this.getComponent();if(null!=d){d=d.getClientId();d=b.getElementById(AdfRichUIPeer.CreateSubId(d,"sb"));var e=b.getMousePosition(a);this._isVertical?(a=d.offsetHeight,b=b.getElementTop(d)+a-e.y,b=1-b/a,this._updateTransientDragPosition(b),this._initiateSpinPercentAnimation(b)):(a=e.x-b.getElementLeft(d),a/=d.offsetWidth,AdfDhtmlCarouselPeer._isRTL()&&(a=1-a),this._updateTransientDragPosition(a),this._initiateSpinPercentAnimation(a))}};
AdfDhtmlCarouselPeer.prototype._finishThumbDrag=function(a,b,d){delete this._duringThumbDrag;this._handleThumbDragPositioning(a,b,d)};AdfDhtmlCarouselPeer.prototype._handleDataBodyDragPositioning=function(a,b,d){a=b;this._isVertical&&(a=d);0!=a&&this._scrollByAmount(-a,!0)};AdfDhtmlCarouselPeer.prototype._finishDataBodyDrag=function(a,b,d){delete this._duringDataBodyDrag;this._queuedScrollAmount=null};
AdfDhtmlCarouselPeer.prototype._getRowIndexFromThumbPos=function(){var a=AdfAgent.AGENT,b=this.getComponent().getClientId();if("small"==this._controlArea||"compact"==this._controlArea||"none"==this._controlArea)a=this._getCurrentPercent();else{var d=a.getElementById(AdfRichUIPeer.CreateSubId(b,"st")),b=a.getElementById(AdfRichUIPeer.CreateSubId(b,"sb"));if(this._isVertical)var e=b.offsetHeight,a=a.getElementTop(b)+e-a.getElementTop(d),a=1-a/e;else a=a.getElementLeft(d)-a.getElementLeft(b),a/=b.offsetWidth,
AdfDhtmlCarouselPeer._isRTL()&&(a=1-a)}d=this._rowCount;-1==d&&(d=this._knownRowCount+AdfDhtmlCarouselPeer._FETCH_MORE_ITEM_COUNT);return Math.max(0,Math.round(a*(d-1)))};
AdfDhtmlCarouselPeer.prototype.HandleComponentClick=function(a){if(this._isOwnComponentEvent(a)){var b=AdfAgent.AGENT,d=a.getNativeEvent(),e=b.getEventTarget(d);if(e&&!this._isEmpty){var f=this._getRowKeyAndRow(e,this.getDomElement());null!=f?(b=f[0],e=f[1],null!=b&&a.isLeftButtonPressed()&&this._handleItemClick(d,b,e)):"small"!=this._controlArea&&"compact"!=this._controlArea&&"none"!=this._controlArea&&(f=this.getComponent().getClientId(),a=b.getElementById(AdfRichUIPeer.CreateSubId(f,"sb")),e.id==
a.id&&(d=b.getMousePosition(d),b.getElementById(AdfRichUIPeer.CreateSubId(f,"st")).focus(),this._isVertical?(e=a.offsetHeight,b=b.getElementTop(a)+e-d.y,this._initiateSpinPercentAnimation(1-b/e,this._getCurrentPercent())):(b=d.x-b.getElementLeft(a),b/=a.offsetWidth,AdfDhtmlCarouselPeer._isRTL()&&(b=1-b),this._initiateSpinPercentAnimation(b,this._getCurrentPercent()))))}}};
AdfDhtmlCarouselPeer.prototype._fillViewPort=function(a,b,d){var e=AdfDhtmlCarouselPeer.VIEWPORT_SATISFIED;if(0<this._knownRowCount){var e=this._isViewportSatisfied(a),f=0!=(e&AdfDhtmlCarouselPeer.MISSING_BEFORE),g=0!=(e&AdfDhtmlCarouselPeer.MISSING_AFTER);e==AdfDhtmlCarouselPeer.VIEWPORT_SATISFIED?(this._hideStatus(),AdfDhtmlCarouselPeer._setCursor(a,"")):f?this._addBefore(a,b,d):g&&this._addAfter(a,b,d)}return e};
AdfDhtmlCarouselPeer.prototype._isViewportSatisfied=function(a){var b=a.firstChild;a=AdfDhtmlCarouselPeer.NO_BLOCKS;if(b&&(a=AdfDhtmlCarouselPeer.VIEWPORT_SATISFIED,!this._allRowsAvailableOnClient(b))){var d=this._isVertical,e=this._findRowByKey(this._currentItemKey,!0);if(!e)return AdfLogger.LOGGER.severe('When checking _isViewportSatisfied, a null rowData was found for "'+this._currentItemKey+'".'),AdfDhtmlCarouselPeer.VIEWPORT_SATISFIED;var e=e.index,f=b.startRow-1,b=b.startRow+this._getNumberOfRows(b),
g=this._rowCount;-1==g&&(g=this._knownRowCount+AdfDhtmlCarouselPeer._FETCH_MORE_ITEM_COUNT);if("oneByOne"==this._displayItems)0<=f&&f==e-1&&(a|=AdfDhtmlCarouselPeer.MISSING_BEFORE),b<g&&b==e+1&&(a|=AdfDhtmlCarouselPeer.MISSING_AFTER);else{var h=this.getComponent(),k=this._dataBodyWidth,l=this._dataBodyHeight,m=h.getHalign(),h=h.getValign();0<=f&&(f=this._getAuxShiftSizeAndOpacity(e-f),5<f.auxSize&&(d&&0<this._getValignTop(d,h,l,f.auxSize,-f.auxShift)||!d&&0<this._getHalignLeft(d,m,k,f.auxSize,-f.auxShift))&&
(a|=AdfDhtmlCarouselPeer.MISSING_BEFORE));b<g&&(f=this._getAuxShiftSizeAndOpacity(b-e),5<f.auxSize&&(d&&this._getValignTop(d,h,l,f.auxSize,f.auxShift)<l||!d&&this._getHalignLeft(d,m,k,f.auxSize,f.auxShift)<k)&&(a|=AdfDhtmlCarouselPeer.MISSING_AFTER))}}return a};
AdfDhtmlCarouselPeer.prototype._addBefore=function(a,b,d){var e=a.firstChild;a=e.startRow;e=AdfAgent.AGENT.getAttribute(this._getFirstNonPlaceholder(e),AdfDhtmlCarouselPeer._ROW_KEY);this._startFetch(AdfCarouselDataFetchEvent.BEFORE_KEY_SUBTYPE,a,e,b,!d)};
AdfDhtmlCarouselPeer.prototype._addAfter=function(a,b,d){var e=a.firstChild;a=e.startRow+this._getNumberOfRows(e)-1;e=AdfAgent.AGENT.getAttribute(this._getLastNonPlaceholder(e),AdfDhtmlCarouselPeer._ROW_KEY);this._startFetch(AdfCarouselDataFetchEvent.AFTER_KEY_SUBTYPE,a,e,b,!d)};
AdfDhtmlCarouselPeer.prototype._handleLongJump=function(a,b,d,e){var f=null,g,h,k=this.getComponent().getFetchSize(),l=AdfPage.PAGE.getLookAndFeel(),m=this._rowCount;g=Math.ceil(k/2);0<=b-g?g=b-g:(f=l.getTranslatedString("af_carousel.LABEL_START"),g=0);-1!=m?g+k<m?h=g+k-1:(h=m-1,f=l.getTranslatedString("af_carousel.LABEL_END")):h=g+k-1;null==f&&(f=l.getTranslatedString("af_carousel.LABEL_ITEM",1+b));this._positionThumbAndSpinInfo(b);if(m=a.firstChild){var n=m.startRow,q=n+this._getNumberOfRows(m)-
1;if(g==n&&h==q)return;var r=k=!1;g>=n&&b<=q?r=!0:h>=n&&h<=q&&b>=n&&(k=!0);if(k||r){f=m.childNodes[b-n+this._getNumberOfLeadingPlaceholders(m)];AdfAssert.assert(null!=f,"Unexpected null row A: ("+this._getNumberOfRows(m)+", "+b+", "+n+")");b=AdfAgent.AGENT.getAttribute(f,AdfDhtmlCarouselPeer._ROW_KEY);this._updateCurrentItemKey(b);k?this._addBefore(a,d,e):this._addAfter(a,d,e);return}}d&&this._displayStatus(l.getTranslatedString("af_carousel.LABEL_GOING_TO",f));this._startFetch(AdfCarouselDataFetchEvent.AT_INDEX_SUBTYPE,
b,null,d,!e)};
AdfDhtmlCarouselPeer.prototype._deleteOffscreenItems=function(a,b){var d=a.firstChild,e=d.startRow,f=this._getNumberOfRows(d),g=this._dataBodyWidth,h=this._dataBodyHeight,k=this.getComponent(),l=k.getFetchSize(),m=k.getHalign(),n=k.getValign(),q=this._findRowByKey(this._currentItemKey,!1),r=this._isVertical;if(q)if(q=q.index,b)for(f=q-l;f>=e;){l=this._getAuxShiftSizeAndOpacity(q-f);if(5>=l.auxSize||r&&0>=this._getValignTop(r,n,h,l.auxSize,-l.auxShift)||!r&&0>=this._getHalignLeft(r,m,g,l.auxSize,-l.auxShift)){for(;e<=
f;e++)g=this._getFirstNonPlaceholder(d),this._unregisterNode(g),d.removeChild(g);d.startRow=f+1;d.numRows=this._getNumberOfRows(d);this._updateComponentStartAndRowProperties(k,d.startRow,d.numRows);break}f--}else for(var t=q+l;t<e+f;){l=this._getAuxShiftSizeAndOpacity(t-q);if(5>=l.auxSize||r&&this._getValignTop(r,n,h,l.auxSize,l.auxShift)>=h||!r&&this._getHalignLeft(r,m,g,l.auxSize,l.auxShift)>=g){for(g=t;g<e+f;g++)h=this._getLastNonPlaceholder(d),this._unregisterNode(h),d.removeChild(h);d.numRows=
this._getNumberOfRows(d);this._updateComponentStartAndRowProperties(k,d.startRow,d.numRows);break}t++}};AdfDhtmlCarouselPeer.prototype._unregisterNode=function(a){AdfPage.PAGE.removeComponentsInSubtree(a);AdfAgent.AGENT.elementsRemoved(a)};AdfDhtmlCarouselPeer.prototype._undoSpin=function(a){if(a=a.getAttribute("_currentItemKey"))this._currentItemKey=a,this.getComponent().setCurrentItemKey(a),this._positionThumbAndSpinInfo()};
AdfDhtmlCarouselPeer.prototype._queueFetchEvent=function(a,b,d,e){var f=this._fetchId++,g=this.getComponent(),h=new AdfCarouselDataFetchEvent(g,f,b,d,e);h.setPartial(!0);h.setRenderOnly(a);var k=!1;a?AdfPage.PAGE.queueEventToServer(h):(this._setEventRootToCurrentItem(this._currentItemKey,h),g.queueEvent(h),k=h.isCanceled());k||(this._pendingFetch=b,this._pendingId=f,this._fetchIndex=d,this._fetchKey=e,this._pendingRenderOnly=a,h.setRoot(g));return k?null:h};
AdfDhtmlCarouselPeer.prototype._startFetch=function(a,b,d,e,f){if(a!=this._pendingFetch||b!=this._fetchIndex||d!=this._fetchKey)if(this._pendingTimeout&&(delete this._pendingTimeout,window.clearTimeout(this._pendingTimeout)),e){e=AdfPage.PAGE.getDomWindow();var g=function(){var a=arguments.callee;a._self._delNav(a._subtype,a._index,a._key,a._renderOnly)};g._subtype=a;g._index=b;g._key=d;g._renderOnly=f;g._self=this;this._pendingTimeout=e.setTimeout(g,AdfDhtmlCarouselPeer._FETCH_DELAY_TIMEOUT);this._cancelPendingFetch()}else(a=
this._queueFetchEvent(f,a,b,d))?(b=AdfPage.PAGE.getLookAndFeel().getTranslatedString("af_carousel.LABEL_FETCHING"),this._displayStatus(b),AdfDhtmlCarouselPeer._setCursor(this._getDataBody(),"wait"),this._pruneKeyCache&&(a.setClientTokens(this._collectClientTokens(this._pruneKeyCache)),this._pruneKeyCache=null)):(this._hideStatus(),this._positionThumbAndSpinInfo())};AdfDhtmlCarouselPeer.prototype._delNav=function(a,b,d,e){this._startFetch(a,b,d,!1,e);delete this._pendingTimeout};
AdfDhtmlCarouselPeer.prototype._cancelPendingFetch=function(){this._pendingRenderOnly=this._pendingId=this._fetchKey=this._fetchIndex=this._pendingFetch=void 0};AdfDhtmlCarouselPeer.prototype._initNewBlock=function(a,b,d){a.startRow=b;a.numRows=d};
AdfDhtmlCarouselPeer.prototype._sizeDataBody=function(a,b,d){var e=AdfAgent.AGENT,f=this.getComponent(),g=this.getDomElement();this._setupInitialPositions(f,g);var h=Math.max(0,b),k=Math.max(0,d),l=this._isVertical;l?h=Math.max(0,h-this._nonDataBodySize):k=Math.max(0,k-this._nonDataBodySize);var m=k;l?(k-=this._heightOfBoxUnderCurrentItem,m=h,k<h&&(m=Math.max(0,k-2*AdfDhtmlCarouselPeer._ITEM_PADDING))):h<k&&(m=Math.max(0,h-2*AdfDhtmlCarouselPeer._ITEM_PADDING));m=Math.round(Math.max(30,m-2*AdfDhtmlCarouselPeer._ITEM_PADDING));
this._dataBodyWidth=h;this._dataBodyHeight=k;this._selectedSize=m;this._widthMargin=(h-m)/2;this._heightMargin=(k-m)/2;var n=f.getClientId();if("small"==this._controlArea||"compact"==this._controlArea){var q=this._getControlAreaDiv(g),g=e.getComputedStyle(q),q=q.style,r=0,t=parseInt(g.paddingLeft,10),g=parseInt(g.paddingRight,10),r=r+t+g;q.width=m-r+"px";q.right="auto";q.left=this._getHalignLeft(l,f.getHalign(),h,m,0)+"px";l&&(q.top=this._getValignTop(l,f.getValign(),k,m,0)+m+"px")}else l&&(q=this._getItemTextDiv(n),
g=e.getComputedStyle(q),q=q.style,r=0+parseInt(g.paddingLeft,10),r+=parseInt(g.paddingRight,10),q.width=m-r+"px",q.left=this._getHalignLeft(!0,f.getHalign(),h,m,0)+(AdfDhtmlCarouselPeer._isRTL()?parseInt(a.offsetLeft):0)+"px",q.top=this._getValignTop(!0,f.getValign(),k,m,0)+m+"px");"oneByOne"==this._displayItems&&(g=a.style,g.width=m+"px",g.height=m+"px",g.right="auto",g.bottom="auto",g.top=this._getValignTop(l,f.getValign(),k,m,0)+"px",g.left=this._getHalignLeft(l,f.getHalign(),h,m,0)+(AdfDhtmlCarouselPeer._isRTL()?
parseInt(a.offsetLeft):0)+"px");"oneByOne"==this._displayItems&&"small"!=this._controlArea&&"compact"!=this._controlArea&&"none"!=this._controlArea&&(g=e.getElementById(AdfRichUIPeer.CreateSubId(n,"sp")),q=e.getElementById(AdfRichUIPeer.CreateSubId(n,"sb")),e=e.getElementById(AdfRichUIPeer.CreateSubId(n,"sn")),l?(f=f.getValign(),h=g.offsetHeight,b=e.offsetHeight,k=this._getValignTop(!0,f,k,m,0),n=this._getItemTextDiv(n).offsetHeight,h=k+h,m=k+m+n-b,g.style.bottom=d-h+"px",q.style.top=h+"px",q.style.bottom=
d-m+"px",e.style.top=m+"px"):(d=f.getHalign(),f=g.offsetWidth,k=e.offsetWidth,h=this._getHalignLeft(!1,d,h,m,0),f=h+f,k=h+m-k,q.style.left=f+"px",q.style.right=b-k+"px",AdfDhtmlCarouselPeer._isRTL()?(g.style.left=k+"px",e.style.right=b-f+"px"):(g.style.right=b-f+"px",e.style.left=k+"px"),"start"==d?this._getItemTextDiv(n).style.right=b-2*h-m+"px":"end"==d&&(this._getItemTextDiv(n).style.left=2*h+m-b+"px")));AdfAssert.assert(!a.firstChild||this._currentItemKey,"There is no current item in the data block");
this._currentItemKey&&((a=this._findRowByKey(this._currentItemKey,!0))?(this._sizeDataBodyForSelectedWrapperElement(a.row,!1),this._queueResizeNotifyOnDisplayedChildren()):AdfLogger.LOGGER.severe("_sizeDataBody failed due to invalid currentItemKey: "+this._currentItemKey))};
AdfDhtmlCarouselPeer.prototype._handleDataCallback=function(a,b,d,e){var f=AdfAgent.AGENT,g=f.getIntAttribute(a,"_startRow",0),h=this._getNumberOfRows(a),k=this._getDataBody(),l=k.firstChild;this._initNewBlock(a,g,h);b==AdfCarouselDataFetchEvent.AT_INDEX_SUBTYPE?(this._replaceWithDataBlock(k,a,d),this._adjustRowCountFromResponse(k,a)):b==AdfCarouselDataFetchEvent.AFTER_KEY_SUBTYPE?(0==h?-1==this._rowCount?(a=f.getIntAttribute(l,"_rowCount",-1),this._rowCount=-1==a?this._knownRowCount:a):this._adjustRowCountFromResponse(k,
a):(d=g-l.startRow-this._getNumberOfRows(l),0!=d?(d=g+Math.ceil(h/2),this._replaceWithDataBlock(k,a,d)):this._addDataBlockItems(k,a,!1),this._adjustRowCountFromResponse(k,a)),e||this._deleteOffscreenItems(k,!0)):b==AdfCarouselDataFetchEvent.BEFORE_KEY_SUBTYPE&&(d=g-l.startRow+h,f=this._adjustRowCountFromResponse(k,a),0!=d||0!=f?(d=g+Math.ceil(h/2),this._replaceWithDataBlock(k,a,d)):this._addDataBlockItems(k,a,!0),e||this._deleteOffscreenItems(k,!1));if(b==AdfCarouselDataFetchEvent.AT_INDEX_SUBTYPE||
b==AdfCarouselDataFetchEvent.AFTER_KEY_SUBTYPE)b=g+h-this._knownRowCount,0<b&&(this._knownRowCount+=b,this._positionThumbAndSpinInfo())};AdfDhtmlCarouselPeer.prototype._adjustRowCountFromResponse=function(a,b){var d=0,e=this._rowCount;if(-1!=e){var f=AdfAgent.AGENT.getIntAttribute(b,"_rowCount",-1);0==this._unavailableRowIndex?f=-1:0<this._unavailableRowIndex&&(f=this._unavailableRowIndex);-1!=f&&(d=f-e)}0!=d&&(this._rowCount=this._knownRowCount=f,this._positionThumbAndSpinInfo());return d};
AdfDhtmlCarouselPeer.prototype._displayStatus=function(a){var b=this._getStatusMessage();if("icon"==AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|carousel-tr-status-type")){var d=AdfDhtmlCarouselPeer._findFirstChildByTagName(b,"IMG");null!=d?d.title=a:b.title=a}else b.innerHTML=a;a=b.style;if("none"==a.display){var e=!1,f=this._dataBodyWidth,g=this._dataBodyHeight;if(null==f||null==g||0==f||0==g)e=!0,d=this._getDataBody(),f=d.offsetWidth,g=d.offsetHeight;a.zIndex=1E4;d=this._isVertical;a.visibility=
"hidden";a.display="block";var h=b.offsetWidth/2,b=b.offsetHeight/2;if(e)h=f/2-h,g=g/2-b,d&&null!=this._nonDataBodySize&&0!=this._nonDataBodySize&&(h+=this._nonDataBodySize),AdfDhtmlCarouselPeer._isRTL()?a.left=Math.floor(h)+"px":a.right=Math.floor(h)+"px",a.top=Math.floor(g)+"px";else{var k=this.getComponent(),e=this._selectedSize,f=this._getHalignLeft(d,k.getHalign(),f,e,0),d=this._getValignTop(d,k.getValign(),g,e,0);a.right="auto";a.left=Math.floor(f+e/2-h)+"px";a.top=Math.floor(d+e/2-b)+"px"}a.visibility=
"visible"}};AdfDhtmlCarouselPeer.prototype._hideStatus=function(){this._getStatusMessage().style.display="none"};AdfDhtmlCarouselPeer.prototype._getDataBody=function(a){return this._getElemBySubId("db",a)};AdfDhtmlCarouselPeer.prototype._getControlAreaDiv=function(a){AdfAssert.assert("small"==this._controlArea||"compact"==this._controlArea,"Carousel peer should not be accessing the control area when controlArea \x3d\x3d full or none");return this._getElemBySubId("ca",a)};
AdfDhtmlCarouselPeer.prototype._getSpinControlDiv=function(a){AdfAssert.assert("small"!=this._controlArea&&"compact"!=this._controlArea&&"none"!=this._controlArea,"Carousel peer should not be accessing the spin control div when controlArea !\x3d full");return AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(a,"sc"))};
AdfDhtmlCarouselPeer.prototype._getSpinInfoDiv=function(a){AdfAssert.assert("compact"!=this._controlArea&&"none"!=this._controlArea,"Carousel peer should not be accessing the spin info div when controlArea \x3d\x3d compact or none");return AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(a,"si"))};AdfDhtmlCarouselPeer.prototype._getItemTextDiv=function(a){return AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(a,"it"))};AdfDhtmlCarouselPeer.prototype._getStatusMessage=function(){return this._getElemBySubId("sm")};
AdfDhtmlCarouselPeer.prototype._getElemBySubId=function(a,b){var d=this.getDomElement();null==d&&(d=b);return AdfDhtmlCarouselPeer._getChildBySubId(d,a)};AdfDhtmlCarouselPeer._getChildBySubId=function(a,b){AdfAssert.assert(null!=a,"Carousel peer cannot get a child by sub ID if the parent is null!");for(var d=a.id+"::"+b,e=a.childNodes,f=0;f<e.length;f++)if(d==e[f].id)return e[f];return null};
AdfDhtmlCarouselPeer._handlePreviousClick=function(a){a=AdfAgent.AGENT.getEventTarget(a);var b=a.id;b||(b=a.parentNode.id);a=b.substring(0,b.indexOf("::"));AdfPage.PAGE.findComponent(a).getPeer()._initiateSpinPreviousAnimation()};AdfDhtmlCarouselPeer._handleNextClick=function(a){a=AdfAgent.AGENT.getEventTarget(a);var b=a.id;b||(b=a.parentNode.id);a=b.substring(0,b.indexOf("::"));AdfPage.PAGE.findComponent(a).getPeer()._initiateSpinNextAnimation()};
AdfDhtmlCarouselPeer._handleMouseWheel=function(a){a||(a=AdfPage.PAGE.getDomWindow().event);var b=null!=a.wheelDelta?-a.wheelDelta/4:4*a.detail,d=AdfPage.PAGE.findComponent(this.id);null!=d&&(d=d.getPeer(),d._isVertical&&(b*=-1),d._scrollByAmount(b,!1));AdfAgent.AGENT.eatEvent(a)};
AdfDhtmlCarouselPeer.prototype._scrollByAmount=function(a,b){if(null!=this.getComponent())if(!b&&30>=Math.abs(a))0<a?this._initiateSpinNextAnimation():0!=a&&this._initiateSpinPreviousAnimation();else{var d=this._getDataBody(),d=this._isVertical?d.offsetHeight:d.offsetWidth;null!=this._queuedScrollAmount&&(a+=this._queuedScrollAmount);b&&Math.abs(a/d)<this._percentSize?this._queuedScrollAmount=a:(this._queuedScrollAmount=null,0<a?this._initiateSpinNextAnimation():0!=a&&this._initiateSpinPreviousAnimation())}};
AdfDhtmlCarouselPeer._findFirstChildByTagName=function(a,b){AdfAssert.assert(null!=a,"Carousel peer cannot find first child by tag name if the parent is null!");for(var d=a.childNodes,e=0;e<d.length;e++)if(b==d[e].tagName)return d[e];return null};
AdfDhtmlCarouselPeer.prototype._getRowKeyAndRow=function(a,b){AdfAssert.assertDomElement(a);var d=a,e=AdfAgent.AGENT;if(null==d||1!=d.nodeType)return null;for(var f=e.getAttribute(d,AdfDhtmlCarouselPeer._ROW_KEY);null==f;){if(null==d||d==b)return null;d=d.parentNode;if(null==d||1!=d.nodeType)return null;f=e.getAttribute(d,AdfDhtmlCarouselPeer._ROW_KEY)}return[f,d]};
AdfDhtmlCarouselPeer.prototype.ComponentCurrentItemKeyChanged=function(a,b,d,e){this._ignoreCurrentItemSet||(b=this._findRowByKey(d,!1),null==b?AdfAssert.assert(null!=b,"The carousel '"+a.getClientId()+"' does not any item in the current set of fetched items with client key: "+d):(this._currentItemKey=d,this._sizeDataBodyForSelectedWrapperElement(b.row,!1),this._updateTextForNewCurrentItemKey(d)))};
AdfDhtmlCarouselPeer.prototype._updateCurrentItemKey=function(a,b){var d=!1,e=this.getComponent(),f=this._currentItemKey,g=new AdfCarouselSpinEvent(e,f,a);b||this._setEventRootToCurrentItem(f,g);g.queue();g.isCanceled()||(g.setRoot(e),this._currentItemKey=a,this._ignoreCurrentItemSet=!0,AdfLogger.LOGGER.finer("Update current item key to:",a),e.setCurrentItemKey(a),this._ignoreCurrentItemSet=!1,this._updateTextForNewCurrentItemKey(a),d=!0);return d};
AdfDhtmlCarouselPeer.prototype._setEventRootToCurrentItem=function(a,b){var d=this._findRowByKey(a,!1);AdfAssert.assert(null!=d,'Unexpected null rowData for key "'+a+'".');d&&(d=AdfDomUtils.getFirstChildElement(d.row).id,(d=AdfPage.PAGE.findComponent(d))&&b.setRoot(d))};
AdfDhtmlCarouselPeer.prototype._updateTextForNewCurrentItemKey=function(a){var b=this._findRowByKey(a,!0);AdfAssert.assert(null!=b,'Unexpected null rowData for key "'+a+'".');if(b){b=AdfDomUtils.getFirstChildElement(b.row).id;a=AdfPage.PAGE.findComponent(b);var d=this.getComponent().getClientId(),d=this._getItemTextDiv(d);null==a?(this._waitingForTextClientId=b,d.title="",d.innerHTML=""):(this._waitingForTextClientId=null,b=a.getText(),d.title=null==b?"":b,d.innerHTML=null==b?"":b);this._updateSelectedItemClass(a)}};
AdfDhtmlCarouselPeer.prototype.CarouselItemInitialized=function(a){null!=this._waitingForTextClientId&&this._waitingForTextClientId==a&&(this._waitingForTextClientId=null,this._currentItemTextUpdate(a));this._queueResizeNotifyOnDisplayedChildren()};
AdfDhtmlCarouselPeer.prototype._currentItemTextUpdate=function(a){var b=this.getComponent().getClientId(),b=this._getItemTextDiv(b);a=AdfPage.PAGE.findComponent(a);if(null==a)b.title="",b.innerHTML="";else{var d=a.getText();b.title=null==d?"":d;b.innerHTML=null==d?"":d}this._updateSelectedItemClass(a)};
AdfDhtmlCarouselPeer.prototype._updateSelectedItemClass=function(a){for(var b=AdfPage.PAGE.getLookAndFeel().getStyleClass("p_AFSelected"),d=this._getDataBody().firstChild.childNodes,e=d.length,f=0;f<e;++f){var g=d[f];if(AdfDomUtils.removeCSSClassName(g,b)){(d=AdfDomUtils.getFirstChildElement(g))&&d.removeAttribute("aria-selected");break}}null!=a&&(d=a.getPeer(),d.bind(a),a=d.getDomElement(),AdfDomUtils.addCSSClassName(a.parentNode,b),this.getDomElement().setAttribute("aria-activedescendant",a.id),
a.setAttribute("aria-selected",!0))};AdfDhtmlCarouselPeer.prototype._queueResizeNotifyOnDisplayedChildren=function(){this._pendingResizeNotify&&(window.clearTimeout(this._pendingResizeNotify),delete this._pendingResizeNotify);var a=AdfPage.PAGE.getDomWindow(),b=new Function("var c \x3d arguments.callee;c._self._delRes();");b._self=this;this._pendingResizeNotify=a.setTimeout(b,1)};AdfDhtmlCarouselPeer.prototype._delRes=function(){this._doResizeNotifyOnDisplayedChildren(this.getComponent())};
AdfDhtmlCarouselPeer.prototype._isTargetCellEditable=function(a){for(var b=AdfAgent.getAgent(),d,e=this.getDomElement(),f=AdfDhtmlCarouselPeer._INPUT_REGEXP;null!=a&&a!=e&&"TD"!=(d=b.getNodeName(a))&&"TH"!=d;){if(d.match(f)&&-1!=a.tabIndex)return!0;a=a.parentNode}return!1};AdfDhtmlCarouselPeer.prototype._handleDataBodySelectStart=function(a){a||(a=AdfPage.PAGE.getDomWindow().event);var b=AdfAgent.AGENT;this._isTargetCellEditable(AdfAgent.AGENT.getEventTarget(a))||b.preventDefault(a)};
AdfDhtmlCarouselPeer.prototype._handleItemClick=function(a,b,d){this._currentItemKey!=b&&null!=b&&this._initiateSpinSpecificExistingItemAnimation(b,d)};
AdfDhtmlCarouselPeer.prototype._findRowByKey=function(a,b){for(var d=null,e=this._getDataBody().firstChild,f=e.childNodes,g=this._getNumberOfLeadingPlaceholders(e),h=g;h<f.length&&!d;h++){var k=f[h],l=k.getAttribute(AdfDhtmlCarouselPeer._ROW_KEY);if(null==l)break;if(a==l){d={row:k,index:e.startRow+h-g,block:e};break}}b&&null==d&&0<f.length&&(h=f[g],AdfAssert.assert(!AdfDhtmlCarouselPeer._isPlaceholder(h),"The located firstRow (by default) is a placeholder: "+g+", "+h+", "+f),d={row:h,index:e.startRow,
block:e},e=AdfAgent.AGENT.getAttribute(h,AdfDhtmlCarouselPeer._ROW_KEY),this._updateCurrentItemKey(e,!0));return d};
AdfDhtmlCarouselPeer.prototype._collectClientTokens=function(a){for(var b="",d=this._getDataBody().childNodes,e=0;e<d.length;e++)for(var f=d[e].childNodes,g=0;g<f.length;g++){var h=f[g].getAttribute(AdfDhtmlCarouselPeer._ROW_KEY);if(null!=h)if("flat"==a)b+=h,b+="_";else for(var h=h.split(","),k=h.length,b=b+h[k-1],b=b+"_",l=0;l<k-1;l++){var m=h[l];b.match(new RegExp("(^|_)"+m+"(_|$)"))||(b+=m,b+="_")}}return b};AdfDhtmlCarouselPeer.prototype._grabFocus=function(){AdfFocusUtils.focusElement(this.getDomElement())};
AdfDhtmlCarouselPeer.prototype.HandleComponentKeyDown=function(a){if(!a.isCanceled()){a=a.getNativeEvent();var b=AdfAgent.AGENT,d=b.getEventTarget(a),e=a.keyCode,f=!0,g=d.id;d&&e==AdfKeyStroke.TAB_KEY&&(f=this._handleTabKeyDown(d,a.shiftKey));if(f&&d&&g&&!this._isEmpty){var h=this.getComponent().getClientId(),k=!1;"small"!=this._controlArea&&"compact"!=this._controlArea&&"none"!=this._controlArea&&(h=b.getElementById(AdfRichUIPeer.CreateSubId(h,"st")),k=g==h.id);if(k||!this._isTargetCellEditable(d))if(d=
AdfDhtmlCarouselPeer._isRTL(),e==AdfKeyStroke.ARROWUP_KEY||e==AdfKeyStroke.ARROWLEFT_KEY)this._isVertical?a.shiftKey?this._initiateSpinStartAnimation():this._initiateSpinPreviousAnimation():d?a.shiftKey?this._initiateSpinEndAnimation():this._initiateSpinNextAnimation():a.shiftKey?this._initiateSpinStartAnimation():this._initiateSpinPreviousAnimation(),propogate=!1;else if(e==AdfKeyStroke.ARROWDOWN_KEY||e==AdfKeyStroke.ARROWRIGHT_KEY)this._isVertical?a.shiftKey?this._initiateSpinEndAnimation():this._initiateSpinNextAnimation():
d?(a.shiftKey?this._initiateSpinStartAnimation():this._initiateSpinPreviousAnimation(),f=!1):a.shiftKey?this._initiateSpinEndAnimation():this._initiateSpinNextAnimation(),propogate=!1}f||b.eatEvent(a)}};
AdfDhtmlCarouselPeer.prototype._handleTabKeyDown=function(a,b){var d=this._currentItemKey;if(!d)return!0;var e=!0,f=this.getComponent().getClientId(),g=AdfAgent.AGENT,h=this.getDomElement(),k=this._getDataBody(),k=AdfDomUtils.isAncestorOrSelf(k,a);"none"==this._controlArea?(f=this._getItemTextDiv(f),f=AdfFocusUtils.getNextTabStop(f,null,!0)):f=g.getElementById(AdfRichUIPeer.CreateSubId(f,"sp"));var g=!1,l=null;if(d=this._findRowByKey(d,!1))l=d.row,g=AdfDomUtils.isAncestorOrSelf(l,a);b?k?g?AdfFocusUtils.getFirstTabStop(l,
!1)==a&&(AdfFocusUtils.focusElement(h),e=!1):(AdfFocusUtils.focusElement(h),e=!1):AdfDomUtils.isAncestorOrSelf(f,a)&&(AdfFocusUtils.focusLastTabStop(l)||AdfFocusUtils.focusElement(h),e=!1):k?g?AdfFocusUtils.getLastTabStop(l,!1)==a&&(AdfFocusUtils.focusElement(f),e=!1):(AdfFocusUtils.focusElement(f),e=!1):a==h&&(AdfFocusUtils.focusFirstTabStop(l)||AdfFocusUtils.focusElement(f),e=!1);return e};
AdfDhtmlCarouselPeer.prototype._getNextRowKeyAndRow=function(a){if(a){for(var b=AdfAgent.AGENT,d={},e=this._getDataBody().firstChild.childNodes,f=e.length,g=0;g<f;++g){var h=e[g],k=b.getAttribute(h,AdfDhtmlCarouselPeer._ROW_KEY);if(null!=k)if(null==a){d.rowKey=k;d.row=h;break}else if(k==a){d.lastRowKeyInView=k;if(g+1<f){h=e[g+1];k=b.getAttribute(h,AdfDhtmlCarouselPeer._ROW_KEY);if(null==k)break;d.rowKey=k;d.row=h}break}}return d}};
AdfDhtmlCarouselPeer.prototype._getPreviousRowKeyAndRow=function(a){if(a){for(var b=AdfAgent.AGENT,d=this._getDataBody(),e={},f=d.firstChild.childNodes,g=f.length-1;0<=g;--g){var h=f[g],k=b.getAttribute(h,AdfDhtmlCarouselPeer._ROW_KEY);if(null!=k)if(null==a){e.rowKey=k;e.row=h;break}else if(k==a){e.lastRowKeyInView=k;if(0<=g-1){h=f[g-1];k=b.getAttribute(h,AdfDhtmlCarouselPeer._ROW_KEY);if(null==k)break;e.rowKey=k;e.row=h}else 0==b.getIntAttribute(d.firstChild,"_startRow",-1)&&(e.isAtTop=!0);break}}return e}};
AdfDhtmlCarouselPeer.prototype._isImmediateContentDelivery=function(a){return"immediate"==a.getContentDelivery()};AdfDhtmlCarouselPeer._isRTL=function(){return AdfPage.PAGE.getLocaleContext().isRightToLeft()};AdfDhtmlCarouselPeer.prototype._isOwnComponentEvent=function(a){a=a.getSource();for(var b=this.getComponent(),d=!1;!d&&a;)if(a==b)d=!0;else{if(a instanceof AdfRichCarousel||a instanceof AdfUIPopup)break;a=a.getParent()}return d};
AdfDhtmlCarouselPeer._setCursor=function(a,b){a&&a.style.cursor!=b&&(a.style.cursor=b)};AdfDhtmlCarouselPeer.prototype._sizeDataBodyForSelectedWrapperElement=function(a,b){b||this._stopAnimation(!0);var d=this._selectedSize,e=this.getComponent(),f=e.getHalign(),e=e.getValign(),g=this._isVertical;this._positionItem(a,d,0,3E3,g,e,f,1,!1);this._positionSiblings(a,3E3,g,e,f,!0);this._positionSiblings(a,3E3,g,e,f,!1);this._positionThumbAndSpinInfo()};
AdfDhtmlCarouselPeer.prototype._doResizeNotifyOnDisplayedChildren=function(a){a=AdfPage.PAGE;for(var b=this._getDataBody().firstChild.childNodes,d=b.length,e=0;e<d;++e){var f=b[e];"block"==f.style.display&&(f=AdfDomUtils.getFirstChildElement(f),null!=f&&(f=f.id,null!=f&&(f=AdfPage.PAGE.findComponent(f),null!=f&&a.doResizeNotify(f))))}};
AdfDhtmlCarouselPeer.prototype._updateTransientDragPosition=function(a){if(!this.getComponent().getDisabled()){var b=this._rowCount;-1==b&&(b=this._knownRowCount+AdfDhtmlCarouselPeer._FETCH_MORE_ITEM_COUNT);this._positionThumbAndSpinInfo(Math.min(Math.max(0,a*(b-1)),b-1))}};
AdfDhtmlCarouselPeer.prototype._updateSpinInfoDiv=function(a){var b=this.getComponent().getClientId(),d=this._getSpinInfoDiv(b),e=this._rowCount;this._duringThumbDrag&&(a=Math.round(a));a=-1==e?a:AdfPage.PAGE.getLookAndFeel().getTranslatedString("af_carousel.TIP_SPIN_INFO_X_OF_Y",a,e);d.innerHTML="\x3cspan\x3e"+a+"\x3c/span\x3e";if("small"!=this._controlArea&&"compact"!=this._controlArea&&"none"!=this._controlArea){a=d.style;var f=AdfAgent.AGENT,g=f.getElementById(AdfRichUIPeer.CreateSubId(b,"st"));
this._isVertical?(b=f.getElementById(AdfRichUIPeer.CreateSubId(b,"sp")),a.paddingTop=Math.round(b.offsetTop+b.offsetHeight+g.offsetTop+g.offsetHeight/2-d.firstChild.offsetHeight/2)+"px"):(d=d.firstChild.offsetWidth,e=g.offsetLeft,g=g.offsetWidth,b=AdfDhtmlCarouselPeer._isRTL()?f.getElementById(AdfRichUIPeer.CreateSubId(b,"sn")):f.getElementById(AdfRichUIPeer.CreateSubId(b,"sp")),f=b.offsetWidth,b=b.offsetLeft,a.textAlign="left",a.paddingLeft=Math.round(b+f+e+g/2-d/2)+"px")}};
AdfDhtmlCarouselPeer.prototype._positionSiblings=function(a,b,d,e,f,g){var h=this._selectedSize,k=b;a=g?AdfDomUtils.getPreviousElement(a):AdfDomUtils.getNextElement(a);if("oneByOne"==this._displayItems)for(k=g?-h:h;null!=a;)this._positionItem(a,h,k,b-1,d,e,f,1,!0),a=g?AdfDomUtils.getPreviousElement(a):AdfDomUtils.getNextElement(a);else{b=this._SHRINK_FACTOR;for(var l=this._SHIFT_FACTOR,m=0,n=100;null!=a;)m+=h*l,h=Math.round(h*b),n*=b,this._positionItem(a,h,g?-m:m,--k,d,e,f,Math.max(1,100-n),!0),a=
g?AdfDomUtils.getPreviousElement(a):AdfDomUtils.getNextElement(a)}};AdfDhtmlCarouselPeer.prototype._getAuxShiftSizeAndOpacity=function(a){var b=this._SHRINK_FACTOR,d=this._SHIFT_FACTOR,e=0,f=this._selectedSize,g=100;if("oneByOne"==this._displayItems)e=a,g*=b;else for(var h=0;h<a;h++)e+=f*d,f=Math.round(f*b),g*=b;return{auxShift:e,auxSize:f,auxOpacity:Math.max(1,100-g)}};
AdfDhtmlCarouselPeer.prototype._positionItem=function(a,b,d,e,f,g,h,k,l){var m=this._dataBodyWidth,n=this._dataBodyHeight,q=a.style;q.display=5<b||!l?"block":"none";q.width=b+"px";q.height=b+"px";l||"oneByOne"!=this._displayItems?(q.top=this._getValignTop(f,g,n,b,d)+"px",q.left=this._getHalignLeft(f,h,m,b,d)+"px"):(q.top="0px",q.left="0px");q.zIndex=e;a=AdfDomUtils.getLastChildElement(a);null!=a&&(a.style.display=l?"block":"none",this._useOpacity?AdfAgent.AGENT.setOpacity(a,k):a.style.backgroundColor=
"transparent")};AdfDhtmlCarouselPeer.prototype._getHalignLeft=function(a,b,d,e,f){if(0!=f&&"oneByOne"==this._displayItems)return a?0:0>f?-this._selectedSize:this._selectedSize;a?a="start"==b?AdfDhtmlCarouselPeer._isRTL()?d-e-this._widthMargin:this._widthMargin:"end"==b?AdfDhtmlCarouselPeer._isRTL()?this._widthMargin:d-e-this._widthMargin:.5*(d-e):(a="start"==b?.2*(d-e)+f:"end"==b?.8*(d-e)+f:.5*(d-e)+f,AdfDhtmlCarouselPeer._isRTL()&&(a=d-e-a));return Math.round(a)};
AdfDhtmlCarouselPeer.prototype._getValignTop=function(a,b,d,e,f){if(0!=f&&"oneByOne"==this._displayItems)return a?0>f?-this._selectedSize:this._selectedSize:0;a?"top"==b?(a=.2*(d-e)+f,0<f&&(a+=this._heightOfBoxUnderCurrentItem)):"bottom"==b?(a=.8*(d-e)+f,0<f&&(a+=.25*this._heightOfBoxUnderCurrentItem)):(a=.5*(d-e)+f,0<f&&(a+=this._heightOfBoxUnderCurrentItem)):a="top"==b?this._heightMargin:"bottom"==b?d-e-this._heightMargin:.5*(d-e);return Math.round(a)};
AdfDhtmlCarouselPeer.prototype._replaceWithDataBlock=function(a,b,d){var e=AdfAgent.AGENT,f=a.firstChild;this._unregisterNode(f);a.removeChild(f);a.appendChild(b);e.elementsAdded(b);(a=b.firstChild)?(a=b.startRow,f=b.childNodes.length,AdfAssert.assert(d>=a,"Bad data block state: ("+b.innerHTML+", "+d+", "+a+", "+f+")"),this._updateComponentStartAndRowProperties(this.getComponent(),a,f),d=Math.min(d,a+f-1),a=b.childNodes[d-a],b=e.getAttribute(a,AdfDhtmlCarouselPeer._ROW_KEY),this._updateCurrentItemKey(b,
!0),this._sizeDataBodyForSelectedWrapperElement(a,!1),this._queueResizeNotifyOnDisplayedChildren()):AdfLogger.LOGGER.severe("No items in the data block")};
AdfDhtmlCarouselPeer.prototype._addDataBlockItems=function(a,b,d){a=a.firstChild;var e=b.childNodes.length,f=this._getNumberOfRows(a),g=AdfAgent.AGENT,h=a.startRow,k=this._findRowByKey(this._currentItemKey,!0);if(null==k)AdfLogger.LOGGER.severe("Addition of data block items failed: "+this._currentItemKey+", "+k);else{var l=k.index,m=this.getComponent();this._stopAnimation(!0,k.row);this._removePlaceholders();for(var n=m.getHalign(),q=m.getValign(),r=d?3E3-(l-(h-1)):3E3-(f+h-l),h=d?l-(h-1):f+h-l;d?
b.lastChild:b.firstChild;){l=d?b.lastChild:b.firstChild;if(d){var t=this._getFirstNonPlaceholder(a);a.insertBefore(l,t)}else a.appendChild(l);t=this._getAuxShiftSizeAndOpacity(h);this._positionItem(l,t.auxSize,d?-t.auxShift:t.auxShift,--r,this._isVertical,q,n,t.auxOpacity,!0);g.elementsAdded(l);h++}d&&(a.startRow-=e);f+=e;a.numRows=f;this._updateComponentStartAndRowProperties(m,a.startRow,f);this._sizeDataBodyForSelectedWrapperElement(k.row,!1);this._queueResizeNotifyOnDisplayedChildren()}};
AdfDhtmlCarouselPeer.prototype._positionThumbAndSpinInfo=function(a){var b=AdfAgent.AGENT,d=this.getComponent().getClientId();if(void 0==a){if(this._duringThumbDrag)return;a=this._findRowByKey(this._currentItemKey,!0);if(null==a){AdfLogger.LOGGER.severe("Thumb details failed: "+this._currentItemKey+", "+a);return}a=a.index}var e=this._rowCount,e=-1!=e?e:this._knownRowCount+AdfDhtmlCarouselPeer._FETCH_MORE_ITEM_COUNT,e=Math.max(1,e-1),f=a/e;this._duringThumbDrag||(this._currentPercent=f);if("small"!=
this._controlArea&&"compact"!=this._controlArea&&"none"!=this._controlArea){f=b.getElementById(AdfRichUIPeer.CreateSubId(d,"sb"));b=b.getElementById(AdfRichUIPeer.CreateSubId(d,"st"));this._duringThumbDrag||(this._percentSize=1/e);var d=this._isVertical,g=b[d?"offsetHeight":"offsetWidth"],e=d?(1-a/e)*(f.offsetHeight-g):AdfDhtmlCarouselPeer._isRTL()?(e-a)/e*(f.offsetWidth-g):a/e*(f.offsetWidth-g);b.style[d?"bottom":"left"]=e+"px"}else this._duringThumbDrag||"none"==this._controlArea||(e=0==a,f=1==
f,this.getComponent().getDisabled()&&(f=e=!0),g=b.getElementById(AdfRichUIPeer.CreateSubId(d,"sp")),b=b.getElementById(AdfRichUIPeer.CreateSubId(d,"sn")),AdfDomUtils.addOrRemoveCSSClassName(e,g,AdfRichUIPeer.DISABLED_STYLECLASS),AdfDomUtils.addOrRemoveCSSClassName(f,b,AdfRichUIPeer.DISABLED_STYLECLASS));"compact"!=this._controlArea&&"none"!=this._controlArea&&this._updateSpinInfoDiv(a+1)};
AdfDhtmlCarouselPeer.prototype._animateRowsForNewSelectedWrapperElement=function(a,b,d,e){var f=null,g=100,h,k;if(null==e){if(b=this._findRowByKey(b,!0))h=b.row;this._stopAnimation(!0,h)}else{k=a;h=e.hoverKey;if(null!=h){g=0;if(h==this._lastHoverKey)return;this._lastHoverKey=h;f=e.hoverWrapper}this._stopAnimation(!1)}h=this._SHRINK_FACTOR;b=this._SHIFT_FACTOR;var l=this._dataBodyWidth,m=this._dataBodyHeight,n=this._selectedSize,q=this._isVertical,r=this.getComponent(),t=r.getHalign(),u=r.getValign(),
v=[],w,y=0,z=0,B="oneByOne"==this._displayItems;if(!B&&(y=this._getHalignLeft(q,t,l,n,0),z=this._getValignTop(q,u,m,n,0),"hover"==this._POP_OUT)){var r=r.getClientId(),C=null;"small"==this._controlArea||"compact"==this._controlArea?(r=this.getDomElement(),C=this._getControlAreaDiv(r)):C=this._getItemTextDiv(r);null!=C&&(w={element:C,properties:{alpha:g}},v.push(w))}w={element:a,properties:{offsetLeft:y,offsetTop:z,width:n,height:n}};var A=a.style;A.zIndex=3E3;A.display="block";v.push(w);A=AdfDomUtils.getLastChildElement(a);
null!=A&&(this._useOpacity?(w={element:A,properties:{alpha:0}},v.push(w)):A.style.backgroundColor="transparent");null==e&&this._positionThumbAndSpinInfo();for(var E=AdfDomUtils.getPreviousElement(a),g=0,y=n,z=100,r=3E3,F=0,C=AdfDhtmlCarouselPeer._isRTL();null!=E;){B?g=1:(g+=y*b,y=Math.round(y*h));A=E.style;if(E==f){A.zIndex=3001;--r;w=(n-y)/2;q&&(C?"start"==t?w=n-y:"end"==t&&(w=0):"start"==t?w=0:"end"==t&&(w=n-y));var D=(n-y)/2;q||("top"==u?D=0:"bottom"==u&&(D=n-y));w={element:E,properties:{offsetLeft:this._getHalignLeft(q,
t,l,y,-g)-w,offsetTop:this._getValignTop(q,u,m,y,-g)-D,width:n,height:n}}}else A.zIndex=--r,w={element:E,properties:{offsetLeft:this._getHalignLeft(q,t,l,y,-g),offsetTop:this._getValignTop(q,u,m,y,-g),width:y,height:y}};A.display=5>=y?"none":"block";v.push(w);A=AdfDomUtils.getLastChildElement(E);null!=A&&E!=k&&(A.style.display="block",this._useOpacity?(z*=h,w=E==f?{element:A,properties:{alpha:1}}:{element:A,properties:{alpha:Math.max(1,100-z)}},v.push(w)):A.style.backgroundColor="transparent");A=
E;E=AdfDomUtils.getPreviousElement(E);d&&null==E&&2<y&&0<A.parentNode.startRow-F&&(E=null,this._useOpacity&&(z*=h,E=Math.max(1,100-z)),E=this._createPlaceholder(A,!1,E),++F,B&&(E=null))}E=AdfDomUtils.getNextElement(a);g=0;y=n;z=100;r=3E3;for(F=0;null!=E;)if(B?g=1:(g+=y*b,y=Math.round(Math.max(1,y*h))),A=E.style,E==f?(A.zIndex=3001,--r,w=(n-y)/2,q&&(C?"start"==t?w=n-y:"end"==t&&(w=0):"start"==t?w=0:"end"==t&&(w=n-y)),D=(n-y)/2,q||("top"==u?D=0:"bottom"==u&&(D=n-y)),w={element:E,properties:{offsetLeft:this._getHalignLeft(q,
t,l,y,g)-w,offsetTop:this._getValignTop(q,u,m,y,g)-D,width:n,height:n}}):(A.zIndex=--r,w={element:E,properties:{offsetLeft:this._getHalignLeft(q,t,l,y,g),offsetTop:this._getValignTop(q,u,m,y,g),width:y,height:y}}),A.display=5>=y?"none":"block",v.push(w),A=AdfDomUtils.getLastChildElement(E),null!=A&&E!=k&&(A.style.display="block",this._useOpacity?(z*=h,w=E==f?{element:A,properties:{alpha:1}}:{element:A,properties:{alpha:Math.max(1,100-z)}},v.push(w)):A.style.backgroundColor="transparent"),A=E,E=AdfDomUtils.getNextElement(E),
d&&null==E&&2<y&&F<AdfDhtmlCarouselPeer._MAX_PLACEHOLDERS_ON_ONE_SIDE&&(w=A.parentNode,w=w.startRow+this._getNumberOfRows(w)+F,D=this._rowCount,-1==D||w<D))E=null,this._useOpacity&&(z*=h,E=Math.max(1,100-z)),E=this._createPlaceholder(A,!0,E),++F,B&&(E=null);this._longJumpAnimation=AdfDhtmlCarouselPeer._isPlaceholder(a);this._animator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,null==e?this._animDuration:this._popOutDuration,v,null,AdfDhtmlCarouselPeer._spinAnimationComplete,
this,null)};
AdfDhtmlCarouselPeer.prototype._createPlaceholder=function(a,b,d){var e=AdfAgent.AGENT,f=a.ownerDocument,g=f.createElement("div"),h=g.style;h.width="1px";h.height="1px";h.top="50%";h.left="50%";h.display="none";var k=AdfPage.PAGE.getLookAndFeel();AdfDomUtils.addCSSClassName(g,k.getStyleClass("af|carousel::item"));"oneByOne"==this._displayItems?AdfDomUtils.addCSSClassName(g,k.getStyleClass("p_AFOneByOne")):AdfDomUtils.addCSSClassName(g,k.getStyleClass("p_AFCircular"));h=f.createElement("div");AdfDomUtils.addCSSClassName(h,
k.getStyleClass("af|carouselItem"));g.appendChild(h);f=f.createElement("div");AdfDomUtils.addCSSClassName(f,k.getStyleClass("af|carousel::item-overlay"));null!=d&&e.setOpacity(f,100*d);g.appendChild(f);d=e.getAttribute(a,"theme");null!=d&&(e.setAttribute(g,"theme",d),e.setAttribute(h,"theme",d),e.setAttribute(f,"theme",d));b?a.parentNode.appendChild(g):a.parentNode.insertBefore(g,a);return g};AdfDhtmlCarouselPeer._isPlaceholder=function(a){return null==AdfAgent.AGENT.getAttribute(a,AdfDhtmlCarouselPeer._ROW_KEY)};
AdfDhtmlCarouselPeer.prototype._removePlaceholders=function(){var a=this._getDataBody().firstChild;if(null!=a)for(var a=a.childNodes,b=a.length-1;0<=b;b--){var d=a[b];AdfDhtmlCarouselPeer._isPlaceholder(d)&&d.parentNode.removeChild(d)}};AdfDhtmlCarouselPeer.prototype._stopAnimation=function(a,b){if(null!=this._animator){var d=b;if(!d){var e=this._findRowByKey(this._currentItemKey,!0);e&&(d=e.row)}e=this._animator;this._animator=null;e.stop();d&&a&&this._sizeDataBodyForSelectedWrapperElement(d,!0)}};
AdfDhtmlCarouselPeer._spinAnimationComplete=function(a){a._animator=null;a._longJumpAnimation||(a._resizeNotifyAfterAnimate(),a._fillViewPort(a._getDataBody(),!1,!0))};
AdfDhtmlCarouselPeer.prototype._resizeNotifyAfterAnimate=function(){for(var a=this._getDataBody().firstChild.childNodes,b=0;b<a.length;++b){var d=a[b].style;"block"==d.display&&5>=parseInt(d.width,10)&&(d.display="none")}this._doResizeNotifyOnDisplayedChildren(this.getComponent());if(a=this._findRowByKey(this._currentItemKey,!1))a=a.row,a.style.display="block",a=AdfDomUtils.getLastChildElement(a),null!=a&&(a.style.display="none")};AdfDhtmlCarouselPeer.prototype._initiateSpinStartAnimation=function(){this._initiateSpinPercentAnimation(0)};
AdfDhtmlCarouselPeer.prototype._initiateSpinEndAnimation=function(){this._initiateSpinPercentAnimation(1)};
AdfDhtmlCarouselPeer.prototype._initiateSpinPreviousAnimation=function(){var a=this.getComponent();if(null!=a&&!a.getDisabled()){var a=this._currentItemKey,b=this._getPreviousRowKeyAndRow(a);if(b.row&&b.rowKey)this._cancelPendingFetch(),this._pendingTimeout&&window.clearTimeout(this._pendingTimeout),this._updateCurrentItemKey(b.rowKey)&&this._animateRowsForNewSelectedWrapperElement(b.row,a,!0);else{var b=this._getRowIndexFromThumbPos(),d=this._findRowByKey(a,!1);d?b<d.index&&this._handleLongJump(this._getDataBody(),
b,!0,!0):AdfLogger.LOGGER.severe("_initiateSpinPreviousAnimation failed due to invalid currentItemKey: "+a)}}};
AdfDhtmlCarouselPeer.prototype._initiateSpinNextAnimation=function(){var a=this.getComponent();if(null!=a&&!a.getDisabled()){var a=this._currentItemKey,b=this._getNextRowKeyAndRow(a);if(b.row&&b.rowKey)this._cancelPendingFetch(),this._pendingTimeout&&window.clearTimeout(this._pendingTimeout),this._updateCurrentItemKey(b.rowKey)&&this._animateRowsForNewSelectedWrapperElement(b.row,a,!0);else{var b=this._getRowIndexFromThumbPos(),d=this._findRowByKey(a,!1);d?b>d.index&&this._handleLongJump(this._getDataBody(),
b,!0,!0):AdfLogger.LOGGER.severe("_initiateSpinNextAnimation failed due to invalid currentItemKey: "+a)}}};AdfDhtmlCarouselPeer.prototype._initiateSpinSpecificExistingItemAnimation=function(a,b){this._cancelPendingFetch();this._pendingTimeout&&window.clearTimeout(this._pendingTimeout);if(!this.getComponent().getDisabled()){var d=this._currentItemKey;this._updateCurrentItemKey(a)&&this._animateRowsForNewSelectedWrapperElement(b,d,!0)}};
AdfDhtmlCarouselPeer.prototype._getCurrentPercent=function(){if(null!=this._currentPercent)return this._currentPercent;AdfAssert.assert(!1,"Illegal state; currentPercent is not known: "+this._currentPercent)};
AdfDhtmlCarouselPeer.prototype._initiateSpinPercentAnimation=function(a,b){if(!this.getComponent().getDisabled()){var d=this._getDataBody(),e=d.firstChild,f=e.childNodes,g=this._rowCount,h=e.startRow,k=this._getNumberOfRows(e);-1==g&&(g=this._knownRowCount+AdfDhtmlCarouselPeer._FETCH_MORE_ITEM_COUNT);var l=g-1,m=Math.max(0,Math.round(a*l)),n=null;null!=b&&(n=Math.max(0,Math.round(b*l)));m=Math.min(m,g-1);n==m&&(m=a<b?Math.max(0,--m):Math.min(l,++m));m>=h&&m<h+k?(this._cancelPendingFetch(),this._pendingTimeout&&
window.clearTimeout(this._pendingTimeout),e=this._getNumberOfLeadingPlaceholders(e),d=f[m-h+e],AdfAssert.assert(null!=d,"A desired row could not be found: "+f+", "+m+", "+h+", "+e),f=AdfAgent.AGENT.getAttribute(d,AdfDhtmlCarouselPeer._ROW_KEY),h=!0,this._currentItemKey!=f&&null!=f&&(m=this._currentItemKey,this._updateCurrentItemKey(f)&&(h=!1,this._animateRowsForNewSelectedWrapperElement(d,m,!0))),h&&(this._stopAnimation(!0),this._removePlaceholders(),this._hideStatus(),(f=this._findRowByKey(this._currentItemKey,
!0))&&this._sizeDataBodyForSelectedWrapperElement(f.row,!0))):this._handleLongJump(d,m,!0,!0)}};
AdfDhtmlCarouselPeer.prototype._animateForLongJump=function(a,b,d){this._stopAnimation(!0);this._removePlaceholders();var e=this._findRowByKey(this._currentItemKey,!0),f;e&&(f=e.row);for(var g=this._selectedSize,e=this._SHRINK_FACTOR,h=f,k=h,l=100;null!=h;)l*=e,h=b?AdfDomUtils.getNextElement(k):AdfDomUtils.getPreviousElement(k),null!=h&&(k=h);h=null;if("oneByOne"==this._displayItems){a=Math.min(10,d);for(d=0;d<a;d++)h=null,this._useOpacity&&(l*=e,h=Math.max(1,100-l)),k=this._createPlaceholder(k,b,
h);h=k}else{for(var m=0;5<g&&m<AdfDhtmlCarouselPeer._MAX_PLACEHOLDERS_ON_ONE_SIDE;)m++,g=Math.round(g*e);for(var m=Math.max(1,m-1),g=Math.min(m,d),n=2*m+1,m=Math.min(m,a-d),q=0,r=g+1+m;q<r;){var t=null;this._useOpacity&&(l*=e,t=Math.max(1,100-l));k=this._createPlaceholder(k,b,t);q==g&&(h=k);++q}null==h&&AdfAssert.assert(!1,"Illegal state; no desiredPlaceholder: maxNumberOfPossibleItems \x3d "+n+", placeholdersBeforeDesired \x3d "+g+", placeholdersAfterDesired \x3d "+m+", placeholderCount \x3d "+q+
", fullNeededPlaceholderCount \x3d "+a+", itemsFromCurrentlyAvailableEdge \x3d "+d)}this._sizeDataBodyForSelectedWrapperElement(f,!1);this._animateRowsForNewSelectedWrapperElement(h,this._currentItemKey,!1)};AdfDhtmlCarouselPeer.prototype._updateComponentStartAndRowProperties=function(a,b,d){a.setProperty("rows",d,!1,AdfUIComponent.PROPAGATE_NEVER);a.setProperty("first",b,!1,AdfUIComponent.PROPAGATE_NEVER)};
AdfDhtmlCarouselPeer.prototype.ConvertClientIdToLocator=function(a,b,d,e){b=a.getClientId();a=AdfStrings.count(b,":");AdfAssert.assert(0<=d.indexOf(b));d=d.substring(b.length+1);b=d.indexOf(":");0<b&&(d=d.substring(0,b),d=this._findRowByKey(d,!1),e.push([a+1,d?d.index:null]))};AdfDhtmlCarouselPeer.prototype.convertLocatorToClientId=function(a,b){var d=a.getClientId(),e=this._getRowKeyForIndex(a,b);return e?d+":"+e:null};
AdfDhtmlCarouselPeer.prototype._getRowKeyForIndex=function(a,b){var d=this._getDataBody(this.getDomElement());if(null!=d)for(var d=d.childNodes,e=0;e<d.length;e++){var f=d[e],g=f.startRow;if(b>=g&&b<g+f.numRows)return AdfDomUtils.getChildElementByPosition(f,1,b-g).getAttribute(AdfDhtmlCarouselPeer._ROW_KEY)}return null};AdfDhtmlCarouselPeer.prototype.getRowIndex=function(a){AdfAssert.assertString(a);AdfAssert.assert(null!=a,"Row Key cannot be null");return(a=this._findRowByKey(a))?a.index:-1};
AdfDhtmlCarouselPeer.prototype.getRowKey=function(a){AdfAssert.assertNumber(a);var b=this.getComponent(),d=b.getProperty("rows"),e=b.getProperty("first");AdfAssert.assert(a>=e&&a<d+e,"index must be within the viewport of the client");return this._getRowKeyForIndex(b,a)};
AdfDhtmlCarouselPeer.prototype.scrollToRowIndex=function(a,b){AdfAssert.assertNumber(a);AdfAssert.assert("number"===typeof a&&0<=a&&a<this._rowCount&&0===a%1,"Provided value expected to be a valid rowIndex, provided value: "+a);if("number"===typeof a&&0<=a&&a<this._rowCount&&0===a%1){var d=this._findRowByKey(this._currentItemKey,!1);if(d&&a==d.index)this._callCallback(b);else{var e=this._getDataBody(),d=e.firstChild,f=d.startRow,g=this._getNumberOfRows(d);a>=f&&a<f+g?(this._cancelPendingFetch(),this._pendingTimeout&&
window.clearTimeout(this._pendingTimeout),e=this._getNumberOfLeadingPlaceholders(d),d=d.childNodes[a-f+e],AdfAssert.assert(null!=d,"A desired row could not be found, rowIndex: "+a),f=AdfAgent.AGENT.getAttribute(d,AdfDhtmlCarouselPeer._ROW_KEY),e=this._currentItemKey,this._updateCurrentItemKey(f)?this._animateRowsForNewSelectedWrapperElement(d,e,!0):(this._stopAnimation(!0),this._removePlaceholders(),this._hideStatus(),(d=this._findRowByKey(this._currentItemKey,!0))&&this._sizeDataBodyForSelectedWrapperElement(d.row,
!0)),this._callCallback(b)):(this._handleLongJump(e,a,!0,!0),null!=b&&(this._postUpdateCallback=b,AdfPage.PAGE.addEventListener(AdfDomReplacedEvent.EVENT_TYPE,this._domReplacedListener,this)))}}else AdfLogger.LOGGER.warning("Invalid rowIndex value used, rowIndex: "+a)};AdfDhtmlCarouselPeer.prototype._callCallback=function(a){a&&(AdfAssert.assertFunction(a),a())};
AdfDhtmlCarouselPeer.prototype._domReplacedListener=function(a){var b=this.getComponent();AdfAssert.assertPrototype(b,AdfUIComponent);b=b.getClientId();a.containsClientId(b)&&(AdfPage.PAGE.removeEventListener(AdfDomReplacedEvent.EVENT_TYPE,this._domReplacedListener,this),a=this._postUpdateCallback,this._postUpdateCallback=null,this._callCallback(a))};