gridstack
Version:
TypeScript/JS lib for dashboard layout and creation, no external dependencies, with many wrappers (React, Angular, Vue, Ember, knockout...)
2 lines • 201 kB
JavaScript
/*! For license information please see gridstack-jq.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GridStack=t():e.GridStack=t()}(self,(function(){return e={21:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridStackDD=void 0;const n=i(334),s=i(270),o=i(593);class r extends n.GridStackDDI{static get(){return n.GridStackDDI.get()}remove(e){return this.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,this}}function a(e,t){let i=e?e.gridstackNode:void 0;i&&i.grid&&(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}t.GridStackDD=r,s.GridStack.prototype._setupAcceptWidget=function(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return r.get().droppable(this.el,"destroy"),this;let e,t,i=(i,n,s)=>{let a=n.gridstackNode;if(!a)return;s=s||n;let l=this.el.getBoundingClientRect(),{top:h,left:u}=s.getBoundingClientRect();u-=l.left,h-=l.top;let c={position:{top:h,left:u}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(u/t)),a.y=Math.max(0,Math.round(h/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a))return void r.get().off(n,"drag");a._willFitPos&&(o.Utils.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(s,i,c,a,t,e)}else this._dragOrResize(s,i,c,a,t,e)};return r.get().droppable(this.el,{accept:e=>{let t=e.gridstackNode;if((null==t?void 0:t.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;if(null==t?void 0:t.subGrid)return!1;let i=!0;if("function"==typeof this.opts.acceptWidgets)i=this.opts.acceptWidgets(e);else{let t=!0===this.opts.acceptWidgets?".grid-stack-item":this.opts.acceptWidgets;i=e.matches(t)}if(i&&t&&this.opts.maxRow){let e={w:t.w,h:t.h,minW:t.minW,minH:t.minH};i=this.engine.willItFit(e)}return i}}).on(this.el,"dropover",((n,s,o)=>{let l=s.gridstackNode;if((null==l?void 0:l.grid)===this&&!l._temporaryRemoved)return!1;(null==l?void 0:l.grid)&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(s,o),t=this.cellWidth(),e=this.getCellHeight(!0),l||(l=this._readAttr(s)),l.grid||(l._isExternal=!0,s.gridstackNode=l),o=o||s;let h=l.w||Math.round(o.offsetWidth/t)||1,u=l.h||Math.round(o.offsetHeight/e)||1;return l.grid&&l.grid!==this?(s._gridstackNodeOrig||(s._gridstackNodeOrig=l),s.gridstackNode=l=Object.assign(Object.assign({},l),{w:h,h:u,grid:this}),this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=h,l.h=u,l._temporaryRemoved=!0),a(l.el,!1),r.get().on(s,"drag",i),i(n,s,o),!1})).on(this.el,"dropout",((e,t,i)=>{let n=t.gridstackNode;return!!n&&(n.grid&&n.grid!==this||this._leave(t,i),!1)})).on(this.el,"drop",((e,t,i)=>{let n=t.gridstackNode;if((null==n?void 0:n.grid)===this&&!n._isExternal)return!1;let s=!!this.placeholder.parentElement;this.placeholder.remove();let a=t._gridstackNodeOrig;if(delete t._gridstackNodeOrig,s&&a&&a.grid&&a.grid!==this){let e=a.grid;e.engine.removedNodes.push(a),e._triggerRemoveEvent()}return!!n&&(s&&(this.engine.cleanupNode(n),n.grid=this),r.get().off(t,"drag"),i!==t?(i.remove(),t.gridstackNode=a,s&&(t=t.cloneNode(!0))):(t.remove(),r.get().remove(t)),!!s&&(t.gridstackNode=n,n.el=t,o.Utils.copyPos(n,this._readAttr(this.placeholder)),o.Utils.removePositioningStyles(t),this._writeAttr(t,n),this.el.appendChild(t),this._updateContainerHeight(),this.engine.addedNodes.push(n),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped(Object.assign(Object.assign({},e),{type:"dropped"}),a&&a.grid?a:void 0,n),window.setTimeout((()=>{n.el&&n.el.parentElement?this._prepareDragDropByNode(n):this.engine.removeNode(n)})),!1))})),this},s.GridStack.prototype._setupRemoveDrop=function(){if(!this.opts.staticGrid&&"string"==typeof this.opts.removable){let e=document.querySelector(this.opts.removable);if(!e)return this;r.get().isDroppable(e)||r.get().droppable(e,this.opts.removableOptions).on(e,"dropover",((e,t)=>a(t,!0))).on(e,"dropout",((e,t)=>a(t,!1)))}return this},s.GridStack.setupDragIn=function(e,t){let i,n;if(e&&(i=e,n=Object.assign(Object.assign({},{revert:"invalid",handle:".grid-stack-item-content",scroll:!1,appendTo:"body"}),t||{})),"string"!=typeof i)return;let s=r.get();o.Utils.getElements(i).forEach((e=>{s.isDraggable(e)||s.dragIn(e,n)}))},s.GridStack.prototype._prepareDragDropByNode=function(e){let t=e.el,i=r.get();if(this.opts.staticGrid||(e.noMove||this.opts.disableDrag)&&(e.noResize||this.opts.disableResize))return e._initDD&&(i.remove(t),delete e._initDD),t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!e._initDD){let n,s,r=(i,o)=>{this._gsEventHandler[i.type]&&this._gsEventHandler[i.type](i,i.target),n=this.cellWidth(),s=this.getCellHeight(!0),this._onStartMoving(t,i,o,e,n,s)},a=(i,o)=>{this._dragOrResize(t,i,o,e,n,s)},l=n=>{this.placeholder.remove(),delete e._moving,delete e._lastTried;let s=n.target;if(s.gridstackNode&&s.gridstackNode.grid===this){if(e.el=s,e._isAboutToRemove){let o=t.gridstackNode.grid;o._gsEventHandler[n.type]&&o._gsEventHandler[n.type](n,s),i.remove(t),o.engine.removedNodes.push(e),o._triggerRemoveEvent(),delete t.gridstackNode,delete e.el,t.remove()}else e._temporaryRemoved?(o.Utils.removePositioningStyles(s),o.Utils.copyPos(e,e._orig),this._writePosAttr(s,e),this.engine.addNode(e)):(o.Utils.removePositioningStyles(s),this._writePosAttr(s,e)),this._gsEventHandler[n.type]&&this._gsEventHandler[n.type](n,s);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate()}};i.draggable(t,{start:r,stop:l,drag:a}).resizable(t,{start:r,stop:l,resize:a}),e._initDD=!0}return e.noMove||this.opts.disableDrag?(i.draggable(t,"disable"),t.classList.add("ui-draggable-disabled")):(i.draggable(t,"enable"),t.classList.remove("ui-draggable-disabled")),e.noResize||this.opts.disableResize?(i.resizable(t,"disable"),t.classList.add("ui-resizable-disabled")):(i.resizable(t,"enable"),t.classList.remove("ui-resizable-disabled")),this},s.GridStack.prototype._onStartMoving=function(e,t,i,n,s,o){if(this.engine.cleanNodes().beginUpdate(n),this._writePosAttr(this.placeholder,n),this.el.appendChild(this.placeholder),n.el=this.placeholder,n._lastUiPosition=i.position,n._prevYPix=i.position.top,n._moving="dragstart"===t.type,delete n._lastTried,"dropover"===t.type&&n._temporaryRemoved&&(this.engine.addNode(n),n._moving=!0),this.engine.cacheRects(s,o,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),"resizestart"===t.type){let t=r.get().resizable(e,"option","minWidth",s*(n.minW||1)).resizable(e,"option","minHeight",o*(n.minH||1));n.maxW&&t.resizable(e,"option","maxWidth",s*n.maxW),n.maxH&&t.resizable(e,"option","maxHeight",o*n.maxH)}},s.GridStack.prototype._leave=function(e,t){let i=e.gridstackNode;i&&(r.get().off(e,"drag"),i._temporaryRemoved||(i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e,!0===this.opts.removable&&a(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&(delete i.el,delete e.gridstackNode,this.engine.restoreInitial())))},s.GridStack.prototype._dragOrResize=function(e,t,i,n,s,r){let a,l=Object.assign({},n._orig),h=this.opts.marginLeft,u=this.opts.marginRight,c=this.opts.marginTop,d=this.opts.marginBottom,p=Math.round(.1*r),f=Math.round(.1*s);if(h=Math.min(h,f),u=Math.min(u,f),c=Math.min(c,p),d=Math.min(d,p),"drag"===t.type){if(n._temporaryRemoved)return;let t=i.position.top-n._prevYPix;n._prevYPix=i.position.top,o.Utils.updateScrollPosition(e,i.position,t);let a=i.position.left+(i.position.left>n._lastUiPosition.left?-u:h),p=i.position.top+(i.position.top>n._lastUiPosition.top?-d:c);l.x=Math.round(a/s),l.y=Math.round(p/r);let f=this._extraDragRow;if(this.engine.collide(n,l)){let e=this.getRow(),t=Math.max(0,l.y+n.h-e);this.opts.maxRow&&e+t>this.opts.maxRow&&(t=Math.max(0,this.opts.maxRow-e)),this._extraDragRow=t}else this._extraDragRow=0;if(this._extraDragRow!==f&&this._updateContainerHeight(),n.x===l.x&&n.y===l.y)return}else if("resize"===t.type){if(l.x<0)return;if(o.Utils.updateScrollResize(t,e,r),l.w=Math.round((i.size.width-h)/s),l.h=Math.round((i.size.height-c)/r),n.w===l.w&&n.h===l.h)return;if(n._lastTried&&n._lastTried.w===l.w&&n._lastTried.h===l.h)return;let u=i.position.left+h,d=i.position.top+c;l.x=Math.round(u/s),l.y=Math.round(d/r),a=!0}n._lastTried=l;let g={x:i.position.left+h,y:i.position.top+c,w:(i.size?i.size.width:n.w*s)-h-u,h:(i.size?i.size.height:n.h*r)-c-d};if(this.engine.moveNodeCheck(n,Object.assign(Object.assign({},l),{cellWidth:s,cellHeight:r,rect:g,resizing:a}))){n._lastUiPosition=i.position,this.engine.cacheRects(s,r,c,u,d,h),delete n._skipDown,a&&n.subGrid&&n.subGrid.onParentResize(),this._extraDragRow=0,this._updateContainerHeight();let e=t.target;this._writePosAttr(e,n),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,e)}},s.GridStack.prototype.movable=function(e,t){return this.opts.staticGrid||s.GridStack.getElements(e).forEach((e=>{let i=e.gridstackNode;i&&(t?delete i.noMove:i.noMove=!0,this._prepareDragDropByNode(i))})),this},s.GridStack.prototype.resizable=function(e,t){return this.opts.staticGrid||s.GridStack.getElements(e).forEach((e=>{let i=e.gridstackNode;i&&(t?delete i.noResize:i.noResize=!0,this._prepareDragDropByNode(i))})),this},s.GridStack.prototype.disable=function(){if(!this.opts.staticGrid)return this.enableMove(!1),this.enableResize(!1),this._triggerEvent("disable"),this},s.GridStack.prototype.enable=function(){if(!this.opts.staticGrid)return this.enableMove(!0),this.enableResize(!0),this._triggerEvent("enable"),this},s.GridStack.prototype.enableMove=function(e){return this.opts.staticGrid||(this.opts.disableDrag=!e,this.engine.nodes.forEach((t=>this.movable(t.el,e)))),this},s.GridStack.prototype.enableResize=function(e){return this.opts.staticGrid||(this.opts.disableResize=!e,this.engine.nodes.forEach((t=>this.resizable(t.el,e)))),this}},334:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridStackDDI=void 0;class i{static registerPlugin(e){return i.ddi=new e,i.ddi}static get(){return i.ddi||i.registerPlugin(i)}remove(e){return this}}t.GridStackDDI=i},62:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridStackEngine=void 0;const n=i(593);class s{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.column=e.column||12,this.onChange=e.onChange,this._float=e.float,this.maxRow=e.maxRow,this.nodes=e.nodes||[]}batchUpdate(){return this.batchMode||(this.batchMode=!0,this._prevFloat=this._float,this._float=!0,this.saveInitial()),this}commit(){return this.batchMode?(this.batchMode=!1,this._float=this._prevFloat,delete this._prevFloat,this._packNodes()._notify()):this}_useEntireRowArea(e,t){return!this.float&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,s={}){if(this._sortNodes(-1),!(i=i||this.collide(e,t)))return!1;if(e._moving&&!s.nested&&!this.float&&this.swap(e,i))return!0;let o=t;this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,s.skip));let r=!1,a={nested:!0,pack:!1};for(;i=i||this.collide(e,o,s.skip);){let o;if(i.locked||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,Object.assign(Object.assign({},i),{y:e.y}),e)||!this.collide(i,Object.assign(Object.assign({},i),{y:t.y-i.h}),e))?(e._skipDown=e._skipDown||t.y>e.y,o=this.moveNode(e,Object.assign(Object.assign(Object.assign({},t),{y:i.y+i.h}),a)),i.locked&&o?n.Utils.copyPos(t,e):!i.locked&&o&&s.pack&&(this._packNodes(),t.y=i.y+i.h,n.Utils.copyPos(e,t)),r=r||o):o=this.moveNode(i,Object.assign(Object.assign(Object.assign({},i),{y:t.y+t.h,skip:e}),a)),!o)return r;i=void 0}return r}collide(e,t=e,i){return this.nodes.find((s=>s!==e&&s!==i&&n.Utils.isIntercepted(s,t)))}collideAll(e,t=e,i){return this.nodes.filter((s=>s!==e&&s!==i&&n.Utils.isIntercepted(s,t)))}collideCoverage(e,t,i){if(!t.rect||!e._rect)return;let n,s=e._rect,o=Object.assign({},t.rect);return o.y>s.y?(o.h+=o.y-s.y,o.y=s.y):o.h+=s.y-o.y,o.x>s.x?(o.w+=o.x-s.x,o.x=s.x):o.w+=s.x-o.x,i.forEach((e=>{if(e.locked||!e._rect)return;let t=e._rect,i=Number.MAX_VALUE,r=Number.MAX_VALUE,a=.5;s.y<t.y?i=(o.y+o.h-t.y)/t.h:s.y+s.h>t.y+t.h&&(i=(t.y+t.h-o.y)/t.h),s.x<t.x?r=(o.x+o.w-t.x)/t.w:s.x+s.w>t.x+t.w&&(r=(t.x+t.w-o.x)/t.w);let l=Math.min(r,i);l>a&&(a=l,n=e)})),n}cacheRects(e,t,i,n,s,o){return this.nodes.forEach((r=>r._rect={y:r.y*t+i,x:r.x*e+o,w:r.w*e-o-n,h:r.h*t-i-s})),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){let i=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=i,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=i,e.y=n),e._dirty=t._dirty=!0,!0}let s;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(s=n.Utils.isTouching(e,t)))return i();if(!1!==s){if(e.w===t.w&&e.x===t.x&&(s||(s=n.Utils.isTouching(e,t)))){if(t.y<e.y){let i=e;e=t,t=i}return i()}if(!1!==s){if(e.h===t.h&&e.y===t.y&&(s||(s=n.Utils.isTouching(e,t)))){if(t.x<e.x){let i=e;e=t,t=i}return i()}return!1}}}isAreaEmpty(e,t,i,n){let s={x:e||0,y:t||0,w:i||1,h:n||1};return!this.collide(s)}compact(){if(0===this.nodes.length)return this;this.batchUpdate()._sortNodes();let e=this.nodes;return this.nodes=[],e.forEach((e=>{e.locked||(e.autoPosition=!0),this.addNode(e,!1),e._dirty=!0})),this.commit()}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}_sortNodes(e){return this.nodes=n.Utils.sort(this.nodes,e,this.column),this}_packNodes(){return this.batchMode||(this._sortNodes(),this.float?this.nodes.forEach((e=>{if(e._updating||void 0===e._orig||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)})):this.nodes.forEach(((e,t)=>{if(!e.locked)for(;e.y>0;){let i=0===t?0:e.y-1;if(0!==t&&this.collide(e,{x:e.x,y:i,w:e.w,h:e.h}))break;e._dirty=e.y!==i,e.y=i}}))),this}prepareNode(e,t){(e=e||{})._id=e._id||s._idSeq++,void 0!==e.x&&void 0!==e.y&&null!==e.x&&null!==e.y||(e.autoPosition=!0);let i={x:0,y:0,w:1,h:1};return n.Utils.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,"string"==typeof e.x&&(e.x=Number(e.x)),"string"==typeof e.y&&(e.y=Number(e.y)),"string"==typeof e.w&&(e.w=Number(e.w)),"string"==typeof e.h&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,t)}nodeBoundFix(e,t){let i=e._orig||n.Utils.copyPos({},e);return e.maxW&&(e.w=Math.min(e.w,e.maxW)),e.maxH&&(e.h=Math.min(e.h,e.maxH)),e.minW&&e.minW<=this.column&&(e.w=Math.max(e.w,e.minW)),e.minH&&(e.h=Math.max(e.h,e.minH)),e.w>this.column?(this.column<12&&!this._inColumnResize&&(e.w=Math.min(12,e.w),this.cacheOneLayout(e,12)),e.w=this.column):e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),n.Utils.samePos(e,i)||(e._dirty=!0),e}getDirtyNodes(e){return e?this.nodes.filter((e=>e._dirty&&!n.Utils.samePos(e,e._orig))):this.nodes.filter((e=>e._dirty))}_notify(e,t=!0){if(this.batchMode)return this;let i=(e=void 0===e?[]:Array.isArray(e)?e:[e]).concat(this.getDirtyNodes());return this.onChange&&this.onChange(i,t),this}cleanNodes(){return this.batchMode||this.nodes.forEach((e=>{delete e._dirty,delete e._lastTried})),this}saveInitial(){return this.nodes.forEach((e=>{e._orig=n.Utils.copyPos({},e),delete e._dirty})),this._hasLocked=this.nodes.some((e=>e.locked)),this}restoreInitial(){return this.nodes.forEach((e=>{n.Utils.samePos(e,e._orig)||(n.Utils.copyPos(e,e._orig),e._dirty=!0)})),this._notify(),this}addNode(e,t=!1){let i=this.nodes.find((t=>t._id===e._id));if(i)return i;if(delete(e=this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e))._temporaryRemoved,delete e._removeDOM,e.autoPosition){this._sortNodes();for(let t=0;;++t){let i=t%this.column,s=Math.floor(t/this.column);if(i+e.w>this.column)continue;let o={x:i,y:s,w:e.w,h:e.h};if(!this.nodes.find((e=>n.Utils.isIntercepted(o,e)))){e.x=i,e.y=s,delete e.autoPosition;break}}}return this.nodes.push(e),t&&this.addedNodes.push(e),this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find((t=>t===e))?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter((t=>t!==e)),this._packNodes()._notify(e)):this}removeAll(e=!0){return delete this._layouts,0===this.nodes.length?this:(e&&this.nodes.forEach((e=>e._removeDOM=!0)),this.removedNodes=this.nodes,this.nodes=[],this._notify(this.removedNodes))}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i,o=new s({column:this.column,float:this.float,nodes:this.nodes.map((t=>t===e?(i=Object.assign({},t),i):Object.assign({},t)))});if(!i)return!1;let r=o.moveNode(i,t);if(this.maxRow&&r&&(r=o.getRow()<=this.maxRow,!r&&!t.resizing)){let i=this.collide(e,t);if(i&&this.swap(e,i))return this._notify(),!0}return!!r&&(o.nodes.filter((e=>e._dirty)).forEach((e=>{let t=this.nodes.find((t=>t._id===e._id));t&&(n.Utils.copyPos(t,e),t._dirty=!0)})),this._notify(),!0)}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;let t=new s({column:this.column,float:this.float,nodes:this.nodes.map((e=>Object.assign({},e)))}),i=Object.assign({},e);return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow&&(e._willFitPos=n.Utils.copyPos({},i),!0)}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y||(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return!1;void 0===t.pack&&(t.pack=!0),"number"!=typeof t.x&&(t.x=e.x),"number"!=typeof t.y&&(t.y=e.y),"number"!=typeof t.w&&(t.w=e.w),"number"!=typeof t.h&&(t.h=e.h);let i=e.w!==t.w||e.h!==t.h,s=n.Utils.copyPos({},e,!0);if(n.Utils.copyPos(s,t),s=this.nodeBoundFix(s,i),n.Utils.copyPos(t,s),n.Utils.samePos(e,t))return!1;let o=n.Utils.copyPos({},e),r=s,a=this.collideAll(e,r,t.skip),l=!0;if(a.length){let i=e._moving&&!t.nested?this.collideCoverage(e,t,a):a[0];l=!!i&&!this._fixCollisions(e,s,i,t)}return l&&(e._dirty=!0,n.Utils.copyPos(e,s)),t.pack&&this._packNodes()._notify(),!n.Utils.samePos(e,o)}getRow(){return this.nodes.reduce(((e,t)=>Math.max(e,t.y+t.h)),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){let e=this.nodes.find((e=>e._updating));return e&&(delete e._updating,delete e._skipDown),this}save(e=!0){var t;let i=null===(t=this._layouts)||void 0===t?void 0:t.length,n=i&&this.column!==i-1?this._layouts[i-1]:null,s=[];return this._sortNodes(),this.nodes.forEach((t=>{let i=null==n?void 0:n.find((e=>e._id===t._id)),o=Object.assign({},t);i&&(o.x=i.x,o.y=i.y,o.w=i.w);for(let e in o)"_"!==e[0]&&null!==o[e]&&void 0!==o[e]||delete o[e];delete o.grid,e||delete o.el,o.autoPosition||delete o.autoPosition,o.noResize||delete o.noResize,o.noMove||delete o.noMove,o.locked||delete o.locked,s.push(o)})),s}layoutsNodesChange(e){return!this._layouts||this._inColumnResize||this._layouts.forEach(((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{let n=i/this.column;e.forEach((e=>{if(!e._orig)return;let i=t.find((t=>t._id===e._id));i&&(e.y!==e._orig.y&&(i.y+=e.y-e._orig.y),e.x!==e._orig.x&&(i.x=Math.round(e.x*n)),e.w!==e._orig.w&&(i.w=Math.round(e.w*n)))}))}})),this}updateNodeWidths(e,t,i,s="moveScale"){var o;if(!this.nodes.length||!t||e===t)return this;this.cacheLayout(this.nodes,e),this.batchUpdate();let r=[],a=!1;if(1===t&&(null==i?void 0:i.length)){a=!0;let e=0;i.forEach((t=>{t.x=0,t.w=1,t.y=Math.max(t.y,e),e=t.y+t.h})),r=i,i=[]}else i=n.Utils.sort(this.nodes,-1,e);let l=[];if(t>e){l=this._layouts[t]||[];let n=this._layouts.length-1;!l.length&&e!==n&&(null===(o=this._layouts[n])||void 0===o?void 0:o.length)&&(e=n,this._layouts[n].forEach((e=>{let t=i.find((t=>t._id===e._id));t&&(t.x=e.x,t.y=e.y,t.w=e.w)})))}if(l.forEach((e=>{let t=i.findIndex((t=>t._id===e._id));-1!==t&&(i[t].x=e.x,i[t].y=e.y,i[t].w=e.w,r.push(i[t]),i.splice(t,1))})),i.length)if("function"==typeof s)s(t,e,r,i);else if(!a){let n=t/e,o="move"===s||"moveScale"===s,a="scale"===s||"moveScale"===s;i.forEach((i=>{i.x=1===t?0:o?Math.round(i.x*n):Math.min(i.x,t-1),i.w=1===t||1===e?1:a?Math.round(i.w*n)||1:Math.min(i.w,t),r.push(i)})),i=[]}return r=n.Utils.sort(r,-1,t),this._inColumnResize=!0,this.nodes=[],r.forEach((e=>{this.addNode(e,!1),delete e._orig})),this.commit(),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){let n=[];return e.forEach(((e,t)=>{e._id=e._id||s._idSeq++,n[t]={x:e.x,y:e.y,w:e.w,_id:e._id}})),this._layouts=i?[]:this._layouts||[],this._layouts[t]=n,this}cacheOneLayout(e,t){e._id=e._id||s._idSeq++;let i={x:e.x,y:e.y,w:e.w,_id:e._id};this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];let n=this._layouts[t].findIndex((t=>t._id===e._id));return-1===n?this._layouts[t].push(i):this._layouts[t][n]=i,this}cleanupNode(e){for(let t in e)"_"===t[0]&&"_id"!==t&&delete e[t];return this}}t.GridStackEngine=s,s._idSeq=1},572:function(e,t,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||t.hasOwnProperty(i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),s(i(699),t),s(i(593),t),s(i(62),t),s(i(334),t),s(i(270),t),s(i(906),t)},270:function(e,t,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||t.hasOwnProperty(i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.GridStack=void 0;const o=i(62),r=i(593),a=i(334);s(i(699),t),s(i(593),t),s(i(62),t),s(i(334),t);const l={column:12,minRow:0,maxRow:0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,styleInHead:!1,cellHeight:"auto",cellHeightThrottle:100,margin:10,auto:!0,minWidth:768,float:!1,staticGrid:!1,animate:!0,alwaysShowResizeHandle:!1,resizable:{autoHide:!0,handles:"se"},draggable:{handle:".grid-stack-item-content",scroll:!1,appendTo:"body"},disableDrag:!1,disableResize:!1,rtl:"auto",removable:!1,removableOptions:{accept:".grid-stack-item"},marginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:!1,oneColumnModeDomSort:!1};class h{constructor(e,t={}){this._gsEventHandler={},this._extraDragRow=0,this.el=e,(t=t||{}).row&&(t.minRow=t.maxRow=t.row,delete t.row);let i=r.Utils.toNumber(e.getAttribute("gs-row"));"auto"===t.column&&delete t.column;let n=Object.assign(Object.assign({},r.Utils.cloneDeep(l)),{column:r.Utils.toNumber(e.getAttribute("gs-column"))||12,minRow:i||r.Utils.toNumber(e.getAttribute("gs-min-row"))||0,maxRow:i||r.Utils.toNumber(e.getAttribute("gs-max-row"))||0,staticGrid:r.Utils.toBool(e.getAttribute("gs-static"))||!1,_styleSheetClass:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),alwaysShowResizeHandle:t.alwaysShowResizeHandle||!1,resizable:{autoHide:!t.alwaysShowResizeHandle,handles:"se"},draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"},removableOptions:{accept:"."+(t.itemClass||"grid-stack-item")}});e.getAttribute("gs-animate")&&(n.animate=r.Utils.toBool(e.getAttribute("gs-animate"))),this.opts=r.Utils.defaults(t,n),t=null,this.initMargin(),1!==this.opts.column&&!this.opts.disableOneColumnMode&&this._widthOrContainer()<=this.opts.minWidth&&(this._prevColumn=this.getColumn(),this.opts.column=1),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===e.style.direction),this.opts.rtl&&this.el.classList.add("grid-stack-rtl");let s=r.Utils.closestByClass(this.el,l.itemClass);if(s&&s.gridstackNode&&(this.opts._isNested=s.gridstackNode,this.opts._isNested.subGrid=this,s.classList.add("grid-stack-nested"),this.el.classList.add("grid-stack-nested")),this._isAutoCellHeight="auto"===this.opts.cellHeight,this._isAutoCellHeight||"initial"===this.opts.cellHeight?this.cellHeight(void 0,!1):("number"==typeof this.opts.cellHeight&&this.opts.cellHeightUnit&&this.opts.cellHeightUnit!==l.cellHeightUnit&&(this.opts.cellHeight=this.opts.cellHeight+this.opts.cellHeightUnit,delete this.opts.cellHeightUnit),this.cellHeight(this.opts.cellHeight,!1)),this.el.classList.add(this.opts._styleSheetClass),this._setStaticClass(),this.engine=new o.GridStackEngine({column:this.getColumn(),float:this.opts.float,maxRow:this.opts.maxRow,onChange:e=>{let t=0;this.engine.nodes.forEach((e=>{t=Math.max(t,e.y+e.h)})),e.forEach((e=>{let t=e.el;t&&(e._removeDOM?(t&&t.remove(),delete e._removeDOM):this._writePosAttr(t,e))})),this._updateStyles(!1,t)}}),this.opts.auto){this.batchUpdate();let e=[];this.getGridItems().forEach((t=>{let i=parseInt(t.getAttribute("gs-x")),n=parseInt(t.getAttribute("gs-y"));e.push({el:t,i:(Number.isNaN(i)?1e3:i)+(Number.isNaN(n)?1e3:n)*this.getColumn()})})),e.sort(((e,t)=>e.i-t.i)).forEach((e=>this._prepareElement(e.el))),this.commit()}this.setAnimation(this.opts.animate),this._updateStyles(),12!=this.opts.column&&this.el.classList.add("grid-stack-"+this.opts.column),this.opts.dragIn&&h.setupDragIn(this.opts.dragIn,this.opts.dragInOptions),delete this.opts.dragIn,delete this.opts.dragInOptions,this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateWindowResizeEvent()}static init(e={},t=".grid-stack"){let i=h.getGridElement(t);return i?(i.gridstack||(i.gridstack=new h(i,r.Utils.cloneDeep(e))),i.gridstack):("string"==typeof t?console.error('GridStack.initAll() no grid was found with selector "'+t+'" - element missing or wrong selector ?\nNote: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.'):console.error("GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){let i=[];return h.getGridElements(t).forEach((t=>{t.gridstack||(t.gridstack=new h(t,r.Utils.cloneDeep(e)),delete e.dragIn,delete e.dragInOptions),i.push(t.gridstack)})),0===i.length&&console.error('GridStack.initAll() no grid was found with selector "'+t+'" - element missing or wrong selector ?\nNote: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.'),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(!e.classList.contains("grid-stack")){let n=document.implementation.createHTMLDocument("");n.body.innerHTML=`<div class="grid-stack ${t.class||""}"></div>`,i=n.body.children[0],e.appendChild(i)}let n=h.init(t,i);if(n.opts.children){let e=n.opts.children;delete n.opts.children,n.load(e)}return n}get placeholder(){if(!this._placeholder){let e=document.createElement("div");e.className="placeholder-content",this.opts.placeholderText&&(e.innerHTML=this.opts.placeholderText),this._placeholder=document.createElement("div"),this._placeholder.classList.add(this.opts.placeholderClass,l.itemClass,this.opts.itemClass),this.placeholder.appendChild(e)}return this._placeholder}addWidget(e,t){if(arguments.length>2){console.warn("gridstack.ts: `addWidget(el, x, y, width...)` is deprecated. Use `addWidget({x, y, w, content, ...})`. It will be removed soon");let t=arguments,i=1,n={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++],minW:t[i++],maxW:t[i++],minH:t[i++],maxH:t[i++],id:t[i++]};return this.addWidget(e,n)}let i;if("string"==typeof e){let t=document.implementation.createHTMLDocument("");t.body.innerHTML=e,i=t.body.children[0]}else if(0===arguments.length||1===arguments.length&&(void 0!==(n=e).x||void 0!==n.y||void 0!==n.w||void 0!==n.h||void 0!==n.content)){let n=e&&e.content||"";t=e;let s=document.implementation.createHTMLDocument("");s.body.innerHTML=`<div class="grid-stack-item ${this.opts.itemClass||""}"><div class="grid-stack-item-content">${n}</div></div>`,i=s.body.children[0]}else i=e;var n;let s=this._readAttr(i);t=r.Utils.cloneDeep(t)||{},r.Utils.defaults(t,s);let o=this.engine.prepareNode(t);if(this._writeAttr(i,t),this._insertNotAppend?this.el.prepend(i):this.el.appendChild(i),this._prepareElement(i,!0,t),this._updateContainerHeight(),o.subGrid&&!o.subGrid.el){let e,t=o.subGrid;"auto"===t.column&&(t.column=o.w,t.disableOneColumnMode=!0,e=!0);let i=o.el.querySelector(".grid-stack-item-content");o.subGrid=h.addGrid(i,o.subGrid),e&&(o.subGrid._autoColumn=!0)}return this._triggerAddEvent(),this._triggerChangeEvent(),i}save(e=!0,t=!1){let i=this.engine.save(e);if(i.forEach((t=>{if(e&&t.el&&!t.subGrid){let e=t.el.querySelector(".grid-stack-item-content");t.content=e?e.innerHTML:void 0,t.content||delete t.content}else e||delete t.content,t.subGrid&&(t.subGrid=t.subGrid.save(e,!0));delete t.el})),t){let e=r.Utils.cloneDeep(this.opts);return e.marginBottom===e.marginTop&&e.marginRight===e.marginLeft&&e.marginTop===e.marginRight&&(e.margin=e.marginTop,delete e.marginTop,delete e.marginRight,delete e.marginBottom,delete e.marginLeft),e.rtl===("rtl"===this.el.style.direction)&&(e.rtl="auto"),this._isAutoCellHeight&&(e.cellHeight="auto"),this._autoColumn&&(e.column="auto",delete e.disableOneColumnMode),r.Utils.removeInternalAndSame(e,l),e.children=i,e}return i}load(e,t=!0){let i=h.Utils.sort([...e],-1,this._prevColumn||this.getColumn());this._insertNotAppend=!0,this._prevColumn&&this._prevColumn!==this.opts.column&&i.some((e=>e.x+e.w>this.opts.column))&&(this._ignoreLayoutsNodeChange=!0,this.engine.cacheLayout(i,this._prevColumn,!0));let n=[];return this.batchUpdate(),t&&[...this.engine.nodes].forEach((e=>{i.find((t=>e.id===t.id))||("function"==typeof t?t(this,e,!1):(n.push(e),this.removeWidget(e.el,!0,!1)))})),i.forEach((e=>{let i=e.id||0===e.id?this.engine.nodes.find((t=>t.id===e.id)):void 0;if(i){if(this.update(i.el,e),e.subGrid&&e.subGrid.children){let t=i.el.querySelector(".grid-stack");t&&t.gridstack&&(t.gridstack.load(e.subGrid.children),this._insertNotAppend=!0)}}else t&&(e="function"==typeof t?t(this,e,!0).gridstackNode:this.addWidget(e).gridstackNode)})),this.engine.removedNodes=n,this.commit(),delete this._ignoreLayoutsNodeChange,delete this._insertNotAppend,this}batchUpdate(){return this.engine.batchUpdate(),this}getCellHeight(e=!1){if(this.opts.cellHeight&&"auto"!==this.opts.cellHeight&&(!e||!this.opts.cellHeightUnit||"px"===this.opts.cellHeightUnit))return this.opts.cellHeight;let t=this.el.querySelector("."+this.opts.itemClass);if(t){let e=r.Utils.toNumber(t.getAttribute("gs-h"));return Math.round(t.offsetHeight/e)}let i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e,t=!0){if(t&&void 0!==e&&this._isAutoCellHeight!==("auto"===e)&&(this._isAutoCellHeight="auto"===e,this._updateWindowResizeEvent()),"initial"!==e&&"auto"!==e||(e=void 0),void 0===e){let t=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+t}let i=r.Utils.parseHeight(e);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h||(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,t&&this._updateStyles(!0,this.getRow())),this}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(){return this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}commit(){return this.engine.commit(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent(),this}compact(){return this.engine.compact(),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(e<1||this.opts.column===e)return this;let i,n=this.getColumn();return 1===e?this._prevColumn=n:delete this._prevColumn,this.el.classList.remove("grid-stack-"+n),this.el.classList.add("grid-stack-"+e),this.opts.column=this.engine.column=e,1===e&&this.opts.oneColumnModeDomSort&&(i=[],this.getGridItems().forEach((e=>{e.gridstackNode&&i.push(e.gridstackNode)})),i.length||(i=void 0)),this.engine.updateNodeWidths(n,e,i,t),this._isAutoCellHeight&&this.cellHeight(),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter((e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass)))}destroy(e=!0){if(this.el)return this._updateWindowResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.classList.remove(this.opts._styleSheetClass)),this._removeStylesheet(),this.el.removeAttribute("gs-current-row"),delete this.opts._isNested,delete this.opts,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.engine.float=e,this._triggerChangeEvent(),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){let i,n=this.el.getBoundingClientRect();i=t?{top:n.top+document.documentElement.scrollTop,left:n.left}:{top:this.el.offsetTop,left:this.el.offsetLeft};let s=e.left-i.left,o=e.top-i.top,r=n.width/this.getColumn(),a=n.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(s/r),y:Math.floor(o/a)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,n){return this.engine.isAreaEmpty(e,t,i,n)}makeWidget(e){let t=h.getElement(e);return this._prepareElement(t,!0),this._updateContainerHeight(),this._triggerAddEvent(),this._triggerChangeEvent(),t}on(e,t){if(-1!==e.indexOf(" "))return e.split(" ").forEach((e=>this.on(e,t))),this;if("change"===e||"added"===e||"removed"===e||"enable"===e||"disable"===e){let i="enable"===e||"disable"===e;this._gsEventHandler[e]=i?e=>t(e):e=>t(e,e.detail),this.el.addEventListener(e,this._gsEventHandler[e])}else"drag"===e||"dragstart"===e||"dragstop"===e||"resizestart"===e||"resize"===e||"resizestop"===e||"dropped"===e?this._gsEventHandler[e]=t:console.log("GridStack.on("+e+') event not supported, but you can still use $(".grid-stack").on(...) while jquery-ui is still used internally.');return this}off(e){return-1!==e.indexOf(" ")?(e.split(" ").forEach((e=>this.off(e))),this):("change"!==e&&"added"!==e&&"removed"!==e&&"enable"!==e&&"disable"!==e||this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}removeWidget(e,t=!0,i=!0){return h.getElements(e).forEach((e=>{if(e.parentElement!==this.el)return;let n=e.gridstackNode;n||(n=this.engine.nodes.find((t=>e===t.el))),n&&(delete e.gridstackNode,a.GridStackDDI.get().remove(e),this.engine.removeNode(n,t,i),t&&e.parentElement&&e.remove())})),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this}removeAll(e=!0){return this.engine.nodes.forEach((e=>{delete e.el.gridstackNode,a.GridStackDDI.get().remove(e.el)})),this.engine.removeAll(e),this._triggerRemoveEvent(),this}setAnimation(e){return e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}setStatic(e,t=!0){return this.opts.staticGrid===e||(this.opts.staticGrid=e,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach((e=>this._prepareDragDropByNode(e))),t&&this._setStaticClass()),this}update(e,t){if(arguments.length>2){console.warn("gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon");let i=arguments,n=1;return t={x:i[n++],y:i[n++],w:i[n++],h:i[n++]},this.update(e,t)}return h.getElements(e).forEach((e=>{if(!e||!e.gridstackNode)return;let i=e.gridstackNode,n=r.Utils.cloneDeep(t);delete n.autoPosition;let s,o=["x","y","w","h"];if(o.some((e=>void 0!==n[e]&&n[e]!==i[e]))&&(s={},o.forEach((e=>{s[e]=void 0!==n[e]?n[e]:i[e],delete n[e]}))),!s&&(n.minW||n.minH||n.maxW||n.maxH)&&(s={}),n.content){let t=e.querySelector(".grid-stack-item-content");t&&t.innerHTML!==n.content&&(t.innerHTML=n.content),delete n.content}let a=!1,l=!1;for(const e in n)"_"!==e[0]&&i[e]!==n[e]&&(i[e]=n[e],a=!0,l=l||!this.opts.staticGrid&&("noResize"===e||"noMove"===e||"locked"===e));s&&(this.engine.cleanNodes().beginUpdate(i).moveNode(i,s),this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate()),a&&this._writeAttr(e,i),l&&this._prepareDragDropByNode(i)})),this}margin(e){if(!("string"==typeof e&&e.split(" ").length>1)){let t=r.Utils.parseHeight(e);if(this.opts.marginUnit===t.unit&&this.opts.margin===t.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this.initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");let e=arguments,t=0,i={x:e[t++],y:e[t++],w:e[t++],h:e[t++],autoPosition:e[t++]};return this.willItFit(i)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;let e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){return this.engine.batchMode||this.engine.addedNodes&&this.engine.addedNodes.length>0&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach((e=>{delete e._dirty})),this._triggerEvent("added",this.engine.addedNodes),this.engine.addedNodes=[]),this}_triggerRemoveEvent(){return this.engine.batchMode||this.engine.removedNodes&&this.engine.removedNodes.length>0&&(this._triggerEvent("removed",this.engine.removedNodes),this.engine.removedNodes=[]),this}_triggerEvent(e,t){let i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);return this.el.dispatchEvent(i),this}_removeStylesheet(){return this._styles&&(r.Utils.removeStylesheet(this._styles._id),delete this._styles),this}_updateStyles(e=!1,t){if(e&&this._removeStylesheet(),this._updateContainerHeight(),0===this.opts.cellHeight)return this;let i=this.opts.cellHeight,n=this.opts.cellHeightUnit,s=`.${this.opts._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){let e="gridstack-style-"+(1e5*Math.random()).toFixed(),t=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=r.Utils.createStylesheet(e,t),!this._styles)return this;this._styles._id=e,this._styles._max=0,r.Utils.addCSSRule(this._styles,s,`min-height: ${i}${n}`);let o=this.opts.marginTop+this.opts.marginUnit,a=this.opts.marginBottom+this.opts.marginUnit,l=this.opts.marginRight+this.opts.marginUnit,h=this.opts.marginLeft+this.opts.marginUnit,u=`${s} > .grid-stack-item-content`,c=`.${this.opts._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;r.Utils.addCSSRule(this._styles,u,`top: ${o}; right: ${l}; bottom: ${a}; left: ${h};`),r.Utils.addCSSRule(this._styles,c,`top: ${o}; right: ${l}; bottom: ${a}; left: ${h};`),r.Utils.addCSSRule(this._styles,`${s} > .ui-resizable-ne`,`right: ${l}`),r.Utils.addCSSRule(this._styles,`${s} > .ui-resizable-e`,`right: ${l}`),r.Utils.addCSSRule(this._styles,`${s} > .ui-resizable-se`,`right: ${l}; bottom: ${a}`),r.Utils.addCSSRule(this._styles,`${s} > .ui-resizable-nw`,`left: ${h}`),r.Utils.addCSSRule(this._styles,`${s} > .ui-resizable-w`,`left: ${h}`),r.Utils.addCSSRule(this._styles,`${s} > .ui-resizable-sw`,`left: ${h}; bottom: ${a}`)}if((t=t||this._styles._max)>this._styles._max){let e=e=>i*e+n;for(let i=this._styles._max+1;i<=t;i++){let t=e(i);r.Utils.addCSSRule(this._styles,`${s}[gs-y="${i-1}"]`,`top: ${e(i-1)}`),r.Utils.addCSSRule(this._styles,`${s}[gs-h="${i}"]`,`height: ${t}`),r.Utils.addCSSRule(this._styles,`${s}[gs-min-h="${i}"]`,`min-height: ${t}`),r.Utils.addCSSRule(this._styles,`${s}[gs-max-h="${i}"]`,`max-height: ${t}`)}this._styles._max=t}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;let e=this.getRow()+this._extraDragRow;if(this.el.setAttribute("gs-current-row",String(e)),0===e)return this.el.style.removeProperty("height"),this;let t=this.opts.cellHeight,i=this.opts.cellHeightUnit;return t?(this.el.style.height=e*t+i,this):this}_prepareElement(e,t=!1,i){i||(e.classList.add(this.opts.itemClass),i=this._readAttr(e)),e.gridstackNode=i,i.el=e,i.grid=this;let n=Object.assign({},i);return i=this.engine.addNode(i,t),r.Utils.same(i,n)||this._writeAttr(e,i),this._prepareDragDropByNode(i),this}_writePosAttr(e,t){return void 0!==t.x&&null!==t.x&&e.setAttribute("gs-x",String(t.x)),void 0!==t.y&&null!==t.y&&e.setAttribute("gs-y",String(t.y)),t.w&&e.setAttribute("gs-w",String(t.w)),t.h&&e.setAttribute("gs-h",String(t.h)),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);let i={autoPosition:"gs-auto-position",minW:"gs-min-w",minH:"gs-min-h",maxW:"gs-max-w",maxH:"gs-max-h",noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",resizeHandles:"gs-resize-handles"};for(const n in i)t[n]?e.setAttribute(i[n],String(t[n])):e.removeAttribute(i[n]);return this}_readAttr(e){let t={};t.x=r.Utils.toNumber(e.getAttribute("gs-x")),t.y=r.Utils.toNumber(e.getAttribute("gs-y")),t.w=r.Utils.toNumber(e.getAttribute("gs-w")),t.h=r.Utils.toNumber(e.getAttribute("gs-h")),t.maxW=r.Utils.toNumber(e.getAttribute("gs-max-w")),t.minW=r.Utils.toNumber(e.getAttribute("gs-min-w")),t.maxH=r.Utils.toNumber(e.getAttribute("gs-max-h")),t.minH=r.Utils.toNumber(e.getAttribute("gs-min-h")),t.autoPosition=r.Utils.toBool(e.getAttribute("gs-auto-position")),t.noResize=r.Utils.toBool(e.getAttribute("gs-no-resize")),t.noMove=r.Utils.toBool(e.getAttribute("gs-no-move")),t.locked=r.Utils.toBool(e.getAttribute("gs-locked")),t.resizeHandles=e.getAttribute("gs-resize-handles"),t.id=e.getAttribute("gs-id");for(const e in t){if(!t.hasOwnProperty(e))return;t[e]||0===t[e]||delete t[e]}return t}_setStaticClass(){let e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onParentResize(){if(!this.el||!this.el.clientWidth)return;let e=!1;if(this._autoColumn&&this.opts._isNested)this.opts.column!==this.opts._isNested.w&&(e=!0,this.column(this.opts._isNested.w,"none"));else{let t=!this.opts.disableOneColumnMode&&this.el.clientWidth<=this.opts.minWidth;1===this.opts.column!==t&&(e=!0,this.opts.animate&&this.setAnimation(!1),this.column(t?1:this._prevColumn),this.opts.animate&&this.setAnimation(!0))}return this._isAutoCellHeight&&(!e&&this.opts.cellHeightThrottle?(this._cellHeightThrottle||(this._cellHeightThrottle=r.Utils.throttle((()=>this.cellHeight()),this.opts.cellHeightThrottle)),this._cellHeightThrottle()):this.cellHeight()),this.engine.nodes.forEach((e=>{e.subGrid&&e.subGrid.onParentResize()})),this}_updateWindowResizeEvent(e=!1){const t=(this._isAutoCellHeight||!this.opts.disableOneColumnMode)&&!this.opts._isNested;return e||!t||this._windowResizeBind?!e&&t||!this._windowResizeBind||(window.removeEventListener("resize",this._windowResizeBind),delete this._windowResizeBind):(this._windowResizeBind=this.onParentResize.bind(this),window.addEventListener("resize",this._windowResizeBind)),this}static getElement(e=".grid-stack-item"){return r.Utils.getElement(e)}static getElements(e=".grid-stack-item"){return r.Utils.getElements(e)}static getGridElement(e){return h.getElement(e)}static getGridElements(e){return r.Utils.getElements(e)}initMargin(){let e,t=0,i=[];return"string"==typeof this.opts.margin&&(i=this.opts.margin.split(" ")),2===i.length?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):4===i.length?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=r.Utils.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),void 0===this.opts.marginTop?this.opts.marginTop=t:(e=r.Utils.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),void 0===this.opts.marginBottom?this.opts.marginBottom=t:(e=r.Utils.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),void 0===this.opts.marginRight?this.opts.marginRight=t:(e=r.Utils.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),void 0===this.opts.marginLeft?this.opts.marginLeft=t:(e=r.Utils.parseHeight(this.opts.marginLeft),this.opts.marginLeft=e.h,delete this.opts.margin),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static setupDragIn(e,t){}movable(e,t){return this}resizable(e,t){return this}disable(){return this}enable(){return this}enableMove(e){return this}enableResize(e){return this}_setupAcceptWidget(){return this}_setupRemoveDrop(){return this}_prepareDragDropByNode(e){return this}_onStartMoving(e,t,i,n,s,o){}_dragOrResize(e,t,i,n,s,o){}_leave(e,t){}}t.GridStack=h,h.Utils=r.Utils,h.Engine=o.GridStackEngine},906:function(e,t,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||t.hasOwnProperty(i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.GridStackDDJQueryUI=t.$=void 0;const o=i(21),r=i(28);t.$=r,i(87),i(949),s(i(21),t);class a extends o.GridStackDD{resizable(e,t,i,n){let s=r(e);if("enable"===t)s.resizable().resizable(t);else if("disable"===t||"destroy"===t)s.data("ui-resizable")&&s.resizable(t);else if("option"===t)s.resizable(t,i,n);else{const i=e.gridstackNode.grid;let n=s.data("gs-resize-handles")?s.data("gs-resize-handles"):i.opts.resizable.handles;s.resizable(Object.assign(Object.assign(Object.assign({},i.opts.resizable),{handles:n}),{start:t.start,stop:t.stop,resize:t.resize}))}return this}draggable(e,t,i,n){let s=r(e);if("enable"===t)s.draggable().draggable("enable");else if("disable"===t||"destroy"===t)s.data("ui-draggable")&&s.draggable(t);else if("option"===t)s.draggable(t,i,n);else{const i=e.gridstackNode.grid;s.draggable(Object.assign(Object.assign({},i.opts.draggable),{containment:i.opts._isNested&&!i.opts.dragOut?r(i.el).parent():i.opts.draggable.containment||null,start:t.start,stop:t.stop,drag:t.drag}))}return this}dragIn(e,t){return r(e).draggable(t),this}droppable(e,t,i,n){let s=r(e);return"function"!=typeof t.accept||t._accept||(t._accept=t.accept,t.accept=e=>t._accept(e.get(0))),"disable"===t||"destroy"===t?s.data("ui-droppable")&&s.droppable(t):s.droppable(t,i,n),this}isDroppable(e){let t=r(e);return Boolean(t.data("ui-droppable"))}isDraggable(e){let t=r(e);return Boolean(t.data("ui-draggable"))}isResizable(e){let t=r(e);return Boolean(t.data("ui-resizable"))}on(e,t,i){return r(e).on(t,((e,t)=>i(e,t.draggable?t.draggable[0]:e.target,t.helper?t.helper[0]:null))),this}off(e,t){return r(e).off(t),this}}t.GridStackDDJQueryUI=a,o.GridStackDD.registerPlugin(a)},699:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},593:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Utils=t.obsoleteAttr=t.obsoleteOptsDel=t.obsoleteOpts=t.obsolete=void 0,t.obsolete=function(e,t,i,n,s){let o=(...o)=>(console.warn("gridstack.js: Function `"+i+"` is deprecated in "+s+" and has been replaced with `"+n+"`. It will be **completely** removed in v1.0"),t.apply(e,o));return o.prototype=t.prototype,o},t.obsoleteOpts=function(e,t,i,n){void 0!==e[t]&&(e[i]=e[t],console.warn("gridstack.js: Option `"+t+"` is deprecated in "+n+" and has been replaced with `"+i+"`. It will be **completely** removed in v1.0"))},t.obsoleteOptsDel=function(e,t,i,n){void 0!==e[t]&&console.warn("gridstack.js: Option `"+t+"` is deprecated in "+i+n)},t.obsoleteAttr=function(e,t,i,n){let s=e.getAttribute(t);null!==s&&(e.setAttribute(i,s),console.warn("gridstack.js: attribute `"+t+"`="+s+" is deprecated on this object in "+n+" and has been replaced with `"+i+"`. It will be **completely** removed in v1.0"))};class i{static getElements(e){if("string"==typeof e){let t=document.querySelectorAll(e);return t.length||"."===e[0]||"#"===e[0]||(t=document.querySelectorAll("."+e),t.length||(t=document.querySelectorAll("#"+e))),Array.from(t)}return[e]}static getElement(e){if("string"==typeof e){if(!e.length)return null;if("#"===e[0])return document.getElementById(e.substring(1));if("."===e[0]||"["===e[0])return document.querySelector(e);if(!isNaN(+e[0]))return document.getElementById(e);let t=document.querySelector(e);return t||(t=document.getElementById(e)),t||(t=document.querySelector("."+e)),t}return e}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return i.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static sort(e,t,i){return i=i||e.reduce(((e,t)=>Math.max(t.x+t.w,e)),0)||12,-1===t?e.sort(((e,t)=>t.x+t.y*i-(e.x+e.y*i))):e.sort(((e,t)=>e.x+e.y*i-(t.x+t.y*i)))}static createStylesheet(e,t){let i=document.createElement("style");return i.setAttribute("type","text/css"),i.setAttribute("gs-style-id",e),i.styleSheet?i.styleSheet.cssText="":i.appendChild(document.createTextNode("")),t?t.in