AdfRichUIPeer.createPeerClass(AdfRichUIPeer,"AdfDhtmlMasonryLayoutPeer",!1);
AdfDhtmlMasonryLayoutPeer.InitSubclass=function(){this._MASONRY_LAYOUT_CLASS="af|masonryLayout";this._MASONRY_LAYOUT_DROP_TARGET_CLASS=this._MASONRY_LAYOUT_CLASS+"::drop-target";this._MASONRY_LAYOUT_TRANSITION_RESIZE_TO_CLASS="AFMasonryLayoutTransitionResizeTo";this._MASONRY_LAYOUT_TRANSITION_RESIZE_TO_FAST_CLASS="AFMasonryLayoutTransitionResizeToFast";this._MAX_TILE_ROW_SPAN=this._MAX_TILE_COL_SPAN=10;this._MASONRY_TILE_SIZE_CLASS_STEM="AFMasonryTileSize";var a=this._MAX_TILE_COL_SPAN+1,b=this._MAX_TILE_ROW_SPAN+
1,d=[null];this._UNCOMPRESSED_MASONRY_TILE_SIZE_CLASSES=d;for(var e=1;e<a;e++){var f=[null];d.push(f);for(var g=1;g<b;g++)f.push(this._MASONRY_TILE_SIZE_CLASS_STEM+e+"x"+g)}this._MASONRY_TRANSITION_MOVE_TO_CLASS="AFMasonryTileTransitionMoveTo";this._MASONRY_TRANSITION_MOVE_TO_FAST_CLASS="AFMasonryTileTransitionMoveToFast";this._MASONRY_TRANSITION_RESIZE_TO_CLASS="AFMasonryTileTransitionResizeTo";this._MASONRY_TRANSITION_HIDE_FROM_CLASS="AFMasonryTileTransitionHideFrom";this._MASONRY_TRANSITION_HIDE_TO_CLASS=
"AFMasonryTileTransitionHideTo";this._MASONRY_TRANSITION_SHOW_FROM_CLASS="AFMasonryTileTransitionShowFrom";this._MASONRY_TRANSITION_SHOW_TO_CLASS="AFMasonryTileTransitionShowTo";this._HAS_DELETE_LISTENER_KEY="hasDeleteListener";this._HAS_REORDER_LISTENER_KEY="hasReorderListener"};
AdfDhtmlMasonryLayoutPeer.prototype.InitDomElement=function(a,b){AdfDhtmlMasonryLayoutPeer.superclass.InitDomElement.call(this,a,b);var d=AdfPage.PAGE,e=d.getLocaleContext().isRightToLeft();this._rtl=e;var f=d.isAutomationEnabled(),d=d.getLookAndFeel(),g=AdfDhtmlMasonryLayoutPeer._UNCOMPRESSED_MASONRY_TILE_SIZE_CLASSES,h=AdfDhtmlMasonryLayoutPeer._MAX_TILE_COL_SPAN+1,k=AdfDhtmlMasonryLayoutPeer._MAX_TILE_ROW_SPAN+1,l=[null];this._compressedMasonryTileSizeClasses=l;for(var m=1;m<h;m++){var n=g[m],
q=[null];l.push(q);for(var r=1;r<k;r++){var t=d.getStyleClass(n[r]);q.push(t)}}g="";for(m=1;m<h;m++)for(q=l[m],r=1;r<k;r++)if(t=q[r])0<g.length&&(g+=", "),g+="."+t;h={};h.tiles=g;k={};k.transitionComponentResizeToStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_LAYOUT_TRANSITION_RESIZE_TO_CLASS);k.transitionComponentResizeToFastStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_LAYOUT_TRANSITION_RESIZE_TO_FAST_CLASS);k.transitionMoveToStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_MOVE_TO_CLASS);
k.transitionMoveToFastStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_MOVE_TO_FAST_CLASS);k.transitionResizeToStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_RESIZE_TO_CLASS);k.transitionHideFromStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_HIDE_FROM_CLASS);k.transitionHideToStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_HIDE_TO_CLASS);k.transitionShowFromStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_SHOW_FROM_CLASS);
k.transitionShowToStyleClass=d.getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_SHOW_TO_CLASS);d={};d.addStyleClassName=AdfDomUtils.addCSSClassName;d.removeStyleClassName=AdfDomUtils.removeCSSClassName;d.getSizeStyleClassName=this.createCallback(this._getSizeStyleClassName);d.getTileSpan=this.createCallback(this._getTileSpan);d.hideTileOnEndFunc=this.createCallback(this._hideTileOnEndFunc);d.layoutOnEndFunc=this.createCallback(this._layoutOnEndFunc);d.layoutCycleOnStartFunc=this.createCallback(this._layoutCycleOnStartFunc);
d.layoutCycleOnEndFunc=this.createCallback(this._layoutCycleOnEndFunc);d.sortTilesOriginalOrderFunc=AdfDhtmlMasonryLayoutPeer._sortTilesOriginalOrder;this._saveTilesOriginalOrder(this._getChildElements(b));this._mlCommon=e=new window.adf.shared.impl.masonryLayout.MasonryLayoutCommon(b,e,f,h,k,d);e.setup(!0)};AdfDhtmlMasonryLayoutPeer.prototype.needsResizeNotify=function(a){return!0};
AdfDhtmlMasonryLayoutPeer.prototype.ResizeNotify=function(a,b,d,e){AdfDhtmlMasonryLayoutPeer.superclass.ResizeNotify.call(this,a,b,d,e);this._dropTargetInitialized||(this._dropTargetInitialized=!0,a=this.getComponent(),(b=a.getDropTarget())&&a.setDropTarget(new AdfMasonryLayoutDropTarget(b)));if(a=this._mlCommon)this._handledFirstResize?a.resizeNotify():(this._handledFirstResize=!0,a.setup(!0),this.getDomElement().style.visibility="")};
AdfDhtmlMasonryLayoutPeer.prototype.ReplaceDomElement=function(a,b){if(0<=a.id.indexOf("optRnd"))for(var d=b.childNodes,e=d.length-1;0<=e;e--){var f=d[e];if(1==f.nodeType){var g=f.id;g&&0<g.length&&(a.querySelector("#"+AdfDhtmlMasonryLayoutPeer._encodeSelector(g))||a.appendChild(f))}}AdfDhtmlMasonryLayoutPeer.superclass.ReplaceDomElement.call(this,a,b)};
AdfDhtmlMasonryLayoutPeer.prototype.DomReplaceNotify=function(a){if(0<=a.id.indexOf("optRnd")){for(var b=a.childNodes,d=0;d<b.length;d++){var e=b[d];8==e.nodeType&&(a.removeChild(e),d--)}this._preProcessOptimizedRender(a);this._processOptimizedRenderTimer=AdfPage.PAGE.scheduleTimer(this,this._processOptimizedRender,a,0)}else return a};
AdfDhtmlMasonryLayoutPeer.prototype.ComponentRemoved=function(a){this._processOptimizedRenderTimer&&(AdfPage.PAGE.cancelTimer(this._processOptimizedRenderTimer),this._processOptimizedRenderTimer=null)};
AdfDhtmlMasonryLayoutPeer.prototype.resizeTile=function(a,b){var d=this._mlCommon;d.isInLayoutCycle()&&d.finishLayoutCycle();var e=AdfPage.PAGE.getLookAndFeel(),f=document.getElementById(a),g=this._getUncompressedSizeStyleClassName(f),h=e.getStyleClass(g);if(b==g||b==h)AdfLogger.LOGGER.warning("Unable to resize masonryLayout child ",a," to style class ",b," because ",b," is already applied.");else{this._arResizeClientIds||(this._arResizeClientIds=[]);this._arResizeClientIds.push(a);AdfFocusUtils.containsFocus(f)&&
(this._resizingTileWithFocusId=f.id);var g=AdfAgent.AGENT,k=this.getComponent(),l=k.getClientId(),h=g.cloneNode(f);1==h.nodeType&&g.clearSubtreeIds(h);h.id=AdfRichUIPeer.createSubId(l,a+"_resizePlaceholder");h._afrMasonryOriginalOrder=f._afrMasonryOriginalOrder;this.getDomElement().replaceChild(h,f);g=AdfRichUIPeer.createSubId(l,"optRnd");document.getElementById(g).appendChild(f);this._arResizeEventsToFire||(this._arResizeEventsToFire=[]);g=this._getUncompressedSizeStyleClassName(f);f=new AdfMasonryResizeEvent(k,
a,g,b);this._arResizeEventsToFire.push(f);e=e.getStyleClass(b);d.resizeTile("#"+AdfDhtmlMasonryLayoutPeer._encodeSelector(h.id),e)}};
AdfDhtmlMasonryLayoutPeer.prototype.insertTile=function(a,b){var d=this._mlCommon;d.isInLayoutCycle()&&d.finishLayoutCycle();var e=AdfPage.PAGE.getLookAndFeel().getStyleClass(a);isNaN(b)&&(b=-1);var f=document.createElement("div"),g=this.getComponent(),h=g.getClientId(),h=AdfRichUIPeer.createSubId(h,"placeholder"+b);f.id=h;AdfDomUtils.addCSSClassName(f,e);e=f.style;e.top="-1px";this._rtl?e.right="-1px":e.left="-1px";this._arInsertEventsToFire||(this._arInsertEventsToFire=[]);g=new AdfMasonryInsertEvent(g,
b,a);this._arInsertEventsToFire.push(g);this._insertTileOriginalOrder(f,b);d.insertTileDomElem(f,b);this._inserting=!0};
AdfDhtmlMasonryLayoutPeer.prototype.deleteTile=function(a){var b=this._mlCommon;b.isInLayoutCycle()&&b.finishLayoutCycle();var d=document.getElementById(a);if(AdfFocusUtils.containsFocus(d)){var e=this._getChildElements(this.getDomElement(),!0),d=AdfCollections.indexOf(e,d);0<d&&(this._deletingTileWithFocusPrevId=e[d-1].id)}this._arDeleteEventsToFire||(this._arDeleteEventsToFire=[]);e=new AdfMasonryDeleteEvent(this.getComponent(),a);e.setPropagatesToServer(this._hasDeleteListener());this._arDeleteEventsToFire.push(e);
b.hideTile("#"+AdfDhtmlMasonryLayoutPeer._encodeSelector(a))};AdfDhtmlMasonryLayoutPeer._encodeSelector=function(a){a=a.concat("");return a=a.replace(/:/g,"\\:")};AdfDhtmlMasonryLayoutPeer._sortTilesOriginalOrder=function(a){a&&a.sort(AdfDhtmlMasonryLayoutPeer._compareTilesOriginalOrder);return a};AdfDhtmlMasonryLayoutPeer._compareTilesOriginalOrder=function(a,b){return b._afrMasonryOriginalOrder<a._afrMasonryOriginalOrder?1:a._afrMasonryOriginalOrder<b._afrMasonryOriginalOrder?-1:0};
AdfDhtmlMasonryLayoutPeer.prototype._deferFunction=function(a){this._deferredFunctions||(this._deferredFunctions=[]);this._deferredFunctions.push(a)};AdfDhtmlMasonryLayoutPeer.prototype._hasDeleteListener=function(){return null!=this.getComponent().getProperty(AdfDhtmlMasonryLayoutPeer._HAS_DELETE_LISTENER_KEY)};AdfDhtmlMasonryLayoutPeer.prototype._hasReorderListener=function(){return null!=this.getComponent().getProperty(AdfDhtmlMasonryLayoutPeer._HAS_REORDER_LISTENER_KEY)};
AdfDhtmlMasonryLayoutPeer.prototype._fireEvents=function(a){if(a)for(var b=0;b<a.length;b++)a[b].queue()};AdfDhtmlMasonryLayoutPeer.prototype._fireDeleteEvents=function(){this._fireEvents(this._arDeleteEventsToFire);this._arDeleteEventsToFire=null};AdfDhtmlMasonryLayoutPeer.prototype._fireInsertEvents=function(){this._fireEvents(this._arInsertEventsToFire);this._arInsertEventsToFire=null};
AdfDhtmlMasonryLayoutPeer.prototype._fireResizeEvents=function(){if(this._arResizeEventsToFire)for(var a=this._arResizeEventsToFire,b=a[a.length-1],d=0;d<a.length-1;d++){var e=a[d];b.addPriorResizeEvent(e.getChildClientId(),e.getOldSizeStyleClass(),e.getNewSizeStyleClass())}this._fireEvents(this._arResizeEventsToFire);this._arResizeEventsToFire=null};
AdfDhtmlMasonryLayoutPeer.prototype._getUncompressedSizeStyleClassName=function(a){for(var b,d=this._compressedMasonryTileSizeClasses,e=1;e<d.length;e++)for(var f=d[e],g=1;g<f.length;g++)if(AdfDomUtils.containsCSSClassName(a,f[g])){b=AdfDhtmlMasonryLayoutPeer._UNCOMPRESSED_MASONRY_TILE_SIZE_CLASSES[e][g];break}return b};
AdfDhtmlMasonryLayoutPeer.prototype._getSizeStyleClassName=function(a){for(var b,d=this._compressedMasonryTileSizeClasses,e=1;e<d.length;e++)for(var f=d[e],g=1;g<f.length;g++){var h=f[g];if(AdfDomUtils.containsCSSClassName(a,h)){b=h;break}}return b};
AdfDhtmlMasonryLayoutPeer.prototype._getTileSpan=function(a){var b=AdfDhtmlMasonryLayoutPeer._MASONRY_TILE_SIZE_CLASS_STEM,b=this._getUncompressedSizeStyleClassName(a).substring(b.length),d=b.indexOf("x");a=b.substring(0,d);b=b.substring(d+1);a=parseInt(a,10);b=parseInt(b,10);return{colSpan:a,rowSpan:b}};
AdfDhtmlMasonryLayoutPeer.prototype._preProcessOptimizedRender=function(a){if(this._mlCommon.isAnimationEnabled()){var b=AdfAgent.AGENT,d=AdfPage.PAGE.getLookAndFeel().getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_TRANSITION_SHOW_FROM_CLASS);a=a.childNodes;for(var e=0;e<a.length;e++){var f=a[e];1==f.nodeType&&b.getAttribute(f,"data-insert")&&AdfDomUtils.addCSSClassName(f.firstChild,d)}}};
AdfDhtmlMasonryLayoutPeer.prototype._processOptimizedRender=function(a){var b=AdfAgent.AGENT;this._processOptimizedRenderTimer=null;for(var d=a.childNodes,e=d.length,f=[],g=0;g<e;g++){var h=d[g];1==h.nodeType&&(b.getAttribute(h,"data-insert")?(this._processInsertTile(h),f.push(h)):b.getAttribute(h,"data-resize")&&(this._processResizeTile(h),f.push(h)))}for(;0<f.length;)h=f.pop(),a.removeChild(h);return-1};
AdfDhtmlMasonryLayoutPeer.prototype._processInsertTile=function(a){if(this._mlCommon.isInLayoutCycle()){var b=this;this._deferFunction(function(){b._processInsertTile(a)});return!1}var d=a.firstChild;return this._inserting?(this._mapReadyToInsert||(this._mapReadyToInsert={}),this._mapReadyToInsert[d.id]=a,!1):this._finishInsertTile(a)};
AdfDhtmlMasonryLayoutPeer.prototype._processResizeTile=function(a){if(this._mlCommon.isInLayoutCycle()){var b=this;this._deferFunction(function(){b._processResizeTile(a)});return!1}var d=a.firstChild.id,e=this._arResizeClientIds;if(e&&-1<AdfCollections.indexOf(e,d))return this._mapReadyToResize||(this._mapReadyToResize={}),this._mapReadyToResize[d]=a,!1;this._replaceResizedTile(a);return!0};
AdfDhtmlMasonryLayoutPeer.prototype._finishInsertTile=function(a){var b=a.firstChild,d=this.getComponent().getClientId(),e=this._mlCommon,f=AdfAgent.AGENT.getAttribute(a,"data-insert"),g=AdfRichUIPeer.createSubId(d,"placeholder"+f),d=this.getDomElement(),h=null;"-1"==f?h=document.getElementById(g):(g=d.querySelectorAll("#"+AdfDhtmlMasonryLayoutPeer._encodeSelector(g)))&&0<g.length&&(h=g[g.length-1]);if(h)return a=b.style,f=h.style,a.top=f.top,this._rtl?a.right=f.right:a.left=f.left,b._afrMasonryOriginalOrder=
h._afrMasonryOriginalOrder,d.replaceChild(b,h),AdfPage.PAGE.doResizeNotifyDom(b,!0),e.showTile("#"+AdfDhtmlMasonryLayoutPeer._encodeSelector(b.id)),!0;e=this._getSizeStyleClassName(b);f=parseInt(f,10);this.insertTile(e,f);this._mapReadyToInsert||(this._mapReadyToInsert={});this._mapReadyToInsert[b.id]=a;return!1};
AdfDhtmlMasonryLayoutPeer.prototype._replaceResizedTile=function(a){a=a.firstChild;var b=a.id,d=this.getComponent().getClientId(),b=AdfRichUIPeer.createSubId(d,b+"_resizePlaceholder"),b=document.getElementById(b),d=b.style,e=a.style;e.top=d.top;this._rtl?e.right=d.right:e.left=d.left;a._afrMasonryOriginalOrder=b._afrMasonryOriginalOrder;this.getDomElement().replaceChild(a,b);AdfPage.PAGE.doResizeNotifyDom(a,!0);this._resizingTileWithFocusId&&(b=document.getElementById(this._resizingTileWithFocusId),
b==a&&(AdfFocusUtils.focusFirstTabStop(b),this._resizingTileWithFocusId=null))};AdfDhtmlMasonryLayoutPeer.prototype._hideTileOnEndFunc=function(a){var b=AdfAgent.AGENT;AdfPage.PAGE.removeComponentsInSubtree(a);b.elementsRemoved(a);a.parentNode.removeChild(a);this._deleteTileOriginalOrder(a);this._fireDeleteEvents()};
AdfDhtmlMasonryLayoutPeer.prototype._layoutOnEndFunc=function(){var a=this._arResizeClientIds;if(a&&0<a.length){for(;0<a.length;){var b=a.pop(),d=this._mapReadyToResize;if(d){var e=d[b];e&&(delete d[b],this._replaceResizedTile(e))}}this._fireResizeEvents()}if(this._inserting){this._inserting=!1;if(a=this._mapReadyToInsert)for(var f in a)b=a[f],delete a[f],this._finishInsertTile(b);this._fireInsertEvents()}};
AdfDhtmlMasonryLayoutPeer.prototype._layoutCycleOnStartFunc=function(){this._layoutStartActiveDomElem=null;var a=AdfPage.PAGE.getActiveDomElement();if(a){var b=this.getDomElement();b&&AdfDomUtils.isAncestor(b,a)&&(this._layoutStartActiveDomElem=a)}};
AdfDhtmlMasonryLayoutPeer.prototype._layoutCycleOnEndFunc=function(){var a=this.getDomElement();if(a&&this._layoutStartActiveDomElem){var b=this._layoutStartActiveDomElem;this._layoutStartActiveDomElem=null;var d=AdfPage.PAGE.getActiveDomElement();this._deletingTileWithFocusPrevId?(b=document.getElementById(this._deletingTileWithFocusPrevId),this._deletingTileWithFocusPrevId=null,b&&AdfDomUtils.isAncestor(a,b)&&(a=this._getChildElements(a,!0),d=AdfCollections.indexOf(a,b),0<=d&&d<a.length-1?AdfFocusUtils.focusFirstTabStop(a[d+
1]):AdfFocusUtils.focusFirstTabStop(b))):d?AdfDomUtils.isAncestor(a,d)&&AdfFocusUtils.focusElement(d):AdfDomUtils.isAncestor(a,b)?AdfFocusUtils.focusElement(b):AdfFocusUtils.focusFirstTabStop(a)}if(this._deferredFunctions)for(a=this._deferredFunctions,this._deferredFunctions=null,b=0;b<a.length;b++)d=a[b],a[b]=null,d()};
AdfDhtmlMasonryLayoutPeer.prototype._getChildElements=function(a,b){for(var d=AdfDomUtils.getChildElements(a),e=d.length,f=[],g=0;g<e;g++){var h=d[g];if(!b||b&&h!==this._dropSite){var k=h.style;"hidden"!==k.visibility&&"none"!==k.display&&f.push(h)}}return f};AdfDhtmlMasonryLayoutPeer.prototype._saveTilesOriginalOrder=function(a){if(a)for(var b=0;b<a.length;b++)a[b]._afrMasonryOriginalOrder=b+1};
AdfDhtmlMasonryLayoutPeer.prototype._insertTileOriginalOrder=function(a,b){var d=this._getChildElements(this.getDomElement());0>b&&(b=d.length);if(d)for(var e=0;e<d.length;e++){var f=d[e];f._afrMasonryOriginalOrder&&f._afrMasonryOriginalOrder>=b+1&&f._afrMasonryOriginalOrder++}a._afrMasonryOriginalOrder=b+1};
AdfDhtmlMasonryLayoutPeer.prototype._deleteTileOriginalOrder=function(a){if(a._afrMasonryOriginalOrder){var b=this._getChildElements(this.getDomElement());if(b)for(var d=0;d<b.length;d++){var e=b[d];e._afrMasonryOriginalOrder&&e._afrMasonryOriginalOrder>a._afrMasonryOriginalOrder&&e._afrMasonryOriginalOrder--}delete a._afrMasonryOriginalOrder}};
AdfDhtmlMasonryLayoutPeer.prototype.dropOnRowKey=function(a,b,d,e,f,g){e=!0;d=null;b=this.getComponent();a&&(d=a.getDragSource().getComponent(),e=this._isExternalDragSource(d));f=this.getDomElement();a=-1;g=null;if(!e&&d){g=d.getPeer().getDomElement();var h=g.style;h.display="";if(this._dropSite){var k=this._dropSite;a=k.style;this._rtl?h.right=a.right:h.left=a.left;h.top=a.top;f.insertBefore(g,k);a=k._afrMasonryDragSourceIndex;this._insertTileOriginalOrder(g,k._afrMasonryOriginalOrder-1)}}this._dropSite&&
(this._deleteTileOriginalOrder(this._dropSite),f.removeChild(this._dropSite),this._dropSite=null);!e&&d&&(e=this._getChildIndex(f,g),a!=e&&(d=d.getClientId(),b=new AdfMasonryReorderEvent(b,d,a,e),b.setPropagatesToServer(this._hasReorderListener()),b.queue()))};
AdfDhtmlMasonryLayoutPeer.prototype.showDragFeedback=function(a,b,d,e,f,g,h){AdfAssert.assertPrototype(a,AdfDnDContext);AdfAssert.assertStringOrNull(b);AdfAssert.assertNumber(d);AdfAssert.assertStringOrNull(e);h&&(b=!0,d=null,a&&(d=a.getDragSource().getComponent(),b=this._isExternalDragSource(d)),a=!1,this._dropSite&&(a=this.getDomElement(),this._deleteTileOriginalOrder(this._dropSite),a.removeChild(this._dropSite),this._dropSite=null,a=!0),!b&&d&&(a=d.getPeer().getDomElement(),a.style.display="",
b=a._afrMasonryOriginalOrder,delete a._afrMasonryOriginalOrder,this._insertTileOriginalOrder(a,b-1),a=!0),a&&this._mlCommon.setup(!1,!0))};
AdfDhtmlMasonryLayoutPeer.prototype.getRowKeyBounds=function(a){if(!a)return null;a=this.getDomElement();var b=this._getTileSpan(this._dropSite),d=this._mlCommon.getCellSize(),e=this._dropSite.style,f=b.colSpan*d.w,g=AdfAgent.AGENT,h=0,h=this._rtl?a.offsetWidth-parseInt(e.right,10)-f:parseInt(e.left,10),e=parseInt(e.top,10),g=g.getElementPageBounds(a);g.left+=h-a.scrollLeft;g.right=g.left+f;g.top+=e-a.scrollTop;g.bottom=g.top+b.rowSpan*d.h;return g};
AdfDhtmlMasonryLayoutPeer.prototype.getDraggedSourceChildIndex=function(a,b){var d=a.getClientId();if(!b&&this._draggedSourceClientId==d)return this._draggedSourceIndex;this._draggedSourceClientId=d;return this._draggedSourceIndex=this._dropSite._afrMasonryDragSourceIndex};
AdfDhtmlMasonryLayoutPeer.prototype.getRowKeyAndOrientationFromHints=function(a,b,d){AdfAssert.assertNumber(a);AdfAssert.assertNumber(b);AdfAssert.assert(null!=d);var e=d[AdfStampedDropTarget.HINT_LAST_ROWKEY],f=d[AdfStampedDropTarget.HINT_LAST_ROWKEY_BOUNDS],g=d[AdfStampedDropTarget.HINT_LAST_DROP_ORIENTATION];if(e&&f&&(AdfAssert.assertString(e),AdfAssert.assertObject(f),a>=f.left&&b>=f.top&&a<=f.right&&b<=f.bottom)){d[AdfStampedDropTarget.ROW_KEY]=e;d[AdfStampedDropTarget.DROP_ORIENTATION]=g;return}var f=
!0,h=AdfPage.PAGE,k=h.getDnDContext(),l=null;k&&(l=k.getDragSource().getComponent(),f=this._isExternalDragSource(l));this._getRowKeyAndOrientationForPosition(a,b,d,f,l);a=d[AdfStampedDropTarget.ROW_KEY];!e||a&&e!==a?(d=this.getDomElement(),!this._dropSite&&l?l&&(g=h.getLookAndFeel().getStyleClass(AdfDhtmlMasonryLayoutPeer._MASONRY_LAYOUT_DROP_TARGET_CLASS),e=l.getPeer().getDomElement(),this._draggedSourceIndex=this._draggedSourceClientId=null,l=this._dropSite=document.createElement("div"),h=this._getSizeStyleClassName(e),
AdfDomUtils.addCSSClassName(l,g),h||(h=this._masonryTile1x1Class),AdfDomUtils.addCSSClassName(l,h),AdfDomUtils.addCSSClassName(l,"p_AFDropTarget"),f?this._insertTileOriginalOrder(l,parseInt(a,10)):(f=this._getChildIndex(d,e),l._afrMasonryDragSourceIndex=f,l._afrMasonryOriginalOrder=e._afrMasonryOriginalOrder,f=l.style,a=e.style,this._rtl?f.right=a.right:f.left=a.left,f.top=a.top,a.display="none"),d.insertBefore(l,e)):(l=this._dropSite,a?(f=parseInt(a,10),a=this._getChildAtIndex(d,f),this._deleteTileOriginalOrder(l),
this._insertTileOriginalOrder(l,f),d.insertBefore(l,a)):(f=this._getChildElements(d,!0),this._deleteTileOriginalOrder(l),this._insertTileOriginalOrder(l,f.length),d.appendChild(l))),this._mlCommon.setup(!1,!0)):(d[AdfStampedDropTarget.ROW_KEY]=e,d[AdfStampedDropTarget.DROP_ORIENTATION]=g)};
AdfDhtmlMasonryLayoutPeer.prototype._getRowKeyAndOrientationForPosition=function(a,b,d,e,f){AdfAssert.assertNumber(a);AdfAssert.assertNumber(b);a=this._getDisplayDropIndexFromCoordinates(this.getComponent(),this.getDomElement(),a,b,e,f);d[AdfStampedDropTarget.ROW_KEY]=a?a:null;d[AdfStampedDropTarget.DROP_ORIENTATION]=AdfDropEvent.DROP_ORIENTATION_INSIDE};
AdfDhtmlMasonryLayoutPeer.prototype._getDisplayDropIndexFromCoordinates=function(a,b,d,e,f,g){a=AdfAgent.AGENT;if(a.pointInElementBounds(b,d,e)){if(e=this._getChildUnderPoint(b,d,e))return d=d-document.documentElement.scrollLeft-a.getElementLeft(b)+b.scrollLeft>=e.offsetLeft+.5*e.offsetWidth,a=AdfPage.PAGE.getLocaleContext().isRightToLeft(),b=this._getChildIndex(b,e),g=g.getPeer().getDomElement(),e!==g&&e!==this._dropSite&&(d&&!a||!d&&a)&&b++,""+b;if(!this._dropSite)return(g=this._getChildElements(b,
!0))&&0<g.length?""+g.length:"0"}return null};AdfDhtmlMasonryLayoutPeer.prototype._getChildUnderPoint=function(a,b,d){a=this._getChildElements(a,!0);for(var e=a.length,f=AdfAgent.AGENT,g=0;g<e;g++){var h=a[g];if(f.pointInElementBounds(h,b,d))return h}return null};AdfDhtmlMasonryLayoutPeer.prototype._getChildIndex=function(a,b){var d=this._getChildElements(a,!0);AdfDhtmlMasonryLayoutPeer._sortTilesOriginalOrder(d);for(var e=d.length,f=0;f<e;f++)if(d[f]===b)return f;return-1};
AdfDhtmlMasonryLayoutPeer.prototype._getChildAtIndex=function(a,b){var d=this._getChildElements(a,!0);AdfDhtmlMasonryLayoutPeer._sortTilesOriginalOrder(d);var e=d.length;return 0<=b&&b<e?d[b]:null};AdfDhtmlMasonryLayoutPeer.prototype._isExternalDragSource=function(a){return a.getPeer().getDomElement().parentNode==this.getDomElement()?!1:!0};