dragselect
Advanced tools
Comparing version 2.6.1 to 2.7.0
@@ -0,1 +1,7 @@ | ||
# 2.7.0 | ||
- Introduce blog-drag as alpha. It is supposed to fix dragging of multiple elements: dragging them as one block keeping aspect ratio positions on drag-scroll. Instead of moving elements individually. This was considered a bug. However as it is not fully tested it comes under a flag, please turn it on by setting `dragAsBlock: true` and [report any issue you find here](https://github.com/ThibaultJanBeyer/DragSelect/issues). Thanks to [@rendertom](https://github.com/rendertom) for the addition [#162](https://github.com/ThibaultJanBeyer/DragSelect/pull/162). | ||
*Note: this feature will be turned on by default in a future release once proper testing and all bugs are fixed* | ||
# 2.6.1 | ||
@@ -2,0 +8,0 @@ |
@@ -16,2 +16,3 @@ | ||
- Check if the `changelog` reflects the latest version | ||
- `cd DragSelect/` if not already | ||
@@ -18,0 +19,0 @@ ``` |
@@ -1,1 +0,1 @@ | ||
function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,D(r.key),r)}}function s(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function S(e){var t=c();return function(){var n,r=a(e);if(t){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return p(this,n)}}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=f(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}},g.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var _=function(e,t,n){var r=e.x,s=e.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[t]},I=function(e){return{x:e.left,y:e.top}},w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},L=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);e.forEach((function(e,t){r.observe(e,{childList:0!==t,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(e,t){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,e.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,t)}},C=function(){var e,t,n,r;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},E=function(e){return function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=t[r])||void 0===n?void 0:n.parentNode;return s?(t.push(s),e(t,++r)):t}([e])},A=function(e){return!e||e instanceof Document?C():{x:e.scrollLeft>=0?e.scrollLeft:C().x,y:e.scrollTop>=0?e.scrollTop:C().y}},T=function(e){var t=e.elementRect,n=e.containerRect,r=e.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return t.top-s.y<n.top&&i.push("top"),t.left-s.x<n.left&&i.push("left"),t.bottom+s.y>n.bottom&&i.push("bottom"),t.right+s.y>n.right&&i.push("right"),i},x=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},k=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return x(e);var n={x:0,y:0},r=t.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:x(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(e);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(e)},M=function(e){var t=e.computedStyle,n=e.node,r=t.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},N=function(e,t,n,r){if(void 0===t)return n?i({},e,r):{};if(null===t)return i({},e,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof t||t instanceof String),a&&!s&&(o=!0,V(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(t)&&"number"==typeof t),l&&!s&&(o=!0,V(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(t)),c&&!s&&(o=!0,V(e,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof t),u&&!s&&(o=!0,V(e,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(t)),d&&!s&&(o=!0,V(e,"array"));var h=o||n;return"dragKeys"===e&&s?i({},e,Object.assign(r,t)):"dragKeys"!==e||s?("dropZones"===e&&s&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},e,t):h?i({},e,r):{}):h?i({},e,r):{}},O=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e;if(n>0){var s=(e.right-e.left)*n,i=(e.bottom-e.top)*n;r={left:e.left+s,right:e.right-s,top:e.top+i,bottom:e.bottom-i}}return r.left<t.right&&r.right>t.left&&r.top<t.bottom&&r.bottom>t.top},K=function(e){var t=e.element,n=e.posDirection,r=e.containerRect,s=e.useTransform,i=k(t,s),o=_(i,"+",n);R(t,o,s);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,r=e.elementRect,s=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&R(t,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&R(t,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&R(t,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&R(t,{y:i.y,x:i.x+s.right-r.right},o)}({element:t,edges:T({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},R=function(e,t,n){if(n){var r=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:b(new Set(b(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(e){r.reset(),r._node=e,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=e instanceof Document?r||document.body:e,i=t.includes("top")&&s.scrollTop>0,o=t.includes("bottom")&&s.scrollTop<s.scrollHeight,a=t.includes("left")&&s.scrollLeft>0,l=t.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(e,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.HTMLNode)}}]),e}(),B=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,r=e.zoom,s=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return K({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),i(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return K({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?_(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?_(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var r=this,s=t.DS,o=t.id,a=t.element,l=t.droppables;n(this,e),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element&&(r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass))})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return O(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),W=s((function e(r){var s=this,o=r.DS;n(this,e),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(e){var n=e.dropZones;n&&(s._zones&&s._zones.forEach((function(e){return e.destroy()})),s._zones=n.map((function(e){return new F(t({DS:s.DS},e))})),s._zones.forEach((function(e){s._zoneByElement.set(e.element,e),s._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=s._zonesByDroppable.get(t);if(null==n||!n.length)return s._zonesByDroppable.set(t,[e]);s._zonesByDroppable.set(t,b(new Set([].concat(b(n),[e]))))}))})))})),i(this,"_handleDrop",(function(e){s._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,r=t.y,i=0,o=e.length;i<o;i++){var a=s._zoneByElement.get(e[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(e){if(e.isDragging){var t=s.getTarget();s._handleDrop(t)}})),i(this,"getItemsDroppedById",(function(e){var t=s._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),i(this,"getItemsInsideById",(function(e,t){var n=s._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var r=n.itemsInside;return t&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(e){var t;if(null!==(t=s._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==e?void 0:e.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return s.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),U=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),i(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),i(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(e.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(e.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),e.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),i(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.stop(t["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return s(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),X=s((function e(t){var r=this,s=t.DS;n(this,e),i(this,"subscribers",{}),i(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),i(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),i(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),i(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),i(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),i(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=s})),Y=function(e){o(r,d(Set));var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return Z(s.Settings.selectables).forEach((function(e){return s.add(e)}))})),i(h(s),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"_onClick",(function(e){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),i(h(s),"_onPointer",(function(e){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;s.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),g(a(r.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),g(a(r.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(),q=function(e){o(r,d(Set));var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),g(a(r.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=g(a(r.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(),G=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),i(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,p=new Map,S=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s:s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(S.s();!(n=S.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):p.set(g,b))}}catch(e){S.e(e)}finally{S.f()}if(!r.DS.continue){var m=r.filterSelected({select:h,unselect:p,selectorRect:d}),D=m.select,_=m.unselect;D.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.multiSelectionToggle,s=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(s.has(t)?r&&s.delete(t):s.add(t),t.classList.add(i))}({element:n,force:e,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.SelectedSet,s=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=r.has(t),a=s.has(t);o&&!a?r.delete(t):!o&&a&&r.add(t),t.classList.remove(i)}({element:n,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(e){var t=e.select,n=e.unselect;return e.selectorRect,{select:t,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(e,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,r=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),e}(),$=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,w(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,r=e.pointerPos,s={};return r.x>n.x-t.x?(s.left=n.x-t.x,s.width=r.x-n.x+t.x):(s.left=r.x,s.width=n.x-r.x-t.x),r.y>n.y-t.y?(s.top=n.y-t.y,s.height=r.y-n.y+t.y):(s.top=r.y,s.height=n.y-r.y-t.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),J=function(){function e(t){var r,s=this,o=t.DS;n(this,e),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[t][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var e=s.DS.Area.rect,t=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(e.top+t.top,"px"),i="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(e){s.stopAutoScroll(),e&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var e=s.DS,t=e.stores.PointerStore,n=e.Area;s.currentEdges=T({elementRect:w(t.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(e,t){return!(!s.DS.Area.HTMLNode.contains(e)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;s.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),s.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),Q=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),i(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),ee=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),i(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return s(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),e}(),te=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=A(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=A(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=A(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=_(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},r=_(_(t,"*",n),"-",t);return{x:t.x+r.x,y:t.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=A(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),ne=s((function e(r){var s=this,o=r.DS,a=r.settings;n(this,e),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(e){var n=e.settings,r=e.init;return s.DS.publish("Settings:updated:pre",t({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(e){for(var n=function(e,n){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},N("area",e.area,n,document)),N("selectables",e.selectables,n,null)),N("autoScrollSpeed",e.autoScrollSpeed,n,5)),N("overflowTolerance",e.overflowTolerance,n,{x:25,y:25})),N("zoom",e.zoom,n,1)),N("customStyles",e.customStyles,n,!1)),N("multiSelectMode",e.multiSelectMode,n,!1)),N("multiSelectToggling",e.multiSelectToggling,n,!0)),N("multiSelectKeys",e.multiSelectKeys,n,["Control","Shift","Meta"])),N("selector",e.selector,n,null)),N("selectionThreshold",e.selectionThreshold,n,0)),N("draggability",e.draggability,n,!0)),N("immediateDrag",e.immediateDrag,n,!0)),N("keyboardDrag",e.keyboardDrag,n,!0)),N("dragKeys",e.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),N("keyboardDragSpeed",e.keyboardDragSpeed,n,10)),N("useTransform",e.useTransform,n,!0)),N("refreshMemoryRate",e.refreshMemoryRate,n,80)),N("dropZones",e.dropZones,n,[])),N("dropInsideThreshold",e.dropInsideThreshold,n,1)),N("dropTargetThreshold",e.dropTargetThreshold,n,0)),N("usePointerEvents",e.usePointerEvents,n,!1)),N("hoverClass",e.hoverClass,n,"ds-hover")),N("selectableClass",e.selectableClass,n,"ds-selectable")),N("selectedClass",e.selectedClass,n,"ds-selected")),N("selectorClass",e.selectorClass,n,"ds-selector")),N("selectorAreaClass",e.selectorAreaClass,n,"ds-selector-area")),N("droppedTargetClass",e.droppedTargetClass,n,"ds-dropped-target")),N("droppedInsideClass",e.droppedInsideClass,n,"ds-dropped-inside")),N("droppableClass",e.droppableClass,n,"ds-droppable")),N("dropZoneClass",e.dropZoneClass,n,"ds-dropzone")),N("dropZoneReadyClass",e.dropZoneReadyClass,n,"ds-dropzone-ready")),N("dropZoneTargetClass",e.dropZoneTargetClass,n,"ds-dropzone-target")),N("dropZoneInsideClass",e.dropZoneInsideClass,n,"ds-dropzone-inside"))}(e.settings,e.init),r=function(){var e,t=v(a[o],2),n=t[0],r=t[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(e){return s.update({settings:i({},n,e)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(e={},i(e,n,s._settings[n]),i(e,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),e)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),re=function(){function e(r){var s=this;n(this,e),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(e){return s.stores.SettingsStore.update({settings:e})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(e){return s.stores.KeyStore.isMultiSelectKeyPressed(e)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(e){var t;return null===(t=s.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),i(this,"getItemsDroppedByZoneId",(function(e){return s.DropZones.getItemsDroppedById(e)})),i(this,"getItemsInsideByZoneId",(function(e,t){return s.DropZones.getItemsInsideById(e,t)})),this.PubSub=new X({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ne({DS:this,settings:r}),this.stores.PointerStore=new ee({DS:this}),this.stores.ScrollStore=new te({DS:this}),this.stores.KeyStore=new Q({DS:this}),this.Area=new H({DS:this}),this.Selector=new $({DS:this}),this.SelectorArea=new J({DS:this}),this.SelectableSet=new Y({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new G({DS:this}),this.Drag=new B({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new U({DS:this}),function(e){for(var n=e.subscribe,r=e.publish,s=e.Interaction,i=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return t({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=v(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return n(e?"".concat(o,":").concat(e):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(e?"".concat(e).concat(o.name):o.name,t(t({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(e,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(s){return t.SelectedSet.has(s)?t.removeSelection(e,n,r):t.addSelection(e,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var r=Z(e);return this.SelectableSet.addAll(r),t&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();re.isCollision=O;export{re as default}; | ||
function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function e(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,D(r.key),r)}}function s(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function i(t,e,n){return(e=D(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,n){return u=c()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var s=new(Function.bind.apply(t,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return u(t,arguments,a(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,t)},d(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}function p(t){var e=c();return function(){var n,r=a(t);if(e){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return S(this,n)}}function f(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=f(t,e);if(r){var s=Object.getOwnPropertyDescriptor(r,e);return s.get?s.get.call(arguments.length<3?t:n):s.value}},g.apply(this,arguments)}function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,s=t}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(t,e)||m(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t){return function(t){if(Array.isArray(t))return y(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return y(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var _=function(t,e,n){var r=t.x,s=t.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[e]},I=function(t){return{x:t.left,y:t.top}},w=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:t.x,top:t.y,right:t.x,bottom:t.y,width:e,height:e}},L=function(t,e){var n=e;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);t.forEach((function(t,e){r.observe(t,{childList:0!==e,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(t,e){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,t.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,e)}},C=function(){var t,e,n,r;return{y:(null===(t=document.body)||void 0===t?void 0:t.scrollTop)||(null===(e=document.documentElement)||void 0===e?void 0:e.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},E=function(t){return function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=e[r])||void 0===n?void 0:n.parentNode;return s?(e.push(s),t(e,++r)):e}([t])},A=function(t,e){var n={top:Number.POSITIVE_INFINITY,left:Number.POSITIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,right:Number.NEGATIVE_INFINITY,width:Number.NEGATIVE_INFINITY,height:Number.NEGATIVE_INFINITY};return z(t).forEach((function(t){var r=e.getRect(t);n.top=Math.min(n.top,r.top),n.left=Math.min(n.left,r.left),n.bottom=Math.max(n.bottom,r.bottom),n.right=Math.max(n.right,r.right)})),n.height=n.bottom-n.top,n.width=n.right-n.left,n},T=function(t){return!t||t instanceof Document?C():{x:t.scrollLeft>=0?t.scrollLeft:C().x,y:t.scrollTop>=0?t.scrollTop:C().y}},x=function(t){var e=t.elementRect,n=t.containerRect,r=t.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return e.top-s.y<n.top&&i.push("top"),e.left-s.x<n.left&&i.push("left"),e.bottom+s.y>n.bottom&&i.push("bottom"),e.right+s.y>n.right&&i.push("right"),i},k=function(t){var e={x:0,y:0},n=window.getComputedStyle(t);if(!n.transform||"none"===n.transform)return e;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");e.x=parseInt(i[12])||0,e.y=parseInt(i[13])||0}return e}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");e.x=parseInt(l[4])||0,e.y=parseInt(l[5])||0}return e},N=function(t,e){return e?function(t){var e=t.style.transform;if(!e||e.indexOf("translate")<0)return k(t);var n={x:0,y:0},r=e.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:k(t)}(t):function(t){var e=t.style,n={x:parseInt(e.left)||0,y:parseInt(e.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(t);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(t)},M=function(t){var e=t.computedStyle,n=t.node,r=e.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(t,e,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(t,'" is not of type "').concat(e,'".'))},R=function(t,e,n,r){if(void 0===e)return n?i({},t,r):{};if(null===e)return i({},t,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof e||e instanceof String),a&&!s&&(o=!0,V(t,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(e)&&"number"==typeof e),l&&!s&&(o=!0,V(t,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(e)),c&&!s&&(o=!0,V(t,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof e),u&&!s&&(o=!0,V(t,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(e)),d&&!s&&(o=!0,V(t,"array"));var h=o||n;return"dragKeys"===t&&s?i({},t,Object.assign(r,e)):"dragKeys"!==t||s?("dropZones"===t&&s&&new Set(e.map((function(t){return t.id}))).size!==e.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},t,e):h?i({},t,r):{}):h?i({},t,r):{}},O=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t;if(n>0){var s=(t.right-t.left)*n,i=(t.bottom-t.top)*n;r={left:t.left+s,right:t.right-s,top:t.top+i,bottom:t.bottom-i}}return r.left<e.right&&r.right>e.left&&r.top<e.bottom&&r.bottom>e.top},K=function(t){var e=t.element,n=t.posDirection,r=t.containerRect,s=t.useTransform,i=N(e,s),o=_(i,"+",n);Z(e,o,s);var a=e.getBoundingClientRect();!function(t){var e=t.element,n=t.edges,r=t.elementRect,s=t.containerRect,i=t.elementPos,o=t.useTransform;n.includes("top")&&Z(e,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&Z(e,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&Z(e,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&Z(e,{y:i.y,x:i.x+s.right-r.right},o)}({element:e,edges:x({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(t,e){window.removeEventListener("resize",e),window.removeEventListener("scroll",e),t.disconnect()},Z=function(t,e,n){if(n){var r=t.style.transform;t.style.transform="translate3d(".concat(e.x,"px,").concat(e.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else t.style.left="".concat(e.x,"px"),t.style.top="".concat(e.y,"px");return t},z=function(t){return t?!Array.isArray(t)&&(t instanceof HTMLElement||t instanceof SVGElement)?[t]:b(new Set(b(t))):[]},B=function(t,e){t.style.left="".concat(e.left,"px"),t.style.top="".concat(e.top,"px"),t.style.width="".concat(e.width,"px"),t.style.height="".concat(e.height,"px")},H=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(t){r.reset(),r._node=t,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(t){r.DS.PubSub.publish("Area:modified:pre",{event:t,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:t,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(t,e){var n={scroll_directions:t,scroll_multiplier:e};r.DS.PubSub.publish("Area:scroll:pre",n),function(t,e,n){if(e.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=t instanceof Document?r||document.body:t,i=e.includes("top")&&s.scrollTop>0,o=e.includes("bottom")&&s.scrollTop<s.scrollHeight,a=e.includes("left")&&s.scrollLeft>0,l=e.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,t,e),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(t){var e=t.settings;r.setArea(e.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(t,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(t,e){if(t instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=t.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(t.clientWidth||n.width)*e,height:(t.clientHeight||n.height)*e}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.HTMLNode)}}]),t}(),F=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"_selectionRect",void 0),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(t){return t.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(t){return t.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(t){return t.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(t){return t.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(t){var e=t.event,n=t.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:e,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.DS.stores.SettingsStore.s.dragAsBlock&&(r._selectionRect=A(r._elements,r.DS.SelectableSet)),r.handleZIndex(!0);var i=function(t){var e=t.shiftKey,n=t.keyboardDragSpeed,r=t.zoom,s=t.key,i=t.dragKeys,o=t.scrollDiff,a=t.canScroll,l=t.scrollCallback,c={x:0,y:0},u=e?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,e||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,e||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,e||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,e||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r.DS.stores.SettingsStore.s.dragAsBlock&&(i=r.limitDirection(i)),r._elements.forEach((function(t){return K({element:t,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(t){var e=t.event,n=t.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:e,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(t){var e=t.isDragging,n=t.isDraggingKeyboard;e&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.DS.stores.SettingsStore.s.dragAsBlock&&(r._selectionRect=A(r._elements,r.DS.SelectableSet)),r.handleZIndex(!0))})),i(this,"stop",(function(t){null!=t&&t.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(t){var e=t.isDragging,n=t.isDraggingKeyboard;if(e&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r.DS.stores.SettingsStore.s.dragAsBlock&&(s=r.limitDirection(s)),r._elements.forEach((function(t){return K({element:t,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"limitDirection",(function(t){var e=r.DS.SelectorArea.rect,n=r.DS.stores.ScrollStore.scrollAmount,s={top:e.top-r._selectionRect.top+n.y,left:e.left-r._selectionRect.left+n.x,bottom:e.bottom-r._selectionRect.bottom+n.y,right:e.right-r._selectionRect.right+n.x};return 0===t.x&&0===t.y||(t.y<0&&(t.y=Math.max(t.y,s.top)),t.x<0&&(t.x=Math.max(t.x,s.left)),t.y>0&&(t.y=Math.min(t.y,s.bottom)),t.x>0&&(t.x=Math.min(t.x,s.right)),r._selectionRect.top+=t.y,r._selectionRect.bottom+=t.y,r._selectionRect.left+=t.x,r._selectionRect.right+=t.x),t})),i(this,"handleZIndex",(function(t){r._elements.forEach((function(e){return e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+t?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(t,[{key:"_cursorDiff",get:function(){var t=this.DS.stores.PointerStore.currentVal,e=this._prevCursorPos?_(t,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=t,e}},{key:"_scrollDiff",get:function(){var t=this.DS.stores.ScrollStore.currentVal,e=this._prevScrollPos?_(t,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=t,e}}]),t}(),Y=function(){function t(e){var r=this,s=e.DS,o=e.id,a=e.element,l=e.droppables;n(this,t),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(t){if(!r.isDestroyed){var e=r.droppables.filter((function(t){return r.DS.SelectedSet.has(t)}));e.length&&(e.forEach((function(e){e.classList[t]("".concat(r.Settings.droppableClass)),e.classList[t]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[t]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var t;r.isDestroyed||(r.DS.SelectedSet.forEach((function(t){t.classList.remove(r.Settings.droppedTargetClass),t.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(t){return!r.DS.SelectedSet.has(t)})),null!==(t=r._itemsDropped)&&void 0!==t&&t.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var t,e,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(t=r.droppables)||void 0===t?void 0:t.filter((function(t){return r.DS.SelectedSet.has(t)})))))),null===(e=r._itemsDropped)||void 0===e||e.forEach((function(t){t.classList.add("".concat(r.Settings.droppedTargetClass)),t.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var t=!1;r.droppables.forEach((function(e){r.itemsInside.includes(e)?(e.classList.add("".concat(r.Settings.droppedInsideClass)),e.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t=!0):(e.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||e.classList.remove("".concat(r.Settings.droppedInsideClass)))})),t?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(t){t.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(t){t.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(t){var e=t.settings;r.element&&(r.element.classList.remove(e["dropZoneClass:pre"]),r.element.classList.add(e.dropZoneClass))})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(t,[{key:"destroy",value:function(){var t=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(e){e.classList.remove("".concat(t.Settings.droppedTargetClass)),e.classList.remove("".concat(t.Settings.droppedTargetClass,"-").concat(t.id)),e.classList.remove("".concat(t.Settings.droppableClass)),e.classList.remove("".concat(t.Settings.droppableClass,"-").concat(t.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var t=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(e){return O(t.DS.SelectableSet.rects.get(e),t.rect,t.Settings.dropInsideThreshold)?[e]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return t._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(t){this._droppables=t}}]),t}(),W=s((function t(r){var s=this,o=r.DS;n(this,t),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(t){var n=t.dropZones;n&&(s._zones&&s._zones.forEach((function(t){return t.destroy()})),s._zones=n.map((function(t){return new Y(e({DS:s.DS},t))})),s._zones.forEach((function(t){s._zoneByElement.set(t.element,t),s._zoneById.set(t.id,t),t.droppables.forEach((function(e){var n=s._zonesByDroppable.get(e);if(null==n||!n.length)return s._zonesByDroppable.set(e,[t]);s._zonesByDroppable.set(e,b(new Set([].concat(b(n),[t]))))}))})))})),i(this,"_handleDrop",(function(t){s._zones.forEach((function(e){e!==t&&e.handleNoDrop()})),t&&t.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(t,e){for(var n=e.x,r=e.y,i=0,o=t.length;i<o;i++){var a=s._zoneByElement.get(t[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(t){if(t.isDragging){var e=s.getTarget();s._handleDrop(e)}})),i(this,"getItemsDroppedById",(function(t){var e=s._zoneById.get(t);return e?e.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(t,")"))})),i(this,"getItemsInsideById",(function(t,e){var n=s._zoneById.get(t);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(t,")"));var r=n.itemsInside;return e&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(t){var e;if(null!==(e=s._zones)&&void 0!==e&&e.length){var n=(null==t?void 0:t.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==t?void 0:t.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(t){var e=t.settings;return s.setDropZones(e)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),G=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(t){return r.DS.publish("Interaction:start:pre",{event:t,isDragging:r.isDragging})})),i(this,"_start",(function(t){"touchstart"===t.type&&t.preventDefault(),r._canInteract(t)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(t),r.DS.publish("Interaction:start",{event:t,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(t){var e=t.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)||!e)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(e)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(e)):r.DS.SelectedSet.add(e)),!!r.DS.SelectedSet.has(e))})),i(this,"onClick",(function(t){var e=t.event;if(r._canInteract(e)&&!(e.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(e);var c=e.target;a.has(c)&&(o.isMultiSelectKeyPressed(e)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(t.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(t.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),t.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(t){var e=t.event,n=t.scroll_directions,s=t.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:e,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(t){return r.DS.publish("Interaction:end:pre",{event:t,isDragging:r.isDragging})})),i(this,"_reset",(function(t){var e=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:t,isDragging:e})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(t){var e=t.settings;r.stop(e["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(t){var e=t.event;return r.start(e)})),this.DS.subscribe("Interaction:start:pre",(function(t){var e=t.event;return r._start(e)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(t){var e=t.event;return r._reset(e)})),this.DS.subscribe("Area:scroll",this.update)}return s(t,[{key:"_canInteract",value:function(t){var e=0===t.clientX&&0===t.clientY&&0===t.detail&&t.target;return!(2===t.button||this.isInteracting||t.target&&!this.DS.SelectorArea.isInside(t.target)||!e&&!this.DS.SelectorArea.isClicked(t))}}]),t}(),U=s((function t(e){var r=this,s=e.DS;n(this,t),i(this,"subscribers",{}),i(this,"subscribe",(function(t,e){return Array.isArray(r.subscribers[t])||(r.subscribers[t]=[]),r.subscribers[t].push(e),r.subscribers[t].length-1})),i(this,"unsubscribe",(function(t,e,n){n>=0?r.subscribers[t].splice(n,1):e&&(r.subscribers[t]=r.subscribers[t].filter((function(t){return t!==e})))})),i(this,"publish",(function(t,e){Array.isArray(t)?t.forEach((function(t){return r._publish(t,e)})):r._publish(t,e)})),i(this,"_publish",(function(t,e){var n=r.subscribers[t];Array.isArray(n)&&(t.includes(":pre")?r._handlePrePublish(n,e):r._handlePublish(n,e))})),i(this,"_handlePublish",(function(t,e){for(var n=0,s=t.length;n<s;n++){if(r.DS.stopped)return;t[n](e)}})),i(this,"_handlePrePublish",(function(t,e){for(var n=t.length;n--;){if(r.DS.stopped)return;t[n](e)}})),this.DS=s})),X=function(t){o(r,d(Set));var e=p(r);function r(t){var s,o=t.DS;return n(this,r),i(h(s=e.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return z(s.Settings.selectables).forEach((function(t){return s.add(t)}))})),i(h(s),"clear",(function(){return s.forEach((function(t){return s.delete(t)}))})),i(h(s),"_onClick",(function(t){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:t})})),i(h(s),"_onPointer",(function(t){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:t})})),i(h(s),"addAll",(function(t){return t.forEach((function(t){return s.add(t)}))})),i(h(s),"deleteAll",(function(t){return t.forEach((function(t){return s.delete(t)}))})),i(h(s),"getRect",(function(t){return s._rects?s.rects.get(t):t.getBoundingClientRect()})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(t){var e=t.settings;s.forEach((function(t){t.classList.remove(e["selectableClass:pre"]),t.classList.add(e.selectableClass)}))})),s}return s(r,[{key:"add",value:function(t){if(!g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selectable:added:pre",e),t.classList.add(this.Settings.selectableClass),t.addEventListener("click",this._onClick),this.Settings.usePointerEvents?t.addEventListener("pointerdown",this._onPointer,{passive:!1}):t.addEventListener("mousedown",this._onPointer),t.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(t),node:t}),this.DS.publish("Selectable:added",e),g(a(r.prototype),"add",this).call(this,t)}}},{key:"delete",value:function(t){if(g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selectable:removed:pre",e),t.classList.remove(this.Settings.selectableClass),t.classList.remove(this.Settings.hoverClass),t.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?t.removeEventListener("pointerdown",this._onPointer,{passive:!1}):t.removeEventListener("mousedown",this._onPointer),t.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",e),g(a(r.prototype),"delete",this).call(this,t)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var t=this;return this._rects||(this._rects=new Map,this.forEach((function(e){return t._rects.set(e,e.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return t._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(),q=function(t){o(r,d(Set));var e=p(r);function r(t){var s,o=t.DS;return n(this,r),i(h(s=e.call(this)),"clear",(function(){return s.forEach((function(t){return s.delete(t)}))})),i(h(s),"addAll",(function(t){return t.forEach((function(t){return s.add(t)}))})),i(h(s),"deleteAll",(function(t){return t.forEach((function(t){return s.delete(t)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(t){if(!g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selected:added:pre",e),g(a(r.prototype),"add",this).call(this,t),t.classList.add(this.DS.stores.SettingsStore.s.selectedClass),t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+1),this.DS.publish("Selected:added",e),this}}},{key:"delete",value:function(t){if(g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};this.DS.publish("Selected:removed:pre",e);var n=g(a(r.prototype),"delete",this).call(this,t);return t.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)-1),this.DS.publish("Selected:removed",e),n}}},{key:"toggle",value:function(t){return this.has(t)?this.delete(t):this.add(t),t}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(),$=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(t){var e=t.event;t.isDragging||(r._storePrevious(e),r._handleInsideSelection(!0,e))})),i(this,"update",(function(t){t.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(t,e){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,S=new Map,p=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=m(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){a=!0,i=t},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(p.s();!(n=p.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):S.set(g,b))}}catch(t){p.e(t)}finally{p.f()}if(!r.DS.continue){var y=r.filterSelected({select:h,unselect:S,selectorRect:d}),D=y.select,_=y.unselect;D.forEach((function(e,n){return function(t){var e=t.element,n=t.force,r=t.multiSelectionToggle,s=t.SelectedSet,i=t.hoverClassName;e.classList.contains(i)&&!n||(s.has(e)?r&&s.delete(e):s.add(e),e.classList.add(i))}({element:n,force:t,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(e,n){return function(t){var e=t.element,n=t.force,r=t.SelectedSet,s=t.PrevSelectedSet,i=t.hoverClassName;if(!e.classList.contains(i)&&!n)return!1;var o=r.has(e),a=s.has(e);o&&!a?r.delete(e):!o&&a&&r.add(e),e.classList.remove(i)}({element:n,force:t,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(t){var e=t.select,n=t.unselect;return t.selectorRect,{select:e,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(t,[{key:"_storePrevious",value:function(t){var e=this.DS,n=e.stores.KeyStore,r=e.SelectedSet;n.isMultiSelectKeyPressed(t)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),t}(),J=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var t,e,n,s;r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(t){if(!t.isDragging){var e=r.DS.stores.PointerStore.initialValArea;B(r.HTMLNode,w(e,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(t){if(!t.isDragging&&!r.DS.continue){var e=r.DS.stores,n=e.ScrollStore,s=e.PointerStore,i=function(t){var e=t.scrollAmount,n=t.initialPointerPos,r=t.pointerPos,s={};return r.x>n.x-e.x?(s.left=n.x-e.x,s.width=r.x-n.x+e.x):(s.left=r.x,s.width=n.x-r.x-e.x),r.y>n.y-e.y?(s.top=n.y-e.y,s.height=r.y-n.y+e.y):(s.top=r.y,s.height=n.y-r.y-e.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});B(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(t){var e=t.settings;r.HTMLNode.classList.remove(e["selectorClass:pre"]),r.HTMLNode.classList.add(e.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),Q=function(){function t(e){var r,s=this,o=e.DS;n(this,t),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",e=document.body?"body":"documentElement",n="".concat(t,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[e][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var t=s.DS.Area.rect,e=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(t.top+e.top,"px"),i="".concat(t.left+e.left,"px"),o="".concat(t.width,"px"),a="".concat(t.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(t){s.stopAutoScroll(),t&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var t=s.DS,e=t.stores.PointerStore,n=t.Area;s.currentEdges=x({elementRect:w(e.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(t,e){return!(!s.DS.Area.HTMLNode.contains(t)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,e||t.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(t){var e=t.settings;s.HTMLNode.classList.remove(e["selectorAreaClass:pre"]),s.HTMLNode.classList.add(e.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(t,[{key:"isClicked",value:function(t){var e=this.DS.stores.PointerStore,n=t?e.getPointerPosition(t):e.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),tt=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(t){var e=t.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:t,key:e}),r._currentValues.add(e),r.DS.publish("KeyStore:down",{event:t,key:e})})),i(this,"keyup",(function(t){var e=t.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:t,key:e}),r._currentValues.delete(e),r.DS.publish("KeyStore:up",{event:t,key:e})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(t,[{key:"isMultiSelectKeyPressed",value:function(t){var e=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(t){return t.toLocaleLowerCase()}));return!!this.currentValues.some((function(t){return n.includes(t.toLocaleLowerCase())}))||!(!t||!n.some((function(n){return t[e._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),t}(),et=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(t){return function(t){var e=t.event;return{x:e.clientX,y:e.clientY}}({event:r._normalizedEvent(t)})})),i(this,"update",(function(t){t&&(r.DS.publish("PointerStore:updated:pre",{event:t}),r.currentVal=r.getPointerPosition(t),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:t}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(t){t&&(r.currentVal=r.lastVal=r.getPointerPosition(t),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(t){var e=t.event;return r.start(e)})),this.DS.subscribe("Interaction:end",(function(t){var e=t.event;return r.reset(e)}))}return s(t,[{key:"start",value:function(t){t&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(t))}},{key:"_normalizedEvent",value:function(t){return"touches"in t&&"touchend"!==t.type&&(this._lastTouch=t),"touches"in t?this._lastTouch.touches[0]:t}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(t){this._initialVal=t,this._initialValArea=t&&_(t,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(t){this._currentVal=t,this._currentValArea=t&&_(t,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(t){this._lastVal=t,this._lastValArea=t&&_(t,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),t}(),nt=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=T(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=T(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(t=this.DS.stores.SettingsStore.s.area,!!((e=T(t)).x||e.y||(t instanceof Document?t.body?t.body.scrollTop=1:t.documentElement.scrollTop=1:t.scrollTop=1)));var t,e}},{key:"scrollAmount",get:function(){var t,e=_(this.currentVal,"-",this.initialVal),n={x:t=this.DS.stores.SettingsStore.s.zoom,y:t},r=_(_(e,"*",n),"-",e);return{x:e.x+r.x,y:e.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=T(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),rt=s((function t(r){var s=this,o=r.DS,a=r.settings;n(this,t),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(t){var n=t.settings,r=t.init;return s.DS.publish("Settings:updated:pre",e({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(t){for(var n=function(t,n){return e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e({},R("area",t.area,n,document)),R("selectables",t.selectables,n,null)),R("autoScrollSpeed",t.autoScrollSpeed,n,5)),R("overflowTolerance",t.overflowTolerance,n,{x:25,y:25})),R("zoom",t.zoom,n,1)),R("customStyles",t.customStyles,n,!1)),R("multiSelectMode",t.multiSelectMode,n,!1)),R("multiSelectToggling",t.multiSelectToggling,n,!0)),R("multiSelectKeys",t.multiSelectKeys,n,["Control","Shift","Meta"])),R("selector",t.selector,n,null)),R("selectionThreshold",t.selectionThreshold,n,0)),R("draggability",t.draggability,n,!0)),R("immediateDrag",t.immediateDrag,n,!0)),R("keyboardDrag",t.keyboardDrag,n,!0)),R("dragKeys",t.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),R("keyboardDragSpeed",t.keyboardDragSpeed,n,10)),R("useTransform",t.useTransform,n,!0)),R("refreshMemoryRate",t.refreshMemoryRate,n,80)),R("dropZones",t.dropZones,n,[])),R("dropInsideThreshold",t.dropInsideThreshold,n,1)),R("dropTargetThreshold",t.dropTargetThreshold,n,0)),R("usePointerEvents",t.usePointerEvents,n,!1)),R("hoverClass",t.hoverClass,n,"ds-hover")),R("selectableClass",t.selectableClass,n,"ds-selectable")),R("selectedClass",t.selectedClass,n,"ds-selected")),R("selectorClass",t.selectorClass,n,"ds-selector")),R("selectorAreaClass",t.selectorAreaClass,n,"ds-selector-area")),R("droppedTargetClass",t.droppedTargetClass,n,"ds-dropped-target")),R("droppedInsideClass",t.droppedInsideClass,n,"ds-dropped-inside")),R("droppableClass",t.droppableClass,n,"ds-droppable")),R("dropZoneClass",t.dropZoneClass,n,"ds-dropzone")),R("dropZoneReadyClass",t.dropZoneReadyClass,n,"ds-dropzone-ready")),R("dropZoneTargetClass",t.dropZoneTargetClass,n,"ds-dropzone-target")),R("dropZoneInsideClass",t.dropZoneInsideClass,n,"ds-dropzone-inside")),R("dragAsBlock",t.dragAsBlock,n,!1))}(t.settings,t.init),r=function(){var t,e=v(a[o],2),n=e[0],r=e[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(t){return s.update({settings:i({},n,t)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(t={},i(t,n,s._settings[n]),i(t,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),t)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),st=function(){function t(r){var s=this;n(this,t),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(t){return s.stores.SettingsStore.update({settings:t})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(t){return s.stores.KeyStore.isMultiSelectKeyPressed(t)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(t){var e;return null===(e=s.DropZones.getTarget(t))||void 0===e?void 0:e.toObject()})),i(this,"getItemsDroppedByZoneId",(function(t){return s.DropZones.getItemsDroppedById(t)})),i(this,"getItemsInsideByZoneId",(function(t,e){return s.DropZones.getItemsInsideById(t,e)})),this.PubSub=new U({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new rt({DS:this,settings:r}),this.stores.PointerStore=new et({DS:this}),this.stores.ScrollStore=new nt({DS:this}),this.stores.KeyStore=new tt({DS:this}),this.Area=new H({DS:this}),this.Selector=new J({DS:this}),this.SelectorArea=new Q({DS:this}),this.SelectableSet=new X({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new $({DS:this}),this.Drag=new F({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new G({DS:this}),function(t){for(var n=t.subscribe,r=t.publish,s=t.Interaction,i=t.SelectedSet,o=t.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(t){return t.event}}],"Interaction:end":[{name:"callback",extraData:function(){var t=o.getTarget();return e({},t?{dropTarget:t.toObject()}:{})}}]},l=function(){var t=v(u[c],2),o=t[0],a=t[1];["pre",!1].forEach((function(t){return n(t?"".concat(o,":").concat(t):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(t?"".concat(t).concat(o.name):o.name,e(e({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(t,[{key:"stop",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(t),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),t&&this.SelectableSet.clear(),e&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(z(t)),n||this.addSelectables(t),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(z(t)),n&&this.removeSelectables(t),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return z(t).forEach((function(s){return e.SelectedSet.has(s)?e.removeSelection(t,n,r):e.addSelection(t,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(t,e,n),this.getSelection()}},{key:"clearSelection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(t,e,n){var r=z(t);return this.SelectableSet.addAll(r),e&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),t}},{key:"setSelectables",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(t,e),this.addSelectables(t,n)}},{key:"removeSelectables",value:function(t,e,n){return this.SelectableSet.deleteAll(z(t)),e&&this.removeSelection(t),n&&this.PubSub.publish("callback",{items:this.getSelection()}),t}}]),t}();st.isCollision=O;export{st as default}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DragSelect=t()}(this,(function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,D(r.key),r)}}function s(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function S(e){var t=c();return function(){var n,r=a(e);if(t){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return p(this,n)}}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=f(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}},g.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var _=function(e,t,n){var r=e.x,s=e.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[t]},I=function(e){return{x:e.left,y:e.top}},w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},L=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);e.forEach((function(e,t){r.observe(e,{childList:0!==t,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(e,t){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,e.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,t)}},C=function(){var e,t,n,r;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},E=function(e){return function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=t[r])||void 0===n?void 0:n.parentNode;return s?(t.push(s),e(t,++r)):t}([e])},T=function(e){return!e||e instanceof Document?C():{x:e.scrollLeft>=0?e.scrollLeft:C().x,y:e.scrollTop>=0?e.scrollTop:C().y}},A=function(e){var t=e.elementRect,n=e.containerRect,r=e.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return t.top-s.y<n.top&&i.push("top"),t.left-s.x<n.left&&i.push("left"),t.bottom+s.y>n.bottom&&i.push("bottom"),t.right+s.y>n.right&&i.push("right"),i},x=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},k=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return x(e);var n={x:0,y:0},r=t.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:x(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(e);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(e)},M=function(e){var t=e.computedStyle,n=e.node,r=t.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},N=function(e,t,n,r){if(void 0===t)return n?i({},e,r):{};if(null===t)return i({},e,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof t||t instanceof String),a&&!s&&(o=!0,V(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(t)&&"number"==typeof t),l&&!s&&(o=!0,V(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(t)),c&&!s&&(o=!0,V(e,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof t),u&&!s&&(o=!0,V(e,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(t)),d&&!s&&(o=!0,V(e,"array"));var h=o||n;return"dragKeys"===e&&s?i({},e,Object.assign(r,t)):"dragKeys"!==e||s?("dropZones"===e&&s&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},e,t):h?i({},e,r):{}):h?i({},e,r):{}},O=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e;if(n>0){var s=(e.right-e.left)*n,i=(e.bottom-e.top)*n;r={left:e.left+s,right:e.right-s,top:e.top+i,bottom:e.bottom-i}}return r.left<t.right&&r.right>t.left&&r.top<t.bottom&&r.bottom>t.top},K=function(e){var t=e.element,n=e.posDirection,r=e.containerRect,s=e.useTransform,i=k(t,s),o=_(i,"+",n);R(t,o,s);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,r=e.elementRect,s=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&R(t,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&R(t,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&R(t,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&R(t,{y:i.y,x:i.x+s.right-r.right},o)}({element:t,edges:A({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},R=function(e,t,n){if(n){var r=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:b(new Set(b(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(e){r.reset(),r._node=e,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=e instanceof Document?r||document.body:e,i=t.includes("top")&&s.scrollTop>0,o=t.includes("bottom")&&s.scrollTop<s.scrollHeight,a=t.includes("left")&&s.scrollLeft>0,l=t.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(e,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.HTMLNode)}}]),e}(),B=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,r=e.zoom,s=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return K({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),i(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return K({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?_(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?_(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var r=this,s=t.DS,o=t.id,a=t.element,l=t.droppables;n(this,e),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element&&(r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass))})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return O(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),W=s((function e(r){var s=this,o=r.DS;n(this,e),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(e){var n=e.dropZones;n&&(s._zones&&s._zones.forEach((function(e){return e.destroy()})),s._zones=n.map((function(e){return new F(t({DS:s.DS},e))})),s._zones.forEach((function(e){s._zoneByElement.set(e.element,e),s._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=s._zonesByDroppable.get(t);if(null==n||!n.length)return s._zonesByDroppable.set(t,[e]);s._zonesByDroppable.set(t,b(new Set([].concat(b(n),[e]))))}))})))})),i(this,"_handleDrop",(function(e){s._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,r=t.y,i=0,o=e.length;i<o;i++){var a=s._zoneByElement.get(e[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(e){if(e.isDragging){var t=s.getTarget();s._handleDrop(t)}})),i(this,"getItemsDroppedById",(function(e){var t=s._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),i(this,"getItemsInsideById",(function(e,t){var n=s._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var r=n.itemsInside;return t&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(e){var t;if(null!==(t=s._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==e?void 0:e.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return s.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),U=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),i(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),i(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(e.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(e.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),e.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),i(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.stop(t["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return s(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),X=s((function e(t){var r=this,s=t.DS;n(this,e),i(this,"subscribers",{}),i(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),i(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),i(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),i(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),i(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),i(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=s})),Y=function(e){o(r,e);var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return Z(s.Settings.selectables).forEach((function(e){return s.add(e)}))})),i(h(s),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"_onClick",(function(e){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),i(h(s),"_onPointer",(function(e){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;s.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),g(a(r.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),g(a(r.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(d(Set)),q=function(e){o(r,e);var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),g(a(r.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=g(a(r.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(d(Set)),G=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),i(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,p=new Map,S=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s:s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(S.s();!(n=S.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):p.set(g,b))}}catch(e){S.e(e)}finally{S.f()}if(!r.DS.continue){var m=r.filterSelected({select:h,unselect:p,selectorRect:d}),D=m.select,_=m.unselect;D.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.multiSelectionToggle,s=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(s.has(t)?r&&s.delete(t):s.add(t),t.classList.add(i))}({element:n,force:e,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.SelectedSet,s=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=r.has(t),a=s.has(t);o&&!a?r.delete(t):!o&&a&&r.add(t),t.classList.remove(i)}({element:n,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(e){var t=e.select,n=e.unselect;return e.selectorRect,{select:t,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(e,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,r=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),e}(),$=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,w(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,r=e.pointerPos,s={};return r.x>n.x-t.x?(s.left=n.x-t.x,s.width=r.x-n.x+t.x):(s.left=r.x,s.width=n.x-r.x-t.x),r.y>n.y-t.y?(s.top=n.y-t.y,s.height=r.y-n.y+t.y):(s.top=r.y,s.height=n.y-r.y-t.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),J=function(){function e(t){var r,s=this,o=t.DS;n(this,e),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[t][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var e=s.DS.Area.rect,t=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(e.top+t.top,"px"),i="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(e){s.stopAutoScroll(),e&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var e=s.DS,t=e.stores.PointerStore,n=e.Area;s.currentEdges=A({elementRect:w(t.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(e,t){return!(!s.DS.Area.HTMLNode.contains(e)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;s.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),s.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),Q=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),i(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),ee=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),i(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return s(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),e}(),te=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=T(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=T(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=T(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=_(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},r=_(_(t,"*",n),"-",t);return{x:t.x+r.x,y:t.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=T(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),ne=s((function e(r){var s=this,o=r.DS,a=r.settings;n(this,e),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(e){var n=e.settings,r=e.init;return s.DS.publish("Settings:updated:pre",t({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(e){for(var n=function(e,n){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},N("area",e.area,n,document)),N("selectables",e.selectables,n,null)),N("autoScrollSpeed",e.autoScrollSpeed,n,5)),N("overflowTolerance",e.overflowTolerance,n,{x:25,y:25})),N("zoom",e.zoom,n,1)),N("customStyles",e.customStyles,n,!1)),N("multiSelectMode",e.multiSelectMode,n,!1)),N("multiSelectToggling",e.multiSelectToggling,n,!0)),N("multiSelectKeys",e.multiSelectKeys,n,["Control","Shift","Meta"])),N("selector",e.selector,n,null)),N("selectionThreshold",e.selectionThreshold,n,0)),N("draggability",e.draggability,n,!0)),N("immediateDrag",e.immediateDrag,n,!0)),N("keyboardDrag",e.keyboardDrag,n,!0)),N("dragKeys",e.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),N("keyboardDragSpeed",e.keyboardDragSpeed,n,10)),N("useTransform",e.useTransform,n,!0)),N("refreshMemoryRate",e.refreshMemoryRate,n,80)),N("dropZones",e.dropZones,n,[])),N("dropInsideThreshold",e.dropInsideThreshold,n,1)),N("dropTargetThreshold",e.dropTargetThreshold,n,0)),N("usePointerEvents",e.usePointerEvents,n,!1)),N("hoverClass",e.hoverClass,n,"ds-hover")),N("selectableClass",e.selectableClass,n,"ds-selectable")),N("selectedClass",e.selectedClass,n,"ds-selected")),N("selectorClass",e.selectorClass,n,"ds-selector")),N("selectorAreaClass",e.selectorAreaClass,n,"ds-selector-area")),N("droppedTargetClass",e.droppedTargetClass,n,"ds-dropped-target")),N("droppedInsideClass",e.droppedInsideClass,n,"ds-dropped-inside")),N("droppableClass",e.droppableClass,n,"ds-droppable")),N("dropZoneClass",e.dropZoneClass,n,"ds-dropzone")),N("dropZoneReadyClass",e.dropZoneReadyClass,n,"ds-dropzone-ready")),N("dropZoneTargetClass",e.dropZoneTargetClass,n,"ds-dropzone-target")),N("dropZoneInsideClass",e.dropZoneInsideClass,n,"ds-dropzone-inside"))}(e.settings,e.init),r=function(){var e,t=v(a[o],2),n=t[0],r=t[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(e){return s.update({settings:i({},n,e)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(e={},i(e,n,s._settings[n]),i(e,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),e)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),re=function(){function e(r){var s=this;n(this,e),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(e){return s.stores.SettingsStore.update({settings:e})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(e){return s.stores.KeyStore.isMultiSelectKeyPressed(e)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(e){var t;return null===(t=s.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),i(this,"getItemsDroppedByZoneId",(function(e){return s.DropZones.getItemsDroppedById(e)})),i(this,"getItemsInsideByZoneId",(function(e,t){return s.DropZones.getItemsInsideById(e,t)})),this.PubSub=new X({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ne({DS:this,settings:r}),this.stores.PointerStore=new ee({DS:this}),this.stores.ScrollStore=new te({DS:this}),this.stores.KeyStore=new Q({DS:this}),this.Area=new H({DS:this}),this.Selector=new $({DS:this}),this.SelectorArea=new J({DS:this}),this.SelectableSet=new Y({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new G({DS:this}),this.Drag=new B({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new U({DS:this}),function(e){for(var n=e.subscribe,r=e.publish,s=e.Interaction,i=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return t({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=v(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return n(e?"".concat(o,":").concat(e):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(e?"".concat(e).concat(o.name):o.name,t(t({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(e,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(s){return t.SelectedSet.has(s)?t.removeSelection(e,n,r):t.addSelection(e,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var r=Z(e);return this.SelectableSet.addAll(r),t&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();return re.isCollision=O,re})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).DragSelect=e()}(this,(function(){"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function e(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,D(r.key),r)}}function s(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function i(t,e,n){return(e=D(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,n){return u=c()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var s=new(Function.bind.apply(t,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return u(t,arguments,a(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,t)},d(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}function p(t){var e=c();return function(){var n,r=a(t);if(e){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return S(this,n)}}function f(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=f(t,e);if(r){var s=Object.getOwnPropertyDescriptor(r,e);return s.get?s.get.call(arguments.length<3?t:n):s.value}},g.apply(this,arguments)}function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,s=t}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(t,e)||m(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t){return function(t){if(Array.isArray(t))return y(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return y(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var _=function(t,e,n){var r=t.x,s=t.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[e]},I=function(t){return{x:t.left,y:t.top}},w=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:t.x,top:t.y,right:t.x,bottom:t.y,width:e,height:e}},L=function(t,e){var n=e;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);t.forEach((function(t,e){r.observe(t,{childList:0!==e,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(t,e){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,t.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,e)}},T=function(){var t,e,n,r;return{y:(null===(t=document.body)||void 0===t?void 0:t.scrollTop)||(null===(e=document.documentElement)||void 0===e?void 0:e.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},C=function(t){return function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=e[r])||void 0===n?void 0:n.parentNode;return s?(e.push(s),t(e,++r)):e}([t])},E=function(t,e){var n={top:Number.POSITIVE_INFINITY,left:Number.POSITIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,right:Number.NEGATIVE_INFINITY,width:Number.NEGATIVE_INFINITY,height:Number.NEGATIVE_INFINITY};return z(t).forEach((function(t){var r=e.getRect(t);n.top=Math.min(n.top,r.top),n.left=Math.min(n.left,r.left),n.bottom=Math.max(n.bottom,r.bottom),n.right=Math.max(n.right,r.right)})),n.height=n.bottom-n.top,n.width=n.right-n.left,n},A=function(t){return!t||t instanceof Document?T():{x:t.scrollLeft>=0?t.scrollLeft:T().x,y:t.scrollTop>=0?t.scrollTop:T().y}},x=function(t){var e=t.elementRect,n=t.containerRect,r=t.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return e.top-s.y<n.top&&i.push("top"),e.left-s.x<n.left&&i.push("left"),e.bottom+s.y>n.bottom&&i.push("bottom"),e.right+s.y>n.right&&i.push("right"),i},k=function(t){var e={x:0,y:0},n=window.getComputedStyle(t);if(!n.transform||"none"===n.transform)return e;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");e.x=parseInt(i[12])||0,e.y=parseInt(i[13])||0}return e}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");e.x=parseInt(l[4])||0,e.y=parseInt(l[5])||0}return e},N=function(t,e){return e?function(t){var e=t.style.transform;if(!e||e.indexOf("translate")<0)return k(t);var n={x:0,y:0},r=e.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:k(t)}(t):function(t){var e=t.style,n={x:parseInt(e.left)||0,y:parseInt(e.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(t);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(t)},M=function(t){var e=t.computedStyle,n=t.node,r=e.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(t,e,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(t,'" is not of type "').concat(e,'".'))},R=function(t,e,n,r){if(void 0===e)return n?i({},t,r):{};if(null===e)return i({},t,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof e||e instanceof String),a&&!s&&(o=!0,V(t,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(e)&&"number"==typeof e),l&&!s&&(o=!0,V(t,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(e)),c&&!s&&(o=!0,V(t,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof e),u&&!s&&(o=!0,V(t,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(e)),d&&!s&&(o=!0,V(t,"array"));var h=o||n;return"dragKeys"===t&&s?i({},t,Object.assign(r,e)):"dragKeys"!==t||s?("dropZones"===t&&s&&new Set(e.map((function(t){return t.id}))).size!==e.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},t,e):h?i({},t,r):{}):h?i({},t,r):{}},O=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t;if(n>0){var s=(t.right-t.left)*n,i=(t.bottom-t.top)*n;r={left:t.left+s,right:t.right-s,top:t.top+i,bottom:t.bottom-i}}return r.left<e.right&&r.right>e.left&&r.top<e.bottom&&r.bottom>e.top},K=function(t){var e=t.element,n=t.posDirection,r=t.containerRect,s=t.useTransform,i=N(e,s),o=_(i,"+",n);Z(e,o,s);var a=e.getBoundingClientRect();!function(t){var e=t.element,n=t.edges,r=t.elementRect,s=t.containerRect,i=t.elementPos,o=t.useTransform;n.includes("top")&&Z(e,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&Z(e,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&Z(e,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&Z(e,{y:i.y,x:i.x+s.right-r.right},o)}({element:e,edges:x({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(t,e){window.removeEventListener("resize",e),window.removeEventListener("scroll",e),t.disconnect()},Z=function(t,e,n){if(n){var r=t.style.transform;t.style.transform="translate3d(".concat(e.x,"px,").concat(e.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else t.style.left="".concat(e.x,"px"),t.style.top="".concat(e.y,"px");return t},z=function(t){return t?!Array.isArray(t)&&(t instanceof HTMLElement||t instanceof SVGElement)?[t]:b(new Set(b(t))):[]},B=function(t,e){t.style.left="".concat(e.left,"px"),t.style.top="".concat(e.top,"px"),t.style.width="".concat(e.width,"px"),t.style.height="".concat(e.height,"px")},H=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(t){r.reset(),r._node=t,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(t){r.DS.PubSub.publish("Area:modified:pre",{event:t,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:t,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(t,e){var n={scroll_directions:t,scroll_multiplier:e};r.DS.PubSub.publish("Area:scroll:pre",n),function(t,e,n){if(e.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=t instanceof Document?r||document.body:t,i=e.includes("top")&&s.scrollTop>0,o=e.includes("bottom")&&s.scrollTop<s.scrollHeight,a=e.includes("left")&&s.scrollLeft>0,l=e.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,t,e),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(t){var e=t.settings;r.setArea(e.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(t,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(t,e){if(t instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=t.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(t.clientWidth||n.width)*e,height:(t.clientHeight||n.height)*e}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=C(this.HTMLNode)}}]),t}(),F=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"_selectionRect",void 0),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(t){return t.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(t){return t.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(t){return t.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(t){return t.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(t){var e=t.event,n=t.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:e,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.DS.stores.SettingsStore.s.dragAsBlock&&(r._selectionRect=E(r._elements,r.DS.SelectableSet)),r.handleZIndex(!0);var i=function(t){var e=t.shiftKey,n=t.keyboardDragSpeed,r=t.zoom,s=t.key,i=t.dragKeys,o=t.scrollDiff,a=t.canScroll,l=t.scrollCallback,c={x:0,y:0},u=e?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,e||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,e||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,e||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,e||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r.DS.stores.SettingsStore.s.dragAsBlock&&(i=r.limitDirection(i)),r._elements.forEach((function(t){return K({element:t,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(t){var e=t.event,n=t.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:e,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(t){var e=t.isDragging,n=t.isDraggingKeyboard;e&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.DS.stores.SettingsStore.s.dragAsBlock&&(r._selectionRect=E(r._elements,r.DS.SelectableSet)),r.handleZIndex(!0))})),i(this,"stop",(function(t){null!=t&&t.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(t){var e=t.isDragging,n=t.isDraggingKeyboard;if(e&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r.DS.stores.SettingsStore.s.dragAsBlock&&(s=r.limitDirection(s)),r._elements.forEach((function(t){return K({element:t,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"limitDirection",(function(t){var e=r.DS.SelectorArea.rect,n=r.DS.stores.ScrollStore.scrollAmount,s={top:e.top-r._selectionRect.top+n.y,left:e.left-r._selectionRect.left+n.x,bottom:e.bottom-r._selectionRect.bottom+n.y,right:e.right-r._selectionRect.right+n.x};return 0===t.x&&0===t.y||(t.y<0&&(t.y=Math.max(t.y,s.top)),t.x<0&&(t.x=Math.max(t.x,s.left)),t.y>0&&(t.y=Math.min(t.y,s.bottom)),t.x>0&&(t.x=Math.min(t.x,s.right)),r._selectionRect.top+=t.y,r._selectionRect.bottom+=t.y,r._selectionRect.left+=t.x,r._selectionRect.right+=t.x),t})),i(this,"handleZIndex",(function(t){r._elements.forEach((function(e){return e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+t?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(t,[{key:"_cursorDiff",get:function(){var t=this.DS.stores.PointerStore.currentVal,e=this._prevCursorPos?_(t,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=t,e}},{key:"_scrollDiff",get:function(){var t=this.DS.stores.ScrollStore.currentVal,e=this._prevScrollPos?_(t,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=t,e}}]),t}(),Y=function(){function t(e){var r=this,s=e.DS,o=e.id,a=e.element,l=e.droppables;n(this,t),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(t){if(!r.isDestroyed){var e=r.droppables.filter((function(t){return r.DS.SelectedSet.has(t)}));e.length&&(e.forEach((function(e){e.classList[t]("".concat(r.Settings.droppableClass)),e.classList[t]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[t]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var t;r.isDestroyed||(r.DS.SelectedSet.forEach((function(t){t.classList.remove(r.Settings.droppedTargetClass),t.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(t){return!r.DS.SelectedSet.has(t)})),null!==(t=r._itemsDropped)&&void 0!==t&&t.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var t,e,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(t=r.droppables)||void 0===t?void 0:t.filter((function(t){return r.DS.SelectedSet.has(t)})))))),null===(e=r._itemsDropped)||void 0===e||e.forEach((function(t){t.classList.add("".concat(r.Settings.droppedTargetClass)),t.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var t=!1;r.droppables.forEach((function(e){r.itemsInside.includes(e)?(e.classList.add("".concat(r.Settings.droppedInsideClass)),e.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t=!0):(e.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||e.classList.remove("".concat(r.Settings.droppedInsideClass)))})),t?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(t){t.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(t){t.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(t){var e=t.settings;r.element&&(r.element.classList.remove(e["dropZoneClass:pre"]),r.element.classList.add(e.dropZoneClass))})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(t,[{key:"destroy",value:function(){var t=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(e){e.classList.remove("".concat(t.Settings.droppedTargetClass)),e.classList.remove("".concat(t.Settings.droppedTargetClass,"-").concat(t.id)),e.classList.remove("".concat(t.Settings.droppableClass)),e.classList.remove("".concat(t.Settings.droppableClass,"-").concat(t.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var t=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(e){return O(t.DS.SelectableSet.rects.get(e),t.rect,t.Settings.dropInsideThreshold)?[e]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return t._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=C(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(t){this._droppables=t}}]),t}(),W=s((function t(r){var s=this,o=r.DS;n(this,t),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(t){var n=t.dropZones;n&&(s._zones&&s._zones.forEach((function(t){return t.destroy()})),s._zones=n.map((function(t){return new Y(e({DS:s.DS},t))})),s._zones.forEach((function(t){s._zoneByElement.set(t.element,t),s._zoneById.set(t.id,t),t.droppables.forEach((function(e){var n=s._zonesByDroppable.get(e);if(null==n||!n.length)return s._zonesByDroppable.set(e,[t]);s._zonesByDroppable.set(e,b(new Set([].concat(b(n),[t]))))}))})))})),i(this,"_handleDrop",(function(t){s._zones.forEach((function(e){e!==t&&e.handleNoDrop()})),t&&t.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(t,e){for(var n=e.x,r=e.y,i=0,o=t.length;i<o;i++){var a=s._zoneByElement.get(t[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(t){if(t.isDragging){var e=s.getTarget();s._handleDrop(e)}})),i(this,"getItemsDroppedById",(function(t){var e=s._zoneById.get(t);return e?e.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(t,")"))})),i(this,"getItemsInsideById",(function(t,e){var n=s._zoneById.get(t);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(t,")"));var r=n.itemsInside;return e&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(t){var e;if(null!==(e=s._zones)&&void 0!==e&&e.length){var n=(null==t?void 0:t.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==t?void 0:t.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(t){var e=t.settings;return s.setDropZones(e)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),G=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(t){return r.DS.publish("Interaction:start:pre",{event:t,isDragging:r.isDragging})})),i(this,"_start",(function(t){"touchstart"===t.type&&t.preventDefault(),r._canInteract(t)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(t),r.DS.publish("Interaction:start",{event:t,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(t){var e=t.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)||!e)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(e)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(e)):r.DS.SelectedSet.add(e)),!!r.DS.SelectedSet.has(e))})),i(this,"onClick",(function(t){var e=t.event;if(r._canInteract(e)&&!(e.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(e);var c=e.target;a.has(c)&&(o.isMultiSelectKeyPressed(e)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(t.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(t.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),t.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(t){var e=t.event,n=t.scroll_directions,s=t.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:e,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(t){return r.DS.publish("Interaction:end:pre",{event:t,isDragging:r.isDragging})})),i(this,"_reset",(function(t){var e=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:t,isDragging:e})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(t){var e=t.settings;r.stop(e["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(t){var e=t.event;return r.start(e)})),this.DS.subscribe("Interaction:start:pre",(function(t){var e=t.event;return r._start(e)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(t){var e=t.event;return r._reset(e)})),this.DS.subscribe("Area:scroll",this.update)}return s(t,[{key:"_canInteract",value:function(t){var e=0===t.clientX&&0===t.clientY&&0===t.detail&&t.target;return!(2===t.button||this.isInteracting||t.target&&!this.DS.SelectorArea.isInside(t.target)||!e&&!this.DS.SelectorArea.isClicked(t))}}]),t}(),U=s((function t(e){var r=this,s=e.DS;n(this,t),i(this,"subscribers",{}),i(this,"subscribe",(function(t,e){return Array.isArray(r.subscribers[t])||(r.subscribers[t]=[]),r.subscribers[t].push(e),r.subscribers[t].length-1})),i(this,"unsubscribe",(function(t,e,n){n>=0?r.subscribers[t].splice(n,1):e&&(r.subscribers[t]=r.subscribers[t].filter((function(t){return t!==e})))})),i(this,"publish",(function(t,e){Array.isArray(t)?t.forEach((function(t){return r._publish(t,e)})):r._publish(t,e)})),i(this,"_publish",(function(t,e){var n=r.subscribers[t];Array.isArray(n)&&(t.includes(":pre")?r._handlePrePublish(n,e):r._handlePublish(n,e))})),i(this,"_handlePublish",(function(t,e){for(var n=0,s=t.length;n<s;n++){if(r.DS.stopped)return;t[n](e)}})),i(this,"_handlePrePublish",(function(t,e){for(var n=t.length;n--;){if(r.DS.stopped)return;t[n](e)}})),this.DS=s})),X=function(t){o(r,t);var e=p(r);function r(t){var s,o=t.DS;return n(this,r),i(h(s=e.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return z(s.Settings.selectables).forEach((function(t){return s.add(t)}))})),i(h(s),"clear",(function(){return s.forEach((function(t){return s.delete(t)}))})),i(h(s),"_onClick",(function(t){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:t})})),i(h(s),"_onPointer",(function(t){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:t})})),i(h(s),"addAll",(function(t){return t.forEach((function(t){return s.add(t)}))})),i(h(s),"deleteAll",(function(t){return t.forEach((function(t){return s.delete(t)}))})),i(h(s),"getRect",(function(t){return s._rects?s.rects.get(t):t.getBoundingClientRect()})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(t){var e=t.settings;s.forEach((function(t){t.classList.remove(e["selectableClass:pre"]),t.classList.add(e.selectableClass)}))})),s}return s(r,[{key:"add",value:function(t){if(!g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selectable:added:pre",e),t.classList.add(this.Settings.selectableClass),t.addEventListener("click",this._onClick),this.Settings.usePointerEvents?t.addEventListener("pointerdown",this._onPointer,{passive:!1}):t.addEventListener("mousedown",this._onPointer),t.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(t),node:t}),this.DS.publish("Selectable:added",e),g(a(r.prototype),"add",this).call(this,t)}}},{key:"delete",value:function(t){if(g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selectable:removed:pre",e),t.classList.remove(this.Settings.selectableClass),t.classList.remove(this.Settings.hoverClass),t.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?t.removeEventListener("pointerdown",this._onPointer,{passive:!1}):t.removeEventListener("mousedown",this._onPointer),t.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",e),g(a(r.prototype),"delete",this).call(this,t)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var t=this;return this._rects||(this._rects=new Map,this.forEach((function(e){return t._rects.set(e,e.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return t._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(d(Set)),q=function(t){o(r,t);var e=p(r);function r(t){var s,o=t.DS;return n(this,r),i(h(s=e.call(this)),"clear",(function(){return s.forEach((function(t){return s.delete(t)}))})),i(h(s),"addAll",(function(t){return t.forEach((function(t){return s.add(t)}))})),i(h(s),"deleteAll",(function(t){return t.forEach((function(t){return s.delete(t)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(t){if(!g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selected:added:pre",e),g(a(r.prototype),"add",this).call(this,t),t.classList.add(this.DS.stores.SettingsStore.s.selectedClass),t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+1),this.DS.publish("Selected:added",e),this}}},{key:"delete",value:function(t){if(g(a(r.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};this.DS.publish("Selected:removed:pre",e);var n=g(a(r.prototype),"delete",this).call(this,t);return t.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)-1),this.DS.publish("Selected:removed",e),n}}},{key:"toggle",value:function(t){return this.has(t)?this.delete(t):this.add(t),t}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(d(Set)),$=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(t){var e=t.event;t.isDragging||(r._storePrevious(e),r._handleInsideSelection(!0,e))})),i(this,"update",(function(t){t.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(t,e){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,S=new Map,p=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=m(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){a=!0,i=t},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(p.s();!(n=p.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):S.set(g,b))}}catch(t){p.e(t)}finally{p.f()}if(!r.DS.continue){var y=r.filterSelected({select:h,unselect:S,selectorRect:d}),D=y.select,_=y.unselect;D.forEach((function(e,n){return function(t){var e=t.element,n=t.force,r=t.multiSelectionToggle,s=t.SelectedSet,i=t.hoverClassName;e.classList.contains(i)&&!n||(s.has(e)?r&&s.delete(e):s.add(e),e.classList.add(i))}({element:n,force:t,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(e,n){return function(t){var e=t.element,n=t.force,r=t.SelectedSet,s=t.PrevSelectedSet,i=t.hoverClassName;if(!e.classList.contains(i)&&!n)return!1;var o=r.has(e),a=s.has(e);o&&!a?r.delete(e):!o&&a&&r.add(e),e.classList.remove(i)}({element:n,force:t,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(t){var e=t.select,n=t.unselect;return t.selectorRect,{select:e,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(t,[{key:"_storePrevious",value:function(t){var e=this.DS,n=e.stores.KeyStore,r=e.SelectedSet;n.isMultiSelectKeyPressed(t)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),t}(),J=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var t,e,n,s;r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(t){if(!t.isDragging){var e=r.DS.stores.PointerStore.initialValArea;B(r.HTMLNode,w(e,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(t){if(!t.isDragging&&!r.DS.continue){var e=r.DS.stores,n=e.ScrollStore,s=e.PointerStore,i=function(t){var e=t.scrollAmount,n=t.initialPointerPos,r=t.pointerPos,s={};return r.x>n.x-e.x?(s.left=n.x-e.x,s.width=r.x-n.x+e.x):(s.left=r.x,s.width=n.x-r.x-e.x),r.y>n.y-e.y?(s.top=n.y-e.y,s.height=r.y-n.y+e.y):(s.top=r.y,s.height=n.y-r.y-e.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});B(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(t){var e=t.settings;r.HTMLNode.classList.remove(e["selectorClass:pre"]),r.HTMLNode.classList.add(e.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),Q=function(){function t(e){var r,s=this,o=e.DS;n(this,t),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",e=document.body?"body":"documentElement",n="".concat(t,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[e][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var t=s.DS.Area.rect,e=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(t.top+e.top,"px"),i="".concat(t.left+e.left,"px"),o="".concat(t.width,"px"),a="".concat(t.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(t){s.stopAutoScroll(),t&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var t=s.DS,e=t.stores.PointerStore,n=t.Area;s.currentEdges=x({elementRect:w(e.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(t,e){return!(!s.DS.Area.HTMLNode.contains(t)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,e||t.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(t){var e=t.settings;s.HTMLNode.classList.remove(e["selectorAreaClass:pre"]),s.HTMLNode.classList.add(e.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(t,[{key:"isClicked",value:function(t){var e=this.DS.stores.PointerStore,n=t?e.getPointerPosition(t):e.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),tt=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(t){var e=t.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:t,key:e}),r._currentValues.add(e),r.DS.publish("KeyStore:down",{event:t,key:e})})),i(this,"keyup",(function(t){var e=t.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:t,key:e}),r._currentValues.delete(e),r.DS.publish("KeyStore:up",{event:t,key:e})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(t,[{key:"isMultiSelectKeyPressed",value:function(t){var e=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(t){return t.toLocaleLowerCase()}));return!!this.currentValues.some((function(t){return n.includes(t.toLocaleLowerCase())}))||!(!t||!n.some((function(n){return t[e._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),t}(),et=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(t){return function(t){var e=t.event;return{x:e.clientX,y:e.clientY}}({event:r._normalizedEvent(t)})})),i(this,"update",(function(t){t&&(r.DS.publish("PointerStore:updated:pre",{event:t}),r.currentVal=r.getPointerPosition(t),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:t}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(t){t&&(r.currentVal=r.lastVal=r.getPointerPosition(t),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(t){var e=t.event;return r.start(e)})),this.DS.subscribe("Interaction:end",(function(t){var e=t.event;return r.reset(e)}))}return s(t,[{key:"start",value:function(t){t&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(t))}},{key:"_normalizedEvent",value:function(t){return"touches"in t&&"touchend"!==t.type&&(this._lastTouch=t),"touches"in t?this._lastTouch.touches[0]:t}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(t){this._initialVal=t,this._initialValArea=t&&_(t,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(t){this._currentVal=t,this._currentValArea=t&&_(t,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(t){this._lastVal=t,this._lastValArea=t&&_(t,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),t}(),nt=function(){function t(e){var r=this,s=e.DS;n(this,t),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=A(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=A(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(t=this.DS.stores.SettingsStore.s.area,!!((e=A(t)).x||e.y||(t instanceof Document?t.body?t.body.scrollTop=1:t.documentElement.scrollTop=1:t.scrollTop=1)));var t,e}},{key:"scrollAmount",get:function(){var t,e=_(this.currentVal,"-",this.initialVal),n={x:t=this.DS.stores.SettingsStore.s.zoom,y:t},r=_(_(e,"*",n),"-",e);return{x:e.x+r.x,y:e.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=A(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),rt=s((function t(r){var s=this,o=r.DS,a=r.settings;n(this,t),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(t){var n=t.settings,r=t.init;return s.DS.publish("Settings:updated:pre",e({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(t){for(var n=function(t,n){return e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e(e({},R("area",t.area,n,document)),R("selectables",t.selectables,n,null)),R("autoScrollSpeed",t.autoScrollSpeed,n,5)),R("overflowTolerance",t.overflowTolerance,n,{x:25,y:25})),R("zoom",t.zoom,n,1)),R("customStyles",t.customStyles,n,!1)),R("multiSelectMode",t.multiSelectMode,n,!1)),R("multiSelectToggling",t.multiSelectToggling,n,!0)),R("multiSelectKeys",t.multiSelectKeys,n,["Control","Shift","Meta"])),R("selector",t.selector,n,null)),R("selectionThreshold",t.selectionThreshold,n,0)),R("draggability",t.draggability,n,!0)),R("immediateDrag",t.immediateDrag,n,!0)),R("keyboardDrag",t.keyboardDrag,n,!0)),R("dragKeys",t.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),R("keyboardDragSpeed",t.keyboardDragSpeed,n,10)),R("useTransform",t.useTransform,n,!0)),R("refreshMemoryRate",t.refreshMemoryRate,n,80)),R("dropZones",t.dropZones,n,[])),R("dropInsideThreshold",t.dropInsideThreshold,n,1)),R("dropTargetThreshold",t.dropTargetThreshold,n,0)),R("usePointerEvents",t.usePointerEvents,n,!1)),R("hoverClass",t.hoverClass,n,"ds-hover")),R("selectableClass",t.selectableClass,n,"ds-selectable")),R("selectedClass",t.selectedClass,n,"ds-selected")),R("selectorClass",t.selectorClass,n,"ds-selector")),R("selectorAreaClass",t.selectorAreaClass,n,"ds-selector-area")),R("droppedTargetClass",t.droppedTargetClass,n,"ds-dropped-target")),R("droppedInsideClass",t.droppedInsideClass,n,"ds-dropped-inside")),R("droppableClass",t.droppableClass,n,"ds-droppable")),R("dropZoneClass",t.dropZoneClass,n,"ds-dropzone")),R("dropZoneReadyClass",t.dropZoneReadyClass,n,"ds-dropzone-ready")),R("dropZoneTargetClass",t.dropZoneTargetClass,n,"ds-dropzone-target")),R("dropZoneInsideClass",t.dropZoneInsideClass,n,"ds-dropzone-inside")),R("dragAsBlock",t.dragAsBlock,n,!1))}(t.settings,t.init),r=function(){var t,e=v(a[o],2),n=e[0],r=e[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(t){return s.update({settings:i({},n,t)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(t={},i(t,n,s._settings[n]),i(t,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),t)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),st=function(){function t(r){var s=this;n(this,t),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(t){return s.stores.SettingsStore.update({settings:t})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(t){return s.stores.KeyStore.isMultiSelectKeyPressed(t)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(t){var e;return null===(e=s.DropZones.getTarget(t))||void 0===e?void 0:e.toObject()})),i(this,"getItemsDroppedByZoneId",(function(t){return s.DropZones.getItemsDroppedById(t)})),i(this,"getItemsInsideByZoneId",(function(t,e){return s.DropZones.getItemsInsideById(t,e)})),this.PubSub=new U({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new rt({DS:this,settings:r}),this.stores.PointerStore=new et({DS:this}),this.stores.ScrollStore=new nt({DS:this}),this.stores.KeyStore=new tt({DS:this}),this.Area=new H({DS:this}),this.Selector=new J({DS:this}),this.SelectorArea=new Q({DS:this}),this.SelectableSet=new X({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new $({DS:this}),this.Drag=new F({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new G({DS:this}),function(t){for(var n=t.subscribe,r=t.publish,s=t.Interaction,i=t.SelectedSet,o=t.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(t){return t.event}}],"Interaction:end":[{name:"callback",extraData:function(){var t=o.getTarget();return e({},t?{dropTarget:t.toObject()}:{})}}]},l=function(){var t=v(u[c],2),o=t[0],a=t[1];["pre",!1].forEach((function(t){return n(t?"".concat(o,":").concat(t):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(t?"".concat(t).concat(o.name):o.name,e(e({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(t,[{key:"stop",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(t),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),t&&this.SelectableSet.clear(),e&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(z(t)),n||this.addSelectables(t),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(z(t)),n&&this.removeSelectables(t),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return z(t).forEach((function(s){return e.SelectedSet.has(s)?e.removeSelection(t,n,r):e.addSelection(t,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(t,e,n),this.getSelection()}},{key:"clearSelection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(t,e,n){var r=z(t);return this.SelectableSet.addAll(r),e&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),t}},{key:"setSelectables",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(t,e),this.addSelectables(t,n)}},{key:"removeSelectables",value:function(t,e,n){return this.SelectableSet.deleteAll(z(t)),e&&this.removeSelection(t),n&&this.PubSub.publish("callback",{items:this.getSelection()}),t}}]),t}();return st.isCollision=O,st})); |
@@ -1,6 +0,4 @@ | ||
declare function _default(elements: DSElements): DSBoundingRect; | ||
declare function _default(elements: DSElements, SelectableSet: SelectableSet): DSBoundingRect; | ||
export default _default; | ||
import { SelectableSet } from "../modules"; | ||
import "../types" | ||
import "../types" | ||
import "../types" | ||
import "../types" |
@@ -10,2 +10,3 @@ export * as vect2 from "./vect2"; | ||
export { default as getAreaRect } from "./getAreaRect"; | ||
export { default as getBoundingClientRect } from "./getBoundingClientRect"; | ||
export { default as getCurrentScroll } from "./getCurrentScroll"; | ||
@@ -12,0 +13,0 @@ export { default as getOverflowEdges } from "./getOverflowEdges"; |
@@ -35,2 +35,7 @@ export default class Drag { | ||
private _dragKeysFlat; | ||
/** | ||
* @type {DSBoundingRect} | ||
* @private | ||
*/ | ||
private _selectionRect; | ||
DS: DragSelect; | ||
@@ -55,2 +60,9 @@ assignDragkeys: () => void; | ||
}) => void; | ||
/** | ||
* Modify direction value so that the rect of draggable elements | ||
* does not exceed the boundaries of container rect | ||
* @param {Vect2} direction | ||
* @return {Vect2} | ||
*/ | ||
limitDirection: (direction: Vect2) => Vect2; | ||
handleZIndex: (add: any) => void; | ||
@@ -57,0 +69,0 @@ get _cursorDiff(): Vect2; |
@@ -33,2 +33,4 @@ export default class SelectableSet extends Set<any> { | ||
deleteAll: (elements: DSElements) => void; | ||
/** @param {DSElement} element */ | ||
getRect: (element: DSElement) => DSBoundingRect | DOMRect; | ||
/** @return {DSElements} */ | ||
@@ -35,0 +37,0 @@ get elements(): DSElements; |
@@ -141,2 +141,6 @@ /** | ||
dropZoneInsideClass?: string; | ||
/** | ||
* whether to drag multiple elements as a single block or as individual items | ||
*/ | ||
dragAsBlock?: boolean; | ||
}; | ||
@@ -143,0 +147,0 @@ /** |
{ | ||
"name": "dragselect", | ||
"version": "2.6.1", | ||
"version": "2.7.0", | ||
"description": "Easy JavaScript library for selecting and moving elements. With no dependencies. Drag-Select & Drag-And-Drop.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/DragSelect.js", |
@@ -255,2 +255,3 @@ /** | ||
), | ||
...hydrateHelper('dragAsBlock', settings.dragAsBlock, withFallback, false), | ||
}) |
@@ -10,2 +10,3 @@ export * as vect2 from './vect2' | ||
export { default as getAreaRect } from './getAreaRect' | ||
export { default as getBoundingClientRect } from './getBoundingClientRect' | ||
export { default as getCurrentScroll } from './getCurrentScroll' | ||
@@ -12,0 +13,0 @@ export { default as getOverflowEdges } from './getOverflowEdges' |
@@ -5,3 +5,8 @@ // @ts-check | ||
import { vect2, moveElement, handleKeyboardDragPosDifference } from '../methods' | ||
import { | ||
getBoundingClientRect, | ||
handleKeyboardDragPosDifference, | ||
moveElement, | ||
vect2, | ||
} from '../methods' | ||
@@ -40,2 +45,8 @@ export default class Drag { | ||
/** | ||
* @type {DSBoundingRect} | ||
* @private | ||
*/ | ||
_selectionRect | ||
/** | ||
* @constructor Drag | ||
@@ -100,5 +111,7 @@ * @param {{DS:DragSelect}} obj | ||
this._elements = this.DS.getSelection() | ||
if (this.DS.stores.SettingsStore.s.dragAsBlock) | ||
this._selectionRect = getBoundingClientRect(this._elements, this.DS.SelectableSet) | ||
this.handleZIndex(true) | ||
const posDirection = handleKeyboardDragPosDifference({ | ||
let posDirection = handleKeyboardDragPosDifference({ | ||
shiftKey: this.DS.stores.KeyStore.currentValues.includes('shift'), | ||
@@ -114,2 +127,5 @@ keyboardDragSpeed: this.DS.stores.SettingsStore.s.keyboardDragSpeed, | ||
if (this.DS.stores.SettingsStore.s.dragAsBlock) | ||
posDirection = this.limitDirection(posDirection) | ||
this._elements.forEach((element) => | ||
@@ -152,2 +168,4 @@ moveElement({ | ||
this._elements = this.DS.getSelection() | ||
if (this.DS.stores.SettingsStore.s.dragAsBlock) | ||
this._selectionRect = getBoundingClientRect(this._elements, this.DS.SelectableSet) | ||
this.handleZIndex(true) | ||
@@ -173,3 +191,5 @@ } | ||
const posDirection = vect2.calc(this._cursorDiff, '+', this._scrollDiff) | ||
let posDirection = vect2.calc(this._cursorDiff, '+', this._scrollDiff) | ||
if (this.DS.stores.SettingsStore.s.dragAsBlock) | ||
posDirection = this.limitDirection(posDirection) | ||
@@ -186,2 +206,33 @@ this._elements.forEach((element) => | ||
/** | ||
* Modify direction value so that the rect of draggable elements | ||
* does not exceed the boundaries of container rect | ||
* @param {Vect2} direction | ||
* @return {Vect2} | ||
*/ | ||
limitDirection = (direction) => { | ||
const containerRect = this.DS.SelectorArea.rect; | ||
const scrollAmount = this.DS.stores.ScrollStore.scrollAmount; | ||
const delta = { | ||
top: containerRect.top - this._selectionRect.top + scrollAmount.y, | ||
left: containerRect.left - this._selectionRect.left + scrollAmount.x, | ||
bottom: containerRect.bottom - this._selectionRect.bottom + scrollAmount.y, | ||
right: containerRect.right - this._selectionRect.right + scrollAmount.x, | ||
} | ||
if(direction.x === 0 && direction.y === 0) return direction | ||
if (direction.y < 0) direction.y = Math.max(direction.y, delta.top) | ||
if (direction.x < 0) direction.x = Math.max(direction.x, delta.left) | ||
if (direction.y > 0) direction.y = Math.min(direction.y, delta.bottom) | ||
if (direction.x > 0) direction.x = Math.min(direction.x, delta.right) | ||
this._selectionRect.top += direction.y; | ||
this._selectionRect.bottom += direction.y; | ||
this._selectionRect.left += direction.x; | ||
this._selectionRect.right += direction.x; | ||
return direction | ||
} | ||
handleZIndex = (add) => { | ||
@@ -188,0 +239,0 @@ this._elements.forEach( |
@@ -120,2 +120,5 @@ // @ts-check | ||
/** @param {DSElement} element */ | ||
getRect = (element) => this._rects ? this.rects.get(element) : element.getBoundingClientRect() | ||
/** @return {DSElements} */ | ||
@@ -122,0 +125,0 @@ get elements() { |
@@ -38,2 +38,3 @@ /** | ||
* @property {string} [dropZoneInsideClass=ds-dropzone-inside] on dropZone that has elements inside after any drop | ||
* @property {boolean} [dragAsBlock=false] whether to drag multiple elements as a single block or as individual items | ||
*/ | ||
@@ -40,0 +41,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
597628
111
12657