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