forked from haltu/muuri
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmuuri.min.js
25 lines (25 loc) · 37.1 KB
/
muuri.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*!
* Muuri v0.3.0
* https://github.com/haltu/muuri
* Copyright (c) 2015, Haltu Oy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
!function(t,e){var i,n;if("function"==typeof define&&define.amd)define(function(r){return i=r.defined&&r.defined("velocity")?r("velocity"):void 0,n=r.defined&&r.defined("hammer")?r("hammer"):void 0,e(t,"Muuri",i,n)});else if("object"==typeof module&&module.exports){try{i=require("velocity-animate")}catch(t){}try{n=require("hammerjs")}catch(t){}module.exports=e(t,"Muuri",i,n)}else i=t.Velocity||t.jQuery.Velocity,n=t.Hammer,t.Muuri=e(t,"Muuri",i,n)}(this,function(t,e,i,n,r){"use strict";function o(e,i){var n,r,s,a,l=this;if(e=l._element=typeof e===lt?et.querySelectorAll(e)[0]:e,!et.body.contains(e))throw new ot("Container element must be an existing DOM element");n=l._settings=tt(o.defaultOptions,i),l._id=++_t,ht[l._id]=l,l._isDestroyed=!1,l._layout=null,l._emitter=new o.Emitter,l._setSortGroups(n.dragSortGroup),l._sortConnections=n.dragSortWith&&n.dragSortWith.length?[].concat(n.dragSortWith):null,l._itemShowHandler=typeof n.showAnimation===at?n.showAnimation(n.showDuration,n.showEasing,n.visibleStyles):U("show",n.showDuration,n.showEasing,n.visibleStyles),l._itemHideHandler=typeof n.hideAnimation===at?n.hideAnimation(n.hideDuration,n.hideEasing,n.hiddenStyles):U("hide",n.hideDuration,n.hideEasing,n.hiddenStyles),E(e,n.containerClass),l._items=[],r=n.items,typeof r===lt?Y(l._element.children).forEach(function(t){("*"===r||pt(t,r))&&l._items.push(new o.Item(l,t))}):(nt.isArray(r)||D(r))&&(l._items=Y(r).map(function(t){return new o.Item(l,t)})),a=n.layoutOnResize,a=!0===a?0:typeof a===dt?a:-1,a>=0&&(s=C(function(){l.refreshItems().layout()},a),l._resizeHandler=function(){s()},t.addEventListener("resize",l._resizeHandler)),n.layoutOnInit&&l.layout(!0)}function s(t,e){var i,n=this,r=t._settings;n._id=++_t,ft[n._id]=n,n._isDestroyed=!1,e.parentNode!==t._element&&t._element.appendChild(e),E(e,r.itemClass),i="none"===b(e,"display"),E(e,i?r.itemHiddenClass:r.itemVisibleClass),n._gridId=t._id,n._element=e,n._child=e.children[0],n._animate=new o.ItemAnimate(n,e),n._animateChild=new o.ItemAnimate(n,n._child),n._isDefaultAnimate=n._animate instanceof f,n._isActive=!i,n._isPositioning=!1,n._isHidden=i,n._isHiding=!1,n._isShowing=!1,n._visibilityQueue=[],n._layoutQueue=[],n._left=0,n._top=0,I(e,{left:"0",top:"0",transform:"translateX(0px) translateY(0px)",display:i?"none":"block"}),n._refreshDimensions()._refreshSortData(),i?t._itemHideHandler.start(n,!0):t._itemShowHandler.start(n,!0),n._migrate=new o.ItemMigrate(n),n._release=new o.ItemRelease(n),n._drag=r.dragEnabled?new o.ItemDrag(n):null}function a(t,e){e=e?e.concat():t.getItems("active"),t._refreshDimensions();var i=this,n=t._settings.layout,r=t._width-t._border.left-t._border.right-t._padding.left-t._padding.right,o=t._height-t._border.top-t._border.bottom-t._padding.top-t._padding.bottom,s=typeof n===at?n(e,r,o):l(e,r,o,v(n)?n:{});i.items=e,i.slots=s.slots,i.setWidth=s.setWidth||!1,i.setHeight=s.setHeight||!1,i.width=s.width,i.height=s.height}function l(t,e,i,n){var r,o,s,a,l=!!n.fillGaps,h=!!n.horizontal,f=!!n.alignRight,u=!!n.alignBottom,g={slots:{},width:h?0:e,height:h?i:0,setWidth:h,setHeight:!h},_=[];if(!t.length)return g;for(a=0;a<t.length;a++)s=t[a],o=d(g,_,s._outerWidth,s._outerHeight,!h,l),h?g.width=rt.max(g.width,o.left+o.width):g.height=rt.max(g.height,o.top+o.height),g.slots[s._id]=o;if(f||u)for(r=it.keys(g.slots),a=0;a<r.length;a++)o=g.slots[r[a]],f&&(o.left=g.width-(o.left+o.width)),u&&(o.top=g.height-(o.top+o.height));return g}function d(t,e,i,n,r,o){var s,a,l,d,h,f=e[0]||[],u=[],g={left:null,top:null,width:i,height:n};for(d=0;d<f.length;d++)if(s=f[d],g.width<=s.width&&g.height<=s.height){g.left=s.left,g.top=s.top;break}for(null===g.left&&(g.left=r?0:t.width,g.top=r?t.height:0,o||(l=!0)),r&&g.top+g.height>t.height&&(g.left>0&&(u[u.length]={left:0,top:t.height,width:g.left,height:1/0}),g.left+g.width<t.width&&(u[u.length]={left:g.left+g.width,top:t.height,width:t.width-g.left-g.width,height:1/0}),t.height=g.top+g.height),!r&&g.left+g.width>t.width&&(g.top>0&&(u[u.length]={left:t.width,top:0,width:1/0,height:g.top}),g.top+g.height<t.height&&(u[u.length]={left:t.width,top:g.top+g.height,width:1/0,height:t.height-g.top-g.height}),t.width=g.left+g.width),d=o?0:l?f.length:d;d<f.length;d++)for(a=F(f[d],g),h=0;h<a.length;h++)s=a[h],s.width>0&&s.height>0&&(r&&s.top<t.height||!r&&s.left<t.width)&&(u[u.length]=s);return e[0]=V(u).sort(r?N:M),g}function h(){this._events={},this._isDestroyed=!1}function f(t,i){this._element=i,this._queue=e+"-"+ ++_t,this._isAnimating=!1,this._isDestroyed=!1}function u(t){var e=this;e._itemId=t._id,e._isDestroyed=!1,e.isActive=!1,e.container=!1,e.containerDiffX=0,e.containerDiffY=0}function g(t){var e=this;e._itemId=t._id,e._isDestroyed=!1,e.isActive=!1,e.isPositioningStarted=!1,e.containerDiffX=0,e.containerDiffY=0}function _(t){if(!n)throw ot("["+e+"] required dependency Hammer is not defined.");var i,r=this,o=t._element,s=t.getGrid(),a=s._settings,l=typeof a.dragStartPredicate===at?a.dragStartPredicate:_.defaultStartPredicate,d=0;r._itemId=t._id,r._gridId=s._id,r._hammer=i=new n.Manager(o),r._isDestroyed=!1,r._isMigrating=!1,r._data={},r.reset(),r._checkSortOverlap=C(function(){r._data.isActive&&r.checkOverlap()},a.dragSortInterval),r._sortPredicate=typeof a.dragSortPredicate===at?a.dragSortPredicate:_.defaultSortPredicate,r._scrollHandler=function(t){r.onScroll(t)},i.add(new n.Pan({event:"drag",pointers:1,threshold:0,direction:n.DIRECTION_ALL})),i.add(new n.Press({event:"draginit",pointers:1,threshold:1e3,time:0})),v(a.dragHammerSettings)&&i.set(a.dragHammerSettings),i.on("draginit dragstart dragmove",function(t){var e;0===d?(e=l(r.getItem(),t),!0===e?(d=1,r.onStart(t)):!1===e&&(d=2)):1===d&&r._data.isActive&&r.onMove(t)}).on("dragend dragcancel draginitup",function(t){var e=1===d;l(r.getItem(),t),d=0,e&&r._data.isActive&&r.onEnd(t)}),o.addEventListener("dragstart",$,!1)}function p(t,e){var i=t.length,n=i-1;return e>n?n:e<0?rt.max(i+e,0):e}function c(t,e,i){if(!(t.length<2)){var n,r=p(t,e),o=p(t,i);r!==o&&(n=t[r],t[r]=t[o],t[o]=n)}}function m(t,e,i){if(!(t.length<2)){var n=p(t,e),r=p(t,i);n!==r&&t.splice(r,0,t.splice(n,1)[0])}}function y(t){var e,i=[],n=t.length;if(n)for(i[0]=t[0],e=1;e<n;e++)i.indexOf(t[e])<0&&(i[i.length]=t[e]);return i}function v(t){return"object"==typeof t&&"[object Object]"===it.prototype.toString.call(t)}function D(t){var e=it.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e}function w(t,e){return it.keys(e).forEach(function(i){var n=v(e[i]);v(t[i])&&n?(t[i]=w({},t[i]),t[i]=w(t[i],e[i])):t[i]=n?w({},e[i]):nt.isArray(e[i])?e[i].concat():e[i]}),t}function S(t,e,i){var n=typeof i===dt?i:-1;t.splice.apply(t,[n<0?t.length-n+1:n,0].concat(e))}function C(e,i){var n;return i>0?function(o){n!==r&&(n=t.clearTimeout(n),"finish"===o&&e()),"cancel"!==o&&"finish"!==o&&(n=t.setTimeout(function(){n=r,e()},i))}:function(t){"cancel"!==t&&e()}}function b(e,i){return t.getComputedStyle(e,null).getPropertyValue("transform"===i?ct.styleName||i:i)}function A(t,e){return parseFloat(b(t,e))||0}function x(t,e){return parseFloat((b(t,"transform")||"").replace("matrix(","").split(",")["x"===e?4:5])||0}function I(t,e){var i,n,r,o=it.keys(e);for(r=0;r<o.length;r++)i=o[r],n=e[i],t.style["transform"===i&&ct?ct.propName:i]=n}function H(t,e){var n,r=it.keys(e);for(n=0;n<r.length;n++)i.hook(t,r[n],e[r[n]])}function E(t,e){t.classList?t.classList.add(e):pt(t,"."+e)||(t.className+=" "+e)}function X(t,e){t.classList?t.classList.remove(e):pt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim())}function Y(t){return[].slice.call(t)}function G(t,e,i){if(t===e)return{left:0,top:0};i&&(t=k(t,!0),e=k(e,!0));var n=P(t),r=P(e);return{left:r.left-n.left,top:r.top-n.top}}function P(e){var i,n={left:0,top:0};return e===et?n:(n.left=t.pageXOffset||0,n.top=t.pageYOffset||0,e.self===t.self?n:(i=e.getBoundingClientRect(),n.left+=i.left+A(e,"border-left-width"),n.top+=i.top+A(e,"border-top-width"),n))}function k(t,e){for(var i=(e?t:t.parentElement)||et;i&&i!==et&&"static"===b(i,"position")&&!R(i);)i=i.parentElement||et;return i}function O(e){var i=[],n=/(auto|scroll)/,r=e.parentNode;if(mt){if("fixed"===b(e,"position"))return i;for(;r&&r!==et&&r!==et.documentElement;)n.test(b(r,"overflow")+b(r,"overflow-y")+b(r,"overflow-x"))&&(i[i.length]=r),r="fixed"===b(r,"position")?null:r.parentNode;null!==r&&(i[i.length]=t)}else{for(;r&&r!==et;)"fixed"!==b(e,"position")||R(r)?(n.test(b(r,"overflow")+b(r,"overflow-y")+b(r,"overflow-x"))&&(i[i.length]=r),e=r,r=r.parentNode):r=r.parentNode;i[i.length-1]===et.documentElement?i[i.length-1]=t:i[i.length]=t}return i}function R(t){var e=b(t,"transform"),i=b(t,"display");return"none"!==e&&"inline"!==i&&"none"!==i}function L(t,e){return!(t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top)}function N(t,e){return t.top-e.top||t.left-e.left}function M(t,e){return t.left-e.left||t.top-e.top}function z(t,e){return t.left>=e.left&&t.top>=e.top&&t.left+t.width<=e.left+e.width&&t.top+t.height<=e.top+e.height}function F(t,e){var i=[];return L(t,e)?(t.left<e.left&&(i[i.length]={left:t.left,top:t.top,width:e.left-t.left,height:t.height}),t.left+t.width>e.left+e.width&&(i[i.length]={left:e.left+e.width,top:t.top,width:t.left+t.width-(e.left+e.width),height:t.height}),t.top<e.top&&(i[i.length]={left:t.left,top:t.top,width:t.width,height:e.top-t.top}),t.top+t.height>e.top+e.height&&(i[i.length]={left:t.left,top:e.top+e.height,width:t.width,height:t.top+t.height-(e.top+e.height)}),i):[{left:t.left,top:t.top,width:t.width,height:t.height}]}function V(t){for(var e,i,n,r=t.length;r--;)for(i=t[r],e=t.length;e--;)if(n=t[e],r!==e&&z(i,n)){t.splice(r,1);break}return t}function W(t,e){return L(t,e)?(rt.min(t.left+t.width,e.left+e.width)-rt.max(t.left,e.left))*(rt.min(t.top+t.height,e.top+e.height)-rt.max(t.top,e.top))/(rt.min(t.width,e.width)*rt.min(t.height,e.height))*100:0}function B(t){var e,i={};for(e=0;e<t.length;e++)i[t[e]._id]=e;return i}function Q(t,e,i,n){var r=n[t._id],o=n[e._id];return i?o-r:r-o}function q(t,e,i,n){var r,o,s,a,l,d=0;for(l=0;l<n.length;l++)if(r=n[l][0],o=n[l][1],s=(t._sortData?t:t._refreshSortData())._sortData[r],a=(e._sortData?e:e._refreshSortData())._sortData[r],0!==(d="desc"===o||!o&&i?a<s?-1:a>s?1:0:s<a?-1:s>a?1:0))return d;return d}function j(t,e){var i,n,r,o=[],s=t.concat();for(r=0;r<e.length;r++)i=e[r],(n=s.indexOf(i))>-1&&(o.push(i),s.splice(n,1));return nt.prototype.splice.apply(t,[0,t.length].concat(o).concat(s)),t}function T(t,e,i,n){var o,s,a=t.getItems(i),l=n||{},d=!0===l.instant,h=l.onFinish,f=l.layout?l.layout:l.layout===r,u=a.length,g="show"===e,_=g?yt:Dt,p=g?vt:wt,c=!1,m=[],y=[],v=[];for(s=0;s<a.length;s++)o=a[s],(g?o._isHidden||o._isHiding||o._isShowing&&d:!o._isHidden||o._isShowing||o._isHiding&&d)&&(m[m.length]=o);if(u=m.length){for(t._emit(_,m.concat()),s=0;s<m.length;s++)o=m[s],(g&&!o._isActive||!g&&o._isActive)&&(c=!0),g&&!o._isActive&&(o._skipNextLayoutAnimation=!0,v[v.length]=o),o["_"+e](d,function(e,i){e||(y[y.length]=i),--u<1&&(typeof h===at&&h(y.concat()),t._emit(p,y.concat()))});c&&(v.length&&t.refreshItems(v),f&&t.layout("instant"===f,typeof f===at?f:r))}else typeof h===at&&h(m);return t}function U(t,e,i,n){e=parseInt(e)||0,i=i||"ease",n=v(n)?n:null;var r=e>0;return{start:function(t,o,s){r&&n?o?((t._isDefaultAnimate?H:I)(t._child,n),s&&s()):t._animateChild.start(null,n,{duration:e,easing:i,onFinish:s}):s&&s()},stop:function(t){t._animateChild.stop()}}}function J(t,e,i){var n,r,o,s=null,a=e._getSortConnections(!0),l=-1;for(o=0;o<a.length;o++)r=a[o],r._refreshDimensions(),(n=W(t,{width:r._width,height:r._height,left:r._left,top:r._top}))>i&&n>l&&(l=n,s=r);return s}function K(t,e,i){var n,r=t.splice(0,t.length);for(n=0;n<r.length;n++)r[n](e,i)}function Z(t,e){var i;return"inactive"===e?!t.isActive():"hidden"===e?!t.isVisible():(i="is"+e.charAt(0).toUpperCase()+e.slice(1),typeof t[i]===at&&t[i]())}function $(t){t.preventDefault&&t.preventDefault()}function tt(t,e){var i=w({},t);return i=e?w(i,e):i,i.visibleStyles=(e||{}).visibleStyles||(t||{}).visibleStyles,i.hiddenStyles=(e||{}).hiddenStyles||(t||{}).hiddenStyles,i}var et=t.document,it=t.Object,nt=t.Array,rt=t.Math,ot=t.Error,st=t.Element,at="function",lt="string",dt="number",ht={},ft={},ut={},gt=function(){},_t=0,pt=function(){var t=st.prototype,e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;return function(t,i){return e.call(t,i)}}(),ct=function(t){var e,i,n,o=et.documentElement,s=t.charAt(0).toUpperCase()+t.slice(1),a=["","Webkit","Moz","O","ms"];for(n=0;n<a.length;n++)if(e=a[n],i=e?e+s:t,o.style[i]!==r)return e=e.toLowerCase(),{prefix:e,propName:i,styleName:e?"-"+e+"-"+t:t};return null}("transform"),mt=function(){if(!ct)return!0;var t,e,i=et.createElement("div"),n=et.createElement("div");return I(i,{display:"block",visibility:"hidden",position:"absolute",width:"1px",height:"1px",left:"1px",top:"0",margin:"0",transform:"none"}),I(n,{display:"block",position:"fixed",width:"1px",height:"1px",left:"0",top:"0",margin:"0",transform:"none"}),i.appendChild(n),et.body.appendChild(i),t=n.getBoundingClientRect().left,i.style[ct.propName]="scaleX(1)",e=n.getBoundingClientRect().left,et.body.removeChild(i),e===t}(),yt="showStart",vt="showEnd",Dt="hideStart",wt="hideEnd";return o.Item=s,o.ItemDrag=_,o.ItemRelease=g,o.ItemMigrate=u,o.ItemAnimate=f,o.Layout=a,o.Emitter=h,o.defaultOptions={items:"*",showDuration:300,showEasing:"ease",hideDuration:300,hideEasing:"ease",showAnimation:null,hideAnimation:null,visibleStyles:{opacity:1,scale:1},hiddenStyles:{opacity:0,scale:.5},layout:{fillGaps:!1,horizontal:!1,alignRight:!1,alignBottom:!1},layoutOnResize:100,layoutOnInit:!0,layoutDuration:300,layoutEasing:"ease",sortData:null,dragEnabled:!1,dragContainer:null,dragStartPredicate:{distance:0,delay:0,handle:!1},dragSort:!0,dragSortInterval:100,dragSortPredicate:{threshold:50,action:"move"},dragSortGroup:null,dragSortWith:null,dragReleaseDuration:300,dragReleaseEasing:"ease",dragHammerSettings:{touchAction:"none"},containerClass:"muuri",itemClass:"muuri-item",itemVisibleClass:"muuri-item-shown",itemHiddenClass:"muuri-item-hidden",itemPositioningClass:"muuri-item-positioning",itemDraggingClass:"muuri-item-dragging",itemReleasingClass:"muuri-item-releasing"},o.prototype.on=function(t,e){return this._isDestroyed||this._emitter.on(t,e),this},o.prototype.once=function(t,e){return this._isDestroyed||this._emitter.once(t,e),this},o.prototype.off=function(t,e){return this._isDestroyed||this._emitter.off(t,e),this},o.prototype.getElement=function(){return this._element},o.prototype.getItems=function(t,e){var i,n,r=this,o=0===t||t&&typeof t!==lt,s=o?D(t)?Y(t):[].concat(t):null,a=o?e:t,l=[];if(r._isDestroyed)return l;if((a=typeof a===lt?a:null)||s){for(s=s||r._items,n=0;n<s.length;n++)!(i=o?r._getItem(s[n]):s[n])||a&&!Z(i,a)||(l[l.length]=i);return l}return l.concat(r._items)},o.prototype.refreshItems=function(t){var e,i,n=this;if(!n._isDestroyed)for(e=n.getItems(t||"active"),i=0;i<e.length;i++)e[i]._refreshDimensions();return n},o.prototype.refreshSortData=function(t){var e,i,n=this;if(!n._isDestroyed)for(e=n.getItems(t),i=0;i<e.length;i++)e[i]._refreshSortData();return n},o.prototype.synchronize=function(){var t,e,i,n=this,r=n._element,o=n._items;if(n._isDestroyed)return n;if(o.length){for(i=0;i<o.length;i++)e=o[i]._element,e.parentNode===r&&(t=t||et.createDocumentFragment(),t.appendChild(e));t&&r.appendChild(t)}return n._emit("synchronize"),n},o.prototype.layout=function(t,e){function i(){--g<=0&&(typeof f===at&&f(h._layout!==n,r.concat()),h._layout===n&&h._emit("layoutEnd",r.concat()))}var n,r,s,a,l,d,h=this,f=typeof t===at?t:e,u=!0===t,g=0;if(h._isDestroyed)return h;if(n=h._layout=new o.Layout(h),r=n.items.concat(),g=r.length,h._emit("layoutStart",r.concat()),(n.setWidth||n.setHeight)&&(s="border-box"===b(h._element,"box-sizing"),n.setHeight&&I(h._element,{height:(s?n.height+h._padding.top+h._padding.bottom+h._border.top+h._border.bottom:n.height)+"px"}),n.setWidth&&I(h._element,{width:(s?n.width+h._padding.left+h._padding.right+h._border.left+h._border.right:n.width)+"px"})),!r.length)return i(),h;for(d=0;d<r.length;d++)a=r[d],l=n.slots[a._id],a._left=l.left+h._padding.left,a._top=l.top+h._padding.top,a.isDragging()?i():a._layout(u,i);return h},o.prototype.add=function(t,e){var i,n,s,a=this,l=[].concat(t),d=e||{},h=d.layout?d.layout:d.layout===r,f=[],u=a._items,g=!1;if(a._isDestroyed)return[];for(s=0;s<u.length;s++)(i=l.indexOf(u[s]._element))>-1&&l.splice(i,1);if(!l.length)return f;for(s=0;s<l.length;s++)n=new o.Item(a,l[s]),f[f.length]=n,n._isActive&&(g=!0,n._skipNextLayoutAnimation=!0);return S(u,f,d.index),a._emit("add",f.concat()),g&&h&&a.layout("instant"===h,typeof h===at?h:r),f},o.prototype.remove=function(t,e){var i,n,o,s=this,a=e||{},l=a.layout?a.layout:a.layout===r,d=!1;if(s._isDestroyed)return[];for(i=s.getItems(t),o=0;o<i.length;o++)n=i[o],n._isActive&&(d=!0),n._destroy(a.removeElements);return s._emit("remove",i.concat()),d&&l&&s.layout("instant"===l,typeof l===at?l:r),i},o.prototype.show=function(t,e){return this._isDestroyed?this:T(this,"show",t,e)},o.prototype.hide=function(t,e){return this._isDestroyed?this:T(this,"hide",t,e)},o.prototype.filter=function(t,e){var i,n,o,s=this,a=s._items,l=typeof t,d=l===lt,h=l===at,f=e||{},u=!0===f.instant,g=f.layout?f.layout:f.layout===r,_=typeof f.onFinish===at?f.onFinish:null,p=[],c=[],m=-1;if(s._isDestroyed||!a.length)return s;if(i=_?function(){++m&&_(p.concat(),c.concat())}:gt,h||d)for(o=0;o<a.length;o++)n=a[o],(h?t(n):pt(n._element,t))?p.push(n):c.push(n);return p.length?s.show(p,{instant:u,onFinish:i,layout:!1}):i(),c.length?s.hide(c,{instant:u,onFinish:i,layout:!1}):i(),(p.length||c.length)&&(s._emit("filter",p.concat(),c.concat()),g&&s.layout("instant"===g,typeof g===at?g:r)),s},o.prototype.sort=function(t,e){var i,n,o=this,s=o._items,a=e||{},l=!!a.descending,d=a.layout?a.layout:a.layout===r;if(o._isDestroyed||s.length<2)return o;if(i=s.concat(),typeof t===at)s.sort(function(e,r){var o=t(e,r);return(l&&0!==o?-o:o)||Q(e,r,l,n||(n=B(i)))});else if(typeof t===lt)t=t.trim().split(" ").map(function(t){return t.split(":")}),s.sort(function(e,r){return q(e,r,l,t)||Q(e,r,l,n||(n=B(i)))});else{if(!nt.isArray(t))return o;j(s,t),l&&s.reverse()}return o._emit("sort",s.concat(),i),d&&o.layout("instant"===d,typeof d===at?d:r),o},o.prototype.move=function(t,e,i){var n,o,s,a,l=this,d=l._items,h=i||{},f=h.layout?h.layout:h.layout===r,u="swap"===h.action,g=u?"swap":"move";return l._isDestroyed||d.length<2?l:(n=l._getItem(t),o=l._getItem(e),n&&o&&n!==o&&(s=d.indexOf(n),a=d.indexOf(o),(u?c:m)(d,s,a),l._emit("move",{item:n,fromIndex:s,toIndex:a,action:g}),f&&l.layout("instant"===f,typeof f===at?f:r)),l)},o.prototype.send=function(t,e,i,n){if(this._isDestroyed||e._isDestroyed||this===e)return this;var o=this,s=e,a=n||{},l=a.appendTo||et.body,d=a.layoutSender?a.layoutSender:a.layoutSender===r,h=a.layoutReceiver?a.layoutReceiver:a.layoutReceiver===r;return(t=o._getItem(t))?(t._migrate.start(s,i,l),t._migrate.isActive&&t.isActive()&&(d&&o.layout("instant"===d,typeof d===at?d:r),h&&s.layout("instant"===h,typeof h===at?h:r)),o):o},o.prototype.destroy=function(e){var i,n=this,o=n._element,s=n._items.concat();if(n._isDestroyed)return n;for(n._resizeHandler&&t.removeEventListener("resize",n._resizeHandler),i=0;i<s.length;i++)s[i]._destroy(e);return n._unsetSortGroups(),X(o,n._settings.containerClass),I(o,{height:""}),n._emit("destroy"),n._emitter.destroy(),ht[n._id]=r,n._isDestroyed=!0,n},o.prototype._getItem=function(t){var e,i,n,r,o=this;if(o._isDestroyed||!t)return o._items[0]||null;if(t instanceof s)return t._gridId===o._id?t:null;if(typeof t===dt)return e=t>-1?t:o._items.length+t,o._items[e]||null;for(i=null,r=0;r<o._items.length;r++)if(n=o._items[r],n._element===t){i=n;break}return i},o.prototype._emit=function(){return this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments),this},o.prototype._refreshDimensions=function(){var t,e=this,i=this.getElement(),n=i.getBoundingClientRect(),r=["left","right","top","bottom"];for(e._width=rt.round(n.width),e._height=rt.round(n.height),e._left=rt.round(n.left),e._top=rt.round(n.top),e._padding={},e._border={},t=0;t<r.length;t++)e._padding[r[t]]=rt.round(A(i,"padding-"+r[t])),e._border[r[t]]=rt.round(A(i,"border-"+r[t]+"-width"));return e},o.prototype._setSortGroups=function(t){var e=this,i=[];return e._sortGroups=null,[].concat(t).forEach(function(t){"string"==typeof t&&i.indexOf(t)<0&&(i.push(t),ut[t]||(ut[t]=[]),ut[t].push(e._id))}),i.length&&(e._sortGroups=i),e},o.prototype._unsetSortGroups=function(){var t,e,i,n=this,r=n._sortGroups;if(r){for(e=0;e<r.length;e++)for(t=ut[r[e]],i=0;i<t.length;i++)if(t[i]===n._id){t.splice(i,1);break}n._sortGroups=null}return n},o.prototype._getSortConnections=function(t){var e,i,n,r,o=this,s=t?[o]:[],a=o._sortConnections;if(o._isDestroyed)return s;if(a&&a.length)for(r=0;r<a.length;r++)if((e=ut[a[r]])&&e.length)for(n=0;n<e.length;n++)(i=ht[e[n]])!==o&&s.indexOf(i)<0&&s.push(i);return s},s.prototype.getGrid=function(){return ht[this._gridId]},s.prototype.getElement=function(){return this._element},s.prototype.getWidth=function(){return this._width},s.prototype.getHeight=function(){return this._height},s.prototype.getMargin=function(){return{left:this._margin.left,right:this._margin.right,top:this._margin.top,bottom:this._margin.bottom}},s.prototype.getPosition=function(){return{left:this._left,top:this._top}},s.prototype.isActive=function(){return this._isActive},s.prototype.isVisible=function(){return!this._isHidden},s.prototype.isShowing=function(){return this._isShowing},s.prototype.isHiding=function(){return this._isHiding},s.prototype.isPositioning=function(){return this._isPositioning},s.prototype.isDragging=function(){return!!this._drag&&this._drag._data.isActive},s.prototype.isReleasing=function(){return this._release.isActive},s.prototype._stopLayout=function(t){var e=this;return e._isDestroyed||!e._isPositioning?e:(e._animate.stop(),X(e._element,e.getGrid()._settings.itemPositioningClass),e._isPositioning=!1,t&&K(e._layoutQueue,!0,e),e)},s.prototype._refreshDimensions=function(){var t,e,i,n,r,o,s=this;if(s._isDestroyed||s._isHidden)return s;for(t=s._element,i=["left","right","top","bottom"],r=s._margin=s._margin||{},o=0;o<4;o++)n=rt.round(A(t,"margin-"+i[o])),r[i[o]]=n>0?n:0;return e=t.getBoundingClientRect(),s._width=rt.round(e.width),s._height=rt.round(e.height),s._outerWidth=s._width+r.left+r.right,s._outerHeight=s._height+r.top+r.bottom,s},s.prototype._refreshSortData=function(){var t,e,i=this;return i._isDestroyed||(t={},e=i.getGrid()._settings.sortData,e&&it.keys(e).forEach(function(n){t[n]=e[n](i,i._element)}),i._sortData=t),i},s.prototype._layout=function(t,e){var n,r,o,s,a,l,d,h,f,u,g=this,_=g._element,p=g._isPositioning,c=g._migrate,m=g._release,y=m.isActive&&!1===m.isPositioningStarted;if(g._isDestroyed)return g;if(n=g.getGrid(),r=n._settings,o=y?r.dragReleaseDuration:r.layoutDuration,s=y?r.dragReleaseEasing:r.layoutEasing,a=!t&&!g._skipNextLayoutAnimation&&o>0,u=function(){g._isPositioning&&(g._isPositioning=!1,X(_,r.itemPositioningClass)),m.isActive&&m.stop(),c.isActive&&c.stop(),K(g._layoutQueue,!1,g)},p&&K(g._layoutQueue,!0,g),y&&(m.isPositioningStarted=!0),typeof e===at&&(g._layoutQueue[g._layoutQueue.length]=e),l=m.isActive?m.containerDiffX:c.isActive?c.containerDiffX:0,d=m.isActive?m.containerDiffY:c.isActive?c.containerDiffY:0,a){if(p&&g._isDefaultAnimate?(h=parseFloat(i.hook(_,"translateX"))-l,f=parseFloat(i.hook(_,"translateY"))-d):(h=x(_,"x")-l,f=x(_,"y")-d),g._left===h&&g._top===f)return g._stopLayout(),void u();p||(g._isPositioning=!0,E(_,r.itemPositioningClass)),g._animate.start({translateX:h+l+"px",translateY:f+d+"px"},{translateX:g._left+l,translateY:g._top+d},{duration:o,easing:s,onFinish:u})}else g._stopLayout(),g._skipNextLayoutAnimation=!1,m.isActive&&_.parentNode!==n._element&&c.isActive&&c.container!==n._element||I(_,{transform:"translateX("+(g._left+l)+"px) translateY("+(g._top+d)+"px)"}),u();return g},s.prototype._show=function(t,e){var i,n,r=this,o=r._element,s=r._visibilityQueue,a=typeof e===at?e:null;return r._isDestroyed?r:(i=r.getGrid(),n=i._settings,r._isShowing?t?(i._itemShowHandler.stop(r),K(s,!0,r),a&&(s[s.length]=a),i._itemShowHandler.start(r,t,function(){r._isShowing=!1,K(s,!1,r)})):a&&(s[s.length]=a):r._isHidden?(r._isHiding&&i._itemHideHandler.stop(r),r._isActive=r._isShowing=!0,r._isHidden=r._isHiding=!1,E(o,n.itemVisibleClass),X(o,n.itemHiddenClass),I(o,{display:"block"}),K(s,!0,r),a&&(s[s.length]=a),i._itemShowHandler.start(r,t,function(){r._isShowing=!1,K(s,!1,r)})):a&&a(!1,r),r)},s.prototype._hide=function(t,e){var i,n,r=this,o=r._element,s=r._visibilityQueue,a=typeof e===at?e:null;return r._isDestroyed?r:(i=r.getGrid(),n=i._settings,r._isHiding?t?(i._itemHideHandler.stop(r),K(s,!0,r),a&&(s[s.length]=a),i._itemHideHandler.start(r,t,function(){r._isHiding=!1,I(o,{display:"none"}),K(s,!1,r)})):a&&(s[s.length]=a):r._isHidden?a&&a(!1,r):(r._isShowing&&i._itemShowHandler.stop(r),r._isHidden=r._isHiding=!0,r._isActive=r._isShowing=!1,E(o,n.itemHiddenClass),X(o,n.itemVisibleClass),K(s,!0,r),typeof a===at&&(s[s.length]=a),i._itemHideHandler.start(r,t,function(){r._isHiding=!1,I(o,{display:"none"}),K(s,!1,r)})),r)},s.prototype._destroy=function(t){var e,i,n,o=this,s=o._element;return o._isDestroyed?o:(e=o.getGrid(),i=e._settings,n=e._items.indexOf(o),o._release.destroy(),o._migrate.destroy(),o._stopLayout(!0),e._itemShowHandler.stop(o),e._itemHideHandler.stop(o),o._drag&&o._drag.destroy(),o._animate.destroy(),o._animateChild.destroy(),s.removeAttribute("style"),o._child.removeAttribute("style"),K(o._visibilityQueue,!0,o),X(s,i.itemPositioningClass),X(s,i.itemDraggingClass),X(s,i.itemReleasingClass),X(s,i.itemClass),X(s,i.itemVisibleClass),X(s,i.itemHiddenClass),n>-1&&e._items.splice(n,1),t&&s.parentNode.removeChild(s),ft[o._id]=r,o._isActive=o._isPositioning=o._isHiding=o._isShowing=!1,o._isDestroyed=o._isHidden=!0,o)},h.prototype.on=function(t,e){if(this._isDestroyed)return this;var i=this._events[t]||[];return i[i.length]=e,this._events[t]=i,this},h.prototype.once=function(t,e){var i=this;return this.on(t,function n(){i.off(t,n),e.apply(null,arguments)})},h.prototype.off=function(t,e){if(this._isDestroyed)return this;for(var i=this._events[t]||[],n=i.length;n--;)e===i[n]&&i.splice(n,1);return this},h.prototype.emit=function(t,e,i,n){if(this._isDestroyed)return this;var r,o=this._events[t]||[],s=o.length,a=arguments.length-1;if(s)for(o=o.concat(),r=0;r<s;r++)0===a?o[r]():1===a?o[r](e):2===a?o[r](e,i):o[r](e,i,n);return this},h.prototype.destroy=function(){if(this._isDestroyed)return this;var t,e=it.keys(this._events);for(t=0;t<e.length;t++)this._events[e[t]]=null;return this._isDestroyed=!0,this},f.prototype.start=function(t,e,n){if(!this._isDestroyed){var r=this,o=r._element,s=n||{},a=typeof s.onFinish===at?s.onFinish:null,l={duration:s.duration||300,easing:s.easing||"ease",queue:r._queue};r._isAnimating&&r.stop(),t&&H(o,t),r._isAnimating=!0,a&&(l.complete=function(){a()}),i(o,e,l),i.Utilities.dequeue(o,r._queue)}},f.prototype.stop=function(){!this._isDestroyed&&this._isAnimating&&(this._isAnimating=!1,i(this._element,"stop",this._queue))},f.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=null,this._isDestroyed=!0)},u.prototype.destroy=function(){var t=this;return t._isDestroyed||(t.stop(!0),t._isDestroyed=!0),t},u.prototype.getItem=function(){return ft[this._itemId]||null},u.prototype.start=function(t,e,i){var n,r,s,a,l,d,h,u,g,_,p,c,m,y,v=this;return v._isDestroyed?v:(n=v.getItem(),r=n.getElement(),s=n.isVisible(),a=n.getGrid(),l=a._settings,d=t._settings,h=t.getElement(),_=i||et.body,u=a._items.indexOf(n),null===(g=typeof e===dt?e:t._items.indexOf(t._getItem(e)))?v:(n.isPositioning()&&n._stopLayout(!0),v.isActive&&v.stop(!0),n.isReleasing()&&n._release.stop(!0),a._itemShowHandler.stop(n),a._itemHideHandler.stop(n),n._drag&&n._drag.destroy(),n._animate.destroy(),n._animateChild.destroy(),K(n._visibilityQueue,!0,n),X(r,l.itemClass),X(r,l.itemVisibleClass),X(r,l.itemHiddenClass),E(r,d.itemClass),E(r,s?d.itemVisibleClass:d.itemHiddenClass),a._items.splice(u,1),S(t._items,n,g),n._gridId=t._id,n._animate=new o.ItemAnimate(n,r),n._animateChild=new o.ItemAnimate(n,n._child),n._isDefaultAnimate=n._animate instanceof f,p=r.parentNode,_!==p&&(_.appendChild(r),c=G(_,p,!0),m=x(r,"x")+c.left,y=x(r,"y")+c.top,I(r,{transform:"translateX("+m+"px) translateY("+y+"px)"})),I(r,{display:s?"block":"hidden"}),n._refreshDimensions()._refreshSortData(),n._child.removeAttribute("style"),s?t._itemShowHandler.start(n,!0):t._itemHideHandler.start(n,!0),n._drag=d.dragEnabled?new o.ItemDrag(n):null,c=G(_,h,!0),v.isActive=!0,v.container=_,v.containerDiffX=c.left,v.containerDiffY=c.top,a._emit("send",{item:n,fromGrid:a,fromIndex:u,toGrid:t,toIndex:g}),t._emit("receive",{item:n,fromGrid:a,fromIndex:u,toGrid:t,toIndex:g}),v))},u.prototype.stop=function(t){var e,i,n,r,o,s,a=this;return a._isDestroyed||!a.isActive?a:(e=a.getItem(),i=e.getElement(),n=e.getGrid(),r=n.getElement(),a.container!==r&&(o=t?x(i,"x")-a.containerDiffX:e._left,s=t?x(i,"y")-a.containerDiffY:e._top,r.appendChild(i),I(i,{transform:"translateX("+o+"px) translateY("+s+"px)"})),a.isActive=!1,a.container=null,a.containerDiffX=0,a.containerDiffY=0,a)},g.prototype.destroy=function(){var t=this;return t._isDestroyed||(t.stop(!0),t._isDestroyed=!0),t},g.prototype.getItem=function(){return ft[this._itemId]||null},g.prototype.reset=function(){var t,e=this;return e._isDestroyed||(t=e.getItem(),X(t.getElement(),t.getGrid()._settings.itemReleasingClass),e.isActive=!1,e.isPositioningStarted=!1,e.containerDiffX=0,e.containerDiffY=0),e},g.prototype.start=function(){var t,e,i,n=this;return n._isDestroyed||n.isActive?n:(t=n.getItem(),e=t.getElement(),i=t.getGrid(),n.isActive=!0,E(e,i._settings.itemReleasingClass),i._emit("dragReleaseStart",t),t._layout(!1),n)},g.prototype.stop=function(t){var e,i,n,r,o,s,a,l,d=this;return d._isDestroyed||!d.isActive?d:(e=d.getItem(),i=e.getElement(),n=e.getGrid(),r=n.getElement(),o=d.containerDiffX,s=d.containerDiffY,d.reset(),i.parentNode!==r&&(a=t?x(i,"x")-o:e._left,l=t?x(i,"y")-s:e._top,r.appendChild(i),I(i,{transform:"translateX("+a+"px) translateY("+l+"px)"})),t||n._emit("dragReleaseEnd",e),d)},_.defaultStartPredicate=function(e,i){var n,r,o,s=e.getElement(),a=e._drag,l=a.getGrid(),d=l._settings.dragStartPredicate||{},h=rt.abs(d.distance)||0,f=rt.abs(d.delay)||0,u="string"==typeof d.handle&&d.handle;if(!i.isFinal){if(u&&!pt(i.srcEvent.target,u))return!1;if(i.distance<h||i.deltaTime<f)return;return!0}n="a"===s.tagName.toLowerCase(),r=s.getAttribute("href"),o=s.getAttribute("target"),n&&r&&rt.abs(i.deltaX)<2&&rt.abs(i.deltaY)<2&&i.deltaTime<200&&(o&&"_self"!==o?t.open(r,o):t.location.href=r)},_.defaultSortPredicate=function(t){var e,i,n,r,o,s=t._drag,a=s._data,l=s.getGrid(),d=l._settings.dragSortPredicate||{},h=d.threshold||50,f=d.action||"move",u={width:t._width,height:t._height,left:rt.round(a.elementClientX),top:rt.round(a.elementClientY)},g=J(u,l,h),_=0,p=0,c=-1;if(!g)return!1;for(g===l?(u.left=rt.round(a.gridX)+t._margin.left,u.top=rt.round(a.gridY)+t._margin.top):(_=g._left+g._border.left+g._padding.left,p=g._top+g._border.top+g._padding.top),o=0;o<g._items.length;o++)n=g._items[o],n._isActive&&n!==t&&(i=!0,(r=W(u,{width:n._width,height:n._height,left:rt.round(n._left)+n._margin.left+_,top:rt.round(n._top)+n._margin.top+p}))>c&&(e=o,c=r));return c<h&&t.getGrid()!==g&&(e=i?-1:0,c=1/0),c>=h&&{grid:g,index:e,action:f}},_.prototype.destroy=function(){var t=this;return t._isDestroyed||(t.stop(),t._hammer.destroy(),t.getItem()._element.removeEventListener("dragstart",$,!1),t._isDestroyed=!0),t},_.prototype.getItem=function(){return ft[this._itemId]||null},_.prototype.getGrid=function(){return ht[this._gridId]||null},
_.prototype.reset=function(){var t=this,e=t._data;return e.isActive=!1,e.container=null,e.containingBlock=null,e.startEvent=null,e.currentEvent=null,e.scrollers=[],e.left=0,e.top=0,e.gridX=0,e.gridY=0,e.elementClientX=0,e.elementClientY=0,e.containerDiffX=0,e.containerDiffY=0,t},_.prototype.checkOverlap=function(){var t,e,i,n,r,o=this,s=o.getItem(),a=o._sortPredicate(s,o._data.currentEvent);return v(a)&&typeof a.index===dt?(t=s.getGrid(),e=t._items.indexOf(s),i=a.grid||t,n=a.index,r="swap"===a.action?"swap":"move",t===i?(n=p(t._items,n),e!==n&&(("swap"===r?c:m)(t._items,e,n),t._emit("move",{item:s,fromIndex:e,toIndex:n,action:r}),t.layout())):(s._gridId=i._id,o._isMigrating=s._gridId!==o._gridId,t._items.splice(e,1),S(i._items,s,n),n=i._items.indexOf(s),s._sortData=null,t._emit("send",{item:s,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),i._emit("receive",{item:s,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),t.layout(),i.layout()),o):o},_.prototype.finishMigration=function(){var t,e,i,n=this,r=n.getItem(),s=r._release,a=r.getElement(),l=r.getGrid(),d=l.getElement(),h=l._settings,u=h.dragContainer||d,g=n.getGrid()._settings,_=a.parentNode;return n._isMigrating=!1,n.destroy(),r._animate.destroy(),r._animateChild.destroy(),X(a,g.itemClass),X(a,g.itemVisibleClass),X(a,g.itemHiddenClass),E(a,h.itemClass),E(a,h.itemVisibleClass),r._animate=new o.ItemAnimate(r,a),r._animateChild=new o.ItemAnimate(r,r._child),r._isDefaultAnimate=r._animate instanceof f,u!==_&&(u.appendChild(a),i=G(_,u,!0),t=x(a,"x")+i.left,e=x(a,"y")+i.top,I(a,{transform:"translateX("+t+"px) translateY("+e+"px)"})),r._refreshDimensions()._refreshSortData(),r._child.removeAttribute("style"),l._itemShowHandler.start(r,!0),r._drag=h.dragEnabled?new o.ItemDrag(r):null,i=G(u,d,!0),s.containerDiffX=i.left,s.containerDiffY=i.top,s.start(),n},_.prototype.stop=function(){var t,e,i,n=this,r=n._data;if(!r.isActive)return n;if(n._isMigrating)return void n.finishMigration(r.currentEvent);for(t=n.getItem()._element,e=n.getGrid(),i=0;i<r.scrollers.length;i++)r.scrollers[i].removeEventListener("scroll",n._scrollHandler);return n._checkSortOverlap("cancel"),t.parentNode!==e._element&&(e._element.appendChild(t),I(t,{transform:"translateX("+r.gridX+"px) translateY("+r.gridY+"px)"})),X(t,e._settings.itemDraggingClass),n.reset(),n},_.prototype.onStart=function(t){var e,i,n,r,o,s,a,l,d,h,f,u,g,_,p=this,c=p.getItem();if(c._isActive){for(e=c._element,i=p.getGrid(),n=i._settings,r=p._data,o=c._release,c.isPositioning()&&c._stopLayout(!0),c._migrate.isActive&&c._migrate.stop(!0),c.isReleasing()&&o.reset(),r.isActive=!0,r.startEvent=r.currentEvent=t,s=x(e,"x"),a=x(e,"y"),l=i._element,r.container=d=n.dragContainer||l,r.containingBlock=h=k(d,!0),r.left=r.gridX=s,r.top=r.gridY=a,d!==l&&(g=e.parentNode===d,g||d.appendChild(e),f=G(h,l),r.containerDiffX=f.left,r.containerDiffY=f.top,g?(r.gridX=s-r.containerDiffX,r.gridY=a-r.containerDiffY):(r.left=s+r.containerDiffX,r.top=a+r.containerDiffY,I(e,{transform:"translateX("+r.left+"px) translateY("+r.top+"px)"}))),u=e.getBoundingClientRect(),r.elementClientX=u.left,r.elementClientY=u.top,r.scrollers=O(e),d!==l&&(r.scrollers=y(r.scrollers.concat(l).concat(O(l)))),_=0;_<r.scrollers.length;_++)r.scrollers[_].addEventListener("scroll",p._scrollHandler);return E(e,n.itemDraggingClass),i._emit("dragStart",c,t),p}},_.prototype.onMove=function(t){var e,i,n,r,o,s,a=this,l=a.getItem();return l._isActive?(e=l._element,i=a.getGrid(),n=i._settings,r=a._data,o=t.deltaX-r.currentEvent.deltaX,s=t.deltaY-r.currentEvent.deltaY,r.currentEvent=t,r.left+=o,r.top+=s,r.gridX+=o,r.gridY+=s,r.elementClientX+=o,r.elementClientY+=s,I(e,{transform:"translateX("+r.left+"px) translateY("+r.top+"px)"}),n.dragSort&&a._checkSortOverlap(),i._emit("dragMove",l,t),a):void a.stop()},_.prototype.onScroll=function(t){var e,i=this,n=i.getItem(),r=n._element,o=i.getGrid(),s=o._settings,a=i._data,l=o._element,d=r.getBoundingClientRect(),h=a.elementClientX-d.left,f=a.elementClientY-d.top;return a.container!==l&&(e=G(a.containingBlock,l),a.containerDiffX=e.left,a.containerDiffY=e.top),a.left+=h,a.top+=f,a.gridX=a.left-a.containerDiffX,a.gridY=a.top-a.containerDiffY,I(r,{transform:"translateX("+a.left+"px) translateY("+a.top+"px)"}),s.dragSort&&i._checkSortOverlap(),o._emit("dragScroll",n,t),i},_.prototype.onEnd=function(t){var e,i=this,n=i.getItem(),r=n._element,o=i.getGrid(),s=o._settings,a=i._data,l=n._release;if(!n._isActive)return void i.stop();for(s.dragSort&&i._checkSortOverlap("finish"),e=0;e<a.scrollers.length;e++)a.scrollers[e].removeEventListener("scroll",i._scrollHandler);return X(r,s.itemDraggingClass),l.containerDiffX=a.containerDiffX,l.containerDiffY=a.containerDiffY,i.reset(),o._emit("dragEnd",n,t),i._isMigrating?i.finishMigration():l.start(),i},o});