sortable.esm.2632adaa.js 44 KB

1234567
  1. /**!
  2. * Sortable 1.15.0
  3. * @author RubaXa <trash@rubaxa.org>
  4. * @author owenm <owen23355@gmail.com>
  5. * @license MIT
  6. */function De(o,t){var e=Object.keys(o);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(o);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),e.push.apply(e,n)}return e}function Q(o){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?De(Object(e),!0).forEach(function(n){qe(o,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(e)):De(Object(e)).forEach(function(n){Object.defineProperty(o,n,Object.getOwnPropertyDescriptor(e,n))})}return o}function Ht(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ht=function(t){return typeof t}:Ht=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(o)}function qe(o,t,e){return t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function j(){return j=Object.assign||function(o){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n])}return o},j.apply(this,arguments)}function $e(o,t){if(o==null)return{};var e={},n=Object.keys(o),i,r;for(r=0;r<n.length;r++)i=n[r],!(t.indexOf(i)>=0)&&(e[i]=o[i]);return e}function Ve(o,t){if(o==null)return{};var e=$e(o,t),n,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);for(i=0;i<r.length;i++)n=r[i],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(o,n)||(e[n]=o[n]))}return e}function Ze(o){return Qe(o)||Je(o)||tn(o)||en()}function Qe(o){if(Array.isArray(o))return oe(o)}function Je(o){if(typeof Symbol!="undefined"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)}function tn(o,t){if(!!o){if(typeof o=="string")return oe(o,t);var e=Object.prototype.toString.call(o).slice(8,-1);if(e==="Object"&&o.constructor&&(e=o.constructor.name),e==="Map"||e==="Set")return Array.from(o);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return oe(o,t)}}function oe(o,t){(t==null||t>o.length)&&(t=o.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=o[e];return n}function en(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
  7. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var nn="1.15.0";function et(o){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(o)}var nt=et(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ct=et(/Edge/i),_e=et(/firefox/i),Ot=et(/safari/i)&&!et(/chrome/i)&&!et(/android/i),Ce=et(/iP(ad|od|hone)/i),Oe=et(/chrome/i)&&et(/android/i),Te={capture:!1,passive:!1};function y(o,t,e){o.addEventListener(t,e,!nt&&Te)}function w(o,t,e){o.removeEventListener(t,e,!nt&&Te)}function Gt(o,t){if(!!t){if(t[0]===">"&&(t=t.substring(1)),o)try{if(o.matches)return o.matches(t);if(o.msMatchesSelector)return o.msMatchesSelector(t);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(t)}catch{return!1}return!1}}function on(o){return o.host&&o!==document&&o.host.nodeType?o.host:o.parentNode}function U(o,t,e,n){if(o){e=e||document;do{if(t!=null&&(t[0]===">"?o.parentNode===e&&Gt(o,t):Gt(o,t))||n&&o===e)return o;if(o===e)break}while(o=on(o))}return null}var Ae=/\s+/g;function T(o,t,e){if(o&&t)if(o.classList)o.classList[e?"add":"remove"](t);else{var n=(" "+o.className+" ").replace(Ae," ").replace(" "+t+" "," ");o.className=(n+(e?" "+t:"")).replace(Ae," ")}}function h(o,t,e){var n=o&&o.style;if(n){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(e=o.currentStyle),t===void 0?e:e[t];!(t in n)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),n[t]=e+(typeof e=="string"?"":"px")}}function ct(o,t){var e="";if(typeof o=="string")e=o;else do{var n=h(o,"transform");n&&n!=="none"&&(e=n+" "+e)}while(!t&&(o=o.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(e)}function Ie(o,t,e){if(o){var n=o.getElementsByTagName(t),i=0,r=n.length;if(e)for(;i<r;i++)e(n[i],i);return n}return[]}function J(){var o=document.scrollingElement;return o||document.documentElement}function C(o,t,e,n,i){if(!(!o.getBoundingClientRect&&o!==window)){var r,a,l,s,u,d,f;if(o!==window&&o.parentNode&&o!==J()?(r=o.getBoundingClientRect(),a=r.top,l=r.left,s=r.bottom,u=r.right,d=r.height,f=r.width):(a=0,l=0,s=window.innerHeight,u=window.innerWidth,d=window.innerHeight,f=window.innerWidth),(t||e)&&o!==window&&(i=i||o.parentNode,!nt))do if(i&&i.getBoundingClientRect&&(h(i,"transform")!=="none"||e&&h(i,"position")!=="static")){var p=i.getBoundingClientRect();a-=p.top+parseInt(h(i,"border-top-width")),l-=p.left+parseInt(h(i,"border-left-width")),s=a+r.height,u=l+r.width;break}while(i=i.parentNode);if(n&&o!==window){var E=ct(i||o),b=E&&E.a,S=E&&E.d;E&&(a/=S,l/=b,f/=b,d/=S,s=a+d,u=l+f)}return{top:a,left:l,bottom:s,right:u,width:f,height:d}}}function Ne(o,t,e){for(var n=rt(o,!0),i=C(o)[t];n;){var r=C(n)[e],a=void 0;if(e==="top"||e==="left"?a=i>=r:a=i<=r,!a)return n;if(n===J())break;n=rt(n,!1)}return!1}function pt(o,t,e,n){for(var i=0,r=0,a=o.children;r<a.length;){if(a[r].style.display!=="none"&&a[r]!==g.ghost&&(n||a[r]!==g.dragged)&&U(a[r],e.draggable,o,!1)){if(i===t)return a[r];i++}r++}return null}function ie(o,t){for(var e=o.lastElementChild;e&&(e===g.ghost||h(e,"display")==="none"||t&&!Gt(e,t));)e=e.previousElementSibling;return e||null}function I(o,t){var e=0;if(!o||!o.parentNode)return-1;for(;o=o.previousElementSibling;)o.nodeName.toUpperCase()!=="TEMPLATE"&&o!==g.clone&&(!t||Gt(o,t))&&e++;return e}function Pe(o){var t=0,e=0,n=J();if(o)do{var i=ct(o),r=i.a,a=i.d;t+=o.scrollLeft*r,e+=o.scrollTop*a}while(o!==n&&(o=o.parentNode));return[t,e]}function rn(o,t){for(var e in o)if(!!o.hasOwnProperty(e)){for(var n in t)if(t.hasOwnProperty(n)&&t[n]===o[e][n])return Number(e)}return-1}function rt(o,t){if(!o||!o.getBoundingClientRect)return J();var e=o,n=!1;do if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var i=h(e);if(e.clientWidth<e.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||e.clientHeight<e.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!e.getBoundingClientRect||e===document.body)return J();if(n||t)return e;n=!0}}while(e=e.parentNode);return J()}function an(o,t){if(o&&t)for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e]);return o}function re(o,t){return Math.round(o.top)===Math.round(t.top)&&Math.round(o.left)===Math.round(t.left)&&Math.round(o.height)===Math.round(t.height)&&Math.round(o.width)===Math.round(t.width)}var Tt;function xe(o,t){return function(){if(!Tt){var e=arguments,n=this;e.length===1?o.call(n,e[0]):o.apply(n,e),Tt=setTimeout(function(){Tt=void 0},t)}}}function ln(){clearTimeout(Tt),Tt=void 0}function Me(o,t,e){o.scrollLeft+=t,o.scrollTop+=e}function ae(o){var t=window.Polymer,e=window.jQuery||window.Zepto;return t&&t.dom?t.dom(o).cloneNode(!0):e?e(o).clone(!0)[0]:o.cloneNode(!0)}function Fe(o,t){h(o,"position","absolute"),h(o,"top",t.top),h(o,"left",t.left),h(o,"width",t.width),h(o,"height",t.height)}function le(o){h(o,"position",""),h(o,"top",""),h(o,"left",""),h(o,"width",""),h(o,"height","")}var R="Sortable"+new Date().getTime();function sn(){var o=[],t;return{captureAnimationState:function(){if(o=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(i){if(!(h(i,"display")==="none"||i===g.ghost)){o.push({target:i,rect:C(i)});var r=Q({},o[o.length-1].rect);if(i.thisAnimationDuration){var a=ct(i,!0);a&&(r.top-=a.f,r.left-=a.e)}i.fromRect=r}})}},addAnimationState:function(n){o.push(n)},removeAnimationState:function(n){o.splice(rn(o,{target:n}),1)},animateAll:function(n){var i=this;if(!this.options.animation){clearTimeout(t),typeof n=="function"&&n();return}var r=!1,a=0;o.forEach(function(l){var s=0,u=l.target,d=u.fromRect,f=C(u),p=u.prevFromRect,E=u.prevToRect,b=l.rect,S=ct(u,!0);S&&(f.top-=S.f,f.left-=S.e),u.toRect=f,u.thisAnimationDuration&&re(p,f)&&!re(d,f)&&(b.top-f.top)/(b.left-f.left)==(d.top-f.top)/(d.left-f.left)&&(s=cn(b,p,E,i.options)),re(f,d)||(u.prevFromRect=d,u.prevToRect=f,s||(s=i.options.animation),i.animate(u,b,f,s)),s&&(r=!0,a=Math.max(a,s),clearTimeout(u.animationResetTimer),u.animationResetTimer=setTimeout(function(){u.animationTime=0,u.prevFromRect=null,u.fromRect=null,u.prevToRect=null,u.thisAnimationDuration=null},s),u.thisAnimationDuration=s)}),clearTimeout(t),r?t=setTimeout(function(){typeof n=="function"&&n()},a):typeof n=="function"&&n(),o=[]},animate:function(n,i,r,a){if(a){h(n,"transition",""),h(n,"transform","");var l=ct(this.el),s=l&&l.a,u=l&&l.d,d=(i.left-r.left)/(s||1),f=(i.top-r.top)/(u||1);n.animatingX=!!d,n.animatingY=!!f,h(n,"transform","translate3d("+d+"px,"+f+"px,0)"),this.forRepaintDummy=un(n),h(n,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),h(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){h(n,"transition",""),h(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},a)}}}}function un(o){return o.offsetWidth}function cn(o,t,e,n){return Math.sqrt(Math.pow(t.top-o.top,2)+Math.pow(t.left-o.left,2))/Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))*n.animation}var gt=[],se={initializeByDefault:!0},At={mount:function(t){for(var e in se)se.hasOwnProperty(e)&&!(e in t)&&(t[e]=se[e]);gt.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),gt.push(t)},pluginEvent:function(t,e,n){var i=this;this.eventCanceled=!1,n.cancel=function(){i.eventCanceled=!0};var r=t+"Global";gt.forEach(function(a){!e[a.pluginName]||(e[a.pluginName][r]&&e[a.pluginName][r](Q({sortable:e},n)),e.options[a.pluginName]&&e[a.pluginName][t]&&e[a.pluginName][t](Q({sortable:e},n)))})},initializePlugins:function(t,e,n,i){gt.forEach(function(l){var s=l.pluginName;if(!(!t.options[s]&&!l.initializeByDefault)){var u=new l(t,e,t.options);u.sortable=t,u.options=t.options,t[s]=u,j(n,u.defaults)}});for(var r in t.options)if(!!t.options.hasOwnProperty(r)){var a=this.modifyOption(t,r,t.options[r]);typeof a!="undefined"&&(t.options[r]=a)}},getEventProperties:function(t,e){var n={};return gt.forEach(function(i){typeof i.eventProperties=="function"&&j(n,i.eventProperties.call(e[i.pluginName],t))}),n},modifyOption:function(t,e,n){var i;return gt.forEach(function(r){!t[r.pluginName]||r.optionListeners&&typeof r.optionListeners[e]=="function"&&(i=r.optionListeners[e].call(t[r.pluginName],n))}),i}};function It(o){var t=o.sortable,e=o.rootEl,n=o.name,i=o.targetEl,r=o.cloneEl,a=o.toEl,l=o.fromEl,s=o.oldIndex,u=o.newIndex,d=o.oldDraggableIndex,f=o.newDraggableIndex,p=o.originalEvent,E=o.putSortable,b=o.extraEventProperties;if(t=t||e&&e[R],!!t){var S,P=t.options,L="on"+n.charAt(0).toUpperCase()+n.substr(1);window.CustomEvent&&!nt&&!Ct?S=new CustomEvent(n,{bubbles:!0,cancelable:!0}):(S=document.createEvent("Event"),S.initEvent(n,!0,!0)),S.to=a||e,S.from=l||e,S.item=i||e,S.clone=r,S.oldIndex=s,S.newIndex=u,S.oldDraggableIndex=d,S.newDraggableIndex=f,S.originalEvent=p,S.pullMode=E?E.lastPutMode:void 0;var M=Q(Q({},b),At.getEventProperties(n,t));for(var Y in M)S[Y]=M[Y];e&&e.dispatchEvent(S),P[L]&&P[L].call(t,S)}}var fn=["evt"],B=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=n.evt,r=Ve(n,fn);At.pluginEvent.bind(g)(t,e,Q({dragEl:c,parentEl:N,ghostEl:v,rootEl:O,nextEl:ft,lastDownEl:Wt,cloneEl:A,cloneHidden:at,dragStarted:Pt,putSortable:F,activeSortable:g.active,originalEvent:i,oldIndex:mt,oldDraggableIndex:Nt,newIndex:W,newDraggableIndex:lt,hideGhostForTarget:Ge,unhideGhostForTarget:We,cloneNowHidden:function(){at=!0},cloneNowShown:function(){at=!1},dispatchSortableEvent:function(l){X({sortable:e,name:l,originalEvent:i})}},r))};function X(o){It(Q({putSortable:F,cloneEl:A,targetEl:c,rootEl:O,oldIndex:mt,oldDraggableIndex:Nt,newIndex:W,newDraggableIndex:lt},o))}var c,N,v,O,ft,Wt,A,at,mt,W,Nt,lt,Kt,F,vt=!1,Lt=!1,jt=[],dt,q,ue,ce,Re,ke,Pt,bt,xt,Mt=!1,zt=!1,Ut,k,fe=[],de=!1,qt=[],$t=typeof document!="undefined",Vt=Ce,Xe=Ct||nt?"cssFloat":"float",dn=$t&&!Oe&&!Ce&&"draggable"in document.createElement("div"),Ye=function(){if(!!$t){if(nt)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Be=function(t,e){var n=h(t),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=pt(t,0,e),a=pt(t,1,e),l=r&&h(r),s=a&&h(a),u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+C(r).width,d=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+C(a).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&l.float&&l.float!=="none"){var f=l.float==="left"?"left":"right";return a&&(s.clear==="both"||s.clear===f)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||u>=i&&n[Xe]==="none"||a&&n[Xe]==="none"&&u+d>i)?"vertical":"horizontal"},hn=function(t,e,n){var i=n?t.left:t.top,r=n?t.right:t.bottom,a=n?t.width:t.height,l=n?e.left:e.top,s=n?e.right:e.bottom,u=n?e.width:e.height;return i===l||r===s||i+a/2===l+u/2},pn=function(t,e){var n;return jt.some(function(i){var r=i[R].options.emptyInsertThreshold;if(!(!r||ie(i))){var a=C(i),l=t>=a.left-r&&t<=a.right+r,s=e>=a.top-r&&e<=a.bottom+r;if(l&&s)return n=i}}),n},He=function(t){function e(r,a){return function(l,s,u,d){var f=l.options.group.name&&s.options.group.name&&l.options.group.name===s.options.group.name;if(r==null&&(a||f))return!0;if(r==null||r===!1)return!1;if(a&&r==="clone")return r;if(typeof r=="function")return e(r(l,s,u,d),a)(l,s,u,d);var p=(a?l:s).options.group.name;return r===!0||typeof r=="string"&&r===p||r.join&&r.indexOf(p)>-1}}var n={},i=t.group;(!i||Ht(i)!="object")&&(i={name:i}),n.name=i.name,n.checkPull=e(i.pull,!0),n.checkPut=e(i.put),n.revertClone=i.revertClone,t.group=n},Ge=function(){!Ye&&v&&h(v,"display","none")},We=function(){!Ye&&v&&h(v,"display","")};$t&&!Oe&&document.addEventListener("click",function(o){if(Lt)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Lt=!1,!1},!0);var ht=function(t){if(c){t=t.touches?t.touches[0]:t;var e=pn(t.clientX,t.clientY);if(e){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[R]._onDragOver(n)}}},gn=function(t){c&&c.parentNode[R]._isOutsideThisEl(t.target)};function g(o,t){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=t=j({},t),o[R]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Be(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(a,l){a.setData("Text",l.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:g.supportPointer!==!1&&"PointerEvent"in window&&!Ot,emptyInsertThreshold:5};At.initializePlugins(this,o,e);for(var n in e)!(n in t)&&(t[n]=e[n]);He(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:dn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?y(o,"pointerdown",this._onTapStart):(y(o,"mousedown",this._onTapStart),y(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(y(o,"dragover",this),y(o,"dragenter",this)),jt.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),j(this,sn())}g.prototype={constructor:g,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(bt=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,c):this.options.direction},_onTapStart:function(t){if(!!t.cancelable){var e=this,n=this.el,i=this.options,r=i.preventOnFilter,a=t.type,l=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,s=(l||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,d=i.filter;if(Dn(n),!c&&!(/mousedown|pointerdown/.test(a)&&t.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&Ot&&s&&s.tagName.toUpperCase()==="SELECT")&&(s=U(s,i.draggable,n,!1),!(s&&s.animated)&&Wt!==s)){if(mt=I(s),Nt=I(s,i.draggable),typeof d=="function"){if(d.call(this,t,s,this)){X({sortable:e,rootEl:u,name:"filter",targetEl:s,toEl:n,fromEl:n}),B("filter",e,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(d&&(d=d.split(",").some(function(f){if(f=U(u,f.trim(),n,!1),f)return X({sortable:e,rootEl:f,name:"filter",targetEl:s,fromEl:n,toEl:n}),B("filter",e,{evt:t}),!0}),d)){r&&t.cancelable&&t.preventDefault();return}i.handle&&!U(u,i.handle,n,!1)||this._prepareDragStart(t,l,s)}}},_prepareDragStart:function(t,e,n){var i=this,r=i.el,a=i.options,l=r.ownerDocument,s;if(n&&!c&&n.parentNode===r){var u=C(n);if(O=r,c=n,N=c.parentNode,ft=c.nextSibling,Wt=n,Kt=a.group,g.dragged=c,dt={target:c,clientX:(e||t).clientX,clientY:(e||t).clientY},Re=dt.clientX-u.left,ke=dt.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,c.style["will-change"]="all",s=function(){if(B("delayEnded",i,{evt:t}),g.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!_e&&i.nativeDraggable&&(c.draggable=!0),i._triggerDragStart(t,e),X({sortable:i,name:"choose",originalEvent:t}),T(c,a.chosenClass,!0)},a.ignore.split(",").forEach(function(d){Ie(c,d.trim(),he)}),y(l,"dragover",ht),y(l,"mousemove",ht),y(l,"touchmove",ht),y(l,"mouseup",i._onDrop),y(l,"touchend",i._onDrop),y(l,"touchcancel",i._onDrop),_e&&this.nativeDraggable&&(this.options.touchStartThreshold=4,c.draggable=!0),B("delayStart",this,{evt:t}),a.delay&&(!a.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Ct||nt))){if(g.eventCanceled){this._onDrop();return}y(l,"mouseup",i._disableDelayedDrag),y(l,"touchend",i._disableDelayedDrag),y(l,"touchcancel",i._disableDelayedDrag),y(l,"mousemove",i._delayedDragTouchMoveHandler),y(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&y(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(s,a.delay)}else s()}},_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(){c&&he(c),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;w(t,"mouseup",this._disableDelayedDrag),w(t,"touchend",this._disableDelayedDrag),w(t,"touchcancel",this._disableDelayedDrag),w(t,"mousemove",this._delayedDragTouchMoveHandler),w(t,"touchmove",this._delayedDragTouchMoveHandler),w(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?y(document,"pointermove",this._onTouchMove):e?y(document,"touchmove",this._onTouchMove):y(document,"mousemove",this._onTouchMove):(y(c,"dragend",this),y(O,"dragstart",this._onDragStart));try{document.selection?Qt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(vt=!1,O&&c){B("dragStarted",this,{evt:e}),this.nativeDraggable&&y(document,"dragover",gn);var n=this.options;!t&&T(c,n.dragClass,!1),T(c,n.ghostClass,!0),g.active=this,t&&this._appendGhost(),X({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(q){this._lastX=q.clientX,this._lastY=q.clientY,Ge();for(var t=document.elementFromPoint(q.clientX,q.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(q.clientX,q.clientY),t!==e);)e=t;if(c.parentNode[R]._isOutsideThisEl(t),e)do{if(e[R]){var n=void 0;if(n=e[R]._onDragOver({clientX:q.clientX,clientY:q.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);We()}},_onTouchMove:function(t){if(dt){var e=this.options,n=e.fallbackTolerance,i=e.fallbackOffset,r=t.touches?t.touches[0]:t,a=v&&ct(v,!0),l=v&&a&&a.a,s=v&&a&&a.d,u=Vt&&k&&Pe(k),d=(r.clientX-dt.clientX+i.x)/(l||1)+(u?u[0]-fe[0]:0)/(l||1),f=(r.clientY-dt.clientY+i.y)/(s||1)+(u?u[1]-fe[1]:0)/(s||1);if(!g.active&&!vt){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(v){a?(a.e+=d-(ue||0),a.f+=f-(ce||0)):a={a:1,b:0,c:0,d:1,e:d,f};var p="matrix(".concat(a.a,",").concat(a.b,",").concat(a.c,",").concat(a.d,",").concat(a.e,",").concat(a.f,")");h(v,"webkitTransform",p),h(v,"mozTransform",p),h(v,"msTransform",p),h(v,"transform",p),ue=d,ce=f,q=r}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!v){var t=this.options.fallbackOnBody?document.body:O,e=C(c,!0,Vt,!0,t),n=this.options;if(Vt){for(k=t;h(k,"position")==="static"&&h(k,"transform")==="none"&&k!==document;)k=k.parentNode;k!==document.body&&k!==document.documentElement?(k===document&&(k=J()),e.top+=k.scrollTop,e.left+=k.scrollLeft):k=J(),fe=Pe(k)}v=c.cloneNode(!0),T(v,n.ghostClass,!1),T(v,n.fallbackClass,!0),T(v,n.dragClass,!0),h(v,"transition",""),h(v,"transform",""),h(v,"box-sizing","border-box"),h(v,"margin",0),h(v,"top",e.top),h(v,"left",e.left),h(v,"width",e.width),h(v,"height",e.height),h(v,"opacity","0.8"),h(v,"position",Vt?"absolute":"fixed"),h(v,"zIndex","100000"),h(v,"pointerEvents","none"),g.ghost=v,t.appendChild(v),h(v,"transform-origin",Re/parseInt(v.style.width)*100+"% "+ke/parseInt(v.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,i=t.dataTransfer,r=n.options;if(B("dragStart",this,{evt:t}),g.eventCanceled){this._onDrop();return}B("setupClone",this),g.eventCanceled||(A=ae(c),A.removeAttribute("id"),A.draggable=!1,A.style["will-change"]="",this._hideClone(),T(A,this.options.chosenClass,!1),g.clone=A),n.cloneId=Qt(function(){B("clone",n),!g.eventCanceled&&(n.options.removeCloneOnHide||O.insertBefore(A,c),n._hideClone(),X({sortable:n,name:"clone"}))}),!e&&T(c,r.dragClass,!0),e?(Lt=!0,n._loopId=setInterval(n._emulateDragOver,50)):(w(document,"mouseup",n._onDrop),w(document,"touchend",n._onDrop),w(document,"touchcancel",n._onDrop),i&&(i.effectAllowed="move",r.setData&&r.setData.call(n,i,c)),y(document,"drop",n),h(c,"transform","translateZ(0)")),vt=!0,n._dragStartId=Qt(n._dragStarted.bind(n,e,t)),y(document,"selectstart",n),Pt=!0,Ot&&h(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,n=t.target,i,r,a,l=this.options,s=l.group,u=g.active,d=Kt===s,f=l.sort,p=F||u,E,b=this,S=!1;if(de)return;function P(_t,ze){B(_t,b,Q({evt:t,isOwner:d,axis:E?"vertical":"horizontal",revert:a,dragRect:i,targetRect:r,canSort:f,fromSortable:p,target:n,completed:M,onMove:function(Se,Ue){return Zt(O,e,c,i,Se,C(Se),t,Ue)},changed:Y},ze))}function L(){P("dragOverAnimationCapture"),b.captureAnimationState(),b!==p&&p.captureAnimationState()}function M(_t){return P("dragOverCompleted",{insertion:_t}),_t&&(d?u._hideClone():u._showClone(b),b!==p&&(T(c,F?F.options.ghostClass:u.options.ghostClass,!1),T(c,l.ghostClass,!0)),F!==b&&b!==g.active?F=b:b===g.active&&F&&(F=null),p===b&&(b._ignoreWhileAnimating=n),b.animateAll(function(){P("dragOverAnimationComplete"),b._ignoreWhileAnimating=null}),b!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(n===c&&!c.animated||n===e&&!n.animated)&&(bt=null),!l.dragoverBubble&&!t.rootEl&&n!==document&&(c.parentNode[R]._isOutsideThisEl(t.target),!_t&&ht(t)),!l.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),S=!0}function Y(){W=I(c),lt=I(c,l.draggable),X({sortable:b,name:"change",toEl:e,newIndex:W,newDraggableIndex:lt,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=U(n,l.draggable,e,!0),P("dragOver"),g.eventCanceled)return S;if(c.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||b._ignoreWhileAnimating===n)return M(!1);if(Lt=!1,u&&!l.disabled&&(d?f||(a=N!==O):F===this||(this.lastPutMode=Kt.checkPull(this,u,c,t))&&s.checkPut(this,u,c,t))){if(E=this._getDirection(t,n)==="vertical",i=C(c),P("dragOverValid"),g.eventCanceled)return S;if(a)return N=O,L(),this._hideClone(),P("revert"),g.eventCanceled||(ft?O.insertBefore(c,ft):O.appendChild(c)),M(!0);var D=ie(e,l.draggable);if(!D||wn(t,E,this)&&!D.animated){if(D===c)return M(!1);if(D&&e===t.target&&(n=D),n&&(r=C(n)),Zt(O,e,c,i,n,r,t,!!n)!==!1)return L(),D&&D.nextSibling?e.insertBefore(c,D.nextSibling):e.appendChild(c),N=e,Y(),M(!0)}else if(D&&bn(t,E,this)){var V=pt(e,0,l,!0);if(V===c)return M(!1);if(n=V,r=C(n),Zt(O,e,c,i,n,r,t,!1)!==!1)return L(),e.insertBefore(c,V),N=e,Y(),M(!0)}else if(n.parentNode===e){r=C(n);var Z=0,st,yt=c.parentNode!==e,G=!hn(c.animated&&c.toRect||i,n.animated&&n.toRect||r,E),Et=E?"top":"left",ot=Ne(n,"top","top")||Ne(c,"top","top"),St=ot?ot.scrollTop:void 0;bt!==n&&(st=r[Et],Mt=!1,zt=!G&&l.invertSwap||yt),Z=yn(t,n,r,E,G?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,zt,bt===n);var tt;if(Z!==0){var ut=I(c);do ut-=Z,tt=N.children[ut];while(tt&&(h(tt,"display")==="none"||tt===v))}if(Z===0||tt===n)return M(!1);bt=n,xt=Z;var Dt=n.nextElementSibling,it=!1;it=Z===1;var Bt=Zt(O,e,c,i,n,r,t,it);if(Bt!==!1)return(Bt===1||Bt===-1)&&(it=Bt===1),de=!0,setTimeout(vn,30),L(),it&&!Dt?e.appendChild(c):n.parentNode.insertBefore(c,it?Dt:n),ot&&Me(ot,0,St-ot.scrollTop),N=c.parentNode,st!==void 0&&!zt&&(Ut=Math.abs(st-C(n)[Et])),Y(),M(!0)}if(e.contains(c))return M(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){w(document,"mousemove",this._onTouchMove),w(document,"touchmove",this._onTouchMove),w(document,"pointermove",this._onTouchMove),w(document,"dragover",ht),w(document,"mousemove",ht),w(document,"touchmove",ht)},_offUpEvents:function(){var t=this.el.ownerDocument;w(t,"mouseup",this._onDrop),w(t,"touchend",this._onDrop),w(t,"pointerup",this._onDrop),w(t,"touchcancel",this._onDrop),w(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(W=I(c),lt=I(c,n.draggable),B("drop",this,{evt:t}),N=c&&c.parentNode,W=I(c),lt=I(c,n.draggable),g.eventCanceled){this._nulling();return}vt=!1,zt=!1,Mt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),pe(this.cloneId),pe(this._dragStartId),this.nativeDraggable&&(w(document,"drop",this),w(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ot&&h(document.body,"user-select",""),h(c,"transform",""),t&&(Pt&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),v&&v.parentNode&&v.parentNode.removeChild(v),(O===N||F&&F.lastPutMode!=="clone")&&A&&A.parentNode&&A.parentNode.removeChild(A),c&&(this.nativeDraggable&&w(c,"dragend",this),he(c),c.style["will-change"]="",Pt&&!vt&&T(c,F?F.options.ghostClass:this.options.ghostClass,!1),T(c,this.options.chosenClass,!1),X({sortable:this,name:"unchoose",toEl:N,newIndex:null,newDraggableIndex:null,originalEvent:t}),O!==N?(W>=0&&(X({rootEl:N,name:"add",toEl:N,fromEl:O,originalEvent:t}),X({sortable:this,name:"remove",toEl:N,originalEvent:t}),X({rootEl:N,name:"sort",toEl:N,fromEl:O,originalEvent:t}),X({sortable:this,name:"sort",toEl:N,originalEvent:t})),F&&F.save()):W!==mt&&W>=0&&(X({sortable:this,name:"update",toEl:N,originalEvent:t}),X({sortable:this,name:"sort",toEl:N,originalEvent:t})),g.active&&((W==null||W===-1)&&(W=mt,lt=Nt),X({sortable:this,name:"end",toEl:N,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){B("nulling",this),O=c=N=v=ft=A=Wt=at=dt=q=Pt=W=lt=mt=Nt=bt=xt=F=Kt=g.dragged=g.ghost=g.clone=g.active=null,qt.forEach(function(t){t.checked=!0}),qt.length=ue=ce=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":c&&(this._onDragOver(t),mn(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,i=0,r=n.length,a=this.options;i<r;i++)e=n[i],U(e,a.draggable,this.el,!1)&&t.push(e.getAttribute(a.dataIdAttr)||Sn(e));return t},sort:function(t,e){var n={},i=this.el;this.toArray().forEach(function(r,a){var l=i.children[a];U(l,this.options.draggable,i,!1)&&(n[r]=l)},this),e&&this.captureAnimationState(),t.forEach(function(r){n[r]&&(i.removeChild(n[r]),i.appendChild(n[r]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return U(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(e===void 0)return n[t];var i=At.modifyOption(this,t,e);typeof i!="undefined"?n[t]=i:n[t]=e,t==="group"&&He(n)},destroy:function(){B("destroy",this);var t=this.el;t[R]=null,w(t,"mousedown",this._onTapStart),w(t,"touchstart",this._onTapStart),w(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(w(t,"dragover",this),w(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),jt.splice(jt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!at){if(B("hideClone",this),g.eventCanceled)return;h(A,"display","none"),this.options.removeCloneOnHide&&A.parentNode&&A.parentNode.removeChild(A),at=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(at){if(B("showClone",this),g.eventCanceled)return;c.parentNode==O&&!this.options.group.revertClone?O.insertBefore(A,c):ft?O.insertBefore(A,ft):O.appendChild(A),this.options.group.revertClone&&this.animate(c,A),h(A,"display",""),at=!1}}};function mn(o){o.dataTransfer&&(o.dataTransfer.dropEffect="move"),o.cancelable&&o.preventDefault()}function Zt(o,t,e,n,i,r,a,l){var s,u=o[R],d=u.options.onMove,f;return window.CustomEvent&&!nt&&!Ct?s=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(s=document.createEvent("Event"),s.initEvent("move",!0,!0)),s.to=t,s.from=o,s.dragged=e,s.draggedRect=n,s.related=i||t,s.relatedRect=r||C(t),s.willInsertAfter=l,s.originalEvent=a,o.dispatchEvent(s),d&&(f=d.call(u,s,a)),f}function he(o){o.draggable=!1}function vn(){de=!1}function bn(o,t,e){var n=C(pt(e.el,0,e.options,!0)),i=10;return t?o.clientX<n.left-i||o.clientY<n.top&&o.clientX<n.right:o.clientY<n.top-i||o.clientY<n.bottom&&o.clientX<n.left}function wn(o,t,e){var n=C(ie(e.el,e.options.draggable)),i=10;return t?o.clientX>n.right+i||o.clientX<=n.right&&o.clientY>n.bottom&&o.clientX>=n.left:o.clientX>n.right&&o.clientY>n.top||o.clientX<=n.right&&o.clientY>n.bottom+i}function yn(o,t,e,n,i,r,a,l){var s=n?o.clientY:o.clientX,u=n?e.height:e.width,d=n?e.top:e.left,f=n?e.bottom:e.right,p=!1;if(!a){if(l&&Ut<u*i){if(!Mt&&(xt===1?s>d+u*r/2:s<f-u*r/2)&&(Mt=!0),Mt)p=!0;else if(xt===1?s<d+Ut:s>f-Ut)return-xt}else if(s>d+u*(1-i)/2&&s<f-u*(1-i)/2)return En(t)}return p=p||a,p&&(s<d+u*r/2||s>f-u*r/2)?s>d+u/2?1:-1:0}function En(o){return I(c)<I(o)?1:-1}function Sn(o){for(var t=o.tagName+o.className+o.src+o.href+o.textContent,e=t.length,n=0;e--;)n+=t.charCodeAt(e);return n.toString(36)}function Dn(o){qt.length=0;for(var t=o.getElementsByTagName("input"),e=t.length;e--;){var n=t[e];n.checked&&qt.push(n)}}function Qt(o){return setTimeout(o,0)}function pe(o){return clearTimeout(o)}$t&&y(document,"touchmove",function(o){(g.active||vt)&&o.cancelable&&o.preventDefault()});g.utils={on:y,off:w,css:h,find:Ie,is:function(t,e){return!!U(t,e,t,!1)},extend:an,throttle:xe,closest:U,toggleClass:T,clone:ae,index:I,nextTick:Qt,cancelNextTick:pe,detectDirection:Be,getChild:pt};g.get=function(o){return o[R]};g.mount=function(){for(var o=arguments.length,t=new Array(o),e=0;e<o;e++)t[e]=arguments[e];t[0].constructor===Array&&(t=t[0]),t.forEach(function(n){if(!n.prototype||!n.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(n));n.utils&&(g.utils=Q(Q({},g.utils),n.utils)),At.mount(n)})};g.create=function(o,t){return new g(o,t)};g.version=nn;var x=[],Ft,ge,me=!1,ve,be,Jt,Rt;function _n(){function o(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return o.prototype={dragStarted:function(e){var n=e.originalEvent;this.sortable.nativeDraggable?y(document,"dragover",this._handleAutoScroll):this.options.supportPointer?y(document,"pointermove",this._handleFallbackAutoScroll):n.touches?y(document,"touchmove",this._handleFallbackAutoScroll):y(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var n=e.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?w(document,"dragover",this._handleAutoScroll):(w(document,"pointermove",this._handleFallbackAutoScroll),w(document,"touchmove",this._handleFallbackAutoScroll),w(document,"mousemove",this._handleFallbackAutoScroll)),Ke(),te(),ln()},nulling:function(){Jt=ge=Ft=me=Rt=ve=be=null,x.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,n){var i=this,r=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,l=document.elementFromPoint(r,a);if(Jt=e,n||this.options.forceAutoScrollFallback||Ct||nt||Ot){we(e,this.options,l,n);var s=rt(l,!0);me&&(!Rt||r!==ve||a!==be)&&(Rt&&Ke(),Rt=setInterval(function(){var u=rt(document.elementFromPoint(r,a),!0);u!==s&&(s=u,te()),we(e,i.options,u,n)},10),ve=r,be=a)}else{if(!this.options.bubbleScroll||rt(l,!0)===J()){te();return}we(e,this.options,rt(l,!1),!1)}}},j(o,{pluginName:"scroll",initializeByDefault:!0})}function te(){x.forEach(function(o){clearInterval(o.pid)}),x=[]}function Ke(){clearInterval(Rt)}var we=xe(function(o,t,e,n){if(!!t.scroll){var i=(o.touches?o.touches[0]:o).clientX,r=(o.touches?o.touches[0]:o).clientY,a=t.scrollSensitivity,l=t.scrollSpeed,s=J(),u=!1,d;ge!==e&&(ge=e,te(),Ft=t.scroll,d=t.scrollFn,Ft===!0&&(Ft=rt(e,!0)));var f=0,p=Ft;do{var E=p,b=C(E),S=b.top,P=b.bottom,L=b.left,M=b.right,Y=b.width,D=b.height,V=void 0,Z=void 0,st=E.scrollWidth,yt=E.scrollHeight,G=h(E),Et=E.scrollLeft,ot=E.scrollTop;E===s?(V=Y<st&&(G.overflowX==="auto"||G.overflowX==="scroll"||G.overflowX==="visible"),Z=D<yt&&(G.overflowY==="auto"||G.overflowY==="scroll"||G.overflowY==="visible")):(V=Y<st&&(G.overflowX==="auto"||G.overflowX==="scroll"),Z=D<yt&&(G.overflowY==="auto"||G.overflowY==="scroll"));var St=V&&(Math.abs(M-i)<=a&&Et+Y<st)-(Math.abs(L-i)<=a&&!!Et),tt=Z&&(Math.abs(P-r)<=a&&ot+D<yt)-(Math.abs(S-r)<=a&&!!ot);if(!x[f])for(var ut=0;ut<=f;ut++)x[ut]||(x[ut]={});(x[f].vx!=St||x[f].vy!=tt||x[f].el!==E)&&(x[f].el=E,x[f].vx=St,x[f].vy=tt,clearInterval(x[f].pid),(St!=0||tt!=0)&&(u=!0,x[f].pid=setInterval(function(){n&&this.layer===0&&g.active._onTouchMove(Jt);var Dt=x[this.layer].vy?x[this.layer].vy*l:0,it=x[this.layer].vx?x[this.layer].vx*l:0;typeof d=="function"&&d.call(g.dragged.parentNode[R],it,Dt,o,Jt,x[this.layer].el)!=="continue"||Me(x[this.layer].el,it,Dt)}.bind({layer:f}),24))),f++}while(t.bubbleScroll&&p!==s&&(p=rt(p,!1)));me=u}},30),Le=function(t){var e=t.originalEvent,n=t.putSortable,i=t.dragEl,r=t.activeSortable,a=t.dispatchSortableEvent,l=t.hideGhostForTarget,s=t.unhideGhostForTarget;if(!!e){var u=n||r;l();var d=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,f=document.elementFromPoint(d.clientX,d.clientY);s(),u&&!u.el.contains(f)&&(a("spill"),this.onSpill({dragEl:i,putSortable:n}))}};function ye(){}ye.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var i=pt(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(e,i):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Le};j(ye,{pluginName:"revertOnSpill"});function Ee(){}Ee.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable,i=n||this.sortable;i.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),i.animateAll()},drop:Le};j(Ee,{pluginName:"removeOnSpill"});var z;function An(){function o(){this.defaults={swapClass:"sortable-swap-highlight"}}return o.prototype={dragStart:function(e){var n=e.dragEl;z=n},dragOverValid:function(e){var n=e.completed,i=e.target,r=e.onMove,a=e.activeSortable,l=e.changed,s=e.cancel;if(!!a.options.swap){var u=this.sortable.el,d=this.options;if(i&&i!==u){var f=z;r(i)!==!1?(T(i,d.swapClass,!0),z=i):z=null,f&&f!==z&&T(f,d.swapClass,!1)}l(),n(!0),s()}},drop:function(e){var n=e.activeSortable,i=e.putSortable,r=e.dragEl,a=i||this.sortable,l=this.options;z&&T(z,l.swapClass,!1),z&&(l.swap||i&&i.options.swap)&&r!==z&&(a.captureAnimationState(),a!==n&&n.captureAnimationState(),Cn(r,z),a.animateAll(),a!==n&&n.animateAll())},nulling:function(){z=null}},j(o,{pluginName:"swap",eventProperties:function(){return{swapItem:z}}})}function Cn(o,t){var e=o.parentNode,n=t.parentNode,i,r;!e||!n||e.isEqualNode(t)||n.isEqualNode(o)||(i=I(o),r=I(t),e.isEqualNode(n)&&i<r&&r++,e.insertBefore(t,e.children[i]),n.insertBefore(o,n.children[r]))}var m=[],K=[],kt,$,Xt=!1,H=!1,wt=!1,_,Yt,ee;function In(){function o(t){for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this));t.options.avoidImplicitDeselect||(t.options.supportPointer?y(document,"pointerup",this._deselectMultiDrag):(y(document,"mouseup",this._deselectMultiDrag),y(document,"touchend",this._deselectMultiDrag))),y(document,"keydown",this._checkKeyDown),y(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:!1,setData:function(i,r){var a="";m.length&&$===t?m.forEach(function(l,s){a+=(s?", ":"")+l.textContent}):a=r.textContent,i.setData("Text",a)}}}return o.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal:function(e){var n=e.dragEl;_=n},delayEnded:function(){this.isMultiDrag=~m.indexOf(_)},setupClone:function(e){var n=e.sortable,i=e.cancel;if(!!this.isMultiDrag){for(var r=0;r<m.length;r++)K.push(ae(m[r])),K[r].sortableIndex=m[r].sortableIndex,K[r].draggable=!1,K[r].style["will-change"]="",T(K[r],this.options.selectedClass,!1),m[r]===_&&T(K[r],this.options.chosenClass,!1);n._hideClone(),i()}},clone:function(e){var n=e.sortable,i=e.rootEl,r=e.dispatchSortableEvent,a=e.cancel;!this.isMultiDrag||this.options.removeCloneOnHide||m.length&&$===n&&(je(!0,i),r("clone"),a())},showClone:function(e){var n=e.cloneNowShown,i=e.rootEl,r=e.cancel;!this.isMultiDrag||(je(!1,i),K.forEach(function(a){h(a,"display","")}),n(),ee=!1,r())},hideClone:function(e){var n=this;e.sortable;var i=e.cloneNowHidden,r=e.cancel;!this.isMultiDrag||(K.forEach(function(a){h(a,"display","none"),n.options.removeCloneOnHide&&a.parentNode&&a.parentNode.removeChild(a)}),i(),ee=!0,r())},dragStartGlobal:function(e){e.sortable,!this.isMultiDrag&&$&&$.multiDrag._deselectMultiDrag(),m.forEach(function(n){n.sortableIndex=I(n)}),m=m.sort(function(n,i){return n.sortableIndex-i.sortableIndex}),wt=!0},dragStarted:function(e){var n=this,i=e.sortable;if(!!this.isMultiDrag){if(this.options.sort&&(i.captureAnimationState(),this.options.animation)){m.forEach(function(a){a!==_&&h(a,"position","absolute")});var r=C(_,!1,!0,!0);m.forEach(function(a){a!==_&&Fe(a,r)}),H=!0,Xt=!0}i.animateAll(function(){H=!1,Xt=!1,n.options.animation&&m.forEach(function(a){le(a)}),n.options.sort&&ne()})}},dragOver:function(e){var n=e.target,i=e.completed,r=e.cancel;H&&~m.indexOf(n)&&(i(!1),r())},revert:function(e){var n=e.fromSortable,i=e.rootEl,r=e.sortable,a=e.dragRect;m.length>1&&(m.forEach(function(l){r.addAnimationState({target:l,rect:H?C(l):a}),le(l),l.fromRect=a,n.removeAnimationState(l)}),H=!1,On(!this.options.removeCloneOnHide,i))},dragOverCompleted:function(e){var n=e.sortable,i=e.isOwner,r=e.insertion,a=e.activeSortable,l=e.parentEl,s=e.putSortable,u=this.options;if(r){if(i&&a._hideClone(),Xt=!1,u.animation&&m.length>1&&(H||!i&&!a.options.sort&&!s)){var d=C(_,!1,!0,!0);m.forEach(function(p){p!==_&&(Fe(p,d),l.appendChild(p))}),H=!0}if(!i)if(H||ne(),m.length>1){var f=ee;a._showClone(n),a.options.animation&&!ee&&f&&K.forEach(function(p){a.addAnimationState({target:p,rect:Yt}),p.fromRect=Yt,p.thisAnimationDuration=null})}else a._showClone(n)}},dragOverAnimationCapture:function(e){var n=e.dragRect,i=e.isOwner,r=e.activeSortable;if(m.forEach(function(l){l.thisAnimationDuration=null}),r.options.animation&&!i&&r.multiDrag.isMultiDrag){Yt=j({},n);var a=ct(_,!0);Yt.top-=a.f,Yt.left-=a.e}},dragOverAnimationComplete:function(){H&&(H=!1,ne())},drop:function(e){var n=e.originalEvent,i=e.rootEl,r=e.parentEl,a=e.sortable,l=e.dispatchSortableEvent,s=e.oldIndex,u=e.putSortable,d=u||this.sortable;if(!!n){var f=this.options,p=r.children;if(!wt)if(f.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),T(_,f.selectedClass,!~m.indexOf(_)),~m.indexOf(_))m.splice(m.indexOf(_),1),kt=null,It({sortable:a,rootEl:i,name:"deselect",targetEl:_,originalEvent:n});else{if(m.push(_),It({sortable:a,rootEl:i,name:"select",targetEl:_,originalEvent:n}),n.shiftKey&&kt&&a.el.contains(kt)){var E=I(kt),b=I(_);if(~E&&~b&&E!==b){var S,P;for(b>E?(P=E,S=b):(P=b,S=E+1);P<S;P++)~m.indexOf(p[P])||(T(p[P],f.selectedClass,!0),m.push(p[P]),It({sortable:a,rootEl:i,name:"select",targetEl:p[P],originalEvent:n}))}}else kt=_;$=d}if(wt&&this.isMultiDrag){if(H=!1,(r[R].options.sort||r!==i)&&m.length>1){var L=C(_),M=I(_,":not(."+this.options.selectedClass+")");if(!Xt&&f.animation&&(_.thisAnimationDuration=null),d.captureAnimationState(),!Xt&&(f.animation&&(_.fromRect=L,m.forEach(function(D){if(D.thisAnimationDuration=null,D!==_){var V=H?C(D):L;D.fromRect=V,d.addAnimationState({target:D,rect:V})}})),ne(),m.forEach(function(D){p[M]?r.insertBefore(D,p[M]):r.appendChild(D),M++}),s===I(_))){var Y=!1;m.forEach(function(D){if(D.sortableIndex!==I(D)){Y=!0;return}}),Y&&l("update")}m.forEach(function(D){le(D)}),d.animateAll()}$=d}(i===r||u&&u.lastPutMode!=="clone")&&K.forEach(function(D){D.parentNode&&D.parentNode.removeChild(D)})}},nullingGlobal:function(){this.isMultiDrag=wt=!1,K.length=0},destroyGlobal:function(){this._deselectMultiDrag(),w(document,"pointerup",this._deselectMultiDrag),w(document,"mouseup",this._deselectMultiDrag),w(document,"touchend",this._deselectMultiDrag),w(document,"keydown",this._checkKeyDown),w(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(typeof wt!="undefined"&&wt)&&$===this.sortable&&!(e&&U(e.target,this.options.draggable,this.sortable.el,!1))&&!(e&&e.button!==0))for(;m.length;){var n=m[0];T(n,this.options.selectedClass,!1),m.shift(),It({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:n,originalEvent:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},j(o,{pluginName:"multiDrag",utils:{select:function(e){var n=e.parentNode[R];!n||!n.options.multiDrag||~m.indexOf(e)||($&&$!==n&&($.multiDrag._deselectMultiDrag(),$=n),T(e,n.options.selectedClass,!0),m.push(e))},deselect:function(e){var n=e.parentNode[R],i=m.indexOf(e);!n||!n.options.multiDrag||!~i||(T(e,n.options.selectedClass,!1),m.splice(i,1))}},eventProperties:function(){var e=this,n=[],i=[];return m.forEach(function(r){n.push({multiDragElement:r,index:r.sortableIndex});var a;H&&r!==_?a=-1:H?a=I(r,":not(."+e.options.selectedClass+")"):a=I(r),i.push({multiDragElement:r,index:a})}),{items:Ze(m),clones:[].concat(K),oldIndicies:n,newIndicies:i}},optionListeners:{multiDragKey:function(e){return e=e.toLowerCase(),e==="ctrl"?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}function On(o,t){m.forEach(function(e,n){var i=t.children[e.sortableIndex+(o?Number(n):0)];i?t.insertBefore(e,i):t.appendChild(e)})}function je(o,t){K.forEach(function(e,n){var i=t.children[e.sortableIndex+(o?Number(n):0)];i?t.insertBefore(e,i):t.appendChild(e)})}function ne(){m.forEach(function(o){o!==_&&o.parentNode&&o.parentNode.removeChild(o)})}g.mount(new _n);g.mount(Ee,ye);export{In as MultiDrag,g as Sortable,An as Swap,g as default};