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