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.6.0 to 2.6.1

dist/methods/getBoundingClientRect.d.ts

4

CHANGELOG.md

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

# 2.6.1
- Fix bug calling dropZones [ #168](https://github.com/ThibaultJanBeyer/DragSelect/pull/168) by [@fredrikvin](https://github.com/fredrikvin)
# 2.6.0

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

2

dist/ds.es6m.min.js

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

function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,D(r.key),r)}}function s(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function S(e){var t=c();return function(){var n,r=a(e);if(t){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return p(this,n)}}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=f(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}},g.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var _=function(e,t,n){var r=e.x,s=e.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[t]},I=function(e){return{x:e.left,y:e.top}},w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},L=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);e.forEach((function(e,t){r.observe(e,{childList:0!==t,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(e,t){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,e.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,t)}},C=function(){var e,t,n,r;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},E=function(e){return function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=t[r])||void 0===n?void 0:n.parentNode;return s?(t.push(s),e(t,++r)):t}([e])},A=function(e){return!e||e instanceof Document?C():{x:e.scrollLeft>=0?e.scrollLeft:C().x,y:e.scrollTop>=0?e.scrollTop:C().y}},T=function(e){var t=e.elementRect,n=e.containerRect,r=e.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return t.top-s.y<n.top&&i.push("top"),t.left-s.x<n.left&&i.push("left"),t.bottom+s.y>n.bottom&&i.push("bottom"),t.right+s.y>n.right&&i.push("right"),i},x=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},k=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return x(e);var n={x:0,y:0},r=t.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:x(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(e);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(e)},M=function(e){var t=e.computedStyle,n=e.node,r=t.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},N=function(e,t,n,r){if(void 0===t)return n?i({},e,r):{};if(null===t)return i({},e,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof t||t instanceof String),a&&!s&&(o=!0,V(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(t)&&"number"==typeof t),l&&!s&&(o=!0,V(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(t)),c&&!s&&(o=!0,V(e,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof t),u&&!s&&(o=!0,V(e,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(t)),d&&!s&&(o=!0,V(e,"array"));var h=o||n;return"dragKeys"===e&&s?i({},e,Object.assign(r,t)):"dragKeys"!==e||s?("dropZones"===e&&s&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},e,t):h?i({},e,r):{}):h?i({},e,r):{}},O=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e;if(n>0){var s=(e.right-e.left)*n,i=(e.bottom-e.top)*n;r={left:e.left+s,right:e.right-s,top:e.top+i,bottom:e.bottom-i}}return r.left<t.right&&r.right>t.left&&r.top<t.bottom&&r.bottom>t.top},K=function(e){var t=e.element,n=e.posDirection,r=e.containerRect,s=e.useTransform,i=k(t,s),o=_(i,"+",n);R(t,o,s);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,r=e.elementRect,s=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&R(t,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&R(t,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&R(t,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&R(t,{y:i.y,x:i.x+s.right-r.right},o)}({element:t,edges:T({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},R=function(e,t,n){if(n){var r=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:b(new Set(b(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(e){r.reset(),r._node=e,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=e instanceof Document?r||document.body:e,i=t.includes("top")&&s.scrollTop>0,o=t.includes("bottom")&&s.scrollTop<s.scrollHeight,a=t.includes("left")&&s.scrollLeft>0,l=t.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(e,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.HTMLNode)}}]),e}(),B=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,r=e.zoom,s=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return K({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),i(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return K({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?_(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?_(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var r=this,s=t.DS,o=t.id,a=t.element,l=t.droppables;n(this,e),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return O(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),W=s((function e(r){var s=this,o=r.DS;n(this,e),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(e){var n=e.dropZones;n&&(s._zones&&s._zones.forEach((function(e){return e.destroy()})),s._zones=n.map((function(e){return new F(t({DS:s.DS},e))})),s._zones.forEach((function(e){s._zoneByElement.set(e.element,e),s._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=s._zonesByDroppable.get(t);if(null==n||!n.length)return s._zonesByDroppable.set(t,[e]);s._zonesByDroppable.set(t,b(new Set([].concat(b(n),[e]))))}))})))})),i(this,"_handleDrop",(function(e){s._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,r=t.y,i=0,o=e.length;i<o;i++){var a=s._zoneByElement.get(e[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(e){if(e.isDragging){var t=s.getTarget();s._handleDrop(t)}})),i(this,"getItemsDroppedById",(function(e){var t=s._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),i(this,"getItemsInsideById",(function(e,t){var n=s._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var r=n.itemsInside;return t&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(e){var t;if(null!==(t=s._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==e?void 0:e.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return s.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),U=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),i(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),i(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(e.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(e.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),e.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),i(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.stop(t["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return s(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),X=s((function e(t){var r=this,s=t.DS;n(this,e),i(this,"subscribers",{}),i(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),i(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),i(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),i(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),i(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),i(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=s})),Y=function(e){o(r,d(Set));var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return Z(s.Settings.selectables).forEach((function(e){return s.add(e)}))})),i(h(s),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"_onClick",(function(e){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),i(h(s),"_onPointer",(function(e){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;s.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),g(a(r.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),g(a(r.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(),q=function(e){o(r,d(Set));var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),g(a(r.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=g(a(r.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(),G=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),i(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,p=new Map,S=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s:s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(S.s();!(n=S.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):p.set(g,b))}}catch(e){S.e(e)}finally{S.f()}if(!r.DS.continue){var m=r.filterSelected({select:h,unselect:p,selectorRect:d}),D=m.select,_=m.unselect;D.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.multiSelectionToggle,s=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(s.has(t)?r&&s.delete(t):s.add(t),t.classList.add(i))}({element:n,force:e,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.SelectedSet,s=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=r.has(t),a=s.has(t);o&&!a?r.delete(t):!o&&a&&r.add(t),t.classList.remove(i)}({element:n,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(e){var t=e.select,n=e.unselect;return e.selectorRect,{select:t,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(e,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,r=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),e}(),$=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,w(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,r=e.pointerPos,s={};return r.x>n.x-t.x?(s.left=n.x-t.x,s.width=r.x-n.x+t.x):(s.left=r.x,s.width=n.x-r.x-t.x),r.y>n.y-t.y?(s.top=n.y-t.y,s.height=r.y-n.y+t.y):(s.top=r.y,s.height=n.y-r.y-t.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),J=function(){function e(t){var r,s=this,o=t.DS;n(this,e),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[t][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var e=s.DS.Area.rect,t=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(e.top+t.top,"px"),i="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(e){s.stopAutoScroll(),e&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var e=s.DS,t=e.stores.PointerStore,n=e.Area;s.currentEdges=T({elementRect:w(t.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(e,t){return!(!s.DS.Area.HTMLNode.contains(e)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;s.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),s.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),Q=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),i(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),ee=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),i(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return s(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),e}(),te=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=A(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=A(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=A(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=_(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},r=_(_(t,"*",n),"-",t);return{x:t.x+r.x,y:t.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=A(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),ne=s((function e(r){var s=this,o=r.DS,a=r.settings;n(this,e),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(e){var n=e.settings,r=e.init;return s.DS.publish("Settings:updated:pre",t({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(e){for(var n=function(e,n){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},N("area",e.area,n,document)),N("selectables",e.selectables,n,null)),N("autoScrollSpeed",e.autoScrollSpeed,n,5)),N("overflowTolerance",e.overflowTolerance,n,{x:25,y:25})),N("zoom",e.zoom,n,1)),N("customStyles",e.customStyles,n,!1)),N("multiSelectMode",e.multiSelectMode,n,!1)),N("multiSelectToggling",e.multiSelectToggling,n,!0)),N("multiSelectKeys",e.multiSelectKeys,n,["Control","Shift","Meta"])),N("selector",e.selector,n,null)),N("selectionThreshold",e.selectionThreshold,n,0)),N("draggability",e.draggability,n,!0)),N("immediateDrag",e.immediateDrag,n,!0)),N("keyboardDrag",e.keyboardDrag,n,!0)),N("dragKeys",e.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),N("keyboardDragSpeed",e.keyboardDragSpeed,n,10)),N("useTransform",e.useTransform,n,!0)),N("refreshMemoryRate",e.refreshMemoryRate,n,80)),N("dropZones",e.dropZones,n,[])),N("dropInsideThreshold",e.dropInsideThreshold,n,1)),N("dropTargetThreshold",e.dropTargetThreshold,n,0)),N("usePointerEvents",e.usePointerEvents,n,!1)),N("hoverClass",e.hoverClass,n,"ds-hover")),N("selectableClass",e.selectableClass,n,"ds-selectable")),N("selectedClass",e.selectedClass,n,"ds-selected")),N("selectorClass",e.selectorClass,n,"ds-selector")),N("selectorAreaClass",e.selectorAreaClass,n,"ds-selector-area")),N("droppedTargetClass",e.droppedTargetClass,n,"ds-dropped-target")),N("droppedInsideClass",e.droppedInsideClass,n,"ds-dropped-inside")),N("droppableClass",e.droppableClass,n,"ds-droppable")),N("dropZoneClass",e.dropZoneClass,n,"ds-dropzone")),N("dropZoneReadyClass",e.dropZoneReadyClass,n,"ds-dropzone-ready")),N("dropZoneTargetClass",e.dropZoneTargetClass,n,"ds-dropzone-target")),N("dropZoneInsideClass",e.dropZoneInsideClass,n,"ds-dropzone-inside"))}(e.settings,e.init),r=function(){var e,t=v(a[o],2),n=t[0],r=t[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(e){return s.update({settings:i({},n,e)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(e={},i(e,n,s._settings[n]),i(e,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),e)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),re=function(){function e(r){var s=this;n(this,e),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(e){return s.stores.SettingsStore.update({settings:e})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(e){return s.stores.KeyStore.isMultiSelectKeyPressed(e)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(e){var t;return null===(t=s.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),i(this,"getItemsDroppedByZoneId",(function(e){return s.DropZones.getItemsDroppedById(e)})),i(this,"getItemsInsideByZoneId",(function(e,t){return s.DropZones.getItemsInsideById(e,t)})),this.PubSub=new X({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ne({DS:this,settings:r}),this.stores.PointerStore=new ee({DS:this}),this.stores.ScrollStore=new te({DS:this}),this.stores.KeyStore=new Q({DS:this}),this.Area=new H({DS:this}),this.Selector=new $({DS:this}),this.SelectorArea=new J({DS:this}),this.SelectableSet=new Y({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new G({DS:this}),this.Drag=new B({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new U({DS:this}),function(e){for(var n=e.subscribe,r=e.publish,s=e.Interaction,i=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return t({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=v(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return n(e?"".concat(o,":").concat(e):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(e?"".concat(e).concat(o.name):o.name,t(t({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(e,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(s){return t.SelectedSet.has(s)?t.removeSelection(e,n,r):t.addSelection(e,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var r=Z(e);return this.SelectableSet.addAll(r),t&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();re.isCollision=O;export{re as default};
function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,D(r.key),r)}}function s(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function S(e){var t=c();return function(){var n,r=a(e);if(t){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return p(this,n)}}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=f(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}},g.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var _=function(e,t,n){var r=e.x,s=e.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[t]},I=function(e){return{x:e.left,y:e.top}},w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},L=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);e.forEach((function(e,t){r.observe(e,{childList:0!==t,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(e,t){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,e.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,t)}},C=function(){var e,t,n,r;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},E=function(e){return function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=t[r])||void 0===n?void 0:n.parentNode;return s?(t.push(s),e(t,++r)):t}([e])},A=function(e){return!e||e instanceof Document?C():{x:e.scrollLeft>=0?e.scrollLeft:C().x,y:e.scrollTop>=0?e.scrollTop:C().y}},T=function(e){var t=e.elementRect,n=e.containerRect,r=e.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return t.top-s.y<n.top&&i.push("top"),t.left-s.x<n.left&&i.push("left"),t.bottom+s.y>n.bottom&&i.push("bottom"),t.right+s.y>n.right&&i.push("right"),i},x=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},k=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return x(e);var n={x:0,y:0},r=t.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:x(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(e);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(e)},M=function(e){var t=e.computedStyle,n=e.node,r=t.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},N=function(e,t,n,r){if(void 0===t)return n?i({},e,r):{};if(null===t)return i({},e,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof t||t instanceof String),a&&!s&&(o=!0,V(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(t)&&"number"==typeof t),l&&!s&&(o=!0,V(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(t)),c&&!s&&(o=!0,V(e,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof t),u&&!s&&(o=!0,V(e,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(t)),d&&!s&&(o=!0,V(e,"array"));var h=o||n;return"dragKeys"===e&&s?i({},e,Object.assign(r,t)):"dragKeys"!==e||s?("dropZones"===e&&s&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},e,t):h?i({},e,r):{}):h?i({},e,r):{}},O=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e;if(n>0){var s=(e.right-e.left)*n,i=(e.bottom-e.top)*n;r={left:e.left+s,right:e.right-s,top:e.top+i,bottom:e.bottom-i}}return r.left<t.right&&r.right>t.left&&r.top<t.bottom&&r.bottom>t.top},K=function(e){var t=e.element,n=e.posDirection,r=e.containerRect,s=e.useTransform,i=k(t,s),o=_(i,"+",n);R(t,o,s);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,r=e.elementRect,s=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&R(t,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&R(t,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&R(t,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&R(t,{y:i.y,x:i.x+s.right-r.right},o)}({element:t,edges:T({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},R=function(e,t,n){if(n){var r=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:b(new Set(b(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(e){r.reset(),r._node=e,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=e instanceof Document?r||document.body:e,i=t.includes("top")&&s.scrollTop>0,o=t.includes("bottom")&&s.scrollTop<s.scrollHeight,a=t.includes("left")&&s.scrollLeft>0,l=t.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(e,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.HTMLNode)}}]),e}(),B=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,r=e.zoom,s=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return K({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),i(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return K({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?_(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?_(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var r=this,s=t.DS,o=t.id,a=t.element,l=t.droppables;n(this,e),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element&&(r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass))})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return O(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),W=s((function e(r){var s=this,o=r.DS;n(this,e),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(e){var n=e.dropZones;n&&(s._zones&&s._zones.forEach((function(e){return e.destroy()})),s._zones=n.map((function(e){return new F(t({DS:s.DS},e))})),s._zones.forEach((function(e){s._zoneByElement.set(e.element,e),s._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=s._zonesByDroppable.get(t);if(null==n||!n.length)return s._zonesByDroppable.set(t,[e]);s._zonesByDroppable.set(t,b(new Set([].concat(b(n),[e]))))}))})))})),i(this,"_handleDrop",(function(e){s._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,r=t.y,i=0,o=e.length;i<o;i++){var a=s._zoneByElement.get(e[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(e){if(e.isDragging){var t=s.getTarget();s._handleDrop(t)}})),i(this,"getItemsDroppedById",(function(e){var t=s._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),i(this,"getItemsInsideById",(function(e,t){var n=s._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var r=n.itemsInside;return t&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(e){var t;if(null!==(t=s._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==e?void 0:e.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return s.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),U=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),i(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),i(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(e.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(e.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),e.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),i(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.stop(t["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return s(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),X=s((function e(t){var r=this,s=t.DS;n(this,e),i(this,"subscribers",{}),i(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),i(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),i(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),i(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),i(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),i(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=s})),Y=function(e){o(r,d(Set));var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return Z(s.Settings.selectables).forEach((function(e){return s.add(e)}))})),i(h(s),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"_onClick",(function(e){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),i(h(s),"_onPointer",(function(e){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;s.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),g(a(r.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),g(a(r.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(),q=function(e){o(r,d(Set));var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),g(a(r.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=g(a(r.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(),G=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),i(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,p=new Map,S=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s:s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(S.s();!(n=S.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):p.set(g,b))}}catch(e){S.e(e)}finally{S.f()}if(!r.DS.continue){var m=r.filterSelected({select:h,unselect:p,selectorRect:d}),D=m.select,_=m.unselect;D.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.multiSelectionToggle,s=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(s.has(t)?r&&s.delete(t):s.add(t),t.classList.add(i))}({element:n,force:e,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.SelectedSet,s=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=r.has(t),a=s.has(t);o&&!a?r.delete(t):!o&&a&&r.add(t),t.classList.remove(i)}({element:n,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(e){var t=e.select,n=e.unselect;return e.selectorRect,{select:t,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(e,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,r=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),e}(),$=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,w(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,r=e.pointerPos,s={};return r.x>n.x-t.x?(s.left=n.x-t.x,s.width=r.x-n.x+t.x):(s.left=r.x,s.width=n.x-r.x-t.x),r.y>n.y-t.y?(s.top=n.y-t.y,s.height=r.y-n.y+t.y):(s.top=r.y,s.height=n.y-r.y-t.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),J=function(){function e(t){var r,s=this,o=t.DS;n(this,e),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[t][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var e=s.DS.Area.rect,t=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(e.top+t.top,"px"),i="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(e){s.stopAutoScroll(),e&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var e=s.DS,t=e.stores.PointerStore,n=e.Area;s.currentEdges=T({elementRect:w(t.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(e,t){return!(!s.DS.Area.HTMLNode.contains(e)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;s.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),s.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),Q=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),i(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),ee=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),i(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return s(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),e}(),te=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=A(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=A(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=A(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=_(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},r=_(_(t,"*",n),"-",t);return{x:t.x+r.x,y:t.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=A(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),ne=s((function e(r){var s=this,o=r.DS,a=r.settings;n(this,e),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(e){var n=e.settings,r=e.init;return s.DS.publish("Settings:updated:pre",t({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(e){for(var n=function(e,n){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},N("area",e.area,n,document)),N("selectables",e.selectables,n,null)),N("autoScrollSpeed",e.autoScrollSpeed,n,5)),N("overflowTolerance",e.overflowTolerance,n,{x:25,y:25})),N("zoom",e.zoom,n,1)),N("customStyles",e.customStyles,n,!1)),N("multiSelectMode",e.multiSelectMode,n,!1)),N("multiSelectToggling",e.multiSelectToggling,n,!0)),N("multiSelectKeys",e.multiSelectKeys,n,["Control","Shift","Meta"])),N("selector",e.selector,n,null)),N("selectionThreshold",e.selectionThreshold,n,0)),N("draggability",e.draggability,n,!0)),N("immediateDrag",e.immediateDrag,n,!0)),N("keyboardDrag",e.keyboardDrag,n,!0)),N("dragKeys",e.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),N("keyboardDragSpeed",e.keyboardDragSpeed,n,10)),N("useTransform",e.useTransform,n,!0)),N("refreshMemoryRate",e.refreshMemoryRate,n,80)),N("dropZones",e.dropZones,n,[])),N("dropInsideThreshold",e.dropInsideThreshold,n,1)),N("dropTargetThreshold",e.dropTargetThreshold,n,0)),N("usePointerEvents",e.usePointerEvents,n,!1)),N("hoverClass",e.hoverClass,n,"ds-hover")),N("selectableClass",e.selectableClass,n,"ds-selectable")),N("selectedClass",e.selectedClass,n,"ds-selected")),N("selectorClass",e.selectorClass,n,"ds-selector")),N("selectorAreaClass",e.selectorAreaClass,n,"ds-selector-area")),N("droppedTargetClass",e.droppedTargetClass,n,"ds-dropped-target")),N("droppedInsideClass",e.droppedInsideClass,n,"ds-dropped-inside")),N("droppableClass",e.droppableClass,n,"ds-droppable")),N("dropZoneClass",e.dropZoneClass,n,"ds-dropzone")),N("dropZoneReadyClass",e.dropZoneReadyClass,n,"ds-dropzone-ready")),N("dropZoneTargetClass",e.dropZoneTargetClass,n,"ds-dropzone-target")),N("dropZoneInsideClass",e.dropZoneInsideClass,n,"ds-dropzone-inside"))}(e.settings,e.init),r=function(){var e,t=v(a[o],2),n=t[0],r=t[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(e){return s.update({settings:i({},n,e)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(e={},i(e,n,s._settings[n]),i(e,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),e)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),re=function(){function e(r){var s=this;n(this,e),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(e){return s.stores.SettingsStore.update({settings:e})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(e){return s.stores.KeyStore.isMultiSelectKeyPressed(e)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(e){var t;return null===(t=s.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),i(this,"getItemsDroppedByZoneId",(function(e){return s.DropZones.getItemsDroppedById(e)})),i(this,"getItemsInsideByZoneId",(function(e,t){return s.DropZones.getItemsInsideById(e,t)})),this.PubSub=new X({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ne({DS:this,settings:r}),this.stores.PointerStore=new ee({DS:this}),this.stores.ScrollStore=new te({DS:this}),this.stores.KeyStore=new Q({DS:this}),this.Area=new H({DS:this}),this.Selector=new $({DS:this}),this.SelectorArea=new J({DS:this}),this.SelectableSet=new Y({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new G({DS:this}),this.Drag=new B({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new U({DS:this}),function(e){for(var n=e.subscribe,r=e.publish,s=e.Interaction,i=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return t({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=v(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return n(e?"".concat(o,":").concat(e):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(e?"".concat(e).concat(o.name):o.name,t(t({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(e,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(s){return t.SelectedSet.has(s)?t.removeSelection(e,n,r):t.addSelection(e,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var r=Z(e);return this.SelectableSet.addAll(r),t&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();re.isCollision=O;export{re as default};

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DragSelect=t()}(this,(function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,D(r.key),r)}}function s(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function S(e){var t=c();return function(){var n,r=a(e);if(t){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return p(this,n)}}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=f(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}},g.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var _=function(e,t,n){var r=e.x,s=e.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[t]},I=function(e){return{x:e.left,y:e.top}},w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},L=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);e.forEach((function(e,t){r.observe(e,{childList:0!==t,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(e,t){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,e.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,t)}},C=function(){var e,t,n,r;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},E=function(e){return function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=t[r])||void 0===n?void 0:n.parentNode;return s?(t.push(s),e(t,++r)):t}([e])},T=function(e){return!e||e instanceof Document?C():{x:e.scrollLeft>=0?e.scrollLeft:C().x,y:e.scrollTop>=0?e.scrollTop:C().y}},A=function(e){var t=e.elementRect,n=e.containerRect,r=e.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return t.top-s.y<n.top&&i.push("top"),t.left-s.x<n.left&&i.push("left"),t.bottom+s.y>n.bottom&&i.push("bottom"),t.right+s.y>n.right&&i.push("right"),i},x=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},k=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return x(e);var n={x:0,y:0},r=t.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:x(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(e);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(e)},M=function(e){var t=e.computedStyle,n=e.node,r=t.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},N=function(e,t,n,r){if(void 0===t)return n?i({},e,r):{};if(null===t)return i({},e,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof t||t instanceof String),a&&!s&&(o=!0,V(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(t)&&"number"==typeof t),l&&!s&&(o=!0,V(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(t)),c&&!s&&(o=!0,V(e,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof t),u&&!s&&(o=!0,V(e,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(t)),d&&!s&&(o=!0,V(e,"array"));var h=o||n;return"dragKeys"===e&&s?i({},e,Object.assign(r,t)):"dragKeys"!==e||s?("dropZones"===e&&s&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},e,t):h?i({},e,r):{}):h?i({},e,r):{}},O=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e;if(n>0){var s=(e.right-e.left)*n,i=(e.bottom-e.top)*n;r={left:e.left+s,right:e.right-s,top:e.top+i,bottom:e.bottom-i}}return r.left<t.right&&r.right>t.left&&r.top<t.bottom&&r.bottom>t.top},K=function(e){var t=e.element,n=e.posDirection,r=e.containerRect,s=e.useTransform,i=k(t,s),o=_(i,"+",n);R(t,o,s);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,r=e.elementRect,s=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&R(t,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&R(t,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&R(t,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&R(t,{y:i.y,x:i.x+s.right-r.right},o)}({element:t,edges:A({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},R=function(e,t,n){if(n){var r=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:b(new Set(b(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(e){r.reset(),r._node=e,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=e instanceof Document?r||document.body:e,i=t.includes("top")&&s.scrollTop>0,o=t.includes("bottom")&&s.scrollTop<s.scrollHeight,a=t.includes("left")&&s.scrollLeft>0,l=t.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(e,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.HTMLNode)}}]),e}(),B=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,r=e.zoom,s=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return K({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),i(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return K({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?_(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?_(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var r=this,s=t.DS,o=t.id,a=t.element,l=t.droppables;n(this,e),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return O(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),W=s((function e(r){var s=this,o=r.DS;n(this,e),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(e){var n=e.dropZones;n&&(s._zones&&s._zones.forEach((function(e){return e.destroy()})),s._zones=n.map((function(e){return new F(t({DS:s.DS},e))})),s._zones.forEach((function(e){s._zoneByElement.set(e.element,e),s._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=s._zonesByDroppable.get(t);if(null==n||!n.length)return s._zonesByDroppable.set(t,[e]);s._zonesByDroppable.set(t,b(new Set([].concat(b(n),[e]))))}))})))})),i(this,"_handleDrop",(function(e){s._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,r=t.y,i=0,o=e.length;i<o;i++){var a=s._zoneByElement.get(e[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(e){if(e.isDragging){var t=s.getTarget();s._handleDrop(t)}})),i(this,"getItemsDroppedById",(function(e){var t=s._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),i(this,"getItemsInsideById",(function(e,t){var n=s._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var r=n.itemsInside;return t&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(e){var t;if(null!==(t=s._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==e?void 0:e.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return s.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),U=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),i(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),i(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(e.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(e.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),e.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),i(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.stop(t["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return s(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),X=s((function e(t){var r=this,s=t.DS;n(this,e),i(this,"subscribers",{}),i(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),i(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),i(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),i(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),i(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),i(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=s})),Y=function(e){o(r,e);var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return Z(s.Settings.selectables).forEach((function(e){return s.add(e)}))})),i(h(s),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"_onClick",(function(e){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),i(h(s),"_onPointer",(function(e){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;s.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),g(a(r.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),g(a(r.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(d(Set)),q=function(e){o(r,e);var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),g(a(r.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=g(a(r.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(d(Set)),G=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),i(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,p=new Map,S=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s:s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(S.s();!(n=S.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):p.set(g,b))}}catch(e){S.e(e)}finally{S.f()}if(!r.DS.continue){var m=r.filterSelected({select:h,unselect:p,selectorRect:d}),D=m.select,_=m.unselect;D.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.multiSelectionToggle,s=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(s.has(t)?r&&s.delete(t):s.add(t),t.classList.add(i))}({element:n,force:e,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.SelectedSet,s=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=r.has(t),a=s.has(t);o&&!a?r.delete(t):!o&&a&&r.add(t),t.classList.remove(i)}({element:n,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(e){var t=e.select,n=e.unselect;return e.selectorRect,{select:t,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(e,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,r=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),e}(),$=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,w(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,r=e.pointerPos,s={};return r.x>n.x-t.x?(s.left=n.x-t.x,s.width=r.x-n.x+t.x):(s.left=r.x,s.width=n.x-r.x-t.x),r.y>n.y-t.y?(s.top=n.y-t.y,s.height=r.y-n.y+t.y):(s.top=r.y,s.height=n.y-r.y-t.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),J=function(){function e(t){var r,s=this,o=t.DS;n(this,e),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[t][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var e=s.DS.Area.rect,t=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(e.top+t.top,"px"),i="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(e){s.stopAutoScroll(),e&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var e=s.DS,t=e.stores.PointerStore,n=e.Area;s.currentEdges=A({elementRect:w(t.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(e,t){return!(!s.DS.Area.HTMLNode.contains(e)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;s.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),s.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),Q=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),i(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),ee=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),i(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return s(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),e}(),te=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=T(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=T(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=T(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=_(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},r=_(_(t,"*",n),"-",t);return{x:t.x+r.x,y:t.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=T(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),ne=s((function e(r){var s=this,o=r.DS,a=r.settings;n(this,e),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(e){var n=e.settings,r=e.init;return s.DS.publish("Settings:updated:pre",t({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(e){for(var n=function(e,n){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},N("area",e.area,n,document)),N("selectables",e.selectables,n,null)),N("autoScrollSpeed",e.autoScrollSpeed,n,5)),N("overflowTolerance",e.overflowTolerance,n,{x:25,y:25})),N("zoom",e.zoom,n,1)),N("customStyles",e.customStyles,n,!1)),N("multiSelectMode",e.multiSelectMode,n,!1)),N("multiSelectToggling",e.multiSelectToggling,n,!0)),N("multiSelectKeys",e.multiSelectKeys,n,["Control","Shift","Meta"])),N("selector",e.selector,n,null)),N("selectionThreshold",e.selectionThreshold,n,0)),N("draggability",e.draggability,n,!0)),N("immediateDrag",e.immediateDrag,n,!0)),N("keyboardDrag",e.keyboardDrag,n,!0)),N("dragKeys",e.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),N("keyboardDragSpeed",e.keyboardDragSpeed,n,10)),N("useTransform",e.useTransform,n,!0)),N("refreshMemoryRate",e.refreshMemoryRate,n,80)),N("dropZones",e.dropZones,n,[])),N("dropInsideThreshold",e.dropInsideThreshold,n,1)),N("dropTargetThreshold",e.dropTargetThreshold,n,0)),N("usePointerEvents",e.usePointerEvents,n,!1)),N("hoverClass",e.hoverClass,n,"ds-hover")),N("selectableClass",e.selectableClass,n,"ds-selectable")),N("selectedClass",e.selectedClass,n,"ds-selected")),N("selectorClass",e.selectorClass,n,"ds-selector")),N("selectorAreaClass",e.selectorAreaClass,n,"ds-selector-area")),N("droppedTargetClass",e.droppedTargetClass,n,"ds-dropped-target")),N("droppedInsideClass",e.droppedInsideClass,n,"ds-dropped-inside")),N("droppableClass",e.droppableClass,n,"ds-droppable")),N("dropZoneClass",e.dropZoneClass,n,"ds-dropzone")),N("dropZoneReadyClass",e.dropZoneReadyClass,n,"ds-dropzone-ready")),N("dropZoneTargetClass",e.dropZoneTargetClass,n,"ds-dropzone-target")),N("dropZoneInsideClass",e.dropZoneInsideClass,n,"ds-dropzone-inside"))}(e.settings,e.init),r=function(){var e,t=v(a[o],2),n=t[0],r=t[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(e){return s.update({settings:i({},n,e)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(e={},i(e,n,s._settings[n]),i(e,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),e)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),re=function(){function e(r){var s=this;n(this,e),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(e){return s.stores.SettingsStore.update({settings:e})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(e){return s.stores.KeyStore.isMultiSelectKeyPressed(e)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(e){var t;return null===(t=s.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),i(this,"getItemsDroppedByZoneId",(function(e){return s.DropZones.getItemsDroppedById(e)})),i(this,"getItemsInsideByZoneId",(function(e,t){return s.DropZones.getItemsInsideById(e,t)})),this.PubSub=new X({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ne({DS:this,settings:r}),this.stores.PointerStore=new ee({DS:this}),this.stores.ScrollStore=new te({DS:this}),this.stores.KeyStore=new Q({DS:this}),this.Area=new H({DS:this}),this.Selector=new $({DS:this}),this.SelectorArea=new J({DS:this}),this.SelectableSet=new Y({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new G({DS:this}),this.Drag=new B({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new U({DS:this}),function(e){for(var n=e.subscribe,r=e.publish,s=e.Interaction,i=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return t({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=v(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return n(e?"".concat(o,":").concat(e):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(e?"".concat(e).concat(o.name):o.name,t(t({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(e,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(s){return t.SelectedSet.has(s)?t.removeSelection(e,n,r):t.addSelection(e,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var r=Z(e);return this.SelectableSet.addAll(r),t&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();return re.isCollision=O,re}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DragSelect=t()}(this,(function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,D(r.key),r)}}function s(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&l(s,n.prototype),s},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function S(e){var t=c();return function(){var n,r=a(e);if(t){var s=a(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return p(this,n)}}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=f(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}},g.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,i,o,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var _=function(e,t,n){var r=e.x,s=e.y,i=n.x,o=n.y;return{"+":{x:r+i,y:s+o},"-":{x:r-i,y:s-o},"*":{x:r*i,y:s*o},"/":{x:r/i,y:s/o}}[t]},I=function(e){return{x:e.left,y:e.top}},w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},L=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var r=new MutationObserver(n);e.forEach((function(e,t){r.observe(e,{childList:0!==t,attributes:!0})}));return{observer:r,callback:n,cleanup:function(){return j(r,n)}}},P=function(e,t){var n;return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=function(){n=null,e.apply(void 0,s)};clearTimeout(n),n=setTimeout(o,t)}},C=function(){var e,t,n,r;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(r=document.documentElement)||void 0===r?void 0:r.scrollLeft)||0}},E=function(e){return function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=null===(n=t[r])||void 0===n?void 0:n.parentNode;return s?(t.push(s),e(t,++r)):t}([e])},T=function(e){return!e||e instanceof Document?C():{x:e.scrollLeft>=0?e.scrollLeft:C().x,y:e.scrollTop>=0?e.scrollTop:C().y}},A=function(e){var t=e.elementRect,n=e.containerRect,r=e.tolerance,s=void 0===r?{x:0,y:0}:r,i=[];return t.top-s.y<n.top&&i.push("top"),t.left-s.x<n.left&&i.push("left"),t.bottom+s.y>n.bottom&&i.push("bottom"),t.right+s.y>n.right&&i.push("right"),i},x=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var r=n.transform.trim().match(/matrix3d\((.*?)\)/);if(r&&r.length){var s,i=null===(s=r[1])||void 0===s?void 0:s.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},k=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return x(e);var n={x:0,y:0},r=t.trim().match(/translate[3dD]*?\(.*?\)/);if(r){var s,i=null===(s=r[0])||void 0===s?void 0:s.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:x(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var r=window.getComputedStyle(e);return{x:parseInt(r.left)||0,y:parseInt(r.top)||0}}return n}(e)},M=function(e){var t=e.computedStyle,n=e.node,r=t.position;n instanceof Document||("absolute"===r||"relative"===r||"fixed"===r)||(n.style.position="relative")},V=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},N=function(e,t,n,r){if(void 0===t)return n?i({},e,r):{};if(null===t)return i({},e,null);var s=!0,o=!1,a="string"==typeof r;a&&(s="string"==typeof t||t instanceof String),a&&!s&&(o=!0,V(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(s=!Number.isNaN(t)&&"number"==typeof t),l&&!s&&(o=!0,V(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(s="[object Object]"===Object.prototype.toString.call(t)),c&&!s&&(o=!0,V(e,"object"));var u="boolean"==typeof r;u&&(s="boolean"==typeof t),u&&!s&&(o=!0,V(e,"boolean"));var d=Array.isArray(r);d&&(s=Array.isArray(t)),d&&!s&&(o=!0,V(e,"array"));var h=o||n;return"dragKeys"===e&&s?i({},e,Object.assign(r,t)):"dragKeys"!==e||s?("dropZones"===e&&s&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),s?i({},e,t):h?i({},e,r):{}):h?i({},e,r):{}},O=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e;if(n>0){var s=(e.right-e.left)*n,i=(e.bottom-e.top)*n;r={left:e.left+s,right:e.right-s,top:e.top+i,bottom:e.bottom-i}}return r.left<t.right&&r.right>t.left&&r.top<t.bottom&&r.bottom>t.top},K=function(e){var t=e.element,n=e.posDirection,r=e.containerRect,s=e.useTransform,i=k(t,s),o=_(i,"+",n);R(t,o,s);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,r=e.elementRect,s=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&R(t,{y:i.y+s.top-r.top,x:i.x},o),n.includes("left")&&R(t,{y:i.y,x:i.x+s.left-r.left},o),n.includes("bottom")&&R(t,{y:i.y+s.bottom-r.bottom,x:i.x},o),n.includes("right")&&R(t,{y:i.y,x:i.x+s.right-r.right},o)}({element:t,edges:A({elementRect:a,containerRect:r}),elementRect:a,containerRect:r,elementPos:o,useTransform:s})},j=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},R=function(e,t,n){if(n){var r=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(r.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:b(new Set(b(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"DS",void 0),i(this,"_observers",void 0),i(this,"_node",void 0),i(this,"_parentNodes",void 0),i(this,"_computedStyle",void 0),i(this,"_computedBorder",void 0),i(this,"_rect",void 0),i(this,"setArea",(function(e){r.reset(),r._node=e,M({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),i(this,"start",(function(){r._observers=L(r.parentNodes,P((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),i(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),i(this,"stop",(function(){r._observers.cleanup(),r.reset()})),i(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var r=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,s=e instanceof Document?r||document.body:e,i=t.includes("top")&&s.scrollTop>0,o=t.includes("bottom")&&s.scrollTop<s.scrollHeight,a=t.includes("left")&&s.scrollLeft>0,l=t.includes("right")&&s.scrollLeft<s.scrollWidth;i&&(s.scrollTop-=1*n),o&&(s.scrollTop+=1*n),a&&(s.scrollLeft-=1*n),l&&(s.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=s,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return s(e,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.HTMLNode)}}]),e}(),B=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevCursorPos",void 0),i(this,"_prevScrollPos",void 0),i(this,"_elements",[]),i(this,"_dragKeys",void 0),i(this,"_dragKeysFlat",[]),i(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(b(r._dragKeys.up),b(r._dragKeys.down),b(r._dragKeys.left),b(r._dragKeys.right))})),i(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,r=e.zoom,s=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*r:n*r;return i.left.includes(s)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(s)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(s)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(s)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return K({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),i(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),i(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),i(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),i(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=_(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return K({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),i(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=s,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return s(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?_(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?_(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var r=this,s=t.DS,o=t.id,a=t.element,l=t.droppables;n(this,e),i(this,"id",void 0),i(this,"element",void 0),i(this,"_droppables",void 0),i(this,"_rect",void 0),i(this,"_observers",void 0),i(this,"_timeout",void 0),i(this,"_itemsDropped",[]),i(this,"_itemsInside",void 0),i(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),i(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=b(new Set([].concat(b(r._itemsDropped),b(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),i(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),i(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),i(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),i(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element&&(r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass))})),this._observers=L(this.parentNodes,P((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return O(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=E(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),W=s((function e(r){var s=this,o=r.DS;n(this,e),i(this,"_zoneByElement",new Map),i(this,"_zoneById",new Map),i(this,"_zonesByDroppable",new Map),i(this,"_zones",void 0),i(this,"setDropZones",(function(e){var n=e.dropZones;n&&(s._zones&&s._zones.forEach((function(e){return e.destroy()})),s._zones=n.map((function(e){return new F(t({DS:s.DS},e))})),s._zones.forEach((function(e){s._zoneByElement.set(e.element,e),s._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=s._zonesByDroppable.get(t);if(null==n||!n.length)return s._zonesByDroppable.set(t,[e]);s._zonesByDroppable.set(t,b(new Set([].concat(b(n),[e]))))}))})))})),i(this,"_handleDrop",(function(e){s._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),i(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,r=t.y,i=0,o=e.length;i<o;i++){var a=s._zoneByElement.get(e[i]);if(a&&O(a.rect,{left:n,right:n,top:r,bottom:r},Math.min(s.Settings.dropTargetThreshold,.5)))return a}})),i(this,"stop",(function(e){if(e.isDragging){var t=s.getTarget();s._handleDrop(t)}})),i(this,"getItemsDroppedById",(function(e){var t=s._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),i(this,"getItemsInsideById",(function(e,t){var n=s._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var r=n.itemsInside;return t&&n.handleItemsInsideClasses(),r})),i(this,"getTarget",(function(e){var t;if(null!==(t=s._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||s.DS.stores.PointerStore.currentVal.x,r=(null==e?void 0:e.y)||s.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,r);return s._getZoneByElementsFromPoint(i,{x:n,y:r})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return s.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)})),U=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"isInteracting",void 0),i(this,"isDragging",void 0),i(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),i(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),i(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),i(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),i(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),i(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),i(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DS.Area.HTMLNode;r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(e.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(e.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),e.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),i(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),i(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),i(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",(function(e){var t=e.settings;r.stop(t["area:pre"]),r.init()})),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return s(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),X=s((function e(t){var r=this,s=t.DS;n(this,e),i(this,"subscribers",{}),i(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),i(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),i(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),i(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),i(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),i(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=s})),Y=function(e){o(r,e);var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"_rects",void 0),i(h(s),"_timeout",void 0),i(h(s),"init",(function(){return Z(s.Settings.selectables).forEach((function(e){return s.add(e)}))})),i(h(s),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"_onClick",(function(e){return s.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),i(h(s),"_onPointer",(function(e){return s.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s.Settings=o.stores.SettingsStore.s,s.DS.subscribe("Interaction:init",s.init),s.DS.PubSub.subscribe("Settings:updated:selectables",(function(){s.clear(),s.init()})),s.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;s.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&M({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),g(a(r.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),g(a(r.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),r}(d(Set)),q=function(e){o(r,e);var t=S(r);function r(e){var s,o=e.DS;return n(this,r),i(h(s=t.call(this)),"clear",(function(){return s.forEach((function(e){return s.delete(e)}))})),i(h(s),"addAll",(function(e){return e.forEach((function(e){return s.add(e)}))})),i(h(s),"deleteAll",(function(e){return e.forEach((function(e){return s.delete(e)}))})),s.DS=o,s}return s(r,[{key:"add",value:function(e){if(!g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),g(a(r.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(g(a(r.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=g(a(r.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),r}(d(Set)),G=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_prevSelectedSet",void 0),i(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),i(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),i(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling,c=r.Settings.selectionThreshold,u=i.rects,d=a.rect,h=new Map,p=new Map,S=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s:s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(u);try{for(S.s();!(n=S.n()).done;){var f=v(n.value,2),g=f[0],b=f[1];o.isInside(g,b)&&(O(b,d,c)?h.set(g,b):p.set(g,b))}}catch(e){S.e(e)}finally{S.f()}if(!r.DS.continue){var m=r.filterSelected({select:h,unselect:p,selectorRect:d}),D=m.select,_=m.unselect;D.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.multiSelectionToggle,s=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(s.has(t)?r&&s.delete(t):s.add(t),t.classList.add(i))}({element:n,force:e,multiSelectionToggle:l,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),_.forEach((function(t,n){return function(e){var t=e.element,n=e.force,r=e.SelectedSet,s=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=r.has(t),a=s.has(t);o&&!a?r.delete(t):!o&&a&&r.add(t),t.classList.remove(i)}({element:n,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})}))}})),i(this,"filterSelected",(function(e){var t=e.select,n=e.unselect;return e.selectorRect,{select:t,unselect:n}})),this.DS=s,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return s(e,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,r=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(r):this._prevSelectedSet=new Set}}]),e}(),$=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_rect",void 0),i(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 175, 255, 0.2)",s.style.border="1px solid rgba(0, 175, 255, 0.8)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),i(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,w(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),i(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),i(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,r=e.pointerPos,s={};return r.x>n.x-t.x?(s.left=n.x-t.x,s.width=r.x-n.x+t.x):(s.left=r.x,s.width=n.x-r.x-t.x),r.y>n.y-t.y?(s.top=n.y-t.y,s.height=r.y-n.y+t.y):(s.top=r.y,s.height=n.y-r.y-t.y),s}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=s,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return s(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),J=function(){function e(t){var r,s=this,o=t.DS;n(this,e),i(this,"_scrollInterval",void 0),i(this,"_rect",void 0),i(this,"currentEdges",[]),i(this,"start",(function(){return s.applyElements("append")})),i(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");s.HTMLNode[n](s.DS.Selector.HTMLNode),document[t][n](s.HTMLNode)})),i(this,"updatePos",(function(){s._rect=null;var e=s.DS.Area.rect,t=s.DS.Area.computedBorder,n=s.HTMLNode.style,r="".concat(e.top+t.top,"px"),i="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==r&&(n.top=r),n.left!==i&&(n.left=i),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),i(this,"stop",(function(e){s.stopAutoScroll(),e&&s.applyElements("remove")})),i(this,"startAutoScroll",(function(){s.currentEdges=[],s._scrollInterval=setInterval((function(){return s.handleAutoScroll()}),16)})),i(this,"handleAutoScroll",(function(){if(!s.DS.continue){var e=s.DS,t=e.stores.PointerStore,n=e.Area;s.currentEdges=A({elementRect:w(t.currentVal),containerRect:s.rect,tolerance:s.DS.stores.SettingsStore.s.overflowTolerance}),s.currentEdges.length&&n.scroll(s.currentEdges,s.DS.stores.SettingsStore.s.autoScrollSpeed)}})),i(this,"stopAutoScroll",(function(){s.currentEdges=[],clearInterval(s._scrollInterval)})),i(this,"isInside",(function(e,t){return!(!s.DS.Area.HTMLNode.contains(e)||!s.DS.stores.ScrollStore.canScroll)||O(s.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;s.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),s.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){s.updatePos(),s.stopAutoScroll()}))}return s(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return O({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),Q=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_currentValues",new Set),i(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),i(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),i(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),i(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),i(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),i(this,"reset",(function(){return r._currentValues.clear()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init)}return s(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),ee=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_isMouseInteraction",!1),i(this,"_initialValArea",void 0),i(this,"_currentValArea",void 0),i(this,"_lastValArea",void 0),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_lastVal",void 0),i(this,"_lastTouch",void 0),i(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),i(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),i(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),i(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),i(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=s,this.Settings=s.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return s(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&_(e,"-",_(I(this.DS.Area.rect),"+",I(this.DS.Area.computedBorder)))}}]),e}(),te=function(){function e(t){var r=this,s=t.DS;n(this,e),i(this,"_initialVal",void 0),i(this,"_currentVal",void 0),i(this,"_canScroll",void 0),i(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"start",(function(){r._currentVal=r._initialVal=T(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),i(this,"update",(function(){return r._currentVal=T(r.DS.stores.SettingsStore.s.area)})),i(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),i(this,"reset",(function(){r.stop(),r.start()})),this.DS=s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return s(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=T(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=_(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},r=_(_(t,"*",n),"-",t);return{x:t.x+r.x,y:t.y+r.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=T(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),ne=s((function e(r){var s=this,o=r.DS,a=r.settings;n(this,e),i(this,"_settings",{}),i(this,"s",{}),i(this,"update",(function(e){var n=e.settings,r=e.init;return s.DS.publish("Settings:updated:pre",t({settings:n},r?{init:r}:{}))})),i(this,"_update",(function(e){for(var n=function(e,n){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},N("area",e.area,n,document)),N("selectables",e.selectables,n,null)),N("autoScrollSpeed",e.autoScrollSpeed,n,5)),N("overflowTolerance",e.overflowTolerance,n,{x:25,y:25})),N("zoom",e.zoom,n,1)),N("customStyles",e.customStyles,n,!1)),N("multiSelectMode",e.multiSelectMode,n,!1)),N("multiSelectToggling",e.multiSelectToggling,n,!0)),N("multiSelectKeys",e.multiSelectKeys,n,["Control","Shift","Meta"])),N("selector",e.selector,n,null)),N("selectionThreshold",e.selectionThreshold,n,0)),N("draggability",e.draggability,n,!0)),N("immediateDrag",e.immediateDrag,n,!0)),N("keyboardDrag",e.keyboardDrag,n,!0)),N("dragKeys",e.dragKeys,n,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),N("keyboardDragSpeed",e.keyboardDragSpeed,n,10)),N("useTransform",e.useTransform,n,!0)),N("refreshMemoryRate",e.refreshMemoryRate,n,80)),N("dropZones",e.dropZones,n,[])),N("dropInsideThreshold",e.dropInsideThreshold,n,1)),N("dropTargetThreshold",e.dropTargetThreshold,n,0)),N("usePointerEvents",e.usePointerEvents,n,!1)),N("hoverClass",e.hoverClass,n,"ds-hover")),N("selectableClass",e.selectableClass,n,"ds-selectable")),N("selectedClass",e.selectedClass,n,"ds-selected")),N("selectorClass",e.selectorClass,n,"ds-selector")),N("selectorAreaClass",e.selectorAreaClass,n,"ds-selector-area")),N("droppedTargetClass",e.droppedTargetClass,n,"ds-dropped-target")),N("droppedInsideClass",e.droppedInsideClass,n,"ds-dropped-inside")),N("droppableClass",e.droppableClass,n,"ds-droppable")),N("dropZoneClass",e.dropZoneClass,n,"ds-dropzone")),N("dropZoneReadyClass",e.dropZoneReadyClass,n,"ds-dropzone-ready")),N("dropZoneTargetClass",e.dropZoneTargetClass,n,"ds-dropzone-target")),N("dropZoneInsideClass",e.dropZoneInsideClass,n,"ds-dropzone-inside"))}(e.settings,e.init),r=function(){var e,t=v(a[o],2),n=t[0],r=t[1];n in s._settings||Object.defineProperty(s.s,n,{get:function(){return s._settings[n]},set:function(e){return s.update({settings:i({},n,e)})}}),s._settings["".concat(n,":pre")]=s._settings[n],s._settings[n]=r;var l={settings:(e={},i(e,n,s._settings[n]),i(e,"".concat(n,":pre"),s._settings["".concat(n,":pre")]),e)};s.DS.publish("Settings:updated",l),s.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(n);o<a.length;o++)r()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})})),re=function(){function e(r){var s=this;n(this,e),i(this,"continue",!1),i(this,"start",(function(){s.stopped=!1,s.Interaction.init()})),i(this,"break",(function(){return s.continue=!0})),i(this,"setSettings",(function(e){return s.stores.SettingsStore.update({settings:e})})),i(this,"getSelection",(function(){return s.SelectedSet.elements})),i(this,"getSelectables",(function(){return s.SelectableSet.elements})),i(this,"getInitialCursorPosition",(function(){return s.stores.PointerStore.initialVal})),i(this,"getCurrentCursorPosition",(function(){return s.stores.PointerStore.currentVal})),i(this,"getPreviousCursorPosition",(function(){return s.stores.PointerStore.lastVal})),i(this,"getInitialCursorPositionArea",(function(){return s.stores.PointerStore.initialValArea})),i(this,"getCurrentCursorPositionArea",(function(){return s.stores.PointerStore.currentValArea})),i(this,"getPreviousCursorPositionArea",(function(){return s.stores.PointerStore.lastValArea})),i(this,"isMultiSelect",(function(e){return s.stores.KeyStore.isMultiSelectKeyPressed(e)})),i(this,"isDragging",(function(){return s.Interaction.isDragging})),i(this,"getZoneByCoordinates",(function(e){var t;return null===(t=s.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),i(this,"getItemsDroppedByZoneId",(function(e){return s.DropZones.getItemsDroppedById(e)})),i(this,"getItemsInsideByZoneId",(function(e,t){return s.DropZones.getItemsInsideById(e,t)})),this.PubSub=new X({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ne({DS:this,settings:r}),this.stores.PointerStore=new ee({DS:this}),this.stores.ScrollStore=new te({DS:this}),this.stores.KeyStore=new Q({DS:this}),this.Area=new H({DS:this}),this.Selector=new $({DS:this}),this.SelectorArea=new J({DS:this}),this.SelectableSet=new Y({DS:this}),this.SelectedSet=new q({DS:this}),this.Selection=new G({DS:this}),this.Drag=new B({DS:this}),this.DropZones=new W({DS:this}),this.Interaction=new U({DS:this}),function(e){for(var n=e.subscribe,r=e.publish,s=e.Interaction,i=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return t({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=v(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return n(e?"".concat(o,":").concat(e):o,(function(n){return a.forEach((function(o){return(!o.condition||o.condition(n))&&r(e?"".concat(e).concat(o.name):o.name,t(t({items:i.elements,isDragging:s.isDragging},n),o.extraData?o.extraData(n):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return s.continue=!1})),this.start()}return s(e,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(s){return t.SelectedSet.has(s)?t.removeSelection(e,n,r):t.addSelection(e,n,r)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var r=Z(e);return this.SelectableSet.addAll(r),t&&this.SelectedSet.addAll(r),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();return re.isCollision=O,re}));
{
"name": "dragselect",
"version": "2.6.0",
"version": "2.6.1",
"description": "Easy JavaScript library for selecting and moving elements. With no dependencies. Drag-Select & Drag-And-Drop.",

@@ -5,0 +5,0 @@ "main": "./dist/DragSelect.js",

@@ -79,2 +79,3 @@ // @ts-check

this.DS.subscribe('Settings:updated:dropZoneClass', ({ settings }) => {
if (!this.element) return
this.element.classList.remove(settings['dropZoneClass:pre'])

@@ -81,0 +82,0 @@ this.element.classList.add(settings.dropZoneClass)

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