/**! * Sortable 1.10.2 * @author RubaXa * @author owenm * @license MIT */ 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(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(){return n=Object.assign||function(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function r(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var a=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),l=r(/Edge/i),s=r(/firefox/i),c=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),d=r(/iP(ad|od|hone)/i),u=r(/chrome/i)&&r(/android/i),h={capture:!1,passive:!1};function f(t,e,n){t.addEventListener(e,n,!a&&h)}function p(t,e,n){t.removeEventListener(e,n,!a&&h)}function g(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(n){return!1}return!1}}function m(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function v(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&g(t,e):g(t,e))||o&&t===n)return t;if(t===n)break}while(t=m(t))}return null}var b,y=/\s+/g;function w(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(y," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(y," ")}}function E(t,e,n){var o=t&&t.style;if(o){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 o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function D(t,e){var n="";if("string"==typeof t)n=t;else do{var o=E(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function _(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=r:i<=r))return o;if(o===S())break;o=N(o,!1)}return!1}function T(t,e,n){for(var o=0,i=0,r=t.children;i2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,a=i(n,["evt"]);$.pluginEvent.bind(At)(t,e,o({dragEl:H,parentEl:W,ghostEl:V,rootEl:U,nextEl:z,lastDownEl:G,cloneEl:q,cloneHidden:J,dragStarted:ct,putSortable:nt,activeSortable:At.active,originalEvent:r,oldIndex:Z,oldDraggableIndex:Q,newIndex:K,newDraggableIndex:tt,hideGhostForTarget:It,unhideGhostForTarget:Mt,cloneNowHidden:function(){J=!0},cloneNowShown:function(){J=!1},dispatchSortableEvent:function(t){j({sortable:e,name:t,originalEvent:r})}},a))};function j(t){!function(t){var e=t.sortable,n=t.rootEl,i=t.name,r=t.targetEl,s=t.cloneEl,c=t.toEl,d=t.fromEl,u=t.oldIndex,h=t.newIndex,f=t.oldDraggableIndex,p=t.newDraggableIndex,g=t.originalEvent,m=t.putSortable,v=t.extraEventProperties;if(e=e||n&&n[R]){var b,y=e.options,w="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||a||l?(b=document.createEvent("Event")).initEvent(i,!0,!0):b=new CustomEvent(i,{bubbles:!0,cancelable:!0}),b.to=c||n,b.from=d||n,b.item=r||n,b.clone=s,b.oldIndex=u,b.newIndex=h,b.oldDraggableIndex=f,b.newDraggableIndex=p,b.originalEvent=g,b.pullMode=m?m.lastPutMode:void 0;var E=o({},v,$.getEventProperties(i,e));for(var D in E)b[D]=E[D];n&&n.dispatchEvent(b),y[w]&&y[w].call(e,b)}}(o({putSortable:nt,cloneEl:q,targetEl:H,rootEl:U,oldIndex:Z,oldDraggableIndex:Q,newIndex:K,newDraggableIndex:tt},t))}var H,W,V,U,z,G,q,J,Z,K,Q,tt,et,nt,ot,it,rt,at,lt,st,ct,dt,ut,ht,ft,pt=!1,gt=!1,mt=[],vt=!1,bt=!1,yt=[],wt=!1,Et=[],Dt="undefined"!=typeof document,_t=d,St=l||a?"cssFloat":"float",Ct=Dt&&!u&&!d&&"draggable"in document.createElement("div"),xt=function(){if(Dt){if(a)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Tt=function(t,e){var n=E(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=T(t,0,e),r=T(t,1,e),a=i&&E(i),l=r&&E(r),s=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+C(i).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+C(r).width;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(i&&a.float&&"none"!==a.float){var d="left"===a.float?"left":"right";return!r||"both"!==l.clear&&l.clear!==d?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||s>=o&&"none"===n[St]||r&&"none"===n[St]&&s+c>o)?"vertical":"horizontal"},Ot=function(e){function n(t,e){return function(o,i,r,a){var l=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(e||l))return!0;if(null==t||!1===t)return!1;if(e&&"clone"===t)return t;if("function"==typeof t)return n(t(o,i,r,a),e)(o,i,r,a);var s=(e?o:i).options.group.name;return!0===t||"string"==typeof t&&t===s||t.join&&t.indexOf(s)>-1}}var o={},i=e.group;i&&"object"==t(i)||(i={name:i}),o.name=i.name,o.checkPull=n(i.pull,!0),o.checkPut=n(i.put),o.revertClone=i.revertClone,e.group=o},It=function(){!xt&&V&&E(V,"display","none")},Mt=function(){!xt&&V&&E(V,"display","")};Dt&&document.addEventListener("click",(function(t){if(gt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),gt=!1,!1}),!0);var Nt=function(t){if(H){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,mt.some((function(t){if(!O(t)){var e=C(t),n=t[R].options.emptyInsertThreshold,o=i>=e.left-n&&i<=e.right+n,l=r>=e.top-n&&r<=e.bottom+n;return n&&o&&l?a=t:void 0}})),a);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[R]._onDragOver(n)}}var i,r,a},Pt=function(t){H&&H.parentNode[R]._isOutsideThisEl(t.target)};function At(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=n({},e),t[R]=this;var o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Tt(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==At.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var i in $.initializePlugins(this,t,o),o)!(i in e)&&(e[i]=o[i]);for(var r in Ot(e),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!e.forceFallback&&Ct,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?f(t,"pointerdown",this._onTapStart):(f(t,"mousedown",this._onTapStart),f(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(f(t,"dragover",this),f(t,"dragenter",this)),mt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),n(this,X())}function kt(t,e,n,o,i,r,s,c){var d,u,h=t[R],f=h.options.onMove;return!window.CustomEvent||a||l?(d=document.createEvent("Event")).initEvent("move",!0,!0):d=new CustomEvent("move",{bubbles:!0,cancelable:!0}),d.to=e,d.from=t,d.dragged=n,d.draggedRect=o,d.related=i||e,d.relatedRect=r||C(e),d.willInsertAfter=c,d.originalEvent=s,t.dispatchEvent(d),f&&(u=f.call(h,d,s)),u}function Ft(t){t.draggable=!1}function Rt(){wt=!1}function Xt(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Lt(t){return setTimeout(t,0)}function Yt(t){return clearTimeout(t)}At.prototype={constructor:At,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(dt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,H):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,a=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,l=(a||t).target,s=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,c=o.filter;if(function(t){Et.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Et.push(o)}}(n),!H&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled||s.isContentEditable||(l=v(l,o.draggable,n,!1))&&l.animated||G===l)){if(Z=I(l),Q=I(l,o.draggable),"function"==typeof c){if(c.call(this,t,l,this))return j({sortable:e,rootEl:s,name:"filter",targetEl:l,toEl:n,fromEl:n}),B("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=v(s,o.trim(),n,!1))return j({sortable:e,rootEl:o,name:"filter",targetEl:l,fromEl:n,toEl:n}),B("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!v(s,o.handle,n,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,c=i.options,d=r.ownerDocument;if(n&&!H&&n.parentNode===r){var u=C(n);if(U=r,W=(H=n).parentNode,z=H.nextSibling,G=n,et=c.group,At.dragged=H,ot={target:H,clientX:(e||t).clientX,clientY:(e||t).clientY},lt=ot.clientX-u.left,st=ot.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,H.style["will-change"]="all",o=function(){B("delayEnded",i,{evt:t}),At.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!s&&i.nativeDraggable&&(H.draggable=!0),i._triggerDragStart(t,e),j({sortable:i,name:"choose",originalEvent:t}),w(H,c.chosenClass,!0))},c.ignore.split(",").forEach((function(t){_(H,t.trim(),Ft)})),f(d,"dragover",Nt),f(d,"mousemove",Nt),f(d,"touchmove",Nt),f(d,"mouseup",i._onDrop),f(d,"touchend",i._onDrop),f(d,"touchcancel",i._onDrop),s&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),B("delayStart",this,{evt:t}),!c.delay||c.delayOnTouchOnly&&!e||this.nativeDraggable&&(l||a))o();else{if(At.eventCanceled)return void this._onDrop();f(d,"mouseup",i._disableDelayedDrag),f(d,"touchend",i._disableDelayedDrag),f(d,"touchcancel",i._disableDelayedDrag),f(d,"mousemove",i._delayedDragTouchMoveHandler),f(d,"touchmove",i._delayedDragTouchMoveHandler),c.supportPointer&&f(d,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,c.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){H&&Ft(H),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;p(t,"mouseup",this._disableDelayedDrag),p(t,"touchend",this._disableDelayedDrag),p(t,"touchcancel",this._disableDelayedDrag),p(t,"mousemove",this._delayedDragTouchMoveHandler),p(t,"touchmove",this._delayedDragTouchMoveHandler),p(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?f(document,"pointermove",this._onTouchMove):f(document,e?"touchmove":"mousemove",this._onTouchMove):(f(H,"dragend",this),f(U,"dragstart",this._onDragStart));try{document.selection?Lt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(pt=!1,U&&H){B("dragStarted",this,{evt:e}),this.nativeDraggable&&f(document,"dragover",Pt);var n=this.options;!t&&w(H,n.dragClass,!1),w(H,n.ghostClass,!0),At.active=this,t&&this._appendGhost(),j({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(it){this._lastX=it.clientX,this._lastY=it.clientY,It();for(var t=document.elementFromPoint(it.clientX,it.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(it.clientX,it.clientY))!==e;)e=t;if(H.parentNode[R]._isOutsideThisEl(t),e)do{if(e[R]){if(e[R]._onDragOver({clientX:it.clientX,clientY:it.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Mt()}},_onTouchMove:function(t){if(ot){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=V&&D(V,!0),a=V&&r&&r.a,l=V&&r&&r.d,s=_t&&ft&&M(ft),c=(i.clientX-ot.clientX+o.x)/(a||1)+(s?s[0]-yt[0]:0)/(a||1),d=(i.clientY-ot.clientY+o.y)/(l||1)+(s?s[1]-yt[1]:0)/(l||1);if(!At.active&&!pt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))o.right+i||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+i}(t,r,this)&&!m.animated){if(m===H)return $(!1);if(m&&a===t.target&&(l=m),l&&(n=C(l)),!1!==kt(U,a,H,e,l,n,t,!!l))return Y(),a.appendChild(H),W=a,G(),$(!0)}else if(l.parentNode===a){n=C(l);var b,y,D,_=H.parentNode!==a,S=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,s=n?e.width:e.height;return o===a||i===l||o+r/2===a+s/2}(H.animated&&H.toRect||e,l.animated&&l.toRect||n,r),T=r?"top":"left",M=x(l,"top","top")||x(H,"top","top"),N=M?M.scrollTop:void 0;if(dt!==l&&(y=n[T],vt=!1,bt=!S&&s.invertSwap||_),b=function(t,e,n,o,i,r,a,l){var s=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,u=o?n.bottom:n.right,h=!1;if(!a)if(l&&htd+c*r/2:su-ht)return-ut}else if(s>d+c*(1-i)/2&&su-c*r/2))return s>d+c/2?1:-1;return 0}(t,l,n,r,S?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,bt,dt===l),0!==b){var P=I(H);do{P-=b,D=W.children[P]}while(D&&("none"===E(D,"display")||D===V))}if(0===b||D===l)return $(!1);dt=l,ut=b;var A=l.nextElementSibling,F=!1,X=kt(U,a,H,e,l,n,t,F=1===b);if(!1!==X)return 1!==X&&-1!==X||(F=1===X),wt=!0,setTimeout(Rt,30),Y(),F&&!A?a.appendChild(H):l.parentNode.insertBefore(H,F?A:l),M&&k(M,0,N-M.scrollTop),W=H.parentNode,void 0===y||bt||(ht=Math.abs(y-C(l)[T])),G(),$(!0)}if(a.contains(H))return $(!1)}return!1}function L(s,c){B(s,p,o({evt:t,isOwner:u,axis:r?"vertical":"horizontal",revert:i,dragRect:e,targetRect:n,canSort:h,fromSortable:f,target:l,completed:$,onMove:function(n,o){return kt(U,a,H,e,n,C(n),t,o)},changed:G},c))}function Y(){L("dragOverAnimationCapture"),p.captureAnimationState(),p!==f&&f.captureAnimationState()}function $(e){return L("dragOverCompleted",{insertion:e}),e&&(u?d._hideClone():d._showClone(p),p!==f&&(w(H,nt?nt.options.ghostClass:d.options.ghostClass,!1),w(H,s.ghostClass,!0)),nt!==p&&p!==At.active?nt=p:p===At.active&&nt&&(nt=null),f===p&&(p._ignoreWhileAnimating=l),p.animateAll((function(){L("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(l===H&&!H.animated||l===a&&!l.animated)&&(dt=null),s.dragoverBubble||t.rootEl||l===document||(H.parentNode[R]._isOutsideThisEl(t.target),!e&&Nt(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),g=!0}function G(){K=I(H),tt=I(H,s.draggable),j({sortable:p,name:"change",toEl:a,newIndex:K,newDraggableIndex:tt,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){p(document,"mousemove",this._onTouchMove),p(document,"touchmove",this._onTouchMove),p(document,"pointermove",this._onTouchMove),p(document,"dragover",Nt),p(document,"mousemove",Nt),p(document,"touchmove",Nt)},_offUpEvents:function(){var t=this.el.ownerDocument;p(t,"mouseup",this._onDrop),p(t,"touchend",this._onDrop),p(t,"pointerup",this._onDrop),p(t,"touchcancel",this._onDrop),p(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;K=I(H),tt=I(H,n.draggable),B("drop",this,{evt:t}),W=H&&H.parentNode,K=I(H),tt=I(H,n.draggable),At.eventCanceled||(pt=!1,bt=!1,vt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Yt(this.cloneId),Yt(this._dragStartId),this.nativeDraggable&&(p(document,"drop",this),p(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),c&&E(document.body,"user-select",""),E(H,"transform",""),t&&(ct&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),V&&V.parentNode&&V.parentNode.removeChild(V),(U===W||nt&&"clone"!==nt.lastPutMode)&&q&&q.parentNode&&q.parentNode.removeChild(q),H&&(this.nativeDraggable&&p(H,"dragend",this),Ft(H),H.style["will-change"]="",ct&&!pt&&w(H,nt?nt.options.ghostClass:this.options.ghostClass,!1),w(H,this.options.chosenClass,!1),j({sortable:this,name:"unchoose",toEl:W,newIndex:null,newDraggableIndex:null,originalEvent:t}),U!==W?(K>=0&&(j({rootEl:W,name:"add",toEl:W,fromEl:U,originalEvent:t}),j({sortable:this,name:"remove",toEl:W,originalEvent:t}),j({rootEl:W,name:"sort",toEl:W,fromEl:U,originalEvent:t}),j({sortable:this,name:"sort",toEl:W,originalEvent:t})),nt&&nt.save()):K!==Z&&K>=0&&(j({sortable:this,name:"update",toEl:W,originalEvent:t}),j({sortable:this,name:"sort",toEl:W,originalEvent:t})),At.active&&(null!=K&&-1!==K||(K=Z,tt=Q),j({sortable:this,name:"end",toEl:W,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){B("nulling",this),U=H=W=V=z=q=G=J=ot=it=ct=K=tt=Z=Q=dt=ut=nt=et=At.dragged=At.ghost=At.clone=At.active=null,Et.forEach((function(t){t.checked=!0})),Et.length=rt=at=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":H&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;ot.replace(ee,((t,e)=>e?e.toUpperCase():""))));function oe(t){null!==t.parentElement&&t.parentElement.removeChild(t)}function ie(t,e,n){const o=0===n?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,o)}function re(t,e){this.$nextTick((()=>this.$emit(t.toLowerCase(),e)))}function ae(t){return e=>{null!==this.realList&&this["onDrag"+t](e),re.call(this,t,e)}}function le(t){return["transition-group","TransitionGroup"].includes(t)}function se(t,e,n){return t[n]||(e[n]?e[n]():void 0)}const ce=["Start","Add","Remove","Update","End"],de=["Choose","Unchoose","Sort","Filter","Clone"],ue=["Move",...ce,...de].map((t=>"on"+t));var he=null;const fe={name:"draggable",inheritAttrs:!1,props:{options:Object,list:{type:Array,required:!1,default:null},value:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:t=>t},element:{type:String,default:"div"},tag:{type:String,default:null},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},data:()=>({transitionMode:!1,noneFunctionalComponentMode:!1}),render(t){const e=this.$slots.default;this.transitionMode=function(t){if(!t||1!==t.length)return!1;const[{componentOptions:e}]=t;return!!e&&le(e.tag)}(e);const{children:n,headerOffset:o,footerOffset:i}=function(t,e,n){let o=0,i=0;const r=se(e,n,"header");r&&(o=r.length,t=t?[...r,...t]:[...r]);const a=se(e,n,"footer");return a&&(i=a.length,t=t?[...t,...a]:[...a]),{children:t,headerOffset:o,footerOffset:i}}(e,this.$slots,this.$scopedSlots);this.headerOffset=o,this.footerOffset=i;const r=function(t,e){let n=null;const o=(t,e)=>{n=function(t,e,n){return void 0===n||((t=t||{})[e]=n),t}(n,t,e)};if(o("attrs",Object.keys(t).filter((t=>"id"===t||t.startsWith("data-"))).reduce(((e,n)=>(e[n]=t[n],e)),{})),!e)return n;const{on:i,props:r,attrs:a}=e;return o("on",i),o("props",r),Object.assign(n.attrs,a),n}(this.$attrs,this.componentData);return t(this.getTag(),r,n)},created(){null!==this.list&&null!==this.value&&te.error("Value and list props are mutually exclusive! Please set one or another."),"div"!==this.element&&te.warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props"),void 0!==this.options&&te.warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props")},mounted(){if(this.noneFunctionalComponentMode=this.getTag().toLowerCase()!==this.$el.nodeName.toLowerCase()&&!this.getIsFunctional(),this.noneFunctionalComponentMode&&this.transitionMode)throw new Error(`Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ${this.getTag()}`);const t={};ce.forEach((e=>{t["on"+e]=ae.call(this,e)})),de.forEach((e=>{t["on"+e]=re.bind(this,e)}));const e=Object.keys(this.$attrs).reduce(((t,e)=>(t[ne(e)]=this.$attrs[e],t)),{}),n=Object.assign({},this.options,e,t,{onMove:(t,e)=>this.onDragMove(t,e)});!("draggable"in n)&&(n.draggable=">*"),this._sortable=new At(this.rootContainer,n),this.computeIndexes()},beforeDestroy(){void 0!==this._sortable&&this._sortable.destroy()},computed:{rootContainer(){return this.transitionMode?this.$el.children[0]:this.$el},realList(){return this.list?this.list:this.value}},watch:{options:{handler(t){this.updateOptions(t)},deep:!0},$attrs:{handler(t){this.updateOptions(t)},deep:!0},realList(){this.computeIndexes()}},methods:{getIsFunctional(){const{fnOptions:t}=this._vnode;return t&&t.functional},getTag(){return this.tag||this.element},updateOptions(t){for(var e in t){const n=ne(e);-1===ue.indexOf(n)&&this._sortable.option(n,t[e])}},getChildrenNodes(){if(this.noneFunctionalComponentMode)return this.$children[0].$slots.default;const t=this.$slots.default;return this.transitionMode?t[0].child.$slots.default:t},computeIndexes(){this.$nextTick((()=>{this.visibleIndexes=function(t,e,n,o){if(!t)return[];const i=t.map((t=>t.elm)),r=e.length-o,a=[...e].map(((t,e)=>e>=r?i.length:i.indexOf(t)));return n?a.filter((t=>-1!==t)):a}(this.getChildrenNodes(),this.rootContainer.children,this.transitionMode,this.footerOffset)}))},getUnderlyingVm(t){const e=function(t,e){return t.map((t=>t.elm)).indexOf(e)}(this.getChildrenNodes()||[],t);if(-1===e)return null;return{index:e,element:this.realList[e]}},getUnderlyingPotencialDraggableComponent:({__vue__:t})=>t&&t.$options&&le(t.$options._componentTag)?t.$parent:!("realList"in t)&&1===t.$children.length&&"realList"in t.$children[0]?t.$children[0]:t,emitChanges(t){this.$nextTick((()=>{this.$emit("change",t)}))},alterList(t){if(this.list)return void t(this.list);const e=[...this.value];t(e),this.$emit("input",e)},spliceList(){this.alterList((t=>t.splice(...arguments)))},updatePosition(t,e){this.alterList((n=>n.splice(e,0,n.splice(t,1)[0])))},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getUnderlyingPotencialDraggableComponent(t);if(!n)return{component:n};const o=n.realList,i={list:o,component:n};if(t!==e&&o&&n.getUnderlyingVm){const t=n.getUnderlyingVm(e);if(t)return Object.assign(t,i)}return i},getVmIndex(t){const e=this.visibleIndexes,n=e.length;return t>n-1?n:e[t]},getComponent(){return this.$slots.default[0].componentInstance},resetTransitionData(t){if(!this.noTransitionOnDrag||!this.transitionMode)return;this.getChildrenNodes()[t].data=null;const e=this.getComponent();e.children=[],e.kept=void 0},onDragStart(t){this.context=this.getUnderlyingVm(t.item),t.item._underlying_vm_=this.clone(this.context.element),he=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(void 0===e)return;oe(t.item);const n=this.getVmIndex(t.newIndex);this.spliceList(n,0,e),this.computeIndexes();const o={element:e,newIndex:n};this.emitChanges({added:o})},onDragRemove(t){if(ie(this.rootContainer,t.item,t.oldIndex),"clone"===t.pullMode)return void oe(t.clone);const e=this.context.index;this.spliceList(e,1);const n={element:this.context.element,oldIndex:e};this.resetTransitionData(e),this.emitChanges({removed:n})},onDragUpdate(t){oe(t.item),ie(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndex(t.newIndex);this.updatePosition(e,n);const o={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:o})},updateProperty(t,e){t.hasOwnProperty(e)&&(t[e]+=this.headerOffset)},computeFutureIndex(t,e){if(!t.element)return 0;const n=[...e.to.children].filter((t=>"none"!==t.style.display)),o=n.indexOf(e.related),i=t.component.getVmIndex(o);return-1!==n.indexOf(he)||!e.willInsertAfter?i:i+1},onDragMove(t,e){const n=this.move;if(!n||!this.realList)return!0;const o=this.getRelatedContextFromMoveEvent(t),i=this.context,r=this.computeFutureIndex(o,t);Object.assign(i,{futureIndex:r});return n(Object.assign({},t,{relatedContext:o,draggedContext:i}),e)},onDragEnd(){this.computeIndexes(),he=null}}};"undefined"!=typeof window&&"Vue"in window&&window.Vue.component("draggable",fe);export{fe as default};