Socket
Socket
Sign inDemoInstall

vue-virtual-draglist

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-virtual-draglist - npm Package Compare versions

Comparing version 2.8.8 to 2.8.9

4

dist/virtual-drag-list.min.js
/*!
* vue-virtual-drag-list v2.8.8
* vue-virtual-drag-list v2.8.9
* open source under the MIT license

@@ -11,2 +11,2 @@ * https://github.com/mfuu/vue-virtual-drag-list#readme

* https://github.com/mfuu/sortable-dnd#readme
*/!function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},e.apply(this,arguments)}var n={capture:!1,passive:!1},i=/\s+/g;function o(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var r=o(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),s=o(/Edge/i),l=o(/safari/i)&&!o(/chrome/i)&&!o(/android/i),a=function(){var t=!1;return document.addEventListener("checkIfSupportPassive",null,{get passive(){return t=!0,!0}}),t}();function c(t,e,i){window.addEventListener?t.addEventListener(e,i,!(!a&&r)&&n):window.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i}function u(t,e,i){window.removeEventListener?t.removeEventListener(e,i,!(!a&&r)&&n):window.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null}function h(){return document.scrollingElement||document.documentElement}function d(t,e,n){if(t.getBoundingClientRect||t===window){var i,o,r,s,l,a,c;if(t!==window&&t.parentNode&&t!==h()?(o=(i=t.getBoundingClientRect()).top,r=i.left,s=i.bottom,l=i.right,a=i.height,c=i.width):(o=0,r=0,s=window.innerHeight,l=window.innerWidth,a=window.innerHeight,c=window.innerWidth),e&&t!==window){n=n||t.parentNode;do{if(n&&n.getBoundingClientRect){var u=n.getBoundingClientRect();o-=u.top+parseInt(w(n,"border-top-width")),r-=u.left+parseInt(w(n,"border-left-width")),s=o+i.height,l=r+i.width;break}}while(n=n.parentNode)}return{top:o,left:r,bottom:s,right:l,width:c,height:a}}}function f(t,e,n,i){if(t){if(n&&!e)for(var o=Array.prototype.slice.call(n.children),r=0,s=o.length;r<s;r++)if(o[r]===t||p(t,o[r]))return o[r];n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&S(t,e):S(t,e))||i&&t===n)return t;if(t===n)break}while(t=t.parentNode);return null}}function p(t,e){if(!t||!e)return!1;if(e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return!0;return!1}function m(t,e){for(var n=t.lastElementChild;n&&(n===it.ghost||"none"===w(n,"display")||e&&!S(n,e));)n=n.previousElementSibling;return n||null}function g(t,e){if(!t||!t.parentNode)return-1;for(var n=0;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!S(t,e)||"none"===w(t,"display")||n++;return n}function v(t,e,n,i){for(var o=0,r=0,s=t.children;o<s.length;){if(s[o]!==it.ghost&&"none"!==w(s[o],"display")&&f(s[o],n,t,!1)&&(i||s[o]!==it.dragged)){if(r===e)return s[o];r++}o++}return null}function y(t,e){var n=w(t),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=v(t,0,e),l=v(t,1,e),a=o&&w(o),c=l&&w(l),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+d(o).width,h=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+d(l).width,f=s||r?"cssFloat":"float";if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&"none"!==a.float){var p="left"===a.float?"left":"right";return!l||"both"!==c.clear&&c.clear!==p?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||u>=i&&"none"===n[f]||l&&"none"===n[f]&&u+h>i)?"vertical":"horizontal"}function b(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(i," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(i," ")}}function S(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function w(t,e,n){var i=t&&t.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in i||-1!==e.indexOf("webkit")||(e="-webkit-"+e),i[e]=n+("string"==typeof n?"":"px")}}function x(t,e){var n,i,o=(i=e,(n=t).compareDocumentPosition?n.compareDocumentPosition(i):n.contains?(n!=i&&n.contains(i)&&16)+(n!=i&&i.contains(n)&&8)+(n.sourceIndex>=0&&i.sourceIndex>=0?(n.sourceIndex<i.sourceIndex&&4)+(n.sourceIndex>i.sourceIndex&&2):1):0);return 2===o?1:4===o?-1:0}function _(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function T(t){var n=t.sortable,i=t.name,o=t.params,r=n.options[i];"function"==typeof r&&r(e({},o))}!function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"];(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1]}();var E,D,I="Sortable"+Date.now();function O(t){this.options=t,this.autoScrollAnimationFrame=null}function z(t){this.options=t,this.stack=[]}function R(t){this.options=t||{},this.selectedElements=[]}window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),O.prototype={destroy:function(){this.autoScrollAnimationFrame&&(cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=null)},update:function(t,e,n){var i=this;cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=requestAnimationFrame((function(){e&&n&&i.autoScroll(t,n),i.update(t,e,n)}))},autoScroll:function(t,e){if(t&&void 0!==e.clientX&&void 0!==e.clientY){var n=d(t);if(n){var i=e.clientX,o=e.clientY,r=n.top,s=n.right,l=n.bottom,a=n.left,c=n.height,u=n.width;if(!(o<r||i>s||o>l||i<a)){var h=this.options,f=h.scrollThreshold,p=h.scrollSpeed,m=t.scrollTop,g=t.scrollLeft,v=t.scrollHeight,y=m>0&&o>=r&&o<=r+f,b=g+u<t.scrollWidth&&i<=s&&i>=s-f,S=m+c<v&&o<=l&&o>=l-f;g>0&&i>=a&&i<=a+f&&(t.scrollLeft+=Math.floor(Math.max(-1,(i-a)/f-1)*p.x)),b&&(t.scrollLeft+=Math.ceil(Math.min(1,(i-s)/f+1)*p.x)),y&&(t.scrollTop+=Math.floor(Math.max(-1,(o-r)/f-1)*p.y)),S&&(t.scrollTop+=Math.ceil(Math.min(1,(o-l)/f+1)*p.y))}}}}},z.prototype={collect:function(t){if(t){for(var e=d(t),n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,o=Math.min(e.right,n),r=Math.min(e.bottom,i),s=Array.prototype.slice.call(t.children),l=[],a=0,c=s.length;a<=c;a++){var u=s[a];if(u&&u!==it.ghost&&"none"!==w(u,"display")){var h=d(u);if(!(h.bottom<0||h.right<0)){if(h.top-h.height>r||h.left-h.width>o)break;l.push({el:u,rect:h})}}}this.stack.push(l)}},animate:function(){for(var t=this.stack.pop(),e=0,n=t.length;e<n;e++){var i=t[e],o=i.el,r=i.rect;this.options.animation&&this._excute(o,r)}},_excute:function(t,e){var n=d(t);if(n.top!==e.top||n.left!==e.left){var i=e.left-n.left,o=e.top-n.top;w(t,"transition",""),w(t,"transform","translate3d("+i+"px, "+o+"px, 0)"),t.offsetWidth;var r=this.options,s=r.animation,l=r.easing;w(t,"transition","transform "+s+"ms"+(l?" "+l:"")),w(t,"transform","translate3d(0px, 0px, 0px)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){w(t,"transition",""),w(t,"transform",""),t.animated=null}),s)}}},R.prototype={destroy:function(){E=D=null},active:function(){return!!E},setParams:function(t){t.nodes=E||[],t.clones=D||[]},select:function(t){b(t,this.options.selectedClass,!0),this.selectedElements.push(t),this.selectedElements.sort((function(t,e){return x(t,e)}))},deselect:function(t){var e=this.selectedElements.indexOf(t);e>-1&&(b(t,this.options.selectedClass,!1),this.selectedElements.splice(e,1))},getGhostElement:function(){if(!E)return null;var t=document.createElement("div");return this.selectedElements.forEach((function(e,n){var i=e.cloneNode(!0),o=0===n?1:.5;i.style="position: absolute;left: 0;top: 0;bottom: 0;right: 0;opacity: ".concat(o,";z-index: ").concat(n,";"),t.appendChild(i)})),t},toggleSelected:function(t,e){var n=this;e?t.forEach((function(t){return n.selectedElements.push(t)})):this.selectedElements=this.selectedElements.filter((function(e){return t.indexOf(e)<0}))},toggleClass:function(t){if(E)for(var e=0;e<E.length;e++)b(E[e],this.options.chosenClass,t)},toggleVisible:function(t){if(E)if(t){var e=E.indexOf(it.dragged);this._viewElements(E,e,it.dragged)}else this._hideElements(E)},onChoose:function(){!this.options.multiple||!this.selectedElements.length||this.selectedElements.indexOf(it.dragged)<0||(this.selectedElements.sort((function(t,e){return x(t,e)})),E=this.selectedElements,this.toggleClass(!0))},onDrag:function(t){E&&(t.animator.collect(it.dragged.parentNode),this._hideElements(E),t.animator.animate(),this.toggleClass(!1))},onDrop:function(t,e,n){if(E){var i=it.dragged,o=it.clone,r=E.indexOf(i);e[I].animator.collect(o.parentNode),t!==e&&"clone"===n?(w(o,"display","none"),D=E.map((function(t){return t.cloneNode(!0)})),this._viewElements(D,r,o),this._viewElements(E,r,i)):this._viewElements(E,r,o),e[I].animator.animate(),t!==e&&(e[I].multiplayer.toggleSelected(D||E,!0),"clone"!==n&&t[I].multiplayer.toggleSelected(E,!1))}},onSelect:function(t,e,n){var i=this.selectedElements.indexOf(e);b(e,this.options.selectedClass,i<0);var o={from:n.el,event:t,node:e,index:g(e)};i<0?(this.selectedElements.push(e),T({sortable:n,name:"onSelect",params:o})):(this.selectedElements.splice(i,1),T({sortable:n,name:"onDeselect",params:o})),this.selectedElements.sort((function(t,e){return x(t,e)}))},_viewElements:function(t,e,n){for(var i=0;i<t.length;i++)if(w(t[i],"display",""),i<e)n.parentNode.insertBefore(t[i],n);else{var o=i>0?t[i-1]:n;n.parentNode.insertBefore(t[i],o.nextSibling)}},_hideElements:function(t){for(var e=0;e<t.length;e++)t[e]!=it.dragged&&w(t[e],"display","none")}};var C,k,A,B,M,N,L,P,K,F,j,H,q,$,W,U,Y,X,V,G,J,Q,Z,tt=[];function et(e){var n={},i=e.group;i&&"object"==t(i)||(i={name:i,pull:!0,put:!0,revertDrag:!0}),n.name=i.name,n.pull=i.pull,n.put=i.put,n.revertDrag=i.revertDrag,e.group=n}function nt(t){var e=U||W;return!(void 0!==t.clientX&&void 0!==t.clientY&&Math.abs(t.clientX-e.clientX)<=0&&Math.abs(t.clientY-e.clientY)<=0)}function it(t,n){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(t));t[I]=this,this.el=t,this.options=n=e({},n);var i={store:null,group:"",handle:null,sortable:!0,disabled:!1,multiple:!1,lockAxis:"",direction:"",animation:150,easing:"",draggable:null,selectHandle:null,customGhost:null,autoScroll:!0,scrollThreshold:55,scrollSpeed:{x:10,y:10},delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",swapOnDrop:!0,fallbackOnBody:!1,supportTouch:"ontouchstart"in window,emptyInsertThreshold:-1};for(var o in i)!(o in this.options)&&(this.options[o]=i[o]);for(var r in et(n),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));c(t,this.options.supportTouch?"touchstart":"mousedown",this._onDrag),tt.push(t),this.autoScroller=new O(this.options),this.multiplayer=new R(this.options),this.animator=new z(this.options)}return it.prototype={constructor:it,destroy:function(){this._cancelStart(),this._nulling(),u(this.el,"touchstart",this._onDrag),u(this.el,"mousedown",this._onDrag);var t=tt.indexOf(this.el);t>-1&&tt.splice(t,1),this.el[I]=this.animator=this.multiplayer=this.autoScroller=null},option:function(t,e){if(void 0===e)return this.options[t];this.options[t]=e,this.animator.options[t]=e,this.multiplayer.options[t]=e,this.autoScroller.options[t]=e,"group"===t&&et(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selectedElements},_onDrag:function(t){var e=this;if(!B&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var n=t.touches&&t.touches[0],i=(n||t).target;if(!l||!i||"SELECT"!==i.tagName.toUpperCase()){var o=f(i,this.options.draggable,this.el);if(o&&!o.animated){W={origin:t,clientX:(n||t).clientX,clientY:(n||t).clientY},B=o,c(G=n?B:document,"mouseup",this._onDrop),c(G,"touchend",this._onDrop),c(G,"touchcancel",this._onDrop);var a=this.options,u=a.handle,h=a.selectHandle;if("function"==typeof h&&h(t)||"string"==typeof h&&S(i,h))Z=!0;else if(("function"!=typeof u||u(t))&&("string"!=typeof u||S(i,u))){var d=this.options,p=d.delay,m=d.delayOnTouchOnly;!p||m&&!n||s||r?this._onStart(n,t):(c(this.el.ownerDocument,"touchmove",this._delayMoveHandler),c(this.el.ownerDocument,"mousemove",this._delayMoveHandler),c(this.el.ownerDocument,"mouseup",this._cancelStart),c(this.el.ownerDocument,"touchend",this._cancelStart),c(this.el.ownerDocument,"touchcancel",this._cancelStart),Q=setTimeout((function(){return e._onStart(n,t)}),p)),c(document,"selectstart",_),l&&w(document.body,"user-select","none")}}}}},_delayMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-W.clientX),Math.abs(e.clientY-W.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(Q),u(this.el.ownerDocument,"touchmove",this._delayMoveHandler),u(this.el.ownerDocument,"mousemove",this._delayMoveHandler),u(this.el.ownerDocument,"mouseup",this._cancelStart),u(this.el.ownerDocument,"touchend",this._cancelStart),u(this.el.ownerDocument,"touchcancel",this._cancelStart),u(document,"selectstart",_),l&&w(document.body,"user-select","")},_onStart:function(t,e){var n=g(B);C=this.el,k=this.el,K=B,H=n,q=n,$=n,X={to:this.el,target:B,newIndex:n,relative:0},V=B,A=this.el,L=B.cloneNode(!0),F=B.parentNode,j=this.options.group.pull,it.clone=L,it.active=this,it.dragged=B,b(B,this.options.chosenClass,!0),this.multiplayer.onChoose(),T({sortable:this,name:"onChoose",params:this._getParams(e)}),c(G,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout((function(){return document.selection.empty()}),0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){b(L,this.options.chosenClass,!0),this._appendGhost(),this.multiplayer.onDrag(this),T({sortable:this,name:"onDrag",params:this._getParams(W.origin)}),w(B,"display","none"),b(B,this.options.chosenClass,!1),B.parentNode.insertBefore(L,B)},_getGhostElement:function(){var t=this.options.customGhost;if("function"==typeof t){var e=this.multiplayer.selectedElements;return t(e.length?e:[B])}return this.multiplayer.getGhostElement()||B},_appendGhost:function(){if(!P){var t=this.options.fallbackOnBody?document.body:this.el,n=this._getGhostElement();b(P=n.cloneNode(!0),this.options.ghostClass,!0);var i=d(B),o=e({position:"fixed",top:i.top,left:i.left,width:i.width,height:i.height,zIndex:"100000",opacity:"0.8",overflow:"hidden",boxSizing:"border-box",transform:"translate3d(0px, 0px, 0px)",transition:"none",pointerEvents:"none"},this.options.ghostStyle);for(var r in o)w(P,r,o[r]);it.ghost=P,t.appendChild(P);var s=(W.clientX-i.left)/parseInt(P.style.width)*100,l=(W.clientY-i.top)/parseInt(P.style.height)*100;w(P,"transform-origin",s+"% "+l+"%"),w(P,"will-change","transform")}},_nearestSortable:function(t){_(t);var e=t.touches&&t.touches[0]||t;if(B&&nt(e)){!U&&this._onStarted();var n=this.options.lockAxis,i="x"===n?W.clientX:e.clientX,o="y"===n?W.clientY:e.clientY,r=document.elementFromPoint(i,o),s=i-W.clientX,l=o-W.clientY;U={origin:t,clientX:i,clientY:o},w(P,"transform","translate3d("+s+"px, "+l+"px, 0)");var a,c,u,f=(a=i,c=o,tt.reduce((function(t,e){var n=e[I].options.emptyInsertThreshold;if(null!=n){var i=d(e),o=a>=i.left-n&&a<=i.right+n,r=c>=i.top-n&&c<=i.bottom+n;return o&&r&&(!u||u&&i.left>=u.left&&i.right<=u.right&&i.top>=u.top&&i.bottom<=u.bottom)&&(t=e,u=i),t}}),null));if(f&&f[I]._onMove(t,r),!f||f[I].options.autoScroll){var p=function(t,e){if(!t||!t.getBoundingClientRect)return h();var n=t,i=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=w(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n.getBoundingClientRect||n===document.body)return h();if(i||e)return n;i=!0}}}while(n=n.parentNode);return h()}(r,!0);this.autoScroller.update(p,W,U)}else this.autoScroller.destroy()}},_allowPut:function(){if(A===this.el)return!0;if(this.options.group.put){var t=this.options.group,e=t.name,n=t.put,i=A[I].options.group;return n.join&&n.indexOf(i.name)>-1||i.name&&e&&i.name===e}return!1},_getDirection:function(){var t=this.options,e=t.draggable,n=t.direction;return n?"function"==typeof n?n.call(U.origin,B,this):n:y(F,e)},_allowSwap:function(){var t=d(M),e="vertical"===this._getDirection(),n=e?"top":"left",i=e?"bottom":"right",o=M[e?"offsetHeight":"offsetWidth"],r=e?U.clientY:U.clientX,s=r>=t[n]&&r<t[i]-o/2?-1:1,l=v(F,0,this.options.draggable),a=m(F),c=d(l),u=d(a);if(M===F||p(F,M))return L===l&&r<c[n]?(N=M,!0):L===a&&r>u[i]&&(N=M.nextSibling,!0);var h=x(L,M);return N=h<0?M.nextSibling:M,Y!==M?(J=s,!0):J!==s&&(J=s,s<0?h>0:h<0)},_onMove:function(t,e){if(!this.options.disabled&&this._allowPut()){if(M=f(e,this.options.draggable,this.el),T({sortable:this,name:"onMove",params:this._getParams(t,{target:M})}),this.options.sortable||this.el!==A)return this.el===k||e!==this.el&&m(this.el)?void(M&&!M.animated&&!p(M,L)&&this._allowSwap()&&(M!==L&&N!==L?(this.el!==k?this._onInsert(t):M!==B&&this._onChange(t),Y=M):Y=M)):(M=Y=null,void this._onInsert(t));k!==A&&(M=Y=B,J=0,this._onInsert(t))}},_onInsert:function(t){var e=M||L,n="clone"===j&&this.el!==A&&k===A,i="clone"===j&&this.el===A&&k!==A,o=p(M,document),r=M===B&&!o;C=this.el,H=g(L),K=e,F=o?M.parentNode:this.el,k[I].animator.collect(L.parentNode),this.animator.collect(F),n&&(X.target=V,X.newIndex=H,X.relative=V===B?0:x(L,V),w(B,"display",""),A[I].multiplayer.toggleVisible(!0),A[I].options.group.revertDrag||L.parentNode.insertBefore(B,L)),i&&(H=g(B),w(B,"display","none"),this.multiplayer.toggleVisible(!1)),w(L,"display",r?"none":""),M&&o?F.insertBefore(L,J<0?M:M.nextSibling):F.appendChild(L),q=r?$:g(L),n&&A[I].options.group.revertDrag&&(X.target=B,X.newIndex=$,X.relative=0,T({sortable:A[I],name:"onChange",params:this._getParams(t,{to:A,target:B,newIndex:$,revertDrag:!0})})),n||T({sortable:k[I],name:"onRemove",params:this._getParams(t,{newIndex:-1})}),i&&e!==B&&(V=e,T({sortable:this,name:"onChange",params:this._getParams(t,{from:A,backToOrigin:!0})})),i||T({sortable:this,name:"onAdd",params:this._getParams(t,{oldIndex:-1})}),k[I].animator.animate(),this.animator.animate(),k=this.el},_onChange:function(t){H=g(L),F=M.parentNode,K=M,this.el===A&&(V=M),this.animator.collect(F),F.insertBefore(L,N),q=g(L),T({sortable:this,name:"onChange",params:this._getParams(t)}),this.animator.animate(),k=this.el},_onDrop:function(t){this._cancelStart(),u(G,"touchmove",this._nearestSortable),u(G,"mousemove",this._nearestSortable),u(G,"mouseup",this._onDrop),u(G,"touchend",this._onDrop),u(G,"touchcancel",this._onDrop),b(B,this.options.chosenClass,!1),A&&(k=A,H=$,K===L&&(K=B),this.multiplayer.toggleClass(!1),T({sortable:this,name:"onUnchoose",params:this._getParams(t)}),U&&this._onEnd(t));var e=this.options,n=e.multiple,i=e.selectHandle;n&&(i&&Z||!i&&!A)&&!nt(t.changedTouches?t.changedTouches[0]:t)&&this.multiplayer.onSelect(t,B,this),P&&P.parentNode&&P.parentNode.removeChild(P),this.autoScroller.destroy(),this.multiplayer.destroy(),this._nulling()},_onEnd:function(t){var n=this._getParams(t);this.multiplayer.onDrop(k,C,j);var i=this.options.swapOnDrop;"clone"===j&&k!==C||!("function"==typeof i?i(n):i)||F.insertBefore(B,L),"clone"!==j||k===C||this.multiplayer.active()?L&&L.parentNode&&L.parentNode.removeChild(L):b(L,this.options.chosenClass,!1),w(B,"display",""),k!==C&&T({sortable:k[I],name:"onDrop",params:e({},n,"clone"===j?X:{newIndex:-1})}),T({sortable:C[I],name:"onDrop",params:e({},n,k===C?{}:{oldIndex:-1})})},_getParams:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={};return i.event=t,i.to=C,i.from=k,i.node=B,i.clone=L,i.target=K,i.oldIndex=H,i.newIndex=q,i.pullMode=j,this.multiplayer.setParams(i),e(i,n),i.relative=K===B?0:x(L,K),i},_nulling:function(){C=k=A=B=M=N=L=P=K=F=j=H=q=$=W=U=Y=X=V=G=J=Q=Z=it.clone=it.ghost=it.active=it.dragged=null}},it.utils={on:c,off:u,css:w,index:g,closest:f,getRect:d,toggleClass:b,detectDirection:y},it.get=function(t){return t[I]},it.create=function(t,e){return new it(t,e)},it}()}(c);var u=a(c.exports),h={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},scroller:{type:[Document,HTMLElement]},direction:{type:String,default:"vertical"},keeps:{type:Number,default:30},size:{type:Number},draggable:{type:String,default:".virtual-dnd-list-item"},sortable:{type:Boolean,default:!0},handle:{type:[Function,String]},group:{type:[String,Object]},lockAxis:{type:String,default:""},debounceTime:{type:Number,default:0},animation:{type:Number,default:150},autoScroll:{type:Boolean,default:!0},scrollThreshold:{type:Number,default:55},keepOffset:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fallbackOnBody:{type:Boolean,default:!1},delay:{type:Number,default:0},delayOnTouchOnly:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemStyle:{type:Object},itemClass:{type:String,default:""},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},d={tag:{type:String,default:"div"},dataKey:{type:[String,Number]},sizeKey:{type:String}},f=["delay","group","handle","lockAxis","disabled","sortable","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","fallbackOnBody","scrollThreshold","delayOnTouchOnly"];function p(t,e){this.el=t,this.options=e,this.reRendered=!1,this.installSortable()}function m(t,e){var n=null,i=function(){for(var i=this,o=arguments.length,r=new Array(o),s=0;s<o;s++)r[s]=arguments[s];n||(e<=0?t.apply(this,r):n=setTimeout((function(){n=void 0,t.apply(i,r)}),e))};return i.cancel=function(){n&&(clearTimeout(n),n=null)},i}function g(t,e){var n=m(t,e),i=function(){n.cancel(),n.apply(this,arguments)};return i.cancel=function(){n.cancel()},i}function v(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce((function(t,e){return(t||{})[e]}),t)}p.prototype={constructor:p,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=this.reRendered=null},option:function(t,e){this.options[t]=e,f.includes(t)&&this.sortable.option(t,e)},installSortable:function(){var t=this,e=f.reduce((function(e,n){return e[n]=t.options[n],e}),{});this.sortable=new u(this.el,o(o({},e),{},{emptyInsertThreshold:0,swapOnDrop:function(t){return t.from===t.to},onDrag:function(e){return t.onDrag(e)},onDrop:function(e){return t.onDrop(e)},onAdd:function(e){return t.onAdd(e)},onRemove:function(e){return t.onRemove(e)}}))},onAdd:function(t){var e=u.get(t.from).option("store"),n=e.item,i=e.key;this.sortable.option("store",{item:n,key:i}),this.dispatchEvent("onAdd",{item:n,key:i,event:t})},onRemove:function(t){var e=u.get(t.from).option("store"),n=e.item,i=e.key;this.dispatchEvent("onRemove",{item:n,key:i,event:t})},onDrag:function(t){var e=t.node.getAttribute("data-key"),n=this.getIndex(e),i=this.options.list[n];this.sortable.option("store",{item:i,key:e,index:n}),this.dispatchEvent("onDrag",{item:i,key:e,index:n,event:t})},onDrop:function(t){var e,n,i=u.get(t.from).option("store"),o=i.item,r=i.key,l=i.index,a=this.options.list,c={key:r,item:o,list:a,event:t,changed:!1,oldList:s(a),oldIndex:l,newIndex:l};(t.from===t.to&&t.node===t.target||this.getDropParams(c,t,o,r,l,a),this.dispatchEvent("onDrop",c),t.from===this.el&&this.reRendered)&&(null===(e=u.dragged)||void 0===e||e.remove());t.from!==t.to&&"clone"===t.pullMode&&(null===(n=u.clone)||void 0===n||n.remove());this.reRendered=!1},getDropParams:function(t,e,n,i,o,r){var s=e.target.getAttribute("data-key"),l=-1,a=o;e.from===e.to?(((a=this.getIndex(i))<(l=this.getIndex(s))&&-1===e.relative||a>l&&1===e.relative)&&(l+=e.relative),l!==a&&(r.splice(a,1),r.splice(l,0,n))):(e.from===this.el&&(a=this.getIndex(i),r.splice(a,1)),e.to===this.el&&(a=-1,l=this.getIndex(s),0===e.relative?l=r.length:1===e.relative&&(l+=e.relative),r.splice(l,0,n))),t.changed=e.from!==e.to||l!==a,t.list=r,t.oldIndex=a,t.newIndex=l},getIndex:function(t){return this.options.uniqueKeys.indexOf(t)},dispatchEvent:function(t,e){var n=this.options[t];n&&n(e)}};var y=["size","keeps","scroller","direction","debounceTime","throttleTime"],b="INIT",S="FIXED",w="DYNAMIC",x="FRONT",_="BEHIND",T="STATIONARY",E={vertical:"top",horizontal:"left"},D={vertical:"scrollTop",horizontal:"scrollLeft"},I={vertical:"scrollHeight",horizontal:"scrollWidth"},O={vertical:"offsetHeight",horizontal:"offsetWidth"};function z(t){this.options=t;var e={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(var n in e)!(n in this.options)&&(this.options[n]=e[n]);this.sizes=new Map,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.calcType=b,this.calcSize={average:0,total:0,fixed:0},this.scrollDirection="",this.updateScrollElement(),this.updateOnScrollFunction(),this.addScrollEventListener(),this.checkIfUpdate(0,t.keeps-1)}z.prototype={constructor:z,isFront:function(){return this.scrollDirection===x},isBehind:function(){return this.scrollDirection===_},isFixed:function(){return this.calcType===S},getSize:function(t){return this.sizes.get(t)||this.getItemSize()},getOffset:function(){return this.scrollEl[D[this.options.direction]]},getScrollSize:function(){return this.scrollEl[I[this.options.direction]]},getClientSize:function(){return this.scrollEl[O[this.options.direction]]},scrollToOffset:function(t){this.scrollEl[D[this.options.direction]]=t},scrollToIndex:function(t){if(t>=this.options.uniqueKeys.length-1)this.scrollToBottom();else{var e=this.getOffsetByIndex(t),n=this.getScrollStartOffset();this.scrollToOffset(e+n)}},scrollToBottom:function(){var t=this,e=this.getScrollSize();this.scrollToOffset(e),setTimeout((function(){var e=t.getClientSize(),n=t.getScrollSize();t.getOffset()+e+1<n&&t.scrollToBottom()}),5)},option:function(t,e){var n=this,i=this.options[t];this.options[t]=e,"uniqueKeys"===t&&this.sizes.forEach((function(t,i){e.includes(i)||n.sizes.delete(i)})),"scroller"===t&&(i&&u.utils.off(i,"scroll",this.onScroll),this.updateScrollElement(),this.addScrollEventListener())},updateRange:function(t){if(t)this.handleUpdate(t.start,t.end);else{var e=this.range.start;e=Math.max(e,0),this.handleUpdate(e,this.getEndByStart(e))}},onItemResized:function(t,e){this.sizes.set(t,e),this.calcType===b?(this.calcType=S,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=w,this.calcSize.fixed=void 0),this.calcType!==S&&(this.calcSize.total=s(this.sizes.values()).reduce((function(t,e){return t+e}),0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},addScrollEventListener:function(){this.options.scroller&&u.utils.on(this.options.scroller,"scroll",this.onScroll)},removeScrollEventListener:function(){this.options.scroller&&u.utils.off(this.options.scroller,"scroll",this.onScroll)},enableScroll:function(t){var e=this.options.scroller,n=t?u.utils.off:u.utils.on,i="onwheel"in document.createElement("div")?"wheel":"mousewheel";n(e,"DOMMouseScroll",this.preventDefault),n(e,i,this.preventDefault),n(e,"touchmove",this.preventDefault),n(e,"keydown",this.preventDefaultForKeyDown)},preventDefault:function(t){t.preventDefault()},preventDefaultForKeyDown:function(t){if({37:1,38:1,39:1,40:1}[t.keyCode])return this.preventDefault(t),!1},updateScrollElement:function(){var t=this.options.scroller;t instanceof Document&&9===t.nodeType||t instanceof Window?this.scrollEl=document.scrollingElement||document.documentElement||document.body:this.scrollEl=t},updateOnScrollFunction:function(){var t=this,e=this.options,n=e.debounceTime,i=e.throttleTime;this.onScroll=n?g((function(){return t.handleScroll()}),n):i?m((function(){return t.handleScroll()}),i):function(){return t.handleScroll()}},handleScroll:function(){var t=this.getOffset(),e=this.getClientSize(),n=this.getScrollSize();t===this.offset?this.scrollDirection=T:this.scrollDirection=t<this.offset?x:_,this.offset=t;var i=this.isFront()&&t<=0,o=this.isBehind()&&e+t>=n;this.options.onScroll({top:i,bottom:o,offset:t,direction:this.scrollDirection}),this.isFront()?this.handleScrollFront():this.isBehind()&&this.handleScrollBehind()},handleScrollFront:function(){var t=this.getScrollItems();if(!(t>this.range.start)){var e=Math.max(t-this.options.buffer,0);this.checkIfUpdate(e,this.getEndByStart(e))}},handleScrollBehind:function(){var t=this.getScrollItems();t<this.range.start+this.options.buffer||this.checkIfUpdate(t,this.getEndByStart(t))},getScrollItems:function(){var t=this.offset-this.getScrollStartOffset();if(t<=0)return 0;if(this.isFixed())return Math.floor(t/this.calcSize.fixed);for(var e=0,n=this.options.uniqueKeys.length,i=0,o=0;e<=n;){if(i=e+Math.floor((n-e)/2),(o=this.getOffsetByIndex(i))===t)return i;o<t?e=i+1:o>t&&(n=i-1)}return e>0?--e:0},checkIfUpdate:function(t,e){var n=this.options.keeps;this.options.uniqueKeys.length<=n?(t=0,e=this.getLastIndex()):e-t<n-1&&(t=e-n+1),this.range.start!==t&&this.handleUpdate(t,e)},handleUpdate:function(t,e){this.range.start=t,this.range.end=e,this.range.front=this.getFrontOffset(),this.range.behind=this.getBehindOffset(),this.options.onUpdate(o({},this.range))},getFrontOffset:function(){return this.isFixed()?this.calcSize.fixed*this.range.start:this.getOffsetByIndex(this.range.start)},getBehindOffset:function(){var t=this.range.end,e=this.getLastIndex();return this.isFixed()?(e-t)*this.calcSize.fixed:(e-t)*this.getItemSize()},getOffsetByIndex:function(t){if(!t)return 0;for(var e=0,n=0;n<t;n++){var i=this.sizes.get(this.options.uniqueKeys[n]);e+="number"==typeof i?i:this.getItemSize()}return e},getEndByStart:function(t){return Math.min(t+this.options.keeps-1,this.getLastIndex())},getLastIndex:function(){var t=this.options,e=t.uniqueKeys,n=t.keeps;return e.length>0?e.length-1:n-1},getItemSize:function(){return this.isFixed()?this.calcSize.fixed:this.options.size||this.calcSize.average},getScrollStartOffset:function(){var t=0,e=this.options,n=e.wrapper,i=e.scroller,o=e.direction;if(i&&n){var r=i instanceof Window?u.utils.getRect(n):u.utils.getRect(n,!0,i);t=this.offset+r[E[o]]}return t}};var R={data:function(){return{observer:null}},mounted:function(){var t=this;"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((function(){t.onSizeChange()})),this.$el&&this.observer.observe(this.$el))},updated:function(){this.onSizeChange()},beforeDestroy:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},methods:{onSizeChange:function(){this.$emit("resized",this.dataKey,this.getCurrentSize())},getCurrentSize:function(){return this.$el?this.$el[this.sizeKey]:0}}},C=n.default.component("virtual-draglist-items",{mixins:[R],props:d,render:function(t){var e=this.tag,n=this.dataKey;return t(e,{key:n,attrs:{"data-key":n},class:"virtual-dnd-list-item"},this.$slots.default)}});return n.default.component("virtual-drag-list",{model:{prop:"dataSource",event:"updateDataSource"},props:h,data:function(){return{range:{start:0,end:0,front:0,behind:0},lastList:[],lastLength:null,uniqueKeys:[],virtualRef:null,sortableRef:null}},computed:{isHorizontal:function(){return"vertical"!==this.direction},itemSizeKey:function(){return this.isHorizontal?"offsetWidth":"offsetHeight"},virtualAttributes:function(){var t=this;return y.reduce((function(e,n){return e[n]=t[n],e}),{})},sortableAttributes:function(){var t=this;return f.reduce((function(e,n){return e[n]=t[n],e}),{})}},watch:{dataSource:{handler:function(){this._onUpdate()},deep:!0},virtualAttributes:{handler:function(t,e){if(this.virtualRef)for(var n in t)t[n]!=e[n]&&this.virtualRef.option(n,t[n])}},sortableAttributes:{handler:function(t,e){if(this.sortableRef)for(var n in t)t[n]!=e[n]&&this.sortableRef.option(n,t[n])}}},activated:function(){this.scrollToOffset(this.virtualRef.offset),this.virtualRef.addScrollEventListener()},deactivated:function(){this.virtualRef.removeScrollEventListener()},created:function(){this.range.end=this.keeps-1,this._onUpdate()},mounted:function(){this._initVirtual(),this._initSortable()},beforeDestroy:function(){var t,e;null===(t=this.sortableRef)||void 0===t||t.destroy(),null===(e=this.virtualRef)||void 0===e||e.removeScrollEventListener(),this.sortableRef=this.virtual=null},methods:{getSize:function(t){return this.virtualRef.getSize(t)},getOffset:function(){return this.virtualRef.getOffset()},getClientSize:function(){return this.virtualRef.getClientSize()},getScrollSize:function(){return this.virtualRef.getScrollSize()},scrollToKey:function(t){var e=this.uniqueKeys.indexOf(t);e>-1&&this.virtualRef.scrollToIndex(e)},scrollToIndex:function(t){this.virtualRef.scrollToIndex(t)},scrollToOffset:function(t){this.virtualRef.scrollToOffset(t)},scrollToTop:function(){this.virtualRef.scrollToOffset(0)},scrollToBottom:function(){this.virtualRef.scrollToBottom()},_onUpdate:function(){var t;if(this._updateUniqueKeys(),this._updateRange(this.lastList,this.dataSource),null===(t=this.sortableRef)||void 0===t||t.option("list",this.dataSource),this.lastLength&&this.keepOffset){var e=this.dataSource.length-this.lastLength;e>0&&this.scrollToIndex(e),this.lastLength=null}this.lastList=s(this.dataSource)},_initVirtual:function(){var t=this;this.virtualRef=new z({size:this.size,keeps:this.keeps,buffer:Math.round(this.keeps/3),wrapper:this.$refs.wrapRef,scroller:this.scroller||this.$refs.rootRef,direction:this.direction,uniqueKeys:this.uniqueKeys,debounceTime:this.debounceTime,throttleTime:this.throttleTime,onScroll:function(e){t.lastLength=null,t.dataSource.length&&e.top?t._handleToTop():e.bottom&&t._handleToBottom()},onUpdate:function(e){u.dragged&&e.start!==t.range.start&&(t.sortableRef.reRendered=!0),t.range=e}})},_initSortable:function(){var t=this;this.sortableRef=new p(this.$refs.rootRef,o(o({},this.sortableAttributes),{},{list:this.dataSource,uniqueKeys:this.uniqueKeys,onDrag:function(e){t.sortable||(t.virtualRef.enableScroll(!1),t.sortableRef.option("autoScroll",!1)),t.$emit("drag",e)},onAdd:function(e){t.$emit("add",e)},onRemove:function(e){t.$emit("remove",e)},onDrop:function(e){t.sortable||(t.virtualRef.enableScroll(!0),t.sortableRef.option("autoScroll",t.autoScroll)),e.changed&&t.$emit("updateDataSource",e.list),t.$emit("drop",e)}}))},_updateRange:function(t,e){var n,i=o({},this.range);e.length>t.length&&this.range.end===t.length-1&&this._scrolledToBottom()&&(i.end++,i.start=Math.max(0,i.end-this.keeps+1)),null===(n=this.virtualRef)||void 0===n||n.updateRange(i)},_scrolledToBottom:function(){return this.getOffset()+this.getClientSize()+1>=this.getScrollSize()},_handleToTop:g((function(){this.$emit("top"),this.lastLength=this.dataSource.length})),_handleToBottom:g((function(){this.$emit("bottom")})),_onItemResized:function(t,e){var n=this.virtualRef.sizes.size,i=Math.min(this.keeps,this.dataSource.length);this.virtualRef.onItemResized(t,e),n===i-1&&this._updateRange(this.dataSource,this.dataSource)},_updateUniqueKeys:function(){var t,e,n=this;this.uniqueKeys=this.dataSource.map((function(t){return v(t,n.dataKey)})),null===(t=this.virtualRef)||void 0===t||t.option("uniqueKeys",this.uniqueKeys),null===(e=this.sortableRef)||void 0===e||e.option("uniqueKeys",this.uniqueKeys)},_getItemStyle:function(t){var e;return t==(null===(e=u.dragged)||void 0===e?void 0:e.dataset.key)?{display:"none"}:{}},_renderItems:function(t){for(var e=[],n=this.range,i=n.start,r=n.end,s=i;s<=r;s++){var l=this.dataSource[s];if(l){var a=v(l,this.dataKey),c=o(o({},this.itemStyle),this._getItemStyle(a));e.push(this.$scopedSlots.item?t(C,{key:a,props:{dataKey:a,tag:this.itemTag,sizeKey:this.itemSizeKey},on:{resized:this._onItemResized},style:c,class:this.itemClass},this.$scopedSlots.item({record:l,index:s,dataKey:a})):null)}}return e}},render:function(t){var e=this.range,n=e.front,i=e.behind,r=this.isHorizontal,s=this.rootTag,l=this.wrapTag,a=r?"0px ".concat(i,"px 0px ").concat(n,"px"):"".concat(n,"px 0px ").concat(i,"px");return t(s,{ref:"rootRef",style:!this.scroller&&{overflow:r?"auto hidden":"hidden auto"}},[this.$slots.header,t(l,{ref:"wrapRef",class:this.wrapClass,style:o(o({},this.wrapStyle),{},{padding:a})},this._renderItems(t)),this.$slots.footer])}})}));
*/!function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},e.apply(this,arguments)}var n={capture:!1,passive:!1},i=/\s+/g;function o(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var r=o(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),s=o(/Edge/i),l=o(/safari/i)&&!o(/chrome/i)&&!o(/android/i),a=function(){var t=!1;return document.addEventListener("checkIfSupportPassive",null,{get passive(){return t=!0,!0}}),t}();function c(t,e,i){window.addEventListener?t.addEventListener(e,i,!(!a&&r)&&n):window.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i}function u(t,e,i){window.removeEventListener?t.removeEventListener(e,i,!(!a&&r)&&n):window.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null}function h(){return document.scrollingElement||document.documentElement}function d(t,e,n){if(t.getBoundingClientRect||t===window){var i,o,r,s,l,a,c;if(t!==window&&t.parentNode&&t!==h()?(o=(i=t.getBoundingClientRect()).top,r=i.left,s=i.bottom,l=i.right,a=i.height,c=i.width):(o=0,r=0,s=window.innerHeight,l=window.innerWidth,a=window.innerHeight,c=window.innerWidth),e&&t!==window){n=n||t.parentNode;do{if(n&&n.getBoundingClientRect){var u=n.getBoundingClientRect();o-=u.top+parseInt(w(n,"border-top-width")),r-=u.left+parseInt(w(n,"border-left-width")),s=o+i.height,l=r+i.width;break}}while(n=n.parentNode)}return{top:o,left:r,bottom:s,right:l,width:c,height:a}}}function f(t,e,n,i){if(t){if(n&&!e)for(var o=Array.prototype.slice.call(n.children),r=0,s=o.length;r<s;r++)if(o[r]===t||p(t,o[r]))return o[r];n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&S(t,e):S(t,e))||i&&t===n)return t;if(t===n)break}while(t=t.parentNode);return null}}function p(t,e){if(!t||!e)return!1;if(e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return!0;return!1}function m(t,e){for(var n=t.lastElementChild;n&&(n===it.ghost||"none"===w(n,"display")||e&&!S(n,e));)n=n.previousElementSibling;return n||null}function g(t,e){if(!t||!t.parentNode)return-1;for(var n=0;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!S(t,e)||"none"===w(t,"display")||n++;return n}function v(t,e,n,i){for(var o=0,r=0,s=t.children;o<s.length;){if(s[o]!==it.ghost&&"none"!==w(s[o],"display")&&f(s[o],n,t,!1)&&(i||s[o]!==it.dragged)){if(r===e)return s[o];r++}o++}return null}function y(t,e){var n=w(t),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=v(t,0,e),l=v(t,1,e),a=o&&w(o),c=l&&w(l),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+d(o).width,h=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+d(l).width,f=s||r?"cssFloat":"float";if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&"none"!==a.float){var p="left"===a.float?"left":"right";return!l||"both"!==c.clear&&c.clear!==p?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||u>=i&&"none"===n[f]||l&&"none"===n[f]&&u+h>i)?"vertical":"horizontal"}function b(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(i," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(i," ")}}function S(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function w(t,e,n){var i=t&&t.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in i||-1!==e.indexOf("webkit")||(e="-webkit-"+e),i[e]=n+("string"==typeof n?"":"px")}}function x(t,e){var n,i,o=(i=e,(n=t).compareDocumentPosition?n.compareDocumentPosition(i):n.contains?(n!=i&&n.contains(i)&&16)+(n!=i&&i.contains(n)&&8)+(n.sourceIndex>=0&&i.sourceIndex>=0?(n.sourceIndex<i.sourceIndex&&4)+(n.sourceIndex>i.sourceIndex&&2):1):0);return 2===o?1:4===o?-1:0}function _(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function T(t){var n=t.sortable,i=t.name,o=t.params,r=n.options[i];"function"==typeof r&&r(e({},o))}!function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"];(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1]}();var E,D,I="Sortable"+Date.now();function O(t){this.options=t,this.autoScrollAnimationFrame=null}function z(t){this.options=t,this.stack=[]}function R(t){this.options=t||{},this.selectedElements=[]}window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),O.prototype={destroy:function(){this.autoScrollAnimationFrame&&(cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=null)},update:function(t,e,n){var i=this;cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=requestAnimationFrame((function(){e&&n&&i.autoScroll(t,n),i.update(t,e,n)}))},autoScroll:function(t,e){if(t&&void 0!==e.clientX&&void 0!==e.clientY){var n=d(t);if(n){var i=e.clientX,o=e.clientY,r=n.top,s=n.right,l=n.bottom,a=n.left,c=n.height,u=n.width;if(!(o<r||i>s||o>l||i<a)){var h=this.options,f=h.scrollThreshold,p=h.scrollSpeed,m=t.scrollTop,g=t.scrollLeft,v=t.scrollHeight,y=m>0&&o>=r&&o<=r+f,b=g+u<t.scrollWidth&&i<=s&&i>=s-f,S=m+c<v&&o<=l&&o>=l-f;g>0&&i>=a&&i<=a+f&&(t.scrollLeft+=Math.floor(Math.max(-1,(i-a)/f-1)*p.x)),b&&(t.scrollLeft+=Math.ceil(Math.min(1,(i-s)/f+1)*p.x)),y&&(t.scrollTop+=Math.floor(Math.max(-1,(o-r)/f-1)*p.y)),S&&(t.scrollTop+=Math.ceil(Math.min(1,(o-l)/f+1)*p.y))}}}}},z.prototype={collect:function(t){if(t){for(var e=d(t),n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,o=Math.min(e.right,n),r=Math.min(e.bottom,i),s=Array.prototype.slice.call(t.children),l=[],a=0,c=s.length;a<=c;a++){var u=s[a];if(u&&u!==it.ghost&&"none"!==w(u,"display")){var h=d(u);if(!(h.bottom<0||h.right<0)){if(h.top-h.height>r||h.left-h.width>o)break;l.push({el:u,rect:h})}}}this.stack.push(l)}},animate:function(){for(var t=this.stack.pop(),e=0,n=t.length;e<n;e++){var i=t[e],o=i.el,r=i.rect;this.options.animation&&this._excute(o,r)}},_excute:function(t,e){var n=d(t);if(n.top!==e.top||n.left!==e.left){var i=e.left-n.left,o=e.top-n.top;w(t,"transition",""),w(t,"transform","translate3d("+i+"px, "+o+"px, 0)"),t.offsetWidth;var r=this.options,s=r.animation,l=r.easing;w(t,"transition","transform "+s+"ms"+(l?" "+l:"")),w(t,"transform","translate3d(0px, 0px, 0px)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){w(t,"transition",""),w(t,"transform",""),t.animated=null}),s)}}},R.prototype={destroy:function(){E=D=null},active:function(){return!!E},setParams:function(t){t.nodes=E||[],t.clones=D||[]},select:function(t){b(t,this.options.selectedClass,!0),this.selectedElements.push(t),this.selectedElements.sort((function(t,e){return x(t,e)}))},deselect:function(t){var e=this.selectedElements.indexOf(t);e>-1&&(b(t,this.options.selectedClass,!1),this.selectedElements.splice(e,1))},getGhostElement:function(){if(!E)return null;var t=document.createElement("div");return this.selectedElements.forEach((function(e,n){var i=e.cloneNode(!0),o=0===n?1:.5;i.style="position: absolute;left: 0;top: 0;bottom: 0;right: 0;opacity: ".concat(o,";z-index: ").concat(n,";"),t.appendChild(i)})),t},toggleSelected:function(t,e){var n=this;e?t.forEach((function(t){return n.selectedElements.push(t)})):this.selectedElements=this.selectedElements.filter((function(e){return t.indexOf(e)<0}))},toggleClass:function(t){if(E)for(var e=0;e<E.length;e++)b(E[e],this.options.chosenClass,t)},toggleVisible:function(t){if(E)if(t){var e=E.indexOf(it.dragged);this._viewElements(E,e,it.dragged)}else this._hideElements(E)},onChoose:function(){!this.options.multiple||!this.selectedElements.length||this.selectedElements.indexOf(it.dragged)<0||(this.selectedElements.sort((function(t,e){return x(t,e)})),E=this.selectedElements,this.toggleClass(!0))},onDrag:function(t){E&&(t.animator.collect(it.dragged.parentNode),this._hideElements(E),t.animator.animate(),this.toggleClass(!1))},onDrop:function(t,e,n){if(E){var i=it.dragged,o=it.clone,r=E.indexOf(i);e[I].animator.collect(o.parentNode),t!==e&&"clone"===n?(w(o,"display","none"),D=E.map((function(t){return t.cloneNode(!0)})),this._viewElements(D,r,o),this._viewElements(E,r,i)):this._viewElements(E,r,o),e[I].animator.animate(),t!==e&&(e[I].multiplayer.toggleSelected(D||E,!0),"clone"!==n&&t[I].multiplayer.toggleSelected(E,!1))}},onSelect:function(t,e,n){var i=this.selectedElements.indexOf(e);b(e,this.options.selectedClass,i<0);var o={from:n.el,event:t,node:e,index:g(e)};i<0?(this.selectedElements.push(e),T({sortable:n,name:"onSelect",params:o})):(this.selectedElements.splice(i,1),T({sortable:n,name:"onDeselect",params:o})),this.selectedElements.sort((function(t,e){return x(t,e)}))},_viewElements:function(t,e,n){for(var i=0;i<t.length;i++)if(w(t[i],"display",""),i<e)n.parentNode.insertBefore(t[i],n);else{var o=i>0?t[i-1]:n;n.parentNode.insertBefore(t[i],o.nextSibling)}},_hideElements:function(t){for(var e=0;e<t.length;e++)t[e]!=it.dragged&&w(t[e],"display","none")}};var C,k,A,B,M,N,L,P,K,F,j,H,q,$,W,U,Y,X,V,G,J,Q,Z,tt=[];function et(e){var n={},i=e.group;i&&"object"==t(i)||(i={name:i,pull:!0,put:!0,revertDrag:!0}),n.name=i.name,n.pull=i.pull,n.put=i.put,n.revertDrag=i.revertDrag,e.group=n}function nt(t){var e=U||W;return!(void 0!==t.clientX&&void 0!==t.clientY&&Math.abs(t.clientX-e.clientX)<=0&&Math.abs(t.clientY-e.clientY)<=0)}function it(t,n){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(t));t[I]=this,this.el=t,this.options=n=e({},n);var i={store:null,group:"",handle:null,sortable:!0,disabled:!1,multiple:!1,lockAxis:"",direction:"",animation:150,easing:"",draggable:null,selectHandle:null,customGhost:null,autoScroll:!0,scrollThreshold:55,scrollSpeed:{x:10,y:10},delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",swapOnDrop:!0,fallbackOnBody:!1,supportTouch:"ontouchstart"in window,emptyInsertThreshold:-1};for(var o in i)!(o in this.options)&&(this.options[o]=i[o]);for(var r in et(n),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));c(t,this.options.supportTouch?"touchstart":"mousedown",this._onDrag),tt.push(t),this.autoScroller=new O(this.options),this.multiplayer=new R(this.options),this.animator=new z(this.options)}return it.prototype={constructor:it,destroy:function(){this._cancelStart(),this._nulling(),u(this.el,"touchstart",this._onDrag),u(this.el,"mousedown",this._onDrag);var t=tt.indexOf(this.el);t>-1&&tt.splice(t,1),this.el[I]=this.animator=this.multiplayer=this.autoScroller=null},option:function(t,e){if(void 0===e)return this.options[t];this.options[t]=e,this.animator.options[t]=e,this.multiplayer.options[t]=e,this.autoScroller.options[t]=e,"group"===t&&et(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selectedElements},_onDrag:function(t){var e=this;if(!B&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var n=t.touches&&t.touches[0],i=(n||t).target;if(!l||!i||"SELECT"!==i.tagName.toUpperCase()){var o=f(i,this.options.draggable,this.el);if(o&&!o.animated){W={origin:t,clientX:(n||t).clientX,clientY:(n||t).clientY},B=o,c(G=n?B:document,"mouseup",this._onDrop),c(G,"touchend",this._onDrop),c(G,"touchcancel",this._onDrop);var a=this.options,u=a.handle,h=a.selectHandle;if("function"==typeof h&&h(t)||"string"==typeof h&&S(i,h))Z=!0;else if(("function"!=typeof u||u(t))&&("string"!=typeof u||S(i,u))){var d=this.options,p=d.delay,m=d.delayOnTouchOnly;!p||m&&!n||s||r?this._onStart(n,t):(c(this.el.ownerDocument,"touchmove",this._delayMoveHandler),c(this.el.ownerDocument,"mousemove",this._delayMoveHandler),c(this.el.ownerDocument,"mouseup",this._cancelStart),c(this.el.ownerDocument,"touchend",this._cancelStart),c(this.el.ownerDocument,"touchcancel",this._cancelStart),Q=setTimeout((function(){return e._onStart(n,t)}),p)),c(document,"selectstart",_),l&&w(document.body,"user-select","none")}}}}},_delayMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-W.clientX),Math.abs(e.clientY-W.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(Q),u(this.el.ownerDocument,"touchmove",this._delayMoveHandler),u(this.el.ownerDocument,"mousemove",this._delayMoveHandler),u(this.el.ownerDocument,"mouseup",this._cancelStart),u(this.el.ownerDocument,"touchend",this._cancelStart),u(this.el.ownerDocument,"touchcancel",this._cancelStart),u(document,"selectstart",_),l&&w(document.body,"user-select","")},_onStart:function(t,e){var n=g(B);C=this.el,k=this.el,K=B,H=n,q=n,$=n,X={to:this.el,target:B,newIndex:n,relative:0},V=B,A=this.el,L=B.cloneNode(!0),F=B.parentNode,j=this.options.group.pull,it.clone=L,it.active=this,it.dragged=B,b(B,this.options.chosenClass,!0),this.multiplayer.onChoose(),T({sortable:this,name:"onChoose",params:this._getParams(e)}),c(G,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout((function(){return document.selection.empty()}),0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){b(L,this.options.chosenClass,!0),this._appendGhost(),this.multiplayer.onDrag(this),T({sortable:this,name:"onDrag",params:this._getParams(W.origin)}),w(B,"display","none"),b(B,this.options.chosenClass,!1),B.parentNode.insertBefore(L,B)},_getGhostElement:function(){var t=this.options.customGhost;if("function"==typeof t){var e=this.multiplayer.selectedElements;return t(e.length?e:[B])}return this.multiplayer.getGhostElement()||B},_appendGhost:function(){if(!P){var t=this.options.fallbackOnBody?document.body:this.el,n=this._getGhostElement();b(P=n.cloneNode(!0),this.options.ghostClass,!0);var i=d(B),o=e({position:"fixed",top:i.top,left:i.left,width:i.width,height:i.height,zIndex:"100000",opacity:"0.8",overflow:"hidden",boxSizing:"border-box",transform:"translate3d(0px, 0px, 0px)",transition:"none",pointerEvents:"none"},this.options.ghostStyle);for(var r in o)w(P,r,o[r]);it.ghost=P,t.appendChild(P);var s=(W.clientX-i.left)/parseInt(P.style.width)*100,l=(W.clientY-i.top)/parseInt(P.style.height)*100;w(P,"transform-origin",s+"% "+l+"%"),w(P,"will-change","transform")}},_nearestSortable:function(t){_(t);var e=t.touches&&t.touches[0]||t;if(B&&nt(e)){!U&&this._onStarted();var n=this.options.lockAxis,i="x"===n?W.clientX:e.clientX,o="y"===n?W.clientY:e.clientY,r=document.elementFromPoint(i,o),s=i-W.clientX,l=o-W.clientY;U={origin:t,clientX:i,clientY:o},w(P,"transform","translate3d("+s+"px, "+l+"px, 0)");var a,c,u,f=(a=i,c=o,tt.reduce((function(t,e){var n=e[I].options.emptyInsertThreshold;if(null!=n){var i=d(e),o=a>=i.left-n&&a<=i.right+n,r=c>=i.top-n&&c<=i.bottom+n;return o&&r&&(!u||u&&i.left>=u.left&&i.right<=u.right&&i.top>=u.top&&i.bottom<=u.bottom)&&(t=e,u=i),t}}),null));if(f&&f[I]._onMove(t,r),!f||f[I].options.autoScroll){var p=function(t,e){if(!t||!t.getBoundingClientRect)return h();var n=t,i=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=w(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n.getBoundingClientRect||n===document.body)return h();if(i||e)return n;i=!0}}}while(n=n.parentNode);return h()}(r,!0);this.autoScroller.update(p,W,U)}else this.autoScroller.destroy()}},_allowPut:function(){if(A===this.el)return!0;if(this.options.group.put){var t=this.options.group,e=t.name,n=t.put,i=A[I].options.group;return n.join&&n.indexOf(i.name)>-1||i.name&&e&&i.name===e}return!1},_getDirection:function(){var t=this.options,e=t.draggable,n=t.direction;return n?"function"==typeof n?n.call(U.origin,B,this):n:y(F,e)},_allowSwap:function(){var t=d(M),e="vertical"===this._getDirection(),n=e?"top":"left",i=e?"bottom":"right",o=M[e?"offsetHeight":"offsetWidth"],r=e?U.clientY:U.clientX,s=r>=t[n]&&r<t[i]-o/2?-1:1,l=v(F,0,this.options.draggable),a=m(F),c=d(l),u=d(a);if(M===F||p(F,M))return L===l&&r<c[n]?(N=M,!0):L===a&&r>u[i]&&(N=M.nextSibling,!0);var h=x(L,M);return N=h<0?M.nextSibling:M,Y!==M?(J=s,!0):J!==s&&(J=s,s<0?h>0:h<0)},_onMove:function(t,e){if(!this.options.disabled&&this._allowPut()){if(M=f(e,this.options.draggable,this.el),T({sortable:this,name:"onMove",params:this._getParams(t,{target:M})}),this.options.sortable||this.el!==A)return this.el===k||e!==this.el&&m(this.el)?void(M&&!M.animated&&!p(M,L)&&this._allowSwap()&&(M!==L&&N!==L?(this.el!==k?this._onInsert(t):M!==B&&this._onChange(t),Y=M):Y=M)):(M=Y=null,void this._onInsert(t));k!==A&&(M=Y=B,J=0,this._onInsert(t))}},_onInsert:function(t){var e=M||L,n="clone"===j&&this.el!==A&&k===A,i="clone"===j&&this.el===A&&k!==A,o=p(M,document),r=M===B&&!o;C=this.el,H=g(L),K=e,F=o?M.parentNode:this.el,k[I].animator.collect(L.parentNode),this.animator.collect(F),n&&(X.target=V,X.newIndex=H,X.relative=V===B?0:x(L,V),w(B,"display",""),A[I].multiplayer.toggleVisible(!0),A[I].options.group.revertDrag||L.parentNode.insertBefore(B,L)),i&&(H=g(B),w(B,"display","none"),this.multiplayer.toggleVisible(!1)),w(L,"display",r?"none":""),M&&o?F.insertBefore(L,J<0?M:M.nextSibling):F.appendChild(L),q=r?$:g(L),n&&A[I].options.group.revertDrag&&(X.target=B,X.newIndex=$,X.relative=0,T({sortable:A[I],name:"onChange",params:this._getParams(t,{to:A,target:B,newIndex:$,revertDrag:!0})})),n||T({sortable:k[I],name:"onRemove",params:this._getParams(t,{newIndex:-1})}),i&&e!==B&&(V=e,T({sortable:this,name:"onChange",params:this._getParams(t,{from:A,backToOrigin:!0})})),i||T({sortable:this,name:"onAdd",params:this._getParams(t,{oldIndex:-1})}),k[I].animator.animate(),this.animator.animate(),k=this.el},_onChange:function(t){H=g(L),F=M.parentNode,K=M,this.el===A&&(V=M),this.animator.collect(F),F.insertBefore(L,N),q=g(L),T({sortable:this,name:"onChange",params:this._getParams(t)}),this.animator.animate(),k=this.el},_onDrop:function(t){this._cancelStart(),u(G,"touchmove",this._nearestSortable),u(G,"mousemove",this._nearestSortable),u(G,"mouseup",this._onDrop),u(G,"touchend",this._onDrop),u(G,"touchcancel",this._onDrop),b(B,this.options.chosenClass,!1),A&&(k=A,H=$,K===L&&(K=B),this.multiplayer.toggleClass(!1),T({sortable:this,name:"onUnchoose",params:this._getParams(t)}),U&&this._onEnd(t));var e=this.options,n=e.multiple,i=e.selectHandle;n&&(i&&Z||!i&&!A)&&!nt(t.changedTouches?t.changedTouches[0]:t)&&this.multiplayer.onSelect(t,B,this),P&&P.parentNode&&P.parentNode.removeChild(P),this.autoScroller.destroy(),this.multiplayer.destroy(),this._nulling()},_onEnd:function(t){var n=this._getParams(t);this.multiplayer.onDrop(k,C,j);var i=this.options.swapOnDrop;"clone"===j&&k!==C||!("function"==typeof i?i(n):i)||F.insertBefore(B,L),"clone"!==j||k===C||this.multiplayer.active()?L&&L.parentNode&&L.parentNode.removeChild(L):b(L,this.options.chosenClass,!1),w(B,"display",""),k!==C&&T({sortable:k[I],name:"onDrop",params:e({},n,"clone"===j?X:{newIndex:-1})}),T({sortable:C[I],name:"onDrop",params:e({},n,k===C?{}:{oldIndex:-1})})},_getParams:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={};return i.event=t,i.to=C,i.from=k,i.node=B,i.clone=L,i.target=K,i.oldIndex=H,i.newIndex=q,i.pullMode=j,this.multiplayer.setParams(i),e(i,n),i.relative=K===B?0:x(L,K),i},_nulling:function(){C=k=A=B=M=N=L=P=K=F=j=H=q=$=W=U=Y=X=V=G=J=Q=Z=it.clone=it.ghost=it.active=it.dragged=null}},it.utils={on:c,off:u,css:w,index:g,closest:f,getRect:d,toggleClass:b,detectDirection:y},it.get=function(t){return t[I]},it.create=function(t,e){return new it(t,e)},it}()}(c);var u=a(c.exports),h=["delay","group","handle","lockAxis","disabled","sortable","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","fallbackOnBody","scrollThreshold","delayOnTouchOnly"];function d(t,e){this.el=t,this.options=e,this.reRendered=!1,this.installSortable()}function f(t,e){var n=null,i=function(){for(var i=this,o=arguments.length,r=new Array(o),s=0;s<o;s++)r[s]=arguments[s];n||(e<=0?t.apply(this,r):n=setTimeout((function(){n=void 0,t.apply(i,r)}),e))};return i.cancel=function(){n&&(clearTimeout(n),n=null)},i}function p(t,e){var n=f(t,e),i=function(){n.cancel(),n.apply(this,arguments)};return i.cancel=function(){n.cancel()},i}function m(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce((function(t,e){return(t||{})[e]}),t)}d.prototype={constructor:d,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=this.reRendered=null},option:function(t,e){this.options[t]=e,h.includes(t)&&this.sortable.option(t,e)},installSortable:function(){var t=this,e=h.reduce((function(e,n){return e[n]=t.options[n],e}),{});this.sortable=new u(this.el,o(o({},e),{},{emptyInsertThreshold:0,swapOnDrop:function(t){return t.from===t.to},onDrag:function(e){return t.onDrag(e)},onDrop:function(e){return t.onDrop(e)},onAdd:function(e){return t.onAdd(e)},onRemove:function(e){return t.onRemove(e)}}))},onAdd:function(t){var e=u.get(t.from).option("store"),n=e.item,i=e.key;this.sortable.option("store",{item:n,key:i}),this.dispatchEvent("onAdd",{item:n,key:i,event:t})},onRemove:function(t){var e=u.get(t.from).option("store"),n=e.item,i=e.key;this.dispatchEvent("onRemove",{item:n,key:i,event:t})},onDrag:function(t){var e=t.node.getAttribute("data-key"),n=this.getIndex(e),i=this.options.list[n];this.sortable.option("store",{item:i,key:e,index:n}),this.dispatchEvent("onDrag",{item:i,key:e,index:n,event:t})},onDrop:function(t){var e,n,i=u.get(t.from).option("store"),o=i.item,r=i.key,l=i.index,a=this.options.list,c={key:r,item:o,list:a,event:t,changed:!1,oldList:s(a),oldIndex:l,newIndex:l};(t.from===t.to&&t.node===t.target||this.getDropParams(c,t,o,r,l,a),this.dispatchEvent("onDrop",c),t.from===this.el&&this.reRendered)&&(null===(e=u.dragged)||void 0===e||e.remove());t.from!==t.to&&"clone"===t.pullMode&&(null===(n=u.clone)||void 0===n||n.remove());this.reRendered=!1},getDropParams:function(t,e,n,i,o,r){var s=e.target.getAttribute("data-key"),l=-1,a=o;e.from===e.to?(((a=this.getIndex(i))<(l=this.getIndex(s))&&-1===e.relative||a>l&&1===e.relative)&&(l+=e.relative),l!==a&&(r.splice(a,1),r.splice(l,0,n))):(e.from===this.el&&(a=this.getIndex(i),r.splice(a,1)),e.to===this.el&&(a=-1,l=this.getIndex(s),0===e.relative?l=r.length:1===e.relative&&(l+=e.relative),r.splice(l,0,n))),t.changed=e.from!==e.to||l!==a,t.list=r,t.oldIndex=a,t.newIndex=l},getIndex:function(t){return this.options.uniqueKeys.indexOf(t)},dispatchEvent:function(t,e){var n=this.options[t];n&&n(e)}};var g=["size","keeps","scroller","direction","debounceTime","throttleTime"],v="INIT",y="FIXED",b="DYNAMIC",S="FRONT",w="BEHIND",x="STATIONARY",_={vertical:"top",horizontal:"left"},T={vertical:"scrollTop",horizontal:"scrollLeft"},E={vertical:"scrollHeight",horizontal:"scrollWidth"},D={vertical:"offsetHeight",horizontal:"offsetWidth"};function I(t){this.options=t;var e={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(var n in e)!(n in this.options)&&(this.options[n]=e[n]);this.sizes=new Map,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.calcType=v,this.calcSize={average:0,total:0,fixed:0},this.scrollDirection="",this.updateScrollElement(),this.updateOnScrollFunction(),this.addScrollEventListener(),this.checkIfUpdate(0,t.keeps-1)}I.prototype={constructor:I,isFront:function(){return this.scrollDirection===S},isBehind:function(){return this.scrollDirection===w},isFixed:function(){return this.calcType===y},getSize:function(t){return this.sizes.get(t)||this.getItemSize()},getOffset:function(){return this.scrollEl[T[this.options.direction]]},getScrollSize:function(){return this.scrollEl[E[this.options.direction]]},getClientSize:function(){return this.scrollEl[D[this.options.direction]]},scrollToOffset:function(t){this.scrollEl[T[this.options.direction]]=t},scrollToIndex:function(t){if(t>=this.options.uniqueKeys.length-1)this.scrollToBottom();else{var e=this.getOffsetByIndex(t),n=this.getScrollStartOffset();this.scrollToOffset(e+n)}},scrollToBottom:function(){var t=this,e=this.getScrollSize();this.scrollToOffset(e),setTimeout((function(){var e=t.getClientSize(),n=t.getScrollSize();t.getOffset()+e+1<n&&t.scrollToBottom()}),5)},option:function(t,e){var n=this,i=this.options[t];this.options[t]=e,"uniqueKeys"===t&&this.sizes.forEach((function(t,i){e.includes(i)||n.sizes.delete(i)})),"scroller"===t&&(i&&u.utils.off(i,"scroll",this.onScroll),this.updateScrollElement(),this.addScrollEventListener())},updateRange:function(t){if(t)this.handleUpdate(t.start,t.end);else{var e=this.range.start;e=Math.max(e,0),this.handleUpdate(e,this.getEndByStart(e))}},onItemResized:function(t,e){this.sizes.set(t,e),this.calcType===v?(this.calcType=y,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=b,this.calcSize.fixed=void 0),this.calcType!==y&&(this.calcSize.total=s(this.sizes.values()).reduce((function(t,e){return t+e}),0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},addScrollEventListener:function(){this.options.scroller&&u.utils.on(this.options.scroller,"scroll",this.onScroll)},removeScrollEventListener:function(){this.options.scroller&&u.utils.off(this.options.scroller,"scroll",this.onScroll)},enableScroll:function(t){var e=this.options.scroller,n=t?u.utils.off:u.utils.on,i="onwheel"in document.createElement("div")?"wheel":"mousewheel";n(e,"DOMMouseScroll",this.preventDefault),n(e,i,this.preventDefault),n(e,"touchmove",this.preventDefault),n(e,"keydown",this.preventDefaultForKeyDown)},preventDefault:function(t){t.preventDefault()},preventDefaultForKeyDown:function(t){if({37:1,38:1,39:1,40:1}[t.keyCode])return this.preventDefault(t),!1},updateScrollElement:function(){var t=this.options.scroller;t instanceof Document&&9===t.nodeType||t instanceof Window?this.scrollEl=document.scrollingElement||document.documentElement||document.body:this.scrollEl=t},updateOnScrollFunction:function(){var t=this,e=this.options,n=e.debounceTime,i=e.throttleTime;this.onScroll=n?p((function(){return t.handleScroll()}),n):i?f((function(){return t.handleScroll()}),i):function(){return t.handleScroll()}},handleScroll:function(){var t=this.getOffset(),e=this.getClientSize(),n=this.getScrollSize();t===this.offset?this.scrollDirection=x:this.scrollDirection=t<this.offset?S:w,this.offset=t;var i=this.isFront()&&t<=0,o=this.isBehind()&&e+t>=n;this.options.onScroll({top:i,bottom:o,offset:t,direction:this.scrollDirection}),this.isFront()?this.handleScrollFront():this.isBehind()&&this.handleScrollBehind()},handleScrollFront:function(){var t=this.getScrollItems();if(!(t>this.range.start)){var e=Math.max(t-this.options.buffer,0);this.checkIfUpdate(e,this.getEndByStart(e))}},handleScrollBehind:function(){var t=this.getScrollItems();t<this.range.start+this.options.buffer||this.checkIfUpdate(t,this.getEndByStart(t))},getScrollItems:function(){var t=this.offset-this.getScrollStartOffset();if(t<=0)return 0;if(this.isFixed())return Math.floor(t/this.calcSize.fixed);for(var e=0,n=this.options.uniqueKeys.length,i=0,o=0;e<=n;){if(i=e+Math.floor((n-e)/2),(o=this.getOffsetByIndex(i))===t)return i;o<t?e=i+1:o>t&&(n=i-1)}return e>0?--e:0},checkIfUpdate:function(t,e){var n=this.options.keeps;this.options.uniqueKeys.length<=n?(t=0,e=this.getLastIndex()):e-t<n-1&&(t=e-n+1),this.range.start!==t&&this.handleUpdate(t,e)},handleUpdate:function(t,e){this.range.start=t,this.range.end=e,this.range.front=this.getFrontOffset(),this.range.behind=this.getBehindOffset(),this.options.onUpdate(o({},this.range))},getFrontOffset:function(){return this.isFixed()?this.calcSize.fixed*this.range.start:this.getOffsetByIndex(this.range.start)},getBehindOffset:function(){var t=this.range.end,e=this.getLastIndex();return this.isFixed()?(e-t)*this.calcSize.fixed:(e-t)*this.getItemSize()},getOffsetByIndex:function(t){if(!t)return 0;for(var e=0,n=0;n<t;n++){var i=this.sizes.get(this.options.uniqueKeys[n]);e+="number"==typeof i?i:this.getItemSize()}return e},getEndByStart:function(t){return Math.min(t+this.options.keeps-1,this.getLastIndex())},getLastIndex:function(){var t=this.options,e=t.uniqueKeys,n=t.keeps;return e.length>0?e.length-1:n-1},getItemSize:function(){return this.isFixed()?this.calcSize.fixed:this.options.size||this.calcSize.average},getScrollStartOffset:function(){var t=0,e=this.options,n=e.wrapper,i=e.scroller,o=e.direction;if(i&&n){var r=i instanceof Window?u.utils.getRect(n):u.utils.getRect(n,!0,i);t=this.offset+r[_[o]]}return t}};var O={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},scroller:{type:[Document,HTMLElement]},direction:{type:String,default:"vertical"},keeps:{type:Number,default:30},size:{type:Number},draggable:{type:String,default:".virtual-dnd-list-item"},sortable:{type:Boolean,default:!0},handle:{type:[Function,String]},group:{type:[String,Object]},lockAxis:{type:String,default:""},debounceTime:{type:Number,default:0},animation:{type:Number,default:150},autoScroll:{type:Boolean,default:!0},scrollThreshold:{type:Number,default:55},keepOffset:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fallbackOnBody:{type:Boolean,default:!1},delay:{type:Number,default:0},delayOnTouchOnly:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemStyle:{type:Object},itemClass:{type:String,default:""},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},z={tag:{type:String,default:"div"},dataKey:{type:[String,Number]},sizeKey:{type:String}},R={data:function(){return{observer:null}},mounted:function(){var t=this;"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((function(){t.onSizeChange()})),this.$el&&this.observer.observe(this.$el))},updated:function(){this.onSizeChange()},beforeDestroy:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},methods:{onSizeChange:function(){this.$emit("resized",this.dataKey,this.getCurrentSize())},getCurrentSize:function(){return this.$el?this.$el[this.sizeKey]:0}}},C=n.default.component("virtual-draglist-items",{mixins:[R],props:z,render:function(t){var e=this.tag,n=this.dataKey;return t(e,{key:n,attrs:{"data-key":n},class:"virtual-dnd-list-item"},this.$slots.default)}});return n.default.component("virtual-drag-list",{model:{prop:"dataSource",event:"updateDataSource"},props:O,data:function(){return{range:{start:0,end:0,front:0,behind:0},dragging:"",lastList:[],lastLength:null,uniqueKeys:[],virtualRef:null,sortableRef:null}},computed:{isHorizontal:function(){return"vertical"!==this.direction},itemSizeKey:function(){return this.isHorizontal?"offsetWidth":"offsetHeight"},virtualAttributes:function(){var t=this;return g.reduce((function(e,n){return e[n]=t[n],e}),{})},sortableAttributes:function(){var t=this;return h.reduce((function(e,n){return e[n]=t[n],e}),{})}},watch:{dataSource:{handler:function(){this._onUpdate()},deep:!0},virtualAttributes:{handler:function(t,e){if(this.virtualRef)for(var n in t)t[n]!=e[n]&&this.virtualRef.option(n,t[n])}},sortableAttributes:{handler:function(t,e){if(this.sortableRef)for(var n in t)t[n]!=e[n]&&this.sortableRef.option(n,t[n])}}},activated:function(){this.scrollToOffset(this.virtualRef.offset),this.virtualRef.addScrollEventListener()},deactivated:function(){this.virtualRef.removeScrollEventListener()},created:function(){this.range.end=this.keeps-1,this._onUpdate()},mounted:function(){this._initVirtual(),this._initSortable()},beforeDestroy:function(){var t,e;null===(t=this.sortableRef)||void 0===t||t.destroy(),null===(e=this.virtualRef)||void 0===e||e.removeScrollEventListener(),this.sortableRef=this.virtual=null},methods:{getSize:function(t){return this.virtualRef.getSize(t)},getOffset:function(){return this.virtualRef.getOffset()},getClientSize:function(){return this.virtualRef.getClientSize()},getScrollSize:function(){return this.virtualRef.getScrollSize()},scrollToKey:function(t){var e=this.uniqueKeys.indexOf(t);e>-1&&this.virtualRef.scrollToIndex(e)},scrollToIndex:function(t){this.virtualRef.scrollToIndex(t)},scrollToOffset:function(t){this.virtualRef.scrollToOffset(t)},scrollToTop:function(){this.virtualRef.scrollToOffset(0)},scrollToBottom:function(){this.virtualRef.scrollToBottom()},_onUpdate:function(){var t;if(this._updateUniqueKeys(),this._updateRange(this.lastList,this.dataSource),null===(t=this.sortableRef)||void 0===t||t.option("list",this.dataSource),this.lastLength&&this.keepOffset){var e=this.dataSource.length-this.lastLength;e>0&&this.scrollToIndex(e),this.lastLength=null}this.lastList=s(this.dataSource)},_initVirtual:function(){var t=this;this.virtualRef=new I({size:this.size,keeps:this.keeps,buffer:Math.round(this.keeps/3),wrapper:this.$refs.wrapRef,scroller:this.scroller||this.$refs.rootRef,direction:this.direction,uniqueKeys:this.uniqueKeys,debounceTime:this.debounceTime,throttleTime:this.throttleTime,onScroll:function(e){t.lastLength=null,t.dataSource.length&&e.top?t._handleToTop():e.bottom&&t._handleToBottom()},onUpdate:function(e){var n=e.start!==t.range.start;t.dragging&&n&&(t.sortableRef.reRendered=!0),t.range=e,n&&t.$emit("rangeChange",e)}})},_initSortable:function(){var t=this;this.sortableRef=new d(this.$refs.rootRef,o(o({},this.sortableAttributes),{},{list:this.dataSource,uniqueKeys:this.uniqueKeys,onDrag:function(e){t.dragging=e.key,t.sortable||(t.virtualRef.enableScroll(!1),t.sortableRef.option("autoScroll",!1)),t.$emit("drag",e)},onAdd:function(e){t.$emit("add",e)},onRemove:function(e){t.$emit("remove",e)},onDrop:function(e){t.dragging="",t.sortable||(t.virtualRef.enableScroll(!0),t.sortableRef.option("autoScroll",t.autoScroll)),e.changed&&t.$emit("updateDataSource",e.list),t.$emit("drop",e)}}))},_updateRange:function(t,e){var n,i=o({},this.range);e.length>t.length&&this.range.end===t.length-1&&this._scrolledToBottom()&&(i.end++,i.start=Math.max(0,i.end-this.keeps+1)),null===(n=this.virtualRef)||void 0===n||n.updateRange(i)},_scrolledToBottom:function(){return this.getOffset()+this.getClientSize()+1>=this.getScrollSize()},_handleToTop:p((function(){this.$emit("top"),this.lastLength=this.dataSource.length})),_handleToBottom:p((function(){this.$emit("bottom")})),_onItemResized:function(t,e){var n=this.virtualRef.sizes.size,i=Math.min(this.keeps,this.dataSource.length);this.virtualRef.onItemResized(t,e),n===i-1&&this._updateRange(this.dataSource,this.dataSource)},_updateUniqueKeys:function(){var t,e,n=this;this.uniqueKeys=this.dataSource.map((function(t){return m(t,n.dataKey)})),null===(t=this.virtualRef)||void 0===t||t.option("uniqueKeys",this.uniqueKeys),null===(e=this.sortableRef)||void 0===e||e.option("uniqueKeys",this.uniqueKeys)},_getItemStyle:function(t){return t==this.dragging?{display:"none"}:{}},_renderItems:function(t){for(var e=[],n=this.range,i=n.start,r=n.end,s=i;s<=r;s++){var l=this.dataSource[s];if(l){var a=m(l,this.dataKey),c=o(o({},this.itemStyle),this._getItemStyle(a));e.push(this.$scopedSlots.item?t(C,{key:a,props:{dataKey:a,tag:this.itemTag,sizeKey:this.itemSizeKey},on:{resized:this._onItemResized},style:c,class:this.itemClass},this.$scopedSlots.item({record:l,index:s,dataKey:a})):null)}}return e}},render:function(t){var e=this.range,n=e.front,i=e.behind,r=this.isHorizontal,s=this.rootTag,l=this.wrapTag,a=r?"0px ".concat(i,"px 0px ").concat(n,"px"):"".concat(n,"px 0px ").concat(i,"px");return t(s,{ref:"rootRef",style:!this.scroller&&{overflow:r?"auto hidden":"hidden auto"}},[this.$slots.header,t(l,{ref:"wrapRef",class:this.wrapClass,style:o(o({},this.wrapStyle),{},{padding:a})},this._renderItems(t)),this.$slots.footer])}})}));
{
"name": "vue-virtual-draglist",
"version": "2.8.8",
"version": "2.8.9",
"description": "A virtual scrolling list component that can be sorted by dragging",

@@ -5,0 +5,0 @@ "main": "dist/virtual-drag-list.min.js",

@@ -72,2 +72,3 @@ # vue-virtual-draglist

| `remove` | element is removed from the list into another |
| `rangeChange`| triggered when the range changes |

@@ -74,0 +75,0 @@ ## Props

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc