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

selecto

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selecto - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

4

dist/selecto.cjs.js

@@ -7,3 +7,3 @@ /*

repository: git+https://github.com/daybrush/selecto.git
version: 0.0.17
version: 0.0.18
*/

@@ -169,3 +169,3 @@ 'use strict';

var injector = styled("\n:host {\n position: absolute;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n");
var injector = styled("\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n");
/**

@@ -172,0 +172,0 @@ * @memberof Selecto

@@ -7,3 +7,3 @@ /*

repository: git+https://github.com/daybrush/selecto.git
version: 0.0.17
version: 0.0.18
*/

@@ -167,3 +167,3 @@ import Component from '@egjs/component';

var injector = styled("\n:host {\n position: absolute;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n");
var injector = styled("\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n");
/**

@@ -170,0 +170,0 @@ * @memberof Selecto

@@ -7,3 +7,3 @@ /*

repository: git+https://github.com/daybrush/selecto.git
version: 0.0.17
version: 0.0.18
*/

@@ -165,3 +165,3 @@ (function (global, factory) {

var injector = styled("\n:host {\n position: absolute;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n");
var injector = styled("\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n");
/**

@@ -168,0 +168,0 @@ * @memberof Selecto

@@ -7,5 +7,5 @@ /*

repository: git+https://github.com/daybrush/selecto.git
version: 0.0.17
version: 0.0.18
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/component"),require("@daybrush/drag"),require("framework-utils"),require("@daybrush/utils"),require("@egjs/children-differ"),require("keycon"),require("css-styled")):"function"==typeof define&&define.amd?define(["@egjs/component","@daybrush/drag","framework-utils","@daybrush/utils","@egjs/children-differ","keycon","css-styled"],e):(t=t||self).Selecto=e(t.Component,t.Dragger,t.frameworkUtils,t.utils,t.ChildrenDiffer,t.KeyController,t.styled)}(this,function(t,s,a,g,y,c,e){"use strict";var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function d(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.className,s=i.style;return{tag:t,className:void 0===o?"":o,style:void 0===s?{}:s,attributes:function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(i,["className","style"]),children:n}}function f(t,e,n){t!==e&&n(t,e)}var h=e("\n:host {\n position: absolute;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n"),p="selecto-selection "+h.className,m=["selectableTargets","selectByClick","selectFromInside","continueSelect","toggleContinueSelect","keyContainer","hitRate"],n=function(e){function t(){this.constructor=n}var n,r;function i(t){void 0===t&&(t={});var p=e.call(this)||this;return p.selectedTargets=[],p.differ=new y,p.onDragStart=function(t,e){var n=t.datas,r=t.clientX,i=t.clientY,o=t.inputEvent,s=p.options,a=s.continueSelect,c=s.selectFromInside,l=p.getSelectableTargets(),u=l.map(function(t){var e=t.getBoundingClientRect(),n=e.left,r=e.top;return{left:n,top:r,right:n+e.width,bottom:r+e.height}});n.selectableTargets=l,n.selectableRects=u,n.startSelectedTargets=p.selectedTargets;var d=e||document.elementFromPoint(r,i),f=p.hitTest({left:r,top:i,right:r,bottom:i},r,i,l,u).filter(function(t){return t===d||t.contains(d)}),g=0<f.length;a?f=p.getSelectedTargets(f):p.selectedTargets=[];var h=o.type;return!(("mousedown"===h||"touchstart"===h)&&!p.trigger("dragStart",t))&&(p.select(f,o,!0),n.startX=r,n.startY=i,n.selectedTargets=f,p.target.style.cssText+="left:"+r+"px;top:"+i+"px",!(!c&&g)||(p.onDragEnd(t),o.preventDefault(),!1))},p.onDrag=function(t){var e=t.distX,n=t.distY,r=t.datas,i=t.inputEvent,o=r.startX,s=r.startY,a=Math.min(0,e),c=Math.min(0,n),l=Math.abs(e),u=Math.abs(n);p.target.style.cssText+="display: block;transform: translate("+a+"px, "+c+"px);width:"+l+"px;height:"+u+"px;";var d=o+a,f=s+c,g=p.hitTest({left:d,top:f,right:d+l,bottom:f+u},r.startX,r.startY,r.selectableTargets,r.selectableRects),h=p.getSelectedTargets(g);p.select(h,i),r.selectedTargets=h},p.onDragEnd=function(t){var e=t.datas,n=t.inputEvent;p.target.style.cssText+="display: none;",p.selecteEnd(e.startSelectedTargets,e.selectedTargets,n),p.selectedTargets=e.selectedTargets},p.onKeyDown=function(t){p.sameCombiKey(t)&&(p.continueSelect=!0,p.trigger("keydown",{}))},p.onKeyUp=function(t){p.sameCombiKey(t)&&(p.continueSelect=!1,p.trigger("keyup",{}))},p.onBlur=function(){p.toggleContinueSelect&&p.continueSelect&&p.trigger("keyup",{})},p.onDocumentSelectStart=function(t){if(p.dragger.isFlag()){var e=p.dragContainer;e===window&&(e=document.documentElement),e!==t.target&&!e.contains(t.target)||t.preventDefault()}},p.target=t.target,p.container=t.container,p.options=u({target:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,hitRate:100,continueSelect:!1,toggleContinueSelect:null,keyContainer:null},t),p.initElement(),p.setKeyController(),p}l(n=i,r=e),n.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t);var o=i.prototype;return o.setSelectedTargets=function(t){this.selectedTargets=t,this.differ=new y(t)},o.setKeyContainer=function(t){var e=this,n=this.options;f(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},o.setToggleContinueSelect=function(t){var e=this,n=this.options;f(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},o.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.dragger.unset(),this.injectResult.destroy(),g.removeEvent(document,"selectstart",this.onDocumentSelectStart),this.keycon=null,this.dragger=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},o.click=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),r={datas:{},clientX:n.clientX,clientY:n.clientY,inputEvent:t};this.onDragStart(r,e)&&this.onDragEnd(r)},o.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect;this.keycon&&(this.keycon.destroy(),this.keycon=null),n&&(this.keycon=new c(e||window),this.keycon.keydown(this.onKeyDown).keyup(this.onKeyUp).on("blur",this.onBlur))},o.setKeyEvent=function(){this.options.toggleContinueSelect&&!this.keycon&&this.setKeyController()},o.initElement=function(){this.target=function n(t,e,r){var i=t.tag,o=t.children,s=t.attributes,a=t.className,c=t.style,l=e||document.createElement(i);for(var u in s)l.setAttribute(u,s[u]);var d=l.children;if(o.forEach(function(t,e){n(t,d[e],l)}),a&&a.split(" ").forEach(function(t){g.hasClass(l,t)||g.addClass(l,t)}),c){var f=l.style;for(var u in c)f[u]=c[u]}return!e&&r&&r.appendChild(l),l}(d("div",{className:p}),this.target,this.container);var t=this.target;this.dragContainer=this.options.dragContainer||this.target.parentElement,this.dragger=new s(this.dragContainer,{container:window,preventDefault:!1,dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd}),g.addEvent(document,"selectstart",this.onDocumentSelectStart),this.injectResult=h.inject(t)},o.hitTest=function(t,g,h,p,e){var n=this.options,y=n.hitRate,m=n.selectByClick,v=t.left,b=t.top,S=t.right,C=t.bottom,k=[];return e.forEach(function(t,e){var n=t.left,r=t.top,i=t.right,o=t.bottom,s=n<=g&&g<=i&&r<=h&&h<=o,a=(i-n)*(o-r),c=Math.max(n,v),l=Math.min(i,S),u=Math.max(r,b),d=Math.min(o,C);if(m&&s)k.push(p[e]);else if(!(l<c||d<u)){var f=Math.round((l-c)*(d-u)/a*100);y<=f&&k.push(p[e])}}),k},o.getSelectableTargets=function(){var e=[];return this.options.selectableTargets.forEach(function(t){g.isObject(t)?e.push(t):[].slice.call(document.querySelectorAll(t)).forEach(function(t){e.push(t)})}),e},o.getSelectedTargets=function(t){var e=y.diff(this.selectedTargets,t),n=e.list,r=e.prevList,i=e.added,o=e.removed;return i.map(function(t){return n[t]}).concat(o.map(function(t){return r[t]}))},o.select=function(t,e,n){var r=this.differ.update(t),i=r.added,o=r.removed,s=r.prevList,a=r.list;n&&this.trigger("selectStart",{selected:t,added:i.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e}),(i.length||o.length)&&this.trigger("select",{selected:t,added:i.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e})},o.selecteEnd=function(t,e,n){var r=y.diff(t,e),i=r.added,o=r.removed,s=r.prevList,a=r.list,c=y.diff(this.selectedTargets,e),l=c.added,u=c.removed,d=c.prevList,f=c.list,g=n.type,h="mousedown"===g||"touchstart"===g;this.trigger("selectEnd",{selected:e,added:i.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),afterAdded:l.map(function(t){return f[t]}),afterRemoved:u.map(function(t){return d[t]}),isDragStart:h,inputEvent:n})},o.sameCombiKey=function(t){var e=[].concat(this.options.toggleContinueSelect),n=c.getCombi(t.inputEvent,t.key);return e.every(function(t){return-1<n.indexOf(t)})},i=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;0<=a;a--)(i=t[a])&&(s=(o<3?i(s):3<o?i(e,n,s):i(e,n))||s);return 3<o&&s&&Object.defineProperty(e,n,s),s}([a.Properties(m,function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=g.camelize("set "+e);t[r]?n.set=function(t){this[r](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)})],i)}(t),r={__proto__:null,default:n};for(var i in r)n[i]=r[i];return n});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/component"),require("@daybrush/drag"),require("framework-utils"),require("@daybrush/utils"),require("@egjs/children-differ"),require("keycon"),require("css-styled")):"function"==typeof define&&define.amd?define(["@egjs/component","@daybrush/drag","framework-utils","@daybrush/utils","@egjs/children-differ","keycon","css-styled"],e):(t=t||self).Selecto=e(t.Component,t.Dragger,t.frameworkUtils,t.utils,t.ChildrenDiffer,t.KeyController,t.styled)}(this,function(t,s,a,g,y,c,e){"use strict";var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function d(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.className,s=i.style;return{tag:t,className:void 0===o?"":o,style:void 0===s?{}:s,attributes:function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(i,["className","style"]),children:n}}function f(t,e,n){t!==e&&n(t,e)}var h=e("\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n"),p="selecto-selection "+h.className,m=["selectableTargets","selectByClick","selectFromInside","continueSelect","toggleContinueSelect","keyContainer","hitRate"],n=function(e){function t(){this.constructor=n}var n,r;function i(t){void 0===t&&(t={});var p=e.call(this)||this;return p.selectedTargets=[],p.differ=new y,p.onDragStart=function(t,e){var n=t.datas,r=t.clientX,i=t.clientY,o=t.inputEvent,s=p.options,a=s.continueSelect,c=s.selectFromInside,l=p.getSelectableTargets(),u=l.map(function(t){var e=t.getBoundingClientRect(),n=e.left,r=e.top;return{left:n,top:r,right:n+e.width,bottom:r+e.height}});n.selectableTargets=l,n.selectableRects=u,n.startSelectedTargets=p.selectedTargets;var d=e||document.elementFromPoint(r,i),f=p.hitTest({left:r,top:i,right:r,bottom:i},r,i,l,u).filter(function(t){return t===d||t.contains(d)}),g=0<f.length;a?f=p.getSelectedTargets(f):p.selectedTargets=[];var h=o.type;return!(("mousedown"===h||"touchstart"===h)&&!p.trigger("dragStart",t))&&(p.select(f,o,!0),n.startX=r,n.startY=i,n.selectedTargets=f,p.target.style.cssText+="left:"+r+"px;top:"+i+"px",!(!c&&g)||(p.onDragEnd(t),o.preventDefault(),!1))},p.onDrag=function(t){var e=t.distX,n=t.distY,r=t.datas,i=t.inputEvent,o=r.startX,s=r.startY,a=Math.min(0,e),c=Math.min(0,n),l=Math.abs(e),u=Math.abs(n);p.target.style.cssText+="display: block;transform: translate("+a+"px, "+c+"px);width:"+l+"px;height:"+u+"px;";var d=o+a,f=s+c,g=p.hitTest({left:d,top:f,right:d+l,bottom:f+u},r.startX,r.startY,r.selectableTargets,r.selectableRects),h=p.getSelectedTargets(g);p.select(h,i),r.selectedTargets=h},p.onDragEnd=function(t){var e=t.datas,n=t.inputEvent;p.target.style.cssText+="display: none;",p.selecteEnd(e.startSelectedTargets,e.selectedTargets,n),p.selectedTargets=e.selectedTargets},p.onKeyDown=function(t){p.sameCombiKey(t)&&(p.continueSelect=!0,p.trigger("keydown",{}))},p.onKeyUp=function(t){p.sameCombiKey(t)&&(p.continueSelect=!1,p.trigger("keyup",{}))},p.onBlur=function(){p.toggleContinueSelect&&p.continueSelect&&p.trigger("keyup",{})},p.onDocumentSelectStart=function(t){if(p.dragger.isFlag()){var e=p.dragContainer;e===window&&(e=document.documentElement),e!==t.target&&!e.contains(t.target)||t.preventDefault()}},p.target=t.target,p.container=t.container,p.options=u({target:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,hitRate:100,continueSelect:!1,toggleContinueSelect:null,keyContainer:null},t),p.initElement(),p.setKeyController(),p}l(n=i,r=e),n.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t);var o=i.prototype;return o.setSelectedTargets=function(t){this.selectedTargets=t,this.differ=new y(t)},o.setKeyContainer=function(t){var e=this,n=this.options;f(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},o.setToggleContinueSelect=function(t){var e=this,n=this.options;f(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},o.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.dragger.unset(),this.injectResult.destroy(),g.removeEvent(document,"selectstart",this.onDocumentSelectStart),this.keycon=null,this.dragger=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},o.click=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),r={datas:{},clientX:n.clientX,clientY:n.clientY,inputEvent:t};this.onDragStart(r,e)&&this.onDragEnd(r)},o.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect;this.keycon&&(this.keycon.destroy(),this.keycon=null),n&&(this.keycon=new c(e||window),this.keycon.keydown(this.onKeyDown).keyup(this.onKeyUp).on("blur",this.onBlur))},o.setKeyEvent=function(){this.options.toggleContinueSelect&&!this.keycon&&this.setKeyController()},o.initElement=function(){this.target=function n(t,e,r){var i=t.tag,o=t.children,s=t.attributes,a=t.className,c=t.style,l=e||document.createElement(i);for(var u in s)l.setAttribute(u,s[u]);var d=l.children;if(o.forEach(function(t,e){n(t,d[e],l)}),a&&a.split(" ").forEach(function(t){g.hasClass(l,t)||g.addClass(l,t)}),c){var f=l.style;for(var u in c)f[u]=c[u]}return!e&&r&&r.appendChild(l),l}(d("div",{className:p}),this.target,this.container);var t=this.target;this.dragContainer=this.options.dragContainer||this.target.parentElement,this.dragger=new s(this.dragContainer,{container:window,preventDefault:!1,dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd}),g.addEvent(document,"selectstart",this.onDocumentSelectStart),this.injectResult=h.inject(t)},o.hitTest=function(t,g,h,p,e){var n=this.options,y=n.hitRate,m=n.selectByClick,v=t.left,b=t.top,S=t.right,C=t.bottom,k=[];return e.forEach(function(t,e){var n=t.left,r=t.top,i=t.right,o=t.bottom,s=n<=g&&g<=i&&r<=h&&h<=o,a=(i-n)*(o-r),c=Math.max(n,v),l=Math.min(i,S),u=Math.max(r,b),d=Math.min(o,C);if(m&&s)k.push(p[e]);else if(!(l<c||d<u)){var f=Math.round((l-c)*(d-u)/a*100);y<=f&&k.push(p[e])}}),k},o.getSelectableTargets=function(){var e=[];return this.options.selectableTargets.forEach(function(t){g.isObject(t)?e.push(t):[].slice.call(document.querySelectorAll(t)).forEach(function(t){e.push(t)})}),e},o.getSelectedTargets=function(t){var e=y.diff(this.selectedTargets,t),n=e.list,r=e.prevList,i=e.added,o=e.removed;return i.map(function(t){return n[t]}).concat(o.map(function(t){return r[t]}))},o.select=function(t,e,n){var r=this.differ.update(t),i=r.added,o=r.removed,s=r.prevList,a=r.list;n&&this.trigger("selectStart",{selected:t,added:i.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e}),(i.length||o.length)&&this.trigger("select",{selected:t,added:i.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e})},o.selecteEnd=function(t,e,n){var r=y.diff(t,e),i=r.added,o=r.removed,s=r.prevList,a=r.list,c=y.diff(this.selectedTargets,e),l=c.added,u=c.removed,d=c.prevList,f=c.list,g=n.type,h="mousedown"===g||"touchstart"===g;this.trigger("selectEnd",{selected:e,added:i.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),afterAdded:l.map(function(t){return f[t]}),afterRemoved:u.map(function(t){return d[t]}),isDragStart:h,inputEvent:n})},o.sameCombiKey=function(t){var e=[].concat(this.options.toggleContinueSelect),n=c.getCombi(t.inputEvent,t.key);return e.every(function(t){return-1<n.indexOf(t)})},i=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;0<=a;a--)(i=t[a])&&(s=(o<3?i(s):3<o?i(e,n,s):i(e,n))||s);return 3<o&&s&&Object.defineProperty(e,n,s),s}([a.Properties(m,function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=g.camelize("set "+e);t[r]?n.set=function(t){this[r](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)})],i)}(t),r={__proto__:null,default:n};for(var i in r)n[i]=r[i];return n});
//# sourceMappingURL=selecto.min.js.map

@@ -7,5 +7,5 @@ /*

repository: git+https://github.com/daybrush/selecto.git
version: 0.0.17
version: 0.0.18
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Selecto=e()}(this,function(){"use strict";var c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var u=function(){return(u=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function a(t){return void 0===t}var t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],o=0;e.stop=function(){i=!0},e.currentTarget=this;for(var s=arguments.length,a=new Array(2<s?s-2:0),c=2;c<s;c++)a[c-2]=arguments[c];for(1<=a.length&&(r=r.concat(a)),o=0;n[o];o++)n[o].apply(this,r);return!i},e.once=function(r,o){if("object"==typeof r&&a(o)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof o){var s=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];o.apply(s,n),s.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&a(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(a(t))return this._eventHandler={},this;if(a(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,i=t;for(n in i)this.off(n,i[n]);return this}var r,o,s=this._eventHandler[t];if(s)for(r=0;void 0!==(o=s[r]);r++)if(o===e){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function l(t,e,n,i){t.addEventListener(e,n,i)}function h(t,e,n){t.removeEventListener(e,n)}var f=function(){return(f=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function d(t,e,n,i){var r=C(t),o=C(e),s=C(i);return v(b(i[0],E(r,s)),b(i[0],E(o,s)),n[0])}function p(t){return t.touches?m(t.touches):[r(t)]}function v(t,e,n){var i=t.clientX,r=t.clientY;return{clientX:i,clientY:r,deltaX:i-e.clientX,deltaY:r-e.clientY,distX:i-n.clientX,distY:r-n.clientY}}function g(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function y(t,n,i){return t.map(function(t,e){return v(t,n[e],i[e])})}function m(t){for(var e=Math.min(t.length,2),n=[],i=0;i<e;++i)n.push(r(t[i]));return n}function r(t){return{clientX:t.clientX,clientY:t.clientY}}function C(t){return{clientX:(t[0].clientX+t[1].clientX)/2,clientY:(t[0].clientY+t[1].clientY)/2}}function b(t,e){return{clientX:t.clientX+e.clientX,clientY:t.clientY+e.clientY}}function E(t,e){return{clientX:t.clientX-e.clientX,clientY:t.clientY-e.clientY}}var k=function(){function t(t,e){var c=this;void 0===e&&(e={}),this.el=t,this.options={},this.flag=!1,this.pinchFlag=!1,this.datas={},this.isDrag=!1,this.isPinch=!1,this.isMouse=!1,this.isTouch=!1,this.prevClients=[],this.startClients=[],this.movement=0,this.startPinchClients=[],this.startDistance=0,this.customDist=[0,0],this.onDragStart=function(t){if(c.flag||!1!==t.cancelable){if((e=t).touches&&2<=e.touches.length){if(!c.flag&&t.touches.length!==t.changedTouches.length)return;c.pinchFlag||c.onPinchStart(t)}var e;if(!c.flag){var n=c.startClients[0]?c.startClients:p(t);c.customDist=[0,0],c.flag=!0,c.isDrag=!1,c.startClients=n,c.prevClients=n,c.datas={};var i=v(n[c.movement=0],c.prevClients[0],c.startClients[0]),r=c.options,o=r.dragstart,s=r.preventRightClick,a=r.preventDefault;(s&&3===t.which||!1===(o&&o(f({datas:c.datas,inputEvent:t},i))))&&(c.startClients=[],c.prevClients=[],c.flag=!1),c.flag&&a&&t.preventDefault()}}},this.onDrag=function(t,e){if(c.flag){var n=p(t);c.pinchFlag&&c.onPinch(t,n);var i=c.move([0,0],t,n);if(i&&(i.deltaX||i.deltaY)){var r=c.options.drag;r&&r(f({},i,{isScroll:!!e,inputEvent:t}))}}},this.onDragEnd=function(t){if(c.flag){c.pinchFlag&&c.onPinchEnd(t),c.flag=!1;var e=c.options.dragend,n=c.prevClients,i=c.startClients,r=c.pinchFlag?d(n,n,i,c.startPinchClients):v(n[0],n[0],i[0]);c.startClients=[],c.prevClients=[],e&&e(f({datas:c.datas,isDrag:c.isDrag,inputEvent:t},r))}},this.options=f({container:t,preventRightClick:!0,preventDefault:!0,pinchThreshold:0,events:["touch","mouse"]},e);var n=this.options,i=n.container,r=n.events;if(this.isTouch=-1<r.indexOf("touch"),this.isMouse=-1<r.indexOf("mouse"),this.customDist=[0,0],this.isMouse&&(l(t,"mousedown",this.onDragStart),l(i,"mousemove",this.onDrag),l(i,"mouseup",this.onDragEnd)),this.isTouch){var o={passive:!1};l(t,"touchstart",this.onDragStart,o),l(i,"touchmove",this.onDrag,o),l(i,"touchend",this.onDragEnd,o)}}var e=t.prototype;return e.isDragging=function(){return this.isDrag},e.isFlag=function(){return this.flag},e.isPinching=function(){return this.isPinch},e.scrollBy=function(e,n,t,i){void 0===i&&(i=!0),this.flag&&(this.startClients.forEach(function(t){t.clientX-=e,t.clientY-=n}),this.prevClients.forEach(function(t){t.clientX-=e,t.clientY-=n}),i&&this.onDrag(t,!0))},e.move=function(t,e,n){var i=t[0],r=t[1];void 0===n&&(n=this.prevClients);var o=this.customDist,s=this.prevClients,a=this.startClients,c=this.pinchFlag?d(n,s,a,this.startPinchClients):v(n[0],s[0],a[0]);o[0]+=i,o[1]+=r,c.deltaX+=i,c.deltaY+=r;var u=c.deltaX,l=c.deltaY;return c.distX+=o[0],c.distY+=o[1],this.movement+=Math.sqrt(u*u+l*l),this.prevClients=n,this.isDrag=!0,f({datas:this.datas},c,{isScroll:!1,inputEvent:e})},e.onPinchStart=function(t){var e,n,i=this.options,r=i.pinchstart,o=i.pinchThreshold;if(!(this.isDrag&&this.movement>o)){var s=m(t.changedTouches);if(this.pinchFlag=!0,(e=this.startClients).push.apply(e,s),(n=this.prevClients).push.apply(n,s),this.startDistance=g(this.prevClients),this.startPinchClients=this.prevClients.slice(),r){var a=this.prevClients,c=C(a),u=v(c,c,c);r(f({datas:this.datas,touches:y(a,a,a)},u,{inputEvent:t}))}}},e.onPinch=function(t,e){if(this.flag&&this.pinchFlag){this.isPinch=!0;var n=this.options.pinch;if(n){var i=this.prevClients,r=this.startClients,o=v(C(e),C(i),C(r)),s=g(e);n(f({datas:this.datas,touches:y(e,i,r),scale:s/this.startDistance,distance:s},o,{inputEvent:t}))}}},e.onPinchEnd=function(t){if(this.flag&&this.pinchFlag){var e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.options.pinchend;if(n){var i=this.prevClients,r=this.startClients,o=v(C(i),C(i),C(r));n(f({datas:this.datas,isPinch:e,touches:y(i,i,r)},o,{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}}},e.unset=function(){var t=this.el,e=this.options.container;this.isMouse&&(h(t,"mousedown",this.onDragStart),h(e,"mousemove",this.onDrag),h(e,"mouseup",this.onDragEnd)),this.isTouch&&(h(t,"touchstart",this.onDragStart),h(e,"touchmove",this.onDrag),h(e,"touchend",this.onDragEnd))},t}();var w=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,i=this.values,r=n.indexOf(t),o=-1===r?n.length:r;n[o]=t,i[o]=e},t}(),D=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),S="function"==typeof Map,o=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var O=function(){function t(t,e,n,i,r,o,s,a){this.prevList=t,this.list=e,this.added=n,this.removed=i,this.changed=r,this.maintained=o,this.changedBeforeAdded=s,this.fixed=a}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t,n,a,c,e=(t=this.changedBeforeAdded,n=this.fixed,a=[],c=[],t.forEach(function(t){var e=t[0],n=t[1],i=new o;a[e]=i,c[n]=i}),a.forEach(function(t,e){t.connect(a[e-1])}),t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],i=t[1];if(n===i)return[0,0];var r=a[n],o=c[i-1],s=r.getIndex();return r.disconnect(),o?r.connect(o,o.next):r.connect(void 0,a[0]),[s,r.getIndex()]})),u=this.changed,l=[];this.cacheOrdered=e.filter(function(t,e){var n=t[0],i=t[1],r=u[e],o=r[0],s=r[1];if(n!==i)return l.push([o,s]),!0}),this.cachePureChanged=l},t}();function i(t,e,n){var i=S?Map:n?D:w,r=n||function(t){return t},o=[],s=[],a=[],c=t.map(r),u=e.map(r),l=new i,h=new i,f=[],d=[],p={},v=[],g=0,y=0;return c.forEach(function(t,e){l.set(t,e)}),u.forEach(function(t,e){h.set(t,e)}),c.forEach(function(t,e){var n=h.get(t);void 0===n?(++y,s.push(e)):p[n]=y}),u.forEach(function(t,e){var n=l.get(t);void 0===n?(o.push(e),++g):(a.push([n,e]),y=p[e]||0,f.push([n-y,e-g]),d.push(e===n),n!==e&&v.push([n,e]))}),s.reverse(),new O(t,e,o,s,v,a,f,d)}var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var e,K="function"==typeof Map?void 0:(e=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++e)}),_=function(e){function t(){this.constructor=n}var n,i;function r(t){return void 0===t&&(t=[]),e.call(this,t,K)||this}return s(n=r,i=e),n.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t),r}(function(){function t(t,e){void 0===t&&(t=[]),this.findKeyCallback=e,this.list=[].slice.call(t)}return t.prototype.update=function(t){var e=[].slice.call(t),n=i(this.list,e,this.findKeyCallback);return this.list=e,n},t}());function T(t,e){return i(t,e,K)}var x=function(t,e){return(x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var n,j=(function(t,e){function n(t){if(t&&"object"==typeof t){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return s[t];var n,i=String(t);return(n=r[i.toLowerCase()])?n:(n=o[i.toLowerCase()])||(1===i.length?i.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){var n=t.which||t.keyCode||t.charCode;if(null==n)return!1;if("string"==typeof e){var i;if(i=r[e.toLowerCase()])return i===n;if(i=o[e.toLowerCase()])return i===n}else if("number"==typeof e)return e===n;return!1}};var r=(e=t.exports=n).code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},o=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(i=97;i<123;i++)r[String.fromCharCode(i)]=i-32;for(var i=48;i<58;i++)r[i-48]=i;for(i=1;i<13;i++)r["f"+i]=i+111;for(i=0;i<10;i++)r["numpad "+i]=i+96;var s=e.names=e.title={};for(i in r)s[r[i]]=i;for(var a in o)r[a]=o[a]}(n={exports:{}},n.exports),n.exports),P=(j.code,j.codes,j.aliases,j.names);j.title;function Y(t){return Array.isArray(t)}function X(t){return"string"==typeof t}function M(t,e,n,i){t.addEventListener(e,n,i)}function F(t,e,n){t.removeEventListener(e,n)}var R,L={"+":"plus","left command":"meta","right command":"meta"},A={shift:1,ctrl:2,alt:3,meta:4};function N(t){var e=P[t]||"";for(var n in L)e=e.replace(n,L[n]);return e.replace(/\s/g,"")}function B(t,e){void 0===e&&(e=N(t.keyCode));var n=[t.shiftKey&&"shift",t.ctrlKey&&"ctrl",t.altKey&&"alt",t.metaKey&&"meta"];return-1===n.indexOf(e)&&n.push(e),n.filter(Boolean)}function H(t){var e=t.slice();return e.sort(function(t,e){return(A[t]||5)-(A[e]||5)}),e}var I=function(n){function t(){this.constructor=e}var e,i;function r(t){void 0===t&&(t=window);var e=n.call(this)||this;return e.container=t,e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e.clear=function(){return e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e},e.keydownEvent=function(t){e.triggerEvent("keydown",t)},e.keyupEvent=function(t){e.triggerEvent("keyup",t)},e.blur=function(){e.clear(),e.trigger("blur")},M(t,"blur",e.blur),M(t,"keydown",e.keydownEvent),M(t,"keyup",e.keyupEvent),e}x(e=r,i=n),e.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t);var o=r.prototype;return Object.defineProperty(r,"global",{get:function(){return R=R||new r},enumerable:!0,configurable:!0}),r.setGlobal=function(){return this.global},o.destroy=function(){var t=this.container;this.clear(),this.off(),F(t,"blur",this.blur),F(t,"keydown",this.keydownEvent),F(t,"keyup",this.keyupEvent)},o.keydown=function(t,e){return this.addEvent("keydown",t,e)},o.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},o.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},o.keyup=function(t,e){return this.addEvent("keyup",t,e)},o.addEvent=function(t,e,n){return Y(e)?this.on(t+"."+H(e).join("."),n):X(e)?this.on(t+"."+e,n):this.on(t,e),this},o.removeEvent=function(t,e,n){return Y(e)?this.off(t+"."+H(e).join("."),n):X(e)?this.off(t+"."+e,n):this.off(t,e),this},o.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=N(e.keyCode),i={key:n,isToggle:"ctrl"===n||"shift"===n||"meta"===n||"alt"===n,inputEvent:e,keyCode:e.keyCode,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey};this.trigger(t,i),this.trigger(t+"."+n,i);var r=B(e,n);1<r.length&&this.trigger(t+"."+r.join("."),i)},r}(t);function q(t,e,n){var i=t.tag,r=t.children,o=t.attributes,s=t.className,a=t.style,c=e||document.createElement(i);for(var u in o)c.setAttribute(u,o[u]);var l=c.children;if(r.forEach(function(t,e){q(t,l[e],c)}),s&&s.split(" ").forEach(function(t){var e,n,i,r;r=t,((i=c).classList?i.classList.contains(r):i.className.match(new RegExp("(\\s|^)"+r+"(\\s|$)")))||(n=t,(e=c).classList?e.classList.add(n):e.className+=" "+n)}),a){var h=c.style;for(var u in a)h[u]=a[u]}return!e&&n&&n.appendChild(c),c}function U(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var r=e||{},o=r.className,s=r.style;return{tag:t,className:void 0===o?"":o,style:void 0===s?{}:s,attributes:function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}(r,["className","style"]),children:n}}function z(t,e,n){t!==e&&n(t,e)}function G(i,t,e){var n=document.createElement("style");return n.setAttribute("type","text/css"),n.innerHTML=t.replace(/([^}{]*){/gm,function(t,e){return((n=e.match(/("[^"]*"|'[^']*'|[^,\s()]*\((?:[^()]*|\([^()]*\))*\)[^,\s()]*|[^,])+/g))?n.map(function(t){return t.trim()}):[]).map(function(t){return-1<t.indexOf(":global")?t.replace(/\:global/g,""):-1<t.indexOf(":host")?""+t.replace(/\:host/g,"."+i):"."+i+" "+t}).join(", ")+"{";var n}),(e||document.head||document.body).appendChild(n),n}var V,$,J,Q,W=(J="rCS"+function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0}(V="\n:host {\n position: absolute;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n").toString(36),Q=0,{className:J,inject:function(t){var e,n=function(t){if(t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e}}(t),i=0===Q;return(n||i)&&(e=G(J,V)),i&&($=e),n||++Q,{destroy:function(){n?(t.removeChild(e),e=null):(0<Q&&--Q,0===Q&&$&&($.parentNode.removeChild($),$=null))}}}}),Z="selecto-selection "+W.className,tt=["selectableTargets","selectByClick","selectFromInside","continueSelect","toggleContinueSelect","keyContainer","hitRate"],et=function(e){function t(){this.constructor=n}var n,i;function r(t){void 0===t&&(t={});var v=e.call(this)||this;return v.selectedTargets=[],v.differ=new _,v.onDragStart=function(t,e){var n=t.datas,i=t.clientX,r=t.clientY,o=t.inputEvent,s=v.options,a=s.continueSelect,c=s.selectFromInside,u=v.getSelectableTargets(),l=u.map(function(t){var e=t.getBoundingClientRect(),n=e.left,i=e.top;return{left:n,top:i,right:n+e.width,bottom:i+e.height}});n.selectableTargets=u,n.selectableRects=l,n.startSelectedTargets=v.selectedTargets;var h=e||document.elementFromPoint(i,r),f=v.hitTest({left:i,top:r,right:i,bottom:r},i,r,u,l).filter(function(t){return t===h||t.contains(h)}),d=0<f.length;a?f=v.getSelectedTargets(f):v.selectedTargets=[];var p=o.type;return!(("mousedown"===p||"touchstart"===p)&&!v.trigger("dragStart",t))&&(v.select(f,o,!0),n.startX=i,n.startY=r,n.selectedTargets=f,v.target.style.cssText+="left:"+i+"px;top:"+r+"px",!(!c&&d)||(v.onDragEnd(t),o.preventDefault(),!1))},v.onDrag=function(t){var e=t.distX,n=t.distY,i=t.datas,r=t.inputEvent,o=i.startX,s=i.startY,a=Math.min(0,e),c=Math.min(0,n),u=Math.abs(e),l=Math.abs(n);v.target.style.cssText+="display: block;transform: translate("+a+"px, "+c+"px);width:"+u+"px;height:"+l+"px;";var h=o+a,f=s+c,d=v.hitTest({left:h,top:f,right:h+u,bottom:f+l},i.startX,i.startY,i.selectableTargets,i.selectableRects),p=v.getSelectedTargets(d);v.select(p,r),i.selectedTargets=p},v.onDragEnd=function(t){var e=t.datas,n=t.inputEvent;v.target.style.cssText+="display: none;",v.selecteEnd(e.startSelectedTargets,e.selectedTargets,n),v.selectedTargets=e.selectedTargets},v.onKeyDown=function(t){v.sameCombiKey(t)&&(v.continueSelect=!0,v.trigger("keydown",{}))},v.onKeyUp=function(t){v.sameCombiKey(t)&&(v.continueSelect=!1,v.trigger("keyup",{}))},v.onBlur=function(){v.toggleContinueSelect&&v.continueSelect&&v.trigger("keyup",{})},v.onDocumentSelectStart=function(t){if(v.dragger.isFlag()){var e=v.dragContainer;e===window&&(e=document.documentElement),e!==t.target&&!e.contains(t.target)||t.preventDefault()}},v.target=t.target,v.container=t.container,v.options=u({target:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,hitRate:100,continueSelect:!1,toggleContinueSelect:null,keyContainer:null},t),v.initElement(),v.setKeyController(),v}c(n=r,i=e),n.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t);var o,s,a=r.prototype;return a.setSelectedTargets=function(t){this.selectedTargets=t,this.differ=new _(t)},a.setKeyContainer=function(t){var e=this,n=this.options;z(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},a.setToggleContinueSelect=function(t){var e=this,n=this.options;z(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},a.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.dragger.unset(),this.injectResult.destroy(),h(document,"selectstart",this.onDocumentSelectStart),this.keycon=null,this.dragger=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},a.click=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),i={datas:{},clientX:n.clientX,clientY:n.clientY,inputEvent:t};this.onDragStart(i,e)&&this.onDragEnd(i)},a.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect;this.keycon&&(this.keycon.destroy(),this.keycon=null),n&&(this.keycon=new I(e||window),this.keycon.keydown(this.onKeyDown).keyup(this.onKeyUp).on("blur",this.onBlur))},a.setKeyEvent=function(){this.options.toggleContinueSelect&&!this.keycon&&this.setKeyController()},a.initElement=function(){this.target=q(U("div",{className:Z}),this.target,this.container);var t=this.target;this.dragContainer=this.options.dragContainer||this.target.parentElement,this.dragger=new k(this.dragContainer,{container:window,preventDefault:!1,dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd}),l(document,"selectstart",this.onDocumentSelectStart),this.injectResult=W.inject(t)},a.hitTest=function(t,d,p,v,e){var n=this.options,g=n.hitRate,y=n.selectByClick,m=t.left,C=t.top,b=t.right,E=t.bottom,k=[];return e.forEach(function(t,e){var n=t.left,i=t.top,r=t.right,o=t.bottom,s=n<=d&&d<=r&&i<=p&&p<=o,a=(r-n)*(o-i),c=Math.max(n,m),u=Math.min(r,b),l=Math.max(i,C),h=Math.min(o,E);if(y&&s)k.push(v[e]);else if(!(u<c||h<l)){var f=Math.round((u-c)*(h-l)/a*100);g<=f&&k.push(v[e])}}),k},a.getSelectableTargets=function(){var n=[];return this.options.selectableTargets.forEach(function(t){var e;(e=t)&&"object"==typeof e?n.push(t):[].slice.call(document.querySelectorAll(t)).forEach(function(t){n.push(t)})}),n},a.getSelectedTargets=function(t){var e=T(this.selectedTargets,t),n=e.list,i=e.prevList,r=e.added,o=e.removed;return r.map(function(t){return n[t]}).concat(o.map(function(t){return i[t]}))},a.select=function(t,e,n){var i=this.differ.update(t),r=i.added,o=i.removed,s=i.prevList,a=i.list;n&&this.trigger("selectStart",{selected:t,added:r.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e}),(r.length||o.length)&&this.trigger("select",{selected:t,added:r.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e})},a.selecteEnd=function(t,e,n){var i=T(t,e),r=i.added,o=i.removed,s=i.prevList,a=i.list,c=T(this.selectedTargets,e),u=c.added,l=c.removed,h=c.prevList,f=c.list,d=n.type,p="mousedown"===d||"touchstart"===d;this.trigger("selectEnd",{selected:e,added:r.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),afterAdded:u.map(function(t){return f[t]}),afterRemoved:l.map(function(t){return h[t]}),isDragStart:p,inputEvent:n})},a.sameCombiKey=function(t){var e=[].concat(this.options.toggleContinueSelect),n=B(t.inputEvent,t.key);return e.every(function(t){return-1<n.indexOf(t)})},r=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;0<=a;a--)(r=t[a])&&(s=(o<3?r(s):3<o?r(e,n,s):r(e,n))||s);return 3<o&&s&&Object.defineProperty(e,n,s),s}([(o=tt,s=function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},i=("set "+e).replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()});t[i]?n.set=function(t){this[i](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)},function(t){var e=t.prototype;o.forEach(function(t){s(e,t)})})],r)}(t),nt={__proto__:null,default:et};for(var it in nt)et[it]=nt[it];return et});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Selecto=e()}(this,function(){"use strict";var c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var u=function(){return(u=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function a(t){return void 0===t}var t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],o=0;e.stop=function(){i=!0},e.currentTarget=this;for(var s=arguments.length,a=new Array(2<s?s-2:0),c=2;c<s;c++)a[c-2]=arguments[c];for(1<=a.length&&(r=r.concat(a)),o=0;n[o];o++)n[o].apply(this,r);return!i},e.once=function(r,o){if("object"==typeof r&&a(o)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof o){var s=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];o.apply(s,n),s.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&a(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(a(t))return this._eventHandler={},this;if(a(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,i=t;for(n in i)this.off(n,i[n]);return this}var r,o,s=this._eventHandler[t];if(s)for(r=0;void 0!==(o=s[r]);r++)if(o===e){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function l(t,e,n,i){t.addEventListener(e,n,i)}function h(t,e,n){t.removeEventListener(e,n)}var f=function(){return(f=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function d(t,e,n,i){var r=C(t),o=C(e),s=C(i);return v(b(i[0],E(r,s)),b(i[0],E(o,s)),n[0])}function p(t){return t.touches?m(t.touches):[r(t)]}function v(t,e,n){var i=t.clientX,r=t.clientY;return{clientX:i,clientY:r,deltaX:i-e.clientX,deltaY:r-e.clientY,distX:i-n.clientX,distY:r-n.clientY}}function g(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function y(t,n,i){return t.map(function(t,e){return v(t,n[e],i[e])})}function m(t){for(var e=Math.min(t.length,2),n=[],i=0;i<e;++i)n.push(r(t[i]));return n}function r(t){return{clientX:t.clientX,clientY:t.clientY}}function C(t){return{clientX:(t[0].clientX+t[1].clientX)/2,clientY:(t[0].clientY+t[1].clientY)/2}}function b(t,e){return{clientX:t.clientX+e.clientX,clientY:t.clientY+e.clientY}}function E(t,e){return{clientX:t.clientX-e.clientX,clientY:t.clientY-e.clientY}}var k=function(){function t(t,e){var c=this;void 0===e&&(e={}),this.el=t,this.options={},this.flag=!1,this.pinchFlag=!1,this.datas={},this.isDrag=!1,this.isPinch=!1,this.isMouse=!1,this.isTouch=!1,this.prevClients=[],this.startClients=[],this.movement=0,this.startPinchClients=[],this.startDistance=0,this.customDist=[0,0],this.onDragStart=function(t){if(c.flag||!1!==t.cancelable){if((e=t).touches&&2<=e.touches.length){if(!c.flag&&t.touches.length!==t.changedTouches.length)return;c.pinchFlag||c.onPinchStart(t)}var e;if(!c.flag){var n=c.startClients[0]?c.startClients:p(t);c.customDist=[0,0],c.flag=!0,c.isDrag=!1,c.startClients=n,c.prevClients=n,c.datas={};var i=v(n[c.movement=0],c.prevClients[0],c.startClients[0]),r=c.options,o=r.dragstart,s=r.preventRightClick,a=r.preventDefault;(s&&3===t.which||!1===(o&&o(f({datas:c.datas,inputEvent:t},i))))&&(c.startClients=[],c.prevClients=[],c.flag=!1),c.flag&&a&&t.preventDefault()}}},this.onDrag=function(t,e){if(c.flag){var n=p(t);c.pinchFlag&&c.onPinch(t,n);var i=c.move([0,0],t,n);if(i&&(i.deltaX||i.deltaY)){var r=c.options.drag;r&&r(f({},i,{isScroll:!!e,inputEvent:t}))}}},this.onDragEnd=function(t){if(c.flag){c.pinchFlag&&c.onPinchEnd(t),c.flag=!1;var e=c.options.dragend,n=c.prevClients,i=c.startClients,r=c.pinchFlag?d(n,n,i,c.startPinchClients):v(n[0],n[0],i[0]);c.startClients=[],c.prevClients=[],e&&e(f({datas:c.datas,isDrag:c.isDrag,inputEvent:t},r))}},this.options=f({container:t,preventRightClick:!0,preventDefault:!0,pinchThreshold:0,events:["touch","mouse"]},e);var n=this.options,i=n.container,r=n.events;if(this.isTouch=-1<r.indexOf("touch"),this.isMouse=-1<r.indexOf("mouse"),this.customDist=[0,0],this.isMouse&&(l(t,"mousedown",this.onDragStart),l(i,"mousemove",this.onDrag),l(i,"mouseup",this.onDragEnd)),this.isTouch){var o={passive:!1};l(t,"touchstart",this.onDragStart,o),l(i,"touchmove",this.onDrag,o),l(i,"touchend",this.onDragEnd,o)}}var e=t.prototype;return e.isDragging=function(){return this.isDrag},e.isFlag=function(){return this.flag},e.isPinching=function(){return this.isPinch},e.scrollBy=function(e,n,t,i){void 0===i&&(i=!0),this.flag&&(this.startClients.forEach(function(t){t.clientX-=e,t.clientY-=n}),this.prevClients.forEach(function(t){t.clientX-=e,t.clientY-=n}),i&&this.onDrag(t,!0))},e.move=function(t,e,n){var i=t[0],r=t[1];void 0===n&&(n=this.prevClients);var o=this.customDist,s=this.prevClients,a=this.startClients,c=this.pinchFlag?d(n,s,a,this.startPinchClients):v(n[0],s[0],a[0]);o[0]+=i,o[1]+=r,c.deltaX+=i,c.deltaY+=r;var u=c.deltaX,l=c.deltaY;return c.distX+=o[0],c.distY+=o[1],this.movement+=Math.sqrt(u*u+l*l),this.prevClients=n,this.isDrag=!0,f({datas:this.datas},c,{isScroll:!1,inputEvent:e})},e.onPinchStart=function(t){var e,n,i=this.options,r=i.pinchstart,o=i.pinchThreshold;if(!(this.isDrag&&this.movement>o)){var s=m(t.changedTouches);if(this.pinchFlag=!0,(e=this.startClients).push.apply(e,s),(n=this.prevClients).push.apply(n,s),this.startDistance=g(this.prevClients),this.startPinchClients=this.prevClients.slice(),r){var a=this.prevClients,c=C(a),u=v(c,c,c);r(f({datas:this.datas,touches:y(a,a,a)},u,{inputEvent:t}))}}},e.onPinch=function(t,e){if(this.flag&&this.pinchFlag){this.isPinch=!0;var n=this.options.pinch;if(n){var i=this.prevClients,r=this.startClients,o=v(C(e),C(i),C(r)),s=g(e);n(f({datas:this.datas,touches:y(e,i,r),scale:s/this.startDistance,distance:s},o,{inputEvent:t}))}}},e.onPinchEnd=function(t){if(this.flag&&this.pinchFlag){var e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.options.pinchend;if(n){var i=this.prevClients,r=this.startClients,o=v(C(i),C(i),C(r));n(f({datas:this.datas,isPinch:e,touches:y(i,i,r)},o,{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}}},e.unset=function(){var t=this.el,e=this.options.container;this.isMouse&&(h(t,"mousedown",this.onDragStart),h(e,"mousemove",this.onDrag),h(e,"mouseup",this.onDragEnd)),this.isTouch&&(h(t,"touchstart",this.onDragStart),h(e,"touchmove",this.onDrag),h(e,"touchend",this.onDragEnd))},t}();var w=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,i=this.values,r=n.indexOf(t),o=-1===r?n.length:r;n[o]=t,i[o]=e},t}(),D=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),S="function"==typeof Map,o=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var O=function(){function t(t,e,n,i,r,o,s,a){this.prevList=t,this.list=e,this.added=n,this.removed=i,this.changed=r,this.maintained=o,this.changedBeforeAdded=s,this.fixed=a}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t,n,a,c,e=(t=this.changedBeforeAdded,n=this.fixed,a=[],c=[],t.forEach(function(t){var e=t[0],n=t[1],i=new o;a[e]=i,c[n]=i}),a.forEach(function(t,e){t.connect(a[e-1])}),t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],i=t[1];if(n===i)return[0,0];var r=a[n],o=c[i-1],s=r.getIndex();return r.disconnect(),o?r.connect(o,o.next):r.connect(void 0,a[0]),[s,r.getIndex()]})),u=this.changed,l=[];this.cacheOrdered=e.filter(function(t,e){var n=t[0],i=t[1],r=u[e],o=r[0],s=r[1];if(n!==i)return l.push([o,s]),!0}),this.cachePureChanged=l},t}();function i(t,e,n){var i=S?Map:n?D:w,r=n||function(t){return t},o=[],s=[],a=[],c=t.map(r),u=e.map(r),l=new i,h=new i,f=[],d=[],p={},v=[],g=0,y=0;return c.forEach(function(t,e){l.set(t,e)}),u.forEach(function(t,e){h.set(t,e)}),c.forEach(function(t,e){var n=h.get(t);void 0===n?(++y,s.push(e)):p[n]=y}),u.forEach(function(t,e){var n=l.get(t);void 0===n?(o.push(e),++g):(a.push([n,e]),y=p[e]||0,f.push([n-y,e-g]),d.push(e===n),n!==e&&v.push([n,e]))}),s.reverse(),new O(t,e,o,s,v,a,f,d)}var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var e,K="function"==typeof Map?void 0:(e=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++e)}),_=function(e){function t(){this.constructor=n}var n,i;function r(t){return void 0===t&&(t=[]),e.call(this,t,K)||this}return s(n=r,i=e),n.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t),r}(function(){function t(t,e){void 0===t&&(t=[]),this.findKeyCallback=e,this.list=[].slice.call(t)}return t.prototype.update=function(t){var e=[].slice.call(t),n=i(this.list,e,this.findKeyCallback);return this.list=e,n},t}());function T(t,e){return i(t,e,K)}var x=function(t,e){return(x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var n,j=(function(t,e){function n(t){if(t&&"object"==typeof t){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return s[t];var n,i=String(t);return(n=r[i.toLowerCase()])?n:(n=o[i.toLowerCase()])||(1===i.length?i.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){var n=t.which||t.keyCode||t.charCode;if(null==n)return!1;if("string"==typeof e){var i;if(i=r[e.toLowerCase()])return i===n;if(i=o[e.toLowerCase()])return i===n}else if("number"==typeof e)return e===n;return!1}};var r=(e=t.exports=n).code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},o=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(i=97;i<123;i++)r[String.fromCharCode(i)]=i-32;for(var i=48;i<58;i++)r[i-48]=i;for(i=1;i<13;i++)r["f"+i]=i+111;for(i=0;i<10;i++)r["numpad "+i]=i+96;var s=e.names=e.title={};for(i in r)s[r[i]]=i;for(var a in o)r[a]=o[a]}(n={exports:{}},n.exports),n.exports),P=(j.code,j.codes,j.aliases,j.names);j.title;function Y(t){return Array.isArray(t)}function X(t){return"string"==typeof t}function M(t,e,n,i){t.addEventListener(e,n,i)}function F(t,e,n){t.removeEventListener(e,n)}var R,L={"+":"plus","left command":"meta","right command":"meta"},A={shift:1,ctrl:2,alt:3,meta:4};function N(t){var e=P[t]||"";for(var n in L)e=e.replace(n,L[n]);return e.replace(/\s/g,"")}function B(t,e){void 0===e&&(e=N(t.keyCode));var n=[t.shiftKey&&"shift",t.ctrlKey&&"ctrl",t.altKey&&"alt",t.metaKey&&"meta"];return-1===n.indexOf(e)&&n.push(e),n.filter(Boolean)}function H(t){var e=t.slice();return e.sort(function(t,e){return(A[t]||5)-(A[e]||5)}),e}var I=function(n){function t(){this.constructor=e}var e,i;function r(t){void 0===t&&(t=window);var e=n.call(this)||this;return e.container=t,e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e.clear=function(){return e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e},e.keydownEvent=function(t){e.triggerEvent("keydown",t)},e.keyupEvent=function(t){e.triggerEvent("keyup",t)},e.blur=function(){e.clear(),e.trigger("blur")},M(t,"blur",e.blur),M(t,"keydown",e.keydownEvent),M(t,"keyup",e.keyupEvent),e}x(e=r,i=n),e.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t);var o=r.prototype;return Object.defineProperty(r,"global",{get:function(){return R=R||new r},enumerable:!0,configurable:!0}),r.setGlobal=function(){return this.global},o.destroy=function(){var t=this.container;this.clear(),this.off(),F(t,"blur",this.blur),F(t,"keydown",this.keydownEvent),F(t,"keyup",this.keyupEvent)},o.keydown=function(t,e){return this.addEvent("keydown",t,e)},o.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},o.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},o.keyup=function(t,e){return this.addEvent("keyup",t,e)},o.addEvent=function(t,e,n){return Y(e)?this.on(t+"."+H(e).join("."),n):X(e)?this.on(t+"."+e,n):this.on(t,e),this},o.removeEvent=function(t,e,n){return Y(e)?this.off(t+"."+H(e).join("."),n):X(e)?this.off(t+"."+e,n):this.off(t,e),this},o.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=N(e.keyCode),i={key:n,isToggle:"ctrl"===n||"shift"===n||"meta"===n||"alt"===n,inputEvent:e,keyCode:e.keyCode,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey};this.trigger(t,i),this.trigger(t+"."+n,i);var r=B(e,n);1<r.length&&this.trigger(t+"."+r.join("."),i)},r}(t);function q(t,e,n){var i=t.tag,r=t.children,o=t.attributes,s=t.className,a=t.style,c=e||document.createElement(i);for(var u in o)c.setAttribute(u,o[u]);var l=c.children;if(r.forEach(function(t,e){q(t,l[e],c)}),s&&s.split(" ").forEach(function(t){var e,n,i,r;r=t,((i=c).classList?i.classList.contains(r):i.className.match(new RegExp("(\\s|^)"+r+"(\\s|$)")))||(n=t,(e=c).classList?e.classList.add(n):e.className+=" "+n)}),a){var h=c.style;for(var u in a)h[u]=a[u]}return!e&&n&&n.appendChild(c),c}function U(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var r=e||{},o=r.className,s=r.style;return{tag:t,className:void 0===o?"":o,style:void 0===s?{}:s,attributes:function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}(r,["className","style"]),children:n}}function z(t,e,n){t!==e&&n(t,e)}function G(i,t,e){var n=document.createElement("style");return n.setAttribute("type","text/css"),n.innerHTML=t.replace(/([^}{]*){/gm,function(t,e){return((n=e.match(/("[^"]*"|'[^']*'|[^,\s()]*\((?:[^()]*|\([^()]*\))*\)[^,\s()]*|[^,])+/g))?n.map(function(t){return t.trim()}):[]).map(function(t){return-1<t.indexOf(":global")?t.replace(/\:global/g,""):-1<t.indexOf(":host")?""+t.replace(/\:host/g,"."+i):"."+i+" "+t}).join(", ")+"{";var n}),(e||document.head||document.body).appendChild(n),n}var V,$,J,Q,W=(J="rCS"+function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0}(V="\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n z-index: 100;\n}\n").toString(36),Q=0,{className:J,inject:function(t){var e,n=function(t){if(t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e}}(t),i=0===Q;return(n||i)&&(e=G(J,V)),i&&($=e),n||++Q,{destroy:function(){n?(t.removeChild(e),e=null):(0<Q&&--Q,0===Q&&$&&($.parentNode.removeChild($),$=null))}}}}),Z="selecto-selection "+W.className,tt=["selectableTargets","selectByClick","selectFromInside","continueSelect","toggleContinueSelect","keyContainer","hitRate"],et=function(e){function t(){this.constructor=n}var n,i;function r(t){void 0===t&&(t={});var v=e.call(this)||this;return v.selectedTargets=[],v.differ=new _,v.onDragStart=function(t,e){var n=t.datas,i=t.clientX,r=t.clientY,o=t.inputEvent,s=v.options,a=s.continueSelect,c=s.selectFromInside,u=v.getSelectableTargets(),l=u.map(function(t){var e=t.getBoundingClientRect(),n=e.left,i=e.top;return{left:n,top:i,right:n+e.width,bottom:i+e.height}});n.selectableTargets=u,n.selectableRects=l,n.startSelectedTargets=v.selectedTargets;var h=e||document.elementFromPoint(i,r),f=v.hitTest({left:i,top:r,right:i,bottom:r},i,r,u,l).filter(function(t){return t===h||t.contains(h)}),d=0<f.length;a?f=v.getSelectedTargets(f):v.selectedTargets=[];var p=o.type;return!(("mousedown"===p||"touchstart"===p)&&!v.trigger("dragStart",t))&&(v.select(f,o,!0),n.startX=i,n.startY=r,n.selectedTargets=f,v.target.style.cssText+="left:"+i+"px;top:"+r+"px",!(!c&&d)||(v.onDragEnd(t),o.preventDefault(),!1))},v.onDrag=function(t){var e=t.distX,n=t.distY,i=t.datas,r=t.inputEvent,o=i.startX,s=i.startY,a=Math.min(0,e),c=Math.min(0,n),u=Math.abs(e),l=Math.abs(n);v.target.style.cssText+="display: block;transform: translate("+a+"px, "+c+"px);width:"+u+"px;height:"+l+"px;";var h=o+a,f=s+c,d=v.hitTest({left:h,top:f,right:h+u,bottom:f+l},i.startX,i.startY,i.selectableTargets,i.selectableRects),p=v.getSelectedTargets(d);v.select(p,r),i.selectedTargets=p},v.onDragEnd=function(t){var e=t.datas,n=t.inputEvent;v.target.style.cssText+="display: none;",v.selecteEnd(e.startSelectedTargets,e.selectedTargets,n),v.selectedTargets=e.selectedTargets},v.onKeyDown=function(t){v.sameCombiKey(t)&&(v.continueSelect=!0,v.trigger("keydown",{}))},v.onKeyUp=function(t){v.sameCombiKey(t)&&(v.continueSelect=!1,v.trigger("keyup",{}))},v.onBlur=function(){v.toggleContinueSelect&&v.continueSelect&&v.trigger("keyup",{})},v.onDocumentSelectStart=function(t){if(v.dragger.isFlag()){var e=v.dragContainer;e===window&&(e=document.documentElement),e!==t.target&&!e.contains(t.target)||t.preventDefault()}},v.target=t.target,v.container=t.container,v.options=u({target:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,hitRate:100,continueSelect:!1,toggleContinueSelect:null,keyContainer:null},t),v.initElement(),v.setKeyController(),v}c(n=r,i=e),n.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t);var o,s,a=r.prototype;return a.setSelectedTargets=function(t){this.selectedTargets=t,this.differ=new _(t)},a.setKeyContainer=function(t){var e=this,n=this.options;z(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},a.setToggleContinueSelect=function(t){var e=this,n=this.options;z(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},a.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.dragger.unset(),this.injectResult.destroy(),h(document,"selectstart",this.onDocumentSelectStart),this.keycon=null,this.dragger=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},a.click=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),i={datas:{},clientX:n.clientX,clientY:n.clientY,inputEvent:t};this.onDragStart(i,e)&&this.onDragEnd(i)},a.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect;this.keycon&&(this.keycon.destroy(),this.keycon=null),n&&(this.keycon=new I(e||window),this.keycon.keydown(this.onKeyDown).keyup(this.onKeyUp).on("blur",this.onBlur))},a.setKeyEvent=function(){this.options.toggleContinueSelect&&!this.keycon&&this.setKeyController()},a.initElement=function(){this.target=q(U("div",{className:Z}),this.target,this.container);var t=this.target;this.dragContainer=this.options.dragContainer||this.target.parentElement,this.dragger=new k(this.dragContainer,{container:window,preventDefault:!1,dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd}),l(document,"selectstart",this.onDocumentSelectStart),this.injectResult=W.inject(t)},a.hitTest=function(t,d,p,v,e){var n=this.options,g=n.hitRate,y=n.selectByClick,m=t.left,C=t.top,b=t.right,E=t.bottom,k=[];return e.forEach(function(t,e){var n=t.left,i=t.top,r=t.right,o=t.bottom,s=n<=d&&d<=r&&i<=p&&p<=o,a=(r-n)*(o-i),c=Math.max(n,m),u=Math.min(r,b),l=Math.max(i,C),h=Math.min(o,E);if(y&&s)k.push(v[e]);else if(!(u<c||h<l)){var f=Math.round((u-c)*(h-l)/a*100);g<=f&&k.push(v[e])}}),k},a.getSelectableTargets=function(){var n=[];return this.options.selectableTargets.forEach(function(t){var e;(e=t)&&"object"==typeof e?n.push(t):[].slice.call(document.querySelectorAll(t)).forEach(function(t){n.push(t)})}),n},a.getSelectedTargets=function(t){var e=T(this.selectedTargets,t),n=e.list,i=e.prevList,r=e.added,o=e.removed;return r.map(function(t){return n[t]}).concat(o.map(function(t){return i[t]}))},a.select=function(t,e,n){var i=this.differ.update(t),r=i.added,o=i.removed,s=i.prevList,a=i.list;n&&this.trigger("selectStart",{selected:t,added:r.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e}),(r.length||o.length)&&this.trigger("select",{selected:t,added:r.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),inputEvent:e})},a.selecteEnd=function(t,e,n){var i=T(t,e),r=i.added,o=i.removed,s=i.prevList,a=i.list,c=T(this.selectedTargets,e),u=c.added,l=c.removed,h=c.prevList,f=c.list,d=n.type,p="mousedown"===d||"touchstart"===d;this.trigger("selectEnd",{selected:e,added:r.map(function(t){return a[t]}),removed:o.map(function(t){return s[t]}),afterAdded:u.map(function(t){return f[t]}),afterRemoved:l.map(function(t){return h[t]}),isDragStart:p,inputEvent:n})},a.sameCombiKey=function(t){var e=[].concat(this.options.toggleContinueSelect),n=B(t.inputEvent,t.key);return e.every(function(t){return-1<n.indexOf(t)})},r=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;0<=a;a--)(r=t[a])&&(s=(o<3?r(s):3<o?r(e,n,s):r(e,n))||s);return 3<o&&s&&Object.defineProperty(e,n,s),s}([(o=tt,s=function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},i=("set "+e).replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()});t[i]?n.set=function(t){this[i](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)},function(t){var e=t.prototype;o.forEach(function(t){s(e,t)})})],r)}(t),nt={__proto__:null,default:et};for(var it in nt)et[it]=nt[it];return et});
//# sourceMappingURL=selecto.pkgd.min.js.map
{
"name": "selecto",
"version": "0.0.17",
"version": "0.0.18",
"description": "Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.",

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

@@ -5,3 +5,3 @@ import styled from "css-styled";

:host {
position: absolute;
position: fixed;
display: none;

@@ -8,0 +8,0 @@ border: 1px solid #4af;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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