forked from SortableJS/Sortable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSortable.min.js
2 lines (2 loc) · 41.5 KB
/
Sortable.min.js
1
2
/*! Sortable 1.15.1-sunsama-4 - MIT | git://github.com/SortableJS/Sortable.git */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o,n=arguments[e];for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function t(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}const w=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),E=t(/Edge/i),c=t(/firefox/i),d=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i);var e=t(/iP(ad|od|hone)/i),o=t(/chrome/i)&&t(/android/i);const n={capture:!1,passive:!1};function h(t,e,o){t.addEventListener(e,o,!w&&n)}function r(t,e,o){t.removeEventListener(e,o,!w&&n)}function l(t,e){if(e&&(">"===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}}function x(t,e,o,n){if(t){o=o||document;do{if(null!=e&&(">"!==e[0]||t.parentNode===o)&&l(t,e)||n&&t===o)return t}while(t!==o&&(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode))}var i;return null}const i=/\s+/g;function M(t,e,o){var n;t&&e&&(t.classList?t.classList[o?"add":"remove"](e):(n=(" "+t.className+" ").replace(i," ").replace(" "+e+" "," "),t.className=(n+(o?" "+e:"")).replace(i," ")))}function N(t,e,o){let n=t&&t.style;if(n){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(o=t.currentStyle),void 0===e?o:o[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=o+("string"==typeof o?"":"px")}}function f(t,e){let o="";if("string"==typeof t)o=t;else do{var n=N(t,"transform");n&&"none"!==n&&(o=n+" "+o)}while(!e&&(t=t.parentNode));const i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(o)}function u(n,i,r){if(n){let t=n.getElementsByTagName(i),e=0,o=t.length;if(r)for(;e<o;e++)r(t[e],e);return t}return[]}function p(){var t=document.scrollingElement;return t||document.documentElement}function A(l,s,c,d,h){if(l.getBoundingClientRect||l===window){let t,e,o,n,i,r,a;if(a=l!==window&&l.parentNode&&l!==p()?(t=l.getBoundingClientRect(),e=t.top,o=t.left,n=t.bottom,i=t.right,r=t.height,t.width):(e=0,o=0,n=window.innerHeight,i=window.innerWidth,r=window.innerHeight,window.innerWidth),(s||c)&&l!==window&&(h=h||l.parentNode,!w))do{if(h&&h.getBoundingClientRect&&("none"!==N(h,"transform")||c&&"static"!==N(h,"position"))){var u=h.getBoundingClientRect();e-=u.top+parseInt(N(h,"border-top-width")),o-=u.left+parseInt(N(h,"border-left-width")),n=e+t.height,i=o+t.width;break}}while(h=h.parentNode);return d&&l!==window&&(d=(s=f(h||l))&&s.a,l=s&&s.d,s&&(e/=l,o/=d,a/=d,r/=l,n=e+r,i=o+a)),{top:e,left:o,bottom:n,right:i,width:a,height:r}}}function I(t){let e=A(t);var o=parseInt(N(t,"padding-left")),n=parseInt(N(t,"padding-top")),i=parseInt(N(t,"padding-right")),r=parseInt(N(t,"padding-bottom"));return e.top+=n+parseInt(N(t,"border-top-width")),e.left+=o+parseInt(N(t,"border-left-width")),e.width=t.clientWidth-o-i,e.height=t.clientHeight-n-r,e.bottom=e.top+e.height,e.right=e.left+e.width,e}function O(t,e,o){let n=s(t,!0),i=A(t)[e];for(;n;){let t=A(n)[o],e;if(e="top"===o||"left"===o?t<=i:i<=t,!e)return n;if(n===p())break;n=s(n,!1)}return!1}function k(t,e,o,n){let i=0,r=0,a=t?.children;if(!a)return null;for(;r<a.length;){if("none"!==a[r].style.display&&a[r]!==Ot.ghost&&(n||a[r]!==Ot.dragged)&&x(a[r],o.draggable,t,!1)){if(i===e)return a[r];i++}r++}return null}function P(t,e){let o=t.lastElementChild;for(;o&&(o===Ot.ghost||"none"===N(o,"display")||e&&!l(o,e));)o=o.previousElementSibling;return o||null}function R(t,e){let o=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===Ot.clone||e&&!l(t,e)||o++;return o}function g(t){let e=0,o=0,n=p();if(t)do{var i=f(t),r=i.a,i=i.d;e+=t.scrollLeft*r,o+=t.scrollTop*i}while(t!==n&&(t=t.parentNode));return[e,o]}function s(t,e){if(!t||!t.getBoundingClientRect)return p();let o=t,n=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var i=N(o);if(o.clientWidth<o.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!o.getBoundingClientRect||o===document.body)return p();if(n||e)return o;n=!0}}}while(o=o.parentNode);return p()}function m(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}let v;function b(e,o){return function(){var t;v||(1===(t=arguments).length?e.call(this,t[0]):e.apply(this,t),v=setTimeout(function(){v=void 0},o))}}function X(t,e,o){t.scrollLeft+=e,t.scrollTop+=o}function y(t){let e=window.Polymer,o=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):o?o(t).clone(!0)[0]:t.cloneNode(!0)}function D(t,e){N(t,"position","absolute"),N(t,"top",e.top),N(t,"left",e.left),N(t,"width",e.width),N(t,"height",e.height)}function _(t){N(t,"position",""),N(t,"top",""),N(t,"left",""),N(t,"width",""),N(t,"height","")}const Y="Sortable"+(new Date).getTime();function S(){let n=[],e;return{captureAnimationState(){if(n=[],this.options.animation){let t=this.el?.children?[].slice.call(this.el.children):[];t.forEach(e=>{if("none"!==N(e,"display")&&e!==Ot.ghost){n.push({target:e,rect:A(e)});let t={...n[n.length-1].rect};var o;!e.thisAnimationDuration||(o=f(e,!0))&&(t.top-=o.f,t.left-=o.e),e.fromRect=t}})}},addAnimationState(t){n.push(t)},removeAnimationState(t){n.splice(function(t,e){for(var o in t)if(t.hasOwnProperty(o))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[o][n])return Number(o);return-1}(n,{target:t}),1)},animateAll(t){if(!this.options.animation)return clearTimeout(e),void("function"==typeof t&&t());let u=!1,p=0;n.forEach(t=>{let e=0,o=t.target,n=o.fromRect,i=A(o),r=o.prevFromRect,a=o.prevToRect,l=t.rect,s=f(o,!0);var c,d,h;s&&(i.top-=s.f,i.left-=s.e),o.toRect=i,o.thisAnimationDuration&&m(r,i)&&!m(n,i)&&(l.top-i.top)/(l.left-i.left)==(n.top-i.top)/(n.left-i.left)&&(e=(c=l,d=r,h=a,t=this.options,Math.sqrt(Math.pow(d.top-c.top,2)+Math.pow(d.left-c.left,2))/Math.sqrt(Math.pow(d.top-h.top,2)+Math.pow(d.left-h.left,2))*t.animation)),m(i,n)||(o.prevFromRect=n,o.prevToRect=i,e=e||this.options.animation,this.animate(o,l,i,e)),e&&(u=!0,p=Math.max(p,e),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout(function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null},e),o.thisAnimationDuration=e)}),clearTimeout(e),u?e=setTimeout(function(){"function"==typeof t&&t()},p):"function"==typeof t&&t(),n=[]},animate(t,e,o,n){var i,r;n&&(N(t,"transition",""),N(t,"transform",""),i=(r=f(this.el))&&r.a,r=r&&r.d,i=(e.left-o.left)/(i||1),r=(e.top-o.top)/(r||1),t.animatingX=!!i,t.animatingY=!!r,N(t,"transform","translate3d("+i+"px,"+r+"px,0)"),this.forRepaintDummy=t.offsetWidth,N(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),N(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout(function(){N(t,"transition",""),N(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1},n))}}}let C=[];const T={initializeByDefault:!0};var B={mount(e){for(var t in T)!T.hasOwnProperty(t)||t in e||(e[t]=T[t]);C.forEach(t=>{if(t.pluginName===e.pluginName)throw`Sortable: Cannot mount plugin ${e.pluginName} more than once`}),C.push(e)},pluginEvent(e,o,n){this.eventCanceled=!1,n.cancel=()=>{this.eventCanceled=!0};const i=e+"Global";C.forEach(t=>{o[t.pluginName]&&(o[t.pluginName][i]&&o[t.pluginName][i]({sortable:o,...n}),o.options[t.pluginName]&&o[t.pluginName][e]&&o[t.pluginName][e]({sortable:o,...n}))})},initializePlugins(n,i,r,t){for(var e in C.forEach(e=>{var o=e.pluginName;if(n.options[o]||e.initializeByDefault){let t=new e(n,i,n.options);t.sortable=n,t.options=n.options,n[o]=t,a(r,t.defaults)}}),n.options){var o;n.options.hasOwnProperty(e)&&(void 0!==(o=this.modifyOption(n,e,n.options[e]))&&(n.options[e]=o))}},getEventProperties(e,o){let n={};return C.forEach(t=>{"function"==typeof t.eventProperties&&a(n,t.eventProperties.call(o[t.pluginName],e))}),n},modifyOption(e,o,n){let i;return C.forEach(t=>{e[t.pluginName]&&t.optionListeners&&"function"==typeof t.optionListeners[o]&&(i=t.optionListeners[o].call(e[t.pluginName],n))}),i}};function F({sortable:n,rootEl:i,name:r,targetEl:a,cloneEl:l,toEl:s,fromEl:c,oldIndex:d,newIndex:h,oldDraggableIndex:u,newDraggableIndex:p,originalEvent:f,putSortable:g,extraEventProperties:m}){if(n=n||i&&i[Y]){let t,e=n.options,o="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||w||E?(t=document.createEvent("Event"),t.initEvent(r,!0,!0)):t=new CustomEvent(r,{bubbles:!0,cancelable:!0}),t.to=s||i,t.from=c||i,t.item=a||i,t.clone=l,t.oldIndex=d,t.newIndex=h,t.oldDraggableIndex=u,t.newDraggableIndex=p,t.originalEvent=f,t.pullMode=g?g.lastPutMode:void 0;var v,b={...m,...B.getEventProperties(r,n)};for(v in b)t[v]=b[v];i&&i.dispatchEvent(t),e[o]&&e[o].call(n,t)}}let H=function(t,e,{evt:o,...n}={}){B.pluginEvent.bind(Ot)(t,e,{dragEl:K,parentEl:W,ghostEl:z,rootEl:G,nextEl:$,lastDownEl:U,cloneEl:j,cloneHidden:q,dragStarted:ht,putSortable:et,activeSortable:Ot.active,originalEvent:o,oldIndex:V,oldDraggableIndex:Q,newIndex:Z,newDraggableIndex:J,hideGhostForTarget:Mt,unhideGhostForTarget:Nt,cloneNowHidden(){q=!0},cloneNowShown(){q=!1},dispatchSortableEvent(t){L({sortable:e,name:t,originalEvent:o})},...n})};function L(t){F({putSortable:et,cloneEl:j,targetEl:K,rootEl:G,oldIndex:V,oldDraggableIndex:Q,newIndex:Z,newDraggableIndex:J,...t})}let K,W,z,G,$,U,j,q,V,Z,Q,J,tt,et,ot=!1,nt=!1,it=[],rt,at,lt,st,ct,dt,ht,ut,pt,ft=!1,gt=!1,mt,vt,bt=[],wt=!1,Et=[];const yt="undefined"!=typeof document,Dt=e,_t=E||w?"cssFloat":"float",St=yt&&!o&&!e&&"draggable"in document.createElement("div"),Ct=function(){if(yt){if(w)return!1;let t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Tt=function(t,e){let o=N(t),n=parseInt(o.width,10)-parseInt(o.paddingLeft,10)-parseInt(o.paddingRight,10)-parseInt(o.borderLeftWidth,10)-parseInt(o.borderRightWidth,10),i=k(t,0,e),r=k(t,1,e),a=i&&N(i),l=r&&N(r),s=a&&parseInt(a.marginLeft,10)+parseInt(a.marginRight,10)+A(i).width,c=l&&parseInt(l.marginLeft,10)+parseInt(l.marginRight,10)+A(r).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&"none"!==a.float){e="left"===a.float?"left":"right";return!r||"both"!==l.clear&&l.clear!==e?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||n<=s&&"none"===o[_t]||r&&"none"===o[_t]&&n<s+c)?"vertical":"horizontal"},xt=function(t){function l(r,a){return function(t,e,o,n){var i=t.options.group.name&&e.options.group.name&&t.options.group.name===e.options.group.name;if(null==r&&(a||i))return!0;if(null==r||!1===r)return!1;if(a&&"clone"===r)return r;if("function"==typeof r)return l(r(t,e,o,n),a)(t,e,o,n);e=(a?t:e).options.group.name;return!0===r||"string"==typeof r&&r===e||r.join&&-1<r.indexOf(e)}}let e={},o=t.group;o&&"object"==typeof o||(o={name:o}),e.name=o.name,e.checkPull=l(o.pull,!0),e.checkPut=l(o.put),e.revertClone=o.revertClone,t.group=e},Mt=function(){!Ct&&z&&N(z,"display","none")},Nt=function(){!Ct&&z&&N(z,"display","")};yt&&!o&&document.addEventListener("click",function(t){if(nt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),nt=!1},!0);let At=function(o){if(K){let e=function(i,r){let a;return it.some(t=>{var e=t[Y]?.options?.emptyInsertThreshold;if(e&&!P(t)){var o=A(t),n=i>=o.left-e&&i<=o.right+e,e=r>=o.top-e&&r<=o.bottom+e;return n&&e?a=t:void 0}}),a}((o=o.touches?o.touches[0]:o).clientX,o.clientY);if(e){let t={};for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n]);t.target=t.rootEl=e,t.preventDefault=void 0,t.stopPropagation=void 0,e[Y]._onDragOver(t)}}},It=function(t){K&&K.parentNode[Y]._isOutsideThisEl(t.target)};function Ot(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw`Sortable: \`el\` must be an HTMLElement, not ${{}.toString.call(t)}`;this.el=t,this.options=e=a({},e),t[Y]=this;var o,n,i={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!==Ot.supportPointer&&"PointerEvent"in window&&!d,emptyInsertThreshold:5};for(o in B.initializePlugins(this,t,i),i)o in e||(e[o]=i[o]);for(n in xt(e),this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));this.nativeDraggable=!e.forceFallback&&St,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?h(t,"pointerdown",this._onTapStart):(h(t,"mousedown",this._onTapStart),h(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(h(t,"dragover",this),h(t,"dragenter",this)),it.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,S())}function kt(t,e,o,n,i,r,a,l){let s,c=t[Y],d=c.options.onMove,h;return!window.CustomEvent||w||E?(s=document.createEvent("Event"),s.initEvent("move",!0,!0)):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=o,s.draggedRect=n,s.related=i||e,s.relatedRect=r||A(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(h=d.call(c,s,a)),h}function Pt(t){t.draggable=!1}function Rt(){wt=!1}function Xt(t){return setTimeout(t,0)}function Yt(t){return clearTimeout(t)}Ot.prototype={constructor:Ot,_isOutsideThisEl:function(t){this.el?.contains(t)||t===this.el||(ut=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,K):this.options.direction},_onTapStart:function(c){if(c.cancelable){let e=this,o=this.el,t=this.options,n=t.preventOnFilter,i=c.type,r=c.touches&&c.touches[0]||c.pointerType&&"touch"===c.pointerType&&c,a=(r||c).target,l=c.target.shadowRoot&&(c.path&&c.path[0]||c.composedPath&&c.composedPath()[0])||a,s=t.filter;if(!function(t){Et.length=0;let e=t.getElementsByTagName("input"),o=e.length;for(;o--;){var n=e[o];n.checked&&Et.push(n)}}(o),!K&&!(/mousedown|pointerdown/.test(i)&&0!==c.button||t.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!d||!a||"SELECT"!==a.tagName.toUpperCase())&&(a=x(a,t.draggable,o,!1),!(a&&a.animated||U===a))){if(V=R(a),Q=R(a,t.draggable),"function"==typeof s){if(s.call(this,c,a,this))return L({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:o,fromEl:o}),H("filter",e,{evt:c}),void(n&&c.cancelable&&c.preventDefault())}else if(s&&(s=s.split(",").some(function(t){if(t=x(l,t.trim(),o,!1))return L({sortable:e,rootEl:t,name:"filter",targetEl:a,fromEl:o,toEl:o}),H("filter",e,{evt:c}),!0}),s))return void(n&&c.cancelable&&c.preventDefault());t.handle&&!x(l,t.handle,o,!1)||this._prepareDragStart(c,r,a)}}},_prepareDragStart:function(t,e,o){let n=this,i=n.el,r=n.options,a=i.ownerDocument,l;var s;o&&!K&&o.parentNode===i&&(s=A(o),G=i,K=o,W=K.parentNode,$=K.nextSibling,U=o,tt=r.group,Ot.dragged=K,rt={target:K,clientX:(e||t).clientX,clientY:(e||t).clientY},ct=rt.clientX-s.left,dt=rt.clientY-s.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,K.style["will-change"]="all",l=function(){H("delayEnded",n,{evt:t}),Ot.eventCanceled?n._onDrop():(n._disableDelayedDragEvents(),!c&&n.nativeDraggable&&(K.draggable=!0),n._triggerDragStart(t,e),L({sortable:n,name:"choose",originalEvent:t}),M(K,r.chosenClass,!0))},r.ignore.split(",").forEach(function(t){u(K,t.trim(),Pt)}),h(a,"dragover",At),h(a,"mousemove",At),h(a,"touchmove",At),h(a,"mouseup",n._onDrop),h(a,"touchend",n._onDrop),h(a,"touchcancel",n._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,K.draggable=!0),H("delayStart",this,{evt:t}),!r.delay||r.delayOnTouchOnly&&!e||this.nativeDraggable&&(E||w)?l():Ot.eventCanceled?this._onDrop():(h(a,"mouseup",n._disableDelayedDrag),h(a,"touchend",n._disableDelayedDrag),h(a,"touchcancel",n._disableDelayedDrag),h(a,"mousemove",n._delayedDragTouchMoveHandler),h(a,"touchmove",n._delayedDragTouchMoveHandler),r.supportPointer&&h(a,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(l,r.delay)))},_delayedDragTouchMoveHandler:function(t){t=t.touches?t.touches[0]:t;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){K&&Pt(K),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el?.ownerDocument;r(t,"mouseup",this._disableDelayedDrag),r(t,"touchend",this._disableDelayedDrag),r(t,"touchcancel",this._disableDelayedDrag),r(t,"mousemove",this._delayedDragTouchMoveHandler),r(t,"touchmove",this._delayedDragTouchMoveHandler),r(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?h(document,"pointermove",this._onTouchMove):h(document,e?"touchmove":"mousemove",this._onTouchMove):(h(K,"dragend",this),h(G,"dragstart",this._onDragStart));try{document.selection?Xt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){var o;ot=!1,G&&K?(H("dragStarted",this,{evt:e}),this.nativeDraggable&&h(document,"dragover",It),o=this.options,t||M(K,o.dragClass,!1),M(K,o.ghostClass,!0),Ot.active=this,t&&this._appendGhost(),L({sortable:this,name:"start",originalEvent:e})):this._nulling()},_emulateDragOver:function(){if(at){this._lastX=at.clientX,this._lastY=at.clientY,Mt();let t=document.elementFromPoint(at.clientX,at.clientY),e=t;for(;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(at.clientX,at.clientY),t!==e);)e=t;if(K.parentNode[Y]._isOutsideThisEl(t),e)do{if(e[Y])if(e[Y]._onDragOver({clientX:at.clientX,clientY:at.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}while(t=e,e=e.parentNode);Nt()}},_onTouchMove:function(d){if(rt){let t=this.options,e=t.fallbackTolerance,o=t.fallbackOffset,n=d.touches?d.touches[0]:d,i=z&&f(z,!0),r=z&&i&&i.a,a=z&&i&&i.d,l=Dt&&vt&&g(vt),s=(n.clientX-rt.clientX+o.x)/(r||1)+(l?l[0]-bt[0]:0)/(r||1),c=(n.clientY-rt.clientY+o.y)/(a||1)+(l?l[1]-bt[1]:0)/(a||1);if(!Ot.active&&!ot){if(e&&Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))<e)return;this._onDragStart(d,!0)}var h;z&&(i?(i.e+=s-(lt||0),i.f+=c-(st||0)):i={a:1,b:0,c:0,d:1,e:s,f:c},h=`matrix(${i.a},${i.b},${i.c},${i.d},${i.e},${i.f})`,N(z,"webkitTransform",h),N(z,"mozTransform",h),N(z,"msTransform",h),N(z,"transform",h),lt=s,st=c,at=n),d.cancelable&&d.preventDefault()}},_appendGhost:function(){if(!z){let t=this.options.fallbackOnBody?document.body:G,e=A(K,!0,Dt,!0,t),o=this.options;if(Dt){for(vt=t;"static"===N(vt,"position")&&"none"===N(vt,"transform")&&vt!==document;)vt=vt.parentNode;vt!==document.body&&vt!==document.documentElement?(vt===document&&(vt=p()),e.top+=vt.scrollTop,e.left+=vt.scrollLeft):vt=p(),bt=g(vt)}z=K.cloneNode(!0),M(z,o.ghostClass,!1),M(z,o.fallbackClass,!0),M(z,o.dragClass,!0),N(z,"transition",""),N(z,"transform",""),N(z,"box-sizing","border-box"),N(z,"margin",0),N(z,"top",e.top),N(z,"left",e.left),N(z,"width",e.width),N(z,"height",e.height),N(z,"opacity","0.8"),N(z,"position",Dt?"absolute":"fixed"),N(z,"zIndex","100000"),N(z,"pointerEvents","none"),Ot.ghost=z,t.appendChild(z),N(z,"transform-origin",ct/parseInt(z.style.width,10)*100+"% "+dt/parseInt(z.style.height,10)*100+"%")}},_onDragStart:function(t,e){let o=this,n=t.dataTransfer,i=o.options;H("dragStart",this,{evt:t}),Ot.eventCanceled?this._onDrop():(H("setupClone",this),Ot.eventCanceled||(j=y(K),j.removeAttribute("id"),j.draggable=!1,j.style["will-change"]="",this._hideClone(),M(j,this.options.chosenClass,!1),Ot.clone=j),o.cloneId=Xt(function(){H("clone",o),Ot.eventCanceled||(o.options.removeCloneOnHide||G.insertBefore(j,K),o._hideClone(),L({sortable:o,name:"clone"}))}),e||M(K,i.dragClass,!0),e?(nt=!0,o._loopId=setInterval(o._emulateDragOver,50)):(r(document,"mouseup",o._onDrop),r(document,"touchend",o._onDrop),r(document,"touchcancel",o._onDrop),n&&(n.effectAllowed="move",i.setData&&i.setData.call(o,n,K)),h(document,"drop",o),N(K,"transform","translateZ(0)")),ot=!0,o._dragStartId=Xt(o._dragStarted.bind(o,e,t)),h(document,"selectstart",o),ht=!0,d&&N(document.body,"user-select","none"))},_onDragOver:function(d){let h=this.el,u=d.target,p,f,o,g=this.options,t=g.group,e=Ot.active,n=tt===t,i=g.sort,r=et||e,m,a=this,l=!1;if(!wt){if(void 0!==d.preventDefault&&d.cancelable&&d.preventDefault(),u=x(u,g.draggable,h,!0),c("dragOver"),Ot.eventCanceled)return l;if(K.contains(d.target)||u.animated&&u.animatingX&&u.animatingY||a._ignoreWhileAnimating===u)return C(!1);if(nt=!1,e&&!g.disabled&&(n?i||(o=W!==G):et===this||(this.lastPutMode=tt.checkPull(this,e,K,d))&&t.checkPut(this,e,K,d))){if(m="vertical"===this._getDirection(d,u),p=A(K),c("dragOverValid"),Ot.eventCanceled)return l;if(o)return W=G,S(),this._hideClone(),c("revert"),Ot.eventCanceled||($?G.insertBefore(K,$):G.appendChild(K)),C(!0);var s=P(h,g.draggable);if(s&&(E=d,y=m,_=A(P((D=this).el,D.options.draggable)),D=I(D.el),!(y?E.clientX>D.right+10||E.clientY>_.bottom&&E.clientX>_.left:E.clientY>D.bottom+10||E.clientX>_.right&&E.clientY>_.top)||s.animated)){if(s&&function(t,e,o){var n=A(k(o.el,0,o.options,!0));o=I(o.el);return e?t.clientX<o.left-10||t.clientY<n.top&&t.clientX<n.right:t.clientY<o.top-10||t.clientY<n.bottom&&t.clientX<n.left}(d,m,this)){var v=k(h,0,g,!0);if(v===K)return C(!1);if(u=v,f=A(u),!1!==kt(G,h,K,p,u,f,d,!1))return S(),h.insertBefore(K,v),W=h,T(),C(!0)}else if(u.parentNode===h){f=A(u);let e,t,o=K.parentNode!==h,n=(b=K.animated&&K.toRect||p,w=u.animated&&u.toRect||f,y=m,D=y?b.left:b.top,E=y?b.right:b.bottom,_=y?b.width:b.height,v=y?w.left:w.top,b=y?w.right:w.bottom,w=y?w.width:w.height,!(D===v||E===b||D+_/2===v+w/2)),i=m?"top":"left",r=O(u,"top","top")||O(K,"top","top"),a=r?r.scrollTop:void 0;ut!==u&&(t=f[i],ft=!1,gt=!n&&g.invertSwap||o);let l;if(0!==(e=function(t,e,o,n,i,r,a,l){let s=n?t.clientY:t.clientX,c=n?o.height:o.width,d=n?o.top:o.left,h=n?o.bottom:o.right,u=!1;if(!a)if(l&&mt<c*i){if(!ft&&(1===pt?d+c*r/2<s:s<h-c*r/2)&&(ft=!0),ft)u=!0;else if(1===pt?s<d+mt:s>h-mt)return-pt}else if(d+c*(1-i)/2<s&&s<h-c*(1-i)/2)return function(t){return R(K)<R(t)?1:-1}(e);if(u=u||a,u&&(s<d+c*r/2||h-c*r/2<s))return d+c/2<s?1:-1;return 0}(d,u,f,m,n?1:g.swapThreshold,null==g.invertedSwapThreshold?g.swapThreshold:g.invertedSwapThreshold,gt,ut===u))){let t=R(K);for(;t-=e,l=W.children[t],l&&("none"===N(l,"display")||l===z););}if(0===e||l===u)return C(!1);ut=u,pt=e;let s=u.nextElementSibling,c=!1;c=1===e;w=kt(G,h,K,p,u,f,d,c);if(!1!==w)return 1!==w&&-1!==w||(c=1===w),wt=!0,setTimeout(Rt,30),S(),c&&!s?h.appendChild(K):u.parentNode.insertBefore(K,c?s:u),r&&X(r,0,a-r.scrollTop),W=K.parentNode,void 0===t||gt||(mt=Math.abs(t-A(u)[i])),T(),C(!0)}}else{if(s===K)return C(!1);if(s&&h===d.target&&(u=s),u&&(f=A(u)),!1!==kt(G,h,K,p,u,f,d,!!u))return S(),s&&s.nextSibling?h.insertBefore(K,s.nextSibling):h.appendChild(K),W=h,T(),C(!0)}if(h.contains(K))return C(!1)}var b,w,E,y,D,_;return!1}function c(t,e){H(t,a,{evt:d,isOwner:n,axis:m?"vertical":"horizontal",revert:o,dragRect:p,targetRect:f,canSort:i,fromSortable:r,target:u,completed:C,onMove(t,e){return kt(G,h,K,p,t,A(t),d,e)},changed:T,...e})}function S(){c("dragOverAnimationCapture"),a.captureAnimationState(),a!==r&&r.captureAnimationState()}function C(t){return c("dragOverCompleted",{insertion:t}),t&&(n?e._hideClone():e._showClone(a),a!==r&&(M(K,(et||e).options.ghostClass,!1),M(K,g.ghostClass,!0)),et!==a&&a!==Ot.active?et=a:a===Ot.active&&et&&(et=null),r===a&&(a._ignoreWhileAnimating=u),a.animateAll(function(){c("dragOverAnimationComplete"),a._ignoreWhileAnimating=null}),a!==r&&(r.animateAll(),r._ignoreWhileAnimating=null)),(u===K&&!K.animated||u===h&&!u.animated)&&(ut=null),g.dragoverBubble||d.rootEl||u===document||(K.parentNode[Y]._isOutsideThisEl(d.target),t||At(d)),!g.dragoverBubble&&d.stopPropagation&&d.stopPropagation(),l=!0}function T(){Z=R(K),J=R(K,g.draggable),L({sortable:a,name:"change",toEl:h,newIndex:Z,newDraggableIndex:J,originalEvent:d})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){r(document,"mousemove",this._onTouchMove),r(document,"touchmove",this._onTouchMove),r(document,"pointermove",this._onTouchMove),r(document,"dragover",At),r(document,"mousemove",At),r(document,"touchmove",At)},_offUpEvents:function(){var t=this.el?.ownerDocument;r(t,"mouseup",this._onDrop),r(t,"touchend",this._onDrop),r(t,"pointerup",this._onDrop),r(t,"touchcancel",this._onDrop),r(document,"selectstart",this)},_onDrop:function(t){var e=this.el,o=this.options;if(Z=R(K),J=R(K,o.draggable),H("drop",this,{evt:t}),W=K&&K.parentNode,Z=R(K),J=R(K,o.draggable),Ot.eventCanceled)this._nulling();else{if(ot=!1,gt=!1,ft=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Yt(this.cloneId),Yt(this._dragStartId),this.nativeDraggable&&(r(document,"drop",this),r(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),d&&N(document.body,"user-select",""),N(K,"transform",""),t){if(ht&&(t.cancelable&&t.preventDefault(),o.dropBubble||t.stopPropagation()),z?.parentNode)try{z.parentNode.removeChild(z)}catch(t){console.warn("Failed to remove ghost child from parent node",t)}if((G===W||et&&"clone"!==et.lastPutMode)&&j?.parentNode)try{j.parentNode.removeChild(j)}catch(t){console.warn("Failed to remove clone child from parent node",t)}K&&(this.nativeDraggable&&r(K,"dragend",this),Pt(K),K.style["will-change"]="",ht&&!ot&&M(K,(et||this).options.ghostClass,!1),M(K,this.options.chosenClass,!1),L({sortable:this,name:"unchoose",toEl:W,newIndex:null,newDraggableIndex:null,originalEvent:t}),G!==W?(0<=Z&&(L({rootEl:W,name:"add",toEl:W,fromEl:G,originalEvent:t}),L({sortable:this,name:"remove",toEl:W,originalEvent:t}),L({rootEl:W,name:"sort",toEl:W,fromEl:G,originalEvent:t}),L({sortable:this,name:"sort",toEl:W,originalEvent:t})),et&&et.save()):Z!==V&&0<=Z&&(L({sortable:this,name:"update",toEl:W,originalEvent:t}),L({sortable:this,name:"sort",toEl:W,originalEvent:t})),Ot.active&&(null!=Z&&-1!==Z||(Z=V,J=Q),L({sortable:this,name:"end",toEl:W,originalEvent:t}),this.save()))}this._nulling()}},_nulling:function(){H("nulling",this),G=K=W=z=$=j=U=q=rt=at=ht=Z=J=V=Q=ut=pt=et=tt=Ot.dragged=Ot.ghost=Ot.clone=Ot.active=null,Et.forEach(function(t){t.checked=!0}),Et.length=lt=st=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":K&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){let t=[],e,o=this.el?.children,n=0,i=o.length,r=this.options;for(;n<i;n++)e=o?o[n]:null,x(e,r.draggable,this.el,!1)&&t.push(e.getAttribute(r.dataIdAttr)||function(t){let e=t.tagName+t.className+t.src+t.href+t.textContent,o=e.length,n=0;for(;o--;)n+=e.charCodeAt(o);return n.toString(36)}(e));return t},sort:function(t,e){let o={},n=this.el;this.toArray().forEach(function(t,e){e=n.children[e];x(e,this.options.draggable,n,!1)&&(o[t]=e)},this),e&&this.captureAnimationState(),t.forEach(function(e){if(o[e]){try{n.removeChild(o[e])}catch(t){console.warn(`Failed to remove child ${e}`,t)}n.appendChild(o[e])}}),e&&this.animateAll()},save:function(){let t=this.options.store;t?.set&&t.set(this)},closest:function(t,e){return x(t,e||this.options.draggable,this.el,!1)},option:function(t,e){let o=this.options;if(void 0===e)return o[t];var n=B.modifyOption(this,t,e);o[t]=void 0!==n?n:e,"group"===t&&xt(o)},destroy:function(){H("destroy",this);let t=this.el;t[Y]=null,r(t,"mousedown",this._onTapStart),r(t,"touchstart",this._onTapStart),r(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(r(t,"dragover",this),r(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),it.splice(it.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!q&&(H("hideClone",this),!Ot.eventCanceled)){if(N(j,"display","none"),this.options.removeCloneOnHide&&j.parentNode)try{j.parentNode.removeChild(j)}catch(t){console.warn("Failed to remove child from parent node",t)}q=!0}},_showClone:function(t){"clone"===t.lastPutMode?q&&(H("showClone",this),Ot.eventCanceled||(K.parentNode!=G||this.options.group.revertClone?$?G.insertBefore(j,$):G.appendChild(j):G.insertBefore(j,K),this.options.group.revertClone&&this.animate(K,j),N(j,"display",""),q=!1)):this._hideClone()}},yt&&h(document,"touchmove",function(t){(Ot.active||ot)&&t.cancelable&&t.preventDefault()}),Ot.utils={on:h,off:r,css:N,find:u,is:function(t,e){return!!x(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t},throttle:b,closest:x,toggleClass:M,clone:y,index:R,nextTick:Xt,cancelNextTick:Yt,detectDirection:Tt,getChild:k},Ot.get=function(t){return t[Y]},Ot.mount=function(...t){(t=t[0].constructor===Array?t[0]:t).forEach(t=>{if(!t.prototype||!t.prototype.constructor)throw`Sortable: Mounted plugin must be a constructor function, not ${{}.toString.call(t)}`;t.utils&&(Ot.utils={...Ot.utils,...t.utils}),B.mount(t)})},Ot.create=function(t,e){return new Ot(t,e)};let Bt=[],Ft,Ht,Lt=!(Ot.version="1.15.1-sunsama-4"),Kt,Wt,zt,Gt;function $t(){Bt.forEach(function(t){clearInterval(t.pid)}),Bt=[]}function Ut(){clearInterval(Gt)}const jt=b(function(w,t,e,E){if(t.scroll){const _=(w.touches?w.touches[0]:w).clientX,S=(w.touches?w.touches[0]:w).clientY,C=t.scrollSensitivity,T=t.scrollSpeed,x=p();let g=!1,m;Ht!==e&&(Ht=e,$t(),Ft=t.scroll,m=t.scrollFn,!0===Ft&&(Ft=s(e,!0)));let v=0,b=Ft;do{let t=b,e=A(t),o=e.top,n=e.bottom,i=e.left,r=e.right,a=e.width,l=e.height,s,c,d=t.scrollWidth,h=t.scrollHeight,u=N(t),p=t.scrollLeft,f=t.scrollTop;c=t===x?(s=a<d&&("auto"===u.overflowX||"scroll"===u.overflowX||"visible"===u.overflowX),l<h&&("auto"===u.overflowY||"scroll"===u.overflowY||"visible"===u.overflowY)):(s=a<d&&("auto"===u.overflowX||"scroll"===u.overflowX),l<h&&("auto"===u.overflowY||"scroll"===u.overflowY));var y=s&&(Math.abs(r-_)<=C&&p+a<d)-(Math.abs(i-_)<=C&&!!p),D=c&&(Math.abs(n-S)<=C&&f+l<h)-(Math.abs(o-S)<=C&&!!f);if(!Bt[v])for(let t=0;t<=v;t++)Bt[t]||(Bt[t]={});Bt[v].vx==y&&Bt[v].vy==D&&Bt[v].el===t||(Bt[v].el=t,Bt[v].vx=y,Bt[v].vy=D,clearInterval(Bt[v].pid),0==y&&0==D||(g=!0,Bt[v].pid=setInterval(function(){E&&0===this.layer&&Ot.active._onTouchMove(zt);var t=Bt[this.layer].vy?Bt[this.layer].vy*T:0,e=Bt[this.layer].vx?Bt[this.layer].vx*T:0;"function"==typeof m&&"continue"!==m.call(Ot.dragged.parentNode[Y],e,t,w,zt,Bt[this.layer].el)||X(Bt[this.layer].el,e,t)}.bind({layer:v}),24))),v++}while(t.bubbleScroll&&b!==x&&(b=s(b,!1)));Lt=g}},30);o=function({originalEvent:e,putSortable:o,dragEl:n,activeSortable:i,dispatchSortableEvent:r,hideGhostForTarget:a,unhideGhostForTarget:l}){if(e){let t=o||i;a();e=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,e=document.elementFromPoint(e.clientX,e.clientY);l(),t&&!t.el.contains(e)&&(r("spill"),this.onSpill({dragEl:n,putSortable:o}))}};function qt(){}function Vt(){}qt.prototype={startIndex:null,dragStart({oldDraggableIndex:t}){this.startIndex=t},onSpill({dragEl:t,putSortable:e}){this.sortable.captureAnimationState(),e&&e.captureAnimationState();var o=k(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(t,o):this.sortable.el?.appendChild(t),this.sortable.animateAll(),e&&e.animateAll()},drop:o},a(qt,{pluginName:"revertOnSpill"}),Vt.prototype={onSpill({dragEl:t,putSortable:e}){const o=e||this.sortable;o.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),o.animateAll()},drop:o},a(Vt,{pluginName:"removeOnSpill"});let Zt;let Qt=[],Jt=[],te,ee,oe=!1,ne=!1,ie=!1,re,ae,le;function se(o,n){Jt.forEach((t,e)=>{e=n.children[t.sortableIndex+(o?Number(e):0)];e?n.insertBefore(t,e):n.appendChild(t)})}function ce(){Qt.forEach(t=>{t!==re&&t.parentNode&&t.parentNode.removeChild(t)})}return Ot.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted({originalEvent:t}){this.sortable.nativeDraggable?h(document,"dragover",this._handleAutoScroll):this.options.supportPointer?h(document,"pointermove",this._handleFallbackAutoScroll):t.touches?h(document,"touchmove",this._handleFallbackAutoScroll):h(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted({originalEvent:t}){this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop(){this.sortable.nativeDraggable?r(document,"dragover",this._handleAutoScroll):(r(document,"pointermove",this._handleFallbackAutoScroll),r(document,"touchmove",this._handleFallbackAutoScroll),r(document,"mousemove",this._handleFallbackAutoScroll)),Ut(),$t(),clearTimeout(v),v=void 0},nulling(){zt=Ht=Ft=Lt=Gt=Kt=Wt=null,Bt.length=0},_handleFallbackAutoScroll(t){this._handleAutoScroll(t,!0)},_handleAutoScroll(o,n){const i=(o.touches?o.touches[0]:o).clientX,r=(o.touches?o.touches[0]:o).clientY,t=document.elementFromPoint(i,r);if(zt=o,n||this.options.forceAutoScrollFallback||E||w||d){jt(o,this.options,t,n);let e=s(t,!0);!Lt||Gt&&i===Kt&&r===Wt||(Gt&&Ut(),Gt=setInterval(()=>{var t=s(document.elementFromPoint(i,r),!0);t!==e&&(e=t,$t()),jt(o,this.options,t,n)},10),Kt=i,Wt=r)}else this.options.bubbleScroll&&s(t,!0)!==p()?jt(o,this.options,s(t,!1),!1):$t()}},a(t,{pluginName:"scroll",initializeByDefault:!0})}),Ot.mount(Vt,qt),Ot.mount(new function(){return a(class{constructor(){this.defaults={swapClass:"sortable-swap-highlight"}}dragOver({activeSortable:t,target:e,dragEl:o,onMove:n,completed:i,cancel:r}){var a=this.sortable.el,l=this.options;t.options.swap&&e&&e!==a&&!e.contains(o)&&!1!==n(e)||(Zt&&M(Zt,l.swapClass,!1),Zt=null,i(!1),r())}dragOverValid({target:t,changed:e,completed:o,cancel:n}){var i=this.options;Zt&&Zt!==t&&M(Zt,i.swapClass,!1),M(t,i.swapClass,!0),Zt=t,e(),o(!0),n()}drop({activeSortable:o,putSortable:n,dragEl:i}){if(Zt){let t=n||this.sortable,e=this.options;M(Zt,e.swapClass,!1),(e.swap||n&&n.options.swap)&&(t.captureAnimationState(),t!==o&&o.captureAnimationState(),function(t,e){let o=t.parentNode,n=e.parentNode,i,r;o&&n&&!o.isEqualNode(e)&&!n.isEqualNode(t)&&(i=R(t),r=R(e),o.isEqualNode(n)&&i<r&&r++,o.insertBefore(e,o.children[i]),n.insertBefore(t,n.children[r]))}(i,Zt),t.animateAll(),t!==o&&o.animateAll())}}nulling(){Zt=null;var t=new KeyboardEvent("keyup",{key:"Control"});document.dispatchEvent(t)}},{pluginName:"swap",eventProperties(){return{swapItem:Zt}}})}),Ot.mount(new function(){function t(n){for(var t in this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this));n.options.avoidImplicitDeselect||(n.options.supportPointer?h(document,"pointerup",this._deselectMultiDrag):(h(document,"mouseup",this._deselectMultiDrag),h(document,"touchend",this._deselectMultiDrag))),h(document,"keydown",this._checkKeyDown),h(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:!1,setData(t,e){let o="";Qt.length&&ee===n?Qt.forEach((t,e)=>{o+=(e?", ":"")+t.textContent}):o=e.textContent,t.setData("Text",o)}}}return t.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal({dragEl:t}){re=t},delayEnded(){this.isMultiDrag=~Qt.indexOf(re)},setupClone({sortable:t,cancel:e}){if(this.isMultiDrag){for(let t=0;t<Qt.length;t++)Jt.push(y(Qt[t])),Jt[t].sortableIndex=Qt[t].sortableIndex,Jt[t].draggable=!1,Jt[t].style["will-change"]="",M(Jt[t],this.options.selectedClass,!1),Qt[t]===re&&M(Jt[t],this.options.chosenClass,!1);t._hideClone(),e()}},clone({sortable:t,rootEl:e,dispatchSortableEvent:o,cancel:n}){this.isMultiDrag&&(this.options.removeCloneOnHide||Qt.length&&ee===t&&(se(!0,e),o("clone"),n()))},showClone({cloneNowShown:t,rootEl:e,cancel:o}){this.isMultiDrag&&(se(!1,e),Jt.forEach(t=>{N(t,"display","")}),t(),le=!1,o())},hideClone({cloneNowHidden:t,cancel:e}){this.isMultiDrag&&(Jt.forEach(t=>{N(t,"display","none"),this.options.removeCloneOnHide&&t.parentNode&&t.parentNode.removeChild(t)}),t(),le=!0,e())},dragStartGlobal({}){!this.isMultiDrag&&ee&&ee.multiDrag._deselectMultiDrag(),Qt.forEach(t=>{t.sortableIndex=R(t)}),Qt=Qt.sort(function(t,e){return t.sortableIndex-e.sortableIndex}),ie=!0},dragStarted({sortable:t}){if(this.isMultiDrag){if(this.options.sort&&(t.captureAnimationState(),this.options.animation)){Qt.forEach(t=>{t!==re&&N(t,"position","absolute")});let e=A(re,!1,!0,!0);Qt.forEach(t=>{t!==re&&D(t,e)}),ne=!0,oe=!0}t.animateAll(()=>{ne=!1,oe=!1,this.options.animation&&Qt.forEach(t=>{_(t)}),this.options.sort&&ce()})}},dragOver({target:t,completed:e,cancel:o}){ne&&~Qt.indexOf(t)&&(e(!1),o())},revert({fromSortable:e,rootEl:t,sortable:o,dragRect:n}){var i,r;1<Qt.length&&(Qt.forEach(t=>{o.addAnimationState({target:t,rect:ne?A(t):n}),_(t),t.fromRect=n,e.removeAnimationState(t)}),ne=!1,i=!this.options.removeCloneOnHide,r=t,Qt.forEach((t,e)=>{e=r.children[t.sortableIndex+(i?Number(e):0)];e?r.insertBefore(t,e):r.appendChild(t)}))},dragOverCompleted({sortable:t,isOwner:e,insertion:o,activeSortable:n,parentEl:i,putSortable:r}){var a=this.options;if(o){if(e&&n._hideClone(),oe=!1,a.animation&&1<Qt.length&&(ne||!e&&!n.options.sort&&!r)){let e=A(re,!1,!0,!0);Qt.forEach(t=>{t!==re&&(D(t,e),i.appendChild(t))}),ne=!0}e||(ne||ce(),1<Qt.length?(e=le,n._showClone(t),n.options.animation&&!le&&e&&Jt.forEach(t=>{n.addAnimationState({target:t,rect:ae}),t.fromRect=ae,t.thisAnimationDuration=null})):n._showClone(t))}},dragOverAnimationCapture({dragRect:t,isOwner:e,activeSortable:o}){Qt.forEach(t=>{t.thisAnimationDuration=null}),o.options.animation&&!e&&o.multiDrag.isMultiDrag&&(ae=a({},t),t=f(re,!0),ae.top-=t.f,ae.left-=t.e)},dragOverAnimationComplete(){ne&&(ne=!1,ce())},drop({originalEvent:o,rootEl:r,parentEl:a,sortable:l,dispatchSortableEvent:t,oldIndex:s,putSortable:e}){let c=e||this.sortable;if(o){let n=this.options,i=a.children;if(!ie)if(n.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),M(re,n.selectedClass,!~Qt.indexOf(re)),~Qt.indexOf(re))Qt.splice(Qt.indexOf(re),1),te=null,F({sortable:l,rootEl:r,name:"deselect",targetEl:re,originalEvent:o});else{if(Qt.push(re),F({sortable:l,rootEl:r,name:"select",targetEl:re,originalEvent:o}),o.shiftKey&&te&&l.el.contains(te)){var d=R(te),h=R(re);if(~d&&~h&&d!==h){let t,e;for(t=d<h?(e=d,h):(e=h,d+1);e<t;e++)~Qt.indexOf(i[e])||(M(i[e],n.selectedClass,!0),Qt.push(i[e]),F({sortable:l,rootEl:r,name:"select",targetEl:i[e],originalEvent:o}))}}else te=re;ee=c}if(ie&&this.isMultiDrag){if(ne=!1,(a[Y].options.sort||a!==r)&&1<Qt.length){let o=A(re),e=R(re,":not(."+this.options.selectedClass+")");if(!oe&&n.animation&&(re.thisAnimationDuration=null),c.captureAnimationState(),!oe&&(n.animation&&(re.fromRect=o,Qt.forEach(t=>{var e;t.thisAnimationDuration=null,t!==re&&(e=ne?A(t):o,t.fromRect=e,c.addAnimationState({target:t,rect:e}))})),ce(),Qt.forEach(t=>{i[e]?a.insertBefore(t,i[e]):a.appendChild(t),e++}),s===R(re))){let e=!1;Qt.forEach(t=>{t.sortableIndex!==R(t)&&(e=!0)}),e&&(t("update"),t("sort"))}Qt.forEach(t=>{_(t)}),c.animateAll()}ee=c}(r===a||e&&"clone"!==e.lastPutMode)&&Jt.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)})}},nullingGlobal(){this.isMultiDrag=ie=!1,Jt.length=0},destroyGlobal(){this._deselectMultiDrag(),r(document,"pointerup",this._deselectMultiDrag),r(document,"mouseup",this._deselectMultiDrag),r(document,"touchend",this._deselectMultiDrag),r(document,"keydown",this._checkKeyDown),r(document,"keyup",this._checkKeyUp)},_deselectMultiDrag(t){if(!(void 0!==ie&&ie||ee!==this.sortable||t&&x(t.target,this.options.draggable,this.sortable.el,!1)||t&&0!==t.button))for(;Qt.length;){var e=Qt[0];M(e,this.options.selectedClass,!1),Qt.shift(),F({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:e,originalEvent:t})}},_checkKeyDown(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},a(t,{pluginName:"multiDrag",utils:{select(t){var e=t.parentNode[Y];e&&e.options.multiDrag&&!~Qt.indexOf(t)&&(ee&&ee!==e&&(ee.multiDrag._deselectMultiDrag(),ee=e),M(t,e.options.selectedClass,!0),Qt.push(t))},deselect(t){var e=t.parentNode[Y],o=Qt.indexOf(t);e&&e.options.multiDrag&&~o&&(M(t,e.options.selectedClass,!1),Qt.splice(o,1))}},eventProperties(){const o=[],n=[];return Qt.forEach(t=>{o.push({multiDragElement:t,index:t.sortableIndex});let e;e=ne&&t!==re?-1:ne?R(t,":not(."+this.options.selectedClass+")"):R(t),n.push({multiDragElement:t,index:e})}),{items:[...Qt],clones:[...Jt],oldIndicies:o,newIndicies:n}},optionListeners:{multiDragKey(t){return"ctrl"===(t=t.toLowerCase())?t="Control":1<t.length&&(t=t.charAt(0).toUpperCase()+t.substr(1)),t}}})}),Ot.mount(new function(){return a(class{constructor(){this.defaults={cancelDrag:!0}}drop({cancel:t,dispatchSortableEvent:e,originalEvent:o,dragEl:n,cloneEl:i}){"dragend"!==o?.type||this.options.swap||(this.sortable.revertOnSpill?.onSpill(...arguments),n&&(n.classList.remove(this.options.ghostClass),n.classList.remove(this.options.chosenClass),n.removeAttribute("draggable")),i&&i.remove(),e("end"),t())}},{pluginName:"cancelDrag"})}),Ot});