sortable.esm-e1a7db5e.js 44 KB

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