UNPKG

@blare/angular2gridster

Version:

[![npm version](https://badge.fury.io/js/angular2gridster.svg)](https://badge.fury.io/js/angular2gridster)

1 lines 71.6 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("@blare/angular2gridster",["exports","@angular/core","rxjs","rxjs/operators","@angular/common"],e):e((t.blare=t.blare||{},t.blare.angular2gridster={}),t.ng.core,t.rxjs,t.rxjs.operators,t.ng.common)}(this,function(t,r,h,p,e){"use strict";var i=function(t,e){t.style.left=e.x+"px",t.style.top=e.y+"px"},n=function(t){t.style.left="",t.style.top=""},o=function(t,e){var i="translate("+e.x+"px,"+e.y+"px)";t.style.transform=i,t.style.WebkitTransform=i,t.style.MozTransform=i,t.style.msTransform=i,t.style.OTransform=i},s=function(){document.selection?document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()},a=function(t,e){var i=e.getBoundingClientRect(),n=t.getBoundingClientRect();return n.left>i.left&&n.right<i.right&&n.top>i.top&&n.bottom<i.bottom},l=function(t,e){var i=e.getBoundingClientRect(),n=t.getBoundingClientRect(),r=n.right-n.left,o=n.bottom-n.top;return n.left+r/2>i.left&&n.right-r/2<i.right&&n.top+o/2>i.top&&n.bottom-o/2<i.bottom},u=function(t,e){var i=e.getBoundingClientRect(),n=t.getBoundingClientRect();return n.right>i.left&&n.bottom>i.top&&n.left<i.right&&n.top<i.bottom},g=function(t,e){var i=e.getBoundingClientRect();return t.pageX>i.left&&t.pageX<i.right&&t.pageY>i.top&&t.pageY<i.bottom},c=function(t){var e=window.getComputedStyle(t);return parseFloat(e.getPropertyValue("height"))+parseFloat(e.getPropertyValue("padding-top"))+parseFloat(e.getPropertyValue("padding-bottom"))},d=function(t,e){var i=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:n.top-i.top,left:n.left-i.left}},m=function(t){var i=/(auto|scroll)/,n=function(t,e){return null===t.parentNode?e:n(t.parentNode,e.concat([t]))},r=function(t,e){return getComputedStyle(t,null).getPropertyValue(e)},o=function(t){return i.test(r(e=t,"overflow")+r(e,"overflow-y")+r(e,"overflow-x"));var e};return function(t){if(t instanceof HTMLElement||t instanceof SVGElement){for(var e=n(t.parentNode,[]),i=0;i<e.length;i+=1)if(o(e[i]))return e[i];return document.scrollingElement||document.documentElement}}(t)},f=function(){return(f=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function y(t){var e="function"==typeof Symbol&&t[Symbol.iterator],i=0;return e?e.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}function v(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,o=i.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(a){r={error:a}}finally{try{n&&!n.done&&(i=o["return"])&&i.call(o)}finally{if(r)throw r.error}}return s}function b(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(v(arguments[e]));return t}var x=function(t){for(var e=0;e<t;e++)this.push(null)};x.prototype=[];var w=function(){function u(t,e){this.options=e,this.items=t,this.adjustSizeOfItems(),this.generateGrid()}return u.prototype.toString=function(){var t,e,i,n=this.grid.length,r="\n #|",o="\n --";for(e=0;e<n;e++)r+=" "+this.padNumber(e," "),o+="---";for(r+=o,e=0;e<this.options.lanes;e++)for(r+="\n"+this.padNumber(e," ")+"|",i=0;i<n;i++)r+=" ",r+=(t=this.grid[i][e])?this.padNumber(this.items.indexOf(t),"0"):"--";return r+="\n"},u.prototype.setOption=function(t,e){this.options[t]=e},u.prototype.generateGrid=function(){var t;for(this.resetGrid(),t=0;t<this.items.length;t++)this.markItemPositionToGrid(this.items[t])},u.prototype.resizeGrid=function(t){var e=0;this.options.lanes=t,this.adjustSizeOfItems(),this.sortItemsByPosition(),this.resetGrid();for(var i=0;i<this.items.length;i++){var n=this.items[i],r=this.getItemPosition(n);this.updateItemPosition(n,this.findPositionForItem(n,{x:e,y:0})),e=Math.max(e,r.x)}this.pullItemsToLeft()},u.prototype.findPositionForItem=function(t,e,i){var n,r,o;for(n=e.x;n<this.grid.length;n++)if(i!==undefined){if(o=[n,i],this.itemFitsAtPosition(t,o))return o}else for(r=e.y;r<this.options.lanes;r++)if(o=[n,r],this.itemFitsAtPosition(t,o))return o;var s=this.grid.length,a=0;return i!==undefined&&this.itemFitsAtPosition(t,[s,i])&&(a=i),[s,a]},u.prototype.moveAndResize=function(t,e,i){var n=this.getItemPosition({x:e[0],y:e[1],w:t.w,h:t.h}),r=i.w||t.w,o=i.h||t.h;this.updateItemPosition(t,[n.x,n.y]),this.updateItemSize(t,r,o),this.resolveCollisions(t)},u.prototype.moveItemToPosition=function(t,e){var i=this.getItemPosition({x:e[0],y:e[1],w:t.w,h:t.h});this.updateItemPosition(t,[i.x,i.y]),this.resolveCollisions(t)},u.prototype.resizeItem=function(t,e){var i=e.w||t.w,n=e.h||t.h;this.updateItemSize(t,i,n),this.pullItemsToLeft(t)},u.prototype.getChangedItems=function(s,a){return this.items.map(function(e){var t=[],i={},n=s.find(function(t){return t.$element===e.$element});if(!n)return{item:e,changes:["x","y","w","h"],isNew:!0};var r=n.getValueX(a);e.getValueX(a)!==r&&(t.push("x"),(r||0===r)&&(i.x=r));var o=n.getValueY(a);return e.getValueY(a)!==o&&(t.push("y"),(o||0===o)&&(i.y=o)),e.getValueW(a)!==n.getValueW(a)&&(t.push("w"),i.w=n.w),e.getValueH(a)!==n.getValueH(a)&&(t.push("h"),i.h=n.h),{item:e,oldValues:i,changes:t,isNew:!1}}).filter(function(t){return t.changes.length})},u.prototype.resolveCollisions=function(t){this.tryToResolveCollisionsLocally(t)||this.pullItemsToLeft(t),this.options.floating?this.pullItemsToLeft():this.getItemsCollidingWithItem(t).length&&this.pullItemsToLeft()},u.prototype.pushCollidingItems=function(e){var i=this;this.sortItemsByPosition(),this.resetGrid(),this.generateGrid(),this.items.filter(function(t){return!i.isItemFloating(t)&&t!==e}).forEach(function(t){i.tryToResolveCollisionsLocally(t)||i.pullItemsToLeft(t)})},u.prototype.pullItemsToLeft=function(e){var i=this;if("none"!==this.options.direction){if(this.sortItemsByPosition(),this.resetGrid(),e){var t=this.getItemPosition(e);this.updateItemPosition(e,[t.x,t.y])}this.items.filter(function(t){return!t.dragAndDrop&&t!==e}).forEach(function(t){var e=i.getItemPosition(t);i.updateItemPosition(t,[e.x,e.y])});for(var n=0;n<this.items.length;n++){var r=this.items[n],o=this.getItemPosition(r);if(!(e&&r===e||!r.dragAndDrop||!this.options.floating&&this.isItemFloating(r)&&!this.getItemsCollidingWithItem(r).length)){var s=this.findLeftMostPositionForItem(r),a=this.findPositionForItem(r,{x:s,y:0},o.y);this.updateItemPosition(r,a)}}}},u.prototype.isOverFixedArea=function(t,e,i,n,r){void 0===r&&(r=null);var o={x:t,y:e,w:i,h:n};"horizontal"!==this.options.direction&&(o={x:e,y:t,w:n,h:i});for(var s=o.x;s<o.x+o.w;s++)for(var a=o.y;a<o.y+o.h;a++)if(this.grid[s]&&this.grid[s][a]&&this.grid[s][a]!==r&&!this.grid[s][a].dragAndDrop)return!0;return!1},u.prototype.checkItemAboveEmptyArea=function(t,e){var i={x:e.x,y:e.y,w:t.w,h:t.h};return!t.itemPrototype&&t.x===e.x&&t.y===e.y||("horizontal"===this.options.direction&&(i={x:e.y,y:e.x,w:i.h,h:i.w}),!this.checkItemsInArea(i.y,i.y+i.h-1,i.x,i.x+i.w-1,t))},u.prototype.fixItemsPositions=function(n){var e=this,t=this.items.filter(function(t){return t.itemComponent}).filter(function(t){return e.isItemValidForGrid(t,n)}),i=this.items.filter(function(t){return t.itemComponent}).filter(function(t){return!e.isItemValidForGrid(t,n)}),r=new u([],n);r.items=t.map(function(t){return t.copyForBreakpoint(n.breakpoint)}),r.generateGrid(),i.forEach(function(t){var e=t.copyForBreakpoint(n.breakpoint),i=r.findPositionForItem(e,{x:0,y:0});r.items.push(e),r.setItemPosition(e,i),r.markItemPositionToGrid(e)}),r.pullItemsToLeft(),r.pushCollidingItems(),this.items.forEach(function(e){var t=r.items.filter(function(t){return t.$element===e.$element})[0];e.setValueX(t.x,n.breakpoint),e.setValueY(t.y,n.breakpoint),e.setValueW(t.w,n.breakpoint),e.setValueH(t.h,n.breakpoint),e.autoSize=t.autoSize})},u.prototype.deleteItemPositionFromGrid=function(t){var e,i,n=this.getItemPosition(t);for(e=n.x;e<n.x+n.w;e++)if(this.grid[e])for(i=n.y;i<n.y+n.h;i++)this.grid[e][i]===t&&(this.grid[e][i]=null)},u.prototype.isItemFloating=function(t){if(t.itemComponent&&t.itemComponent.isDragging)return!1;var e=this.getItemPosition(t);return 0!==e.x&&(this.grid[e.x-1]||[]).slice(e.y,e.y+e.h).reduce(function(t,e){return t&&!e},!0)},u.prototype.isItemValidForGrid=function(t,e){var i="horizontal"===e.direction?{x:t.getValueY(e.breakpoint),y:t.getValueX(e.breakpoint),w:t.getValueH(e.breakpoint),h:Math.min(t.getValueW(this.options.breakpoint),e.lanes)}:{x:t.getValueX(e.breakpoint),y:t.getValueY(e.breakpoint),w:Math.min(t.getValueW(this.options.breakpoint),e.lanes),h:t.getValueH(e.breakpoint)};return"number"==typeof i.x&&"number"==typeof i.y&&i.x+i.w<=e.lanes},u.prototype.findDefaultPositionHorizontal=function(t,e){var i,n;try{for(var r=y(this.grid),o=r.next();!o.done;o=r.next())for(var s=o.value,a=this.grid.indexOf(s),h=0;h<s.length-e+1;){if(!this.checkItemsInArea(a,a+t-1,h,h+e-1))return[a,h];h++}}catch(p){i={error:p}}finally{try{o&&!o.done&&(n=r["return"])&&n.call(r)}finally{if(i)throw i.error}}return[this.grid.length,0]},u.prototype.findDefaultPositionVertical=function(t,e){var i,n;try{for(var r=y(this.grid),o=r.next();!o.done;o=r.next())for(var s=o.value,a=this.grid.indexOf(s),h=0;h<s.length-t+1;){if(!this.checkItemsInArea(a,a+e-1,h,h+t-1))return[h,a];h++}}catch(p){i={error:p}}finally{try{o&&!o.done&&(n=r["return"])&&n.call(r)}finally{if(i)throw i.error}}return[0,this.grid.length]},u.prototype.checkItemsInArea=function(t,e,i,n,r){for(var o=t;o<=e;o++)for(var s=i;s<=n;s++)if(this.grid[o]&&this.grid[o][s]&&(!r||this.grid[o][s]!==r))return!0;return!1},u.prototype.sortItemsByPosition=function(){var r=this;this.items.sort(function(t,e){var i=r.getItemPosition(t),n=r.getItemPosition(e);return i.x!==n.x?i.x-n.x:i.y!==n.y?i.y-n.y:0})},u.prototype.adjustSizeOfItems=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.autoSize===undefined&&(e.autoSize=0===e.w||0===e.h),e.autoSize&&("horizontal"===this.options.direction?e.h=this.options.lanes:e.w=this.options.lanes)}},u.prototype.resetGrid=function(){this.grid=[]},u.prototype.itemFitsAtPosition=function(t,e){var i,n,r=this.getItemPosition(t);if(e[0]<0||e[1]<0)return!1;if(e[1]+Math.min(r.h,this.options.lanes)>this.options.lanes)return!1;if(this.isOverFixedArea(t.x,t.y,t.w,t.h))return!1;for(i=e[0];i<e[0]+r.w;i++){var o=this.grid[i];if(o)for(n=e[1];n<e[1]+r.h;n++)if(o[n]&&o[n]!==t)return!1}return!0},u.prototype.updateItemPosition=function(t,e){null!==t.x&&null!==t.y&&this.deleteItemPositionFromGrid(t),this.setItemPosition(t,e),this.markItemPositionToGrid(t)},u.prototype.updateItemSize=function(t,e,i){null!==t.x&&null!==t.y&&this.deleteItemPositionFromGrid(t),t.w=e,t.h=i,this.markItemPositionToGrid(t)},u.prototype.markItemPositionToGrid=function(t){var e,i,n=this.getItemPosition(t);for(this.ensureColumns(n.x+n.w),e=n.x;e<n.x+n.w;e++)for(i=n.y;i<n.y+n.h;i++)this.grid[e][i]=t},u.prototype.ensureColumns=function(t){for(var e=0;e<t;e++)this.grid[e]||this.grid.push(new x(this.options.lanes))},u.prototype.getItemsCollidingWithItem=function(t){for(var e=[],i=0;i<this.items.length;i++)t!==this.items[i]&&this.itemsAreColliding(t,this.items[i])&&e.push(i);return e},u.prototype.itemsAreColliding=function(t,e){var i=this.getItemPosition(t),n=this.getItemPosition(e);return!(n.x>=i.x+i.w||n.x+n.w<=i.x||n.y>=i.y+i.h||n.y+n.h<=i.y)},u.prototype.tryToResolveCollisionsLocally=function(t){var e=this.getItemsCollidingWithItem(t);if(!e.length)return!0;for(var i,n,r,o,s=new u(this.items.map(function(t){return t.copy()}),this.options),a=0;a<e.length;a++){var h=s.items[e[a]],p=this.getItemPosition(h),l=this.getItemPosition(t);if(i=[l.x-p.w,p.y],n=[l.x+l.w,p.y],r=[p.x,l.y-p.h],o=[p.x,l.y+l.h],s.itemFitsAtPosition(h,i))s.updateItemPosition(h,i);else if(s.itemFitsAtPosition(h,r))s.updateItemPosition(h,r);else if(s.itemFitsAtPosition(h,o))s.updateItemPosition(h,o);else{if(!s.itemFitsAtPosition(h,n))return!1;s.updateItemPosition(h,n)}}return this.items.forEach(function(e,t){var i=s.items.filter(function(t){return t.$element===e.$element})[0];e.x=i.x,e.y=i.y,e.w=i.w,e.h=i.h,e.autoSize=i.autoSize}),this.generateGrid(),!0},u.prototype.findLeftMostPositionForItem=function(t){for(var e=0,i=this.getItemPosition(t),n=0;n<this.grid.length;n++)for(var r=i.y;r<i.y+i.h;r++){var o=this.grid[n][r];if(o){var s=this.getItemPosition(o);this.items.indexOf(o)<this.items.indexOf(t)&&(e=s.x+s.w)}}return e},u.prototype.findItemByPosition=function(t,e){for(var i=0;i<this.items.length;i++)if(this.items[i].x===t&&this.items[i].y===e)return this.items[i]},u.prototype.getItemByAttribute=function(t,e){for(var i=0;i<this.items.length;i++)if(this.items[i][t]===e)return this.items[i];return null},u.prototype.padNumber=function(t,e){return 10<=t?t:e+t},u.prototype.getItemPosition=function(t){return"horizontal"===this.options.direction?t:{x:t.y,y:t.x,w:t.h,h:t.w}},u.prototype.setItemPosition=function(t,e){"horizontal"===this.options.direction?(t.x=e[0],t.y=e[1]):(t.x=e[1],t.y=e[0])},u}(),E=function(){function t(){var t=this;this.items=[],this._items=[],this._itemsMap={},this.disabledItems=[],this.debounceRenderSubject=new h.Subject,this.itemRemoveSubject=new h.Subject,this.isInit=!1,this.itemRemoveSubject.pipe(p.debounceTime(0)).subscribe(function(){t.gridList.pullItemsToLeft(),t.render(),t.updateCachedItems()}),this.debounceRenderSubject.pipe(p.debounceTime(0)).subscribe(function(){return t.render()})}return t.prototype.isInitialized=function(){return this.isInit},t.prototype.registerItem=function(t){return this.items.push(t),t},t.prototype.init=function(t){this.gridsterComponent=t,this.draggableOptions=t.draggableOptions,this.gridsterOptions=t.gridsterOptions},t.prototype.start=function(){var t=this;this.updateMaxItemSize(),this.$positionHighlight&&this.removePositionHighlight(),this.initGridList(),this.isInit=!0,setTimeout(function(){t.copyItems(),t.fixItemsPositions(),t.gridsterComponent.reflowGridster(!0),t.gridsterComponent.setReady()})},t.prototype.initGridList=function(){this.gridList=new w(this.items,this.options)},t.prototype.render=function(){this.updateMaxItemSize(),this.gridList.generateGrid(),this.applySizeToItems(),this.applyPositionToItems(),this.refreshLines()},t.prototype.reflow=function(){this.calculateCellSize(),this.render()},t.prototype.fixItemsPositions=function(){var e=this;this.options.responsiveSizes?this.gridList.fixItemsPositions(this.options):(this.gridList.fixItemsPositions(this.gridsterOptions.basicOptions),this.gridsterOptions.responsiveOptions.forEach(function(t){e.gridList.fixItemsPositions(t)})),this.updateCachedItems()},t.prototype.removeItem=function(t){0<=this.items.indexOf(t)&&this.items.splice(this.items.indexOf(t),1),this.gridList.deleteItemPositionFromGrid(t),this.removeItemFromCache(t)},t.prototype.onResizeStart=function(t){this.currentElement=t.$element,this.copyItems(),this._maxGridCols=this.gridList.grid.length,this.highlightPositionForItem(t),this.gridsterComponent.isResizing=!0,this.refreshLines()},t.prototype.onResizeDrag=function(t){var e=this.snapItemSizeToGrid(t),i=this.dragSizeChanged(e),n=this.snapItemPositionToGrid(t),r=this.dragPositionChanged(n);(i||r)&&(this.restoreCachedItems(),this.gridList.generateGrid(),this.previousDragPosition=n,this.previousDragSize=e,this.gridList.moveAndResize(t,n,{w:e[0],h:e[1]}),this.applyPositionToItems(!0),this.highlightPositionForItem(t))},t.prototype.onResizeStop=function(t){this.currentElement=undefined,this.updateCachedItems(),this.previousDragSize=null,this.removePositionHighlight(),this.gridsterComponent.isResizing=!1,this.gridList.pullItemsToLeft(t),this.debounceRenderSubject.next(),this.fixItemsPositions()},t.prototype.onStart=function(t){this.currentElement=t.$element,this.copyItems(),this._maxGridCols=this.gridList.grid.length,this.gridsterComponent.isDragging=!0,this.gridsterComponent.updateGridsterElementData(),this.refreshLines()},t.prototype.onDrag=function(t){var e=this.snapItemPositionToGrid(t);if(this.dragPositionChanged(e)){if(this.restoreCachedItems(),this.gridList.generateGrid(),this.previousDragPosition=e,"none"===this.options.direction&&!this.gridList.checkItemAboveEmptyArea(t,{x:e[0],y:e[1]}))return;this.gridList.moveItemToPosition(t,e),this.applyPositionToItems(!0),this.highlightPositionForItem(t)}},t.prototype.cancel=function(){this.restoreCachedItems(),this.previousDragPosition=null,this.updateMaxItemSize(),this.applyPositionToItems(),this.removePositionHighlight(),this.currentElement=undefined,this.gridsterComponent.isDragging=!1},t.prototype.onDragOut=function(t){this.cancel();var e=this.items.indexOf(t);0<=e&&this.items.splice(e,1),this.gridList.pullItemsToLeft(),this.render()},t.prototype.onStop=function(t){this.currentElement=undefined,this.updateCachedItems(),this.previousDragPosition=null,this.removePositionHighlight(),this.gridList.pullItemsToLeft(t),this.gridsterComponent.isDragging=!1,this.refreshLines()},t.prototype.calculateCellSize=function(){"horizontal"===this.options.direction?(this.cellHeight=this.calculateCellHeight(),this.cellWidth=this.options.cellWidth||this.cellHeight*this.options.widthHeightRatio):(this.cellWidth=this.calculateCellWidth(),this.cellHeight=this.options.cellHeight||this.cellWidth/this.options.widthHeightRatio),this.options.heightToFontSizeRatio&&(this._fontSize=this.cellHeight*this.options.heightToFontSizeRatio)},t.prototype.applyPositionToItems=function(t){this.options.shrink||(t=!0);for(var e=0;e<this.items.length;e++)this.isCurrentElement(this.items[e].$element)||this.items[e].applyPosition(this);var i=this.gridsterComponent.$element.firstChild;if("horizontal"===this.options.direction){var n=t?this.maxItemWidth:0;i.style.height="",i.style.width=(this.gridList.grid.length+n)*this.cellWidth+"px"}else if(this.gridList.grid.length){var r=t?this.maxItemHeight:0;i.style.height=(this.gridList.grid.length+r)*this.cellHeight+"px",i.style.width=""}},t.prototype.refreshLines=function(){var t=this.gridsterComponent.$element.firstChild;if(this.options.lines&&this.options.lines.visible&&(this.gridsterComponent.isDragging||this.gridsterComponent.isResizing||this.options.lines.always)){var e=this.options.lines.color||"#d8d8d8",i=this.options.lines.backgroundColor||"transparent",n=this.options.lines.width||1,r=n/2;t.style.backgroundSize=this.cellWidth+"px "+this.cellHeight+"px",t.style.backgroundPosition="-"+r+"px -"+r+"px",t.style.backgroundImage="\n linear-gradient(to right, "+e+" "+n+"px, "+i+" "+n+"px),\n linear-gradient(to bottom, "+e+" "+n+"px, "+i+" "+n+"px)\n "}else t.style.backgroundSize="",t.style.backgroundPosition="",t.style.backgroundImage=""},t.prototype.removeItemFromCache=function(e){var i=this;this._items=this._items.filter(function(t){return t.$element!==e.$element}),Object.keys(this._itemsMap).forEach(function(t){i._itemsMap[t]=i._itemsMap[t].filter(function(t){return t.$element!==e.$element})})},t.prototype.copyItems=function(){var i=this;this._items=this.items.filter(function(t){return i.isValidGridItem(t)}).map(function(t){return t.copyForBreakpoint(null)}),this.gridsterOptions.responsiveOptions.forEach(function(e){i._itemsMap[e.breakpoint]=i.items.filter(function(t){return i.isValidGridItem(t)}).map(function(t){return t.copyForBreakpoint(e.breakpoint)})})},t.prototype.updateMaxItemSize=function(){this.maxItemWidth=Math.max.apply(null,this.items.map(function(t){return t.w})),this.maxItemHeight=Math.max.apply(null,this.items.map(function(t){return t.h}))},t.prototype.restoreCachedItems=function(){var e=this,i=this.options.breakpoint?this._itemsMap[this.options.breakpoint]:this._items;this.items.filter(function(t){return e.isValidGridItem(t)}).forEach(function(e){var t=i.filter(function(t){return t.$element===e.$element})[0];e.x=t.x,e.y=t.y,e.w=t.w,e.h=t.h,e.autoSize=t.autoSize})},t.prototype.isValidGridItem=function(t){return"none"!==this.options.direction||!!t.itemComponent},t.prototype.calculateCellWidth=function(){var t=parseFloat(window.getComputedStyle(this.gridsterComponent.$element).width);return Math.floor(t/this.options.lanes)},t.prototype.calculateCellHeight=function(){var t=parseFloat(window.getComputedStyle(this.gridsterComponent.$element).height);return Math.floor(t/this.options.lanes)},t.prototype.applySizeToItems=function(){for(var t=0;t<this.items.length;t++)this.items[t].applySize(),this.options.heightToFontSizeRatio&&(this.items[t].$element.style["font-size"]=this._fontSize)},t.prototype.isCurrentElement=function(t){return!!this.currentElement&&t===this.currentElement},t.prototype.snapItemSizeToGrid=function(t){var e=parseInt(t.$element.style.width,10)-1,i=parseInt(t.$element.style.height,10)-1,n=Math.round(e/this.cellWidth),r=Math.round(i/this.cellHeight);return n=Math.max(n,1),r=Math.max(r,1),this.gridList.isOverFixedArea(t.x,t.y,n,r,t)?[t.w,t.h]:[n,r]},t.prototype.generateItemPosition=function(t){var e;if(t.itemPrototype){var i=t.itemPrototype.getPositionToGridster(this);e={x:Math.round(i.x/this.cellWidth),y:Math.round(i.y/this.cellHeight)}}else e={x:Math.round(t.positionX/this.cellWidth),y:Math.round(t.positionY/this.cellHeight)};return e},t.prototype.snapItemPositionToGrid=function(t){var e=this.generateItemPosition(t),i=e.x,n=e.y;return i=Math.max(i,0),n=Math.max(n,0),i="horizontal"===this.options.direction?Math.min(i,this._maxGridCols):Math.min(i,Math.max(0,this.options.lanes-t.w)),this.gridList.isOverFixedArea(i,n,t.w,t.h)?[t.x,t.y]:[i,n]},t.prototype.dragSizeChanged=function(t){return!this.previousDragSize||(t[0]!==this.previousDragSize[0]||t[1]!==this.previousDragSize[1])},t.prototype.dragPositionChanged=function(t){return!this.previousDragPosition||(t[0]!==this.previousDragPosition[0]||t[1]!==this.previousDragPosition[1])},t.prototype.highlightPositionForItem=function(t){var e=t.calculateSize(this),i=t.calculatePosition(this);this.$positionHighlight.style.width=e.width+"px",this.$positionHighlight.style.height=e.height+"px",this.$positionHighlight.style.left=i.left+"px",this.$positionHighlight.style.top=i.top+"px",this.$positionHighlight.style.display="",this.options.heightToFontSizeRatio&&(this.$positionHighlight.style["font-size"]=this._fontSize)},t.prototype.updateCachedItems=function(){var e=this;this.triggerOnChange(null),this.gridsterOptions.responsiveOptions.forEach(function(t){e.triggerOnChange(t.breakpoint)}),this.copyItems()},t.prototype.triggerOnChange=function(e){var t=e?this._itemsMap[e]:this._items;this.gridList.getChangedItems(t||[],e).filter(function(t){return t.item.itemComponent}).forEach(function(t){0<=t.changes.indexOf("x")&&t.item.triggerChangeX(e),0<=t.changes.indexOf("y")&&t.item.triggerChangeY(e),0<=t.changes.indexOf("w")&&t.item.triggerChangeW(e),0<=t.changes.indexOf("h")&&t.item.triggerChangeH(e),t.item.itemComponent.change.emit({item:t.item,oldValues:t.oldValues||{},isNew:t.isNew,changes:t.changes,breakpoint:e})})},t.prototype.removePositionHighlight=function(){this.$positionHighlight.style.display="none"},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[]},t}(),P=function(){function t(){this.isDragging=!1,this.dragSubject=new h.Subject,this.dragStartSubject=new h.Subject,this.dragStopSubject=new h.Subject}return t.prototype.observeDropOver=function(n){var r=this;return this.dragStopSubject.pipe(p.filter(function(i){var t=n.gridsterComponent.$element;return![].slice.call(t.querySelectorAll("gridster")).reduce(function(t,e){return t||r.isOverGridster(i.item,e,i.event,n.options)},!1)&&r.isOverGridster(i.item,t,i.event,n.options)}),p.tap(function(t){t.item.onDrop(n)}))},t.prototype.observeDropOut=function(i){var n=this;return this.dragStopSubject.pipe(p.filter(function(t){var e=i.gridsterComponent.$element;return!n.isOverGridster(t.item,e,t.event,i.options)}),p.tap(function(t){t.item.onCancel()}))},t.prototype.observeDragOver=function(i){var n=this,t=this.dragSubject.pipe(p.map(function(t){var e=i.gridsterComponent.$element;return{item:t.item,event:t.event,isOver:n.isOverGridster(t.item,e,t.event,i.options),isDrop:!1}})),e=this.dragStopSubject.pipe(p.map(function(t){var e=i.gridsterComponent.$element;return{item:t.item,event:t.event,isOver:n.isOverGridster(t.item,e,t.event,i.options),isDrop:!0}})),r=h.merge(this.dragStartSubject.pipe(p.map(function(){return{item:null,isOver:!1,isDrop:!1}})),t,e).pipe(p.scan(function(t,e){return{item:e.item,event:e.event,isOver:e.isOver,isEnter:!1===t.isOver&&!0===e.isOver,isOut:!0===t.isOver&&!1===e.isOver&&!t.isDrop,isDrop:e.isDrop}}),p.filter(function(t){return!t.isDrop}),p.share()),o=this.createDragEnterObservable(r,i),s=this.createDragOutObservable(r,i),a=o.pipe(p.switchMap(function(){return n.dragSubject.pipe(p.takeUntil(s))}),p.map(function(t){return t.item}));return{dragEnter:o,dragOut:s,dragOver:a}},t.prototype.dragItemStart=function(t,e){this.isDragging=!0,this.dragStartSubject.next({item:t,event:e})},t.prototype.dragItemStop=function(t,e){this.isDragging=!1,this.dragStopSubject.next({item:t,event:e})},t.prototype.updatePrototypePosition=function(t,e){this.dragSubject.next({item:t,event:e})},t.prototype.createDragOverObservable=function(t,e){return t.pipe(p.filter(function(t){return t.isOver&&!t.isEnter&&!t.isOut}),p.map(function(t){return t.item}),p.tap(function(t){return t.onOver(e)}))},t.prototype.createDragEnterObservable=function(t,e){return t.pipe(p.filter(function(t){return t.isEnter}),p.map(function(t){return t.item}),p.tap(function(t){return t.onEnter(e)}))},t.prototype.createDragOutObservable=function(t,e){return t.pipe(p.filter(function(t){return t.isOut}),p.map(function(t){return t.item}),p.tap(function(t){return t.onOut(e)}))},t.prototype.isOverGridster=function(t,e,i,n){var r=t.$element,o=e.parentElement&&e.parentElement.closest("gridster-item");if(o)return this.isOverGridster(t,o,i,n);switch(n.tolerance){case"fit":return a(r,e);case"intersect":return l(r,e);case"touch":return u(r,e);default:return g(i,e)}},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[]},t}(),I=function(){function t(t,e){var i=this;this.defaults={lanes:5,direction:"horizontal",widthHeightRatio:1,shrink:!1,responsiveView:!0,responsiveSizes:!1,dragAndDrop:!0,resizable:!1,useCSSTransforms:!1,floating:!0,tolerance:"pointer"},this.responsiveOptions=[],this.breakpointsMap={sm:576,md:768,lg:992,xl:1200},this.basicOptions=t,this.responsiveOptions=this.extendResponsiveOptions(t.responsiveOptions||[]),this.change=h.merge(h.of(this.getOptionsByWidth(document.documentElement.clientWidth)),h.fromEvent(window,"resize").pipe(p.debounceTime(t.responsiveDebounce||0),p.map(function(t){return i.getOptionsByWidth(e.nativeElement.offsetWidth)}))).pipe(p.distinctUntilChanged(null,function(t){return t.minWidth}))}return t.prototype.getOptionsByWidth=function(t){for(var e=0,i=Object.assign({},this.defaults,this.basicOptions);this.responsiveOptions[e];)this.responsiveOptions[e].minWidth<=t&&(i=this.responsiveOptions[e]),e++;return i},t.prototype.extendResponsiveOptions=function(t){var e=this;return t.filter(function(t){return t.breakpoint}).map(function(t){return Object.assign({minWidth:e.breakpointsMap[t.breakpoint]||0},t)}).sort(function(t,e){return t.minWidth-e.minWidth}).map(function(t){return Object.assign({},e.defaults,e.basicOptions,t)})},t}(),O=function(){function t(t,e,i,n){this.zone=t,this.gridsterPrototype=n,this.optionsChange=new r.EventEmitter,this.ready=new r.EventEmitter,this.reflow=new r.EventEmitter,this.prototypeDrop=new r.EventEmitter,this.prototypeEnter=new r.EventEmitter,this.prototypeOut=new r.EventEmitter,this.draggableOptions={},this.isDragging=!1,this.isResizing=!1,this.isReady=!1,this.isPrototypeEntered=!1,this.isDisabled=!1,this.subscription=new h.Subscription,this.gridster=i,this.$element=e.nativeElement}return t.prototype.ngOnInit=function(){var e=this;this.gridsterOptions=new I(this.options,this.container),this.options.useCSSTransforms&&this.$element.classList.add("css-transform"),this.subscription.add(this.gridsterOptions.change.subscribe(function(t){e.gridster.options=t,e.gridster.gridList&&(e.gridster.gridList.options=t),e.optionsChange.emit(t)})),this.gridster.init(this),this.subscription.add(h.fromEvent(window,"resize").pipe(p.debounceTime(this.gridster.options.responsiveDebounce||0),p.filter(function(){return e.gridster.options.responsiveView})).subscribe(function(){return e.reload()})),this.zone.runOutsideAngular(function(){e.subscription.add(h.fromEvent(document,"scroll",{passive:!0}).subscribe(function(){return e.updateGridsterElementData()}));var t=m(e.$element);t&&e.subscription.add(h.fromEvent(t,"scroll",{passive:!0}).subscribe(function(){return e.updateGridsterElementData()}))})},t.prototype.ngAfterContentInit=function(){this.gridster.start(),this.updateGridsterElementData(),this.connectGridsterPrototype(),this.gridster.$positionHighlight=this.$positionHighlight.nativeElement},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t.prototype.setOption=function(t,e){return"dragAndDrop"===t&&(e?this.enableDraggable():this.disableDraggable()),"resizable"===t&&(e?this.enableResizable():this.disableResizable()),"lanes"===t&&(this.gridster.options.lanes=e,this.gridster.gridList.fixItemsPositions(this.gridster.options),this.reflowGridster()),"direction"===t&&(this.gridster.options.direction=e,this.gridster.gridList.pullItemsToLeft()),"widthHeightRatio"===t&&(this.gridster.options.widthHeightRatio=parseFloat(e||1)),"responsiveView"===t&&(this.gridster.options.responsiveView=!!e),this.gridster.gridList.setOption(t,e),this},t.prototype.reload=function(){var t=this;return setTimeout(function(){t.gridster.fixItemsPositions(),t.reflowGridster()}),this},t.prototype.reflowGridster=function(t){void 0===t&&(t=!1),this.gridster.reflow(),this.reflow.emit({isInit:t,gridsterComponent:this})},t.prototype.updateGridsterElementData=function(){this.gridster.gridsterScrollData=this.getScrollPositionFromParents(this.$element),this.gridster.gridsterRect=this.$element.getBoundingClientRect()},t.prototype.setReady=function(){var t=this;setTimeout(function(){return t.isReady=!0}),this.ready.emit()},t.prototype.adjustItemsHeightToContent=function(o){var e=this;void 0===o&&(o=".gridster-item-inner"),this.gridster.items.map(function(t){var e=t.$element.querySelector(o),i=e.lastElementChild,n=d(e,t.$element),r=e.getBoundingClientRect();return{item:t,contentHeight:i.getBoundingClientRect().bottom-r.top,scrollElDistance:n}}).forEach(function(t){t.item.h=Math.ceil(t.contentHeight/(e.gridster.cellHeight-t.scrollElDistance.top))}),this.gridster.fixItemsPositions(),this.gridster.reflow()},t.prototype.disable=function(t){var e=this.gridster.items.indexOf(t.itemComponent);this.isDisabled=!0,0<=e&&delete this.gridster.items[this.gridster.items.indexOf(t.itemComponent)],this.gridster.onDragOut(t)},t.prototype.enable=function(){this.isDisabled=!1},t.prototype.getScrollPositionFromParents=function(t,e){return void 0===e&&(e={scrollTop:0,scrollLeft:0}),t.parentElement&&t.parentElement!==document.body?(e.scrollTop+=t.parentElement.scrollTop,e.scrollLeft+=t.parentElement.scrollLeft,this.getScrollPositionFromParents(t.parentElement,e)):{scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}},t.prototype.connectGridsterPrototype=function(){var e=this;this.gridsterPrototype.observeDropOut(this.gridster).subscribe();var t=this.gridsterPrototype.observeDropOver(this.gridster).pipe(p.publish()),i=this.gridsterPrototype.observeDragOver(this.gridster);i.dragOver.pipe(p.filter(function(){return!e.isDisabled})).subscribe(function(t){e.isPrototypeEntered&&e.gridster.onDrag(t.item)}),i.dragEnter.pipe(p.filter(function(){return!e.isDisabled})).subscribe(function(t){e.isPrototypeEntered=!0,e.gridster.items.indexOf(t.item)<0&&e.gridster.items.push(t.item),e.gridster.onStart(t.item),t.setDragContextGridster(e.gridster),e.parent&&e.parent.disable(t.item),e.prototypeEnter.emit({item:t.item})}),i.dragOut.pipe(p.filter(function(){return!e.isDisabled})).subscribe(function(t){e.isPrototypeEntered&&(e.gridster.onDragOut(t.item),e.isPrototypeEntered=!1,e.prototypeOut.emit({item:t.item}),e.parent&&(e.parent.enable(),e.parent.isPrototypeEntered=!0,e.parent.gridster.items.indexOf(t.item)<0&&e.parent.gridster.items.push(t.item),e.parent.gridster.onStart(t.item),t.setDragContextGridster(e.parent.gridster),setTimeout(function(){e.parent.prototypeEnter.emit({item:t.item}),t.onEnter(e.parent.gridster)})))}),t.pipe(p.filter(function(){return!e.isDisabled})).subscribe(function(t){e.isPrototypeEntered&&(e.gridster.onStop(t.item.item),e.gridster.removeItem(t.item.item),e.isPrototypeEntered=!1,e.parent&&e.parent.enable(),e.prototypeDrop.emit({item:t.item.item}))}),t.connect()},t.prototype.enableDraggable=function(){this.gridster.options.dragAndDrop=!0,this.gridster.items.filter(function(t){return t.itemComponent&&t.itemComponent.dragAndDrop}).forEach(function(t){return t.itemComponent.enableDragDrop()})},t.prototype.disableDraggable=function(){this.gridster.options.dragAndDrop=!1,this.gridster.items.filter(function(t){return t.itemComponent}).forEach(function(t){return t.itemComponent.disableDraggable()})},t.prototype.enableResizable=function(){this.gridster.options.resizable=!0,this.gridster.items.filter(function(t){return t.itemComponent&&t.itemComponent.resizable}).forEach(function(t){return t.itemComponent.enableResizable()})},t.prototype.disableResizable=function(){this.gridster.options.resizable=!1,this.gridster.items.forEach(function(t){return t.itemComponent.disableResizable()})},t.decorators=[{type:r.Component,args:[{selector:"ngx-gridster",template:'<div class="gridster-container" #container>\n <ng-content></ng-content>\n <div class="position-highlight" style="display:none;" #positionHighlight>\n <div class="inner"></div>\n </div>\n </div>',providers:[E],changeDetection:r.ChangeDetectionStrategy.OnPush,encapsulation:r.ViewEncapsulation.None,styles:["\n ngx-gridster {\n position: relative;\n display: block;\n left: 0;\n width: 100%;\n }\n\n ngx-gridster.gridster--dragging {\n -moz-user-select: none;\n -khtml-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n ngx-gridster .gridster-container {\n position: relative;\n width: 100%;\n list-style: none;\n -webkit-transition: width 0.2s, height 0.2s;\n transition: width 0.2s, height 0.2s;\n }\n\n ngx-gridster .position-highlight {\n display: block;\n position: absolute;\n z-index: 1;\n }\n "]}]}],t.ctorParameters=function(){return[{type:r.NgZone},{type:r.ElementRef},{type:E},{type:P}]},t.propDecorators={options:[{type:r.Input}],optionsChange:[{type:r.Output}],ready:[{type:r.Output}],reflow:[{type:r.Output}],prototypeDrop:[{type:r.Output}],prototypeEnter:[{type:r.Output}],prototypeOut:[{type:r.Output}],draggableOptions:[{type:r.Input}],parent:[{type:r.Input}],$positionHighlight:[{type:r.ViewChild,args:["positionHighlight"]}],isDragging:[{type:r.HostBinding,args:["class.gridster--dragging"]}],isResizing:[{type:r.HostBinding,args:["class.gridster--resizing"]}],isReady:[{type:r.HostBinding,args:["class.gridster--ready"]}],container:[{type:r.ViewChild,args:["container"]}]},t}(),S=function(){function n(){}return Object.defineProperty(n.prototype,"$element",{get:function(){return this.getItem().$element},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"x",{get:function(){var t=this.getItem(),e=t.gridster?t.gridster.options.breakpoint:null;return this.getValueX(e)},set:function(t){var e=this.getItem(),i=e.gridster?e.gridster.options.breakpoint:null;this.setValueX(t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){var t=this.getItem(),e=t.gridster?t.gridster.options.breakpoint:null;return this.getValueY(e)},set:function(t){var e=this.getItem(),i=e.gridster?e.gridster.options.breakpoint:null;this.setValueY(t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){var t=this.getItem(),e=t.gridster?t.gridster.options.breakpoint:null;return this.getValueW(e)},set:function(t){var e=this.getItem(),i=e.gridster?e.gridster.options.breakpoint:null;this.setValueW(t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"h",{get:function(){var t=this.getItem(),e=t.gridster?t.gridster.options.breakpoint:null;return this.getValueH(e)},set:function(t){var e=this.getItem(),i=e.gridster?e.gridster.options.breakpoint:null;this.setValueH(t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"autoSize",{get:function(){return this.getItem().autoSize},set:function(t){this.getItem().autoSize=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"dragAndDrop",{get:function(){return!!this.getItem().dragAndDrop},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"resizable",{get:function(){return!!this.getItem().resizable},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"positionX",{get:function(){var t=this.itemComponent||this.itemPrototype;return t?t.positionX:null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"positionY",{get:function(){var t=this.itemComponent||this.itemPrototype;return t?t.positionY:null},enumerable:!0,configurable:!0}),n.prototype.setFromGridsterItem=function(t){if(this.isItemSet())throw new Error("GridListItem is already set.");return this.itemComponent=t,this},n.prototype.setFromGridsterItemPrototype=function(t){if(this.isItemSet())throw new Error("GridListItem is already set.");return this.itemPrototype=t,this},n.prototype.setFromObjectLiteral=function(t){if(this.isItemSet())throw new Error("GridListItem is already set.");return this.itemObject=t,this},n.prototype.copy=function(){return(new n).setFromObjectLiteral({$element:this.$element,x:this.x,y:this.y,w:this.w,h:this.h,autoSize:this.autoSize,dragAndDrop:this.dragAndDrop,resizable:this.resizable})},n.prototype.copyForBreakpoint=function(t){return(new n).setFromObjectLiteral({$element:this.$element,x:this.getValueX(t),y:this.getValueY(t),w:this.getValueW(t),h:this.getValueH(t),autoSize:this.autoSize,dragAndDrop:this.dragAndDrop,resizable:this.resizable})},n.prototype.getValueX=function(t){return this.getItem()[this.getXProperty(t)]},n.prototype.getValueY=function(t){return this.getItem()[this.getYProperty(t)]},n.prototype.getValueW=function(t){return this.getItem()[this.getWProperty(t)]||1},n.prototype.getValueH=function(t){return this.getItem()[this.getHProperty(t)]||1},n.prototype.setValueX=function(t,e){this.getItem()[this.getXProperty(e)]=t},n.prototype.setValueY=function(t,e){this.getItem()[this.getYProperty(e)]=t},n.prototype.setValueW=function(t,e){this.getItem()[this.getWProperty(e)]=t},n.prototype.setValueH=function(t,e){this.getItem()[this.getHProperty(e)]=t},n.prototype.triggerChangeX=function(t){var e=this.itemComponent;e&&e[this.getXProperty(t)+"Change"].emit(this.getValueX(t))},n.prototype.triggerChangeY=function(t){var e=this.itemComponent;e&&e[this.getYProperty(t)+"Change"].emit(this.getValueY(t))},n.prototype.triggerChangeW=function(t){var e=this.itemComponent;e&&e[this.getWProperty(t)+"Change"].emit(this.getValueW(t))},n.prototype.triggerChangeH=function(t){var e=this.itemComponent;e&&e[this.getHProperty(t)+"Change"].emit(this.getValueH(t))},n.prototype.hasPositions=function(t){var e=this.getValueX(t),i=this.getValueY(t);return(e||0===e)&&(i||0===i)},n.prototype.applyPosition=function(t){var e=this.calculatePosition(t);this.itemComponent.positionX=e.left,this.itemComponent.positionY=e.top,this.itemComponent.updateElemenetPosition()},n.prototype.calculatePosition=function(t){return t||this.itemComponent?(t=t||this.itemComponent.gridster,{left:this.x*t.cellWidth,top:this.y*t.cellHeight}):{left:0,top:0}},n.prototype.applySize=function(t){var e=this.calculateSize(t);this.$element.style.width=e.width+"px",this.$element.style.height=e.height+"px"},n.prototype.calculateSize=function(t){if(!t&&!this.itemComponent)return{width:0,height:0};t=t||this.itemComponent.gridster;var e=this.getValueW(t.options.breakpoint),i=this.getValueH(t.options.breakpoint);return"vertical"===t.options.direction&&(e=Math.min(e,t.options.lanes)),"horizontal"===t.options.direction&&(i=Math.min(i,t.options.lanes)),{width:e*t.cellWidth,height:i*t.cellHeight}},n.prototype.getXProperty=function(t){return t&&this.itemComponent?n.X_PROPERTY_MAP[t]:"x"},n.prototype.getYProperty=function(t){return t&&this.itemComponent?n.Y_PROPERTY_MAP[t]:"y"},n.prototype.getWProperty=function(t){if(this.itemPrototype)return this.itemPrototype[n.W_PROPERTY_MAP[t]]?n.W_PROPERTY_MAP[t]:"w";var e=this.getItem(),i=e.gridster&&e.gridster.options.responsiveSizes;return t&&i?n.W_PROPERTY_MAP[t]:"w"},n.prototype.getHProperty=function(t){if(this.itemPrototype)return this.itemPrototype[n.H_PROPERTY_MAP[t]]?n.H_PROPERTY_MAP[t]:"h";var e=this.getItem(),i=e.gridster&&e.gridster.options.responsiveSizes;return t&&i?n.H_PROPERTY_MAP[t]:"h"},n.prototype.getItem=function(){var t=this.itemComponent||this.itemPrototype||this.itemObject;if(!t)throw new Error("GridListItem is not set.");return t},n.prototype.isItemSet=function(){return this.itemComponent||this.itemPrototype||this.itemObject},n.BREAKPOINTS=["sm","md","lg","xl"],n.X_PROPERTY_MAP={sm:"xSm",md:"xMd",lg:"xLg",xl:"xXl"},n.Y_PROPERTY_MAP={sm:"ySm",md:"yMd",lg:"yLg",xl:"yXl"},n.W_PROPERTY_MAP={sm:"wSm",md:"wMd",lg:"wLg",xl:"wXl"},n.H_PROPERTY_MAP={sm:"hSm",md:"hMd",lg:"hLg",xl:"hXl"},n}(),C=function(){function t(t){t.touches?(this.touchEvent=t,this.setDataFromTouchEvent(this.touchEvent)):(this.mouseEvent=t,this.setDataFromMouseEvent(this.mouseEvent))}return t.prototype.isTouchEvent=function(){return!!this.touchEvent},t.prototype.pauseEvent=function(){var t=this.touchEvent||this.mouseEvent;return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,t.returnValue=!1},t.prototype.getRelativeCoordinates=function(t){var e=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,i=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,n=t.getBoundingClientRect();return{x:this.pageX-n.left-i,y:this.pageY-n.top-e}},t.prototype.setDataFromMouseEvent=function(t){this.target=t.target,this.clientX=t.clientX,this.clientY=t.clientY,this.pageX=t.pageX,this.pageY=t.pageY,this.type=t.type},t.prototype.setDataFromTouchEvent=function(t){var e=t.touches[0]||t.changedTouches[0];this.target=t.target,this.clientX=e.clientX,this.clientY=e.clientY,this.pageX=e.pageX,this.pageY=e.pageY,this.type=t.type},t}(),D=function(){function i(t,e){void 0===e&&(e={}),this.mousemove=h.merge(h.fromEvent(document,"mousemove"),h.fromEvent(document,"touchmove",{passive:!1})).pipe(p.share()),this.mouseup=h.merge(h.fromEvent(document,"mouseup"),h.fromEvent(document,"touchend"),h.fromEvent(document,"touchcancel")).pipe(p.share()),this.config={handlerClass:null,scroll:!0,scrollEdge:36,scrollDirection:null},this.autoScrollingInterval=[],this.element=t,this.mousedown=h.merge(h.fromEvent(t,"mousedown"),h.fromEvent(t,"touchstart")).pipe(p.share()),this.config=f({},this.config,e),this.dragStart=this.createDragStartObservable().pipe(p.share()),this.dragMove=this.createDragMoveObservable(this.dragStart),this.dragStop=this.createDragStopObservable(this.dragStart),this.fixProblemWithDnDForIE(t),this.requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},this.cancelAnimationFrame=window.cancelAnimationFrame||function(t){return clearTimeout(t)}}return i.prototype.createDragStartObservable=function(){var i=this;return this.mousedown.pipe(p.map(function(t){return new C(t)}),p.filter(function(t){return i.isDragingByHandler(t)}),p.tap(function(t){t.isTouchEvent()||t.pauseEvent(),document.activeElement&&document.activeElement.blur(),s()}),p.switchMap(function(e){return i.mousemove.pipe(p.map(function(t){return new C(t)}),p.filter(function(t){return i.inRange(e,t,5)}),p.map(function(){return e}),p.takeUntil(i.mouseup),p.take(1))}))},i.prototype.createDragMoveObservable=function(t){var i=this;return t.pipe(p.tap(function(t){i.addTouchActionNone(t.target)}),p.switchMap(function(e){return i.mousemove.pipe(p.skip(1),p.map(function(t){return new C(t)}),p.tap(function(t){t.pauseEvent(),e.pauseEvent()}),p.takeUntil(i.mouseup))}),p.filter(function(t){return!!t}),p.tap(function(t){i.config.scroll&&i.startScroll(i.element,t)}))},i.prototype.createDragStopObservable=function(t){var e=this;return t.pipe(p.switchMap(function(){return e.mouseup.pipe(p.take(1))}),p.map(function(t){return new C(t)}),p.tap(function(t){t.target&&e.removeTouchActionNone(t.target),e.autoScrollingInterval.forEach(function(t){return e.cancelAnimationFrame(t)})}))},i.prototype.startScroll=function(t,e){var i=this,n=this.getScrollContainer(t);this.autoScrollingInterval.forEach(function(t){return i.cancelAnimationFrame(t)}),n?this.startScrollForContainer(e,n):this.startScrollForWindow(e)},i.prototype.startScrollForContainer=function(t,e){this.config.scrollDirection&&"vertical"!==this.config.scrollDirection||this.startScrollVerticallyForContainer(t,e),this.config.scrollDirection&&"horizontal"!==this.config.scrollDirection||this.startScrollHorizontallyForContainer(t,e)},i.prototype.startScrollVerticallyForContainer=function(t,e){t.pageY-this.getOffset(e).top<this.config.scrollEdge?this.startAutoScrolling(e,-i.SCROLL_SPEED,"scrollTop"):this.getOffset(e).top+e.getBoundingClientRect().height-t.pageY<this.config.scrollEdge&&this.startAutoScrolling(e,i.SCROLL_SPEED,"scrollTop")},i.prototype.startScrollHorizontallyForContainer=function(t,e){t.pageX-e.getBoundingClientRect().left<this.config.scrollEdge?this.startAutoScrolling(e,-i.SCROLL_SPEED,"scrollLeft"):this.getOffset(e).left+e.getBoundingClientRect().width-t.pageX<this.config.scrollEdge&&this.startAutoScrolling(e,i.SCROLL_SPEED,"scrollLeft")},i.prototype.startScrollForWindow=function(t){this.config.scrollDirection&&"vertical"!==this.config.scrollDirection||this.startScrollVerticallyForWindow(t),this.config.scrollDirection&&"horizontal"!==this.config.scrollDirection||this.startScrollHorizontallyForWindow(t)},i.prototype.startScrollVerticallyForWindow=function(t){var e=document.scrollingElement||document.documentElement||document.body;t.pageY-window.pageYOffset<this.config.scrollEdge?this.startAutoScrolling(e,-i.SCROLL_SPEED,"scrollTop"):window.innerHeight-(t.pageY-window.pageYOffset)<this.config.scrollEdge&&this.startAutoScrolling(e,i.SCROLL_SPEED,"scrollTop")},i.prototype.startScrollHorizontallyForWindow=function(t){var e=document.scrollingElement||document.documentElement||document.body;t.pageX-window.pageXOffset<this.config.scrollEdge?this.startAutoScrolling(e,-i.SCROLL_SPEED,"scrollLeft"):window.innerWidth-(t.pageX-window.pageXOffset)<this.config.scrollEdge&&this.startAutoScrolling(e,i.SCROLL_SPEED,"scrollLeft")},i.prototype.getScrollContainer=function(t){var e=c(t);return t.scrollHeight>Math.ceil(e)?t:new RegExp("(body|html)","i").test(t.parentNode.tagName)?null:this.getScrollContainer(t.parentNode)},i.prototype.startAutoScrolling=function(t,e,i){return this.autoScrollingInterval.push(this.requestAnimationFrame(function(){this.startAutoScrolling(t,e,i)}.bind(this))),t[i]+=.25*e},i.prototype.getOffset=function(t){var e=t.getBoundingClientRect();return{left:e.left+this.getScroll("scrollLeft","pageXOffset"),top:e.top+this.getScroll("scrollTop","pageYOffset")}},i.prototype.getScroll=function(t,e){return"undefined"!=typeof window[e]?window[e]:document.documentElement.clientHeight?document.documentElement[t]:document.body[t]},i.prototype.isDragingByHandler=function(t){return!!this.isValidDragHandler(t.target)&&(!this.config.handlerClass||this.config.handlerClass&&this.hasElementWithClass(this.config.handlerClass,t.target))},i.prototype.isValidDragHandler=function(t){return-1===["input","textarea"].indexOf(t.tagName.toLowerCase())},i.prototype.inRange=function(t,e,i){return Math.abs(e.clientX-t.clientX)>i||Math.abs(e.clientY-t.clientY)>i},i.prototype.hasElementWithClass=function(t,e){for(;e!==this.element;){if(e.classList.contains(t))return!0;e=e.parentElement}return!1},i.prototype.pauseEvent=function(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,t.returnValue=!1},i.prototype.fixProblemWithDnDForIE=function(t){this.isTouchDevice()&&this.isIEorEdge()&&t.style&&(t.style["touch-action"]="none")},i.prototype.removeTouchActionNone=function(t){t.style&&(t.style["touch-action"]="")},i.prototype.addTouchActionNone=function(t){t.style&&(t.style["touch-action"]="none")},i.prototype.isTouchDevice=function(){return"ontouchstart"in window||navigator.maxTouchPoints},i.prototype.isIEorEdge=function(){var t=window.navigator.userAgent,e=t.indexOf("MSIE ");if(0<e)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(0<t.indexOf("Trident/")){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}var n=t.indexOf("Edge/");return 0<n&&parseInt(t.substring(n+5,t.indexOf(".",n)),10)},i.SCROLL_SPEED=20,i}(),z=function(){function t(t,e,i,n){this.zone=t,this.gridsterPrototypeService=e,this.xChange=new r.EventEmitter(!0),this.yChange=new r.EventEmitter(!0),this.xSmChange=new r.EventEmitter(!0),this.ySmChange=new r.EventEmitter(!0),this.xMdChange=new r.EventEmitter(!0),this.yMdChange=new r.EventEmitter(!0),this.xLgChange=new r.EventEmitter(!0),this.yLgChange=new r.EventEmitter(!0),this.xXlChange=new r.EventEmitter(!0),this.yXlChange=new r.EventEmitter(!0),this.wChange=new r.EventEmitter(!0),this.hChange=new r.EventEmitter(!0),this.wSmChange=new r.EventEmitter(!0),this.hSmChange=new r