Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dragselect

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dragselect - npm Package Compare versions

Comparing version 2.5.4 to 2.5.5

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 2.5.5
- Fix bug where setting a new area via `.setSettings({ area: '...' })` would not remove the old event listeners. Which causes the mobile touch scroll from being blocked when switching between the Document to an areas.
# 2.5.4

@@ -2,0 +6,0 @@

4

dist/DragSelect.d.ts

@@ -88,6 +88,6 @@ export default DragSelect;

* @param {boolean} [triggerCallback] - if callback should be called
* @param {boolean} [alsoSelectables] - if element should not be added/removed to the list of selectable elements accordingly
* @param {boolean} [removeFromSelectables] - if element should not be added/removed to the list of selectable elements accordingly
* @return {DSElements} all selected elements
*/
toggleSelection(elements: DSInputElements, triggerCallback?: boolean, alsoSelectables?: boolean): DSElements;
toggleSelection(elements: DSInputElements, triggerCallback?: boolean, removeFromSelectables?: boolean): DSElements;
/**

@@ -94,0 +94,0 @@ * Sets the current selected elements and optionally run the callback

@@ -1,1 +0,1 @@

function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var s=e[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function n(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,s)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return 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}}),e&&l(t,e)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function l(t,e){return l=Object.setPrototypeOf||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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,n){return u=c()?Reflect.construct:function(t,e,n){var s=[null];s.push.apply(s,e);var r=new(Function.bind.apply(t,s));return n&&l(r,n.prototype),r},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,s)}function s(){return u(t,arguments,a(this).constructor)}return s.prototype=Object.create(t.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,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){return!e||"object"!=typeof e&&"function"!=typeof e?h(t):e}function p(t){var e=c();return function(){var n,s=a(t);if(e){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return S(this,n)}}function f(t,e,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var s=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(s){var r=Object.getOwnPropertyDescriptor(s,e);return r.get?r.get.call(n):r.value}},f(t,e,n||t)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);s=!0);}catch(t){r=!0,i=t}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(t,e)||b(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 v(t){return function(t){if(Array.isArray(t))return m(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||b(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 b(t,e){if(t){if("string"==typeof t)return m(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)?m(t,e):void 0}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n<e;n++)s[n]=t[n];return s}var y=function(t,e,n){var s=t.x,r=t.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[e]},D=function(t){return{x:t.left,y:t.top}},_=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}},I=function(t,e){var n=e;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);t.forEach((function(t,e){s.observe(t,{childList:0!==e,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(t,e){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,t.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,e)}},w=function(){var t,e,n,s;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===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(t){return function t(e){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=e[s])||void 0===n?void 0:n.parentNode;return r?(e.push(r),t(e,++s)):e}([t])},C=function(t){return!t||t instanceof Document?w():{x:t.scrollLeft>=0?t.scrollLeft:w().x,y:t.scrollTop>=0?t.scrollTop:w().y}},A=function(t){var e=t.elementRect,n=t.containerRect,s=t.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return e.top-r.y<n.top&&i.push("top"),e.left-r.x<n.left&&i.push("left"),e.bottom+r.y>n.bottom&&i.push("bottom"),e.right+r.y>n.right&&i.push("right"),i},E=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 s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.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},T=function(t,e){return e?function(t){var e=t.style.transform;if(!e||e.indexOf("translate")<0)return E(t);var n={x:0,y:0},s=e.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.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:E(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 s=window.getComputedStyle(t);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(t)},x=function(t){var e=t.computedStyle,n=t.node,s=e.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(t,e,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(t,'" is not of type "').concat(e,'".'))},M=function(t,e,n,r){if(void 0===e)return n?s({},t,r):{};if(null===e)return s({},t,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof e||e instanceof String),a&&!i&&(o=!0,k(t,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(e)&&"number"==typeof e),l&&!i&&(o=!0,k(t,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(e)),c&&!i&&(o=!0,k(t,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof e),u&&!i&&(o=!0,k(t,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(e)),d&&!i&&(o=!0,k(t,"array"));var h=o||n;return"dragKeys"===t&&i?s({},t,Object.assign(r,e)):"dragKeys"!==t||i?("dropZones"===t&&i&&new Set(e.map((function(t){return t.id}))).size!==e.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},t,e):h?s({},t,r):{}):h?s({},t,r):{}},V=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=t;if(n>0){var r=(t.right-t.left)*n,i=(t.bottom-t.top)*n;s={left:t.left+r,right:t.right-r,top:t.top+i,bottom:t.bottom-i}}return s.left<e.right&&s.right>e.left&&s.top<e.bottom&&s.bottom>e.top},N=function(t){var e=t.element,n=t.posDirection,s=t.containerRect,r=t.useTransform,i=T(e,r),o=y(i,"+",n);O(e,o,r);var a=e.getBoundingClientRect();!function(t){var e=t.element,n=t.edges,s=t.elementRect,r=t.containerRect,i=t.elementPos,o=t.useTransform;n.includes("top")&&O(e,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(e,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(e,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(e,{y:i.y,x:i.x+r.right-s.right},o)}({element:e,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(t,e){window.removeEventListener("resize",e),window.removeEventListener("scroll",e),t.disconnect()},O=function(t,e,n){if(n){var s=t.style.transform;t.style.transform="translate3d(".concat(e.x,"px,").concat(e.y,"px,1px) ").concat(s.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]:v(new Set(v(t))):[]},z=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 e(n){var r=this,i=n.DS;t(this,e),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(t){r._node=t,x({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})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((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))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(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 s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=t instanceof Document?s||document.body:t,i=e.includes("top")&&r.scrollTop>0,o=e.includes("bottom")&&r.scrollTop<r.scrollHeight,a=e.includes("left")&&r.scrollLeft>0,l=e.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,t,e),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(t){var e=t.settings;return r.setArea(e.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return n(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(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=P(this.HTMLNode)}}]),e}(),R=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(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(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(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.handleZIndex(!0);var i=function(t){var e=t.shiftKey,n=t.keyboardDragSpeed,s=t.zoom,r=t.key,i=t.dragKeys,o=t.scrollDiff,a=t.canScroll,l=t.scrollCallback,c={x:0,y:0},u=e?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,e||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,e||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,e||o.y||!a||l(["top"],n)),i.down.includes(r)&&(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._elements.forEach((function(t){return N({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)}})),s(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)}})),s(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.handleZIndex(!0))})),s(this,"stop",(function(t){null!=t&&t.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(t){var e=t.isDragging,n=t.isDraggingKeyboard;if(e&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(t){return N({element:t,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(t){r._elements.forEach((function(e){return e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+t?9999:-9998)}))})),this.DS=i,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 n(e,[{key:"_cursorDiff",get:function(){var t=this.DS.stores.PointerStore.currentVal,e=this._prevCursorPos?y(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?y(t,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=t,e}}]),e}(),j=function(){function e(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;t(this,e),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(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)))}})),s(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)))})),s(this,"handleDrop",(function(){var t,e,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(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)))})),s(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))})),s(this,"start",(function(t){t.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(t){t.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.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.classList.remove(e["dropZoneClass:pre"]),r.element.classList.add(e.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(e,[{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 V(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=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(t){this._droppables=t}}]),e}(),B=function e(n){var r=this,o=n.DS;t(this,e),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(t){var e=t.dropZones;e&&(r._zones&&r._zones.forEach((function(t){return t.destroy()})),r._zones=e.map((function(t){return new j(i({DS:r.DS},t))})),r._zones.forEach((function(t){r._zoneByElement.set(t.element,t),r._zoneById.set(t.id,t),t.droppables.forEach((function(e){var n=r._zonesByDroppable.get(e);if(null==n||!n.length)return r._zonesByDroppable.set(e,[t]);r._zonesByDroppable.set(e,v(new Set([].concat(v(n),[t]))))}))})))})),s(this,"_handleDrop",(function(t){r._zones.forEach((function(e){e!==t&&e.handleNoDrop()})),t&&t.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(t,e){for(var n=e.x,s=e.y,i=0,o=t.length;i<o;i++){var a=r._zoneByElement.get(t[i]);if(a&&V(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(t){if(t.isDragging){var e=r.getTarget();r._handleDrop(e)}})),s(this,"getItemsDroppedById",(function(t){var e=r._zoneById.get(t);return e?e.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(t,")"))})),s(this,"getItemsInsideById",(function(t,e){var n=r._zoneById.get(t);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(t,")"));var s=n.itemsInside;return e&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(t){var e;if(null!==(e=r._zones)&&void 0!==e&&e.length){var n=(null==t?void 0:t.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==t?void 0:t.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(t){var e=t.settings;return r.setDropZones(e)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(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",{})})),s(this,"start",(function(t){return r.DS.publish("Interaction:start:pre",{event:t,isDragging:r.isDragging})})),s(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))})),s(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))})),s(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())}})),s(this,"stop",(function(){r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(r.DS.Area.HTMLNode.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(r.DS.Area.HTMLNode.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),r.DS.Area.HTMLNode.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),s(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})})),s(this,"reset",(function(t){return r.DS.publish("Interaction:end:pre",{event:t,isDragging:r.isDragging})})),s(this,"_reset",(function(t){var e=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:t,isDragging:e})})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",this.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 n(e,[{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))}}]),e}(),W=function e(n){var r=this,i=n.DS;t(this,e),s(this,"subscribers",{}),s(this,"subscribe",(function(t,e){return Array.isArray(r.subscribers[t])||(r.subscribers[t]=[]),r.subscribers[t].push(e),r.subscribers[t].length-1})),s(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})))})),s(this,"publish",(function(t,e){Array.isArray(t)?t.forEach((function(t){return r._publish(t,e)})):r._publish(t,e)})),s(this,"_publish",(function(t,e){var n=r.subscribers[t];Array.isArray(n)&&(t.includes(":pre")?r._handlePrePublish(n,e):r._handlePublish(n,e))})),s(this,"_handlePublish",(function(t,e){for(var n=0,s=t.length;n<s;n++){if(r.DS.stopped)return;t[n](e)}})),s(this,"_handlePrePublish",(function(t,e){for(var n=t.length;n--;){if(r.DS.stopped)return;t[n](e)}})),this.DS=i},U=function(e){o(i,d(Set));var r=p(i);function i(e){var n,o=e.DS;return t(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(t){return n.add(t)}))})),s(h(n),"clear",(function(){return n.forEach((function(t){return n.delete(t)}))})),s(h(n),"_onClick",(function(t){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:t})})),s(h(n),"_onPointer",(function(t){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:t})})),s(h(n),"addAll",(function(t){return t.forEach((function(t){return n.add(t)}))})),s(h(n),"deleteAll",(function(t){return t.forEach((function(t){return n.delete(t)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(t){var e=t.settings;n.forEach((function(t){t.classList.remove(e["selectableClass:pre"]),t.classList.add(e.selectableClass)}))})),n}return n(i,[{key:"add",value:function(t){if(!f(a(i.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&&x({computedStyle:window.getComputedStyle(t),node:t}),this.DS.publish("Selectable:added",e),f(a(i.prototype),"add",this).call(this,t)}}},{key:"delete",value:function(t){if(f(a(i.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),f(a(i.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}}]),i}(),X=function(e){o(i,d(Set));var r=p(i);function i(e){var n,o=e.DS;return t(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(t){return n.delete(t)}))})),s(h(n),"addAll",(function(t){return t.forEach((function(t){return n.add(t)}))})),s(h(n),"deleteAll",(function(t){return t.forEach((function(t){return n.delete(t)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(t){if(!f(a(i.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selected:added:pre",e),f(a(i.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(f(a(i.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};this.DS.publish("Selected:removed:pre",e);var n=f(a(i.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())}}]),i}(),Y=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(t){var e=t.event;t.isDragging||(r._storePrevious(e),r._handleInsideSelection(!0,e))})),s(this,"update",(function(t){t.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(t,e){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=b(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var s=0,r=function(){};return{s:r,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:r}}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=t[Symbol.iterator]()},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}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],S=d[1];o.isInside(h,S)&&(V(S,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(t){u.e(t)}finally{u.f()}var p=r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(e){return function(t){var e=t.element,n=t.force,s=t.multiSelectionToggle,r=t.SelectedSet,i=t.hoverClassName;e.classList.contains(i)&&!n||(r.has(e)?s&&r.delete(e):r.add(e),e.classList.add(i))}({element:e,force:t,multiSelectionToggle:p,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(e){return function(t){var e=t.element,n=t.force,s=t.SelectedSet,r=t.PrevSelectedSet,i=t.hoverClassName;if(!e.classList.contains(i)&&!n)return!1;var o=s.has(e),a=r.has(e);o&&!a?s.delete(e):!o&&a&&s.add(e),e.classList.remove(i)}({element:e,force:t,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(e,[{key:"_storePrevious",value:function(t){var e=this.DS,n=e.stores.KeyStore,s=e.SelectedSet;n.isMultiSelectKeyPressed(t)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),e}(),q=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_rect",void 0),s(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)})),s(this,"start",(function(t){if(!t.isDragging){var e=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(e,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(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,s=t.pointerPos,r={};return s.x>n.x-e.x?(r.left=n.x-e.x,r.width=s.x-n.x+e.x):(r.left=s.x,r.width=n.x-s.x-e.x),s.y>n.y-e.y?(r.top=n.y-e.y,r.height=s.y-n.y+e.y):(r.top=s.y,r.height=n.y-s.y-e.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,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 n(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),G=function(){function e(n){var r,i=this,o=n.DS;t(this,e),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",e=document.body?"body":"documentElement",n="".concat(t,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[e][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var t=i.DS.Area.rect,e=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(t.top+e.top,"px"),r="".concat(t.left+e.left,"px"),o="".concat(t.width,"px"),a="".concat(t.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(t){i.stopAutoScroll(),t&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var t=i.DS,e=t.stores.PointerStore,n=t.Area;i.currentEdges=A({elementRect:_(e.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(t,e){return!(!i.DS.Area.HTMLNode.contains(t)||!i.DS.stores.ScrollStore.canScroll)||V(i.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;i.HTMLNode.classList.remove(e["selectorAreaClass:pre"]),i.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(){i.updatePos(),i.stopAutoScroll()}))}return n(e,[{key:"isClicked",value:function(t){var e=this.DS.stores.PointerStore,n=t?e.getPointerPosition(t):e.initialVal;return V({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}(),$=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(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})})),s(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})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(e,[{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())}}]),e}(),J=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(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})})),s(this,"getPointerPosition",(function(t){return function(t){var e=t.event;return{x:e.clientX,y:e.clientY}}({event:r._normalizedEvent(t)})})),s(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}))})),s(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)})),s(this,"reset",(function(t){t&&(r.currentVal=r.lastVal=r.getPointerPosition(t),r.stop(),r.init())})),this.DS=i,this.Settings=i.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 n(e,[{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&&y(t,"-",y(D(this.DS.Area.rect),"+",D(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&&y(t,"-",y(D(this.DS.Area.rect),"+",D(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&&y(t,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),e}(),Q=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,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 n(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(t=this.DS.stores.SettingsStore.s.area,!!((e=C(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=y(this.currentVal,"-",this.initialVal),n={x:t=this.DS.stores.SettingsStore.s.zoom,y:t},s=y(y(e,"*",n),"-",e);return{x:e.x+s.x,y:e.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),tt=function e(n){var r=this,o=n.DS,a=n.settings;t(this,e),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(t){var e=t.settings,n=t.init;return r.DS.publish("Settings:updated:pre",i({settings:e},n?{init:n}:{}))})),s(this,"_update",(function(t){for(var e=function(t,e){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},M("area",t.area,e,document)),M("selectables",t.selectables,e,null)),M("autoScrollSpeed",t.autoScrollSpeed,e,5)),M("overflowTolerance",t.overflowTolerance,e,{x:25,y:25})),M("zoom",t.zoom,e,1)),M("customStyles",t.customStyles,e,!1)),M("multiSelectMode",t.multiSelectMode,e,!1)),M("multiSelectToggling",t.multiSelectToggling,e,!0)),M("multiSelectKeys",t.multiSelectKeys,e,["Control","Shift","Meta"])),M("selector",t.selector,e,null)),M("selectionThreshold",t.selectionThreshold,e,0)),M("draggability",t.draggability,e,!0)),M("immediateDrag",t.immediateDrag,e,!0)),M("keyboardDrag",t.keyboardDrag,e,!0)),M("dragKeys",t.dragKeys,e,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),M("keyboardDragSpeed",t.keyboardDragSpeed,e,10)),M("useTransform",t.useTransform,e,!0)),M("refreshMemoryRate",t.refreshMemoryRate,e,80)),M("dropZones",t.dropZones,e,[])),M("dropInsideThreshold",t.dropInsideThreshold,e,1)),M("dropTargetThreshold",t.dropTargetThreshold,e,0)),M("usePointerEvents",t.usePointerEvents,e,!1)),M("hoverClass",t.hoverClass,e,"ds-hover")),M("selectableClass",t.selectableClass,e,"ds-selectable")),M("selectedClass",t.selectedClass,e,"ds-selected")),M("selectorClass",t.selectorClass,e,"ds-selector")),M("selectorAreaClass",t.selectorAreaClass,e,"ds-selector-area")),M("droppedTargetClass",t.droppedTargetClass,e,"ds-dropped-target")),M("droppedInsideClass",t.droppedInsideClass,e,"ds-dropped-inside")),M("droppableClass",t.droppableClass,e,"ds-droppable")),M("dropZoneClass",t.dropZoneClass,e,"ds-dropzone")),M("dropZoneReadyClass",t.dropZoneReadyClass,e,"ds-dropzone-ready")),M("dropZoneTargetClass",t.dropZoneTargetClass,e,"ds-dropzone-target")),M("dropZoneInsideClass",t.dropZoneInsideClass,e,"ds-dropzone-inside"))}(t.settings,t.init),n=function(){var t,e=g(a[o],2),n=e[0],i=e[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(t){return r.update({settings:s({},n,t)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(t={},s(t,n,r._settings[n]),s(t,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),t)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(e);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},et=function(){function e(n){var r=this;t(this,e),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(t){return r.stores.SettingsStore.update({settings:t})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(t){return r.stores.KeyStore.isMultiSelectKeyPressed(t)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(t){var e;return null===(e=r.DropZones.getTarget(t))||void 0===e?void 0:e.toObject()})),s(this,"getItemsDroppedByZoneId",(function(t){return r.DropZones.getItemsDroppedById(t)})),s(this,"getItemsInsideByZoneId",(function(t,e){return r.DropZones.getItemsInsideById(t,e)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new tt({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new H({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new R({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(t){for(var e=t.subscribe,n=t.publish,s=t.Interaction,r=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 i({},t?{dropTarget:t.toObject()}:{})}}]},l=function(){var t=g(u[c],2),o=t[0],a=t[1];["pre",!1].forEach((function(t){return e(t?"".concat(o,":").concat(t):o,(function(e){return a.forEach((function(o){return(!o.condition||o.condition(e))&&n(t?"".concat(t).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},e),o.extraData?o.extraData(e):{}))}))}))}))},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 r.continue=!1})),this.start()}return n(e,[{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],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(t).forEach((function(r){return e.SelectedSet.has(r)?e.removeSelection(t,n,s):e.addSelection(t,n,s)})),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 s=Z(t);return this.SelectableSet.addAll(s),e&&this.SelectedSet.addAll(s),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}}]),e}();export default et;
function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var s=e[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function n(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,s)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return 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}}),e&&l(t,e)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function l(t,e){return l=Object.setPrototypeOf||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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,n){return u=c()?Reflect.construct:function(t,e,n){var s=[null];s.push.apply(s,e);var r=new(Function.bind.apply(t,s));return n&&l(r,n.prototype),r},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,s)}function s(){return u(t,arguments,a(this).constructor)}return s.prototype=Object.create(t.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,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){return!e||"object"!=typeof e&&"function"!=typeof e?h(t):e}function p(t){var e=c();return function(){var n,s=a(t);if(e){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return S(this,n)}}function f(t,e,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var s=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(s){var r=Object.getOwnPropertyDescriptor(s,e);return r.get?r.get.call(n):r.value}},f(t,e,n||t)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);s=!0);}catch(t){r=!0,i=t}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(t,e)||b(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 v(t){return function(t){if(Array.isArray(t))return m(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||b(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 b(t,e){if(t){if("string"==typeof t)return m(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)?m(t,e):void 0}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n<e;n++)s[n]=t[n];return s}var y=function(t,e,n){var s=t.x,r=t.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[e]},D=function(t){return{x:t.left,y:t.top}},_=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}},I=function(t,e){var n=e;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);t.forEach((function(t,e){s.observe(t,{childList:0!==e,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(t,e){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,t.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,e)}},w=function(){var t,e,n,s;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===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(t){return function t(e){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=e[s])||void 0===n?void 0:n.parentNode;return r?(e.push(r),t(e,++s)):e}([t])},C=function(t){return!t||t instanceof Document?w():{x:t.scrollLeft>=0?t.scrollLeft:w().x,y:t.scrollTop>=0?t.scrollTop:w().y}},A=function(t){var e=t.elementRect,n=t.containerRect,s=t.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return e.top-r.y<n.top&&i.push("top"),e.left-r.x<n.left&&i.push("left"),e.bottom+r.y>n.bottom&&i.push("bottom"),e.right+r.y>n.right&&i.push("right"),i},E=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 s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.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},T=function(t,e){return e?function(t){var e=t.style.transform;if(!e||e.indexOf("translate")<0)return E(t);var n={x:0,y:0},s=e.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.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:E(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 s=window.getComputedStyle(t);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(t)},x=function(t){var e=t.computedStyle,n=t.node,s=e.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(t,e,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(t,'" is not of type "').concat(e,'".'))},V=function(t,e,n,r){if(void 0===e)return n?s({},t,r):{};if(null===e)return s({},t,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof e||e instanceof String),a&&!i&&(o=!0,k(t,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(e)&&"number"==typeof e),l&&!i&&(o=!0,k(t,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(e)),c&&!i&&(o=!0,k(t,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof e),u&&!i&&(o=!0,k(t,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(e)),d&&!i&&(o=!0,k(t,"array"));var h=o||n;return"dragKeys"===t&&i?s({},t,Object.assign(r,e)):"dragKeys"!==t||i?("dropZones"===t&&i&&new Set(e.map((function(t){return t.id}))).size!==e.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},t,e):h?s({},t,r):{}):h?s({},t,r):{}},M=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=t;if(n>0){var r=(t.right-t.left)*n,i=(t.bottom-t.top)*n;s={left:t.left+r,right:t.right-r,top:t.top+i,bottom:t.bottom-i}}return s.left<e.right&&s.right>e.left&&s.top<e.bottom&&s.bottom>e.top},N=function(t){var e=t.element,n=t.posDirection,s=t.containerRect,r=t.useTransform,i=T(e,r),o=y(i,"+",n);O(e,o,r);var a=e.getBoundingClientRect();!function(t){var e=t.element,n=t.edges,s=t.elementRect,r=t.containerRect,i=t.elementPos,o=t.useTransform;n.includes("top")&&O(e,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(e,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(e,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(e,{y:i.y,x:i.x+r.right-s.right},o)}({element:e,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(t,e){window.removeEventListener("resize",e),window.removeEventListener("scroll",e),t.disconnect()},O=function(t,e,n){if(n){var s=t.style.transform;t.style.transform="translate3d(".concat(e.x,"px,").concat(e.y,"px,1px) ").concat(s.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]:v(new Set(v(t))):[]},z=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")},R=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(t){r.reset(),r._node=t,x({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})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((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))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(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 s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=t instanceof Document?s||document.body:t,i=e.includes("top")&&r.scrollTop>0,o=e.includes("bottom")&&r.scrollTop<r.scrollHeight,a=e.includes("left")&&r.scrollLeft>0,l=e.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,t,e),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,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 n(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(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=P(this.HTMLNode)}}]),e}(),H=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(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(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(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.handleZIndex(!0);var i=function(t){var e=t.shiftKey,n=t.keyboardDragSpeed,s=t.zoom,r=t.key,i=t.dragKeys,o=t.scrollDiff,a=t.canScroll,l=t.scrollCallback,c={x:0,y:0},u=e?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,e||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,e||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,e||o.y||!a||l(["top"],n)),i.down.includes(r)&&(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._elements.forEach((function(t){return N({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)}})),s(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)}})),s(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.handleZIndex(!0))})),s(this,"stop",(function(t){null!=t&&t.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(t){var e=t.isDragging,n=t.isDraggingKeyboard;if(e&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(t){return N({element:t,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(t){r._elements.forEach((function(e){return e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+t?9999:-9998)}))})),this.DS=i,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 n(e,[{key:"_cursorDiff",get:function(){var t=this.DS.stores.PointerStore.currentVal,e=this._prevCursorPos?y(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?y(t,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=t,e}}]),e}(),j=function(){function e(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;t(this,e),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(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)))}})),s(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)))})),s(this,"handleDrop",(function(){var t,e,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(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)))})),s(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))})),s(this,"start",(function(t){t.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(t){t.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.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.classList.remove(e["dropZoneClass:pre"]),r.element.classList.add(e.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(e,[{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 M(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=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(t){this._droppables=t}}]),e}(),B=function e(n){var r=this,o=n.DS;t(this,e),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(t){var e=t.dropZones;e&&(r._zones&&r._zones.forEach((function(t){return t.destroy()})),r._zones=e.map((function(t){return new j(i({DS:r.DS},t))})),r._zones.forEach((function(t){r._zoneByElement.set(t.element,t),r._zoneById.set(t.id,t),t.droppables.forEach((function(e){var n=r._zonesByDroppable.get(e);if(null==n||!n.length)return r._zonesByDroppable.set(e,[t]);r._zonesByDroppable.set(e,v(new Set([].concat(v(n),[t]))))}))})))})),s(this,"_handleDrop",(function(t){r._zones.forEach((function(e){e!==t&&e.handleNoDrop()})),t&&t.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(t,e){for(var n=e.x,s=e.y,i=0,o=t.length;i<o;i++){var a=r._zoneByElement.get(t[i]);if(a&&M(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(t){if(t.isDragging){var e=r.getTarget();r._handleDrop(e)}})),s(this,"getItemsDroppedById",(function(t){var e=r._zoneById.get(t);return e?e.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(t,")"))})),s(this,"getItemsInsideById",(function(t,e){var n=r._zoneById.get(t);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(t,")"));var s=n.itemsInside;return e&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(t){var e;if(null!==(e=r._zones)&&void 0!==e&&e.length){var n=(null==t?void 0:t.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==t?void 0:t.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(t){var e=t.settings;return r.setDropZones(e)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(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",{})})),s(this,"start",(function(t){return r.DS.publish("Interaction:start:pre",{event:t,isDragging:r.isDragging})})),s(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))})),s(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))})),s(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())}})),s(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)})),s(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})})),s(this,"reset",(function(t){return r.DS.publish("Interaction:end:pre",{event:t,isDragging:r.isDragging})})),s(this,"_reset",(function(t){var e=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:t,isDragging:e})})),this.DS=i,this.Settings=i.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 n(e,[{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))}}]),e}(),W=function e(n){var r=this,i=n.DS;t(this,e),s(this,"subscribers",{}),s(this,"subscribe",(function(t,e){return Array.isArray(r.subscribers[t])||(r.subscribers[t]=[]),r.subscribers[t].push(e),r.subscribers[t].length-1})),s(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})))})),s(this,"publish",(function(t,e){Array.isArray(t)?t.forEach((function(t){return r._publish(t,e)})):r._publish(t,e)})),s(this,"_publish",(function(t,e){var n=r.subscribers[t];Array.isArray(n)&&(t.includes(":pre")?r._handlePrePublish(n,e):r._handlePublish(n,e))})),s(this,"_handlePublish",(function(t,e){for(var n=0,s=t.length;n<s;n++){if(r.DS.stopped)return;t[n](e)}})),s(this,"_handlePrePublish",(function(t,e){for(var n=t.length;n--;){if(r.DS.stopped)return;t[n](e)}})),this.DS=i},U=function(e){o(i,d(Set));var r=p(i);function i(e){var n,o=e.DS;return t(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(t){return n.add(t)}))})),s(h(n),"clear",(function(){return n.forEach((function(t){return n.delete(t)}))})),s(h(n),"_onClick",(function(t){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:t})})),s(h(n),"_onPointer",(function(t){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:t})})),s(h(n),"addAll",(function(t){return t.forEach((function(t){return n.add(t)}))})),s(h(n),"deleteAll",(function(t){return t.forEach((function(t){return n.delete(t)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(t){var e=t.settings;n.forEach((function(t){t.classList.remove(e["selectableClass:pre"]),t.classList.add(e.selectableClass)}))})),n}return n(i,[{key:"add",value:function(t){if(!f(a(i.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&&x({computedStyle:window.getComputedStyle(t),node:t}),this.DS.publish("Selectable:added",e),f(a(i.prototype),"add",this).call(this,t)}}},{key:"delete",value:function(t){if(f(a(i.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),f(a(i.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}}]),i}(),X=function(e){o(i,d(Set));var r=p(i);function i(e){var n,o=e.DS;return t(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(t){return n.delete(t)}))})),s(h(n),"addAll",(function(t){return t.forEach((function(t){return n.add(t)}))})),s(h(n),"deleteAll",(function(t){return t.forEach((function(t){return n.delete(t)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(t){if(!f(a(i.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};return this.DS.publish("Selected:added:pre",e),f(a(i.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(f(a(i.prototype),"has",this).call(this,t)){var e={items:this.elements,item:t};this.DS.publish("Selected:removed:pre",e);var n=f(a(i.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())}}]),i}(),Y=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(t){var e=t.event;t.isDragging||(r._storePrevious(e),r._handleInsideSelection(!0,e))})),s(this,"update",(function(t){t.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(t,e){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=b(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var s=0,r=function(){};return{s:r,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:r}}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=t[Symbol.iterator]()},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}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],S=d[1];o.isInside(h,S)&&(M(S,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(t){u.e(t)}finally{u.f()}var p=r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(e){return function(t){var e=t.element,n=t.force,s=t.multiSelectionToggle,r=t.SelectedSet,i=t.hoverClassName;e.classList.contains(i)&&!n||(r.has(e)?s&&r.delete(e):r.add(e),e.classList.add(i))}({element:e,force:t,multiSelectionToggle:p,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(e){return function(t){var e=t.element,n=t.force,s=t.SelectedSet,r=t.PrevSelectedSet,i=t.hoverClassName;if(!e.classList.contains(i)&&!n)return!1;var o=s.has(e),a=r.has(e);o&&!a?s.delete(e):!o&&a&&s.add(e),e.classList.remove(i)}({element:e,force:t,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(e,[{key:"_storePrevious",value:function(t){var e=this.DS,n=e.stores.KeyStore,s=e.SelectedSet;n.isMultiSelectKeyPressed(t)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),e}(),q=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_rect",void 0),s(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)})),s(this,"start",(function(t){if(!t.isDragging){var e=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(e,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(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,s=t.pointerPos,r={};return s.x>n.x-e.x?(r.left=n.x-e.x,r.width=s.x-n.x+e.x):(r.left=s.x,r.width=n.x-s.x-e.x),s.y>n.y-e.y?(r.top=n.y-e.y,r.height=s.y-n.y+e.y):(r.top=s.y,r.height=n.y-s.y-e.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,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 n(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),G=function(){function e(n){var r,i=this,o=n.DS;t(this,e),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",e=document.body?"body":"documentElement",n="".concat(t,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[e][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var t=i.DS.Area.rect,e=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(t.top+e.top,"px"),r="".concat(t.left+e.left,"px"),o="".concat(t.width,"px"),a="".concat(t.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(t){i.stopAutoScroll(),t&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var t=i.DS,e=t.stores.PointerStore,n=t.Area;i.currentEdges=A({elementRect:_(e.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(t,e){return!(!i.DS.Area.HTMLNode.contains(t)||!i.DS.stores.ScrollStore.canScroll)||M(i.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;i.HTMLNode.classList.remove(e["selectorAreaClass:pre"]),i.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(){i.updatePos(),i.stopAutoScroll()}))}return n(e,[{key:"isClicked",value:function(t){var e=this.DS.stores.PointerStore,n=t?e.getPointerPosition(t):e.initialVal;return M({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}(),$=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(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})})),s(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})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(e,[{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())}}]),e}(),J=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(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})})),s(this,"getPointerPosition",(function(t){return function(t){var e=t.event;return{x:e.clientX,y:e.clientY}}({event:r._normalizedEvent(t)})})),s(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}))})),s(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)})),s(this,"reset",(function(t){t&&(r.currentVal=r.lastVal=r.getPointerPosition(t),r.stop(),r.init())})),this.DS=i,this.Settings=i.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 n(e,[{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&&y(t,"-",y(D(this.DS.Area.rect),"+",D(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&&y(t,"-",y(D(this.DS.Area.rect),"+",D(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&&y(t,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),e}(),Q=function(){function e(n){var r=this,i=n.DS;t(this,e),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,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 n(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(t=this.DS.stores.SettingsStore.s.area,!!((e=C(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=y(this.currentVal,"-",this.initialVal),n={x:t=this.DS.stores.SettingsStore.s.zoom,y:t},s=y(y(e,"*",n),"-",e);return{x:e.x+s.x,y:e.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),tt=function e(n){var r=this,o=n.DS,a=n.settings;t(this,e),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(t){var e=t.settings,n=t.init;return r.DS.publish("Settings:updated:pre",i({settings:e},n?{init:n}:{}))})),s(this,"_update",(function(t){for(var e=function(t,e){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},V("area",t.area,e,document)),V("selectables",t.selectables,e,null)),V("autoScrollSpeed",t.autoScrollSpeed,e,5)),V("overflowTolerance",t.overflowTolerance,e,{x:25,y:25})),V("zoom",t.zoom,e,1)),V("customStyles",t.customStyles,e,!1)),V("multiSelectMode",t.multiSelectMode,e,!1)),V("multiSelectToggling",t.multiSelectToggling,e,!0)),V("multiSelectKeys",t.multiSelectKeys,e,["Control","Shift","Meta"])),V("selector",t.selector,e,null)),V("selectionThreshold",t.selectionThreshold,e,0)),V("draggability",t.draggability,e,!0)),V("immediateDrag",t.immediateDrag,e,!0)),V("keyboardDrag",t.keyboardDrag,e,!0)),V("dragKeys",t.dragKeys,e,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),V("keyboardDragSpeed",t.keyboardDragSpeed,e,10)),V("useTransform",t.useTransform,e,!0)),V("refreshMemoryRate",t.refreshMemoryRate,e,80)),V("dropZones",t.dropZones,e,[])),V("dropInsideThreshold",t.dropInsideThreshold,e,1)),V("dropTargetThreshold",t.dropTargetThreshold,e,0)),V("usePointerEvents",t.usePointerEvents,e,!1)),V("hoverClass",t.hoverClass,e,"ds-hover")),V("selectableClass",t.selectableClass,e,"ds-selectable")),V("selectedClass",t.selectedClass,e,"ds-selected")),V("selectorClass",t.selectorClass,e,"ds-selector")),V("selectorAreaClass",t.selectorAreaClass,e,"ds-selector-area")),V("droppedTargetClass",t.droppedTargetClass,e,"ds-dropped-target")),V("droppedInsideClass",t.droppedInsideClass,e,"ds-dropped-inside")),V("droppableClass",t.droppableClass,e,"ds-droppable")),V("dropZoneClass",t.dropZoneClass,e,"ds-dropzone")),V("dropZoneReadyClass",t.dropZoneReadyClass,e,"ds-dropzone-ready")),V("dropZoneTargetClass",t.dropZoneTargetClass,e,"ds-dropzone-target")),V("dropZoneInsideClass",t.dropZoneInsideClass,e,"ds-dropzone-inside"))}(t.settings,t.init),n=function(){var t,e=g(a[o],2),n=e[0],i=e[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(t){return r.update({settings:s({},n,t)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(t={},s(t,n,r._settings[n]),s(t,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),t)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(e);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},et=function(){function e(n){var r=this;t(this,e),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(t){return r.stores.SettingsStore.update({settings:t})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(t){return r.stores.KeyStore.isMultiSelectKeyPressed(t)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(t){var e;return null===(e=r.DropZones.getTarget(t))||void 0===e?void 0:e.toObject()})),s(this,"getItemsDroppedByZoneId",(function(t){return r.DropZones.getItemsDroppedById(t)})),s(this,"getItemsInsideByZoneId",(function(t,e){return r.DropZones.getItemsInsideById(t,e)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new tt({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new R({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new H({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(t){for(var e=t.subscribe,n=t.publish,s=t.Interaction,r=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 i({},t?{dropTarget:t.toObject()}:{})}}]},l=function(){var t=g(u[c],2),o=t[0],a=t[1];["pre",!1].forEach((function(t){return e(t?"".concat(o,":").concat(t):o,(function(e){return a.forEach((function(o){return(!o.condition||o.condition(e))&&n(t?"".concat(t).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},e),o.extraData?o.extraData(e):{}))}))}))}))},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 r.continue=!1})),this.start()}return n(e,[{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],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(t).forEach((function(r){return e.SelectedSet.has(r)?e.removeSelection(t,n,s):e.addSelection(t,n,s)})),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 s=Z(t);return this.SelectableSet.addAll(s),e&&this.SelectedSet.addAll(s),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}}]),e}();export default et;

@@ -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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function n(e,n,s){return n&&t(e.prototype,n),s&&t(e,s),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return 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}}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf||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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct:function(e,t,n){var s=[null];s.push.apply(s,t);var r=new(Function.bind.apply(e,s));return n&&l(r,n.prototype),r},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,s)}function s(){return u(e,arguments,a(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,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 S(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function p(e){var t=c();return function(){var n,s=a(e);if(t){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return S(this,n)}}function f(e,t,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(s){var r=Object.getOwnPropertyDescriptor(s,t);return r.get?r.get.call(n):r.value}},f(e,t,n||e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(e,t)||b(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 v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||b(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 b(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,s=new Array(t);n<t;n++)s[n]=e[n];return s}var y=function(e,t,n){var s=e.x,r=e.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[t]},D=function(e){return{x:e.left,y:e.top}},_=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}},I=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);e.forEach((function(e,t){s.observe(e,{childList:0!==t,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(e,t){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}},w=function(){var e,t,n,s;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===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(e){return function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=t[s])||void 0===n?void 0:n.parentNode;return r?(t.push(r),e(t,++s)):t}([e])},C=function(e){return!e||e instanceof Document?w():{x:e.scrollLeft>=0?e.scrollLeft:w().x,y:e.scrollTop>=0?e.scrollTop:w().y}},A=function(e){var t=e.elementRect,n=e.containerRect,s=e.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return t.top-r.y<n.top&&i.push("top"),t.left-r.x<n.left&&i.push("left"),t.bottom+r.y>n.bottom&&i.push("bottom"),t.right+r.y>n.right&&i.push("right"),i},T=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 s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.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},E=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return T(e);var n={x:0,y:0},s=t.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.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:T(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 s=window.getComputedStyle(e);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(e)},x=function(e){var t=e.computedStyle,n=e.node,s=t.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},M=function(e,t,n,r){if(void 0===t)return n?s({},e,r):{};if(null===t)return s({},e,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof t||t instanceof String),a&&!i&&(o=!0,k(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(o=!0,k(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(t)),c&&!i&&(o=!0,k(e,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof t),u&&!i&&(o=!0,k(e,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(t)),d&&!i&&(o=!0,k(e,"array"));var h=o||n;return"dragKeys"===e&&i?s({},e,Object.assign(r,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},e,t):h?s({},e,r):{}):h?s({},e,r):{}},V=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=e;if(n>0){var r=(e.right-e.left)*n,i=(e.bottom-e.top)*n;s={left:e.left+r,right:e.right-r,top:e.top+i,bottom:e.bottom-i}}return s.left<t.right&&s.right>t.left&&s.top<t.bottom&&s.bottom>t.top},N=function(e){var t=e.element,n=e.posDirection,s=e.containerRect,r=e.useTransform,i=E(t,r),o=y(i,"+",n);O(t,o,r);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,s=e.elementRect,r=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&O(t,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(t,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(t,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(t,{y:i.y,x:i.x+r.right-s.right},o)}({element:t,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},O=function(e,t,n){if(n){var s=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(s.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]:v(new Set(v(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 t(n){var r=this,i=n.DS;e(this,t),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(e){r._node=e,x({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})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((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))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(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 s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=e instanceof Document?s||document.body:e,i=t.includes("top")&&r.scrollTop>0,o=t.includes("bottom")&&r.scrollTop<r.scrollHeight,a=t.includes("left")&&r.scrollLeft>0,l=t.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;return r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return n(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(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=P(this.HTMLNode)}}]),t}(),R=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(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(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(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,s=e.zoom,r=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(r)&&(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 N({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)}})),s(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)}})),s(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))})),s(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return N({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=i,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 n(t,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?y(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?y(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),t}(),j=function(){function t(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;e(this,t),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(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)))}})),s(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)))})),s(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(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)))})),s(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))})),s(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.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.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{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 V(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=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),t}(),B=function t(n){var r=this,o=n.DS;e(this,t),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(e){var t=e.dropZones;t&&(r._zones&&r._zones.forEach((function(e){return e.destroy()})),r._zones=t.map((function(e){return new j(i({DS:r.DS},e))})),r._zones.forEach((function(e){r._zoneByElement.set(e.element,e),r._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=r._zonesByDroppable.get(t);if(null==n||!n.length)return r._zonesByDroppable.set(t,[e]);r._zonesByDroppable.set(t,v(new Set([].concat(v(n),[e]))))}))})))})),s(this,"_handleDrop",(function(e){r._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,s=t.y,i=0,o=e.length;i<o;i++){var a=r._zoneByElement.get(e[i]);if(a&&V(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(e){if(e.isDragging){var t=r.getTarget();r._handleDrop(t)}})),s(this,"getItemsDroppedById",(function(e){var t=r._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),s(this,"getItemsInsideById",(function(e,t){var n=r._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var s=n.itemsInside;return t&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(e){var t;if(null!==(t=r._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==e?void 0:e.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return r.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(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",{})})),s(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),s(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))})),s(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))})),s(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())}})),s(this,"stop",(function(){r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(r.DS.Area.HTMLNode.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(r.DS.Area.HTMLNode.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),r.DS.Area.HTMLNode.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),s(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})})),s(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),s(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",this.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 n(t,[{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))}}]),t}(),W=function t(n){var r=this,i=n.DS;e(this,t),s(this,"subscribers",{}),s(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),s(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})))})),s(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),s(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),s(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),s(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=i},U=function(t){o(i,t);var r=p(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(e){return n.add(e)}))})),s(h(n),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"_onClick",(function(e){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),s(h(n),"_onPointer",(function(e){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;n.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),n}return n(i,[{key:"add",value:function(e){if(!f(a(i.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&&x({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),f(a(i.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(f(a(i.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),f(a(i.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}}]),i}(d(Set)),X=function(t){o(i,t);var r=p(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),f(a(i.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(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=f(a(i.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())}}]),i}(d(Set)),Y=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),s(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}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=e[Symbol.iterator]()},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}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],S=d[1];o.isInside(h,S)&&(V(S,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(e){u.e(e)}finally{u.f()}var p=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.multiSelectionToggle,r=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(r.has(t)?s&&r.delete(t):r.add(t),t.classList.add(i))}({element:t,force:e,multiSelectionToggle:p,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.SelectedSet,r=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=s.has(t),a=r.has(t);o&&!a?s.delete(t):!o&&a&&s.add(t),t.classList.remove(i)}({element:t,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(t,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,s=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),t}(),q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_rect",void 0),s(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)})),s(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(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,s=e.pointerPos,r={};return s.x>n.x-t.x?(r.left=n.x-t.x,r.width=s.x-n.x+t.x):(r.left=s.x,r.width=n.x-s.x-t.x),s.y>n.y-t.y?(r.top=n.y-t.y,r.height=s.y-n.y+t.y):(r.top=s.y,r.height=n.y-s.y-t.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,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 n(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),G=function(){function t(n){var r,i=this,o=n.DS;e(this,t),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[t][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(e.top+t.top,"px"),r="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(e){i.stopAutoScroll(),e&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,n=e.Area;i.currentEdges=A({elementRect:_(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||V(i.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;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.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(){i.updatePos(),i.stopAutoScroll()}))}return n(t,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return V({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}(),$=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(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})})),s(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})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(t,[{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())}}]),t}(),J=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(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})})),s(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),s(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}))})),s(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)})),s(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=i,this.Settings=i.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 n(t,[{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&&y(e,"-",y(D(this.DS.Area.rect),"+",D(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&&y(e,"-",y(D(this.DS.Area.rect),"+",D(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&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),t}(),Q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,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 n(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=C(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=y(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},s=y(y(t,"*",n),"-",t);return{x:t.x+s.x,y:t.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),ee=function t(n){var r=this,o=n.DS,a=n.settings;e(this,t),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(e){var t=e.settings,n=e.init;return r.DS.publish("Settings:updated:pre",i({settings:t},n?{init:n}:{}))})),s(this,"_update",(function(e){for(var t=function(e,t){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},M("area",e.area,t,document)),M("selectables",e.selectables,t,null)),M("autoScrollSpeed",e.autoScrollSpeed,t,5)),M("overflowTolerance",e.overflowTolerance,t,{x:25,y:25})),M("zoom",e.zoom,t,1)),M("customStyles",e.customStyles,t,!1)),M("multiSelectMode",e.multiSelectMode,t,!1)),M("multiSelectToggling",e.multiSelectToggling,t,!0)),M("multiSelectKeys",e.multiSelectKeys,t,["Control","Shift","Meta"])),M("selector",e.selector,t,null)),M("selectionThreshold",e.selectionThreshold,t,0)),M("draggability",e.draggability,t,!0)),M("immediateDrag",e.immediateDrag,t,!0)),M("keyboardDrag",e.keyboardDrag,t,!0)),M("dragKeys",e.dragKeys,t,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),M("keyboardDragSpeed",e.keyboardDragSpeed,t,10)),M("useTransform",e.useTransform,t,!0)),M("refreshMemoryRate",e.refreshMemoryRate,t,80)),M("dropZones",e.dropZones,t,[])),M("dropInsideThreshold",e.dropInsideThreshold,t,1)),M("dropTargetThreshold",e.dropTargetThreshold,t,0)),M("usePointerEvents",e.usePointerEvents,t,!1)),M("hoverClass",e.hoverClass,t,"ds-hover")),M("selectableClass",e.selectableClass,t,"ds-selectable")),M("selectedClass",e.selectedClass,t,"ds-selected")),M("selectorClass",e.selectorClass,t,"ds-selector")),M("selectorAreaClass",e.selectorAreaClass,t,"ds-selector-area")),M("droppedTargetClass",e.droppedTargetClass,t,"ds-dropped-target")),M("droppedInsideClass",e.droppedInsideClass,t,"ds-dropped-inside")),M("droppableClass",e.droppableClass,t,"ds-droppable")),M("dropZoneClass",e.dropZoneClass,t,"ds-dropzone")),M("dropZoneReadyClass",e.dropZoneReadyClass,t,"ds-dropzone-ready")),M("dropZoneTargetClass",e.dropZoneTargetClass,t,"ds-dropzone-target")),M("dropZoneInsideClass",e.dropZoneInsideClass,t,"ds-dropzone-inside"))}(e.settings,e.init),n=function(){var e,t=g(a[o],2),n=t[0],i=t[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(e){return r.update({settings:s({},n,e)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(e={},s(e,n,r._settings[n]),s(e,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),e)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(t);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},te=function(){function t(n){var r=this;e(this,t),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(e){return r.stores.SettingsStore.update({settings:e})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(e){return r.stores.KeyStore.isMultiSelectKeyPressed(e)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(e){var t;return null===(t=r.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),s(this,"getItemsDroppedByZoneId",(function(e){return r.DropZones.getItemsDroppedById(e)})),s(this,"getItemsInsideByZoneId",(function(e,t){return r.DropZones.getItemsInsideById(e,t)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ee({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new H({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new R({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(e){for(var t=e.subscribe,n=e.publish,s=e.Interaction,r=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 i({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=g(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return t(e?"".concat(o,":").concat(e):o,(function(t){return a.forEach((function(o){return(!o.condition||o.condition(t))&&n(e?"".concat(e).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},t),o.extraData?o.extraData(t):{}))}))}))}))},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 r.continue=!1})),this.start()}return n(t,[{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],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(r){return t.SelectedSet.has(r)?t.removeSelection(e,n,s):t.addSelection(e,n,s)})),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 s=Z(e);return this.SelectableSet.addAll(s),t&&this.SelectedSet.addAll(s),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}}]),t}();return te}));
!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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function n(e,n,s){return n&&t(e.prototype,n),s&&t(e,s),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return 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}}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf||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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct:function(e,t,n){var s=[null];s.push.apply(s,t);var r=new(Function.bind.apply(e,s));return n&&l(r,n.prototype),r},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,s)}function s(){return u(e,arguments,a(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,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){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function S(e){var t=c();return function(){var n,s=a(e);if(t){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return p(this,n)}}function f(e,t,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(s){var r=Object.getOwnPropertyDescriptor(s,t);return r.get?r.get.call(n):r.value}},f(e,t,n||e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(e,t)||b(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 v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||b(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 b(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,s=new Array(t);n<t;n++)s[n]=e[n];return s}var y=function(e,t,n){var s=e.x,r=e.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[t]},D=function(e){return{x:e.left,y:e.top}},_=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}},I=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);e.forEach((function(e,t){s.observe(e,{childList:0!==t,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(e,t){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}},w=function(){var e,t,n,s;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===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(e){return function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=t[s])||void 0===n?void 0:n.parentNode;return r?(t.push(r),e(t,++s)):t}([e])},C=function(e){return!e||e instanceof Document?w():{x:e.scrollLeft>=0?e.scrollLeft:w().x,y:e.scrollTop>=0?e.scrollTop:w().y}},A=function(e){var t=e.elementRect,n=e.containerRect,s=e.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return t.top-r.y<n.top&&i.push("top"),t.left-r.x<n.left&&i.push("left"),t.bottom+r.y>n.bottom&&i.push("bottom"),t.right+r.y>n.right&&i.push("right"),i},E=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 s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.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},T=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return E(e);var n={x:0,y:0},s=t.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.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:E(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 s=window.getComputedStyle(e);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(e)},x=function(e){var t=e.computedStyle,n=e.node,s=t.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},V=function(e,t,n,r){if(void 0===t)return n?s({},e,r):{};if(null===t)return s({},e,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof t||t instanceof String),a&&!i&&(o=!0,k(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(o=!0,k(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(t)),c&&!i&&(o=!0,k(e,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof t),u&&!i&&(o=!0,k(e,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(t)),d&&!i&&(o=!0,k(e,"array"));var h=o||n;return"dragKeys"===e&&i?s({},e,Object.assign(r,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},e,t):h?s({},e,r):{}):h?s({},e,r):{}},M=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=e;if(n>0){var r=(e.right-e.left)*n,i=(e.bottom-e.top)*n;s={left:e.left+r,right:e.right-r,top:e.top+i,bottom:e.bottom-i}}return s.left<t.right&&s.right>t.left&&s.top<t.bottom&&s.bottom>t.top},N=function(e){var t=e.element,n=e.posDirection,s=e.containerRect,r=e.useTransform,i=T(t,r),o=y(i,"+",n);O(t,o,r);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,s=e.elementRect,r=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&O(t,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(t,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(t,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(t,{y:i.y,x:i.x+r.right-s.right},o)}({element:t,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},O=function(e,t,n){if(n){var s=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(s.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]:v(new Set(v(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")},R=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(e){r.reset(),r._node=e,x({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})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((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))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(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 s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=e instanceof Document?s||document.body:e,i=t.includes("top")&&r.scrollTop>0,o=t.includes("bottom")&&r.scrollTop<r.scrollHeight,a=t.includes("left")&&r.scrollLeft>0,l=t.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,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 n(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(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=P(this.HTMLNode)}}]),t}(),j=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(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(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(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,s=e.zoom,r=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(r)&&(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 N({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)}})),s(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)}})),s(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))})),s(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return N({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=i,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 n(t,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?y(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?y(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),t}(),H=function(){function t(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;e(this,t),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(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)))}})),s(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)))})),s(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(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)))})),s(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))})),s(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.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.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{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 M(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=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),t}(),B=function t(n){var r=this,o=n.DS;e(this,t),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(e){var t=e.dropZones;t&&(r._zones&&r._zones.forEach((function(e){return e.destroy()})),r._zones=t.map((function(e){return new H(i({DS:r.DS},e))})),r._zones.forEach((function(e){r._zoneByElement.set(e.element,e),r._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=r._zonesByDroppable.get(t);if(null==n||!n.length)return r._zonesByDroppable.set(t,[e]);r._zonesByDroppable.set(t,v(new Set([].concat(v(n),[e]))))}))})))})),s(this,"_handleDrop",(function(e){r._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,s=t.y,i=0,o=e.length;i<o;i++){var a=r._zoneByElement.get(e[i]);if(a&&M(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(e){if(e.isDragging){var t=r.getTarget();r._handleDrop(t)}})),s(this,"getItemsDroppedById",(function(e){var t=r._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),s(this,"getItemsInsideById",(function(e,t){var n=r._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var s=n.itemsInside;return t&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(e){var t;if(null!==(t=r._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==e?void 0:e.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return r.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(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",{})})),s(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),s(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))})),s(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))})),s(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())}})),s(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)})),s(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})})),s(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),s(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=i,this.Settings=i.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 n(t,[{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))}}]),t}(),W=function t(n){var r=this,i=n.DS;e(this,t),s(this,"subscribers",{}),s(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),s(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})))})),s(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),s(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),s(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),s(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=i},U=function(t){o(i,t);var r=S(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(e){return n.add(e)}))})),s(h(n),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"_onClick",(function(e){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),s(h(n),"_onPointer",(function(e){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;n.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),n}return n(i,[{key:"add",value:function(e){if(!f(a(i.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&&x({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),f(a(i.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(f(a(i.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),f(a(i.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}}]),i}(d(Set)),X=function(t){o(i,t);var r=S(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),f(a(i.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(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=f(a(i.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())}}]),i}(d(Set)),Y=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),s(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}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=e[Symbol.iterator]()},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}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],p=d[1];o.isInside(h,p)&&(M(p,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(e){u.e(e)}finally{u.f()}var S=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.multiSelectionToggle,r=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(r.has(t)?s&&r.delete(t):r.add(t),t.classList.add(i))}({element:t,force:e,multiSelectionToggle:S,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.SelectedSet,r=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=s.has(t),a=r.has(t);o&&!a?s.delete(t):!o&&a&&s.add(t),t.classList.remove(i)}({element:t,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(t,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,s=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),t}(),q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_rect",void 0),s(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)})),s(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(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,s=e.pointerPos,r={};return s.x>n.x-t.x?(r.left=n.x-t.x,r.width=s.x-n.x+t.x):(r.left=s.x,r.width=n.x-s.x-t.x),s.y>n.y-t.y?(r.top=n.y-t.y,r.height=s.y-n.y+t.y):(r.top=s.y,r.height=n.y-s.y-t.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,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 n(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),G=function(){function t(n){var r,i=this,o=n.DS;e(this,t),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[t][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(e.top+t.top,"px"),r="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(e){i.stopAutoScroll(),e&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,n=e.Area;i.currentEdges=A({elementRect:_(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||M(i.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;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.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(){i.updatePos(),i.stopAutoScroll()}))}return n(t,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return M({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}(),$=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(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})})),s(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})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(t,[{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())}}]),t}(),J=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(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})})),s(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),s(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}))})),s(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)})),s(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=i,this.Settings=i.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 n(t,[{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&&y(e,"-",y(D(this.DS.Area.rect),"+",D(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&&y(e,"-",y(D(this.DS.Area.rect),"+",D(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&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),t}(),Q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,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 n(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=C(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=y(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},s=y(y(t,"*",n),"-",t);return{x:t.x+s.x,y:t.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),ee=function t(n){var r=this,o=n.DS,a=n.settings;e(this,t),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(e){var t=e.settings,n=e.init;return r.DS.publish("Settings:updated:pre",i({settings:t},n?{init:n}:{}))})),s(this,"_update",(function(e){for(var t=function(e,t){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},V("area",e.area,t,document)),V("selectables",e.selectables,t,null)),V("autoScrollSpeed",e.autoScrollSpeed,t,5)),V("overflowTolerance",e.overflowTolerance,t,{x:25,y:25})),V("zoom",e.zoom,t,1)),V("customStyles",e.customStyles,t,!1)),V("multiSelectMode",e.multiSelectMode,t,!1)),V("multiSelectToggling",e.multiSelectToggling,t,!0)),V("multiSelectKeys",e.multiSelectKeys,t,["Control","Shift","Meta"])),V("selector",e.selector,t,null)),V("selectionThreshold",e.selectionThreshold,t,0)),V("draggability",e.draggability,t,!0)),V("immediateDrag",e.immediateDrag,t,!0)),V("keyboardDrag",e.keyboardDrag,t,!0)),V("dragKeys",e.dragKeys,t,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),V("keyboardDragSpeed",e.keyboardDragSpeed,t,10)),V("useTransform",e.useTransform,t,!0)),V("refreshMemoryRate",e.refreshMemoryRate,t,80)),V("dropZones",e.dropZones,t,[])),V("dropInsideThreshold",e.dropInsideThreshold,t,1)),V("dropTargetThreshold",e.dropTargetThreshold,t,0)),V("usePointerEvents",e.usePointerEvents,t,!1)),V("hoverClass",e.hoverClass,t,"ds-hover")),V("selectableClass",e.selectableClass,t,"ds-selectable")),V("selectedClass",e.selectedClass,t,"ds-selected")),V("selectorClass",e.selectorClass,t,"ds-selector")),V("selectorAreaClass",e.selectorAreaClass,t,"ds-selector-area")),V("droppedTargetClass",e.droppedTargetClass,t,"ds-dropped-target")),V("droppedInsideClass",e.droppedInsideClass,t,"ds-dropped-inside")),V("droppableClass",e.droppableClass,t,"ds-droppable")),V("dropZoneClass",e.dropZoneClass,t,"ds-dropzone")),V("dropZoneReadyClass",e.dropZoneReadyClass,t,"ds-dropzone-ready")),V("dropZoneTargetClass",e.dropZoneTargetClass,t,"ds-dropzone-target")),V("dropZoneInsideClass",e.dropZoneInsideClass,t,"ds-dropzone-inside"))}(e.settings,e.init),n=function(){var e,t=g(a[o],2),n=t[0],i=t[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(e){return r.update({settings:s({},n,e)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(e={},s(e,n,r._settings[n]),s(e,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),e)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(t);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},te=function(){function t(n){var r=this;e(this,t),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(e){return r.stores.SettingsStore.update({settings:e})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(e){return r.stores.KeyStore.isMultiSelectKeyPressed(e)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(e){var t;return null===(t=r.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),s(this,"getItemsDroppedByZoneId",(function(e){return r.DropZones.getItemsDroppedById(e)})),s(this,"getItemsInsideByZoneId",(function(e,t){return r.DropZones.getItemsInsideById(e,t)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ee({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new R({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new j({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(e){for(var t=e.subscribe,n=e.publish,s=e.Interaction,r=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 i({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=g(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return t(e?"".concat(o,":").concat(e):o,(function(t){return a.forEach((function(o){return(!o.condition||o.condition(t))&&n(e?"".concat(e).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},t),o.extraData?o.extraData(t):{}))}))}))}))},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 r.continue=!1})),this.start()}return n(t,[{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],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(r){return t.SelectedSet.has(r)?t.removeSelection(e,n,s):t.addSelection(e,n,s)})),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 s=Z(e);return this.SelectableSet.addAll(s),t&&this.SelectedSet.addAll(s),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}}]),t}();return te}));

@@ -41,3 +41,3 @@ export default class Interaction {

}) => void;
stop: () => void;
stop: (area?: DSArea) => void;
update: ({ event, scroll_directions, scroll_multiplier }: {

@@ -44,0 +44,0 @@ event: any;

{
"name": "dragselect",
"version": "2.5.4",
"version": "2.5.5",
"description": "easy javascript drag select & drop functionality for your projects",

@@ -15,3 +15,2 @@ "main": "./dist/DragSelect.js",

"checkjs:watch": "npm run checkjs -- -w",
"postcheckjs": "npm run docs && rm -rf docs",
"pretest": "npm run build",

@@ -22,3 +21,3 @@ "test": "npm run checkjs && jest --detectOpenHandles",

"build": "npm run rollup",
"docs": "jsdoc -c jsdoc.json",
"docs": "cd www && yarn && yarn build && cd ..",
"premedia": "rm -r docs/media &",

@@ -32,3 +31,3 @@ "media": "cp -R .media docs/media",

"\n## PROD:": "",
"ci:build": "npm run rollup:ci && npm run media && npm run docs",
"ci:build": "npm run docs && npm run rollup:ci && npm run media",
"ci:test": "npm run test"

@@ -68,3 +67,2 @@ },

"jest-puppeteer": "^6.1.1",
"jsdoc": "^3.6.11",
"minami": "^1.2.3",

@@ -75,3 +73,3 @@ "prettier": "^2.2.1",

"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.8.0"
"typescript": "^4.9.3"
},

@@ -78,0 +76,0 @@ "repository": {

@@ -1,14 +0,25 @@

```
____ _____ __ __
/ __ \_________ _____ _/ ___/___ / /__ _____/ /_
/ / / / ___/ __ `/ __ `/\__ \/ _ \/ / _ \/ ___/ __/
/ /_/ / / / /_/ / /_/ /___/ / __/ / __/ /__/ /_
/_____/_/ \__,_/\__, //____/\___/_/\___/\___/\__/
/____/
```
<p align="center" style="text-align: center" >
<a href="https://DragSelect.com/">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://dragselect.com/media/dragselect-logo.png">
<source media="(prefers-color-scheme: dark)" srcset="https://dragselect.com/media/dragselect-logo-alt.png">
<img alt="The DragSelect logo: a selection symbol, a hand, a drop symbol and a mouse within a selection square." width="300" src="https://dragselect.com/media/dragselect-logo.png">
</picture>
</a>
</p>
<p align="center" style="text-align: center">
<a href="https://dragselect.com/">Project-Page</a> |
<a href="https://dragselect.com/docs/intro">Documentation</a> |
<a href="https://github.com/ThibaultJanBeyer/DragSelect/">Github</a> |
<a href="https://www.npmjs.com/package/dragselect">NPM</a> |
</p>
<p align="center" style="text-align: center; margin-bottom: 50px;">
<a href="https://github.com/ThibaultJanBeyer/DragSelect/actions"><img alt="Build Status" src="https://github.com/ThibaultJanBeyer/DragSelect/actions/workflows/github-actions-build.yml/badge.svg"></a>
<a href="https://dragselect.com/v2/ds.min.js"><img alt="gzip size" src="https://img.badgesize.io/https://dragselect.com/v2/ds.min.js?compression=gzip"></a>
<a href="https://www.npmjs.com/package/dragselect"><img alt="npm downloads count" src="https://img.shields.io/npm/dt/dragselect.svg"></a>
<a href="https://github.com/ThibaultJanBeyer/DragSelect/blob/master/package.json"><img alt="No Dependency" src="https://img.shields.io/badge/dependencies-none-informational"></a>
<a href="https://github.com/ThibaultJanBeyer/DragSelect/blob/master/CONTRIBUTING.md"><img alt="Contributors Welcome" src="https://img.shields.io/badge/contributors-welcome-blueviolet"></a>
<a href="https://github.com/sponsors/ThibaultJanBeyer"><img alt="Sponsors Welcome" src="https://img.shields.io/badge/sponsors-welcome-blueviolet"></a>
</p>
[GitHub](https://github.com/ThibaultJanBeyer/DragSelect/) | [NPM](https://www.npmjs.com/package/dragselect) | [Project-Page](https://dragselect.com/)
[![Build Status](https://github.com/ThibaultJanBeyer/DragSelect/actions/workflows/github-actions-build.yml/badge.svg)](https://github.com/ThibaultJanBeyer/DragSelect/actions) ![gzip size](https://img.badgesize.io/https://dragselect.com/v2/ds.min.js?compression=gzip) ![npm downloads count](https://img.shields.io/npm/dt/dragselect.svg) [![No Dependency](https://img.shields.io/badge/dependencies-none-informational)](https://github.com/ThibaultJanBeyer/DragSelect/blob/master/package.json) [![Contributors Welcome](https://img.shields.io/badge/contributors-welcome-blueviolet)](https://github.com/ThibaultJanBeyer/DragSelect/blob/master/CONTRIBUTING.md) [![Sponsors Welcome](https://img.shields.io/badge/sponsors-welcome-blueviolet)](https://github.com/sponsors/ThibaultJanBeyer)
# DragSelect ![GitHub package.json version](https://img.shields.io/github/package-json/v/ThibaultJanBeyer/DragSelect.svg)

@@ -91,8 +102,5 @@ easily add a selection algorithm to your application/website.

| ![BrowserStack](https://dragselect.com/media/browserstack.jpg) | [You?](https://github.com/sponsors/ThibaultJanBeyer) |
| <a href="https://www.browserstack.com/"><img src="https://dragselect.com/media/browserstack.jpg" alt="Browserstack" width="150px"></a> | [You?](https://github.com/sponsors/ThibaultJanBeyer) |
|--- |--- |
|[BrowserStack](https://www.browserstack.com/) is a testing service which helps testing the tool on various browsers. They support this open source projects by providing us with a [free account](https://www.browserstack.com/open-source)! | Thank and support us by making a [Direct Donation to DragSelect](https://www.blockchain.com/btc/address/1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC) (via Bitcoin: `1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC`). Or sponsor via [GitHub Sponsors](https://github.com/sponsors/ThibaultJanBeyer) or [Get in touch](mailto:thibault.beyer@gmail.com). |
| Via BTC: | [1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC](https://www.blockchain.com/btc/address/1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC) (direct) |
| Via GitHub: | [GitHub Sponsors](https://github.com/sponsors/ThibaultJanBeyer) (monthly & one-time) |
| Other: | [get in touch](mailto:thibault.beyer@gmail.com) |
|[BrowserStack](https://www.browserstack.com/) is a service for cross-browser testing. They support this open source projects by providing us with a [free account](https://www.browserstack.com/open-source)! | Thank and support us by making a [Direct Donation to DragSelect](https://www.blockchain.com/btc/address/1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC) (via Bitcoin: `1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC`). Or sponsor via [GitHub Sponsors](https://github.com/sponsors/ThibaultJanBeyer) or [Get in touch](mailto:thibault.beyer@gmail.com).

@@ -99,0 +107,0 @@ All donations are distributed with all project contributors proportionally to their involvement. We are grateful for any amount:

@@ -9,2 +9,3 @@ import babel from '@rollup/plugin-babel'

let typesDone = false
let copyDocsDone = false
const banner = `/***

@@ -49,3 +50,3 @@

name: 'DragSelect',
banner: banner,
banner,
},

@@ -56,3 +57,3 @@ {

name: 'DragSelect',
banner: banner,
banner,
},

@@ -81,2 +82,4 @@ {

if (!process.argv.includes('--ci')) return
// v1
if (!fs.existsSync('docs/')) fs.mkdirSync('docs')

@@ -87,9 +90,11 @@ fs.copyFileSync(

)
console.log(
console.info(
`.v1/${path.basename(options.file)}`,
`docs/${path.basename(options.file)}`
)
// v2
if (!fs.existsSync('docs/v2')) fs.mkdirSync('docs/v2')
fs.copyFileSync(options.file, `docs/v2/${path.basename(options.file)}`)
console.log(options.file, `docs/v2/${path.basename(options.file)}`)
console.info(options.file, `docs/v2/${path.basename(options.file)}`)
},

@@ -102,3 +107,3 @@ },

typesDone = true
console.log(`Adding types to all ts files`)
console.info(`Adding types to all ts files`)
glob('dist/**/*.d.ts', (er, files) => {

