forked from SortableJS/Sortable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSortable.min.js
2 lines (2 loc) · 40.6 KB
/
Sortable.min.js
1
2
/*! Sortable 1.15.2 - 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 i(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 l(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function x(t,e,o,n){if(t){o=o||document;do{if(null!=e&&(">"!==e[0]||t.parentNode===o)&&i(t,e)||n&&t===o)return t}while(t!==o&&(t=l(t)))}return null}const s=/\s+/g;function M(t,e,o){var n;t&&e&&(t.classList?t.classList[o?"add":"remove"](e):(n=(" "+t.className+" ").replace(s," ").replace(" "+e+" "," "),t.className=(n+(o?" "+e:"")).replace(s," ")))}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,e,o){let n=R(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=R(n,!1)}return!1}function O(t,e,o,n){let i=0,r=0,a=t.children;for(;r<a.length;){if("none"!==a[r].style.display&&a[r]!==Pt.ghost&&(n||a[r]!==Pt.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===Pt.ghost||"none"===N(o,"display")||e&&!i(o,e));)o=o.previousElementSibling;return o||null}function k(t,e){let o=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===Pt.clone||e&&!i(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 R(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","")}function Y(e,o,n){const i={};return Array.from(e.children).forEach(t=>{x(t,o.draggable,e,!1)&&!t.animated&&t!==n&&(t=A(t),i.left=Math.min(i.left??1/0,t.left),i.top=Math.min(i.top??1/0,t.top),i.right=Math.max(i.right??-1/0,t.right),i.bottom=Math.max(i.bottom??-1/0,t.bottom))}),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}const B="Sortable"+(new Date).getTime();function S(){let n=[],e;return{captureAnimationState(){if(n=[],this.options.animation){let t=[].slice.call(this.el.children);t.forEach(e=>{if("none"!==N(e,"display")&&e!==Pt.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 F={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 H({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[B]){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,...F.getEventProperties(r,n)};for(v in b)t[v]=b[v];i&&i.dispatchEvent(t),e[o]&&e[o].call(n,t)}}let L=function(t,e,{evt:o,...n}={}){F.pluginEvent.bind(Pt)(t,e,{dragEl:W,parentEl:z,ghostEl:G,rootEl:$,nextEl:U,lastDownEl:j,cloneEl:q,cloneHidden:V,dragStarted:ut,putSortable:ot,activeSortable:Pt.active,originalEvent:o,oldIndex:Z,oldDraggableIndex:J,newIndex:Q,newDraggableIndex:tt,hideGhostForTarget:Nt,unhideGhostForTarget:At,cloneNowHidden(){V=!0},cloneNowShown(){V=!1},dispatchSortableEvent(t){K({sortable:e,name:t,originalEvent:o})},...n})};function K(t){H({putSortable:ot,cloneEl:q,targetEl:W,rootEl:$,oldIndex:Z,oldDraggableIndex:J,newIndex:Q,newDraggableIndex:tt,...t})}let W,z,G,$,U,j,q,V,Z,Q,J,tt,et,ot,nt=!1,it=!1,rt=[],at,lt,st,ct,dt,ht,ut,pt,ft,gt=!1,mt=!1,vt,bt,wt=[],Et=!1,yt=[];const Dt="undefined"!=typeof document,_t=e,St=E||w?"cssFloat":"float",Ct=Dt&&!o&&!e&&"draggable"in document.createElement("div"),Tt=function(){if(Dt){if(w)return!1;let t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),xt=function(t,e){let o=N(t),n=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),i=O(t,0,e),r=O(t,1,e),a=i&&N(i),l=r&&N(r),s=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+A(i).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+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[St]||r&&"none"===o[St]&&n<s+c)?"vertical":"horizontal"},Mt=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},Nt=function(){!Tt&&G&&N(G,"display","none")},At=function(){!Tt&&G&&N(G,"display","")};Dt&&!o&&document.addEventListener("click",function(t){if(it)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),it=!1},!0);let It=function(o){if(W){let e=function(i,r){let a;return rt.some(t=>{var e=t[B].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[B]._onDragOver(t)}}},Ot=function(t){W&&W.parentNode[B]._isOutsideThisEl(t.target)};function Pt(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[B]=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 xt(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!==Pt.supportPointer&&"PointerEvent"in window&&!d,emptyInsertThreshold:5};for(o in F.initializePlugins(this,t,i),i)o in e||(e[o]=i[o]);for(n in Mt(e),this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));this.nativeDraggable=!e.forceFallback&&Ct,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)),rt.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[B],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 Rt(t){t.draggable=!1}function Xt(){Et=!1}function Yt(t){return setTimeout(t,0)}function Bt(t){return clearTimeout(t)}Pt.prototype={constructor:Pt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(pt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,W):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){yt.length=0;let e=t.getElementsByTagName("input"),o=e.length;for(;o--;){var n=e[o];n.checked&&yt.push(n)}}(o),!W&&!(/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||j===a))){if(Z=k(a),J=k(a,t.draggable),"function"==typeof s){if(s.call(this,c,a,this))return K({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:o,fromEl:o}),L("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 K({sortable:e,rootEl:t,name:"filter",targetEl:a,fromEl:o,toEl:o}),L("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&&!W&&o.parentNode===i&&(s=A(o),$=i,W=o,z=W.parentNode,U=W.nextSibling,j=o,et=r.group,Pt.dragged=W,at={target:W,clientX:(e||t).clientX,clientY:(e||t).clientY},dt=at.clientX-s.left,ht=at.clientY-s.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,W.style["will-change"]="all",l=function(){L("delayEnded",n,{evt:t}),Pt.eventCanceled?n._onDrop():(n._disableDelayedDragEvents(),!c&&n.nativeDraggable&&(W.draggable=!0),n._triggerDragStart(t,e),K({sortable:n,name:"choose",originalEvent:t}),M(W,r.chosenClass,!0))},r.ignore.split(",").forEach(function(t){u(W,t.trim(),Rt)}),h(a,"dragover",It),h(a,"mousemove",It),h(a,"touchmove",It),h(a,"mouseup",n._onDrop),h(a,"touchend",n._onDrop),h(a,"touchcancel",n._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,W.draggable=!0),L("delayStart",this,{evt:t}),!r.delay||r.delayOnTouchOnly&&!e||this.nativeDraggable&&(E||w)?l():Pt.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(){W&&Rt(W),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(W,"dragend",this),h($,"dragstart",this._onDragStart));try{document.selection?Yt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){var o;nt=!1,$&&W?(L("dragStarted",this,{evt:e}),this.nativeDraggable&&h(document,"dragover",Ot),o=this.options,t||M(W,o.dragClass,!1),M(W,o.ghostClass,!0),Pt.active=this,t&&this._appendGhost(),K({sortable:this,name:"start",originalEvent:e})):this._nulling()},_emulateDragOver:function(){if(lt){this._lastX=lt.clientX,this._lastY=lt.clientY,Nt();let t=document.elementFromPoint(lt.clientX,lt.clientY),e=t;for(;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(lt.clientX,lt.clientY),t!==e);)e=t;if(W.parentNode[B]._isOutsideThisEl(t),e)do{if(e[B])if(e[B]._onDragOver({clientX:lt.clientX,clientY:lt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}while(t=e,e=l(e));At()}},_onTouchMove:function(d){if(at){let t=this.options,e=t.fallbackTolerance,o=t.fallbackOffset,n=d.touches?d.touches[0]:d,i=G&&f(G,!0),r=G&&i&&i.a,a=G&&i&&i.d,l=_t&&bt&&g(bt),s=(n.clientX-at.clientX+o.x)/(r||1)+(l?l[0]-wt[0]:0)/(r||1),c=(n.clientY-at.clientY+o.y)/(a||1)+(l?l[1]-wt[1]:0)/(a||1);if(!Pt.active&&!nt){if(e&&Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))<e)return;this._onDragStart(d,!0)}var h;G&&(i?(i.e+=s-(st||0),i.f+=c-(ct||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(G,"webkitTransform",h),N(G,"mozTransform",h),N(G,"msTransform",h),N(G,"transform",h),st=s,ct=c,lt=n),d.cancelable&&d.preventDefault()}},_appendGhost:function(){if(!G){let t=this.options.fallbackOnBody?document.body:$,e=A(W,!0,_t,!0,t),o=this.options;if(_t){for(bt=t;"static"===N(bt,"position")&&"none"===N(bt,"transform")&&bt!==document;)bt=bt.parentNode;bt!==document.body&&bt!==document.documentElement?(bt===document&&(bt=p()),e.top+=bt.scrollTop,e.left+=bt.scrollLeft):bt=p(),wt=g(bt)}G=W.cloneNode(!0),M(G,o.ghostClass,!1),M(G,o.fallbackClass,!0),M(G,o.dragClass,!0),N(G,"transition",""),N(G,"transform",""),N(G,"box-sizing","border-box"),N(G,"margin",0),N(G,"top",e.top),N(G,"left",e.left),N(G,"width",e.width),N(G,"height",e.height),N(G,"opacity","0.8"),N(G,"position",_t?"absolute":"fixed"),N(G,"zIndex","100000"),N(G,"pointerEvents","none"),Pt.ghost=G,t.appendChild(G),N(G,"transform-origin",dt/parseInt(G.style.width)*100+"% "+ht/parseInt(G.style.height)*100+"%")}},_onDragStart:function(t,e){let o=this,n=t.dataTransfer,i=o.options;L("dragStart",this,{evt:t}),Pt.eventCanceled?this._onDrop():(L("setupClone",this),Pt.eventCanceled||(q=y(W),q.removeAttribute("id"),q.draggable=!1,q.style["will-change"]="",this._hideClone(),M(q,this.options.chosenClass,!1),Pt.clone=q),o.cloneId=Yt(function(){L("clone",o),Pt.eventCanceled||(o.options.removeCloneOnHide||$.insertBefore(q,W),o._hideClone(),K({sortable:o,name:"clone"}))}),e||M(W,i.dragClass,!0),e?(it=!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,W)),h(document,"drop",o),N(W,"transform","translateZ(0)")),nt=!0,o._dragStartId=Yt(o._dragStarted.bind(o,e,t)),h(document,"selectstart",o),ut=!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=Pt.active,n=et===t,i=g.sort,r=ot||e,m,a=this,l=!1;if(!Et){if(void 0!==d.preventDefault&&d.cancelable&&d.preventDefault(),u=x(u,g.draggable,h,!0),c("dragOver"),Pt.eventCanceled)return l;if(W.contains(d.target)||u.animated&&u.animatingX&&u.animatingY||a._ignoreWhileAnimating===u)return C(!1);if(it=!1,e&&!g.disabled&&(n?i||(o=z!==$):ot===this||(this.lastPutMode=et.checkPull(this,e,W,d))&&t.checkPut(this,e,W,d))){if(m="vertical"===this._getDirection(d,u),p=A(W),c("dragOverValid"),Pt.eventCanceled)return l;if(o)return z=$,S(),this._hideClone(),c("revert"),Pt.eventCanceled||(U?$.insertBefore(W,U):$.appendChild(W)),C(!0);var s=P(h,g.draggable);if(s&&(E=d,y=m,_=A(P((D=this).el,D.options.draggable)),D=Y(D.el,D.options,G),!(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(O(o.el,0,o.options,!0));o=Y(o.el,o.options,G);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=O(h,0,g,!0);if(v===W)return C(!1);if(u=v,f=A(u),!1!==kt($,h,W,p,u,f,d,!1))return S(),h.insertBefore(W,v),z=h,T(),C(!0)}else if(u.parentNode===h){f=A(u);let e,t,o=W.parentNode!==h,n=(b=W.animated&&W.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=I(u,"top","top")||I(W,"top","top"),a=r?r.scrollTop:void 0;pt!==u&&(t=f[i],gt=!1,mt=!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&&vt<c*i){if(!gt&&(1===ft?d+c*r/2<s:s<h-c*r/2)&&(gt=!0),gt)u=!0;else if(1===ft?s<d+vt:s>h-vt)return-ft}else if(d+c*(1-i)/2<s&&s<h-c*(1-i)/2)return function(t){return k(W)<k(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,mt,pt===u))){let t=k(W);for(;t-=e,l=z.children[t],l&&("none"===N(l,"display")||l===G););}if(0===e||l===u)return C(!1);pt=u,ft=e;let s=u.nextElementSibling,c=!1;c=1===e;w=kt($,h,W,p,u,f,d,c);if(!1!==w)return 1!==w&&-1!==w||(c=1===w),Et=!0,setTimeout(Xt,30),S(),c&&!s?h.appendChild(W):u.parentNode.insertBefore(W,c?s:u),r&&X(r,0,a-r.scrollTop),z=W.parentNode,void 0===t||mt||(vt=Math.abs(t-A(u)[i])),T(),C(!0)}}else{if(s===W)return C(!1);if(s&&h===d.target&&(u=s),u&&(f=A(u)),!1!==kt($,h,W,p,u,f,d,!!u))return S(),s&&s.nextSibling?h.insertBefore(W,s.nextSibling):h.appendChild(W),z=h,T(),C(!0)}if(h.contains(W))return C(!1)}var b,w,E,y,D,_;return!1}function c(t,e){L(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($,h,W,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(W,(ot||e).options.ghostClass,!1),M(W,g.ghostClass,!0)),ot!==a&&a!==Pt.active?ot=a:a===Pt.active&&ot&&(ot=null),r===a&&(a._ignoreWhileAnimating=u),a.animateAll(function(){c("dragOverAnimationComplete"),a._ignoreWhileAnimating=null}),a!==r&&(r.animateAll(),r._ignoreWhileAnimating=null)),(u===W&&!W.animated||u===h&&!u.animated)&&(pt=null),g.dragoverBubble||d.rootEl||u===document||(W.parentNode[B]._isOutsideThisEl(d.target),t||It(d)),!g.dragoverBubble&&d.stopPropagation&&d.stopPropagation(),l=!0}function T(){Q=k(W),tt=k(W,g.draggable),K({sortable:a,name:"change",toEl:h,newIndex:Q,newDraggableIndex:tt,originalEvent:d})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){r(document,"mousemove",this._onTouchMove),r(document,"touchmove",this._onTouchMove),r(document,"pointermove",this._onTouchMove),r(document,"dragover",It),r(document,"mousemove",It),r(document,"touchmove",It)},_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;Q=k(W),tt=k(W,o.draggable),L("drop",this,{evt:t}),z=W&&W.parentNode,Q=k(W),tt=k(W,o.draggable),Pt.eventCanceled||(nt=!1,mt=!1,gt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Bt(this.cloneId),Bt(this._dragStartId),this.nativeDraggable&&(r(document,"drop",this),r(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),d&&N(document.body,"user-select",""),N(W,"transform",""),t&&(ut&&(t.cancelable&&t.preventDefault(),o.dropBubble||t.stopPropagation()),G&&G.parentNode&&G.parentNode.removeChild(G),($===z||ot&&"clone"!==ot.lastPutMode)&&q&&q.parentNode&&q.parentNode.removeChild(q),W&&(this.nativeDraggable&&r(W,"dragend",this),Rt(W),W.style["will-change"]="",ut&&!nt&&M(W,(ot||this).options.ghostClass,!1),M(W,this.options.chosenClass,!1),K({sortable:this,name:"unchoose",toEl:z,newIndex:null,newDraggableIndex:null,originalEvent:t}),$!==z?(0<=Q&&(K({rootEl:z,name:"add",toEl:z,fromEl:$,originalEvent:t}),K({sortable:this,name:"remove",toEl:z,originalEvent:t}),K({rootEl:z,name:"sort",toEl:z,fromEl:$,originalEvent:t}),K({sortable:this,name:"sort",toEl:z,originalEvent:t})),ot&&ot.save()):Q!==Z&&0<=Q&&(K({sortable:this,name:"update",toEl:z,originalEvent:t}),K({sortable:this,name:"sort",toEl:z,originalEvent:t})),Pt.active&&(null!=Q&&-1!==Q||(Q=Z,tt=J),K({sortable:this,name:"end",toEl:z,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){L("nulling",this),$=W=z=G=U=q=j=V=at=lt=ut=Q=tt=Z=J=pt=ft=ot=et=Pt.dragged=Pt.ghost=Pt.clone=Pt.active=null,yt.forEach(function(t){t.checked=!0}),yt.length=st=ct=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":W&&(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[n],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(t){o[t]&&(n.removeChild(o[t]),n.appendChild(o[t]))}),e&&this.animateAll()},save:function(){let t=this.options.store;t&&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=F.modifyOption(this,t,e);o[t]=void 0!==n?n:e,"group"===t&&Mt(o)},destroy:function(){L("destroy",this);let t=this.el;t[B]=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)),it=!1,Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),rt.splice(rt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){V||(L("hideClone",this),Pt.eventCanceled||(N(q,"display","none"),this.options.removeCloneOnHide&&q.parentNode&&q.parentNode.removeChild(q),V=!0))},_showClone:function(t){"clone"===t.lastPutMode?V&&(L("showClone",this),Pt.eventCanceled||(W.parentNode!=$||this.options.group.revertClone?U?$.insertBefore(q,U):$.appendChild(q):$.insertBefore(q,W),this.options.group.revertClone&&this.animate(W,q),N(q,"display",""),V=!1)):this._hideClone()}},Dt&&h(document,"touchmove",function(t){(Pt.active||nt)&&t.cancelable&&t.preventDefault()}),Pt.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:k,nextTick:Yt,cancelNextTick:Bt,detectDirection:xt,getChild:O,expando:B},Pt.get=function(t){return t[B]},Pt.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&&(Pt.utils={...Pt.utils,...t.utils}),F.mount(t)})},Pt.create=function(t,e){return new Pt(t,e)};let Ft=[],Ht,Lt,Kt=!(Pt.version="1.15.2"),Wt,zt,Gt,$t;function Ut(){Ft.forEach(function(t){clearInterval(t.pid)}),Ft=[]}function jt(){clearInterval($t)}const qt=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;Lt!==e&&(Lt=e,Ut(),Ht=t.scroll,m=t.scrollFn,!0===Ht&&(Ht=R(e,!0)));let v=0,b=Ht;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(!Ft[v])for(let t=0;t<=v;t++)Ft[t]||(Ft[t]={});Ft[v].vx==y&&Ft[v].vy==D&&Ft[v].el===t||(Ft[v].el=t,Ft[v].vx=y,Ft[v].vy=D,clearInterval(Ft[v].pid),0==y&&0==D||(g=!0,Ft[v].pid=setInterval(function(){E&&0===this.layer&&Pt.active._onTouchMove(Gt);var t=Ft[this.layer].vy?Ft[this.layer].vy*T:0,e=Ft[this.layer].vx?Ft[this.layer].vx*T:0;"function"==typeof m&&"continue"!==m.call(Pt.dragged.parentNode[B],e,t,w,Gt,Ft[this.layer].el)||X(Ft[this.layer].el,e,t)}.bind({layer:v}),24))),v++}while(t.bubbleScroll&&b!==x&&(b=R(b,!1)));Kt=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 Vt(){}function Zt(){}Vt.prototype={startIndex:null,dragStart({oldDraggableIndex:t}){this.startIndex=t},onSpill({dragEl:t,putSortable:e}){this.sortable.captureAnimationState(),e&&e.captureAnimationState();var o=O(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(Vt,{pluginName:"revertOnSpill"}),Zt.prototype={onSpill({dragEl:t,putSortable:e}){const o=e||this.sortable;o.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),o.animateAll()},drop:o},a(Zt,{pluginName:"removeOnSpill"});let Qt;let Jt=[],te=[],ee,oe,ne=!1,ie=!1,re=!1,ae,le,se;function ce(o,n){te.forEach((t,e)=>{e=n.children[t.sortableIndex+(o?Number(e):0)];e?n.insertBefore(t,e):n.appendChild(t)})}function de(){Jt.forEach(t=>{t!==ae&&t.parentNode&&t.parentNode.removeChild(t)})}return Pt.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)),jt(),Ut(),clearTimeout(v),v=void 0},nulling(){Gt=Lt=Ht=Kt=$t=Wt=zt=null,Ft.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(Gt=o,n||this.options.forceAutoScrollFallback||E||w||d){qt(o,this.options,t,n);let e=R(t,!0);!Kt||$t&&i===Wt&&r===zt||($t&&jt(),$t=setInterval(()=>{var t=R(document.elementFromPoint(i,r),!0);t!==e&&(e=t,Ut()),qt(o,this.options,t,n)},10),Wt=i,zt=r)}else this.options.bubbleScroll&&R(t,!0)!==p()?qt(o,this.options,R(t,!1),!1):Ut()}},a(t,{pluginName:"scroll",initializeByDefault:!0})}),Pt.mount(Zt,Vt),Pt.mount(new function(){function t(){this.defaults={swapClass:"sortable-swap-highlight"}}return t.prototype={dragStart({dragEl:t}){Qt=t},dragOverValid({completed:t,target:e,onMove:o,activeSortable:n,changed:i,cancel:r}){var a;n.options.swap&&(a=this.sortable.el,n=this.options,e&&e!==a&&(a=Qt,Qt=!1!==o(e)?(M(e,n.swapClass,!0),e):null,a&&a!==Qt&&M(a,n.swapClass,!1)),i(),t(!0),r())},drop({activeSortable:t,putSortable:e,dragEl:o}){let n=e||this.sortable;var i=this.options;Qt&&M(Qt,i.swapClass,!1),Qt&&(i.swap||e&&e.options.swap)&&o!==Qt&&(n.captureAnimationState(),n!==t&&t.captureAnimationState(),function(t,e){let o=t.parentNode,n=e.parentNode,i,r;o&&n&&!o.isEqualNode(e)&&!n.isEqualNode(t)&&(i=k(t),r=k(e),o.isEqualNode(n)&&i<r&&r++,o.insertBefore(e,o.children[i]),n.insertBefore(t,n.children[r]))}(o,Qt),n.animateAll(),n!==t&&t.animateAll())},nulling(){Qt=null}},a(t,{pluginName:"swap",eventProperties(){return{swapItem:Qt}}})}),Pt.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="";Jt.length&&oe===n?Jt.forEach((t,e)=>{o+=(e?", ":"")+t.textContent}):o=e.textContent,t.setData("Text",o)}}}return t.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal({dragEl:t}){ae=t},delayEnded(){this.isMultiDrag=~Jt.indexOf(ae)},setupClone({sortable:t,cancel:e}){if(this.isMultiDrag){for(let t=0;t<Jt.length;t++)te.push(y(Jt[t])),te[t].sortableIndex=Jt[t].sortableIndex,te[t].draggable=!1,te[t].style["will-change"]="",M(te[t],this.options.selectedClass,!1),Jt[t]===ae&&M(te[t],this.options.chosenClass,!1);t._hideClone(),e()}},clone({sortable:t,rootEl:e,dispatchSortableEvent:o,cancel:n}){this.isMultiDrag&&(this.options.removeCloneOnHide||Jt.length&&oe===t&&(ce(!0,e),o("clone"),n()))},showClone({cloneNowShown:t,rootEl:e,cancel:o}){this.isMultiDrag&&(ce(!1,e),te.forEach(t=>{N(t,"display","")}),t(),se=!1,o())},hideClone({cloneNowHidden:t,cancel:e}){this.isMultiDrag&&(te.forEach(t=>{N(t,"display","none"),this.options.removeCloneOnHide&&t.parentNode&&t.parentNode.removeChild(t)}),t(),se=!0,e())},dragStartGlobal({}){!this.isMultiDrag&&oe&&oe.multiDrag._deselectMultiDrag(),Jt.forEach(t=>{t.sortableIndex=k(t)}),Jt=Jt.sort(function(t,e){return t.sortableIndex-e.sortableIndex}),re=!0},dragStarted({sortable:t}){if(this.isMultiDrag){if(this.options.sort&&(t.captureAnimationState(),this.options.animation)){Jt.forEach(t=>{t!==ae&&N(t,"position","absolute")});let e=A(ae,!1,!0,!0);Jt.forEach(t=>{t!==ae&&D(t,e)}),ie=!0,ne=!0}t.animateAll(()=>{ie=!1,ne=!1,this.options.animation&&Jt.forEach(t=>{_(t)}),this.options.sort&&de()})}},dragOver({target:t,completed:e,cancel:o}){ie&&~Jt.indexOf(t)&&(e(!1),o())},revert({fromSortable:e,rootEl:t,sortable:o,dragRect:n}){var i,r;1<Jt.length&&(Jt.forEach(t=>{o.addAnimationState({target:t,rect:ie?A(t):n}),_(t),t.fromRect=n,e.removeAnimationState(t)}),ie=!1,i=!this.options.removeCloneOnHide,r=t,Jt.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(),ne=!1,a.animation&&1<Jt.length&&(ie||!e&&!n.options.sort&&!r)){let e=A(ae,!1,!0,!0);Jt.forEach(t=>{t!==ae&&(D(t,e),i.appendChild(t))}),ie=!0}e||(ie||de(),1<Jt.length?(e=se,n._showClone(t),n.options.animation&&!se&&e&&te.forEach(t=>{n.addAnimationState({target:t,rect:le}),t.fromRect=le,t.thisAnimationDuration=null})):n._showClone(t))}},dragOverAnimationCapture({dragRect:t,isOwner:e,activeSortable:o}){Jt.forEach(t=>{t.thisAnimationDuration=null}),o.options.animation&&!e&&o.multiDrag.isMultiDrag&&(le=a({},t),t=f(ae,!0),le.top-=t.f,le.left-=t.e)},dragOverAnimationComplete(){ie&&(ie=!1,de())},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(!re)if(n.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),M(ae,n.selectedClass,!~Jt.indexOf(ae)),~Jt.indexOf(ae))Jt.splice(Jt.indexOf(ae),1),ee=null,H({sortable:l,rootEl:r,name:"deselect",targetEl:ae,originalEvent:o});else{if(Jt.push(ae),H({sortable:l,rootEl:r,name:"select",targetEl:ae,originalEvent:o}),o.shiftKey&&ee&&l.el.contains(ee)){var d=k(ee),h=k(ae);if(~d&&~h&&d!==h){let t,e;for(t=d<h?(e=d,h):(e=h,d+1);e<t;e++)~Jt.indexOf(i[e])||(M(i[e],n.selectedClass,!0),Jt.push(i[e]),H({sortable:l,rootEl:r,name:"select",targetEl:i[e],originalEvent:o}))}}else ee=ae;oe=c}if(re&&this.isMultiDrag){if(ie=!1,(a[B].options.sort||a!==r)&&1<Jt.length){let o=A(ae),e=k(ae,":not(."+this.options.selectedClass+")");if(!ne&&n.animation&&(ae.thisAnimationDuration=null),c.captureAnimationState(),!ne&&(n.animation&&(ae.fromRect=o,Jt.forEach(t=>{var e;t.thisAnimationDuration=null,t!==ae&&(e=ie?A(t):o,t.fromRect=e,c.addAnimationState({target:t,rect:e}))})),de(),Jt.forEach(t=>{i[e]?a.insertBefore(t,i[e]):a.appendChild(t),e++}),s===k(ae))){let e=!1;Jt.forEach(t=>{t.sortableIndex!==k(t)&&(e=!0)}),e&&(t("update"),t("sort"))}Jt.forEach(t=>{_(t)}),c.animateAll()}oe=c}(r===a||e&&"clone"!==e.lastPutMode)&&te.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)})}},nullingGlobal(){this.isMultiDrag=re=!1,te.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!==re&&re||oe!==this.sortable||t&&x(t.target,this.options.draggable,this.sortable.el,!1)||t&&0!==t.button))for(;Jt.length;){var e=Jt[0];M(e,this.options.selectedClass,!1),Jt.shift(),H({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[B];e&&e.options.multiDrag&&!~Jt.indexOf(t)&&(oe&&oe!==e&&(oe.multiDrag._deselectMultiDrag(),oe=e),M(t,e.options.selectedClass,!0),Jt.push(t))},deselect(t){var e=t.parentNode[B],o=Jt.indexOf(t);e&&e.options.multiDrag&&~o&&(M(t,e.options.selectedClass,!1),Jt.splice(o,1))}},eventProperties(){const o=[],n=[];return Jt.forEach(t=>{o.push({multiDragElement:t,index:t.sortableIndex});let e;e=ie&&t!==ae?-1:ie?k(t,":not(."+this.options.selectedClass+")"):k(t),n.push({multiDragElement:t,index:e})}),{items:[...Jt],clones:[...te],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}}})}),Pt});