UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

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