%PDF- %PDF-
Direktori : /var/www/projetos/suporte.iigd.com.br/public/lib/ |
Current File : /var/www/projetos/suporte.iigd.com.br/public/lib/gridstack.js.map |
{"version":3,"file":"gridstack.js","mappings":";;;;;;;AAAa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB;AACA,wBAAwB,mBAAO,CAAC,EAAiB;AACjD,oBAAoB,mBAAO,CAAC,EAAa;AACzC,gBAAgB,mBAAO,CAAC,EAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA,uDAAuD;AACvD,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,0DAA0D;AACpF;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B,EAAE,QAAQ;AACzE;AACA;AACA;AACA,mCAAmC;AACnC,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,oEAAoE,WAAW,kBAAkB;AACjG;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,KAAK;AACL;AACA;AACA;AACA;AACA,mCAAmC,2BAA2B,EAAE,QAAQ;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE,mDAAmD;AACnD;AACA,iCAAiC;AACjC;AACA,2CAA2C;AAC3C,iCAAiC;AACjC;AACA;AACA;AACA,0EAA0E,YAAY,iBAAiB;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,sBAAsB;AACtB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,8CAA8C;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA,mCAAmC;AACnC,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA,kCAAkC;AAClC,wDAAwD;AACxD,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,eAAe;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,wCAAwC;AACxC;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,QAAQ,uCAAuC;AACrH;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,gCAAgC;AAChC;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,yCAAyC;AACzC;AACA;AACA;AACA;;;;;;;AC1oBa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,oBAAoB;AACpB;;;;;;;AC3Ba;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB;AACvB,gBAAgB,mBAAO,CAAC,EAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD,6BAA6B;AAC7B,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,0DAA0D;AAC1D;AACA;AACA,uBAAuB;AACvB,0EAA0E;AAC1E;AACA;AACA;AACA;AACA;AACA,sEAAsE,cAAc,WAAW,iEAAiE,cAAc,qBAAqB;AACnM;AACA,wFAAwF,SAAS,0BAA0B;AAC3H;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2FAA2F,cAAc,4BAA4B;AACrI;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,gCAAgC,WAAW;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,mFAAmF;AACnF;AACA;AACA,+BAA+B;AAC/B;AACA;AACA,kDAAkD;AAClD;AACA;AACA,+BAA+B;AAC/B;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,uCAAuC;AACvC,gCAAgC;AAChC,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,iCAAiC;AACrF;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,iCAAiC;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,UAAU;AAC1F;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,uCAAuC;AACvC,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,uBAAuB,OAAO;AACvE,SAAS;AACT,gCAAgC,SAAS;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,eAAe;AACxD;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,yBAAyB;AACzB;AACA,uCAAuC;AACvC,+BAA+B;AAC/B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD,wBAAwB,sCAAsC;AAC9D,SAAS;AACT,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;;;;;;;ACh5Ba;AACb;AACA;AACA,mCAAmC,oCAAoC,gBAAgB;AACvF,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAO,CAAC,EAAoB;AACvD,gBAAgB,mBAAO,CAAC,EAAS;AACjC,wBAAwB,mBAAO,CAAC,EAAiB;AACjD;AACA,aAAa,mBAAO,CAAC,EAAS;AAC9B,aAAa,mBAAO,CAAC,EAAS;AAC9B,aAAa,mBAAO,CAAC,EAAoB;AACzC,aAAa,mBAAO,CAAC,EAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,sBAAsB;AACtB,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,4CAA4C;AACjG;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,eAAe;AACf,6CAA6C;AAC7C;AACA;AACA;AACA,qBAAqB;AACrB,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,mCAAmC;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,iDAAiD;AACjD;AACA,SAAS;AACT;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA,sEAAsE;AACtE,2DAA2D,gBAAgB;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C,8GAA8G,KAAK;AACnH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uGAAuG,sBAAsB;AAC7H;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE;AACtE,gEAAgE,0BAA0B,yCAAyC,QAAQ;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG;AACjG,sCAAsC;AACtC;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA,gEAAgE;AAChE,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,UAAU,OAAO,SAAS,KAAK,OAAO,KAAK,MAAM;AACvG;AACA;AACA,6BAA6B;AAC7B,0DAA0D,mCAAmC;AAC7F;AACA;AACA,6BAA6B;AAC7B,0DAA0D,mBAAmB,cAAc,iBAAiB;AAC5G;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,sBAAsB;AACnE;AACA,4DAA4D,oBAAoB;AAChF;AACA;AACA,2DAA2D,6BAA6B;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wEAAwE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG,mBAAmB;AACpH;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,yGAAyG,SAAS;AAClH;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,kBAAkB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,8BAA8B;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,4BAA4B,KAAK,oBAAoB;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E,WAAW,EAAE,eAAe;AACtG;AACA;AACA;AACA;AACA;AACA,6BAA6B,QAAQ;AACrC,kCAAkC,4BAA4B;AAC9D,oEAAoE,MAAM,SAAS,QAAQ,UAAU,SAAS,QAAQ,MAAM;AAC5H,wEAAwE,MAAM,SAAS,QAAQ,UAAU,SAAS,QAAQ,MAAM;AAChI;AACA,sDAAsD,QAAQ,+BAA+B,MAAM;AACnG,sDAAsD,QAAQ,8BAA8B,MAAM;AAClG,sDAAsD,QAAQ,+BAA+B,QAAQ,UAAU,OAAO;AACtH,sDAAsD,QAAQ,8BAA8B,KAAK;AACjG,sDAAsD,QAAQ,6BAA6B,KAAK;AAChG,sDAAsD,QAAQ,8BAA8B,OAAO,UAAU,OAAO;AACpH;AACA;AACA;AACA;AACA;AACA,gDAAgD,WAAW,OAAO;AAClE;AACA,0DAA0D,OAAO,SAAS,MAAM,aAAa,iBAAiB,IAAI;AAClH,0DAA0D,OAAO,SAAS,EAAE,gBAAgB,EAAE;AAC9F,0DAA0D,OAAO,aAAa,EAAE,oBAAoB,EAAE;AACtG,0DAA0D,OAAO,aAAa,EAAE,oBAAoB,EAAE;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,mDAAmD;AACnD;AACA,iCAAiC;AACjC;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,2BAA2B;AAC3B;AACA,yBAAyB;AACzB;AACA,mCAAmC;AACnC;AACA,iEAAiE;AACjE;AACA,gEAAgE;AAChE;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;;;;;;ACh7Ca;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;;;;;;;ACrCa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB,qBAAqB,mBAAO,CAAC,EAAc;AAC3C,mBAAmB,mBAAO,CAAC,EAAY;AACvC,uBAAuB,mBAAO,CAAC,EAAgB;AAC/C;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,qCAAqC,8CAA8C,YAAY;AACzH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,oCAAoC;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,+BAA+B;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,mCAAmC;AAC5F;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA,mCAAmC;AACnC;AACA;AACA,yCAAyC;AACzC;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,8FAA8F;AAC9F;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA,wBAAwB,YAAY;AACpC,oCAAoC;AACpC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,gCAAgC,eAAe;AAC/C,4CAA4C,2CAA2C,+BAA+B;AACtH;AACA;AACA;AACA;;;;;;;AChTa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB,qBAAqB,mBAAO,CAAC,EAAc;AAC3C,uBAAuB,mBAAO,CAAC,EAAgB;AAC/C,mBAAmB,mBAAO,CAAC,EAAY;AACvC;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,SAAS,QAAQ,+CAA+C;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,mCAAmC;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,SAAS,QAAQ,+CAA+C;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2GAA2G;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,kCAAkC;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,yDAAyD,+BAA+B;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,oBAAoB;AACnD;AACA;AACA,mBAAmB;AACnB;;;;;;;ACvKa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,uBAAuB,mBAAO,CAAC,EAAgB;AAC/C,uBAAuB,mBAAO,CAAC,GAAgB;AAC/C,uBAAuB,mBAAO,CAAC,GAAgB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;;;;;;AC9Fa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;;;;;;;ACVa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yBAAyB,EAAE,SAAS;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;;;;;;ACjFa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB,8BAA8B,mBAAO,CAAC,EAAuB;AAC7D,uBAAuB,mBAAO,CAAC,EAAgB;AAC/C,mBAAmB,mBAAO,CAAC,EAAY;AACvC,gBAAgB,mBAAO,CAAC,EAAU;AAClC;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,iCAAiC,YAAY;AACjF;AACA;AACA,iBAAiB;AACjB,gCAAgC,6BAA6B,gBAAgB;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,sCAAsC;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,iCAAiC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,qCAAqC;AAC9F;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA,oBAAoB,YAAY;AAChC,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;;;;;;;ACtRa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,kFAAkF;AAClF,oGAAoG;AACpG,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,2BAA2B;AAC/C;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;;;;;;;AC7Fa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,oCAAoC,gBAAgB;AACvF,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB,qBAAqB,mBAAO,CAAC,EAAc;AAC3C,qBAAqB,mBAAO,CAAC,EAAc;AAC3C,uBAAuB,mBAAO,CAAC,GAAiB;AAChD,gBAAgB,mBAAO,CAAC,EAAU;AAClC;AACA,aAAa,mBAAO,CAAC,GAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA,qCAAqC,cAAc;AACnD;AACA;AACA;AACA;AACA,+EAA+E,0BAA0B,kBAAkB;AAC3H;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA,qCAAqC,cAAc;AACnD;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA,qCAAqC,cAAc;AACnD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;;;;;;AC3Ia;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D;;;;;;;ACNa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,aAAa,GAAG,oBAAoB,GAAG,uBAAuB,GAAG,oBAAoB,GAAG,gBAAgB;AACxG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,oDAAoD;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,UAAU,EAAE,OAAO;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,uFAAuF;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,eAAe,oBAAoB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,iDAAiD;AACjF;AACA;AACA,gCAAgC,4DAA4D;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;;;;;;;ACtZA;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACsC;AACtC,mBAAmB,gDAAS;AAC5B,mBAAO,CAAC,EAAuC;AAC/C,mBAAO,CAAC,GAAkC","sources":["webpack://@glpi/glpi/./node_modules/gridstack/dist/gridstack-dd.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/gridstack-ddi.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/gridstack-engine.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/gridstack.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-base-impl.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-draggable.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-droppable.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-element.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-manager.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-resizable-handle.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-resizable.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/dd-utils.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/h5/gridstack-dd-native.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/types.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/utils.js","webpack://@glpi/glpi/./node_modules/gridstack/dist/gridstack.min.css?8b5a","webpack://@glpi/glpi/webpack/bootstrap","webpack://@glpi/glpi/webpack/runtime/compat get default export","webpack://@glpi/glpi/webpack/runtime/define property getters","webpack://@glpi/glpi/webpack/runtime/hasOwnProperty shorthand","webpack://@glpi/glpi/webpack/runtime/make namespace object","webpack://@glpi/glpi/./lib/bundles/gridstack.js"],"sourcesContent":["\"use strict\";\r\n/**\r\n * gridstack-dd.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.GridStackDD = void 0;\r\n/* eslint-disable @typescript-eslint/no-unused-vars */\r\nconst gridstack_ddi_1 = require(\"./gridstack-ddi\");\r\nconst gridstack_1 = require(\"./gridstack\");\r\nconst utils_1 = require(\"./utils\");\r\n// TEST let count = 0;\r\n/**\r\n * Base class implementing common Grid drag'n'drop functionality, with domain specific subclass (h5 vs jq subclasses)\r\n */\r\nclass GridStackDD extends gridstack_ddi_1.GridStackDDI {\r\n /** override to cast to correct type */\r\n static get() {\r\n return gridstack_ddi_1.GridStackDDI.get();\r\n }\r\n /** removes any drag&drop present (called during destroy) */\r\n remove(el) {\r\n this.draggable(el, 'destroy').resizable(el, 'destroy');\r\n if (el.gridstackNode) {\r\n delete el.gridstackNode._initDD; // reset our DD init flag\r\n }\r\n return this;\r\n }\r\n}\r\nexports.GridStackDD = GridStackDD;\r\n/********************************************************************************\r\n * GridStack code that is doing drag&drop extracted here so main class is smaller\r\n * for static grid that don't do any of this work anyway. Saves about 10k.\r\n * https://www.typescriptlang.org/docs/handbook/declaration-merging.html\r\n * https://www.typescriptlang.org/docs/handbook/mixins.html\r\n ********************************************************************************/\r\n/** @internal called to add drag over to support widgets being added externally */\r\ngridstack_1.GridStack.prototype._setupAcceptWidget = function () {\r\n // check if we need to disable things\r\n if (this.opts.staticGrid || (!this.opts.acceptWidgets && !this.opts.removable)) {\r\n GridStackDD.get().droppable(this.el, 'destroy');\r\n return this;\r\n }\r\n // vars shared across all methods\r\n let cellHeight, cellWidth;\r\n let onDrag = (event, el, helper) => {\r\n let node = el.gridstackNode;\r\n if (!node)\r\n return;\r\n helper = helper || el;\r\n let parent = this.el.getBoundingClientRect();\r\n let { top, left } = helper.getBoundingClientRect();\r\n left -= parent.left;\r\n top -= parent.top;\r\n let ui = { position: { top, left } };\r\n if (node._temporaryRemoved) {\r\n node.x = Math.max(0, Math.round(left / cellWidth));\r\n node.y = Math.max(0, Math.round(top / cellHeight));\r\n delete node.autoPosition;\r\n this.engine.nodeBoundFix(node);\r\n // don't accept *initial* location if doesn't fit #1419 (locked drop region, or can't grow), but maybe try if it will go somewhere\r\n if (!this.engine.willItFit(node)) {\r\n node.autoPosition = true; // ignore x,y and try for any slot...\r\n if (!this.engine.willItFit(node)) {\r\n GridStackDD.get().off(el, 'drag'); // stop calling us\r\n return; // full grid or can't grow\r\n }\r\n if (node._willFitPos) {\r\n // use the auto position instead #1687\r\n utils_1.Utils.copyPos(node, node._willFitPos);\r\n delete node._willFitPos;\r\n }\r\n }\r\n // re-use the existing node dragging method\r\n this._onStartMoving(helper, event, ui, node, cellWidth, cellHeight);\r\n }\r\n else {\r\n // re-use the existing node dragging that does so much of the collision detection\r\n this._dragOrResize(helper, event, ui, node, cellWidth, cellHeight);\r\n }\r\n };\r\n GridStackDD.get()\r\n .droppable(this.el, {\r\n accept: (el) => {\r\n let node = el.gridstackNode;\r\n // set accept drop to true on ourself (which we ignore) so we don't get \"can't drop\" icon in HTML5 mode while moving\r\n if ((node === null || node === void 0 ? void 0 : node.grid) === this)\r\n return true;\r\n if (!this.opts.acceptWidgets)\r\n return false;\r\n // prevent deeper nesting until rest of 992 can be fixed\r\n if (node === null || node === void 0 ? void 0 : node.subGrid)\r\n return false;\r\n // check for accept method or class matching\r\n let canAccept = true;\r\n if (typeof this.opts.acceptWidgets === 'function') {\r\n canAccept = this.opts.acceptWidgets(el);\r\n }\r\n else {\r\n let selector = (this.opts.acceptWidgets === true ? '.grid-stack-item' : this.opts.acceptWidgets);\r\n canAccept = el.matches(selector);\r\n }\r\n // finally check to make sure we actually have space left #1571\r\n if (canAccept && node && this.opts.maxRow) {\r\n let n = { w: node.w, h: node.h, minW: node.minW, minH: node.minH }; // only width/height matters and autoPosition\r\n canAccept = this.engine.willItFit(n);\r\n }\r\n return canAccept;\r\n }\r\n })\r\n /**\r\n * entering our grid area\r\n */\r\n .on(this.el, 'dropover', (event, el, helper) => {\r\n // TEST console.log(`over ${this.el.gridstack.opts.id} ${count++}`);\r\n let node = el.gridstackNode;\r\n // ignore drop enter on ourself (unless we temporarily removed) which happens on a simple drag of our item\r\n if ((node === null || node === void 0 ? void 0 : node.grid) === this && !node._temporaryRemoved) {\r\n // delete node._added; // reset this to track placeholder again in case we were over other grid #1484 (dropout doesn't always clear)\r\n return false; // prevent parent from receiving msg (which may be a grid as well)\r\n }\r\n // fix #1578 when dragging fast, we may not get a leave on the previous grid so force one now\r\n if ((node === null || node === void 0 ? void 0 : node.grid) && node.grid !== this && !node._temporaryRemoved) {\r\n // TEST console.log('dropover without leave');\r\n let otherGrid = node.grid;\r\n otherGrid._leave(el, helper);\r\n }\r\n // cache cell dimensions (which don't change), position can animate if we removed an item in otherGrid that affects us...\r\n cellWidth = this.cellWidth();\r\n cellHeight = this.getCellHeight(true);\r\n // load any element attributes if we don't have a node\r\n if (!node) { // @ts-ignore private read only on ourself\r\n node = this._readAttr(el);\r\n }\r\n if (!node.grid) {\r\n node._isExternal = true;\r\n el.gridstackNode = node;\r\n }\r\n // calculate the grid size based on element outer size\r\n helper = helper || el;\r\n let w = node.w || Math.round(helper.offsetWidth / cellWidth) || 1;\r\n let h = node.h || Math.round(helper.offsetHeight / cellHeight) || 1;\r\n // if the item came from another grid, make a copy and save the original info in case we go back there\r\n if (node.grid && node.grid !== this) {\r\n // copy the node original values (min/max/id/etc...) but override width/height/other flags which are this grid specific\r\n // TEST console.log('dropover cloning node');\r\n if (!el._gridstackNodeOrig)\r\n el._gridstackNodeOrig = node; // shouldn't have multiple nested!\r\n el.gridstackNode = node = Object.assign(Object.assign({}, node), { w, h, grid: this });\r\n this.engine.cleanupNode(node)\r\n .nodeBoundFix(node);\r\n // restore some internal fields we need after clearing them all\r\n node._initDD =\r\n node._isExternal = // DOM needs to be re-parented on a drop\r\n node._temporaryRemoved = true; // so it can be inserted onDrag below\r\n }\r\n else {\r\n node.w = w;\r\n node.h = h;\r\n node._temporaryRemoved = true; // so we can insert it\r\n }\r\n // clear any marked for complete removal (Note: don't check _isAboutToRemove as that is cleared above - just do it)\r\n _itemRemoving(node.el, false);\r\n GridStackDD.get().on(el, 'drag', onDrag);\r\n // make sure this is called at least once when going fast #1578\r\n onDrag(event, el, helper);\r\n return false; // prevent parent from receiving msg (which may be a grid as well)\r\n })\r\n /**\r\n * Leaving our grid area...\r\n */\r\n .on(this.el, 'dropout', (event, el, helper) => {\r\n // TEST console.log(`out ${this.el.gridstack.opts.id} ${count++}`);\r\n let node = el.gridstackNode;\r\n if (!node)\r\n return false;\r\n // fix #1578 when dragging fast, we might get leave after other grid gets enter (which calls us to clean)\r\n // so skip this one if we're not the active grid really..\r\n if (!node.grid || node.grid === this) {\r\n this._leave(el, helper);\r\n }\r\n return false; // prevent parent from receiving msg (which may be grid as well)\r\n })\r\n /**\r\n * end - releasing the mouse\r\n */\r\n .on(this.el, 'drop', (event, el, helper) => {\r\n let node = el.gridstackNode;\r\n // ignore drop on ourself from ourself that didn't come from the outside - dragend will handle the simple move instead\r\n if ((node === null || node === void 0 ? void 0 : node.grid) === this && !node._isExternal)\r\n return false;\r\n let wasAdded = !!this.placeholder.parentElement; // skip items not actually added to us because of constrains, but do cleanup #1419\r\n this.placeholder.remove();\r\n // notify previous grid of removal\r\n // TEST console.log('drop delete _gridstackNodeOrig')\r\n let origNode = el._gridstackNodeOrig;\r\n delete el._gridstackNodeOrig;\r\n if (wasAdded && origNode && origNode.grid && origNode.grid !== this) {\r\n let oGrid = origNode.grid;\r\n oGrid.engine.removedNodes.push(origNode);\r\n oGrid._triggerRemoveEvent();\r\n }\r\n if (!node)\r\n return false;\r\n // use existing placeholder node as it's already in our list with drop location\r\n if (wasAdded) {\r\n this.engine.cleanupNode(node); // removes all internal _xyz values\r\n node.grid = this;\r\n }\r\n GridStackDD.get().off(el, 'drag');\r\n // if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102)\r\n // as the helper will be nuked by jquery-ui otherwise\r\n if (helper !== el) {\r\n helper.remove();\r\n el.gridstackNode = origNode; // original item (left behind) is re-stored to pre dragging as the node now has drop info\r\n if (wasAdded) {\r\n el = el.cloneNode(true);\r\n }\r\n }\r\n else {\r\n el.remove(); // reduce flicker as we change depth here, and size further down\r\n GridStackDD.get().remove(el);\r\n }\r\n if (!wasAdded)\r\n return false;\r\n el.gridstackNode = node;\r\n node.el = el;\r\n // @ts-ignore\r\n utils_1.Utils.copyPos(node, this._readAttr(this.placeholder)); // placeholder values as moving VERY fast can throw things off #1578\r\n utils_1.Utils.removePositioningStyles(el); // @ts-ignore\r\n this._writeAttr(el, node);\r\n this.el.appendChild(el); // @ts-ignore\r\n this._updateContainerHeight();\r\n this.engine.addedNodes.push(node); // @ts-ignore\r\n this._triggerAddEvent(); // @ts-ignore\r\n this._triggerChangeEvent();\r\n this.engine.endUpdate();\r\n if (this._gsEventHandler['dropped']) {\r\n this._gsEventHandler['dropped'](Object.assign(Object.assign({}, event), { type: 'dropped' }), origNode && origNode.grid ? origNode : undefined, node);\r\n }\r\n // wait till we return out of the drag callback to set the new drag&resize handler or they may get messed up\r\n window.setTimeout(() => {\r\n // IFF we are still there (some application will use as placeholder and insert their real widget instead and better call makeWidget())\r\n if (node.el && node.el.parentElement) {\r\n this._prepareDragDropByNode(node);\r\n }\r\n else {\r\n this.engine.removeNode(node);\r\n }\r\n });\r\n return false; // prevent parent from receiving msg (which may be grid as well)\r\n });\r\n return this;\r\n};\r\n/** @internal mark item for removal */\r\nfunction _itemRemoving(el, remove) {\r\n let node = el ? el.gridstackNode : undefined;\r\n if (!node || !node.grid)\r\n return;\r\n remove ? node._isAboutToRemove = true : delete node._isAboutToRemove;\r\n remove ? el.classList.add('grid-stack-item-removing') : el.classList.remove('grid-stack-item-removing');\r\n}\r\n/** @internal called to setup a trash drop zone if the user specifies it */\r\ngridstack_1.GridStack.prototype._setupRemoveDrop = function () {\r\n if (!this.opts.staticGrid && typeof this.opts.removable === 'string') {\r\n let trashEl = document.querySelector(this.opts.removable);\r\n if (!trashEl)\r\n return this;\r\n // only register ONE drop-over/dropout callback for the 'trash', and it will\r\n // update the passed in item and parent grid because the 'trash' is a shared resource anyway,\r\n // and Native DD only has 1 event CB (having a list and technically a per grid removableOptions complicates things greatly)\r\n if (!GridStackDD.get().isDroppable(trashEl)) {\r\n GridStackDD.get().droppable(trashEl, this.opts.removableOptions)\r\n .on(trashEl, 'dropover', (event, el) => _itemRemoving(el, true))\r\n .on(trashEl, 'dropout', (event, el) => _itemRemoving(el, false));\r\n }\r\n }\r\n return this;\r\n};\r\n/**\r\n * call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.\r\n * Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar\r\n * is dynamically create and needs to change later.\r\n **/\r\ngridstack_1.GridStack.setupDragIn = function (_dragIn, _dragInOptions) {\r\n let dragIn;\r\n let dragInOptions;\r\n const dragInDefaultOptions = {\r\n revert: 'invalid',\r\n handle: '.grid-stack-item-content',\r\n scroll: false,\r\n appendTo: 'body'\r\n };\r\n // cache in the passed in values (form grid init?) so they don't have to resend them each time\r\n if (_dragIn) {\r\n dragIn = _dragIn;\r\n dragInOptions = Object.assign(Object.assign({}, dragInDefaultOptions), (_dragInOptions || {}));\r\n }\r\n if (typeof dragIn !== 'string')\r\n return;\r\n let dd = GridStackDD.get();\r\n utils_1.Utils.getElements(dragIn).forEach(el => {\r\n if (!dd.isDraggable(el))\r\n dd.dragIn(el, dragInOptions);\r\n });\r\n};\r\n/** @internal prepares the element for drag&drop **/\r\ngridstack_1.GridStack.prototype._prepareDragDropByNode = function (node) {\r\n let el = node.el;\r\n let dd = GridStackDD.get();\r\n // check for disabled grid first\r\n if (this.opts.staticGrid || ((node.noMove || this.opts.disableDrag) && (node.noResize || this.opts.disableResize))) {\r\n if (node._initDD) {\r\n dd.remove(el); // nukes everything instead of just disable, will add some styles back next\r\n delete node._initDD;\r\n }\r\n el.classList.add('ui-draggable-disabled', 'ui-resizable-disabled'); // add styles one might depend on #1435\r\n return this;\r\n }\r\n if (!node._initDD) {\r\n // variables used/cashed between the 3 start/move/end methods, in addition to node passed above\r\n let cellWidth;\r\n let cellHeight;\r\n /** called when item starts moving/resizing */\r\n let onStartMoving = (event, ui) => {\r\n // trigger any 'dragstart' / 'resizestart' manually\r\n if (this._gsEventHandler[event.type]) {\r\n this._gsEventHandler[event.type](event, event.target);\r\n }\r\n cellWidth = this.cellWidth();\r\n cellHeight = this.getCellHeight(true); // force pixels for calculations\r\n this._onStartMoving(el, event, ui, node, cellWidth, cellHeight);\r\n };\r\n /** called when item is being dragged/resized */\r\n let dragOrResize = (event, ui) => {\r\n this._dragOrResize(el, event, ui, node, cellWidth, cellHeight);\r\n };\r\n /** called when the item stops moving/resizing */\r\n let onEndMoving = (event) => {\r\n this.placeholder.remove();\r\n delete node._moving;\r\n delete node._lastTried;\r\n // if the item has moved to another grid, we're done here\r\n let target = event.target;\r\n if (!target.gridstackNode || target.gridstackNode.grid !== this)\r\n return;\r\n node.el = target;\r\n if (node._isAboutToRemove) {\r\n let gridToNotify = el.gridstackNode.grid;\r\n if (gridToNotify._gsEventHandler[event.type]) {\r\n gridToNotify._gsEventHandler[event.type](event, target);\r\n }\r\n dd.remove(el);\r\n gridToNotify.engine.removedNodes.push(node);\r\n gridToNotify._triggerRemoveEvent();\r\n // break circular links and remove DOM\r\n delete el.gridstackNode;\r\n delete node.el;\r\n el.remove();\r\n }\r\n else {\r\n if (!node._temporaryRemoved) {\r\n // move to new placeholder location\r\n utils_1.Utils.removePositioningStyles(target); // @ts-ignore\r\n this._writePosAttr(target, node);\r\n }\r\n else {\r\n // got removed - restore item back to before dragging position\r\n utils_1.Utils.removePositioningStyles(target);\r\n utils_1.Utils.copyPos(node, node._orig); // @ts-ignore\r\n this._writePosAttr(target, node);\r\n this.engine.addNode(node);\r\n }\r\n if (this._gsEventHandler[event.type]) {\r\n this._gsEventHandler[event.type](event, target);\r\n }\r\n }\r\n // @ts-ignore\r\n this._extraDragRow = 0; // @ts-ignore\r\n this._updateContainerHeight(); // @ts-ignore\r\n this._triggerChangeEvent();\r\n this.engine.endUpdate();\r\n };\r\n dd.draggable(el, {\r\n start: onStartMoving,\r\n stop: onEndMoving,\r\n drag: dragOrResize\r\n }).resizable(el, {\r\n start: onStartMoving,\r\n stop: onEndMoving,\r\n resize: dragOrResize\r\n });\r\n node._initDD = true; // we've set DD support now\r\n }\r\n // finally fine tune move vs resize by disabling any part...\r\n if (node.noMove || this.opts.disableDrag) {\r\n dd.draggable(el, 'disable');\r\n el.classList.add('ui-draggable-disabled');\r\n }\r\n else {\r\n dd.draggable(el, 'enable');\r\n el.classList.remove('ui-draggable-disabled');\r\n }\r\n if (node.noResize || this.opts.disableResize) {\r\n dd.resizable(el, 'disable');\r\n el.classList.add('ui-resizable-disabled');\r\n }\r\n else {\r\n dd.resizable(el, 'enable');\r\n el.classList.remove('ui-resizable-disabled');\r\n }\r\n return this;\r\n};\r\n/** @internal called when item is starting a drag/resize */\r\ngridstack_1.GridStack.prototype._onStartMoving = function (el, event, ui, node, cellWidth, cellHeight) {\r\n this.engine.cleanNodes()\r\n .beginUpdate(node);\r\n // @ts-ignore\r\n this._writePosAttr(this.placeholder, node);\r\n this.el.appendChild(this.placeholder);\r\n // TEST console.log('_onStartMoving placeholder')\r\n node.el = this.placeholder;\r\n node._lastUiPosition = ui.position;\r\n node._prevYPix = ui.position.top;\r\n node._moving = (event.type === 'dragstart'); // 'dropover' are not initially moving so they can go exactly where they enter (will push stuff out of the way)\r\n delete node._lastTried;\r\n if (event.type === 'dropover' && node._temporaryRemoved) {\r\n // TEST console.log('engine.addNode x=' + node.x);\r\n this.engine.addNode(node); // will add, fix collisions, update attr and clear _temporaryRemoved\r\n node._moving = true; // AFTER, mark as moving object (wanted fix location before)\r\n }\r\n // set the min/max resize info\r\n this.engine.cacheRects(cellWidth, cellHeight, this.opts.marginTop, this.opts.marginRight, this.opts.marginBottom, this.opts.marginLeft);\r\n if (event.type === 'resizestart') {\r\n let dd = GridStackDD.get()\r\n .resizable(el, 'option', 'minWidth', cellWidth * (node.minW || 1))\r\n .resizable(el, 'option', 'minHeight', cellHeight * (node.minH || 1));\r\n if (node.maxW) {\r\n dd.resizable(el, 'option', 'maxWidth', cellWidth * node.maxW);\r\n }\r\n if (node.maxH) {\r\n dd.resizable(el, 'option', 'maxHeight', cellHeight * node.maxH);\r\n }\r\n }\r\n};\r\n/** @internal called when item leaving our area by either cursor dropout event\r\n * or shape is outside our boundaries. remove it from us, and mark temporary if this was\r\n * our item to start with else restore prev node values from prev grid it came from.\r\n **/\r\ngridstack_1.GridStack.prototype._leave = function (el, helper) {\r\n let node = el.gridstackNode;\r\n if (!node)\r\n return;\r\n GridStackDD.get().off(el, 'drag'); // no need to track while being outside\r\n // this gets called when cursor leaves and shape is outside, so only do this once\r\n if (node._temporaryRemoved)\r\n return;\r\n node._temporaryRemoved = true;\r\n this.engine.removeNode(node); // remove placeholder as well, otherwise it's a sign node is not in our list, which is a bigger issue\r\n node.el = node._isExternal && helper ? helper : el; // point back to real item being dragged\r\n if (this.opts.removable === true) { // boolean vs a class string\r\n // item leaving us and we are supposed to remove on leave (no need to drag onto trash) mark it so\r\n _itemRemoving(el, true);\r\n }\r\n // finally if item originally came from another grid, but left us, restore things back to prev info\r\n if (el._gridstackNodeOrig) {\r\n // TEST console.log('leave delete _gridstackNodeOrig')\r\n el.gridstackNode = el._gridstackNodeOrig;\r\n delete el._gridstackNodeOrig;\r\n }\r\n else if (node._isExternal) {\r\n // item came from outside (like a toolbar) so nuke any node info\r\n delete node.el;\r\n delete el.gridstackNode;\r\n // and restore all nodes back to original\r\n this.engine.restoreInitial();\r\n }\r\n};\r\n/** @internal called when item is being dragged/resized */\r\ngridstack_1.GridStack.prototype._dragOrResize = function (el, event, ui, node, cellWidth, cellHeight) {\r\n let p = Object.assign({}, node._orig); // could be undefined (_isExternal) which is ok (drag only set x,y and w,h will default to node value)\r\n let resizing;\r\n let mLeft = this.opts.marginLeft, mRight = this.opts.marginRight, mTop = this.opts.marginTop, mBottom = this.opts.marginBottom;\r\n // if margins (which are used to pass mid point by) are large relative to cell height/width, reduce them down #1855\r\n let mHeight = Math.round(cellHeight * 0.1), mWidth = Math.round(cellWidth * 0.1);\r\n mLeft = Math.min(mLeft, mWidth);\r\n mRight = Math.min(mRight, mWidth);\r\n mTop = Math.min(mTop, mHeight);\r\n mBottom = Math.min(mBottom, mHeight);\r\n if (event.type === 'drag') {\r\n if (node._temporaryRemoved)\r\n return; // handled by dropover\r\n let distance = ui.position.top - node._prevYPix;\r\n node._prevYPix = ui.position.top;\r\n utils_1.Utils.updateScrollPosition(el, ui.position, distance);\r\n // get new position taking into account the margin in the direction we are moving! (need to pass mid point by margin)\r\n let left = ui.position.left + (ui.position.left > node._lastUiPosition.left ? -mRight : mLeft);\r\n let top = ui.position.top + (ui.position.top > node._lastUiPosition.top ? -mBottom : mTop);\r\n p.x = Math.round(left / cellWidth);\r\n p.y = Math.round(top / cellHeight);\r\n // @ts-ignore// if we're at the bottom hitting something else, grow the grid so cursor doesn't leave when trying to place below others\r\n let prev = this._extraDragRow;\r\n if (this.engine.collide(node, p)) {\r\n let row = this.getRow();\r\n let extra = Math.max(0, (p.y + node.h) - row);\r\n if (this.opts.maxRow && row + extra > this.opts.maxRow) {\r\n extra = Math.max(0, this.opts.maxRow - row);\r\n } // @ts-ignore\r\n this._extraDragRow = extra; // @ts-ignore\r\n }\r\n else\r\n this._extraDragRow = 0; // @ts-ignore\r\n if (this._extraDragRow !== prev)\r\n this._updateContainerHeight();\r\n if (node.x === p.x && node.y === p.y)\r\n return; // skip same\r\n // DON'T skip one we tried as we might have failed because of coverage <50% before\r\n // if (node._lastTried && node._lastTried.x === x && node._lastTried.y === y) return;\r\n }\r\n else if (event.type === 'resize') {\r\n if (p.x < 0)\r\n return;\r\n // Scrolling page if needed\r\n utils_1.Utils.updateScrollResize(event, el, cellHeight);\r\n // get new size\r\n p.w = Math.round((ui.size.width - mLeft) / cellWidth);\r\n p.h = Math.round((ui.size.height - mTop) / cellHeight);\r\n if (node.w === p.w && node.h === p.h)\r\n return;\r\n if (node._lastTried && node._lastTried.w === p.w && node._lastTried.h === p.h)\r\n return; // skip one we tried (but failed)\r\n // if we size on left/top side this might move us, so get possible new position as well\r\n let left = ui.position.left + mLeft;\r\n let top = ui.position.top + mTop;\r\n p.x = Math.round(left / cellWidth);\r\n p.y = Math.round(top / cellHeight);\r\n resizing = true;\r\n }\r\n node._lastTried = p; // set as last tried (will nuke if we go there)\r\n let rect = {\r\n x: ui.position.left + mLeft,\r\n y: ui.position.top + mTop,\r\n w: (ui.size ? ui.size.width : node.w * cellWidth) - mLeft - mRight,\r\n h: (ui.size ? ui.size.height : node.h * cellHeight) - mTop - mBottom\r\n };\r\n if (this.engine.moveNodeCheck(node, Object.assign(Object.assign({}, p), { cellWidth, cellHeight, rect, resizing }))) {\r\n node._lastUiPosition = ui.position;\r\n this.engine.cacheRects(cellWidth, cellHeight, mTop, mRight, mBottom, mLeft);\r\n delete node._skipDown;\r\n if (resizing && node.subGrid) {\r\n node.subGrid.onParentResize();\r\n } // @ts-ignore\r\n this._extraDragRow = 0; // @ts-ignore\r\n this._updateContainerHeight();\r\n let target = event.target; // @ts-ignore\r\n this._writePosAttr(target, node);\r\n if (this._gsEventHandler[event.type]) {\r\n this._gsEventHandler[event.type](event, target);\r\n }\r\n }\r\n};\r\n/**\r\n * Enables/Disables moving.\r\n * @param els widget or selector to modify.\r\n * @param val if true widget will be draggable.\r\n */\r\ngridstack_1.GridStack.prototype.movable = function (els, val) {\r\n if (this.opts.staticGrid)\r\n return this; // can't move a static grid!\r\n gridstack_1.GridStack.getElements(els).forEach(el => {\r\n let node = el.gridstackNode;\r\n if (!node)\r\n return;\r\n if (val)\r\n delete node.noMove;\r\n else\r\n node.noMove = true;\r\n this._prepareDragDropByNode(node); // init DD if need be, and adjust\r\n });\r\n return this;\r\n};\r\n/**\r\n * Enables/Disables resizing.\r\n * @param els widget or selector to modify\r\n * @param val if true widget will be resizable.\r\n */\r\ngridstack_1.GridStack.prototype.resizable = function (els, val) {\r\n if (this.opts.staticGrid)\r\n return this; // can't resize a static grid!\r\n gridstack_1.GridStack.getElements(els).forEach(el => {\r\n let node = el.gridstackNode;\r\n if (!node)\r\n return;\r\n if (val)\r\n delete node.noResize;\r\n else\r\n node.noResize = true;\r\n this._prepareDragDropByNode(node); // init DD if need be, and adjust\r\n });\r\n return this;\r\n};\r\n/**\r\n * Temporarily disables widgets moving/resizing.\r\n * If you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.\r\n * Note: no-op for static grid\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(false);\r\n * grid.enableResize(false);\r\n */\r\ngridstack_1.GridStack.prototype.disable = function () {\r\n if (this.opts.staticGrid)\r\n return;\r\n this.enableMove(false);\r\n this.enableResize(false); // @ts-ignore\r\n this._triggerEvent('disable');\r\n return this;\r\n};\r\n/**\r\n * Re-enables widgets moving/resizing - see disable().\r\n * Note: no-op for static grid.\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(true);\r\n * grid.enableResize(true);\r\n */\r\ngridstack_1.GridStack.prototype.enable = function () {\r\n if (this.opts.staticGrid)\r\n return;\r\n this.enableMove(true);\r\n this.enableResize(true); // @ts-ignore\r\n this._triggerEvent('enable');\r\n return this;\r\n};\r\n/** Enables/disables widget moving. No-op for static grids. */\r\ngridstack_1.GridStack.prototype.enableMove = function (doEnable) {\r\n if (this.opts.staticGrid)\r\n return this; // can't move a static grid!\r\n this.opts.disableDrag = !doEnable; // FIRST before we update children as grid overrides #1658\r\n this.engine.nodes.forEach(n => this.movable(n.el, doEnable));\r\n return this;\r\n};\r\n/** Enables/disables widget resizing. No-op for static grids. */\r\ngridstack_1.GridStack.prototype.enableResize = function (doEnable) {\r\n if (this.opts.staticGrid)\r\n return this; // can't size a static grid!\r\n this.opts.disableResize = !doEnable; // FIRST before we update children as grid overrides #1658\r\n this.engine.nodes.forEach(n => this.resizable(n.el, doEnable));\r\n return this;\r\n};\r\n//# sourceMappingURL=gridstack-dd.js.map","\"use strict\";\r\n/**\r\n * gridstack-ddi.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.GridStackDDI = void 0;\r\n/**\r\n * Abstract Partial Interface API for drag'n'drop plugin - look at GridStackDD and HTML5 / Jquery implementation versions\r\n */\r\nclass GridStackDDI {\r\n /** call this method to register your plugin instead of the default no-op one */\r\n static registerPlugin(pluginClass) {\r\n GridStackDDI.ddi = new pluginClass();\r\n return GridStackDDI.ddi;\r\n }\r\n /** get the current registered plugin to use */\r\n static get() {\r\n return GridStackDDI.ddi || GridStackDDI.registerPlugin(GridStackDDI);\r\n }\r\n /** removes any drag&drop present (called during destroy) */\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n remove(el) {\r\n return this; // no-op for static grids\r\n }\r\n}\r\nexports.GridStackDDI = GridStackDDI;\r\n//# sourceMappingURL=gridstack-ddi.js.map","\"use strict\";\r\n/**\r\n * gridstack-engine.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.GridStackEngine = void 0;\r\nconst utils_1 = require(\"./utils\");\r\n/**\r\n * Defines the GridStack engine that does most no DOM grid manipulation.\r\n * See GridStack methods and vars for descriptions.\r\n *\r\n * NOTE: values should not be modified directly - call the main GridStack API instead\r\n */\r\nclass GridStackEngine {\r\n constructor(opts = {}) {\r\n this.addedNodes = [];\r\n this.removedNodes = [];\r\n this.column = opts.column || 12;\r\n this.onChange = opts.onChange;\r\n this._float = opts.float;\r\n this.maxRow = opts.maxRow;\r\n this.nodes = opts.nodes || [];\r\n }\r\n batchUpdate() {\r\n if (this.batchMode)\r\n return this;\r\n this.batchMode = true;\r\n this._prevFloat = this._float;\r\n this._float = true; // let things go anywhere for now... commit() will restore and possibly reposition\r\n this.saveInitial(); // since begin update (which is called multiple times) won't do this\r\n return this;\r\n }\r\n commit() {\r\n if (!this.batchMode)\r\n return this;\r\n this.batchMode = false;\r\n this._float = this._prevFloat;\r\n delete this._prevFloat;\r\n return this._packNodes()\r\n ._notify();\r\n }\r\n // use entire row for hitting area (will use bottom reverse sorted first) if we not actively moving DOWN and didn't already skip\r\n _useEntireRowArea(node, nn) {\r\n return !this.float && !this._hasLocked && (!node._moving || node._skipDown || nn.y <= node.y);\r\n }\r\n /** @internal fix collision on given 'node', going to given new location 'nn', with optional 'collide' node already found.\r\n * return true if we moved. */\r\n _fixCollisions(node, nn = node, collide, opt = {}) {\r\n this._sortNodes(-1); // from last to first, so recursive collision move items in the right order\r\n collide = collide || this.collide(node, nn); // REAL area collide for swap and skip if none...\r\n if (!collide)\r\n return false;\r\n // swap check: if we're actively moving in gravity mode, see if we collide with an object the same size\r\n if (node._moving && !opt.nested && !this.float) {\r\n if (this.swap(node, collide))\r\n return true;\r\n }\r\n // during while() collisions MAKE SURE to check entire row so larger items don't leap frog small ones (push them all down starting last in grid)\r\n let area = nn;\r\n if (this._useEntireRowArea(node, nn)) {\r\n area = { x: 0, w: this.column, y: nn.y, h: nn.h };\r\n collide = this.collide(node, area, opt.skip); // force new hit\r\n }\r\n let didMove = false;\r\n let newOpt = { nested: true, pack: false };\r\n while (collide = collide || this.collide(node, area, opt.skip)) { // could collide with more than 1 item... so repeat for each\r\n let moved;\r\n // if colliding with a locked item OR moving down with top gravity (and collide could move up) -> skip past the collide,\r\n // but remember that skip down so we only do this once (and push others otherwise).\r\n if (collide.locked || node._moving && !node._skipDown && nn.y > node.y && !this.float &&\r\n // can take space we had, or before where we're going\r\n (!this.collide(collide, Object.assign(Object.assign({}, collide), { y: node.y }), node) || !this.collide(collide, Object.assign(Object.assign({}, collide), { y: nn.y - collide.h }), node))) {\r\n node._skipDown = (node._skipDown || nn.y > node.y);\r\n moved = this.moveNode(node, Object.assign(Object.assign(Object.assign({}, nn), { y: collide.y + collide.h }), newOpt));\r\n if (collide.locked && moved) {\r\n utils_1.Utils.copyPos(nn, node); // moving after lock become our new desired location\r\n }\r\n else if (!collide.locked && moved && opt.pack) {\r\n // we moved after and will pack: do it now and keep the original drop location, but past the old collide to see what else we might push way\r\n this._packNodes();\r\n nn.y = collide.y + collide.h;\r\n utils_1.Utils.copyPos(node, nn);\r\n }\r\n didMove = didMove || moved;\r\n }\r\n else {\r\n // move collide down *after* where we will be, ignoring where we are now (don't collide with us)\r\n moved = this.moveNode(collide, Object.assign(Object.assign(Object.assign({}, collide), { y: nn.y + nn.h, skip: node }), newOpt));\r\n }\r\n if (!moved) {\r\n return didMove;\r\n } // break inf loop if we couldn't move after all (ex: maxRow, fixed)\r\n collide = undefined;\r\n }\r\n return didMove;\r\n }\r\n /** return the nodes that intercept the given node. Optionally a different area can be used, as well as a second node to skip */\r\n collide(skip, area = skip, skip2) {\r\n return this.nodes.find(n => n !== skip && n !== skip2 && utils_1.Utils.isIntercepted(n, area));\r\n }\r\n collideAll(skip, area = skip, skip2) {\r\n return this.nodes.filter(n => n !== skip && n !== skip2 && utils_1.Utils.isIntercepted(n, area));\r\n }\r\n /** does a pixel coverage collision, returning the node that has the most coverage that is >50% mid line */\r\n collideCoverage(node, o, collides) {\r\n if (!o.rect || !node._rect)\r\n return;\r\n let r0 = node._rect; // where started\r\n let r = Object.assign({}, o.rect); // where we are\r\n // update dragged rect to show where it's coming from (above or below, etc...)\r\n if (r.y > r0.y) {\r\n r.h += r.y - r0.y;\r\n r.y = r0.y;\r\n }\r\n else {\r\n r.h += r0.y - r.y;\r\n }\r\n if (r.x > r0.x) {\r\n r.w += r.x - r0.x;\r\n r.x = r0.x;\r\n }\r\n else {\r\n r.w += r0.x - r.x;\r\n }\r\n let collide;\r\n collides.forEach(n => {\r\n if (n.locked || !n._rect)\r\n return;\r\n let r2 = n._rect; // overlapping target\r\n let yOver = Number.MAX_VALUE, xOver = Number.MAX_VALUE, overMax = 0.5; // need >50%\r\n // depending on which side we started from, compute the overlap % of coverage\r\n // (ex: from above/below we only compute the max horizontal line coverage)\r\n if (r0.y < r2.y) { // from above\r\n yOver = ((r.y + r.h) - r2.y) / r2.h;\r\n }\r\n else if (r0.y + r0.h > r2.y + r2.h) { // from below\r\n yOver = ((r2.y + r2.h) - r.y) / r2.h;\r\n }\r\n if (r0.x < r2.x) { // from the left\r\n xOver = ((r.x + r.w) - r2.x) / r2.w;\r\n }\r\n else if (r0.x + r0.w > r2.x + r2.w) { // from the right\r\n xOver = ((r2.x + r2.w) - r.x) / r2.w;\r\n }\r\n let over = Math.min(xOver, yOver);\r\n if (over > overMax) {\r\n overMax = over;\r\n collide = n;\r\n }\r\n });\r\n return collide;\r\n }\r\n /** called to cache the nodes pixel rectangles used for collision detection during drag */\r\n cacheRects(w, h, top, right, bottom, left) {\r\n this.nodes.forEach(n => n._rect = {\r\n y: n.y * h + top,\r\n x: n.x * w + left,\r\n w: n.w * w - left - right,\r\n h: n.h * h - top - bottom\r\n });\r\n return this;\r\n }\r\n /** called to possibly swap between 2 nodes (same size or column, not locked, touching), returning true if successful */\r\n swap(a, b) {\r\n if (!b || b.locked || !a || a.locked)\r\n return false;\r\n function _doSwap() {\r\n let x = b.x, y = b.y;\r\n b.x = a.x;\r\n b.y = a.y; // b -> a position\r\n if (a.h != b.h) {\r\n a.x = x;\r\n a.y = b.y + b.h; // a -> goes after b\r\n }\r\n else if (a.w != b.w) {\r\n a.x = b.x + b.w;\r\n a.y = y; // a -> goes after b\r\n }\r\n else {\r\n a.x = x;\r\n a.y = y; // a -> old b position\r\n }\r\n a._dirty = b._dirty = true;\r\n return true;\r\n }\r\n let touching; // remember if we called it (vs undefined)\r\n // same size and same row or column, and touching\r\n if (a.w === b.w && a.h === b.h && (a.x === b.x || a.y === b.y) && (touching = utils_1.Utils.isTouching(a, b)))\r\n return _doSwap();\r\n if (touching === false)\r\n return; // IFF ran test and fail, bail out\r\n // check for taking same columns (but different height) and touching\r\n if (a.w === b.w && a.x === b.x && (touching || (touching = utils_1.Utils.isTouching(a, b)))) {\r\n if (b.y < a.y) {\r\n let t = a;\r\n a = b;\r\n b = t;\r\n } // swap a <-> b vars so a is first\r\n return _doSwap();\r\n }\r\n if (touching === false)\r\n return;\r\n // check if taking same row (but different width) and touching\r\n if (a.h === b.h && a.y === b.y && (touching || (touching = utils_1.Utils.isTouching(a, b)))) {\r\n if (b.x < a.x) {\r\n let t = a;\r\n a = b;\r\n b = t;\r\n } // swap a <-> b vars so a is first\r\n return _doSwap();\r\n }\r\n return false;\r\n }\r\n isAreaEmpty(x, y, w, h) {\r\n let nn = { x: x || 0, y: y || 0, w: w || 1, h: h || 1 };\r\n return !this.collide(nn);\r\n }\r\n /** re-layout grid items to reclaim any empty space */\r\n compact() {\r\n if (this.nodes.length === 0)\r\n return this;\r\n this.batchUpdate()\r\n ._sortNodes();\r\n let copyNodes = this.nodes;\r\n this.nodes = []; // pretend we have no nodes to conflict layout to start with...\r\n copyNodes.forEach(node => {\r\n if (!node.locked) {\r\n node.autoPosition = true;\r\n }\r\n this.addNode(node, false); // 'false' for add event trigger\r\n node._dirty = true; // will force attr update\r\n });\r\n return this.commit();\r\n }\r\n /** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */\r\n set float(val) {\r\n if (this._float === val)\r\n return;\r\n this._float = val || false;\r\n if (!val) {\r\n this._packNodes()._notify();\r\n }\r\n }\r\n /** float getter method */\r\n get float() { return this._float || false; }\r\n /** @internal */\r\n _sortNodes(dir) {\r\n this.nodes = utils_1.Utils.sort(this.nodes, dir, this.column);\r\n return this;\r\n }\r\n /** @internal called to top gravity pack the items back OR revert back to original Y positions when floating */\r\n _packNodes() {\r\n if (this.batchMode) {\r\n return this;\r\n }\r\n this._sortNodes(); // first to last\r\n if (this.float) {\r\n // restore original Y pos\r\n this.nodes.forEach(n => {\r\n if (n._updating || n._orig === undefined || n.y === n._orig.y)\r\n return;\r\n let newY = n.y;\r\n while (newY > n._orig.y) {\r\n --newY;\r\n let collide = this.collide(n, { x: n.x, y: newY, w: n.w, h: n.h });\r\n if (!collide) {\r\n n._dirty = true;\r\n n.y = newY;\r\n }\r\n }\r\n });\r\n }\r\n else {\r\n // top gravity pack\r\n this.nodes.forEach((n, i) => {\r\n if (n.locked)\r\n return;\r\n while (n.y > 0) {\r\n let newY = i === 0 ? 0 : n.y - 1;\r\n let canBeMoved = i === 0 || !this.collide(n, { x: n.x, y: newY, w: n.w, h: n.h });\r\n if (!canBeMoved)\r\n break;\r\n // Note: must be dirty (from last position) for GridStack::OnChange CB to update positions\r\n // and move items back. The user 'change' CB should detect changes from the original\r\n // starting position instead.\r\n n._dirty = (n.y !== newY);\r\n n.y = newY;\r\n }\r\n });\r\n }\r\n return this;\r\n }\r\n /**\r\n * given a random node, makes sure it's coordinates/values are valid in the current grid\r\n * @param node to adjust\r\n * @param resizing if out of bound, resize down or move into the grid to fit ?\r\n */\r\n prepareNode(node, resizing) {\r\n node = node || {};\r\n node._id = node._id || GridStackEngine._idSeq++;\r\n // if we're missing position, have the grid position us automatically (before we set them to 0,0)\r\n if (node.x === undefined || node.y === undefined || node.x === null || node.y === null) {\r\n node.autoPosition = true;\r\n }\r\n // assign defaults for missing required fields\r\n let defaults = { x: 0, y: 0, w: 1, h: 1 };\r\n utils_1.Utils.defaults(node, defaults);\r\n if (!node.autoPosition) {\r\n delete node.autoPosition;\r\n }\r\n if (!node.noResize) {\r\n delete node.noResize;\r\n }\r\n if (!node.noMove) {\r\n delete node.noMove;\r\n }\r\n // check for NaN (in case messed up strings were passed. can't do parseInt() || defaults.x above as 0 is valid #)\r\n if (typeof node.x == 'string') {\r\n node.x = Number(node.x);\r\n }\r\n if (typeof node.y == 'string') {\r\n node.y = Number(node.y);\r\n }\r\n if (typeof node.w == 'string') {\r\n node.w = Number(node.w);\r\n }\r\n if (typeof node.h == 'string') {\r\n node.h = Number(node.h);\r\n }\r\n if (isNaN(node.x)) {\r\n node.x = defaults.x;\r\n node.autoPosition = true;\r\n }\r\n if (isNaN(node.y)) {\r\n node.y = defaults.y;\r\n node.autoPosition = true;\r\n }\r\n if (isNaN(node.w)) {\r\n node.w = defaults.w;\r\n }\r\n if (isNaN(node.h)) {\r\n node.h = defaults.h;\r\n }\r\n return this.nodeBoundFix(node, resizing);\r\n }\r\n /** part2 of preparing a node to fit inside our grid - checks for x,y from grid dimensions */\r\n nodeBoundFix(node, resizing) {\r\n let before = node._orig || utils_1.Utils.copyPos({}, node);\r\n if (node.maxW) {\r\n node.w = Math.min(node.w, node.maxW);\r\n }\r\n if (node.maxH) {\r\n node.h = Math.min(node.h, node.maxH);\r\n }\r\n if (node.minW && node.minW <= this.column) {\r\n node.w = Math.max(node.w, node.minW);\r\n }\r\n if (node.minH) {\r\n node.h = Math.max(node.h, node.minH);\r\n }\r\n if (node.w > this.column) {\r\n // if user loaded a larger than allowed widget for current # of columns,\r\n // remember it's full width so we can restore back (1 -> 12 column) #1655\r\n // IFF we're not in the middle of column resizing!\r\n if (this.column < 12 && !this._inColumnResize) {\r\n node.w = Math.min(12, node.w);\r\n this.cacheOneLayout(node, 12);\r\n }\r\n node.w = this.column;\r\n }\r\n else if (node.w < 1) {\r\n node.w = 1;\r\n }\r\n if (this.maxRow && node.h > this.maxRow) {\r\n node.h = this.maxRow;\r\n }\r\n else if (node.h < 1) {\r\n node.h = 1;\r\n }\r\n if (node.x < 0) {\r\n node.x = 0;\r\n }\r\n if (node.y < 0) {\r\n node.y = 0;\r\n }\r\n if (node.x + node.w > this.column) {\r\n if (resizing) {\r\n node.w = this.column - node.x;\r\n }\r\n else {\r\n node.x = this.column - node.w;\r\n }\r\n }\r\n if (this.maxRow && node.y + node.h > this.maxRow) {\r\n if (resizing) {\r\n node.h = this.maxRow - node.y;\r\n }\r\n else {\r\n node.y = this.maxRow - node.h;\r\n }\r\n }\r\n if (!utils_1.Utils.samePos(node, before)) {\r\n node._dirty = true;\r\n }\r\n return node;\r\n }\r\n getDirtyNodes(verify) {\r\n // compare original x,y,w,h instead as _dirty can be a temporary state\r\n if (verify) {\r\n return this.nodes.filter(n => n._dirty && !utils_1.Utils.samePos(n, n._orig));\r\n }\r\n return this.nodes.filter(n => n._dirty);\r\n }\r\n /** @internal call this to call onChange CB with dirty nodes */\r\n _notify(nodes, removeDOM = true) {\r\n if (this.batchMode)\r\n return this;\r\n nodes = (nodes === undefined ? [] : (Array.isArray(nodes) ? nodes : [nodes]));\r\n let dirtyNodes = nodes.concat(this.getDirtyNodes());\r\n this.onChange && this.onChange(dirtyNodes, removeDOM);\r\n return this;\r\n }\r\n /** @internal remove dirty and last tried info */\r\n cleanNodes() {\r\n if (this.batchMode)\r\n return this;\r\n this.nodes.forEach(n => {\r\n delete n._dirty;\r\n delete n._lastTried;\r\n });\r\n return this;\r\n }\r\n /** @internal called to save initial position/size to track real dirty state.\r\n * Note: should be called right after we call change event (so next API is can detect changes)\r\n * as well as right before we start move/resize/enter (so we can restore items to prev values) */\r\n saveInitial() {\r\n this.nodes.forEach(n => {\r\n n._orig = utils_1.Utils.copyPos({}, n);\r\n delete n._dirty;\r\n });\r\n this._hasLocked = this.nodes.some(n => n.locked);\r\n return this;\r\n }\r\n /** @internal restore all the nodes back to initial values (called when we leave) */\r\n restoreInitial() {\r\n this.nodes.forEach(n => {\r\n if (utils_1.Utils.samePos(n, n._orig))\r\n return;\r\n utils_1.Utils.copyPos(n, n._orig);\r\n n._dirty = true;\r\n });\r\n this._notify();\r\n return this;\r\n }\r\n /** call to add the given node to our list, fixing collision and re-packing */\r\n addNode(node, triggerAddEvent = false) {\r\n let dup = this.nodes.find(n => n._id === node._id);\r\n if (dup)\r\n return dup; // prevent inserting twice! return it instead.\r\n // skip prepareNode if we're in middle of column resize (not new) but do check for bounds!\r\n node = this._inColumnResize ? this.nodeBoundFix(node) : this.prepareNode(node);\r\n delete node._temporaryRemoved;\r\n delete node._removeDOM;\r\n if (node.autoPosition) {\r\n this._sortNodes();\r\n for (let i = 0;; ++i) {\r\n let x = i % this.column;\r\n let y = Math.floor(i / this.column);\r\n if (x + node.w > this.column) {\r\n continue;\r\n }\r\n let box = { x, y, w: node.w, h: node.h };\r\n if (!this.nodes.find(n => utils_1.Utils.isIntercepted(box, n))) {\r\n node.x = x;\r\n node.y = y;\r\n delete node.autoPosition; // found our slot\r\n break;\r\n }\r\n }\r\n }\r\n this.nodes.push(node);\r\n if (triggerAddEvent) {\r\n this.addedNodes.push(node);\r\n }\r\n this._fixCollisions(node);\r\n if (!this.batchMode) {\r\n this._packNodes()._notify();\r\n }\r\n return node;\r\n }\r\n removeNode(node, removeDOM = true, triggerEvent = false) {\r\n if (!this.nodes.find(n => n === node)) {\r\n // TEST console.log(`Error: GridStackEngine.removeNode() node._id=${node._id} not found!`)\r\n return this;\r\n }\r\n if (triggerEvent) { // we wait until final drop to manually track removed items (rather than during drag)\r\n this.removedNodes.push(node);\r\n }\r\n if (removeDOM)\r\n node._removeDOM = true; // let CB remove actual HTML (used to set _id to null, but then we loose layout info)\r\n // don't use 'faster' .splice(findIndex(),1) in case node isn't in our list, or in multiple times.\r\n this.nodes = this.nodes.filter(n => n !== node);\r\n return this._packNodes()\r\n ._notify(node);\r\n }\r\n removeAll(removeDOM = true) {\r\n delete this._layouts;\r\n if (this.nodes.length === 0)\r\n return this;\r\n removeDOM && this.nodes.forEach(n => n._removeDOM = true); // let CB remove actual HTML (used to set _id to null, but then we loose layout info)\r\n this.removedNodes = this.nodes;\r\n this.nodes = [];\r\n return this._notify(this.removedNodes);\r\n }\r\n /** checks if item can be moved (layout constrain) vs moveNode(), returning true if was able to move.\r\n * In more complicated cases (maxRow) it will attempt at moving the item and fixing\r\n * others in a clone first, then apply those changes if still within specs. */\r\n moveNodeCheck(node, o) {\r\n // if (node.locked) return false;\r\n if (!this.changedPosConstrain(node, o))\r\n return false;\r\n o.pack = true;\r\n // simpler case: move item directly...\r\n if (!this.maxRow /* && !this._hasLocked*/) {\r\n return this.moveNode(node, o);\r\n }\r\n // complex case: create a clone with NO maxRow (will check for out of bounds at the end)\r\n let clonedNode;\r\n let clone = new GridStackEngine({\r\n column: this.column,\r\n float: this.float,\r\n nodes: this.nodes.map(n => {\r\n if (n === node) {\r\n clonedNode = Object.assign({}, n);\r\n return clonedNode;\r\n }\r\n return Object.assign({}, n);\r\n })\r\n });\r\n if (!clonedNode)\r\n return false;\r\n let canMove = clone.moveNode(clonedNode, o);\r\n // if maxRow make sure we are still valid size\r\n if (this.maxRow && canMove) {\r\n canMove = (clone.getRow() <= this.maxRow);\r\n // turns out we can't grow, then see if we can swap instead (ex: full grid) if we're not resizing\r\n if (!canMove && !o.resizing) {\r\n let collide = this.collide(node, o);\r\n if (collide && this.swap(node, collide)) {\r\n this._notify();\r\n return true;\r\n }\r\n }\r\n }\r\n if (!canMove)\r\n return false;\r\n // if clone was able to move, copy those mods over to us now instead of caller trying to do this all over!\r\n // Note: we can't use the list directly as elements and other parts point to actual node, so copy content\r\n clone.nodes.filter(n => n._dirty).forEach(c => {\r\n let n = this.nodes.find(a => a._id === c._id);\r\n if (!n)\r\n return;\r\n utils_1.Utils.copyPos(n, c);\r\n n._dirty = true;\r\n });\r\n this._notify();\r\n return true;\r\n }\r\n /** return true if can fit in grid height constrain only (always true if no maxRow) */\r\n willItFit(node) {\r\n delete node._willFitPos;\r\n if (!this.maxRow)\r\n return true;\r\n // create a clone with NO maxRow and check if still within size\r\n let clone = new GridStackEngine({\r\n column: this.column,\r\n float: this.float,\r\n nodes: this.nodes.map(n => { return Object.assign({}, n); })\r\n });\r\n let n = Object.assign({}, node); // clone node so we don't mod any settings on it but have full autoPosition and min/max as well! #1687\r\n this.cleanupNode(n);\r\n delete n.el;\r\n delete n._id;\r\n delete n.content;\r\n delete n.grid;\r\n clone.addNode(n);\r\n if (clone.getRow() <= this.maxRow) {\r\n node._willFitPos = utils_1.Utils.copyPos({}, n);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** true if x,y or w,h are different after clamping to min/max */\r\n changedPosConstrain(node, p) {\r\n // make sure w,h are set\r\n p.w = p.w || node.w;\r\n p.h = p.h || node.h;\r\n if (node.x !== p.x || node.y !== p.y)\r\n return true;\r\n // check constrained w,h\r\n if (node.maxW) {\r\n p.w = Math.min(p.w, node.maxW);\r\n }\r\n if (node.maxH) {\r\n p.h = Math.min(p.h, node.maxH);\r\n }\r\n if (node.minW) {\r\n p.w = Math.max(p.w, node.minW);\r\n }\r\n if (node.minH) {\r\n p.h = Math.max(p.h, node.minH);\r\n }\r\n return (node.w !== p.w || node.h !== p.h);\r\n }\r\n /** return true if the passed in node was actually moved (checks for no-op and locked) */\r\n moveNode(node, o) {\r\n if (!node || /*node.locked ||*/ !o)\r\n return false;\r\n if (o.pack === undefined)\r\n o.pack = true;\r\n // constrain the passed in values and check if we're still changing our node\r\n if (typeof o.x !== 'number') {\r\n o.x = node.x;\r\n }\r\n if (typeof o.y !== 'number') {\r\n o.y = node.y;\r\n }\r\n if (typeof o.w !== 'number') {\r\n o.w = node.w;\r\n }\r\n if (typeof o.h !== 'number') {\r\n o.h = node.h;\r\n }\r\n let resizing = (node.w !== o.w || node.h !== o.h);\r\n let nn = utils_1.Utils.copyPos({}, node, true); // get min/max out first, then opt positions next\r\n utils_1.Utils.copyPos(nn, o);\r\n nn = this.nodeBoundFix(nn, resizing);\r\n utils_1.Utils.copyPos(o, nn);\r\n if (utils_1.Utils.samePos(node, o))\r\n return false;\r\n let prevPos = utils_1.Utils.copyPos({}, node);\r\n // during while() collisions make sure to check entire row so larger items don't leap frog small ones (push them all down)\r\n let area = nn;\r\n // if (this._useEntireRowArea(node, nn)) {\r\n // area = {x: 0, w: this.column, y: nn.y, h: nn.h};\r\n // }\r\n // check if we will need to fix collision at our new location\r\n let collides = this.collideAll(node, area, o.skip);\r\n let needToMove = true;\r\n if (collides.length) {\r\n // now check to make sure we actually collided over 50% surface area while dragging\r\n let collide = node._moving && !o.nested ? this.collideCoverage(node, o, collides) : collides[0];\r\n if (collide) {\r\n needToMove = !this._fixCollisions(node, nn, collide, o); // check if already moved...\r\n }\r\n else {\r\n needToMove = false; // we didn't cover >50% for a move, skip...\r\n }\r\n }\r\n // now move (to the original ask vs the collision version which might differ) and repack things\r\n if (needToMove) {\r\n node._dirty = true;\r\n utils_1.Utils.copyPos(node, nn);\r\n }\r\n if (o.pack) {\r\n this._packNodes()\r\n ._notify();\r\n }\r\n return !utils_1.Utils.samePos(node, prevPos); // pack might have moved things back\r\n }\r\n getRow() {\r\n return this.nodes.reduce((row, n) => Math.max(row, n.y + n.h), 0);\r\n }\r\n beginUpdate(node) {\r\n if (!node._updating) {\r\n node._updating = true;\r\n delete node._skipDown;\r\n if (!this.batchMode)\r\n this.saveInitial();\r\n }\r\n return this;\r\n }\r\n endUpdate() {\r\n let n = this.nodes.find(n => n._updating);\r\n if (n) {\r\n delete n._updating;\r\n delete n._skipDown;\r\n }\r\n return this;\r\n }\r\n /** saves a copy of the largest column layout (eg 12 even when rendering oneColumnMode, so we don't loose orig layout),\r\n * returning a list of widgets for serialization */\r\n save(saveElement = true) {\r\n var _a;\r\n // use the highest layout for any saved info so we can have full detail on reload #1849\r\n let len = (_a = this._layouts) === null || _a === void 0 ? void 0 : _a.length;\r\n let layout = len && this.column !== (len - 1) ? this._layouts[len - 1] : null;\r\n let list = [];\r\n this._sortNodes();\r\n this.nodes.forEach(n => {\r\n let wl = layout === null || layout === void 0 ? void 0 : layout.find(l => l._id === n._id);\r\n let w = Object.assign({}, n);\r\n // use layout info instead if set\r\n if (wl) {\r\n w.x = wl.x;\r\n w.y = wl.y;\r\n w.w = wl.w;\r\n }\r\n // delete internals\r\n for (let key in w) {\r\n if (key[0] === '_' || w[key] === null || w[key] === undefined)\r\n delete w[key];\r\n }\r\n delete w.grid;\r\n if (!saveElement)\r\n delete w.el;\r\n // delete default values (will be re-created on read)\r\n if (!w.autoPosition)\r\n delete w.autoPosition;\r\n if (!w.noResize)\r\n delete w.noResize;\r\n if (!w.noMove)\r\n delete w.noMove;\r\n if (!w.locked)\r\n delete w.locked;\r\n list.push(w);\r\n });\r\n return list;\r\n }\r\n /** @internal called whenever a node is added or moved - updates the cached layouts */\r\n layoutsNodesChange(nodes) {\r\n if (!this._layouts || this._inColumnResize)\r\n return this;\r\n // remove smaller layouts - we will re-generate those on the fly... larger ones need to update\r\n this._layouts.forEach((layout, column) => {\r\n if (!layout || column === this.column)\r\n return this;\r\n if (column < this.column) {\r\n this._layouts[column] = undefined;\r\n }\r\n else {\r\n // we save the original x,y,w (h isn't cached) to see what actually changed to propagate better.\r\n // NOTE: we don't need to check against out of bound scaling/moving as that will be done when using those cache values. #1785\r\n let ratio = column / this.column;\r\n nodes.forEach(node => {\r\n if (!node._orig)\r\n return; // didn't change (newly added ?)\r\n let n = layout.find(l => l._id === node._id);\r\n if (!n)\r\n return; // no cache for new nodes. Will use those values.\r\n // Y changed, push down same amount\r\n // TODO: detect doing item 'swaps' will help instead of move (especially in 1 column mode)\r\n if (node.y !== node._orig.y) {\r\n n.y += (node.y - node._orig.y);\r\n }\r\n // X changed, scale from new position\r\n if (node.x !== node._orig.x) {\r\n n.x = Math.round(node.x * ratio);\r\n }\r\n // width changed, scale from new width\r\n if (node.w !== node._orig.w) {\r\n n.w = Math.round(node.w * ratio);\r\n }\r\n // ...height always carries over from cache\r\n });\r\n }\r\n });\r\n return this;\r\n }\r\n /**\r\n * @internal Called to scale the widget width & position up/down based on the column change.\r\n * Note we store previous layouts (especially original ones) to make it possible to go\r\n * from say 12 -> 1 -> 12 and get back to where we were.\r\n *\r\n * @param prevColumn previous number of columns\r\n * @param column new column number\r\n * @param nodes different sorted list (ex: DOM order) instead of current list\r\n * @param layout specify the type of re-layout that will happen (position, size, etc...).\r\n * Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column\r\n */\r\n updateNodeWidths(prevColumn, column, nodes, layout = 'moveScale') {\r\n var _a;\r\n if (!this.nodes.length || !column || prevColumn === column)\r\n return this;\r\n // cache the current layout in case they want to go back (like 12 -> 1 -> 12) as it requires original data\r\n this.cacheLayout(this.nodes, prevColumn);\r\n this.batchUpdate(); // do this EARLY as it will call saveInitial() so we can detect where we started for _dirty and collision\r\n let newNodes = [];\r\n // if we're going to 1 column and using DOM order rather than default sorting, then generate that layout\r\n let domOrder = false;\r\n if (column === 1 && (nodes === null || nodes === void 0 ? void 0 : nodes.length)) {\r\n domOrder = true;\r\n let top = 0;\r\n nodes.forEach(n => {\r\n n.x = 0;\r\n n.w = 1;\r\n n.y = Math.max(n.y, top);\r\n top = n.y + n.h;\r\n });\r\n newNodes = nodes;\r\n nodes = [];\r\n }\r\n else {\r\n nodes = utils_1.Utils.sort(this.nodes, -1, prevColumn); // current column reverse sorting so we can insert last to front (limit collision)\r\n }\r\n // see if we have cached previous layout IFF we are going up in size (restore) otherwise always\r\n // generate next size down from where we are (looks more natural as you gradually size down).\r\n let cacheNodes = [];\r\n if (column > prevColumn) {\r\n cacheNodes = this._layouts[column] || [];\r\n // ...if not, start with the largest layout (if not already there) as down-scaling is more accurate\r\n // by pretending we came from that larger column by assigning those values as starting point\r\n let lastIndex = this._layouts.length - 1;\r\n if (!cacheNodes.length && prevColumn !== lastIndex && ((_a = this._layouts[lastIndex]) === null || _a === void 0 ? void 0 : _a.length)) {\r\n prevColumn = lastIndex;\r\n this._layouts[lastIndex].forEach(cacheNode => {\r\n let n = nodes.find(n => n._id === cacheNode._id);\r\n if (n) {\r\n // still current, use cache info positions\r\n n.x = cacheNode.x;\r\n n.y = cacheNode.y;\r\n n.w = cacheNode.w;\r\n }\r\n });\r\n }\r\n }\r\n // if we found cache re-use those nodes that are still current\r\n cacheNodes.forEach(cacheNode => {\r\n let j = nodes.findIndex(n => n._id === cacheNode._id);\r\n if (j !== -1) {\r\n // still current, use cache info positions\r\n nodes[j].x = cacheNode.x;\r\n nodes[j].y = cacheNode.y;\r\n nodes[j].w = cacheNode.w;\r\n newNodes.push(nodes[j]);\r\n nodes.splice(j, 1);\r\n }\r\n });\r\n // ...and add any extra non-cached ones\r\n if (nodes.length) {\r\n if (typeof layout === 'function') {\r\n layout(column, prevColumn, newNodes, nodes);\r\n }\r\n else if (!domOrder) {\r\n let ratio = column / prevColumn;\r\n let move = (layout === 'move' || layout === 'moveScale');\r\n let scale = (layout === 'scale' || layout === 'moveScale');\r\n nodes.forEach(node => {\r\n // NOTE: x + w could be outside of the grid, but addNode() below will handle that\r\n node.x = (column === 1 ? 0 : (move ? Math.round(node.x * ratio) : Math.min(node.x, column - 1)));\r\n node.w = ((column === 1 || prevColumn === 1) ? 1 :\r\n scale ? (Math.round(node.w * ratio) || 1) : (Math.min(node.w, column)));\r\n newNodes.push(node);\r\n });\r\n nodes = [];\r\n }\r\n }\r\n // finally re-layout them in reverse order (to get correct placement)\r\n newNodes = utils_1.Utils.sort(newNodes, -1, column);\r\n this._inColumnResize = true; // prevent cache update\r\n this.nodes = []; // pretend we have no nodes to start with (add() will use same structures) to simplify layout\r\n newNodes.forEach(node => {\r\n this.addNode(node, false); // 'false' for add event trigger\r\n delete node._orig; // make sure the commit doesn't try to restore things back to original\r\n });\r\n this.commit();\r\n delete this._inColumnResize;\r\n return this;\r\n }\r\n /**\r\n * call to cache the given layout internally to the given location so we can restore back when column changes size\r\n * @param nodes list of nodes\r\n * @param column corresponding column index to save it under\r\n * @param clear if true, will force other caches to be removed (default false)\r\n */\r\n cacheLayout(nodes, column, clear = false) {\r\n let copy = [];\r\n nodes.forEach((n, i) => {\r\n n._id = n._id || GridStackEngine._idSeq++; // make sure we have an id in case this is new layout, else re-use id already set\r\n copy[i] = { x: n.x, y: n.y, w: n.w, _id: n._id }; // only thing we change is x,y,w and id to find it back\r\n });\r\n this._layouts = clear ? [] : this._layouts || []; // use array to find larger quick\r\n this._layouts[column] = copy;\r\n return this;\r\n }\r\n /**\r\n * call to cache the given node layout internally to the given location so we can restore back when column changes size\r\n * @param node single node to cache\r\n * @param column corresponding column index to save it under\r\n */\r\n cacheOneLayout(n, column) {\r\n n._id = n._id || GridStackEngine._idSeq++;\r\n let layout = { x: n.x, y: n.y, w: n.w, _id: n._id };\r\n this._layouts = this._layouts || [];\r\n this._layouts[column] = this._layouts[column] || [];\r\n let index = this._layouts[column].findIndex(l => l._id === n._id);\r\n index === -1 ? this._layouts[column].push(layout) : this._layouts[column][index] = layout;\r\n return this;\r\n }\r\n /** called to remove all internal values but the _id */\r\n cleanupNode(node) {\r\n for (let prop in node) {\r\n if (prop[0] === '_' && prop !== '_id')\r\n delete node[prop];\r\n }\r\n return this;\r\n }\r\n}\r\nexports.GridStackEngine = GridStackEngine;\r\n/** @internal unique global internal _id counter NOT starting at 0 */\r\nGridStackEngine._idSeq = 1;\r\n//# sourceMappingURL=gridstack-engine.js.map","\"use strict\";\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.GridStack = void 0;\r\n/*!\r\n * GridStack 5.0\r\n * https://gridstackjs.com/\r\n *\r\n * Copyright (c) 2021 Alain Dumesny\r\n * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE\r\n */\r\nconst gridstack_engine_1 = require(\"./gridstack-engine\");\r\nconst utils_1 = require(\"./utils\");\r\nconst gridstack_ddi_1 = require(\"./gridstack-ddi\");\r\n// export all dependent file as well to make it easier for users to just import the main file\r\n__exportStar(require(\"./types\"), exports);\r\n__exportStar(require(\"./utils\"), exports);\r\n__exportStar(require(\"./gridstack-engine\"), exports);\r\n__exportStar(require(\"./gridstack-ddi\"), exports);\r\n// default values for grid options - used during init and when saving out\r\nconst GridDefaults = {\r\n column: 12,\r\n minRow: 0,\r\n maxRow: 0,\r\n itemClass: 'grid-stack-item',\r\n placeholderClass: 'grid-stack-placeholder',\r\n placeholderText: '',\r\n handle: '.grid-stack-item-content',\r\n handleClass: null,\r\n styleInHead: false,\r\n cellHeight: 'auto',\r\n cellHeightThrottle: 100,\r\n margin: 10,\r\n auto: true,\r\n minWidth: 768,\r\n float: false,\r\n staticGrid: false,\r\n animate: true,\r\n alwaysShowResizeHandle: false,\r\n resizable: {\r\n autoHide: true,\r\n handles: 'se'\r\n },\r\n draggable: {\r\n handle: '.grid-stack-item-content',\r\n scroll: false,\r\n appendTo: 'body'\r\n },\r\n disableDrag: false,\r\n disableResize: false,\r\n rtl: 'auto',\r\n removable: false,\r\n removableOptions: {\r\n accept: '.grid-stack-item'\r\n },\r\n marginUnit: 'px',\r\n cellHeightUnit: 'px',\r\n disableOneColumnMode: false,\r\n oneColumnModeDomSort: false\r\n};\r\n/**\r\n * Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.\r\n * Note: your grid elements MUST have the following classes for the CSS layout to work:\r\n * @example\r\n * <div class=\"grid-stack\">\r\n * <div class=\"grid-stack-item\">\r\n * <div class=\"grid-stack-item-content\">Item 1</div>\r\n * </div>\r\n * </div>\r\n */\r\nclass GridStack {\r\n /**\r\n * Construct a grid item from the given element and options\r\n * @param el\r\n * @param opts\r\n */\r\n constructor(el, opts = {}) {\r\n /** @internal */\r\n this._gsEventHandler = {};\r\n /** @internal extra row added when dragging at the bottom of the grid */\r\n this._extraDragRow = 0;\r\n this.el = el; // exposed HTML element to the user\r\n opts = opts || {}; // handles null/undefined/0\r\n // if row property exists, replace minRow and maxRow instead\r\n if (opts.row) {\r\n opts.minRow = opts.maxRow = opts.row;\r\n delete opts.row;\r\n }\r\n let rowAttr = utils_1.Utils.toNumber(el.getAttribute('gs-row'));\r\n // flag only valid in sub-grids (handled by parent, not here)\r\n if (opts.column === 'auto') {\r\n delete opts.column;\r\n }\r\n // elements attributes override any passed options (like CSS style) - merge the two together\r\n let defaults = Object.assign(Object.assign({}, utils_1.Utils.cloneDeep(GridDefaults)), { column: utils_1.Utils.toNumber(el.getAttribute('gs-column')) || 12, minRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-min-row')) || 0, maxRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-max-row')) || 0, staticGrid: utils_1.Utils.toBool(el.getAttribute('gs-static')) || false, _styleSheetClass: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false, resizable: {\r\n autoHide: !(opts.alwaysShowResizeHandle || false),\r\n handles: 'se'\r\n }, draggable: {\r\n handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || '.grid-stack-item-content',\r\n scroll: false,\r\n appendTo: 'body'\r\n }, removableOptions: {\r\n accept: '.' + (opts.itemClass || 'grid-stack-item')\r\n } });\r\n if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead\r\n defaults.animate = utils_1.Utils.toBool(el.getAttribute('gs-animate'));\r\n }\r\n this.opts = utils_1.Utils.defaults(opts, defaults);\r\n opts = null; // make sure we use this.opts instead\r\n this.initMargin(); // part of settings defaults...\r\n // Now check if we're loading into 1 column mode FIRST so we don't do un-necessary work (like cellHeight = width / 12 then go 1 column)\r\n if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.minWidth) {\r\n this._prevColumn = this.getColumn();\r\n this.opts.column = 1;\r\n }\r\n if (this.opts.rtl === 'auto') {\r\n this.opts.rtl = (el.style.direction === 'rtl');\r\n }\r\n if (this.opts.rtl) {\r\n this.el.classList.add('grid-stack-rtl');\r\n }\r\n // check if we're been nested, and if so update our style and keep pointer around (used during save)\r\n let parentGridItemEl = utils_1.Utils.closestByClass(this.el, GridDefaults.itemClass);\r\n if (parentGridItemEl && parentGridItemEl.gridstackNode) {\r\n this.opts._isNested = parentGridItemEl.gridstackNode;\r\n this.opts._isNested.subGrid = this;\r\n parentGridItemEl.classList.add('grid-stack-nested');\r\n this.el.classList.add('grid-stack-nested');\r\n }\r\n this._isAutoCellHeight = (this.opts.cellHeight === 'auto');\r\n if (this._isAutoCellHeight || this.opts.cellHeight === 'initial') {\r\n // make the cell content square initially (will use resize/column event to keep it square)\r\n this.cellHeight(undefined, false);\r\n }\r\n else {\r\n // append unit if any are set\r\n if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== GridDefaults.cellHeightUnit) {\r\n this.opts.cellHeight = this.opts.cellHeight + this.opts.cellHeightUnit;\r\n delete this.opts.cellHeightUnit;\r\n }\r\n this.cellHeight(this.opts.cellHeight, false);\r\n }\r\n this.el.classList.add(this.opts._styleSheetClass);\r\n this._setStaticClass();\r\n this.engine = new gridstack_engine_1.GridStackEngine({\r\n column: this.getColumn(),\r\n float: this.opts.float,\r\n maxRow: this.opts.maxRow,\r\n onChange: (cbNodes) => {\r\n let maxH = 0;\r\n this.engine.nodes.forEach(n => { maxH = Math.max(maxH, n.y + n.h); });\r\n cbNodes.forEach(n => {\r\n let el = n.el;\r\n if (!el)\r\n return;\r\n if (n._removeDOM) {\r\n if (el)\r\n el.remove();\r\n delete n._removeDOM;\r\n }\r\n else {\r\n this._writePosAttr(el, n);\r\n }\r\n });\r\n this._updateStyles(false, maxH); // false = don't recreate, just append if need be\r\n }\r\n });\r\n if (this.opts.auto) {\r\n this.batchUpdate(); // prevent in between re-layout #1535 TODO: this only set float=true, need to prevent collision check...\r\n let elements = [];\r\n this.getGridItems().forEach(el => {\r\n let x = parseInt(el.getAttribute('gs-x'));\r\n let y = parseInt(el.getAttribute('gs-y'));\r\n elements.push({\r\n el,\r\n // if x,y are missing (autoPosition) add them to end of list - but keep their respective DOM order\r\n i: (Number.isNaN(x) ? 1000 : x) + (Number.isNaN(y) ? 1000 : y) * this.getColumn()\r\n });\r\n });\r\n elements.sort((a, b) => a.i - b.i).forEach(e => this._prepareElement(e.el));\r\n this.commit();\r\n }\r\n this.setAnimation(this.opts.animate);\r\n this._updateStyles();\r\n if (this.opts.column != 12) {\r\n this.el.classList.add('grid-stack-' + this.opts.column);\r\n }\r\n // legacy support to appear 'per grid` options when really global.\r\n if (this.opts.dragIn)\r\n GridStack.setupDragIn(this.opts.dragIn, this.opts.dragInOptions);\r\n delete this.opts.dragIn;\r\n delete this.opts.dragInOptions;\r\n this._setupRemoveDrop();\r\n this._setupAcceptWidget();\r\n this._updateWindowResizeEvent();\r\n }\r\n /**\r\n * initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will\r\n * simply return the existing instance (ignore any passed options). There is also an initAll() version that support\r\n * multiple grids initialization at once. Or you can use addGrid() to create the entire grid from JSON.\r\n * @param options grid options (optional)\r\n * @param elOrString element or CSS selector (first one used) to convert to a grid (default to '.grid-stack' class selector)\r\n *\r\n * @example\r\n * let grid = GridStack.init();\r\n *\r\n * Note: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later\r\n * let grid = document.querySelector('.grid-stack').gridstack;\r\n */\r\n static init(options = {}, elOrString = '.grid-stack') {\r\n let el = GridStack.getGridElement(elOrString);\r\n if (!el) {\r\n if (typeof elOrString === 'string') {\r\n console.error('GridStack.initAll() no grid was found with selector \"' + elOrString + '\" - element missing or wrong selector ?' +\r\n '\\nNote: \".grid-stack\" is required for proper CSS styling and drag/drop, and is the default selector.');\r\n }\r\n else {\r\n console.error('GridStack.init() no grid element was passed.');\r\n }\r\n return null;\r\n }\r\n if (!el.gridstack) {\r\n el.gridstack = new GridStack(el, utils_1.Utils.cloneDeep(options));\r\n }\r\n return el.gridstack;\r\n }\r\n /**\r\n * Will initialize a list of elements (given a selector) and return an array of grids.\r\n * @param options grid options (optional)\r\n * @param selector elements selector to convert to grids (default to '.grid-stack' class selector)\r\n *\r\n * @example\r\n * let grids = GridStack.initAll();\r\n * grids.forEach(...)\r\n */\r\n static initAll(options = {}, selector = '.grid-stack') {\r\n let grids = [];\r\n GridStack.getGridElements(selector).forEach(el => {\r\n if (!el.gridstack) {\r\n el.gridstack = new GridStack(el, utils_1.Utils.cloneDeep(options));\r\n delete options.dragIn;\r\n delete options.dragInOptions; // only need to be done once (really a static global thing, not per grid)\r\n }\r\n grids.push(el.gridstack);\r\n });\r\n if (grids.length === 0) {\r\n console.error('GridStack.initAll() no grid was found with selector \"' + selector + '\" - element missing or wrong selector ?' +\r\n '\\nNote: \".grid-stack\" is required for proper CSS styling and drag/drop, and is the default selector.');\r\n }\r\n return grids;\r\n }\r\n /**\r\n * call to create a grid with the given options, including loading any children from JSON structure. This will call GridStack.init(), then\r\n * grid.load() on any passed children (recursively). Great alternative to calling init() if you want entire grid to come from\r\n * JSON serialized data, including options.\r\n * @param parent HTML element parent to the grid\r\n * @param opt grids options used to initialize the grid, and list of children\r\n */\r\n static addGrid(parent, opt = {}) {\r\n if (!parent)\r\n return null;\r\n // create the grid element, but check if the passed 'parent' already has grid styling and should be used instead\r\n let el = parent;\r\n if (!parent.classList.contains('grid-stack')) {\r\n let doc = document.implementation.createHTMLDocument(''); // IE needs a param\r\n doc.body.innerHTML = `<div class=\"grid-stack ${opt.class || ''}\"></div>`;\r\n el = doc.body.children[0];\r\n parent.appendChild(el);\r\n }\r\n // create grid class and load any children\r\n let grid = GridStack.init(opt, el);\r\n if (grid.opts.children) {\r\n let children = grid.opts.children;\r\n delete grid.opts.children;\r\n grid.load(children);\r\n }\r\n return grid;\r\n }\r\n /** @internal create placeholder DIV as needed */\r\n get placeholder() {\r\n if (!this._placeholder) {\r\n let placeholderChild = document.createElement('div'); // child so padding match item-content\r\n placeholderChild.className = 'placeholder-content';\r\n if (this.opts.placeholderText) {\r\n placeholderChild.innerHTML = this.opts.placeholderText;\r\n }\r\n this._placeholder = document.createElement('div');\r\n this._placeholder.classList.add(this.opts.placeholderClass, GridDefaults.itemClass, this.opts.itemClass);\r\n this.placeholder.appendChild(placeholderChild);\r\n }\r\n return this._placeholder;\r\n }\r\n /**\r\n * add a new widget and returns it.\r\n *\r\n * Widget will be always placed even if result height is more than actual grid height.\r\n * You need to use `willItFit()` before calling addWidget for additional check.\r\n * See also `makeWidget()`.\r\n *\r\n * @example\r\n * let grid = GridStack.init();\r\n * grid.addWidget({w: 3, content: 'hello'});\r\n * grid.addWidget('<div class=\"grid-stack-item\"><div class=\"grid-stack-item-content\">hello</div></div>', {w: 3});\r\n *\r\n * @param el GridStackWidget (which can have content string as well), html element, or string definition to add\r\n * @param options widget position/size options (optional, and ignore if first param is already option) - see GridStackWidget\r\n */\r\n addWidget(els, options) {\r\n // support legacy call for now ?\r\n if (arguments.length > 2) {\r\n console.warn('gridstack.ts: `addWidget(el, x, y, width...)` is deprecated. Use `addWidget({x, y, w, content, ...})`. It will be removed soon');\r\n // eslint-disable-next-line prefer-rest-params\r\n let a = arguments, i = 1, opt = { x: a[i++], y: a[i++], w: a[i++], h: a[i++], autoPosition: a[i++],\r\n minW: a[i++], maxW: a[i++], minH: a[i++], maxH: a[i++], id: a[i++] };\r\n return this.addWidget(els, opt);\r\n }\r\n function isGridStackWidget(w) {\r\n return w.x !== undefined || w.y !== undefined || w.w !== undefined || w.h !== undefined || w.content !== undefined ? true : false;\r\n }\r\n let el;\r\n if (typeof els === 'string') {\r\n let doc = document.implementation.createHTMLDocument(''); // IE needs a param\r\n doc.body.innerHTML = els;\r\n el = doc.body.children[0];\r\n }\r\n else if (arguments.length === 0 || arguments.length === 1 && isGridStackWidget(els)) {\r\n let content = els ? els.content || '' : '';\r\n options = els;\r\n let doc = document.implementation.createHTMLDocument(''); // IE needs a param\r\n doc.body.innerHTML = `<div class=\"grid-stack-item ${this.opts.itemClass || ''}\"><div class=\"grid-stack-item-content\">${content}</div></div>`;\r\n el = doc.body.children[0];\r\n }\r\n else {\r\n el = els;\r\n }\r\n // Tempting to initialize the passed in opt with default and valid values, but this break knockout demos\r\n // as the actual value are filled in when _prepareElement() calls el.getAttribute('gs-xyz) before adding the node.\r\n // So make sure we load any DOM attributes that are not specified in passed in options (which override)\r\n let domAttr = this._readAttr(el);\r\n options = utils_1.Utils.cloneDeep(options) || {}; // make a copy before we modify in case caller re-uses it\r\n utils_1.Utils.defaults(options, domAttr);\r\n let node = this.engine.prepareNode(options);\r\n this._writeAttr(el, options);\r\n if (this._insertNotAppend) {\r\n this.el.prepend(el);\r\n }\r\n else {\r\n this.el.appendChild(el);\r\n }\r\n // similar to makeWidget() that doesn't read attr again and worse re-create a new node and loose any _id\r\n this._prepareElement(el, true, options);\r\n this._updateContainerHeight();\r\n // check if nested grid definition is present\r\n if (node.subGrid && !node.subGrid.el) { // see if there is a sub-grid to create too\r\n // if column special case it set, remember that flag and set default\r\n let autoColumn;\r\n let ops = node.subGrid;\r\n if (ops.column === 'auto') {\r\n ops.column = node.w;\r\n ops.disableOneColumnMode = true; // driven by parent\r\n autoColumn = true;\r\n }\r\n let content = node.el.querySelector('.grid-stack-item-content');\r\n node.subGrid = GridStack.addGrid(content, node.subGrid);\r\n if (autoColumn) {\r\n node.subGrid._autoColumn = true;\r\n }\r\n }\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n return el;\r\n }\r\n /**\r\n /**\r\n * saves the current layout returning a list of widgets for serialization which might include any nested grids.\r\n * @param saveContent if true (default) the latest html inside .grid-stack-content will be saved to GridStackWidget.content field, else it will\r\n * be removed.\r\n * @param saveGridOpt if true (default false), save the grid options itself, so you can call the new GridStack.addGrid()\r\n * to recreate everything from scratch. GridStackOptions.children would then contain the widget list instead.\r\n * @returns list of widgets or full grid option, including .children list of widgets\r\n */\r\n save(saveContent = true, saveGridOpt = false) {\r\n // return copied nodes we can modify at will...\r\n let list = this.engine.save(saveContent);\r\n // check for HTML content and nested grids\r\n list.forEach(n => {\r\n if (saveContent && n.el && !n.subGrid) { // sub-grid are saved differently, not plain content\r\n let sub = n.el.querySelector('.grid-stack-item-content');\r\n n.content = sub ? sub.innerHTML : undefined;\r\n if (!n.content)\r\n delete n.content;\r\n }\r\n else {\r\n if (!saveContent) {\r\n delete n.content;\r\n }\r\n // check for nested grid\r\n if (n.subGrid) {\r\n n.subGrid = n.subGrid.save(saveContent, true);\r\n }\r\n }\r\n delete n.el;\r\n });\r\n // check if save entire grid options (needed for recursive) + children...\r\n if (saveGridOpt) {\r\n let o = utils_1.Utils.cloneDeep(this.opts);\r\n // delete default values that will be recreated on launch\r\n if (o.marginBottom === o.marginTop && o.marginRight === o.marginLeft && o.marginTop === o.marginRight) {\r\n o.margin = o.marginTop;\r\n delete o.marginTop;\r\n delete o.marginRight;\r\n delete o.marginBottom;\r\n delete o.marginLeft;\r\n }\r\n if (o.rtl === (this.el.style.direction === 'rtl')) {\r\n o.rtl = 'auto';\r\n }\r\n if (this._isAutoCellHeight) {\r\n o.cellHeight = 'auto';\r\n }\r\n if (this._autoColumn) {\r\n o.column = 'auto';\r\n delete o.disableOneColumnMode;\r\n }\r\n utils_1.Utils.removeInternalAndSame(o, GridDefaults);\r\n o.children = list;\r\n return o;\r\n }\r\n return list;\r\n }\r\n /**\r\n * load the widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.\r\n *\r\n * @param layout list of widgets definition to update/create\r\n * @param addAndRemove boolean (default true) or callback method can be passed to control if and how missing widgets can be added/removed, giving\r\n * the user control of insertion.\r\n *\r\n * @example\r\n * see http://gridstackjs.com/demo/serialization.html\r\n **/\r\n load(layout, addAndRemove = true) {\r\n let items = GridStack.Utils.sort([...layout], -1, this._prevColumn || this.getColumn()); // make copy before we mod/sort\r\n this._insertNotAppend = true; // since create in reverse order...\r\n // if we're loading a layout into 1 column (_prevColumn is set only when going to 1) and items don't fit, make sure to save\r\n // the original wanted layout so we can scale back up correctly #1471\r\n if (this._prevColumn && this._prevColumn !== this.opts.column && items.some(n => (n.x + n.w) > this.opts.column)) {\r\n this._ignoreLayoutsNodeChange = true; // skip layout update\r\n this.engine.cacheLayout(items, this._prevColumn, true);\r\n }\r\n let removed = [];\r\n this.batchUpdate();\r\n // see if any items are missing from new layout and need to be removed first\r\n if (addAndRemove) {\r\n let copyNodes = [...this.engine.nodes]; // don't loop through array you modify\r\n copyNodes.forEach(n => {\r\n let item = items.find(w => n.id === w.id);\r\n if (!item) {\r\n if (typeof (addAndRemove) === 'function') {\r\n addAndRemove(this, n, false);\r\n }\r\n else {\r\n removed.push(n); // batch keep track\r\n this.removeWidget(n.el, true, false);\r\n }\r\n }\r\n });\r\n }\r\n // now add/update the widgets\r\n items.forEach(w => {\r\n let item = (w.id || w.id === 0) ? this.engine.nodes.find(n => n.id === w.id) : undefined;\r\n if (item) {\r\n this.update(item.el, w);\r\n if (w.subGrid && w.subGrid.children) { // update any sub grid as well\r\n let sub = item.el.querySelector('.grid-stack');\r\n if (sub && sub.gridstack) {\r\n sub.gridstack.load(w.subGrid.children); // TODO: support updating grid options ?\r\n this._insertNotAppend = true; // got reset by above call\r\n }\r\n }\r\n }\r\n else if (addAndRemove) {\r\n if (typeof (addAndRemove) === 'function') {\r\n w = addAndRemove(this, w, true).gridstackNode;\r\n }\r\n else {\r\n w = this.addWidget(w).gridstackNode;\r\n }\r\n }\r\n });\r\n this.engine.removedNodes = removed;\r\n this.commit();\r\n // after commit, clear that flag\r\n delete this._ignoreLayoutsNodeChange;\r\n delete this._insertNotAppend;\r\n return this;\r\n }\r\n /**\r\n * Initializes batch updates. You will see no changes until `commit()` method is called.\r\n */\r\n batchUpdate() {\r\n this.engine.batchUpdate();\r\n return this;\r\n }\r\n /**\r\n * Gets current cell height.\r\n */\r\n getCellHeight(forcePixel = false) {\r\n if (this.opts.cellHeight && this.opts.cellHeight !== 'auto' &&\r\n (!forcePixel || !this.opts.cellHeightUnit || this.opts.cellHeightUnit === 'px')) {\r\n return this.opts.cellHeight;\r\n }\r\n // else get first cell height\r\n let el = this.el.querySelector('.' + this.opts.itemClass);\r\n if (el) {\r\n let height = utils_1.Utils.toNumber(el.getAttribute('gs-h'));\r\n return Math.round(el.offsetHeight / height);\r\n }\r\n // else do entire grid and # of rows (but doesn't work if min-height is the actual constrain)\r\n let rows = parseInt(this.el.getAttribute('gs-current-row'));\r\n return rows ? Math.round(this.el.getBoundingClientRect().height / rows) : this.opts.cellHeight;\r\n }\r\n /**\r\n * Update current cell height - see `GridStackOptions.cellHeight` for format.\r\n * This method rebuilds an internal CSS style sheet.\r\n * Note: You can expect performance issues if call this method too often.\r\n *\r\n * @param val the cell height. If not passed (undefined), cells content will be made square (match width minus margin),\r\n * if pass 0 the CSS will be generated by the application instead.\r\n * @param update (Optional) if false, styles will not be updated\r\n *\r\n * @example\r\n * grid.cellHeight(100); // same as 100px\r\n * grid.cellHeight('70px');\r\n * grid.cellHeight(grid.cellWidth() * 1.2);\r\n */\r\n cellHeight(val, update = true) {\r\n // if not called internally, check if we're changing mode\r\n if (update && val !== undefined) {\r\n if (this._isAutoCellHeight !== (val === 'auto')) {\r\n this._isAutoCellHeight = (val === 'auto');\r\n this._updateWindowResizeEvent();\r\n }\r\n }\r\n if (val === 'initial' || val === 'auto') {\r\n val = undefined;\r\n }\r\n // make item content be square\r\n if (val === undefined) {\r\n let marginDiff = -this.opts.marginRight - this.opts.marginLeft\r\n + this.opts.marginTop + this.opts.marginBottom;\r\n val = this.cellWidth() + marginDiff;\r\n }\r\n let data = utils_1.Utils.parseHeight(val);\r\n if (this.opts.cellHeightUnit === data.unit && this.opts.cellHeight === data.h) {\r\n return this;\r\n }\r\n this.opts.cellHeightUnit = data.unit;\r\n this.opts.cellHeight = data.h;\r\n if (update) {\r\n this._updateStyles(true, this.getRow()); // true = force re-create, for that # of rows\r\n }\r\n return this;\r\n }\r\n /** Gets current cell width. */\r\n cellWidth() {\r\n return this._widthOrContainer() / this.getColumn();\r\n }\r\n /** return our expected width (or parent) for 1 column check */\r\n _widthOrContainer() {\r\n // use `offsetWidth` or `clientWidth` (no scrollbar) ?\r\n // https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively\r\n return (this.el.clientWidth || this.el.parentElement.clientWidth || window.innerWidth);\r\n }\r\n /**\r\n * Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.\r\n */\r\n commit() {\r\n this.engine.commit();\r\n this._triggerRemoveEvent();\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n /** re-layout grid items to reclaim any empty space */\r\n compact() {\r\n this.engine.compact();\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n /**\r\n * set the number of columns in the grid. Will update existing widgets to conform to new number of columns,\r\n * as well as cache the original layout so you can revert back to previous positions without loss.\r\n * Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11],\r\n * else you will need to generate correct CSS (see https://github.com/gridstack/gridstack.js#change-grid-columns)\r\n * @param column - Integer > 0 (default 12).\r\n * @param layout specify the type of re-layout that will happen (position, size, etc...).\r\n * Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column\r\n */\r\n column(column, layout = 'moveScale') {\r\n if (column < 1 || this.opts.column === column)\r\n return this;\r\n let oldColumn = this.getColumn();\r\n // if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)\r\n // then remember the original columns so we can restore.\r\n if (column === 1) {\r\n this._prevColumn = oldColumn;\r\n }\r\n else {\r\n delete this._prevColumn;\r\n }\r\n this.el.classList.remove('grid-stack-' + oldColumn);\r\n this.el.classList.add('grid-stack-' + column);\r\n this.opts.column = this.engine.column = column;\r\n // update the items now - see if the dom order nodes should be passed instead (else default to current list)\r\n let domNodes;\r\n if (column === 1 && this.opts.oneColumnModeDomSort) {\r\n domNodes = [];\r\n this.getGridItems().forEach(el => {\r\n if (el.gridstackNode) {\r\n domNodes.push(el.gridstackNode);\r\n }\r\n });\r\n if (!domNodes.length) {\r\n domNodes = undefined;\r\n }\r\n }\r\n this.engine.updateNodeWidths(oldColumn, column, domNodes, layout);\r\n if (this._isAutoCellHeight)\r\n this.cellHeight();\r\n // and trigger our event last...\r\n this._ignoreLayoutsNodeChange = true; // skip layout update\r\n this._triggerChangeEvent();\r\n delete this._ignoreLayoutsNodeChange;\r\n return this;\r\n }\r\n /**\r\n * get the number of columns in the grid (default 12)\r\n */\r\n getColumn() {\r\n return this.opts.column;\r\n }\r\n /** returns an array of grid HTML elements (no placeholder) - used to iterate through our children in DOM order */\r\n getGridItems() {\r\n return Array.from(this.el.children)\r\n .filter((el) => el.matches('.' + this.opts.itemClass) && !el.matches('.' + this.opts.placeholderClass));\r\n }\r\n /**\r\n * Destroys a grid instance. DO NOT CALL any methods or access any vars after this as it will free up members.\r\n * @param removeDOM if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`).\r\n */\r\n destroy(removeDOM = true) {\r\n if (!this.el)\r\n return; // prevent multiple calls\r\n this._updateWindowResizeEvent(true);\r\n this.setStatic(true, false); // permanently removes DD but don't set CSS class (we're going away)\r\n this.setAnimation(false);\r\n if (!removeDOM) {\r\n this.removeAll(removeDOM);\r\n this.el.classList.remove(this.opts._styleSheetClass);\r\n }\r\n else {\r\n this.el.parentNode.removeChild(this.el);\r\n }\r\n this._removeStylesheet();\r\n this.el.removeAttribute('gs-current-row');\r\n delete this.opts._isNested;\r\n delete this.opts;\r\n delete this._placeholder;\r\n delete this.engine;\r\n delete this.el.gridstack; // remove circular dependency that would prevent a freeing\r\n delete this.el;\r\n return this;\r\n }\r\n /**\r\n * enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html)\r\n */\r\n float(val) {\r\n this.engine.float = val;\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n /**\r\n * get the current float mode\r\n */\r\n getFloat() {\r\n return this.engine.float;\r\n }\r\n /**\r\n * Get the position of the cell under a pixel on screen.\r\n * @param position the position of the pixel to resolve in\r\n * absolute coordinates, as an object with top and left properties\r\n * @param useDocRelative if true, value will be based on document position vs parent position (Optional. Default false).\r\n * Useful when grid is within `position: relative` element\r\n *\r\n * Returns an object with properties `x` and `y` i.e. the column and row in the grid.\r\n */\r\n getCellFromPixel(position, useDocRelative = false) {\r\n let box = this.el.getBoundingClientRect();\r\n // console.log(`getBoundingClientRect left: ${box.left} top: ${box.top} w: ${box.w} h: ${box.h}`)\r\n let containerPos;\r\n if (useDocRelative) {\r\n containerPos = { top: box.top + document.documentElement.scrollTop, left: box.left };\r\n // console.log(`getCellFromPixel scrollTop: ${document.documentElement.scrollTop}`)\r\n }\r\n else {\r\n containerPos = { top: this.el.offsetTop, left: this.el.offsetLeft };\r\n // console.log(`getCellFromPixel offsetTop: ${containerPos.left} offsetLeft: ${containerPos.top}`)\r\n }\r\n let relativeLeft = position.left - containerPos.left;\r\n let relativeTop = position.top - containerPos.top;\r\n let columnWidth = (box.width / this.getColumn());\r\n let rowHeight = (box.height / parseInt(this.el.getAttribute('gs-current-row')));\r\n return { x: Math.floor(relativeLeft / columnWidth), y: Math.floor(relativeTop / rowHeight) };\r\n }\r\n /** returns the current number of rows, which will be at least `minRow` if set */\r\n getRow() {\r\n return Math.max(this.engine.getRow(), this.opts.minRow);\r\n }\r\n /**\r\n * Checks if specified area is empty.\r\n * @param x the position x.\r\n * @param y the position y.\r\n * @param w the width of to check\r\n * @param h the height of to check\r\n */\r\n isAreaEmpty(x, y, w, h) {\r\n return this.engine.isAreaEmpty(x, y, w, h);\r\n }\r\n /**\r\n * If you add elements to your grid by hand, you have to tell gridstack afterwards to make them widgets.\r\n * If you want gridstack to add the elements for you, use `addWidget()` instead.\r\n * Makes the given element a widget and returns it.\r\n * @param els widget or single selector to convert.\r\n *\r\n * @example\r\n * let grid = GridStack.init();\r\n * grid.el.appendChild('<div id=\"gsi-1\" gs-w=\"3\"></div>');\r\n * grid.makeWidget('#gsi-1');\r\n */\r\n makeWidget(els) {\r\n let el = GridStack.getElement(els);\r\n this._prepareElement(el, true);\r\n this._updateContainerHeight();\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n return el;\r\n }\r\n /**\r\n * Event handler that extracts our CustomEvent data out automatically for receiving custom\r\n * notifications (see doc for supported events)\r\n * @param name of the event (see possible values) or list of names space separated\r\n * @param callback function called with event and optional second/third param\r\n * (see README documentation for each signature).\r\n *\r\n * @example\r\n * grid.on('added', function(e, items) { log('added ', items)} );\r\n * or\r\n * grid.on('added removed change', function(e, items) { log(e.type, items)} );\r\n *\r\n * Note: in some cases it is the same as calling native handler and parsing the event.\r\n * grid.el.addEventListener('added', function(event) { log('added ', event.detail)} );\r\n *\r\n */\r\n on(name, callback) {\r\n // check for array of names being passed instead\r\n if (name.indexOf(' ') !== -1) {\r\n let names = name.split(' ');\r\n names.forEach(name => this.on(name, callback));\r\n return this;\r\n }\r\n if (name === 'change' || name === 'added' || name === 'removed' || name === 'enable' || name === 'disable') {\r\n // native CustomEvent handlers - cash the generic handlers so we can easily remove\r\n let noData = (name === 'enable' || name === 'disable');\r\n if (noData) {\r\n this._gsEventHandler[name] = (event) => callback(event);\r\n }\r\n else {\r\n this._gsEventHandler[name] = (event) => callback(event, event.detail);\r\n }\r\n this.el.addEventListener(name, this._gsEventHandler[name]);\r\n }\r\n else if (name === 'drag' || name === 'dragstart' || name === 'dragstop' || name === 'resizestart' || name === 'resize' || name === 'resizestop' || name === 'dropped') {\r\n // drag&drop stop events NEED to be call them AFTER we update node attributes so handle them ourself.\r\n // do same for start event to make it easier...\r\n this._gsEventHandler[name] = callback;\r\n }\r\n else {\r\n console.log('GridStack.on(' + name + ') event not supported, but you can still use $(\".grid-stack\").on(...) while jquery-ui is still used internally.');\r\n }\r\n return this;\r\n }\r\n /**\r\n * unsubscribe from the 'on' event below\r\n * @param name of the event (see possible values)\r\n */\r\n off(name) {\r\n // check for array of names being passed instead\r\n if (name.indexOf(' ') !== -1) {\r\n let names = name.split(' ');\r\n names.forEach(name => this.off(name));\r\n return this;\r\n }\r\n if (name === 'change' || name === 'added' || name === 'removed' || name === 'enable' || name === 'disable') {\r\n // remove native CustomEvent handlers\r\n if (this._gsEventHandler[name]) {\r\n this.el.removeEventListener(name, this._gsEventHandler[name]);\r\n }\r\n }\r\n delete this._gsEventHandler[name];\r\n return this;\r\n }\r\n /**\r\n * Removes widget from the grid.\r\n * @param el widget or selector to modify\r\n * @param removeDOM if `false` DOM element won't be removed from the tree (Default? true).\r\n * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).\r\n */\r\n removeWidget(els, removeDOM = true, triggerEvent = true) {\r\n GridStack.getElements(els).forEach(el => {\r\n if (el.parentElement !== this.el)\r\n return; // not our child!\r\n let node = el.gridstackNode;\r\n // For Meteor support: https://github.com/gridstack/gridstack.js/pull/272\r\n if (!node) {\r\n node = this.engine.nodes.find(n => el === n.el);\r\n }\r\n if (!node)\r\n return;\r\n // remove our DOM data (circular link) and drag&drop permanently\r\n delete el.gridstackNode;\r\n gridstack_ddi_1.GridStackDDI.get().remove(el);\r\n this.engine.removeNode(node, removeDOM, triggerEvent);\r\n if (removeDOM && el.parentElement) {\r\n el.remove(); // in batch mode engine.removeNode doesn't call back to remove DOM\r\n }\r\n });\r\n if (triggerEvent) {\r\n this._triggerRemoveEvent();\r\n this._triggerChangeEvent();\r\n }\r\n return this;\r\n }\r\n /**\r\n * Removes all widgets from the grid.\r\n * @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).\r\n */\r\n removeAll(removeDOM = true) {\r\n // always remove our DOM data (circular link) before list gets emptied and drag&drop permanently\r\n this.engine.nodes.forEach(n => {\r\n delete n.el.gridstackNode;\r\n gridstack_ddi_1.GridStackDDI.get().remove(n.el);\r\n });\r\n this.engine.removeAll(removeDOM);\r\n this._triggerRemoveEvent();\r\n return this;\r\n }\r\n /**\r\n * Toggle the grid animation state. Toggles the `grid-stack-animate` class.\r\n * @param doAnimate if true the grid will animate.\r\n */\r\n setAnimation(doAnimate) {\r\n if (doAnimate) {\r\n this.el.classList.add('grid-stack-animate');\r\n }\r\n else {\r\n this.el.classList.remove('grid-stack-animate');\r\n }\r\n return this;\r\n }\r\n /**\r\n * Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on.\r\n * Also toggle the grid-stack-static class.\r\n * @param val if true the grid become static.\r\n */\r\n setStatic(val, updateClass = true) {\r\n if (this.opts.staticGrid === val)\r\n return this;\r\n this.opts.staticGrid = val;\r\n this._setupRemoveDrop();\r\n this._setupAcceptWidget();\r\n this.engine.nodes.forEach(n => this._prepareDragDropByNode(n)); // either delete or init Drag&drop\r\n if (updateClass) {\r\n this._setStaticClass();\r\n }\r\n return this;\r\n }\r\n /**\r\n * Updates widget position/size and other info. Note: if you need to call this on all nodes, use load() instead which will update what changed.\r\n * @param els widget or selector of objects to modify (note: setting the same x,y for multiple items will be indeterministic and likely unwanted)\r\n * @param opt new widget options (x,y,w,h, etc..). Only those set will be updated.\r\n */\r\n update(els, opt) {\r\n // support legacy call for now ?\r\n if (arguments.length > 2) {\r\n console.warn('gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon');\r\n // eslint-disable-next-line prefer-rest-params\r\n let a = arguments, i = 1;\r\n opt = { x: a[i++], y: a[i++], w: a[i++], h: a[i++] };\r\n return this.update(els, opt);\r\n }\r\n GridStack.getElements(els).forEach(el => {\r\n if (!el || !el.gridstackNode)\r\n return;\r\n let n = el.gridstackNode;\r\n let w = utils_1.Utils.cloneDeep(opt); // make a copy we can modify in case they re-use it or multiple items\r\n delete w.autoPosition;\r\n // move/resize widget if anything changed\r\n let keys = ['x', 'y', 'w', 'h'];\r\n let m;\r\n if (keys.some(k => w[k] !== undefined && w[k] !== n[k])) {\r\n m = {};\r\n keys.forEach(k => {\r\n m[k] = (w[k] !== undefined) ? w[k] : n[k];\r\n delete w[k];\r\n });\r\n }\r\n // for a move as well IFF there is any min/max fields set\r\n if (!m && (w.minW || w.minH || w.maxW || w.maxH)) {\r\n m = {}; // will use node position but validate values\r\n }\r\n // check for content changing\r\n if (w.content) {\r\n let sub = el.querySelector('.grid-stack-item-content');\r\n if (sub && sub.innerHTML !== w.content) {\r\n sub.innerHTML = w.content;\r\n }\r\n delete w.content;\r\n }\r\n // any remaining fields are assigned, but check for dragging changes, resize constrain\r\n let changed = false;\r\n let ddChanged = false;\r\n for (const key in w) {\r\n if (key[0] !== '_' && n[key] !== w[key]) {\r\n n[key] = w[key];\r\n changed = true;\r\n ddChanged = ddChanged || (!this.opts.staticGrid && (key === 'noResize' || key === 'noMove' || key === 'locked'));\r\n }\r\n }\r\n // finally move the widget\r\n if (m) {\r\n this.engine.cleanNodes()\r\n .beginUpdate(n)\r\n .moveNode(n, m);\r\n this._updateContainerHeight();\r\n this._triggerChangeEvent();\r\n this.engine.endUpdate();\r\n }\r\n if (changed) { // move will only update x,y,w,h so update the rest too\r\n this._writeAttr(el, n);\r\n }\r\n if (ddChanged) {\r\n this._prepareDragDropByNode(n);\r\n }\r\n });\r\n return this;\r\n }\r\n /**\r\n * Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options (CSS string format of 1,2,4 values or single number).\r\n * @param value margin value\r\n */\r\n margin(value) {\r\n let isMultiValue = (typeof value === 'string' && value.split(' ').length > 1);\r\n // check if we can skip re-creating our CSS file... won't check if multi values (too much hassle)\r\n if (!isMultiValue) {\r\n let data = utils_1.Utils.parseHeight(value);\r\n if (this.opts.marginUnit === data.unit && this.opts.margin === data.h)\r\n return;\r\n }\r\n // re-use existing margin handling\r\n this.opts.margin = value;\r\n this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;\r\n this.initMargin();\r\n this._updateStyles(true); // true = force re-create\r\n return this;\r\n }\r\n /** returns current margin number value (undefined if 4 sides don't match) */\r\n getMargin() { return this.opts.margin; }\r\n /**\r\n * Returns true if the height of the grid will be less than the vertical\r\n * constraint. Always returns true if grid doesn't have height constraint.\r\n * @param node contains x,y,w,h,auto-position options\r\n *\r\n * @example\r\n * if (grid.willItFit(newWidget)) {\r\n * grid.addWidget(newWidget);\r\n * } else {\r\n * alert('Not enough free space to place the widget');\r\n * }\r\n */\r\n willItFit(node) {\r\n // support legacy call for now\r\n if (arguments.length > 1) {\r\n console.warn('gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon');\r\n // eslint-disable-next-line prefer-rest-params\r\n let a = arguments, i = 0, w = { x: a[i++], y: a[i++], w: a[i++], h: a[i++], autoPosition: a[i++] };\r\n return this.willItFit(w);\r\n }\r\n return this.engine.willItFit(node);\r\n }\r\n /** @internal */\r\n _triggerChangeEvent() {\r\n if (this.engine.batchMode)\r\n return this;\r\n let elements = this.engine.getDirtyNodes(true); // verify they really changed\r\n if (elements && elements.length) {\r\n if (!this._ignoreLayoutsNodeChange) {\r\n this.engine.layoutsNodesChange(elements);\r\n }\r\n this._triggerEvent('change', elements);\r\n }\r\n this.engine.saveInitial(); // we called, now reset initial values & dirty flags\r\n return this;\r\n }\r\n /** @internal */\r\n _triggerAddEvent() {\r\n if (this.engine.batchMode)\r\n return this;\r\n if (this.engine.addedNodes && this.engine.addedNodes.length > 0) {\r\n if (!this._ignoreLayoutsNodeChange) {\r\n this.engine.layoutsNodesChange(this.engine.addedNodes);\r\n }\r\n // prevent added nodes from also triggering 'change' event (which is called next)\r\n this.engine.addedNodes.forEach(n => { delete n._dirty; });\r\n this._triggerEvent('added', this.engine.addedNodes);\r\n this.engine.addedNodes = [];\r\n }\r\n return this;\r\n }\r\n /** @internal */\r\n _triggerRemoveEvent() {\r\n if (this.engine.batchMode)\r\n return this;\r\n if (this.engine.removedNodes && this.engine.removedNodes.length > 0) {\r\n this._triggerEvent('removed', this.engine.removedNodes);\r\n this.engine.removedNodes = [];\r\n }\r\n return this;\r\n }\r\n /** @internal */\r\n _triggerEvent(name, data) {\r\n let event = data ? new CustomEvent(name, { bubbles: false, detail: data }) : new Event(name);\r\n this.el.dispatchEvent(event);\r\n return this;\r\n }\r\n /** @internal called to delete the current dynamic style sheet used for our layout */\r\n _removeStylesheet() {\r\n if (this._styles) {\r\n utils_1.Utils.removeStylesheet(this._styles._id);\r\n delete this._styles;\r\n }\r\n return this;\r\n }\r\n /** @internal updated/create the CSS styles for row based layout and initial margin setting */\r\n _updateStyles(forceUpdate = false, maxH) {\r\n // call to delete existing one if we change cellHeight / margin\r\n if (forceUpdate) {\r\n this._removeStylesheet();\r\n }\r\n this._updateContainerHeight();\r\n // if user is telling us they will handle the CSS themselves by setting heights to 0. Do we need this opts really ??\r\n if (this.opts.cellHeight === 0) {\r\n return this;\r\n }\r\n let cellHeight = this.opts.cellHeight;\r\n let cellHeightUnit = this.opts.cellHeightUnit;\r\n let prefix = `.${this.opts._styleSheetClass} > .${this.opts.itemClass}`;\r\n // create one as needed\r\n if (!this._styles) {\r\n let id = 'gridstack-style-' + (Math.random() * 100000).toFixed();\r\n // insert style to parent (instead of 'head' by default) to support WebComponent\r\n let styleLocation = this.opts.styleInHead ? undefined : this.el.parentNode;\r\n this._styles = utils_1.Utils.createStylesheet(id, styleLocation);\r\n if (!this._styles)\r\n return this;\r\n this._styles._id = id;\r\n this._styles._max = 0;\r\n // these are done once only\r\n utils_1.Utils.addCSSRule(this._styles, prefix, `min-height: ${cellHeight}${cellHeightUnit}`);\r\n // content margins\r\n let top = this.opts.marginTop + this.opts.marginUnit;\r\n let bottom = this.opts.marginBottom + this.opts.marginUnit;\r\n let right = this.opts.marginRight + this.opts.marginUnit;\r\n let left = this.opts.marginLeft + this.opts.marginUnit;\r\n let content = `${prefix} > .grid-stack-item-content`;\r\n let placeholder = `.${this.opts._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;\r\n utils_1.Utils.addCSSRule(this._styles, content, `top: ${top}; right: ${right}; bottom: ${bottom}; left: ${left};`);\r\n utils_1.Utils.addCSSRule(this._styles, placeholder, `top: ${top}; right: ${right}; bottom: ${bottom}; left: ${left};`);\r\n // resize handles offset (to match margin)\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-ne`, `right: ${right}`);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-e`, `right: ${right}`);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-se`, `right: ${right}; bottom: ${bottom}`);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-nw`, `left: ${left}`);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-w`, `left: ${left}`);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-sw`, `left: ${left}; bottom: ${bottom}`);\r\n }\r\n // now update the height specific fields\r\n maxH = maxH || this._styles._max;\r\n if (maxH > this._styles._max) {\r\n let getHeight = (rows) => (cellHeight * rows) + cellHeightUnit;\r\n for (let i = this._styles._max + 1; i <= maxH; i++) { // start at 1\r\n let h = getHeight(i);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix}[gs-y=\"${i - 1}\"]`, `top: ${getHeight(i - 1)}`); // start at 0\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix}[gs-h=\"${i}\"]`, `height: ${h}`);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix}[gs-min-h=\"${i}\"]`, `min-height: ${h}`);\r\n utils_1.Utils.addCSSRule(this._styles, `${prefix}[gs-max-h=\"${i}\"]`, `max-height: ${h}`);\r\n }\r\n this._styles._max = maxH;\r\n }\r\n return this;\r\n }\r\n /** @internal */\r\n _updateContainerHeight() {\r\n if (!this.engine || this.engine.batchMode)\r\n return this;\r\n let row = this.getRow() + this._extraDragRow; // checks for minRow already\r\n // check for css min height\r\n // Note: we don't handle %,rem correctly so comment out, beside we don't need need to create un-necessary\r\n // rows as the CSS will make us bigger than our set height if needed... not sure why we had this.\r\n // let cssMinHeight = parseInt(getComputedStyle(this.el)['min-height']);\r\n // if (cssMinHeight > 0) {\r\n // let minRow = Math.round(cssMinHeight / this.getCellHeight(true));\r\n // if (row < minRow) {\r\n // row = minRow;\r\n // }\r\n // }\r\n this.el.setAttribute('gs-current-row', String(row));\r\n if (row === 0) {\r\n this.el.style.removeProperty('height');\r\n return this;\r\n }\r\n let cellHeight = this.opts.cellHeight;\r\n let unit = this.opts.cellHeightUnit;\r\n if (!cellHeight)\r\n return this;\r\n this.el.style.height = row * cellHeight + unit;\r\n return this;\r\n }\r\n /** @internal */\r\n _prepareElement(el, triggerAddEvent = false, node) {\r\n if (!node) {\r\n el.classList.add(this.opts.itemClass);\r\n node = this._readAttr(el);\r\n }\r\n el.gridstackNode = node;\r\n node.el = el;\r\n node.grid = this;\r\n let copy = Object.assign({}, node);\r\n node = this.engine.addNode(node, triggerAddEvent);\r\n // write node attr back in case there was collision or we have to fix bad values during addNode()\r\n if (!utils_1.Utils.same(node, copy)) {\r\n this._writeAttr(el, node);\r\n }\r\n this._prepareDragDropByNode(node);\r\n return this;\r\n }\r\n /** @internal call to write position x,y,w,h attributes back to element */\r\n _writePosAttr(el, n) {\r\n if (n.x !== undefined && n.x !== null) {\r\n el.setAttribute('gs-x', String(n.x));\r\n }\r\n if (n.y !== undefined && n.y !== null) {\r\n el.setAttribute('gs-y', String(n.y));\r\n }\r\n if (n.w) {\r\n el.setAttribute('gs-w', String(n.w));\r\n }\r\n if (n.h) {\r\n el.setAttribute('gs-h', String(n.h));\r\n }\r\n return this;\r\n }\r\n /** @internal call to write any default attributes back to element */\r\n _writeAttr(el, node) {\r\n if (!node)\r\n return this;\r\n this._writePosAttr(el, node);\r\n let attrs /*: GridStackWidget but strings */ = {\r\n autoPosition: 'gs-auto-position',\r\n minW: 'gs-min-w',\r\n minH: 'gs-min-h',\r\n maxW: 'gs-max-w',\r\n maxH: 'gs-max-h',\r\n noResize: 'gs-no-resize',\r\n noMove: 'gs-no-move',\r\n locked: 'gs-locked',\r\n id: 'gs-id',\r\n resizeHandles: 'gs-resize-handles'\r\n };\r\n for (const key in attrs) {\r\n if (node[key]) { // 0 is valid for x,y only but done above already and not in list anyway\r\n el.setAttribute(attrs[key], String(node[key]));\r\n }\r\n else {\r\n el.removeAttribute(attrs[key]);\r\n }\r\n }\r\n return this;\r\n }\r\n /** @internal call to read any default attributes from element */\r\n _readAttr(el) {\r\n let node = {};\r\n node.x = utils_1.Utils.toNumber(el.getAttribute('gs-x'));\r\n node.y = utils_1.Utils.toNumber(el.getAttribute('gs-y'));\r\n node.w = utils_1.Utils.toNumber(el.getAttribute('gs-w'));\r\n node.h = utils_1.Utils.toNumber(el.getAttribute('gs-h'));\r\n node.maxW = utils_1.Utils.toNumber(el.getAttribute('gs-max-w'));\r\n node.minW = utils_1.Utils.toNumber(el.getAttribute('gs-min-w'));\r\n node.maxH = utils_1.Utils.toNumber(el.getAttribute('gs-max-h'));\r\n node.minH = utils_1.Utils.toNumber(el.getAttribute('gs-min-h'));\r\n node.autoPosition = utils_1.Utils.toBool(el.getAttribute('gs-auto-position'));\r\n node.noResize = utils_1.Utils.toBool(el.getAttribute('gs-no-resize'));\r\n node.noMove = utils_1.Utils.toBool(el.getAttribute('gs-no-move'));\r\n node.locked = utils_1.Utils.toBool(el.getAttribute('gs-locked'));\r\n node.resizeHandles = el.getAttribute('gs-resize-handles');\r\n node.id = el.getAttribute('gs-id');\r\n // remove any key not found (null or false which is default)\r\n for (const key in node) {\r\n if (!node.hasOwnProperty(key))\r\n return;\r\n if (!node[key] && node[key] !== 0) { // 0 can be valid value (x,y only really)\r\n delete node[key];\r\n }\r\n }\r\n return node;\r\n }\r\n /** @internal */\r\n _setStaticClass() {\r\n let classes = ['grid-stack-static'];\r\n if (this.opts.staticGrid) {\r\n this.el.classList.add(...classes);\r\n this.el.setAttribute('gs-static', 'true');\r\n }\r\n else {\r\n this.el.classList.remove(...classes);\r\n this.el.removeAttribute('gs-static');\r\n }\r\n return this;\r\n }\r\n /**\r\n * called when we are being resized by the window - check if the one Column Mode needs to be turned on/off\r\n * and remember the prev columns we used, or get our count from parent, as well as check for auto cell height (square)\r\n */\r\n onParentResize() {\r\n if (!this.el || !this.el.clientWidth)\r\n return; // return if we're gone or no size yet (will get called again)\r\n let changedColumn = false;\r\n // see if we're nested and take our column count from our parent....\r\n if (this._autoColumn && this.opts._isNested) {\r\n if (this.opts.column !== this.opts._isNested.w) {\r\n changedColumn = true;\r\n this.column(this.opts._isNested.w, 'none');\r\n }\r\n }\r\n else {\r\n // else check for 1 column in/out behavior\r\n let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.minWidth;\r\n if ((this.opts.column === 1) !== oneColumn) {\r\n changedColumn = true;\r\n if (this.opts.animate) {\r\n this.setAnimation(false);\r\n } // 1 <-> 12 is too radical, turn off animation\r\n this.column(oneColumn ? 1 : this._prevColumn);\r\n if (this.opts.animate) {\r\n this.setAnimation(true);\r\n }\r\n }\r\n }\r\n // make the cells content square again\r\n if (this._isAutoCellHeight) {\r\n if (!changedColumn && this.opts.cellHeightThrottle) {\r\n if (!this._cellHeightThrottle) {\r\n this._cellHeightThrottle = utils_1.Utils.throttle(() => this.cellHeight(), this.opts.cellHeightThrottle);\r\n }\r\n this._cellHeightThrottle();\r\n }\r\n else {\r\n // immediate update if we've changed column count or have no threshold\r\n this.cellHeight();\r\n }\r\n }\r\n // finally update any nested grids\r\n this.engine.nodes.forEach(n => {\r\n if (n.subGrid) {\r\n n.subGrid.onParentResize();\r\n }\r\n });\r\n return this;\r\n }\r\n /** add or remove the window size event handler */\r\n _updateWindowResizeEvent(forceRemove = false) {\r\n // only add event if we're not nested (parent will call us) and we're auto sizing cells or supporting oneColumn (i.e. doing work)\r\n const workTodo = (this._isAutoCellHeight || !this.opts.disableOneColumnMode) && !this.opts._isNested;\r\n if (!forceRemove && workTodo && !this._windowResizeBind) {\r\n this._windowResizeBind = this.onParentResize.bind(this); // so we can properly remove later\r\n window.addEventListener('resize', this._windowResizeBind);\r\n }\r\n else if ((forceRemove || !workTodo) && this._windowResizeBind) {\r\n window.removeEventListener('resize', this._windowResizeBind);\r\n delete this._windowResizeBind; // remove link to us so we can free\r\n }\r\n return this;\r\n }\r\n /** @internal convert a potential selector into actual element */\r\n static getElement(els = '.grid-stack-item') { return utils_1.Utils.getElement(els); }\r\n /** @internal */\r\n static getElements(els = '.grid-stack-item') { return utils_1.Utils.getElements(els); }\r\n /** @internal */\r\n static getGridElement(els) { return GridStack.getElement(els); }\r\n /** @internal */\r\n static getGridElements(els) { return utils_1.Utils.getElements(els); }\r\n /** @internal initialize margin top/bottom/left/right and units */\r\n initMargin() {\r\n let data;\r\n let margin = 0;\r\n // support passing multiple values like CSS (ex: '5px 10px 0 20px')\r\n let margins = [];\r\n if (typeof this.opts.margin === 'string') {\r\n margins = this.opts.margin.split(' ');\r\n }\r\n if (margins.length === 2) { // top/bot, left/right like CSS\r\n this.opts.marginTop = this.opts.marginBottom = margins[0];\r\n this.opts.marginLeft = this.opts.marginRight = margins[1];\r\n }\r\n else if (margins.length === 4) { // Clockwise like CSS\r\n this.opts.marginTop = margins[0];\r\n this.opts.marginRight = margins[1];\r\n this.opts.marginBottom = margins[2];\r\n this.opts.marginLeft = margins[3];\r\n }\r\n else {\r\n data = utils_1.Utils.parseHeight(this.opts.margin);\r\n this.opts.marginUnit = data.unit;\r\n margin = this.opts.margin = data.h;\r\n }\r\n // see if top/bottom/left/right need to be set as well\r\n if (this.opts.marginTop === undefined) {\r\n this.opts.marginTop = margin;\r\n }\r\n else {\r\n data = utils_1.Utils.parseHeight(this.opts.marginTop);\r\n this.opts.marginTop = data.h;\r\n delete this.opts.margin;\r\n }\r\n if (this.opts.marginBottom === undefined) {\r\n this.opts.marginBottom = margin;\r\n }\r\n else {\r\n data = utils_1.Utils.parseHeight(this.opts.marginBottom);\r\n this.opts.marginBottom = data.h;\r\n delete this.opts.margin;\r\n }\r\n if (this.opts.marginRight === undefined) {\r\n this.opts.marginRight = margin;\r\n }\r\n else {\r\n data = utils_1.Utils.parseHeight(this.opts.marginRight);\r\n this.opts.marginRight = data.h;\r\n delete this.opts.margin;\r\n }\r\n if (this.opts.marginLeft === undefined) {\r\n this.opts.marginLeft = margin;\r\n }\r\n else {\r\n data = utils_1.Utils.parseHeight(this.opts.marginLeft);\r\n this.opts.marginLeft = data.h;\r\n delete this.opts.margin;\r\n }\r\n this.opts.marginUnit = data.unit; // in case side were spelled out, use those units instead...\r\n if (this.opts.marginTop === this.opts.marginBottom && this.opts.marginLeft === this.opts.marginRight && this.opts.marginTop === this.opts.marginRight) {\r\n this.opts.margin = this.opts.marginTop; // makes it easier to check for no-ops in setMargin()\r\n }\r\n return this;\r\n }\r\n /*\r\n * drag&drop empty stubs that will be implemented in gridstack-dd.ts for non static grid\r\n * so we don't incur the load unless needed.\r\n * NOTE: had to make those methods public in order to define them else as\r\n * GridStack.prototype._setupAcceptWidget = function()\r\n * maybe there is a better way ????\r\n */\r\n /* eslint-disable @typescript-eslint/no-unused-vars */\r\n /**\r\n * call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.\r\n * Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar\r\n * is dynamically create and needs to change later.\r\n * @param dragIn string selector (ex: '.sidebar .grid-stack-item')\r\n * @param dragInOptions options - see DDDragInOpt. (default: {revert: 'invalid', handle: '.grid-stack-item-content', scroll: false, appendTo: 'body'}\r\n **/\r\n static setupDragIn(dragIn, dragInOptions) { }\r\n /**\r\n * Enables/Disables dragging by the user of specific grid element. If you want all items, and have it affect future items, use enableMove() instead. No-op for static grids.\r\n * IF you are looking to prevent an item from moving (due to being pushed around by another during collision) use locked property instead.\r\n * @param els widget or selector to modify.\r\n * @param val if true widget will be draggable.\r\n */\r\n movable(els, val) { return this; }\r\n /**\r\n * Enables/Disables user resizing of specific grid element. If you want all items, and have it affect future items, use enableResize() instead. No-op for static grids.\r\n * @param els widget or selector to modify\r\n * @param val if true widget will be resizable.\r\n */\r\n resizable(els, val) { return this; }\r\n /**\r\n * Temporarily disables widgets moving/resizing.\r\n * If you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.\r\n * Note: no-op for static grid\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(false);\r\n * grid.enableResize(false);\r\n */\r\n disable() { return this; }\r\n /**\r\n * Re-enables widgets moving/resizing - see disable().\r\n * Note: no-op for static grid.\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(true);\r\n * grid.enableResize(true);\r\n */\r\n enable() { return this; }\r\n /**\r\n * Enables/disables widget moving. No-op for static grids.\r\n */\r\n enableMove(doEnable) { return this; }\r\n /**\r\n * Enables/disables widget resizing. No-op for static grids.\r\n */\r\n enableResize(doEnable) { return this; }\r\n /** @internal called to add drag over support to support widgets */\r\n _setupAcceptWidget() { return this; }\r\n /** @internal called to setup a trash drop zone if the user specifies it */\r\n _setupRemoveDrop() { return this; }\r\n /** @internal prepares the element for drag&drop **/\r\n _prepareDragDropByNode(node) { return this; }\r\n /** @internal handles actual drag/resize start **/\r\n _onStartMoving(el, event, ui, node, cellWidth, cellHeight) { return; }\r\n /** @internal handles actual drag/resize **/\r\n _dragOrResize(el, event, ui, node, cellWidth, cellHeight) { return; }\r\n /** @internal called when a node leaves our area (mouse out or shape outside) **/\r\n _leave(el, helper) { return; }\r\n}\r\nexports.GridStack = GridStack;\r\n/** scoping so users can call GridStack.Utils.sort() for example */\r\nGridStack.Utils = utils_1.Utils;\r\n/** scoping so users can call new GridStack.Engine(12) for example */\r\nGridStack.Engine = gridstack_engine_1.GridStackEngine;\r\n//# sourceMappingURL=gridstack.js.map","\"use strict\";\r\n/**\r\n * dd-base-impl.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDBaseImplement = void 0;\r\nclass DDBaseImplement {\r\n constructor() {\r\n /** @internal */\r\n this._disabled = false;\r\n /** @internal */\r\n this._eventRegister = {};\r\n }\r\n /** returns the enable state, but you have to call enable()/disable() to change (as other things need to happen) */\r\n get disabled() { return this._disabled; }\r\n on(event, callback) {\r\n this._eventRegister[event] = callback;\r\n }\r\n off(event) {\r\n delete this._eventRegister[event];\r\n }\r\n enable() {\r\n this._disabled = false;\r\n }\r\n disable() {\r\n this._disabled = true;\r\n }\r\n destroy() {\r\n delete this._eventRegister;\r\n }\r\n triggerEvent(eventName, event) {\r\n if (!this.disabled && this._eventRegister && this._eventRegister[eventName])\r\n return this._eventRegister[eventName](event);\r\n }\r\n}\r\nexports.DDBaseImplement = DDBaseImplement;\r\n//# sourceMappingURL=dd-base-impl.js.map","\"use strict\";\r\n/**\r\n * dd-draggable.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDDraggable = void 0;\r\nconst dd_manager_1 = require(\"./dd-manager\");\r\nconst dd_utils_1 = require(\"./dd-utils\");\r\nconst dd_base_impl_1 = require(\"./dd-base-impl\");\r\nclass DDDraggable extends dd_base_impl_1.DDBaseImplement {\r\n constructor(el, option = {}) {\r\n super();\r\n /** @internal */\r\n this.dragging = false;\r\n /** @internal TODO: set to public as called by DDDroppable! */\r\n this.ui = () => {\r\n const containmentEl = this.el.parentElement;\r\n const containmentRect = containmentEl.getBoundingClientRect();\r\n const offset = this.helper.getBoundingClientRect();\r\n return {\r\n position: {\r\n top: offset.top - containmentRect.top,\r\n left: offset.left - containmentRect.left\r\n }\r\n /* not used by GridStack for now...\r\n helper: [this.helper], //The object arr representing the helper that's being dragged.\r\n offset: { top: offset.top, left: offset.left } // Current offset position of the helper as { top, left } object.\r\n */\r\n };\r\n };\r\n this.el = el;\r\n this.option = option;\r\n // get the element that is actually supposed to be dragged by\r\n let className = option.handle.substring(1);\r\n this.dragEl = el.classList.contains(className) ? el : el.querySelector(option.handle) || el;\r\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\r\n this._dragStart = this._dragStart.bind(this);\r\n this._drag = this._drag.bind(this);\r\n this._dragEnd = this._dragEnd.bind(this);\r\n this.enable();\r\n }\r\n on(event, callback) {\r\n super.on(event, callback);\r\n }\r\n off(event) {\r\n super.off(event);\r\n }\r\n enable() {\r\n super.enable();\r\n this.dragEl.draggable = true;\r\n this.dragEl.addEventListener('dragstart', this._dragStart);\r\n this.el.classList.remove('ui-draggable-disabled');\r\n this.el.classList.add('ui-draggable');\r\n }\r\n disable(forDestroy = false) {\r\n super.disable();\r\n this.dragEl.removeAttribute('draggable');\r\n this.dragEl.removeEventListener('dragstart', this._dragStart);\r\n this.el.classList.remove('ui-draggable');\r\n if (!forDestroy)\r\n this.el.classList.add('ui-draggable-disabled');\r\n }\r\n destroy() {\r\n if (this.dragging) {\r\n // Destroy while dragging should remove dragend listener and manually trigger\r\n // dragend, otherwise dragEnd can't perform dragstop because eventRegistry is\r\n // destroyed.\r\n this._dragEnd({});\r\n }\r\n this.disable(true);\r\n delete this.el;\r\n delete this.helper;\r\n delete this.option;\r\n super.destroy();\r\n }\r\n updateOption(opts) {\r\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\r\n return this;\r\n }\r\n /** @internal */\r\n _dragStart(event) {\r\n dd_manager_1.DDManager.dragElement = this;\r\n this.helper = this._createHelper(event);\r\n this._setupHelperContainmentStyle();\r\n this.dragOffset = this._getDragOffset(event, this.el, this.helperContainment);\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { target: this.el, type: 'dragstart' });\r\n if (this.helper !== this.el) {\r\n this._setupDragFollowNodeNotifyStart(ev);\r\n // immediately set external helper initial position to avoid flickering behavior and unnecessary looping in `_packNodes()`\r\n this._dragFollow(event);\r\n }\r\n else {\r\n this.dragFollowTimer = window.setTimeout(() => {\r\n delete this.dragFollowTimer;\r\n this._setupDragFollowNodeNotifyStart(ev);\r\n }, 0);\r\n }\r\n this._cancelDragGhost(event);\r\n }\r\n /** @internal */\r\n _setupDragFollowNodeNotifyStart(ev) {\r\n this._setupHelperStyle();\r\n document.addEventListener('dragover', this._drag, DDDraggable.dragEventListenerOption);\r\n this.dragEl.addEventListener('dragend', this._dragEnd);\r\n if (this.option.start) {\r\n this.option.start(ev, this.ui());\r\n }\r\n this.dragging = true;\r\n this.helper.classList.add('ui-draggable-dragging');\r\n this.triggerEvent('dragstart', ev);\r\n return this;\r\n }\r\n /** @internal */\r\n _drag(event) {\r\n // Safari: prevent default to allow drop to happen instead of reverting back (with animation) and delaying dragend #1541\r\n // https://stackoverflow.com/questions/61760755/how-to-fire-dragend-event-immediately\r\n event.preventDefault();\r\n this._dragFollow(event);\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { target: this.el, type: 'drag' });\r\n if (this.option.drag) {\r\n this.option.drag(ev, this.ui());\r\n }\r\n this.triggerEvent('drag', ev);\r\n }\r\n /** @internal */\r\n _dragEnd(event) {\r\n if (this.dragFollowTimer) {\r\n clearTimeout(this.dragFollowTimer);\r\n delete this.dragFollowTimer;\r\n return;\r\n }\r\n else {\r\n if (this.paintTimer) {\r\n cancelAnimationFrame(this.paintTimer);\r\n }\r\n document.removeEventListener('dragover', this._drag, DDDraggable.dragEventListenerOption);\r\n this.dragEl.removeEventListener('dragend', this._dragEnd);\r\n }\r\n this.dragging = false;\r\n this.helper.classList.remove('ui-draggable-dragging');\r\n this.helperContainment.style.position = this.parentOriginStylePosition || null;\r\n if (this.helper === this.el) {\r\n this._removeHelperStyle();\r\n }\r\n else {\r\n this.helper.remove();\r\n }\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { target: this.el, type: 'dragstop' });\r\n if (this.option.stop) {\r\n this.option.stop(ev); // Note: ui() not used by gridstack so don't pass\r\n }\r\n this.triggerEvent('dragstop', ev);\r\n delete dd_manager_1.DDManager.dragElement;\r\n delete this.helper;\r\n }\r\n /** @internal create a clone copy (or user defined method) of the original drag item if set */\r\n _createHelper(event) {\r\n let helper = this.el;\r\n if (typeof this.option.helper === 'function') {\r\n helper = this.option.helper(event);\r\n }\r\n else if (this.option.helper === 'clone') {\r\n helper = dd_utils_1.DDUtils.clone(this.el);\r\n }\r\n if (!document.body.contains(helper)) {\r\n dd_utils_1.DDUtils.appendTo(helper, this.option.appendTo === 'parent' ? this.el.parentNode : this.option.appendTo);\r\n }\r\n if (helper === this.el) {\r\n this.dragElementOriginStyle = DDDraggable.originStyleProp.map(prop => this.el.style[prop]);\r\n }\r\n return helper;\r\n }\r\n /** @internal */\r\n _setupHelperStyle() {\r\n // TODO: set all at once with style.cssText += ... ? https://stackoverflow.com/questions/3968593\r\n const rec = this.helper.getBoundingClientRect();\r\n const style = this.helper.style;\r\n style.pointerEvents = 'none';\r\n style['min-width'] = 0; // since we no longer relative to our parent and we don't resize anyway (normally 100/#column %)\r\n style.width = this.dragOffset.width + 'px';\r\n style.height = this.dragOffset.height + 'px';\r\n style.willChange = 'left, top';\r\n style.position = 'fixed'; // let us drag between grids by not clipping as parent .grid-stack is position: 'relative'\r\n style.left = rec.left + 'px';\r\n style.top = rec.top + 'px';\r\n style.transition = 'none'; // show up instantly\r\n setTimeout(() => {\r\n if (this.helper) {\r\n style.transition = null; // recover animation\r\n }\r\n }, 0);\r\n return this;\r\n }\r\n /** @internal */\r\n _removeHelperStyle() {\r\n // don't bother restoring styles if we're gonna remove anyway...\r\n let node = this.helper ? this.helper.gridstackNode : undefined;\r\n if (this.dragElementOriginStyle && (!node || !node._isAboutToRemove)) {\r\n DDDraggable.originStyleProp.forEach(prop => {\r\n this.helper.style[prop] = this.dragElementOriginStyle[prop] || null;\r\n });\r\n // show up instantly otherwise we animate to off the grid when switching back to 'absolute' from 'fixed'\r\n this.helper.style.transition = 'none';\r\n setTimeout(() => {\r\n if (this.helper) {\r\n this.helper.style.transition = this.dragElementOriginStyle['transition']; // recover animation\r\n }\r\n }, 0);\r\n }\r\n delete this.dragElementOriginStyle;\r\n return this;\r\n }\r\n /** @internal */\r\n _dragFollow(event) {\r\n if (this.paintTimer) {\r\n cancelAnimationFrame(this.paintTimer);\r\n }\r\n this.paintTimer = requestAnimationFrame(() => {\r\n delete this.paintTimer;\r\n const offset = this.dragOffset;\r\n let containmentRect = { left: 0, top: 0 };\r\n if (this.helper.style.position === 'absolute') {\r\n const { left, top } = this.helperContainment.getBoundingClientRect();\r\n containmentRect = { left, top };\r\n }\r\n this.helper.style.left = event.clientX + offset.offsetLeft - containmentRect.left + 'px';\r\n this.helper.style.top = event.clientY + offset.offsetTop - containmentRect.top + 'px';\r\n });\r\n }\r\n /** @internal */\r\n _setupHelperContainmentStyle() {\r\n this.helperContainment = this.helper.parentElement;\r\n if (this.helper.style.position !== 'fixed') {\r\n this.parentOriginStylePosition = this.helperContainment.style.position;\r\n if (window.getComputedStyle(this.helperContainment).position.match(/static/)) {\r\n this.helperContainment.style.position = 'relative';\r\n }\r\n }\r\n return this;\r\n }\r\n /** @internal prevent the default ghost image to be created (which has wrong as we move the helper/element instead\r\n * (legacy jquery UI code updates the top/left of the item).\r\n * TODO: maybe use mouse event instead of HTML5 drag as we have to work around it anyway, or change code to not update\r\n * the actual grid-item but move the ghost image around (and special case jq version) ?\r\n **/\r\n _cancelDragGhost(e) {\r\n /* doesn't seem to do anything...\r\n let t = e.dataTransfer;\r\n t.effectAllowed = 'none';\r\n t.dropEffect = 'none';\r\n t.setData('text', '');\r\n */\r\n // NOTE: according to spec (and required by Safari see #1540) the image has to be visible in the browser (in dom and not hidden) so make it a 1px div\r\n let img = document.createElement('div');\r\n img.style.width = '1px';\r\n img.style.height = '1px';\r\n img.style.position = 'fixed'; // prevent unwanted scrollbar\r\n document.body.appendChild(img);\r\n e.dataTransfer.setDragImage(img, 0, 0);\r\n setTimeout(() => document.body.removeChild(img)); // nuke once drag had a chance to grab this 'image'\r\n e.stopPropagation();\r\n return this;\r\n }\r\n /** @internal */\r\n _getDragOffset(event, el, parent) {\r\n // in case ancestor has transform/perspective css properties that change the viewpoint\r\n let xformOffsetX = 0;\r\n let xformOffsetY = 0;\r\n if (parent) {\r\n const testEl = document.createElement('div');\r\n dd_utils_1.DDUtils.addElStyles(testEl, {\r\n opacity: '0',\r\n position: 'fixed',\r\n top: 0 + 'px',\r\n left: 0 + 'px',\r\n width: '1px',\r\n height: '1px',\r\n zIndex: '-999999',\r\n });\r\n parent.appendChild(testEl);\r\n const testElPosition = testEl.getBoundingClientRect();\r\n parent.removeChild(testEl);\r\n xformOffsetX = testElPosition.left;\r\n xformOffsetY = testElPosition.top;\r\n // TODO: scale ?\r\n }\r\n const targetOffset = el.getBoundingClientRect();\r\n return {\r\n left: targetOffset.left,\r\n top: targetOffset.top,\r\n offsetLeft: -event.clientX + targetOffset.left - xformOffsetX,\r\n offsetTop: -event.clientY + targetOffset.top - xformOffsetY,\r\n width: targetOffset.width,\r\n height: targetOffset.height\r\n };\r\n }\r\n}\r\nexports.DDDraggable = DDDraggable;\r\n/** @internal #1541 can't have {passive: true} on Safari as otherwise it reverts animate back to old location on drop */\r\nDDDraggable.dragEventListenerOption = true; // DDUtils.isEventSupportPassiveOption ? { capture: true, passive: true } : true;\r\n/** @internal */\r\nDDDraggable.originStyleProp = ['transition', 'pointerEvents', 'position',\r\n 'left', 'top', 'opacity', 'zIndex', 'width', 'height', 'willChange', 'min-width'];\r\n//# sourceMappingURL=dd-draggable.js.map","\"use strict\";\r\n/**\r\n * dd-droppable.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDDroppable = void 0;\r\nconst dd_manager_1 = require(\"./dd-manager\");\r\nconst dd_base_impl_1 = require(\"./dd-base-impl\");\r\nconst dd_utils_1 = require(\"./dd-utils\");\r\n// TEST let count = 0;\r\nclass DDDroppable extends dd_base_impl_1.DDBaseImplement {\r\n constructor(el, opts = {}) {\r\n super();\r\n this.el = el;\r\n this.option = opts;\r\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\r\n this._dragEnter = this._dragEnter.bind(this);\r\n this._dragOver = this._dragOver.bind(this);\r\n this._dragLeave = this._dragLeave.bind(this);\r\n this._drop = this._drop.bind(this);\r\n this.el.classList.add('ui-droppable');\r\n this.el.addEventListener('dragenter', this._dragEnter);\r\n this._setupAccept();\r\n }\r\n on(event, callback) {\r\n super.on(event, callback);\r\n }\r\n off(event) {\r\n super.off(event);\r\n }\r\n enable() {\r\n if (!this.disabled)\r\n return;\r\n super.enable();\r\n this.el.classList.remove('ui-droppable-disabled');\r\n this.el.addEventListener('dragenter', this._dragEnter);\r\n }\r\n disable(forDestroy = false) {\r\n if (this.disabled)\r\n return;\r\n super.disable();\r\n if (!forDestroy)\r\n this.el.classList.add('ui-droppable-disabled');\r\n this.el.removeEventListener('dragenter', this._dragEnter);\r\n }\r\n destroy() {\r\n this._removeLeaveCallbacks();\r\n this.disable(true);\r\n this.el.classList.remove('ui-droppable');\r\n this.el.classList.remove('ui-droppable-disabled');\r\n super.destroy();\r\n }\r\n updateOption(opts) {\r\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\r\n this._setupAccept();\r\n return this;\r\n }\r\n /** @internal called when the cursor enters our area - prepare for a possible drop and track leaving */\r\n _dragEnter(event) {\r\n // TEST console.log(`${count++} Enter ${(this.el as GridHTMLElement).gridstack.opts.id}`);\r\n if (!this._canDrop())\r\n return;\r\n event.preventDefault();\r\n event.stopPropagation();\r\n // ignore multiple 'dragenter' as we go over existing items\r\n if (this.moving)\r\n return;\r\n this.moving = true;\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { target: this.el, type: 'dropover' });\r\n if (this.option.over) {\r\n this.option.over(ev, this._ui(dd_manager_1.DDManager.dragElement));\r\n }\r\n this.triggerEvent('dropover', ev);\r\n this.el.addEventListener('dragover', this._dragOver);\r\n this.el.addEventListener('drop', this._drop);\r\n this.el.addEventListener('dragleave', this._dragLeave);\r\n // Update: removed that as it causes nested grids to no receive dragenter events when parent drags and sets this for #992. not seeing cursor flicker (chrome).\r\n // this.el.classList.add('ui-droppable-over');\r\n // make sure when we enter this, that the last one gets a leave to correctly cleanup as we don't always do\r\n if (DDDroppable.lastActive && DDDroppable.lastActive !== this) {\r\n DDDroppable.lastActive._dragLeave(event, true);\r\n }\r\n DDDroppable.lastActive = this;\r\n }\r\n /** @internal called when an moving to drop item is being dragged over - do nothing but eat the event */\r\n _dragOver(event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n /** @internal called when the item is leaving our area, stop tracking if we had moving item */\r\n _dragLeave(event, forceLeave) {\r\n var _a;\r\n // TEST console.log(`${count++} Leave ${(this.el as GridHTMLElement).gridstack.opts.id}`);\r\n event.preventDefault();\r\n event.stopPropagation();\r\n // ignore leave events on our children (we get them when starting to drag our items)\r\n // but exclude nested grids since we would still be leaving ourself, \r\n // but don't handle leave if we're dragging a nested grid around\r\n if (!forceLeave) {\r\n let onChild = dd_utils_1.DDUtils.inside(event, this.el);\r\n let drag = dd_manager_1.DDManager.dragElement.el;\r\n if (onChild && !((_a = drag.gridstackNode) === null || _a === void 0 ? void 0 : _a.subGrid)) { // dragging a nested grid ?\r\n let nestedEl = this.el.gridstack.engine.nodes.filter(n => n.subGrid).map(n => n.subGrid.el);\r\n onChild = !nestedEl.some(el => dd_utils_1.DDUtils.inside(event, el));\r\n }\r\n if (onChild)\r\n return;\r\n }\r\n if (this.moving) {\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { target: this.el, type: 'dropout' });\r\n if (this.option.out) {\r\n this.option.out(ev, this._ui(dd_manager_1.DDManager.dragElement));\r\n }\r\n this.triggerEvent('dropout', ev);\r\n }\r\n this._removeLeaveCallbacks();\r\n if (DDDroppable.lastActive === this) {\r\n delete DDDroppable.lastActive;\r\n }\r\n }\r\n /** @internal item is being dropped on us - call the client drop event */\r\n _drop(event) {\r\n if (!this.moving)\r\n return; // should not have received event...\r\n event.preventDefault();\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { target: this.el, type: 'drop' });\r\n if (this.option.drop) {\r\n this.option.drop(ev, this._ui(dd_manager_1.DDManager.dragElement));\r\n }\r\n this.triggerEvent('drop', ev);\r\n this._removeLeaveCallbacks();\r\n }\r\n /** @internal called to remove callbacks when leaving or dropping */\r\n _removeLeaveCallbacks() {\r\n if (!this.moving) {\r\n return;\r\n }\r\n delete this.moving;\r\n this.el.removeEventListener('dragover', this._dragOver);\r\n this.el.removeEventListener('drop', this._drop);\r\n this.el.removeEventListener('dragleave', this._dragLeave);\r\n // Update: removed that as it causes nested grids to no receive dragenter events when parent drags and sets this for #992. not seeing cursor flicker (chrome).\r\n // this.el.classList.remove('ui-droppable-over');\r\n }\r\n /** @internal */\r\n _canDrop() {\r\n return dd_manager_1.DDManager.dragElement && (!this.accept || this.accept(dd_manager_1.DDManager.dragElement.el));\r\n }\r\n /** @internal */\r\n _setupAccept() {\r\n if (this.option.accept && typeof this.option.accept === 'string') {\r\n this.accept = (el) => {\r\n return el.matches(this.option.accept);\r\n };\r\n }\r\n else {\r\n this.accept = this.option.accept;\r\n }\r\n return this;\r\n }\r\n /** @internal */\r\n _ui(drag) {\r\n return Object.assign({ draggable: drag.el }, drag.ui());\r\n }\r\n}\r\nexports.DDDroppable = DDDroppable;\r\n//# sourceMappingURL=dd-droppable.js.map","\"use strict\";\r\n/**\r\n * dd-elements.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDElement = void 0;\r\nconst dd_resizable_1 = require(\"./dd-resizable\");\r\nconst dd_draggable_1 = require(\"./dd-draggable\");\r\nconst dd_droppable_1 = require(\"./dd-droppable\");\r\nclass DDElement {\r\n constructor(el) {\r\n this.el = el;\r\n }\r\n static init(el) {\r\n if (!el.ddElement) {\r\n el.ddElement = new DDElement(el);\r\n }\r\n return el.ddElement;\r\n }\r\n on(eventName, callback) {\r\n if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\r\n this.ddDraggable.on(eventName, callback);\r\n }\r\n else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\r\n this.ddDroppable.on(eventName, callback);\r\n }\r\n else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\r\n this.ddResizable.on(eventName, callback);\r\n }\r\n return this;\r\n }\r\n off(eventName) {\r\n if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\r\n this.ddDraggable.off(eventName);\r\n }\r\n else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\r\n this.ddDroppable.off(eventName);\r\n }\r\n else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\r\n this.ddResizable.off(eventName);\r\n }\r\n return this;\r\n }\r\n setupDraggable(opts) {\r\n if (!this.ddDraggable) {\r\n this.ddDraggable = new dd_draggable_1.DDDraggable(this.el, opts);\r\n }\r\n else {\r\n this.ddDraggable.updateOption(opts);\r\n }\r\n return this;\r\n }\r\n cleanDraggable() {\r\n if (this.ddDraggable) {\r\n this.ddDraggable.destroy();\r\n delete this.ddDraggable;\r\n }\r\n return this;\r\n }\r\n setupResizable(opts) {\r\n if (!this.ddResizable) {\r\n this.ddResizable = new dd_resizable_1.DDResizable(this.el, opts);\r\n }\r\n else {\r\n this.ddResizable.updateOption(opts);\r\n }\r\n return this;\r\n }\r\n cleanResizable() {\r\n if (this.ddResizable) {\r\n this.ddResizable.destroy();\r\n delete this.ddResizable;\r\n }\r\n return this;\r\n }\r\n setupDroppable(opts) {\r\n if (!this.ddDroppable) {\r\n this.ddDroppable = new dd_droppable_1.DDDroppable(this.el, opts);\r\n }\r\n else {\r\n this.ddDroppable.updateOption(opts);\r\n }\r\n return this;\r\n }\r\n cleanDroppable() {\r\n if (this.ddDroppable) {\r\n this.ddDroppable.destroy();\r\n delete this.ddDroppable;\r\n }\r\n return this;\r\n }\r\n}\r\nexports.DDElement = DDElement;\r\n//# sourceMappingURL=dd-element.js.map","\"use strict\";\r\n/**\r\n * dd-manager.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDManager = void 0;\r\nclass DDManager {\r\n}\r\nexports.DDManager = DDManager;\r\n//# sourceMappingURL=dd-manager.js.map","\"use strict\";\r\n/**\r\n * dd-resizable-handle.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDResizableHandle = void 0;\r\nclass DDResizableHandle {\r\n constructor(host, direction, option) {\r\n /** @internal true after we've moved enough pixels to start a resize */\r\n this.moving = false;\r\n this.host = host;\r\n this.dir = direction;\r\n this.option = option;\r\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\r\n this._mouseDown = this._mouseDown.bind(this);\r\n this._mouseMove = this._mouseMove.bind(this);\r\n this._mouseUp = this._mouseUp.bind(this);\r\n this._init();\r\n }\r\n /** @internal */\r\n _init() {\r\n const el = document.createElement('div');\r\n el.classList.add('ui-resizable-handle');\r\n el.classList.add(`${DDResizableHandle.prefix}${this.dir}`);\r\n el.style.zIndex = '100';\r\n el.style.userSelect = 'none';\r\n this.el = el;\r\n this.host.appendChild(this.el);\r\n this.el.addEventListener('mousedown', this._mouseDown);\r\n return this;\r\n }\r\n /** call this when resize handle needs to be removed and cleaned up */\r\n destroy() {\r\n if (this.moving)\r\n this._mouseUp(this.mouseDownEvent);\r\n this.el.removeEventListener('mousedown', this._mouseDown);\r\n this.host.removeChild(this.el);\r\n delete this.el;\r\n delete this.host;\r\n return this;\r\n }\r\n /** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */\r\n _mouseDown(e) {\r\n e.preventDefault();\r\n this.mouseDownEvent = e;\r\n document.addEventListener('mousemove', this._mouseMove, true); // capture, not bubble\r\n document.addEventListener('mouseup', this._mouseUp);\r\n }\r\n /** @internal */\r\n _mouseMove(e) {\r\n let s = this.mouseDownEvent;\r\n // don't start unless we've moved at least 3 pixels\r\n if (!this.moving && Math.abs(e.x - s.x) + Math.abs(e.y - s.y) > 2) {\r\n this.moving = true;\r\n this._triggerEvent('start', this.mouseDownEvent);\r\n }\r\n else if (this.moving) {\r\n this._triggerEvent('move', e);\r\n }\r\n }\r\n /** @internal */\r\n _mouseUp(e) {\r\n if (this.moving) {\r\n this._triggerEvent('stop', e);\r\n }\r\n document.removeEventListener('mousemove', this._mouseMove, true);\r\n document.removeEventListener('mouseup', this._mouseUp);\r\n delete this.moving;\r\n delete this.mouseDownEvent;\r\n }\r\n /** @internal */\r\n _triggerEvent(name, event) {\r\n if (this.option[name])\r\n this.option[name](event);\r\n return this;\r\n }\r\n}\r\nexports.DDResizableHandle = DDResizableHandle;\r\n/** @internal */\r\nDDResizableHandle.prefix = 'ui-resizable-';\r\n//# sourceMappingURL=dd-resizable-handle.js.map","\"use strict\";\r\n/**\r\n * dd-resizable.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDResizable = void 0;\r\nconst dd_resizable_handle_1 = require(\"./dd-resizable-handle\");\r\nconst dd_base_impl_1 = require(\"./dd-base-impl\");\r\nconst dd_utils_1 = require(\"./dd-utils\");\r\nconst utils_1 = require(\"../utils\");\r\nclass DDResizable extends dd_base_impl_1.DDBaseImplement {\r\n constructor(el, opts = {}) {\r\n super();\r\n /** @internal */\r\n this._showHandlers = () => {\r\n this.el.classList.remove('ui-resizable-autohide');\r\n };\r\n /** @internal */\r\n this._hideHandlers = () => {\r\n this.el.classList.add('ui-resizable-autohide');\r\n };\r\n /** @internal */\r\n this._ui = () => {\r\n const containmentEl = this.el.parentElement;\r\n const containmentRect = containmentEl.getBoundingClientRect();\r\n const newRect = {\r\n width: this.originalRect.width,\r\n height: this.originalRect.height + this.scrolled,\r\n left: this.originalRect.left,\r\n top: this.originalRect.top - this.scrolled\r\n };\r\n const rect = this.temporalRect || newRect;\r\n return {\r\n position: {\r\n left: rect.left - containmentRect.left,\r\n top: rect.top - containmentRect.top\r\n },\r\n size: {\r\n width: rect.width,\r\n height: rect.height\r\n }\r\n /* Gridstack ONLY needs position set above... keep around in case.\r\n element: [this.el], // The object representing the element to be resized\r\n helper: [], // TODO: not support yet - The object representing the helper that's being resized\r\n originalElement: [this.el],// we don't wrap here, so simplify as this.el //The object representing the original element before it is wrapped\r\n originalPosition: { // The position represented as { left, top } before the resizable is resized\r\n left: this.originalRect.left - containmentRect.left,\r\n top: this.originalRect.top - containmentRect.top\r\n },\r\n originalSize: { // The size represented as { width, height } before the resizable is resized\r\n width: this.originalRect.width,\r\n height: this.originalRect.height\r\n }\r\n */\r\n };\r\n };\r\n this.el = el;\r\n this.option = opts;\r\n this.enable();\r\n this._setupAutoHide();\r\n this._setupHandlers();\r\n }\r\n on(event, callback) {\r\n super.on(event, callback);\r\n }\r\n off(event) {\r\n super.off(event);\r\n }\r\n enable() {\r\n super.enable();\r\n this.el.classList.add('ui-resizable');\r\n this.el.classList.remove('ui-resizable-disabled');\r\n }\r\n disable() {\r\n super.disable();\r\n this.el.classList.add('ui-resizable-disabled');\r\n this.el.classList.remove('ui-resizable');\r\n }\r\n destroy() {\r\n this._removeHandlers();\r\n if (this.option.autoHide) {\r\n this.el.removeEventListener('mouseover', this._showHandlers);\r\n this.el.removeEventListener('mouseout', this._hideHandlers);\r\n }\r\n this.el.classList.remove('ui-resizable');\r\n delete this.el;\r\n super.destroy();\r\n }\r\n updateOption(opts) {\r\n let updateHandles = (opts.handles && opts.handles !== this.option.handles);\r\n let updateAutoHide = (opts.autoHide && opts.autoHide !== this.option.autoHide);\r\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\r\n if (updateHandles) {\r\n this._removeHandlers();\r\n this._setupHandlers();\r\n }\r\n if (updateAutoHide) {\r\n this._setupAutoHide();\r\n }\r\n return this;\r\n }\r\n /** @internal */\r\n _setupAutoHide() {\r\n if (this.option.autoHide) {\r\n this.el.classList.add('ui-resizable-autohide');\r\n // use mouseover/mouseout instead of mouseenter/mouseleave to get better performance;\r\n this.el.addEventListener('mouseover', this._showHandlers);\r\n this.el.addEventListener('mouseout', this._hideHandlers);\r\n }\r\n else {\r\n this.el.classList.remove('ui-resizable-autohide');\r\n this.el.removeEventListener('mouseover', this._showHandlers);\r\n this.el.removeEventListener('mouseout', this._hideHandlers);\r\n }\r\n return this;\r\n }\r\n /** @internal */\r\n _setupHandlers() {\r\n let handlerDirection = this.option.handles || 'e,s,se';\r\n if (handlerDirection === 'all') {\r\n handlerDirection = 'n,e,s,w,se,sw,ne,nw';\r\n }\r\n this.handlers = handlerDirection.split(',')\r\n .map(dir => dir.trim())\r\n .map(dir => new dd_resizable_handle_1.DDResizableHandle(this.el, dir, {\r\n start: (event) => {\r\n this._resizeStart(event);\r\n },\r\n stop: (event) => {\r\n this._resizeStop(event);\r\n },\r\n move: (event) => {\r\n this._resizing(event, dir);\r\n }\r\n }));\r\n return this;\r\n }\r\n /** @internal */\r\n _resizeStart(event) {\r\n this.originalRect = this.el.getBoundingClientRect();\r\n this.scrollEl = utils_1.Utils.getScrollElement(this.el);\r\n this.scrollY = this.scrollEl.scrollTop;\r\n this.scrolled = 0;\r\n this.startEvent = event;\r\n this._setupHelper();\r\n this._applyChange();\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { type: 'resizestart', target: this.el });\r\n if (this.option.start) {\r\n this.option.start(ev, this._ui());\r\n }\r\n this.el.classList.add('ui-resizable-resizing');\r\n this.triggerEvent('resizestart', ev);\r\n return this;\r\n }\r\n /** @internal */\r\n _resizing(event, dir) {\r\n this.scrolled = this.scrollEl.scrollTop - this.scrollY;\r\n this.temporalRect = this._getChange(event, dir);\r\n this._applyChange();\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { type: 'resize', target: this.el });\r\n if (this.option.resize) {\r\n this.option.resize(ev, this._ui());\r\n }\r\n this.triggerEvent('resize', ev);\r\n return this;\r\n }\r\n /** @internal */\r\n _resizeStop(event) {\r\n const ev = dd_utils_1.DDUtils.initEvent(event, { type: 'resizestop', target: this.el });\r\n if (this.option.stop) {\r\n this.option.stop(ev); // Note: ui() not used by gridstack so don't pass\r\n }\r\n this.el.classList.remove('ui-resizable-resizing');\r\n this.triggerEvent('resizestop', ev);\r\n this._cleanHelper();\r\n delete this.startEvent;\r\n delete this.originalRect;\r\n delete this.temporalRect;\r\n delete this.scrollY;\r\n delete this.scrolled;\r\n return this;\r\n }\r\n /** @internal */\r\n _setupHelper() {\r\n this.elOriginStyleVal = DDResizable._originStyleProp.map(prop => this.el.style[prop]);\r\n this.parentOriginStylePosition = this.el.parentElement.style.position;\r\n if (window.getComputedStyle(this.el.parentElement).position.match(/static/)) {\r\n this.el.parentElement.style.position = 'relative';\r\n }\r\n this.el.style.position = 'absolute';\r\n this.el.style.opacity = '0.8';\r\n return this;\r\n }\r\n /** @internal */\r\n _cleanHelper() {\r\n DDResizable._originStyleProp.forEach((prop, i) => {\r\n this.el.style[prop] = this.elOriginStyleVal[i] || null;\r\n });\r\n this.el.parentElement.style.position = this.parentOriginStylePosition || null;\r\n return this;\r\n }\r\n /** @internal */\r\n _getChange(event, dir) {\r\n const oEvent = this.startEvent;\r\n const newRect = {\r\n width: this.originalRect.width,\r\n height: this.originalRect.height + this.scrolled,\r\n left: this.originalRect.left,\r\n top: this.originalRect.top - this.scrolled\r\n };\r\n const offsetX = event.clientX - oEvent.clientX;\r\n const offsetY = event.clientY - oEvent.clientY;\r\n if (dir.indexOf('e') > -1) {\r\n newRect.width += offsetX;\r\n }\r\n else if (dir.indexOf('w') > -1) {\r\n newRect.width -= offsetX;\r\n newRect.left += offsetX;\r\n }\r\n if (dir.indexOf('s') > -1) {\r\n newRect.height += offsetY;\r\n }\r\n else if (dir.indexOf('n') > -1) {\r\n newRect.height -= offsetY;\r\n newRect.top += offsetY;\r\n }\r\n const constrain = this._constrainSize(newRect.width, newRect.height);\r\n if (Math.round(newRect.width) !== Math.round(constrain.width)) { // round to ignore slight round-off errors\r\n if (dir.indexOf('w') > -1) {\r\n newRect.left += newRect.width - constrain.width;\r\n }\r\n newRect.width = constrain.width;\r\n }\r\n if (Math.round(newRect.height) !== Math.round(constrain.height)) {\r\n if (dir.indexOf('n') > -1) {\r\n newRect.top += newRect.height - constrain.height;\r\n }\r\n newRect.height = constrain.height;\r\n }\r\n return newRect;\r\n }\r\n /** @internal constrain the size to the set min/max values */\r\n _constrainSize(oWidth, oHeight) {\r\n const maxWidth = this.option.maxWidth || Number.MAX_SAFE_INTEGER;\r\n const minWidth = this.option.minWidth || oWidth;\r\n const maxHeight = this.option.maxHeight || Number.MAX_SAFE_INTEGER;\r\n const minHeight = this.option.minHeight || oHeight;\r\n const width = Math.min(maxWidth, Math.max(minWidth, oWidth));\r\n const height = Math.min(maxHeight, Math.max(minHeight, oHeight));\r\n return { width, height };\r\n }\r\n /** @internal */\r\n _applyChange() {\r\n let containmentRect = { left: 0, top: 0, width: 0, height: 0 };\r\n if (this.el.style.position === 'absolute') {\r\n const containmentEl = this.el.parentElement;\r\n const { left, top } = containmentEl.getBoundingClientRect();\r\n containmentRect = { left, top, width: 0, height: 0 };\r\n }\r\n if (!this.temporalRect)\r\n return this;\r\n Object.keys(this.temporalRect).forEach(key => {\r\n const value = this.temporalRect[key];\r\n this.el.style[key] = value - containmentRect[key] + 'px';\r\n });\r\n return this;\r\n }\r\n /** @internal */\r\n _removeHandlers() {\r\n this.handlers.forEach(handle => handle.destroy());\r\n delete this.handlers;\r\n return this;\r\n }\r\n}\r\nexports.DDResizable = DDResizable;\r\n/** @internal */\r\nDDResizable._originStyleProp = ['width', 'height', 'position', 'left', 'top', 'opacity', 'zIndex'];\r\n//# sourceMappingURL=dd-resizable.js.map","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.DDUtils = void 0;\r\n/**\r\n * dd-utils.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nclass DDUtils {\r\n static clone(el) {\r\n const node = el.cloneNode(true);\r\n node.removeAttribute('id');\r\n return node;\r\n }\r\n static appendTo(el, parent) {\r\n let parentNode;\r\n if (typeof parent === 'string') {\r\n parentNode = document.querySelector(parent);\r\n }\r\n else {\r\n parentNode = parent;\r\n }\r\n if (parentNode) {\r\n parentNode.appendChild(el);\r\n }\r\n }\r\n static setPositionRelative(el) {\r\n if (!(/^(?:r|a|f)/).test(window.getComputedStyle(el).position)) {\r\n el.style.position = \"relative\";\r\n }\r\n }\r\n static addElStyles(el, styles) {\r\n if (styles instanceof Object) {\r\n for (const s in styles) {\r\n if (styles.hasOwnProperty(s)) {\r\n if (Array.isArray(styles[s])) {\r\n // support fallback value\r\n styles[s].forEach(val => {\r\n el.style[s] = val;\r\n });\r\n }\r\n else {\r\n el.style[s] = styles[s];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n static initEvent(e, info) {\r\n const evt = { type: info.type };\r\n const obj = {\r\n button: 0,\r\n which: 0,\r\n buttons: 1,\r\n bubbles: true,\r\n cancelable: true,\r\n target: info.target ? info.target : e.target\r\n };\r\n // don't check for `instanceof DragEvent` as Safari use MouseEvent #1540\r\n if (e.dataTransfer) {\r\n evt['dataTransfer'] = e.dataTransfer; // workaround 'readonly' field.\r\n }\r\n ['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].forEach(p => evt[p] = e[p]); // keys\r\n ['pageX', 'pageY', 'clientX', 'clientY', 'screenX', 'screenY'].forEach(p => evt[p] = e[p]); // point info\r\n return Object.assign(Object.assign({}, evt), obj);\r\n }\r\n /** returns true if event is inside the given element rectangle */\r\n // Note: Safari Mac has null event.relatedTarget which causes #1684 so check if DragEvent is inside the coordinates instead\r\n // this.el.contains(event.relatedTarget as HTMLElement)\r\n static inside(e, el) {\r\n // srcElement, toElement, target: all set to placeholder when leaving simple grid, so we can't use that (Chrome)\r\n let target = e.relatedTarget || e.fromElement;\r\n if (!target) {\r\n const { bottom, left, right, top } = el.getBoundingClientRect();\r\n return (e.x < right && e.x > left && e.y < bottom && e.y > top);\r\n }\r\n return el.contains(target);\r\n }\r\n}\r\nexports.DDUtils = DDUtils;\r\nDDUtils.isEventSupportPassiveOption = ((() => {\r\n let supportsPassive = false;\r\n let passiveTest = () => {\r\n // do nothing\r\n };\r\n document.addEventListener('test', passiveTest, {\r\n get passive() {\r\n supportsPassive = true;\r\n return true;\r\n }\r\n });\r\n document.removeEventListener('test', passiveTest);\r\n return supportsPassive;\r\n})());\r\n//# sourceMappingURL=dd-utils.js.map","\"use strict\";\r\n/**\r\n * gridstack-dd-native.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.GridStackDDNative = void 0;\r\nconst dd_manager_1 = require(\"./dd-manager\");\r\nconst dd_element_1 = require(\"./dd-element\");\r\nconst gridstack_dd_1 = require(\"../gridstack-dd\");\r\nconst utils_1 = require(\"../utils\");\r\n// export our base class (what user should use) and all associated types\r\n__exportStar(require(\"../gridstack-dd\"), exports);\r\n/**\r\n * HTML 5 Native DragDrop based drag'n'drop plugin.\r\n */\r\nclass GridStackDDNative extends gridstack_dd_1.GridStackDD {\r\n resizable(el, opts, key, value) {\r\n this._getDDElements(el).forEach(dEl => {\r\n if (opts === 'disable' || opts === 'enable') {\r\n dEl.ddResizable && dEl.ddResizable[opts](); // can't create DD as it requires options for setupResizable()\r\n }\r\n else if (opts === 'destroy') {\r\n dEl.ddResizable && dEl.cleanResizable();\r\n }\r\n else if (opts === 'option') {\r\n dEl.setupResizable({ [key]: value });\r\n }\r\n else {\r\n const grid = dEl.el.gridstackNode.grid;\r\n let handles = dEl.el.getAttribute('gs-resize-handles') ? dEl.el.getAttribute('gs-resize-handles') : grid.opts.resizable.handles;\r\n dEl.setupResizable(Object.assign(Object.assign(Object.assign({}, grid.opts.resizable), { handles: handles }), {\r\n start: opts.start,\r\n stop: opts.stop,\r\n resize: opts.resize\r\n }));\r\n }\r\n });\r\n return this;\r\n }\r\n draggable(el, opts, key, value) {\r\n this._getDDElements(el).forEach(dEl => {\r\n if (opts === 'disable' || opts === 'enable') {\r\n dEl.ddDraggable && dEl.ddDraggable[opts](); // can't create DD as it requires options for setupDraggable()\r\n }\r\n else if (opts === 'destroy') {\r\n dEl.ddDraggable && dEl.cleanDraggable();\r\n }\r\n else if (opts === 'option') {\r\n dEl.setupDraggable({ [key]: value });\r\n }\r\n else {\r\n const grid = dEl.el.gridstackNode.grid;\r\n dEl.setupDraggable(Object.assign(Object.assign({}, grid.opts.draggable), {\r\n containment: (grid.opts._isNested && !grid.opts.dragOut)\r\n ? grid.el.parentElement\r\n : (grid.opts.draggable.containment || null),\r\n start: opts.start,\r\n stop: opts.stop,\r\n drag: opts.drag\r\n }));\r\n }\r\n });\r\n return this;\r\n }\r\n dragIn(el, opts) {\r\n this._getDDElements(el).forEach(dEl => dEl.setupDraggable(opts));\r\n return this;\r\n }\r\n droppable(el, opts, key, value) {\r\n if (typeof opts.accept === 'function' && !opts._accept) {\r\n opts._accept = opts.accept;\r\n opts.accept = (el) => opts._accept(el);\r\n }\r\n this._getDDElements(el).forEach(dEl => {\r\n if (opts === 'disable' || opts === 'enable') {\r\n dEl.ddDroppable && dEl.ddDroppable[opts]();\r\n }\r\n else if (opts === 'destroy') {\r\n if (dEl.ddDroppable) { // error to call destroy if not there\r\n dEl.cleanDroppable();\r\n }\r\n }\r\n else if (opts === 'option') {\r\n dEl.setupDroppable({ [key]: value });\r\n }\r\n else {\r\n dEl.setupDroppable(opts);\r\n }\r\n });\r\n return this;\r\n }\r\n /** true if element is droppable */\r\n isDroppable(el) {\r\n return !!(el && el.ddElement && el.ddElement.ddDroppable && !el.ddElement.ddDroppable.disabled);\r\n }\r\n /** true if element is draggable */\r\n isDraggable(el) {\r\n return !!(el && el.ddElement && el.ddElement.ddDraggable && !el.ddElement.ddDraggable.disabled);\r\n }\r\n /** true if element is draggable */\r\n isResizable(el) {\r\n return !!(el && el.ddElement && el.ddElement.ddResizable && !el.ddElement.ddResizable.disabled);\r\n }\r\n on(el, name, callback) {\r\n this._getDDElements(el).forEach(dEl => dEl.on(name, (event) => {\r\n callback(event, dd_manager_1.DDManager.dragElement ? dd_manager_1.DDManager.dragElement.el : event.target, dd_manager_1.DDManager.dragElement ? dd_manager_1.DDManager.dragElement.helper : null);\r\n }));\r\n return this;\r\n }\r\n off(el, name) {\r\n this._getDDElements(el).forEach(dEl => dEl.off(name));\r\n return this;\r\n }\r\n /** @internal returns a list of DD elements, creating them on the fly by default */\r\n _getDDElements(els, create = true) {\r\n let hosts = utils_1.Utils.getElements(els);\r\n if (!hosts.length)\r\n return [];\r\n let list = hosts.map(e => e.ddElement || (create ? dd_element_1.DDElement.init(e) : null));\r\n if (!create) {\r\n list.filter(d => d);\r\n } // remove nulls\r\n return list;\r\n }\r\n}\r\nexports.GridStackDDNative = GridStackDDNative;\r\n// finally register ourself\r\ngridstack_dd_1.GridStackDD.registerPlugin(GridStackDDNative);\r\n//# sourceMappingURL=gridstack-dd-native.js.map","\"use strict\";\r\n/**\r\n * types.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n//# sourceMappingURL=types.js.map","\"use strict\";\r\n/**\r\n * utils.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.Utils = exports.obsoleteAttr = exports.obsoleteOptsDel = exports.obsoleteOpts = exports.obsolete = void 0;\r\n/** checks for obsolete method names */\r\n// eslint-disable-next-line\r\nfunction obsolete(self, f, oldName, newName, rev) {\r\n let wrapper = (...args) => {\r\n console.warn('gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +\r\n 'with `' + newName + '`. It will be **completely** removed in v1.0');\r\n return f.apply(self, args);\r\n };\r\n wrapper.prototype = f.prototype;\r\n return wrapper;\r\n}\r\nexports.obsolete = obsolete;\r\n/** checks for obsolete grid options (can be used for any fields, but msg is about options) */\r\nfunction obsoleteOpts(opts, oldName, newName, rev) {\r\n if (opts[oldName] !== undefined) {\r\n opts[newName] = opts[oldName];\r\n console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +\r\n newName + '`. It will be **completely** removed in v1.0');\r\n }\r\n}\r\nexports.obsoleteOpts = obsoleteOpts;\r\n/** checks for obsolete grid options which are gone */\r\nfunction obsoleteOptsDel(opts, oldName, rev, info) {\r\n if (opts[oldName] !== undefined) {\r\n console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);\r\n }\r\n}\r\nexports.obsoleteOptsDel = obsoleteOptsDel;\r\n/** checks for obsolete Jquery element attributes */\r\nfunction obsoleteAttr(el, oldName, newName, rev) {\r\n let oldAttr = el.getAttribute(oldName);\r\n if (oldAttr !== null) {\r\n el.setAttribute(newName, oldAttr);\r\n console.warn('gridstack.js: attribute `' + oldName + '`=' + oldAttr + ' is deprecated on this object in ' + rev + ' and has been replaced with `' +\r\n newName + '`. It will be **completely** removed in v1.0');\r\n }\r\n}\r\nexports.obsoleteAttr = obsoleteAttr;\r\n/**\r\n * Utility methods\r\n */\r\nclass Utils {\r\n /** convert a potential selector into actual list of html elements */\r\n static getElements(els) {\r\n if (typeof els === 'string') {\r\n let list = document.querySelectorAll(els);\r\n if (!list.length && els[0] !== '.' && els[0] !== '#') {\r\n list = document.querySelectorAll('.' + els);\r\n if (!list.length) {\r\n list = document.querySelectorAll('#' + els);\r\n }\r\n }\r\n return Array.from(list);\r\n }\r\n return [els];\r\n }\r\n /** convert a potential selector into actual single element */\r\n static getElement(els) {\r\n if (typeof els === 'string') {\r\n if (!els.length)\r\n return null;\r\n if (els[0] === '#') {\r\n return document.getElementById(els.substring(1));\r\n }\r\n if (els[0] === '.' || els[0] === '[') {\r\n return document.querySelector(els);\r\n }\r\n // if we start with a digit, assume it's an id (error calling querySelector('#1')) as class are not valid CSS\r\n if (!isNaN(+els[0])) { // start with digit\r\n return document.getElementById(els);\r\n }\r\n // finally try string, then id then class\r\n let el = document.querySelector(els);\r\n if (!el) {\r\n el = document.getElementById(els);\r\n }\r\n if (!el) {\r\n el = document.querySelector('.' + els);\r\n }\r\n return el;\r\n }\r\n return els;\r\n }\r\n /** returns true if a and b overlap */\r\n static isIntercepted(a, b) {\r\n return !(a.y >= b.y + b.h || a.y + a.h <= b.y || a.x + a.w <= b.x || a.x >= b.x + b.w);\r\n }\r\n /** returns true if a and b touch edges or corners */\r\n static isTouching(a, b) {\r\n return Utils.isIntercepted(a, { x: b.x - 0.5, y: b.y - 0.5, w: b.w + 1, h: b.h + 1 });\r\n }\r\n /**\r\n * Sorts array of nodes\r\n * @param nodes array to sort\r\n * @param dir 1 for asc, -1 for desc (optional)\r\n * @param width width of the grid. If undefined the width will be calculated automatically (optional).\r\n **/\r\n static sort(nodes, dir, column) {\r\n column = column || nodes.reduce((col, n) => Math.max(n.x + n.w, col), 0) || 12;\r\n if (dir === -1)\r\n return nodes.sort((a, b) => (b.x + b.y * column) - (a.x + a.y * column));\r\n else\r\n return nodes.sort((b, a) => (b.x + b.y * column) - (a.x + a.y * column));\r\n }\r\n /**\r\n * creates a style sheet with style id under given parent\r\n * @param id will set the 'gs-style-id' attribute to that id\r\n * @param parent to insert the stylesheet as first child,\r\n * if none supplied it will be appended to the document head instead.\r\n */\r\n static createStylesheet(id, parent) {\r\n let style = document.createElement('style');\r\n style.setAttribute('type', 'text/css');\r\n style.setAttribute('gs-style-id', id);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n if (style.styleSheet) { // TODO: only CSSImportRule have that and different beast ??\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n style.styleSheet.cssText = '';\r\n }\r\n else {\r\n style.appendChild(document.createTextNode('')); // WebKit hack\r\n }\r\n if (!parent) {\r\n // default to head\r\n parent = document.getElementsByTagName('head')[0];\r\n parent.appendChild(style);\r\n }\r\n else {\r\n parent.insertBefore(style, parent.firstChild);\r\n }\r\n return style.sheet;\r\n }\r\n /** removed the given stylesheet id */\r\n static removeStylesheet(id) {\r\n let el = document.querySelector('STYLE[gs-style-id=' + id + ']');\r\n if (el && el.parentNode)\r\n el.remove();\r\n }\r\n /** inserts a CSS rule */\r\n static addCSSRule(sheet, selector, rules) {\r\n if (typeof sheet.addRule === 'function') {\r\n sheet.addRule(selector, rules);\r\n }\r\n else if (typeof sheet.insertRule === 'function') {\r\n sheet.insertRule(`${selector}{${rules}}`);\r\n }\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n static toBool(v) {\r\n if (typeof v === 'boolean') {\r\n return v;\r\n }\r\n if (typeof v === 'string') {\r\n v = v.toLowerCase();\r\n return !(v === '' || v === 'no' || v === 'false' || v === '0');\r\n }\r\n return Boolean(v);\r\n }\r\n static toNumber(value) {\r\n return (value === null || value.length === 0) ? undefined : Number(value);\r\n }\r\n static parseHeight(val) {\r\n let h;\r\n let unit = 'px';\r\n if (typeof val === 'string') {\r\n let match = val.match(/^(-[0-9]+\\.[0-9]+|[0-9]*\\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%)?$/);\r\n if (!match) {\r\n throw new Error('Invalid height');\r\n }\r\n unit = match[2] || 'px';\r\n h = parseFloat(match[1]);\r\n }\r\n else {\r\n h = val;\r\n }\r\n return { h, unit };\r\n }\r\n /** copies unset fields in target to use the given default sources values */\r\n // eslint-disable-next-line\r\n static defaults(target, ...sources) {\r\n sources.forEach(source => {\r\n for (const key in source) {\r\n if (!source.hasOwnProperty(key))\r\n return;\r\n if (target[key] === null || target[key] === undefined) {\r\n target[key] = source[key];\r\n }\r\n else if (typeof source[key] === 'object' && typeof target[key] === 'object') {\r\n // property is an object, recursively add it's field over... #1373\r\n this.defaults(target[key], source[key]);\r\n }\r\n }\r\n });\r\n return target;\r\n }\r\n /** given 2 objects return true if they have the same values. Checks for Object {} having same fields and values (just 1 level down) */\r\n static same(a, b) {\r\n if (typeof a !== 'object')\r\n return a == b;\r\n if (typeof a !== typeof b)\r\n return false;\r\n // else we have object, check just 1 level deep for being same things...\r\n if (Object.keys(a).length !== Object.keys(b).length)\r\n return false;\r\n for (const key in a) {\r\n if (a[key] !== b[key])\r\n return false;\r\n }\r\n return true;\r\n }\r\n /** copies over b size & position (GridStackPosition), and possibly min/max as well */\r\n static copyPos(a, b, minMax = false) {\r\n a.x = b.x;\r\n a.y = b.y;\r\n a.w = b.w;\r\n a.h = b.h;\r\n if (!minMax)\r\n return a;\r\n if (b.minW)\r\n a.minW = b.minW;\r\n if (b.minH)\r\n a.minH = b.minH;\r\n if (b.maxW)\r\n a.maxW = b.maxW;\r\n if (b.maxH)\r\n a.maxH = b.maxH;\r\n return a;\r\n }\r\n /** true if a and b has same size & position */\r\n static samePos(a, b) {\r\n return a && b && a.x === b.x && a.y === b.y && a.w === b.w && a.h === b.h;\r\n }\r\n /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */\r\n static removeInternalAndSame(a, b) {\r\n if (typeof a !== 'object' || typeof b !== 'object')\r\n return;\r\n for (let key in a) {\r\n let val = a[key];\r\n if (key[0] === '_' || val === b[key]) {\r\n delete a[key];\r\n }\r\n else if (val && typeof val === 'object' && b[key] !== undefined) {\r\n for (let i in val) {\r\n if (val[i] === b[key][i] || i[0] === '_') {\r\n delete val[i];\r\n }\r\n }\r\n if (!Object.keys(val).length) {\r\n delete a[key];\r\n }\r\n }\r\n }\r\n }\r\n /** return the closest parent (or itself) matching the given class */\r\n static closestByClass(el, name) {\r\n while (el) {\r\n if (el.classList.contains(name))\r\n return el;\r\n el = el.parentElement;\r\n }\r\n return null;\r\n }\r\n /** delay calling the given function for given delay, preventing new calls from happening while waiting */\r\n static throttle(func, delay) {\r\n let isWaiting = false;\r\n return (...args) => {\r\n if (!isWaiting) {\r\n isWaiting = true;\r\n setTimeout(() => { func(...args); isWaiting = false; }, delay);\r\n }\r\n };\r\n }\r\n static removePositioningStyles(el) {\r\n let style = el.style;\r\n if (style.position) {\r\n style.removeProperty('position');\r\n }\r\n if (style.left) {\r\n style.removeProperty('left');\r\n }\r\n if (style.top) {\r\n style.removeProperty('top');\r\n }\r\n if (style.width) {\r\n style.removeProperty('width');\r\n }\r\n if (style.height) {\r\n style.removeProperty('height');\r\n }\r\n }\r\n /** @internal returns the passed element if scrollable, else the closest parent that will, up to the entire document scrolling element */\r\n static getScrollElement(el) {\r\n if (!el)\r\n return document.scrollingElement || document.documentElement; // IE support\r\n const style = getComputedStyle(el);\r\n const overflowRegex = /(auto|scroll)/;\r\n if (overflowRegex.test(style.overflow + style.overflowY)) {\r\n return el;\r\n }\r\n else {\r\n return this.getScrollElement(el.parentElement);\r\n }\r\n }\r\n /** @internal */\r\n static updateScrollPosition(el, position, distance) {\r\n // is widget in view?\r\n let rect = el.getBoundingClientRect();\r\n let innerHeightOrClientHeight = (window.innerHeight || document.documentElement.clientHeight);\r\n if (rect.top < 0 ||\r\n rect.bottom > innerHeightOrClientHeight) {\r\n // set scrollTop of first parent that scrolls\r\n // if parent is larger than el, set as low as possible\r\n // to get entire widget on screen\r\n let offsetDiffDown = rect.bottom - innerHeightOrClientHeight;\r\n let offsetDiffUp = rect.top;\r\n let scrollEl = this.getScrollElement(el);\r\n if (scrollEl !== null) {\r\n let prevScroll = scrollEl.scrollTop;\r\n if (rect.top < 0 && distance < 0) {\r\n // moving up\r\n if (el.offsetHeight > innerHeightOrClientHeight) {\r\n scrollEl.scrollTop += distance;\r\n }\r\n else {\r\n scrollEl.scrollTop += Math.abs(offsetDiffUp) > Math.abs(distance) ? distance : offsetDiffUp;\r\n }\r\n }\r\n else if (distance > 0) {\r\n // moving down\r\n if (el.offsetHeight > innerHeightOrClientHeight) {\r\n scrollEl.scrollTop += distance;\r\n }\r\n else {\r\n scrollEl.scrollTop += offsetDiffDown > distance ? distance : offsetDiffDown;\r\n }\r\n }\r\n // move widget y by amount scrolled\r\n position.top += scrollEl.scrollTop - prevScroll;\r\n }\r\n }\r\n }\r\n /**\r\n * @internal Function used to scroll the page.\r\n *\r\n * @param event `MouseEvent` that triggers the resize\r\n * @param el `HTMLElement` that's being resized\r\n * @param distance Distance from the V edges to start scrolling\r\n */\r\n static updateScrollResize(event, el, distance) {\r\n const scrollEl = this.getScrollElement(el);\r\n const height = scrollEl.clientHeight;\r\n // #1727 event.clientY is relative to viewport, so must compare this against position of scrollEl getBoundingClientRect().top\r\n // #1745 Special situation if scrollEl is document 'html': here browser spec states that\r\n // clientHeight is height of viewport, but getBoundingClientRect() is rectangle of html element;\r\n // this discrepancy arises because in reality scrollbar is attached to viewport, not html element itself.\r\n const offsetTop = (scrollEl === this.getScrollElement()) ? 0 : scrollEl.getBoundingClientRect().top;\r\n const pointerPosY = event.clientY - offsetTop;\r\n const top = pointerPosY < distance;\r\n const bottom = pointerPosY > height - distance;\r\n if (top) {\r\n // This also can be done with a timeout to keep scrolling while the mouse is\r\n // in the scrolling zone. (will have smoother behavior)\r\n scrollEl.scrollBy({ behavior: 'smooth', top: pointerPosY - distance });\r\n }\r\n else if (bottom) {\r\n scrollEl.scrollBy({ behavior: 'smooth', top: distance - (height - pointerPosY) });\r\n }\r\n }\r\n /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */\r\n static clone(obj) {\r\n if (obj === null || obj === undefined || typeof (obj) !== 'object') {\r\n return obj;\r\n }\r\n // return Object.assign({}, obj);\r\n if (obj instanceof Array) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n return [...obj];\r\n }\r\n return Object.assign({}, obj);\r\n }\r\n /**\r\n * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.\r\n * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.\r\n */\r\n static cloneDeep(obj) {\r\n // return JSON.parse(JSON.stringify(obj)); // doesn't work with date format ?\r\n const ret = Utils.clone(obj);\r\n for (const key in ret) {\r\n // NOTE: we don't support function/circular dependencies so skip those properties for now...\r\n if (ret.hasOwnProperty(key) && typeof (ret[key]) === 'object' && key.substring(0, 2) !== '__' && !skipFields.find(k => k === key)) {\r\n ret[key] = Utils.cloneDeep(obj[key]);\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.Utils = Utils;\r\n// list of fields we will skip during cloneDeep (nested objects, other internal)\r\nconst skipFields = ['_isNested', 'el', 'grid', 'subGrid', 'engine'];\r\n//# sourceMappingURL=utils.js.map","// extracted by mini-css-extract-plugin\nexport {};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * ---------------------------------------------------------------------\n *\n * GLPI - Gestionnaire Libre de Parc Informatique\n *\n * http://glpi-project.org\n *\n * @copyright 2015-2024 Teclib' and contributors.\n * @copyright 2003-2014 by the INDEPNET Development Team.\n * @licence https://www.gnu.org/licenses/gpl-3.0.html\n *\n * ---------------------------------------------------------------------\n *\n * LICENSE\n *\n * This file is part of GLPI.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n *\n * ---------------------------------------------------------------------\n */\n\n// Gridstack lib\nimport { GridStack } from 'gridstack';\nwindow.GridStack = GridStack;\nrequire('gridstack/dist/h5/gridstack-dd-native');\nrequire('gridstack/dist/gridstack.min.css');\n"],"names":[],"sourceRoot":""}