@@ -118,2 +123,11 @@ if (er) throw er

{
name: 'copy-www-docs',
writeBundle() {
if (!process.argv.includes('--ci') || copyDocsDone) return
copyDocsDone = true
console.info(`Adding www/build output to docs/ folder`)
fs.cpSync(`www/build`, `docs/`, { recursive: true })
},
},
{
name: 'disable-treeshaking',

@@ -120,0 +134,0 @@ transform(code, id) {

@@ -62,3 +62,3 @@ // @ts-check

// Setup
//////////////////////////////////////////////////////////////////////////////////////
/// ///////////////////////////////////////////////////////////////////////////////////

@@ -71,2 +71,3 @@ class DragSelect {

continue = false
/**

@@ -118,3 +119,3 @@ * @class DragSelect

// Useful methods for the user
//////////////////////////////////////////////////////////////////////////////////////
/// ///////////////////////////////////////////////////////////////////////////////////
/**

@@ -128,2 +129,3 @@ * Initializes the functionality. Automatically triggered when created.

}
/**

@@ -153,2 +155,3 @@ * Complete function teardown

}
/**

@@ -160,2 +163,3 @@ * Utility to override DragSelect internal functionality:

break = () => (this.continue = true)
/**

@@ -167,2 +171,3 @@ * Update any setting dynamically

setSettings = (settings) => this.stores.SettingsStore.update({ settings })
/**

@@ -173,2 +178,3 @@ * Returns the current selected nodes

getSelection = () => this.SelectedSet.elements
/**

@@ -193,2 +199,3 @@ * Adds several elements to the selection list also adds the specific classes and take into account all calculations.

}
/**

@@ -213,2 +220,3 @@ * Removes specific elements from the selection

}
/**

@@ -220,10 +228,14 @@ * Toggles specific elements from the selection:

* @param {boolean} [triggerCallback] - if callback should be called
* @param {boolean} [alsoSelectables] - if element should not be added/removed to the list of selectable elements accordingly
* @param {boolean} [removeFromSelectables] - if element should not be added/removed to the list of selectable elements accordingly
* @return {DSElements} all selected elements
*/
toggleSelection(elements, triggerCallback = false, alsoSelectables = false) {
toggleSelection(
elements,
triggerCallback = false,
removeFromSelectables = false
) {
toArray(elements).forEach((el) =>
this.SelectedSet.has(el)
? this.removeSelection(elements, triggerCallback, alsoSelectables)
: this.addSelection(elements, triggerCallback, alsoSelectables)
? this.removeSelection(elements, triggerCallback, removeFromSelectables)
: this.addSelection(elements, triggerCallback, removeFromSelectables)
)

@@ -234,2 +246,3 @@ if (triggerCallback)

}
/**

@@ -252,2 +265,3 @@ * Sets the current selected elements and optionally run the callback

}
/**

@@ -264,2 +278,3 @@ * Unselect / Deselect all current selected Nodes

}
/**

@@ -280,2 +295,3 @@ * Add elements that can be selected. No node is added twice

}
/**

@@ -286,2 +302,3 @@ * Gets all nodes that can potentially be selected

getSelectables = () => this.SelectableSet.elements
/**

@@ -301,6 +318,9 @@ * Sets all elements that can be selected.

) {
console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)')
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(elements, removeFromSelection)
return this.addSelectables(elements, addToSelection)
}
/**

@@ -320,14 +340,21 @@ * Remove elements from the elements that can be selected.

}
/** The starting/initial position of the cursor/selector @return {Vect2} */
getInitialCursorPosition = () => this.stores.PointerStore.initialVal
/** The last seen position of the cursor/selector @return {Vect2} */
getCurrentCursorPosition = () => this.stores.PointerStore.currentVal
/** The previous position of the cursor/selector @return {Vect2} */
getPreviousCursorPosition = () => this.stores.PointerStore.lastVal
/** The starting/initial position of the cursor/selector @return {Vect2} */
getInitialCursorPositionArea = () => this.stores.PointerStore.initialValArea
/** The last seen position of the cursor/selector @return {Vect2} */
getCurrentCursorPositionArea = () => this.stores.PointerStore.currentValArea
/** The previous position of the cursor/selector @return {Vect2} */
getPreviousCursorPositionArea = () => this.stores.PointerStore.lastValArea
/**

@@ -339,2 +366,3 @@ * Whether the multi-selection key was pressed

isMultiSelect = (event) => this.stores.KeyStore.isMultiSelectKeyPressed(event)
/**

@@ -345,2 +373,3 @@ * Whether the user is currently drag n dropping elements (instead of selection)

isDragging = () => this.Interaction.isDragging
/**

@@ -352,3 +381,5 @@ * Returns first DropsZone under coordinates,

*/
getZoneByCoordinates = (coordinates) => this.DropZones.getTarget(coordinates)?.toObject()
getZoneByCoordinates = (coordinates) =>
this.DropZones.getTarget(coordinates)?.toObject()
/**

@@ -359,3 +390,5 @@ * Returns itemsDropped into zone by zone id

*/
getItemsDroppedByZoneId = (zoneId) => this.DropZones.getItemsDroppedById(zoneId)
getItemsDroppedByZoneId = (zoneId) =>
this.DropZones.getItemsDroppedById(zoneId)
/**

@@ -367,5 +400,6 @@ * Returns itemsInside by zone id

*/
getItemsInsideByZoneId = (zoneId, addClasses) => this.DropZones.getItemsInsideById(zoneId, addClasses)
getItemsInsideByZoneId = (zoneId, addClasses) =>
this.DropZones.getItemsInsideById(zoneId, addClasses)
}
export default DragSelect

@@ -67,5 +67,5 @@ // @ts-check

// @ts-ignore: @todo: update to typescript
this.DS.PubSub.subscribe('Settings:updated:area', ({ settings }) =>
this.DS.PubSub.subscribe('Settings:updated:area', ({ settings }) => {
this.setArea(settings.area)
)
})

@@ -78,2 +78,3 @@ this.DS.PubSub.subscribe('Interaction:init', this.start)

setArea = (area) => {
this.reset()
this._node = area

@@ -80,0 +81,0 @@ handleElementPositionAttribute({

@@ -21,3 +21,6 @@ // @ts-check

// @ts-ignore: @todo: update to typescript
this.DS.subscribe('Settings:updated:area', this.init)
this.DS.subscribe('Settings:updated:area', ({ settings }) => {
this.stop(settings['area:pre'])
this.init()
})
this.DS.subscribe('PointerStore:updated', this.update)

@@ -160,3 +163,3 @@ this.DS.subscribe('Selectable:click', this.onClick)

stop = () => {
stop = (area = this.DS.Area.HTMLNode) => {
this.isInteracting = false

@@ -167,3 +170,3 @@ this.isDragging = false

if (this.Settings.usePointerEvents) {
this.DS.Area.HTMLNode.removeEventListener('pointerdown', this.start, {
area.removeEventListener('pointerdown', this.start, {
// @ts-ignore

@@ -175,7 +178,7 @@ passive: false,

} else {
this.DS.Area.HTMLNode.removeEventListener('mousedown', this.start)
area.removeEventListener('mousedown', this.start)
document.removeEventListener('mouseup', this.reset)
}
this.DS.Area.HTMLNode.removeEventListener('touchstart', this.start, {
area.removeEventListener('touchstart', this.start, {
// @ts-ignore

@@ -182,0 +185,0 @@ passive: false,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc