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 1.22.3 to 1.22.4

14

CHANGELOG.md

@@ -6,2 +6,16 @@ # Change Log

## [1.22.3](https://github.com/daybrush/selecto/compare/selecto@1.22.2...selecto@1.22.3) (2023-05-04)
### :bug: Bug Fix
* fix select by click in custom element #130 ([f3cbed9](https://github.com/daybrush/selecto/commit/f3cbed953cf98dea4b56a3191d369dc61c97fd8e))
### :mega: Other
* publish packages ([a6a7ecf](https://github.com/daybrush/selecto/commit/a6a7ecf85231504be0ab0a135d9647817820a608))
## [1.22.2](https://github.com/daybrush/selecto/compare/selecto@1.22.1...selecto@1.22.2) (2023-04-19)

@@ -8,0 +22,0 @@

3

declaration/utils.d.ts

@@ -8,3 +8,3 @@ import type { Hypertext, Point, Rect } from "./types";

export declare function filterDuplicated<T>(arr: T[]): T[];
export declare function elementFromPoint(clientX: number, clientY: number): HTMLElement | SVGElement | null;
export declare function elementFromPoint(baseNode: Node, clientX: number, clientY: number): HTMLElement | SVGElement | null;
export declare function createElement(jsx: Hypertext, prevTarget?: HTMLElement | SVGElement, container?: HTMLElement | SVGElement): HTMLElement | SVGElement;

@@ -19,1 +19,2 @@ export declare function h(tag: string, attrs: IObject<any>, ...children: Hypertext[]): Hypertext;

export declare function getLineSize(points: number[][]): number;
export declare function getDocument(el: Node): Document;

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

repository: git+https://github.com/daybrush/selecto.git
version: 1.22.3
version: 1.22.4
*/

@@ -132,4 +132,5 @@ 'use strict';

}
function elementFromPoint(clientX, clientY) {
return document.elementFromPoint && document.elementFromPoint(clientX, clientY) || null;
function elementFromPoint(baseNode, clientX, clientY) {
var doc = getDocument(baseNode);
return doc.elementFromPoint && doc.elementFromPoint(clientX, clientY) || null;
}

@@ -284,2 +285,5 @@ function createElement(jsx, prevTarget, container) {

}
function getDocument(el) {
return el.ownerDocument || document;
}

@@ -394,2 +398,3 @@ 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 pointer-events: none;\n will-change: transform;\n z-index: 100;\n}\n");

data.containerY = 0;
var container = _this.container;
var boundArea = {

@@ -428,3 +433,3 @@ left: -Infinity,

if (utils.isString(boundElement)) {
rectElement = document.querySelector(boundElement);
rectElement = getDocument(container).querySelector(boundElement);
} else if (boundElement === true) {

@@ -566,3 +571,3 @@ rectElement = _this.container;

while (parentElement && parentElement !== document.body) {
while (parentElement && parentElement !== getDocument(container).body) {
var overflow = getComputedStyle(parentElement).overflow !== "visible";

@@ -622,2 +627,3 @@

var selectFlag = data.selectFlag;
var container = _this.container;
/**

@@ -650,3 +656,3 @@ * When the drag ends (triggers on mouseup or touchend after drag), the dragEnd event is called.

// only clickBySelectEnd
var pointTarget = _this._findElement((inputEvent === null || inputEvent === void 0 ? void 0 : inputEvent.target) || elementFromPoint(e.clientX, e.clientY), data.selectableTargets);
var pointTarget = _this._findElement((inputEvent === null || inputEvent === void 0 ? void 0 : inputEvent.target) || elementFromPoint(container, e.clientX, e.clientY), data.selectableTargets);

@@ -784,2 +790,4 @@ _this._select(pointTarget ? [pointTarget] : [], rect, e);

_this._onDocumentSelectStart = function (e) {
var doc = getDocument(_this.container);
if (!_this.gesto.isFlag()) {

@@ -792,3 +800,3 @@ return;

if (dragContainer === window) {
dragContainer = document.documentElement;
dragContainer = doc.documentElement;
}

@@ -1013,2 +1021,3 @@

__proto.getSelectableElements = function () {
var container = this.container;
var selectableElements = [];

@@ -1027,3 +1036,3 @@ this.options.selectableTargets.forEach(function (target) {

} else {
var elements = [].slice.call(document.querySelectorAll(target));
var elements = [].slice.call(getDocument(container).querySelectorAll(target));
selectableElements.push.apply(selectableElements, elements);

@@ -1076,2 +1085,3 @@ }

var hasIndexesMap = options.checkOverflow || options.innerScrollOptions;
var doc = getDocument(this.container);

@@ -1119,3 +1129,3 @@ if (hasIndexesMap) {

while (parentElement && parentElement !== document.body) {
while (parentElement && parentElement !== doc.body) {
_loop_1();

@@ -1267,5 +1277,6 @@ }

__proto.initElement = function () {
var container = this.container;
this.target = createElement(h("div", {
className: CLASS_NAME
}), this.target, this.container);
}), this.target, container);
var target = this.target;

@@ -1281,3 +1292,3 @@ var _a = this.options,

preventRightClick = _b === void 0 ? true : _b;
this.dragContainer = typeof dragContainer === "string" ? [].slice.call(document.querySelectorAll(dragContainer)) : dragContainer || this.target.parentNode;
this.dragContainer = typeof dragContainer === "string" ? [].slice.call(getDocument(container).querySelectorAll(dragContainer)) : dragContainer || this.target.parentNode;
this.gesto = new Gesto(this.dragContainer, {

@@ -1284,0 +1295,0 @@ checkWindowBlur: true,

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

repository: git+https://github.com/daybrush/selecto.git
version: 1.22.3
version: 1.22.4
*/

@@ -130,4 +130,5 @@ import EventEmitter from '@scena/event-emitter';

}
function elementFromPoint(clientX, clientY) {
return document.elementFromPoint && document.elementFromPoint(clientX, clientY) || null;
function elementFromPoint(baseNode, clientX, clientY) {
var doc = getDocument(baseNode);
return doc.elementFromPoint && doc.elementFromPoint(clientX, clientY) || null;
}

@@ -282,2 +283,5 @@ function createElement(jsx, prevTarget, container) {

}
function getDocument(el) {
return el.ownerDocument || document;
}

@@ -392,2 +396,3 @@ 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 pointer-events: none;\n will-change: transform;\n z-index: 100;\n}\n");

data.containerY = 0;
var container = _this.container;
var boundArea = {

@@ -426,3 +431,3 @@ left: -Infinity,

if (isString(boundElement)) {
rectElement = document.querySelector(boundElement);
rectElement = getDocument(container).querySelector(boundElement);
} else if (boundElement === true) {

@@ -564,3 +569,3 @@ rectElement = _this.container;

while (parentElement && parentElement !== document.body) {
while (parentElement && parentElement !== getDocument(container).body) {
var overflow = getComputedStyle(parentElement).overflow !== "visible";

@@ -620,2 +625,3 @@

var selectFlag = data.selectFlag;
var container = _this.container;
/**

@@ -648,3 +654,3 @@ * When the drag ends (triggers on mouseup or touchend after drag), the dragEnd event is called.

// only clickBySelectEnd
var pointTarget = _this._findElement((inputEvent === null || inputEvent === void 0 ? void 0 : inputEvent.target) || elementFromPoint(e.clientX, e.clientY), data.selectableTargets);
var pointTarget = _this._findElement((inputEvent === null || inputEvent === void 0 ? void 0 : inputEvent.target) || elementFromPoint(container, e.clientX, e.clientY), data.selectableTargets);

@@ -782,2 +788,4 @@ _this._select(pointTarget ? [pointTarget] : [], rect, e);

_this._onDocumentSelectStart = function (e) {
var doc = getDocument(_this.container);
if (!_this.gesto.isFlag()) {

@@ -790,3 +798,3 @@ return;

if (dragContainer === window) {
dragContainer = document.documentElement;
dragContainer = doc.documentElement;
}

@@ -1011,2 +1019,3 @@

__proto.getSelectableElements = function () {
var container = this.container;
var selectableElements = [];

@@ -1025,3 +1034,3 @@ this.options.selectableTargets.forEach(function (target) {

} else {
var elements = [].slice.call(document.querySelectorAll(target));
var elements = [].slice.call(getDocument(container).querySelectorAll(target));
selectableElements.push.apply(selectableElements, elements);

@@ -1074,2 +1083,3 @@ }

var hasIndexesMap = options.checkOverflow || options.innerScrollOptions;
var doc = getDocument(this.container);

@@ -1117,3 +1127,3 @@ if (hasIndexesMap) {

while (parentElement && parentElement !== document.body) {
while (parentElement && parentElement !== doc.body) {
_loop_1();

@@ -1265,5 +1275,6 @@ }

__proto.initElement = function () {
var container = this.container;
this.target = createElement(h("div", {
className: CLASS_NAME
}), this.target, this.container);
}), this.target, container);
var target = this.target;

@@ -1279,3 +1290,3 @@ var _a = this.options,

preventRightClick = _b === void 0 ? true : _b;
this.dragContainer = typeof dragContainer === "string" ? [].slice.call(document.querySelectorAll(dragContainer)) : dragContainer || this.target.parentNode;
this.dragContainer = typeof dragContainer === "string" ? [].slice.call(getDocument(container).querySelectorAll(dragContainer)) : dragContainer || this.target.parentNode;
this.gesto = new Gesto(this.dragContainer, {

@@ -1282,0 +1293,0 @@ checkWindowBlur: true,

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

repository: git+https://github.com/daybrush/selecto.git
version: 1.22.3
version: 1.22.4
*/
!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 F=function(t,e){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function K(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}F(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var m=function(){return(m=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 s(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||((r=r||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}var I="function",W="string",A=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],B=1e-7;function y(t){return t&&"object"==typeof t}function R(t){return Array.isArray(t)}function E(t){return typeof t===W}function L(t){return typeof t===I}function N(t,e,n,r,i){if(g(t,e,n))return n;for(var o,a=t,s=e,c=r,l=i,u=n+1;u<c;++u){var h=function(t){var e,n,r=s[t].trim();return r!==a.close||g(a,s,t)?(e=t,-1===(e=(n=C(l,function(t){return t.open===r}))?N(n,s,t,c,l):e)?(o=t,"break"):void(o=t=e)):{value:t}}(u);if(u=o,"object"==typeof h)return h.value;if("break"===h)break}return-1}function g(t,e,n){if(!t.ignore)return null;e=e.slice(Math.max(n-3,0),n+3).join("");return new RegExp(t.ignore).exec(e)}function q(t,e){var e=E(e)?{separator:e}:e,n=e.separator,o=void 0===n?",":n,a=e.isSeparateFirst,s=e.isSeparateOnlyOpenClose,n=e.isSeparateOpenClose,c=void 0===n?s:n,n=e.openCloseCharacters,l=void 0===n?A:n,e=l.map(function(t){var e=t.open,t=t.close;return e===t?e:e+"|"+t}).join("|"),n=new RegExp("(\\s*"+o+"\\s*|"+e+"|\\s+)","g"),u=t.split(n).filter(Boolean),h=u.length,f=[],p=[];function d(){return p.length&&(f.push(p.join("")),p=[])}for(var v,r=0;r<h;++r){var i=function(t){var e=u[t].trim(),n=t,r=C(l,function(t){return t.open===e}),i=C(l,function(t){return t.close===e});if(r){if(-1!==(n=N(r,u,t,h,l))&&c)return d()&&a?(v=t,"break"):(f.push(u.slice(t,n+1).join("")),t=n,a?(v=t,"break"):(v=t,"continue"))}else{if(i&&!g(i,u,t))throw new Error("invalid format: "+i.close);if(r=e,!((""!==(i=o)&&" "!=i||""!==r&&" "!=r)&&r!==i||s))return d(),a?(v=t,"break"):(v=t,"continue")}p.push(u.slice(t,(n=-1===n?h-1:n)+1).join("")),v=t=n}(r),r=v;if("break"===i)break}return p.length&&f.push(p.join("")),f}function c(t){return q(t,",")}function G(t){t=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!t)return{prefix:"",unit:"",value:NaN};var e=t[1],n=t[2];return{prefix:e,unit:t[3],value:parseFloat(n)}}function H(t){return t.replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()})}function S(){return Date.now?Date.now():(new Date).getTime()}function o(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}function C(t,e,n){e=o(t,e);return-1<e?t[e]:n}function Z(t,e,n){return Math.max(e,Math.min(t,n))}function U(t,r,i,e){return void 0===e&&(e=t[0]/t[1]),[[j(r[0],B),j(r[0]/e,B)],[j(r[1]*e,B),j(r[1],B)]].filter(function(t){return t.every(function(t,e){var e=r[e],n=j(e,B);return i?t<=e||t<=n:e<=t||n<=t})})[0]||t}function V(t,e){var n=e[0]-t[0],e=e[1]-t[1],t=Math.atan2(e,n);return 0<=t?t:t+2*Math.PI}function z(o){return[0,1].map(function(e){for(var t=o.map(function(t){return t[e]}),n=t.length,r=0,i=n-1;0<=i;--i)r+=t[i];return n?r/n:0})}function $(t){var e=z(t),n=V(e,t[0]),e=V(e,t[1]);return n<e&&e-n<Math.PI||e<n&&e-n<-Math.PI?1:-1}function h(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function j(t,e){if(!e)return t;var n=1/e;return Math.round(t/e)/n}function _(t,e,n,r){t.addEventListener(e,n,r)}function b(t,e,n,r){t.removeEventListener(e,n,r)}var J=function(){return(J=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)};var t=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(y(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(y(t))for(var n in t)this.off(n);else{var r,i;e?(r=this._events[t])&&-1<(i=o(r,function(t){return t.listener===e}))&&r.splice(i,1):this._events[t]=[]}else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this,t=(void 0===n&&(n={}),this._events[e]);if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return this.emit(t,e=void 0===e?{}:e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(J({listener:e},n))},t}(),Q=function(t,e){return(Q=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 k=function(){return(k=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 e(t){return 180*(e=[t[0].clientX,t[0].clientY],t=[t[1].clientX,t[1].clientY],n=t[0]-e[0],t=t[1]-e[1],(0<=(e=Math.atan2(t,n))?e:e+2*Math.PI)/Math.PI);var e,n}function D(t){if(!t)return[];if(t.touches){for(var e=t.touches,n=Math.min(e.length,2),r=[],i=0;i<n;++i)r.push(et(e[i]));return r}return[et(t)]}function tt(t,e,n){var r=n.length,t=l(t,r),i=t.clientX,o=t.clientY,a=t.originalClientX,t=t.originalClientY,e=l(e,r),s=e.clientX,e=e.clientY,n=l(n,r);return{clientX:a,clientY:t,deltaX:i-s,deltaY:o-e,distX:i-n.clientX,distY:o-n.clientY}}function n(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function et(t){return{clientX:t.clientX,clientY:t.clientY}}function l(t,e){void 0===e&&(e=t.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=0;r<e;++r){var i=t[r];n.originalClientX+="originalClientX"in i?i.originalClientX:i.clientX,n.originalClientY+="originalClientY"in i?i.originalClientY:i.clientY,n.clientX+=i.clientX,n.clientY+=i.clientY}return e?{clientX:n.clientX/e,clientY:n.clientY/e,originalClientX:n.originalClientX/e,originalClientY:n.originalClientY/e}:n}var w=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}return t.prototype.getAngle=function(t){return e(t=void 0===t?this.prevClients:t)},t.prototype.getRotation=function(t){return e(t=void 0===t?this.prevClients:t)-e(this.startClients)},t.prototype.getPosition=function(t,e){var n=tt((t=void 0===t?this.prevClients:t)||this.prevClients,this.prevClients,this.startClients),r=n.deltaX,i=n.deltaY;return this.movement+=Math.sqrt(r*r+i*i),this.prevClients=t,n},t.prototype.getPositions=function(n){void 0===n&&(n=this.prevClients);var r=this.prevClients;return this.startClients.map(function(t,e){return tt([n[e]],[r[e]],[t])})},t.prototype.getMovement=function(t){var e=this.movement;if(!t)return e;var t=l(t,this.length),n=l(this.prevClients,this.length),r=t.clientX-n.clientX,t=t.clientY-n.clientY;return Math.sqrt(r*r+t*t)+e},t.prototype.getDistance=function(t){return n(t=void 0===t?this.prevClients:t)},t.prototype.getScale=function(t){return n(t=void 0===t?this.prevClients:t)/n(this.startClients)},t.prototype.move=function(e,n){this.startClients.forEach(function(t){t.clientX-=e,t.clientY-=n}),this.prevClients.forEach(function(t){t.clientX-=e,t.clientY-=n})},t}(),nt=["textarea","input"],rt=function(o){function t(){this.constructor=e}var e,n;function r(t,e){void 0===e&&(e={});var n,v=o.call(this)||this,t=(v.options={},v.flag=!1,v.pinchFlag=!1,v.data={},v.isDrag=!1,v.isPinch=!1,v.isMouse=!1,v.isTouch=!1,v.clientStores=[],v.targets=[],v.prevTime=0,v.doubleFlag=!1,v._dragFlag=!1,v._isTrusted=!1,v._isMouseEvent=!1,v._isSecondaryButton=!1,v._preventMouseEvent=!1,v._prevInputEvent=null,v.onDragStart=function(t,e){if(void 0===e&&(e=!0),v.flag||!1!==t.cancelable){var n=v.options,r=n.container,i=n.pinchOutside,o=n.preventWheelClick,a=n.preventRightClick,s=n.preventDefault,c=n.checkInput,l=n.preventClickEventOnDragStart,u=n.preventClickEventOnDrag,n=n.preventClickEventByCondition,h=v.isTouch,f=!v.flag;if(v._isSecondaryButton=3===t.which||2===t.button,o&&(2===t.which||1===t.button)||a&&(3===t.which||2===t.button))return v.stop(),!1;if(f){o=document.activeElement,a=t.target;if(a){var p=a.tagName.toLowerCase(),p=-1<nt.indexOf(p),d=a.isContentEditable;if(p||d){if(c||o===a)return!1;if(o&&d&&o.isContentEditable&&o.contains(a))return!1}else(s||"touchstart"===t.type)&&o&&(p=o.tagName.toLowerCase(),(o.isContentEditable||-1<nt.indexOf(p))&&o.blur());(l||u||n)&&_(window,"click",v._onClick,!0)}v.clientStores=[new w(D(t))],v.flag=!0,v.isDrag=!1,v._isTrusted=e,v._dragFlag=!0,v._prevInputEvent=t,v.data={},v.doubleFlag=S()-v.prevTime<200,v._isMouseEvent=(c=t)&&(-1<c.type.indexOf("mouse")||"button"in c),!v._isMouseEvent&&v._preventMouseEvent&&(v._preventMouseEvent=!1),!1===(v._preventMouseEvent||v.emit("dragStart",k(k({data:v.data,datas:v.data,inputEvent:t,isMouseEvent:v._isMouseEvent,isSecondaryButton:v._isSecondaryButton,isTrusted:e,isDouble:v.doubleFlag},v.getCurrentStore().getPosition()),{preventDefault:function(){t.preventDefault()},preventDrag:function(){v._dragFlag=!1}})))&&v.stop(),v._isMouseEvent&&v.flag&&s&&t.preventDefault()}if(!v.flag)return!1;d=0;f?(v._attchDragEvent(),h&&i&&(d=setTimeout(function(){_(r,"touchstart",v.onDragStart,{passive:!1})}))):h&&i&&b(r,"touchstart",v.onDragStart),v.flag&&((a=t).touches&&2<=a.touches.length)&&(clearTimeout(d),f&&t.touches.length!==t.changedTouches.length||v.pinchFlag||v.onPinchStart(t))}},v.onDrag=function(t,e){if(v.flag){var n=v.options.preventDefault,n=(!v._isMouseEvent&&n&&t.preventDefault(),D(v._prevInputEvent=t)),r=v.moveClients(n,t,!1);if(v._dragFlag){if(v.pinchFlag||r.deltaX||r.deltaY)if(!1===(v._preventMouseEvent||v.emit("drag",k(k({},r),{isScroll:!!e,inputEvent:t}))))return void v.stop();v.pinchFlag&&v.onPinch(t,n)}v.getCurrentStore().getPosition(n,!0)}},v.onDragEnd=function(t){var e,n,r,i,o,a;v.flag&&(a=(r=v.options).pinchOutside,e=r.container,o=r.preventClickEventOnDrag,i=r.preventClickEventOnDragStart,r=r.preventClickEventByCondition,n=v.isDrag,(o||i||r)&&requestAnimationFrame(function(){v._allowClickEvent()}),r||i||!o||n||v._allowClickEvent(),v.isTouch&&a&&b(e,"touchstart",v.onDragStart),v.pinchFlag&&v.onPinchEnd(t),0!==(r=null!=t&&t.touches?D(t):[]).length&&v.options.keepDragging?v._addStore(new w(r)):v.flag=!1,i=v._getPosition(),o=S(),a=!n&&v.doubleFlag,v._prevInputEvent=null,v.prevTime=n||a?0:o,v.flag||(v._dettachDragEvent(),v._preventMouseEvent||v.emit("dragEnd",k({data:v.data,datas:v.data,isDouble:a,isDrag:n,isClick:!n,isMouseEvent:v._isMouseEvent,isSecondaryButton:v._isSecondaryButton,inputEvent:t,isTrusted:v._isTrusted},i)),v.clientStores=[],v._isMouseEvent||(v._preventMouseEvent=!0,requestAnimationFrame(function(){requestAnimationFrame(function(){v._preventMouseEvent=!1})}))))},v.onBlur=function(){v.onDragEnd()},v._allowClickEvent=function(){b(window,"click",v._onClick,!0)},v._onClick=function(t){v._allowClickEvent(),v._preventMouseEvent=!1;var e=v.options.preventClickEventByCondition;null!=e&&e(t)||(t.stopPropagation(),t.preventDefault())},v._onContextMenu=function(t){v.options.preventRightClick?v.onDragEnd(t):t.preventDefault()},v._passCallback=function(){},[].concat(t)),e=(v.options=k({checkInput:!1,container:1<t.length?window:t[0],preventRightClick:!0,preventWheelClick:!0,preventClickEventOnDragStart:!1,preventClickEventOnDrag:!1,preventClickEventByCondition:null,preventDefault:!0,checkWindowBlur:!1,keepDragging:!1,pinchThreshold:0,events:["touch","mouse"]},e),v.options),r=e.container,i=e.events,e=e.checkWindowBlur;return v.isTouch=-1<i.indexOf("touch"),v.isMouse=-1<i.indexOf("mouse"),v.targets=t,v.isMouse&&(t.forEach(function(t){_(t,"mousedown",v.onDragStart),_(t,"mousemove",v._passCallback)}),_(r,"contextmenu",v._onContextMenu)),e&&_(window,"blur",v.onBlur),v.isTouch&&(n={passive:!1},t.forEach(function(t){_(t,"touchstart",v.onDragStart,n),_(t,"touchmove",v._passCallback,n)})),v}return Q(e=r,n=o),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t),r.prototype.stop=function(){this.isDrag=!1,this.data={},this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1,this._allowClickEvent(),this._dettachDragEvent()},r.prototype.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce(function(t,e){return t+e.movement},0)},r.prototype.isDragging=function(){return this.isDrag},r.prototype.isFlag=function(){return this.flag},r.prototype.isPinchFlag=function(){return this.pinchFlag},r.prototype.isDoubleFlag=function(){return this.doubleFlag},r.prototype.isPinching=function(){return this.isPinch},r.prototype.scrollBy=function(t,e,n,r){void 0===r&&(r=!0),this.flag&&(this.clientStores[0].move(t,e),r&&this.onDrag(n,!0))},r.prototype.move=function(t,e){var n=t[0],r=t[1],t=this.getCurrentStore().prevClients;return this.moveClients(t.map(function(t){var e=t.clientX,t=t.clientY;return{clientX:e+n,clientY:t+r,originalClientX:e,originalClientY:t}}),e,!0)},r.prototype.triggerDragStart=function(t){this.onDragStart(t,!1)},r.prototype.setEventData=function(t){var e,n=this.data;for(e in t)n[e]=t[e];return this},r.prototype.setEventDatas=function(t){return this.setEventData(t)},r.prototype.getCurrentEvent=function(t){return void 0===t&&(t=this._prevInputEvent),k(k({data:this.data,datas:this.data},this._getPosition()),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:t})},r.prototype.getEventData=function(){return this.data},r.prototype.getEventDatas=function(){return this.data},r.prototype.unset=function(){var e=this,t=this.targets,n=this.options.container;this.off(),b(window,"blur",this.onBlur),this.isMouse&&(t.forEach(function(t){b(t,"mousedown",e.onDragStart)}),b(n,"contextmenu",this._onContextMenu)),this.isTouch&&(t.forEach(function(t){b(t,"touchstart",e.onDragStart)}),b(n,"touchstart",this.onDragStart)),this._prevInputEvent=null,this._allowClickEvent(),this._dettachDragEvent()},r.prototype.onPinchStart=function(t){var e=this.options.pinchThreshold;this.isDrag&&this.getMovement()>e||(e=new w(D(t)),this.pinchFlag=!0,this._addStore(e),!1===this.emit("pinchStart",k(k({data:this.data,datas:this.data,angle:e.getAngle(),touches:this.getCurrentStore().getPositions()},e.getPosition()),{inputEvent:t,isTrusted:this._isTrusted}))&&(this.pinchFlag=!1))},r.prototype.onPinch=function(t,e){var n;!this.flag||!this.pinchFlag||e.length<2||(n=this.getCurrentStore(),this.isPinch=!0,this.emit("pinch",k(k({data:this.data,datas:this.data,movement:this.getMovement(e),angle:n.getAngle(e),rotation:n.getRotation(e),touches:n.getPositions(e),scale:n.getScale(e),distance:n.getDistance(e)},n.getPosition(e)),{inputEvent:t,isTrusted:this._isTrusted})))},r.prototype.onPinchEnd=function(t){var e,n;this.pinchFlag&&(e=this.isPinch,this.isPinch=!1,this.pinchFlag=!1,n=this.getCurrentStore(),this.emit("pinchEnd",k(k({data:this.data,datas:this.data,isPinch:e,touches:n.getPositions()},n.getPosition()),{inputEvent:t})))},r.prototype.getCurrentStore=function(){return this.clientStores[0]},r.prototype.moveClients=function(t,e,n){var n=this._getPosition(t,n),r=this.isDrag,i=((n.deltaX||n.deltaY)&&(this.isDrag=!0),!1);return!r&&this.isDrag&&(i=!0),k(k({data:this.data,datas:this.data},n),{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,isMouseEvent:this._isMouseEvent,isSecondaryButton:this._isSecondaryButton,inputEvent:e,isTrusted:this._isTrusted,isFirstDrag:i})},r.prototype._addStore=function(t){this.clientStores.splice(0,0,t)},r.prototype._getPosition=function(t,e){var t=this.getCurrentStore().getPosition(t,e),e=this.clientStores.slice(1).reduce(function(t,e){e=e.getPosition();return t.distX+=e.distX,t.distY+=e.distY,t},t),n=e.distX,e=e.distY;return k(k({},t),{distX:n,distY:e})},r.prototype._attchDragEvent=function(){var t=this.options.container,e={passive:!1};this.isMouse&&(_(t,"mousemove",this.onDrag),_(t,"mouseup",this.onDragEnd)),this.isTouch&&(_(t,"touchmove",this.onDrag,e),_(t,"touchend",this.onDragEnd,e),_(t,"touchcancel",this.onDragEnd,e))},r.prototype._dettachDragEvent=function(){var t=this.options.container;this.isMouse&&(b(t,"mousemove",this.onDrag),b(t,"mouseup",this.onDragEnd)),this.isTouch&&(b(t,"touchstart",this.onDragStart),b(t,"touchmove",this.onDrag),b(t,"touchend",this.onDragEnd),b(t,"touchcancel",this.onDragEnd))},r}(t);var it=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,r=this.values,i=n.indexOf(t),i=-1===i?n.length:i;n[i]=t,r[i]=e},t}(),ot=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}(),at="function"==typeof Map,st=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 ct=function(){function t(t,e,n,r,i,o,a,s){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=a,this.fixed=s}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(){t=this.changedBeforeAdded,n=this.fixed,i=[],o=[],t.forEach(function(t){var e=t[0],t=t[1],n=new st;i[e]=n,o[t]=n}),i.forEach(function(t,e){t.connect(i[e-1])});var n,i,o,t=t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],t=t[1];if(n===t)return[0,0];var n=i[n],t=o[t-1],r=n.getIndex();return n.disconnect(),t?n.connect(t,t.next):n.connect(void 0,i[0]),[r,n.getIndex()]}),a=this.changed,s=[];this.cacheOrdered=t.filter(function(t,e){var n=t[0],t=t[1],e=a[e],r=e[0],e=e[1];if(n!==t)return s.push([r,e]),!0}),this.cachePureChanged=s},t}();var lt,ut="function"==typeof Map?void 0:(lt=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++lt)});function M(t,e){return t=t,e=e,n=ut,r=at?Map:n?ot:it,n=n||function(t){return t},i=[],o=[],a=[],s=t.map(n),n=e.map(n),c=new r,l=new r,u=[],h=[],f={},p=[],v=d=0,s.forEach(function(t,e){c.set(t,e)}),n.forEach(function(t,e){l.set(t,e)}),s.forEach(function(t,e){t=l.get(t);void 0===t?(++v,o.push(e)):f[t]=v}),n.forEach(function(t,e){t=c.get(t);void 0===t?(i.push(e),++d):(a.push([t,e]),v=f[e]||0,u.push([t-v,e-d]),h.push(e===t),t!==e&&p.push([t,e]))}),o.reverse(),new ct(t,e,i,o,p,a,u,h);var n,r,i,o,a,s,c,l,u,h,f,p,d,v}var ht=function(t,e){return(ht=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 ft(t){t=t.container;return t===document.body?[t.scrollLeft||document.documentElement.scrollLeft,t.scrollTop||document.documentElement.scrollTop]:[t.scrollLeft,t.scrollTop]}function pt(t,e){return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}function f(t){return t?E(t)?document.querySelector(t):L(t)?t():t instanceof Element?t:"current"in t?t.current:"value"in t?t.value:void 0:null}var dt=function(t){function e(){this.constructor=n}var n;function r(){var n=null!==t&&t.apply(this,arguments)||this;return n._startRect=null,n._startPos=[],n._prevTime=0,n._timer=0,n._prevScrollPos=[0,0],n._isWait=!1,n._flag=!1,n._currentOptions=null,n._lock=!1,n._unregister=null,n._onScroll=function(){var e=n._currentOptions;!n._lock&&e&&n.emit("scrollDrag",{next:function(t){n.checkScroll({container:e.container,inputEvent:t})}})},n}ht(n=r,i=t),n.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e);var i=r.prototype;return i.dragStart=function(t,e){var n,r,i,o,a=f(e.container);a?(o=i=r=n=0,o=a===document.body?(i=window.innerWidth,window.innerHeight):(n=(a=a.getBoundingClientRect()).top,r=a.left,i=a.width,a.height),this._flag=!0,this._startPos=[t.clientX,t.clientY],this._startRect={top:n,left:r,width:i,height:o},this._prevScrollPos=this._getScrollPosition([0,0],e),this._currentOptions=e,this._registerScrollEvent(e)):this._flag=!1},i.drag=function(t,e){var n,r,i,o,a,s;if(clearTimeout(this._timer),this._flag)return n=t.clientX,r=t.clientY,i=e.threshold,i=void 0===i?0:i,o=this._startRect,a=this._startPos,this._currentOptions=e,s=[0,0],o.top>r-i?(a[1]>o.top||r<a[1])&&(s[1]=-1):o.top+o.height<r+i&&(a[1]<o.top+o.height||r>a[1])&&(s[1]=1),o.left>n-i?(a[0]>o.left||n<a[0])&&(s[0]=-1):o.left+o.width<n+i&&(a[0]<o.left+o.width||n>a[0])&&(s[0]=1),!(!s[0]&&!s[1])&&this._continueDrag(u(u({},e),{direction:s,inputEvent:t,isDrag:!0}))},i.checkScroll=function(t){var e=this;if(this._isWait)return!1;var n=t.prevScrollPos,n=void 0===n?this._prevScrollPos:n,r=t.direction,i=t.throttleTime,i=void 0===i?0:i,o=t.inputEvent,a=t.isDrag,s=this._getScrollPosition(r||[0,0],t),c=s[0]-n[0],n=s[1]-n[1],r=r||[c?Math.abs(c)/c:0,n?Math.abs(n)/n:0];return this._prevScrollPos=s,this._lock=!1,!(!c&&!n)&&(this.emit("move",{offsetX:r[0]?c:0,offsetY:r[1]?n:0,inputEvent:o}),i&&a&&(clearTimeout(this._timer),this._timer=window.setTimeout(function(){e._continueDrag(t)},i)),!0)},i.dragEnd=function(){this._flag=!1,this._lock=!1,clearTimeout(this._timer),this._unregisterScrollEvent()},i._getScrollPosition=function(t,e){var n=e.container,e=e.getScrollPosition;return(void 0===e?ft:e)({container:f(n),direction:t})},i._continueDrag=function(t){var e=this,n=t.container,r=t.direction,i=t.throttleTime,o=t.useScroll,a=t.isDrag,s=t.inputEvent;if(!(!this._flag||a&&this._isWait)){var c=S(),i=Math.max(i+this._prevTime-c,0);if(0<i)return clearTimeout(this._timer),this._timer=window.setTimeout(function(){e._continueDrag(t)},i),!1;this._prevTime=c;i=this._getScrollPosition(r,t),c=(this._prevScrollPos=i,a&&(this._isWait=!0),o||(this._lock=!0),{container:f(n),direction:r,inputEvent:s});return null!=(a=t.requestScroll)&&a.call(t,c),this.emit("scroll",c),this._isWait=!1,o||this.checkScroll(u(u({},t),{prevScrollPos:i,direction:r,inputEvent:s}))}},i._registerScrollEvent=function(t){this._unregisterScrollEvent();var e,n=t.checkScrollEvent;n&&(e=!0===n?pt:n,t=f(t.container),!0!==n||t!==document.body&&t!==document.documentElement?this._unregister=e(t,this._onScroll):this._unregister=pt(window,this._onScroll))},i._unregisterScrollEvent=function(){var t;null!=(t=this._unregister)&&t.call(this),this._unregister=null},r}(t),vt=function(t,e){return(vt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function gt(t){return t&&"object"==typeof t}function mt(t){return Array.isArray(t)}function yt(t){return"string"==typeof t}function a(t,e,n,r){t.addEventListener(e,n,r)}function p(t,e,n,r){t.removeEventListener(e,n,r)}var Et=function(){return(Et=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)};var St=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(gt(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(gt(t))for(var n in t)this.off(n);else{var r,i;e?(r=this._events[t])&&-1<(i=function(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}(r,function(t){return t.listener===e}))&&r.splice(i,1):this._events[t]=[]}else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this,t=(void 0===n&&(n={}),this._events[e]);if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return this.emit(t,e=void 0===e?{}:e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Et({listener:e},n))},t}();(function(t,e){function n(t){if(!t||"object"!=typeof t||(e=t.which||t.keyCode||t.charCode)&&(t=e),"number"==typeof t)return s[t];var e=String(t),t=r[e.toLowerCase()];return t||((t=i[e.toLowerCase()])?t:1===e.length?e.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){t=t.which||t.keyCode||t.charCode;if(null!=t)if("string"==typeof e){var n=r[e.toLowerCase()];if(n)return n===t;if(n=i[e.toLowerCase()])return n===t}else if("number"==typeof e)return e===t;return!1}};for(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},i=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},o=97;o<123;o++)r[String.fromCharCode(o)]=o-32;for(var o=48;o<58;o++)r[o-48]=o;for(o=1;o<13;o++)r["f"+o]=o+111;for(o=0;o<10;o++)r["numpad "+o]=o+96;var a,s=e.names=e.title={};for(o in r)s[r[o]]=o;for(a in i)r[a]=i[a]})(r={exports:{}},r.exports);var Ct,r=r.exports,_t=(r.code,r.codes,r.aliases,r.names),bt=(r.title,{"+":"plus","left command":"meta","right command":"meta"}),kt={shift:1,ctrl:2,alt:3,meta:4};function Dt(t,e){var n,r=(_t[t]||e||"").toLowerCase();for(n in bt)r=r.replace(n,bt[n]);return r.replace(/\s/g,"")}function wt(t,e){void 0===e&&(e=Dt(t.keyCode,t.key));t=[t.shiftKey&&"shift",t.ctrlKey&&"ctrl",t.altKey&&"alt",t.metaKey&&"meta"].filter(Boolean);return-1===t.indexOf(e)&&t.push(e),t.filter(Boolean)}function Mt(t){t=t.slice();return t.sort(function(t,e){return(kt[t]||5)-(kt[e]||5)}),t}var Ot=function(n){var t=i,e=n;if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}function i(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")},a(t,"blur",e.blur),a(t,"keydown",e.keydownEvent),a(t,"keyup",e.keyupEvent),e}vt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);e=i.prototype;return Object.defineProperty(i,"global",{get:function(){return Ct=Ct||new i},enumerable:!1,configurable:!0}),i.setGlobal=function(){return this.global},e.destroy=function(){var t=this.container;this.clear(),this.off(),p(t,"blur",this.blur),p(t,"keydown",this.keydownEvent),p(t,"keyup",this.keyupEvent)},e.keydown=function(t,e){return this.addEvent("keydown",t,e)},e.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},e.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},e.keyup=function(t,e){return this.addEvent("keyup",t,e)},e.addEvent=function(t,e,n){return mt(e)?this.on(t+"."+Mt(e).join("."),n):yt(e)?this.on(t+"."+e,n):this.on(t,e),this},e.removeEvent=function(t,e,n){return mt(e)?this.off(t+"."+Mt(e).join("."),n):yt(e)?this.off(t+"."+e,n):this.off(t,e),this},e.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=Dt(e.keyCode,e.key),r={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},e=(this.trigger(t,r),this.trigger(t+"."+n,r),wt(e,n));1<e.length&&this.trigger(t+"."+e.join("."),r)},i}(St);function d(t){return j(t,B)}function P(n){return n.length<3?0:Math.abs(function(t){for(var e=0,n=t.length-1;0<=n;--n)e+=t[n];return e}(n.map(function(t,e){e=n[e+1]||n[0];return t[0]*e[1]-e[0]*t[1]})))/2}function Tt(t){var e=t.map(function(t){return t[0]}),t=t.map(function(t){return t[1]});return{minX:Math.min.apply(Math,e),minY:Math.min.apply(Math,t),maxX:Math.max.apply(Math,e),maxY:Math.max.apply(Math,t)}}function x(i,t,e){var r=i[0],o=i[1],n=Tt(t),a=n.minX,n=n.maxX,s=[[a,o],[n,o]],c=v(s[0],s[1]),a=Yt(t),l=[];if(a.forEach(function(t){var n,e=v(t[0],t[1]),r=t[0];n=e,c.every(function(t,e){return 0===d(t-n[e])})?l.push({pos:i,line:t,type:"line"}):xt(Pt(c,e),[s,t]).forEach(function(n){t.some(function(t){return e=n,!d((t=t)[0]-e[0])&&!d(t[1]-e[1]);var e})?l.push({pos:n,line:t,type:"point"}):0!==d(r[1]-o)&&l.push({pos:n,line:t,type:"intersection"})})}),!e&&C(l,function(t){return t[0]===r}))return!0;var u=0,h={};return l.forEach(function(t){var e=t.pos,n=t.type,t=t.line;e[0]>r||("intersection"===n?++u:"line"!==n&&"point"===n&&(n=C(t,function(t){return t[1]!==o}),t=h[e[0]],n=n[1]>o?1:-1,t?t!==n&&++u:h[e[0]]=n))}),u%2==1}function v(t,e){var n=t[0],t=t[1],r=e[0]-n,e=e[1]-t,i=(Math.abs(r)<B&&(r=0),Math.abs(e)<B&&(e=0),0),o=0,a=0;return r?a=e?(o=1,-(i=-e/r)*n-t):(o=1,-t):e&&(i=-1,a=n),[i,o,a]}function Pt(t,e){var n,r,i=t[0],o=t[1],t=t[2],a=e[0],s=e[1],e=e[2],c=0===i&&0===a,l=0===o&&0===s;return c&&l?[]:c?(c=-t/o)!=-e/s?[]:[[-1/0,c],[1/0,c]]:l?(c=-t/i)!=-e/a?[]:[[c,-1/0],[c,1/0]]:(0===i?[[n=-(s*(r=-t/o)+e)/a,r]]:0===a?[[n=-(o*(r=-e/s)+t)/i,r]]:0===o?[[n=-t/i,r=-(a*n+e)/s]]:0===s?[[n=-e/a,r=-(i*n+t)/o]]:[[n=(o*e-s*t)/(s*i-o*a),r=-(i*n+t)/o]]).map(function(t){return[t[0],t[1]]})}function xt(t,e){var r=e.map(function(e){return[0,1].map(function(t){return[Math.min(e[0][t],e[1][t]),Math.max(e[0][t],e[1][t])]})}),e=[];if(2===t.length){var n=t[0],i=n[0],n=n[1];if(d(i-t[1][0])){if(!d(n-t[1][1])){var o=Math.max.apply(Math,r.map(function(t){return t[0][0]})),a=Math.min.apply(Math,r.map(function(t){return t[0][1]}));if(0<d(o-a))return[];e=[[o,n],[a,n]]}}else{o=Math.max.apply(Math,r.map(function(t){return t[1][0]})),a=Math.min.apply(Math,r.map(function(t){return t[1][1]}));if(0<d(o-a))return[];e=[[i,o],[i,a]]}}return(e=e.length?e:t.filter(function(t){var e=t[0],n=t[1];return r.every(function(t){return 0<=d(e-t[0][0])&&0<=d(t[0][1]-e)&&0<=d(n-t[1][0])&&0<=d(t[1][1]-n)})})).map(function(t){return[d(t[0]),d(t[1])]})}function Yt(n){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(n.slice(1),[n[0]]).map(function(t,e){return[n[e],t]})}function Xt(t,e){var i,a,s,c,l,u,n;return e=e,i=(t=t).slice(),a=e.slice(),-1===$(i)&&i.reverse(),-1===$(a)&&a.reverse(),s=Yt(i),c=Yt(a),t=s.map(function(t){return v(t[0],t[1])}),l=c.map(function(t){return v(t[0],t[1])}),u=[],t.forEach(function(n,r){var i=s[r],o=[];l.forEach(function(t,e){t=xt(Pt(n,t),[i,c[e]]);o.push.apply(o,t.map(function(t){return{index1:r,index2:e,pos:t,type:"intersection"}}))}),o.sort(function(t,e){return h(i[0],t.pos)-h(i[0],e.pos)}),u.push.apply(u,o),x(i[1],a)&&u.push({index1:r,index2:-1,pos:i[1],type:"inside"})}),c.forEach(function(t,n){var r,e;x(t[1],i)&&(r=!1,-1===(e=o(u,function(t){if(t.index2!==n)return!!r;r=!0}))&&(r=!1,e=o(u,function(t){var e=t.index1,t=t.index2;if(-1!==e||t+1!==n)return!!r;r=!0})),-1===e?u.push({index1:-1,index2:n,pos:t[1],type:"inside"}):u.splice(e,0,{index1:-1,index2:n,pos:t[1],type:"inside"}))}),n={},u.filter(function(t){t=t.pos,t=t[0]+"x"+t[1];return!n[t]&&(n[t]=!0)}).map(function(t){return t.pos})}function i(t,e,n){void 0===n&&(n=Math.sqrt(t.length));var r=[],i=t.length/n,o=e.length/i;if(!i)return e;if(!o)return t;for(var a=0;a<n;++a)for(var s=0;s<o;++s)for(var c=r[s*n+a]=0;c<i;++c)r[s*n+a]+=t[c*n+a]*e[s*i+c];return r}function Ft(t,e){return i(t,[1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1],4)}function Bt(t,e){return i(t,[Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1],4)}function jt(t,e){return i(t,(t=e,e=4,n=Math.cos(t),t=Math.sin(t),(r=Wt(e))[0]=n,r[1]=t,r[e]=-t,r[e+1]=n,r));var n,r}function O(t,e){var n=e[0],r=e[1],e=e[2];return i(t,[void 0===n?1:n,0,0,0,0,void 0===r?1:r,0,0,0,0,void 0===e?1:e,0,0,0,0,1],4)}function Kt(t,e){var n=e[0],r=e[1],e=e[2];return i(t,[1,0,0,0,0,1,0,0,0,0,1,0,void 0===n?0:n,void 0===r?0:r,void 0===e?0:e,1],4)}function It(t,e){return i(t,e,4)}function Wt(t){for(var e=t*t,n=[],r=0;r<e;++r)n[r]=r%(t+1)?0:1;return n}function At(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Rt(t){return t=(R(t=t)?t:function(t){return q(t,"")}(t)).map(function(t){var e,n,r,t=!(t=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t=t))||t.length<4?{}:{prefix:t[1],value:t[2],suffix:t[3]},i=t.prefix,t=t.value,o=null,a=i,s="";return"translate"===i||"translateX"===i||"translate3d"===i?(o=Kt,s=[(r=c(t).map(function(t){return parseFloat(t)}))[0],void 0===(e=r[1])?0:e,void 0===(e=r[2])?0:e]):"translateY"===i?(o=Kt,s=[0,parseFloat(t),0]):"translateZ"===i?(o=Kt,s=[0,0,parseFloat(t)]):"scale"===i||"scale3d"===i?(o=O,s=[n=(r=c(t).map(function(t){return parseFloat(t)}))[0],void 0===(e=r[1])?n:e,void 0===(e=r[2])?1:e]):"scaleX"===i?(o=O,s=[n=parseFloat(t),1,1]):"scaleY"===i?(o=O,s=[1,parseFloat(t),1]):"scaleZ"===i?(o=O,s=[1,1,parseFloat(t)]):"rotate"===i||"rotateZ"===i||"rotateX"===i||"rotateY"===i?(e=(r=G(t)).unit,n=r.value,"rotate"===i||"rotateZ"===i?(a="rotateZ",o=jt):"rotateX"===i?o=Ft:"rotateY"===i&&(o=Bt),s="rad"===e?n:n*Math.PI/180):"matrix3d"===i?(o=It,s=c(t).map(function(t){return parseFloat(t)})):"matrix"===i?(o=It,s=[(r=c(t).map(function(t){return parseFloat(t)}))[0],r[1],0,0,r[2],r[3],0,0,0,0,1,0,r[4],r[5],0,1]):a="",{name:i,functionName:a,value:t,matrixFunction:o,functionValue:s}}),n=At(),t.forEach(function(t){var e=t.matrixFunction,t=t.functionValue;e&&(n=e(n,t))}),n;var n}function Lt(t,e){n=t,e=[e[0],e[1]||0,e[2]||0,1],r=(n=i(t,e,t=void 0===(t=4)?e.length:t))[t-1];var n,r,e=n.map(function(t){return t/r}),t=e[3]||1;return[e[0]/t,e[1]/t,e[2]/t]}function Nt(t,e){void 0===e&&(e=document.body);for(var n=t,r=At();n;){r=It(Rt(getComputedStyle(n).transform),r);if(n===e)break;n=n.parentElement}return(r=function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=t.slice(),r=Wt(e),i=0;i<e;++i){var o=e*i+i;if(!j(n[o],B))for(var a=i+1;a<e;++a)if(n[e*i+a]){g=v=d=p=f=h=u=l=c=s=void 0;for(var s=n,c=r,l=i,u=a,h=e,f=0;f<h;++f){var p=l+f*h,d=u+f*h,v=s[p],g=c[p];s[p]=s[d],s[d]=v,c[p]=c[d],c[d]=g}break}if(!j(n[o],B))return[];b=_=C=S=E=y=m=void 0;for(var m=n,y=r,E=i,S=e,C=n[o],_=0;_<S;++_){var b=E+_*S;m[b]/=C,y[b]/=C}for(a=0;a<e;++a){var k=a,D=n[a+i*e];if(j(D,B)&&i!==a){F=X=Y=x=P=T=O=M=w=void 0;for(var w=n,M=r,O=k,T=i,P=e,x=-D,Y=0;Y<P;++Y){var X=O+Y*P,F=T+Y*P;w[X]+=w[F]*x,M[X]+=M[F]*x}}}}return r}(r,4))[12]=0,r[13]=0,r[14]=0,r}function qt(t,e,n){var r=t.tag,i=t.children,o=t.attributes,a=t.className,s=t.style,c=e||document.createElement(r);for(u in o)c.setAttribute(u,o[u]);var l=c.children;if(i.forEach(function(t,e){qt(t,l[e],c)}),a&&a.split(" ").forEach(function(t){var e,n;n=t,((e=c).classList?e.classList.contains(n):e.className.match(new RegExp("(\\s|^)"+n+"(\\s|$)")))||(e=t,(n=c).classList?n.classList.add(e):n.className+=" "+e)}),s){var u,h=c.style;for(u in s)h[u]=s[u]}return!e&&n&&n.appendChild(c),c}function Gt(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var e=e||{},i=e.className,o=e.style;return{tag:t,className:void 0===i?"":i,style:void 0===o?{}:o,attributes:function(t,e){var n={};for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,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}(e,["className","style"]),children:n}}function Ht(t,e,n){t!==e&&n(t,e)}function Zt(t,e,n){void 0===n&&(n=t.data.boundArea);var r=t.distX,r=void 0===r?0:r,i=t.distY,i=void 0===i?0:i,t=t.data,o=t.startX,t=t.startY;0<e&&(r=(0<=r?1:-1)*(e*(a=Math.sqrt((r*r+i*i)/(1+e*e)))),i=(0<=i?1:-1)*a),r=(0<=r?1:-1)*(n=(a=function(t,n,r,e){if(!e)return t.map(function(t,e){return Z(t,n[e],r[e])});var i=t[0],o=t[1],a=(s=U(t,n,!1,e=!0===e?i/o:e))[0],s=s[1],e=(t=U(t,r,!0,e))[0],t=t[1];return i<a||o<s?(i=a,o=s):(e<i||t<o)&&(i=e,o=t),[i,o]}([Math.abs(r),Math.abs(i)],[0,0],[r<0?o-n.left:n.right-o,i<0?t-n.top:n.bottom-t],!!e))[0]),i=(0<=i?1:-1)*(e=a[1]);var a=o+Math.min(0,r),o=t+Math.min(0,i);return{left:a,top:o,right:a+n,bottom:o+e,width:n,height:e}}function T(t){var t=t.getBoundingClientRect(),e=t.left,n=t.top,r=t.width,t=t.height;return{pos1:[e,n],pos2:[e+r,n],pos3:[e,n+t],pos4:[e+r,n+t]}}function Ut(t,e,n){var t=M(t,e),r=t.list,i=t.prevList,e=t.added,o=t.removed,t=t.maintained;return s(s(s([],e.map(function(t){return r[t]}),!0),o.map(function(t){return i[t]}),!0),n?t.map(function(t){t=t[1];return r[t]}):[],!0)}function Vt(t){for(var e=0,n=t.length,r=1;r<n;++r)e=Math.max(h(t[r],t[r-1]),e);return e}function zt(t,e,n,r){var i,o=document.createElement("style");return o.setAttribute("type","text/css"),o.setAttribute("data-styled-id",t),n.nonce&&o.setAttribute("nonce",n.nonce),o.innerHTML=(i=t,t=e,n.original?t:t.replace(/([^};{\s}][^};{]*|^\s*){/gm,function(t,e){e=e.trim();return(e?c(e):[""]).map(function(t){t=t.trim();return 0===t.indexOf("@")?t:-1<t.indexOf(":global")?t.replace(/\:global/g,""):-1<t.indexOf(":host")?""+t.replace(/\:host/g,"."+i):t?"."+i+" "+t:"."+i}).join(", ")+" {"})),(r||document.head||document.body).appendChild(o),o}Jt="rCS"+function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0}($t="\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n pointer-events: none;\n will-change: transform;\n z-index: 100;\n}\n").toString(36),X=0;var $t,Y,Jt,X,Qt,te={className:Jt,inject:function(t,e){void 0===e&&(e={});var n,r=function(t){if(t&&t.getRootNode){t=t.getRootNode();if(11===t.nodeType)return t}}(t),i=0===X;return(r||i)&&(n=zt(Jt,$t,e,r)),i&&(Y=n),r||++X,{destroy:function(){r?(t.removeChild(n),n=null):(0<X&&--X,0===X&&Y&&(Y.parentNode.removeChild(Y),Y=null))}}}},ee="selecto-selection ".concat(te.className),ne=["boundContainer","selectableTargets","selectByClick","selectFromInside","continueSelect","continueSelectWithoutDeselect","toggleContinueSelect","toggleContinueSelectWithoutDeselect","keyContainer","hitRate","scrollOptions","checkInput","preventDefault","ratio","getElementRect","preventDragFromInside","rootContainer","dragCondition","clickBySelectEnd","checkOverflow","innerScrollOptions"],r=s(["dragContainer","cspNonce","preventClickEventOnDrag","preventClickEventOnDragStart","preventRightClick"],ne,!0),St={boundContainer:null,portalContainer:null,container:null,dragContainer:null,selectableTargets:Array,selectByClick:Boolean,selectFromInside:Boolean,continueSelect:Boolean,toggleContinueSelect:Array,toggleContinueSelectWithoutDeselect:Array,keyContainer:null,hitRate:Number,scrollOptions:Object,checkInput:Boolean,preventDefault:Boolean,cspNonce:String,ratio:Number,getElementRect:Function,preventDragFromInside:Boolean,rootContainer:Object,dragCondition:Function,clickBySelectEnd:Boolean,continueSelectWithoutDeselect:Boolean,preventClickEventOnDragStart:Boolean,preventClickEventOnDrag:Boolean,checkOverflow:Boolean,innerScrollOptions:Object},re=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return K(e,t),e}(function(n){function t(t){void 0===t&&(t={});var g=n.call(this)||this,e=(g.selectedTargets=[],g.dragScroll=new dt,g._onDragStart=function(t,e){var n=t.data,r=t.clientX,i=t.clientY,o=t.inputEvent,a=g.options,s=a.selectFromInside,c=a.selectByClick,l=a.rootContainer,u=a.boundContainer,h=a.preventDragFromInside,h=void 0===h||h,f=a.clickBySelectEnd,a=a.dragCondition;if(!a||a(t)){n.data={},n.innerWidth=window.innerWidth,n.innerHeight=window.innerHeight,g.findSelectableTargets(n),n.startSelectedTargets=g.selectedTargets,n.scaleMatrix=At(),n.containerX=0;var a={left:-1/(n.containerY=0),top:-1/0,right:1/0,bottom:1/0},p=(l&&(p=g.container.getBoundingClientRect(),n.containerX=p.left,n.containerY=p.top,n.scaleMatrix=Nt(g.container,l)),u&&((u=(p=y(u)&&"element"in u?m({left:!0,top:!0,bottom:!0,right:!0},u):{element:u,left:!0,top:!0,bottom:!0,right:!0}).element)&&(u=(E(u)?document.querySelector(u):!0===u?g.container:u).getBoundingClientRect(),p.left&&(a.left=u.left),p.top&&(a.top=u.top),p.right&&(a.right=u.right),p.bottom&&(a.bottom=u.bottom))),n.boundArea=a,{left:r,top:i,right:r,bottom:i,width:0,height:0}),u=[],e=0<(u=s&&(!c||f)?u:(a=g._findElement(e||o.target,n.selectableTargets))?[a]:[]).length,a=!s&&e;if(a&&!c)return t.stop(),!1;s=o.type;if(!(!(!t.isClick&&("mousedown"===s||"touchstart"===s))||g.emit("dragStart",m(m({},t),{data:n.data}))))return t.stop(),!1;if(g.continueSelect?(u=Ut(g.selectedTargets,u,g.continueSelectWithoutDeselect),n.startPassedTargets=g.selectedTargets):n.startPassedTargets=[],g._select(u,p,t,!0),n.startX=r,n.startY=i,n.selectFlag=!1,n.preventDragFromInside=!1,o.target&&(e=Lt(n.scaleMatrix,[r-n.containerX,i-n.containerY]),g.target.style.cssText+="position: ".concat(l?"absolute":"fixed",";")+"left:0px;top:0px;"+"transform: translate(".concat(e[0],"px, ").concat(e[1],"px)")),a&&c&&!f)o.preventDefault(),h&&(g._selectEnd(n.startSelectedTargets,n.startPassedTargets,p,t),n.preventDragFromInside=!0);else{n.selectFlag=!0;s=g.options,u=s.scrollOptions,r=s.innerScrollOptions,i=!1;if(r){for(var d=null,v=t.inputEvent.target;v&&v!==document.body;){if("visible"!==getComputedStyle(v).overflow){d=v;break}v=v.parentElement}d&&(n.innerScrollOptions=m({container:d,checkScrollEvent:!0},!0===r?{}:r),g.dragScroll.dragStart(t,n.innerScrollOptions),i=!0)}!i&&u&&u.container&&g.dragScroll.dragStart(t,u),f&&(n.selectFlag=!1,t.preventDrag())}return!0}t.stop()},g._onDrag=function(t){if(t.data.selectFlag){var e=g.scrollOptions,n=t.data.innerScrollOptions;if((n||(null==e?void 0:e.container))&&!t.isScroll&&g.dragScroll.drag(t,n||e))return}g._checkSelected(t)},g._onDragEnd=function(t){var e=t.data,n=t.inputEvent,r=Zt(t,g.options.ratio),i=e.selectFlag;n&&g.emit("dragEnd",m(m({isDouble:!!t.isDouble,isClick:!!t.isClick,isDrag:!1,isSelect:i},t),{data:e.data,rect:r})),g.target.style.cssText+="display: none;",i?(e.selectFlag=!1,g.dragScroll.dragEnd()):g.selectByClick&&g.clickBySelectEnd&&(i=g._findElement((null==n?void 0:n.target)||(i=t.clientX,n=t.clientY,document.elementFromPoint&&document.elementFromPoint(i,n)||null),e.selectableTargets),g._select(i?[i]:[],r,t)),e.preventDragFromInside||g._selectEnd(e.startSelectedTargets,e.startPassedTargets,r,t)},g._onKeyDown=function(t){var e,n=g.options,r=!1;g._keydownContinueSelect||(e=g._sameCombiKey(t,n.toggleContinueSelect),g._keydownContinueSelect=e,r=r||e),g._keydownContinueSelectWithoutDeselection||(e=g._sameCombiKey(t,n.toggleContinueSelectWithoutDeselect),g._keydownContinueSelectWithoutDeselection=e,r=r||e),r&&g.emit("keydown",{keydownContinueSelect:g._keydownContinueSelect,keydownContinueSelectWithoutDeselection:g._keydownContinueSelectWithoutDeselection})},g._onKeyUp=function(t){var e,n=g.options,r=!1;g._keydownContinueSelect&&(e=g._sameCombiKey(t,n.toggleContinueSelect,!0),g._keydownContinueSelect=!e,r=r||e),g._keydownContinueSelectWithoutDeselection&&(e=g._sameCombiKey(t,n.toggleContinueSelectWithoutDeselect,!0),g._keydownContinueSelectWithoutDeselection=!e,r=r||e),r&&g.emit("keyup",{keydownContinueSelect:g._keydownContinueSelect,keydownContinueSelectWithoutDeselection:g._keydownContinueSelectWithoutDeselection})},g._onBlur=function(){(g._keydownContinueSelect||g._keydownContinueSelectWithoutDeselection)&&(g._keydownContinueSelect=!1,g._keydownContinueSelectWithoutDeselection=!1,g.emit("keyup",{keydownContinueSelect:g._keydownContinueSelect,keydownContinueSelectWithoutDeselection:g._keydownContinueSelectWithoutDeselection}))},g._onDocumentSelectStart=function(e){var t,n;g.gesto.isFlag()&&(t=(t=(t=g.dragContainer)===window?document.documentElement:t)instanceof Element?[t]:[].slice.call(t),n=e.target,t.some(function(t){if(t===n||t.contains(n))return e.preventDefault(),!0}))},g.target=t.portalContainer,t.container),t=(g.options=m({portalContainer:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,clickBySelectEnd:!1,hitRate:100,continueSelect:!1,continueSelectWithoutDeselect:!1,toggleContinueSelect:null,toggleContinueSelectWithoutDeselect:null,keyContainer:null,scrollOptions:void 0,checkInput:!1,preventDefault:!1,boundContainer:!1,preventDragFromInside:!0,dragCondition:null,rootContainer:null,checkOverflow:!1,innerScrollOptions:!1,getElementRect:T,cspNonce:"",ratio:0},t),g.options.portalContainer);return t&&(e=t.parentElement),g.container=e||document.body,g.initElement(),g.initDragScroll(),g.setKeyController(),g}K(t,n);var r,i,e=t.prototype;return e.setSelectedTargets=function(t){var e=this.selectedTargets,n=M(e,t),r=n.added,i=n.removed,o=n.prevList,a=n.list;return this.selectedTargets=t,{added:r.map(function(t){return a[t]}),removed:i.map(function(t){return o[t]}),beforeSelected:e,selected:t}},e.setSelectedTargetsByPoints=function(t,e){var n=Math.min(t[0],e[0]),r=Math.min(t[1],e[1]),i=Math.max(t[0],e[0]),t=Math.max(t[1],e[1]),e={left:n,top:r,right:i,bottom:t,width:i-n,height:t-r},i={ignoreClick:!0},n=(this.findSelectableTargets(i),this.hitTest(e,i)),t=this.setSelectedTargets(n);return m(m({},t),{rect:e})},e.selectTargetsByPoints=function(t,e){var t=new MouseEvent("mousedown",{clientX:t[0],clientY:t[1],cancelable:!0,bubbles:!0}),n=new MouseEvent("mousemove",{clientX:e[0],clientY:e[1],cancelable:!0,bubbles:!0}),e=new MouseEvent("mousemove",{clientX:e[0],clientY:e[1],cancelable:!0,bubbles:!0}),r=this.gesto;!1!==r.onDragStart(t)&&(r.onDrag(n),r.onDragEnd(e))},e.getSelectedTargets=function(){return this.selectedTargets},e.triggerDragStart=function(t){return this.gesto.triggerDragStart(t),this},e.destroy=function(){var t;this.off(),this.keycon&&this.keycon.destroy(),this.gesto.unset(),this.injectResult.destroy(),this.dragScroll.dragEnd(),b(document,"selectstart",this._onDocumentSelectStart),this.options.portalContainer||null!=(t=this.target.parentElement)&&t.removeChild(this.target),this.keycon=null,this.gesto=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},e.getElementPoints=function(t){var e,n,r,i,o,a,s,c,l,u=this.getElementRect||T,h=u(t),h=[h.pos1,h.pos2,h.pos4,h.pos3];return u!==T?(u=t.getBoundingClientRect(),t=h,e=(u=u).width,n=u.height,r=u.left,i=u.top,o=(u=Tt(t)).minX,a=u.minY,s=u.maxX,u=u.maxY,c=e/(s-o),l=n/(u-a),t.map(function(t){return[r+(t[0]-o)*c,i+(t[1]-a)*l]})):h},e.getSelectableElements=function(){var n=[];return this.options.selectableTargets.forEach(function(t){var e;L(t)?(e=t())&&n.push.apply(n,[].slice.call(e)):t instanceof Node?n.push(t):y(t)?n.push(t.value||t.current):(e=[].slice.call(document.querySelectorAll(t)),n.push.apply(n,e))}),n},e.checkScroll=function(){var t,e;this.gesto.isFlag()&&(t=this.scrollOptions,((e=this.gesto.getEventData().innerScrollOptions)||(null==t?void 0:t.container))&&this.dragScroll.checkScroll(m({inputEvent:this.gesto.getCurrentEvent()},e||t)))},e.findSelectableTargets=function(t){var a,e=this,n=(void 0===t&&(t=this.gesto.getEventData()),this.getSelectableElements()),r=n.map(function(t){return e.getElementPoints(t)}),r=(t.selectableTargets=n,t.selectablePoints=r,t.selectableParentMap=null,this.options);return(r.checkOverflow||r.innerScrollOptions)&&(a=new Map,t.selectableInnerScrollParentMap=a,t.selectableInnerScrollPathsList=n.map(function(t,n){for(var r=t.parentElement,i=[],o=[];r&&r!==document.body;)!function(){var t,e=a.get(r);e||"visible"!==getComputedStyle(r).overflow&&(t=T(r),e={parentElement:r,indexes:[],points:[t.pos1,t.pos2,t.pos4,t.pos3],paths:s([],o,!0)},i.push(r),i.forEach(function(t){a.set(t,e)}),i=[]),e?(r=e.parentElement,a.get(r).indexes.push(n),o.push(r)):i.push(r),r=r.parentElement}();return o})),r.checkOverflow||(t.selectableInners=n.map(function(){return!0})),this._refreshGroups(t),n},e.clickTarget=function(t,e){var n="touches"in(r=t)?{clientX:(n=r.touches[0]||r.changedTouches[0]).clientX,clientY:n.clientY}:{clientX:r.clientX,clientY:r.clientY},r={data:{selectFlag:!1},clientX:n.clientX,clientY:n.clientY,inputEvent:t,isClick:!0,isTrusted:!1,stop:function(){return!1}};return this._onDragStart(r,e)&&this._onDragEnd(r),this},e.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect,t=t.toggleContinueSelectWithoutDeselect;this.keycon&&(this.keycon.destroy(),this.keycon=null),(n||t)&&(this.keycon=new Ot(e||window),this.keycon.keydown(this._onKeyDown).keyup(this._onKeyUp).on("blur",this._onBlur))},e.setKeyEvent=function(){var t=this.options,e=t.toggleContinueSelect,t=t.toggleContinueSelectWithoutDeselect;!e&&!t||this.keycon||this.setKeyController()},e.setKeyContainer=function(t){var e=this,n=this.options;Ht(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},e.getContinueSelect=function(){var t=this.options,e=t.continueSelect;return t.toggleContinueSelect&&this._keydownContinueSelect?!e:e},e.getContinueSelectWithoutDeselect=function(){var t=this.options,e=t.continueSelectWithoutDeselect;return t.toggleContinueSelectWithoutDeselect&&this._keydownContinueSelectWithoutDeselection?!e:e},e.setToggleContinueSelect=function(t){var e=this,n=this.options;Ht(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},e.setToggleContinueSelectWithoutDeselect=function(t){var e=this,n=this.options;Ht(n.toggleContinueSelectWithoutDeselect,t,function(){n.toggleContinueSelectWithoutDeselect=t,e.setKeyEvent()})},e.setPreventDefault=function(t){this.gesto.options.preventDefault=t},e.setCheckInput=function(t){this.gesto.options.checkInput=t},e.initElement=function(){this.target=qt(Gt("div",{className:ee}),this.target,this.container);var t=this.target,e=this.options,n=e.dragContainer,r=e.checkInput,i=e.preventDefault,o=e.preventClickEventOnDragStart,a=e.preventClickEventOnDrag,s=e.preventClickEventByCondition,e=e.preventRightClick,e=void 0===e||e;this.dragContainer="string"==typeof n?[].slice.call(document.querySelectorAll(n)):n||this.target.parentNode,this.gesto=new rt(this.dragContainer,{checkWindowBlur:!0,container:window,checkInput:r,preventDefault:i,preventClickEventOnDragStart:o,preventClickEventOnDrag:a,preventClickEventByCondition:s,preventRightClick:e}).on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd}),_(document,"selectstart",this._onDocumentSelectStart),this.injectResult=te.inject(t,{nonce:this.options.cspNonce})},e.hitTest=function(t,e,n){function r(t,e){var n=!d&&x([f,p],t);if(a&&n)return!0;if(!(n=Xt(v,t)).length)return!1;var r=P(n),i=0;return 0===r&&0===P(t)?(i=Vt(t),r=Vt(n)):i=P(t),"px"===g.unit?r>=g.value:Z(Math.round(r/i*100),0,100)>=Math.min(100,g.value)}var i=this.options,o=i.hitRate,a=i.selectByClick,i=t.left,s=t.top,c=t.right,t=t.bottom,l=e.innerGroups,u=e.innerWidth,h=e.innerHeight,f=null==n?void 0:n.clientX,p=null==n?void 0:n.clientY,d=e.ignoreClick,v=[[i,s],[c,s],[c,t],[i,t]],g=G("".concat(o)),m=e.selectableTargets,y=e.selectablePoints,E=e.selectableInners;if(!l)return m.filter(function(t,e){return!!E[e]&&r(y[e],m[e])});for(var S=[],n=Math.floor(i/u),C=Math.floor(c/u),_=Math.floor(s/h),b=Math.floor(t/h),k=n;k<=C;++k){var D=l[k];if(D)for(var w=_;w<=b;++w){var M=D[w];M&&M.forEach(function(t){var e=y[t],n=E[t],t=m[t];n&&r(e)&&S.push(t)})}}var O=S;if("undefined"==typeof Map)return O.filter(function(t,e){return O.indexOf(t)===e});var T=new Map;return O.filter(function(t){return!T.has(t)&&(T.set(t,!0),!0)})},e.initDragScroll=function(){var c=this;this.dragScroll.on("scrollDrag",function(t){(0,t.next)(c.gesto.getCurrentEvent())}).on("scroll",function(t){var e=t.container,t=t.direction;c.gesto.getEventData().innerScrollOptions?c.emit("innerScroll",{container:e,direction:t}):c.emit("scroll",{container:e,direction:t})}).on("move",function(t){var e,n,r,i,o=t.offsetX,a=t.offsetY,t=t.inputEvent,s=c.gesto;s&&s.isFlag()&&(s=(e=c.gesto.getEventData()).boundArea,e.startX-=o,e.startY-=a,n=!1,(i=null==(i=c.gesto.getEventData().innerScrollOptions)?void 0:i.container)&&(i=(r=e.selectableInnerScrollParentMap).get(i))&&(i.paths.forEach(function(t){r.get(t).points.forEach(function(t){t[0]-=o,t[1]-=a})}),i.indexes.forEach(function(t){e.selectablePoints[t].forEach(function(t){t[0]-=o,t[1]-=a})}),n=!0),n||e.selectablePoints.forEach(function(t){t.forEach(function(t){t[0]-=o,t[1]-=a})}),c._refreshGroups(e),s.left-=o,s.right-=o,s.top-=a,s.bottom-=a,c.gesto.scrollBy(o,a,t.inputEvent),c._checkSelected(c.gesto.getCurrentEvent()))})},e._select=function(t,e,n,r){var i=n.inputEvent,o=n.data,t=this.setSelectedTargets(t);r&&this.emit("selectStart",m(m({},t),{rect:e,inputEvent:i,data:o.data,isTrusted:n.isTrusted})),(t.added.length||t.removed.length)&&this.emit("select",m(m({},t),{rect:e,inputEvent:i,data:o.data,isTrusted:n.isTrusted}))},e._selectEnd=function(t,e,n,r){var i=r.inputEvent,o=r.isDouble,a=r.data,s=M(t,this.selectedTargets),c=s.added,l=s.removed,u=s.prevList,h=s.list,s=M(e,this.selectedTargets),f=s.added,p=s.removed,d=s.prevList,v=s.list,s=i&&i.type,s="mousedown"===s||"touchstart"===s;this.emit("selectEnd",{startSelected:t,beforeSelected:e,selected:this.selectedTargets,added:c.map(function(t){return h[t]}),removed:l.map(function(t){return u[t]}),afterAdded:f.map(function(t){return v[t]}),afterRemoved:p.map(function(t){return d[t]}),isDragStart:s,isClick:!!r.isClick,isDouble:!!o,rect:n,inputEvent:i,data:a.data,isTrusted:r.isTrusted})},e._checkSelected=function(t,e){void 0===e&&(e=Zt(t,this.options.ratio));var n=t.data,r=e.top,i=e.left,o=e.width,a=e.height,s=n.selectFlag,c=n.containerX,l=n.containerY,u=n.scaleMatrix,i=Lt(u,[i-c,r-l]),c=Lt(u,[o,a]),r=[];s&&(this.target.style.cssText+="display: block;left:0px;top:0px;"+"transform: translate(".concat(i[0],"px, ").concat(i[1],"px);")+"width:".concat(c[0],"px;height:").concat(c[1],"px;"),l=this.hitTest(e,n,t),r=Ut(n.startPassedTargets,l,this.continueSelect&&this.continueSelectWithoutDeselect)),!1===this.emit("drag",m(m({},t),{data:n.data,isSelect:s,rect:e}))?(this.target.style.cssText+="display: none;",t.stop()):s&&this._select(r,e,t)},e._sameCombiKey=function(t,e,n){if(!e)return!1;var r,i=wt(t.inputEvent,t.key),e=[].concat(e),e=R(e[0])?e:[e];return n?(r=t.key,e.some(function(t){return t.some(function(t){return t===r})})):e.some(function(t){return t.every(function(t){return-1<i.indexOf(t)})})},e._findElement=function(t,e){for(var n=t;n&&!(-1<e.indexOf(n));)n=n.parentElement;return n},e._refreshGroups=function(t){var r,i,e,c,l=t.innerWidth,u=t.innerHeight,o=t.selectablePoints;this.options.checkOverflow&&(r=null==(e=this.gesto.getEventData().innerScrollOptions)?void 0:e.container,i=t.selectableInnerScrollParentMap,e=t.selectableInnerScrollPathsList,t.selectableInners=e.map(function(t,e){var n=!1;return t.every(function(t){if(!n){if(t===r)return n=!0;t=i.get(t);if(t)if(!Xt(o[e],t.points).length)return!1}return!0})})),l&&u?(e=t.selectablePoints,c={},e.forEach(function(t,e){var n=1/0,r=-1/0,i=1/0,o=-1/0;t.forEach(function(t){var e=Math.floor(t[0]/l),t=Math.floor(t[1]/u);n=Math.min(e,n),r=Math.max(e,r),i=Math.min(t,i),o=Math.max(t,o)});for(var a=n;a<=r;++a)for(var s=i;s<=o;++s)c[a]=c[a]||{},c[a][s]=c[a][s]||[],c[a][s].push(e)}),t.innerGroups=c):t.innerGroups=null},function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(o<3?i(a):3<o?i(e,n,a):i(e,n))||a);return 3<o&&a&&Object.defineProperty(e,n,a),a}([(r=ne,i=function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=H("get ".concat(e)),i=(t[r]?n.get=function(){return this[r]()}:n.get=function(){return this.options[e]},H("set ".concat(e)));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;r.forEach(function(t){i(e,t)})})],t)}(t)),ie={__proto__:null,default:re,OPTIONS:r,OPTION_TYPES:St,PROPERTIES:ne,EVENTS:["dragStart","drag","dragEnd","selectStart","select","selectEnd","keydown","keyup","scroll","innerScroll"],METHODS:["clickTarget","getSelectableElements","setSelectedTargets","getElementPoints","getSelectedTargets","findSelectableTargets","triggerDragStart","checkScroll","selectTargetsByPoints","setSelectedTargetsByPoints"],CLASS_NAME:ee};for(Qt in ie)re[Qt]=ie[Qt];return re});
!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 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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function K(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}X(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var y=function(){return(y=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 c(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||((r=r||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}var I="function",W="string",A=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],B=1e-7;function E(t){return t&&"object"==typeof t}function R(t){return Array.isArray(t)}function S(t){return typeof t===W}function L(t){return typeof t===I}function N(t,e,n,r,i){if(g(t,e,n))return n;for(var o,a=t,s=e,c=r,l=i,u=n+1;u<c;++u){var h=function(t){var e,n,r=s[t].trim();return r!==a.close||g(a,s,t)?(e=t,-1===(e=(n=C(l,function(t){return t.open===r}))?N(n,s,t,c,l):e)?(o=t,"break"):void(o=t=e)):{value:t}}(u);if(u=o,"object"==typeof h)return h.value;if("break"===h)break}return-1}function g(t,e,n){if(!t.ignore)return null;e=e.slice(Math.max(n-3,0),n+3).join("");return new RegExp(t.ignore).exec(e)}function q(t,e){var e=S(e)?{separator:e}:e,n=e.separator,o=void 0===n?",":n,a=e.isSeparateFirst,s=e.isSeparateOnlyOpenClose,n=e.isSeparateOpenClose,c=void 0===n?s:n,n=e.openCloseCharacters,l=void 0===n?A:n,e=l.map(function(t){var e=t.open,t=t.close;return e===t?e:e+"|"+t}).join("|"),n=new RegExp("(\\s*"+o+"\\s*|"+e+"|\\s+)","g"),u=t.split(n).filter(Boolean),h=u.length,f=[],p=[];function d(){return p.length&&(f.push(p.join("")),p=[])}for(var v,r=0;r<h;++r){var i=function(t){var e=u[t].trim(),n=t,r=C(l,function(t){return t.open===e}),i=C(l,function(t){return t.close===e});if(r){if(-1!==(n=N(r,u,t,h,l))&&c)return d()&&a?(v=t,"break"):(f.push(u.slice(t,n+1).join("")),t=n,a?(v=t,"break"):(v=t,"continue"))}else{if(i&&!g(i,u,t))throw new Error("invalid format: "+i.close);if(r=e,!((""!==(i=o)&&" "!=i||""!==r&&" "!=r)&&r!==i||s))return d(),a?(v=t,"break"):(v=t,"continue")}p.push(u.slice(t,(n=-1===n?h-1:n)+1).join("")),v=t=n}(r),r=v;if("break"===i)break}return p.length&&f.push(p.join("")),f}function l(t){return q(t,",")}function G(t){t=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!t)return{prefix:"",unit:"",value:NaN};var e=t[1],n=t[2];return{prefix:e,unit:t[3],value:parseFloat(n)}}function H(t){return t.replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()})}function m(){return Date.now?Date.now():(new Date).getTime()}function o(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}function C(t,e,n){e=o(t,e);return-1<e?t[e]:n}function Z(t,e,n){return Math.max(e,Math.min(t,n))}function U(t,r,i,e){return void 0===e&&(e=t[0]/t[1]),[[j(r[0],B),j(r[0]/e,B)],[j(r[1]*e,B),j(r[1],B)]].filter(function(t){return t.every(function(t,e){var e=r[e],n=j(e,B);return i?t<=e||t<=n:e<=t||n<=t})})[0]||t}function V(t,e){var n=e[0]-t[0],e=e[1]-t[1],t=Math.atan2(e,n);return 0<=t?t:t+2*Math.PI}function z(o){return[0,1].map(function(e){for(var t=o.map(function(t){return t[e]}),n=t.length,r=0,i=n-1;0<=i;--i)r+=t[i];return n?r/n:0})}function $(t){var e=z(t),n=V(e,t[0]),e=V(e,t[1]);return n<e&&e-n<Math.PI||e<n&&e-n<-Math.PI?1:-1}function h(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function j(t,e){if(!e)return t;var n=1/e;return Math.round(t/e)/n}function _(t,e,n,r){t.addEventListener(e,n,r)}function b(t,e,n,r){t.removeEventListener(e,n,r)}var J=function(){return(J=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)};var t=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(E(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(E(t))for(var n in t)this.off(n);else{var r,i;e?(r=this._events[t])&&-1<(i=o(r,function(t){return t.listener===e}))&&r.splice(i,1):this._events[t]=[]}else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this,t=(void 0===n&&(n={}),this._events[e]);if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return this.emit(t,e=void 0===e?{}:e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(J({listener:e},n))},t}(),Q=function(t,e){return(Q=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 k=function(){return(k=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 e(t){return 180*(e=[t[0].clientX,t[0].clientY],t=[t[1].clientX,t[1].clientY],n=t[0]-e[0],t=t[1]-e[1],(0<=(e=Math.atan2(t,n))?e:e+2*Math.PI)/Math.PI);var e,n}function D(t){if(!t)return[];if(t.touches){for(var e=t.touches,n=Math.min(e.length,2),r=[],i=0;i<n;++i)r.push(et(e[i]));return r}return[et(t)]}function tt(t,e,n){var r=n.length,t=u(t,r),i=t.clientX,o=t.clientY,a=t.originalClientX,t=t.originalClientY,e=u(e,r),s=e.clientX,e=e.clientY,n=u(n,r);return{clientX:a,clientY:t,deltaX:i-s,deltaY:o-e,distX:i-n.clientX,distY:o-n.clientY}}function n(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function et(t){return{clientX:t.clientX,clientY:t.clientY}}function u(t,e){void 0===e&&(e=t.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=0;r<e;++r){var i=t[r];n.originalClientX+="originalClientX"in i?i.originalClientX:i.clientX,n.originalClientY+="originalClientY"in i?i.originalClientY:i.clientY,n.clientX+=i.clientX,n.clientY+=i.clientY}return e?{clientX:n.clientX/e,clientY:n.clientY/e,originalClientX:n.originalClientX/e,originalClientY:n.originalClientY/e}:n}var w=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}return t.prototype.getAngle=function(t){return e(t=void 0===t?this.prevClients:t)},t.prototype.getRotation=function(t){return e(t=void 0===t?this.prevClients:t)-e(this.startClients)},t.prototype.getPosition=function(t,e){var n=tt((t=void 0===t?this.prevClients:t)||this.prevClients,this.prevClients,this.startClients),r=n.deltaX,i=n.deltaY;return this.movement+=Math.sqrt(r*r+i*i),this.prevClients=t,n},t.prototype.getPositions=function(n){void 0===n&&(n=this.prevClients);var r=this.prevClients;return this.startClients.map(function(t,e){return tt([n[e]],[r[e]],[t])})},t.prototype.getMovement=function(t){var e=this.movement;if(!t)return e;var t=u(t,this.length),n=u(this.prevClients,this.length),r=t.clientX-n.clientX,t=t.clientY-n.clientY;return Math.sqrt(r*r+t*t)+e},t.prototype.getDistance=function(t){return n(t=void 0===t?this.prevClients:t)},t.prototype.getScale=function(t){return n(t=void 0===t?this.prevClients:t)/n(this.startClients)},t.prototype.move=function(e,n){this.startClients.forEach(function(t){t.clientX-=e,t.clientY-=n}),this.prevClients.forEach(function(t){t.clientX-=e,t.clientY-=n})},t}(),nt=["textarea","input"],rt=function(o){function t(){this.constructor=e}var e,n;function r(t,e){void 0===e&&(e={});var n,v=o.call(this)||this,t=(v.options={},v.flag=!1,v.pinchFlag=!1,v.data={},v.isDrag=!1,v.isPinch=!1,v.isMouse=!1,v.isTouch=!1,v.clientStores=[],v.targets=[],v.prevTime=0,v.doubleFlag=!1,v._dragFlag=!1,v._isTrusted=!1,v._isMouseEvent=!1,v._isSecondaryButton=!1,v._preventMouseEvent=!1,v._prevInputEvent=null,v.onDragStart=function(t,e){if(void 0===e&&(e=!0),v.flag||!1!==t.cancelable){var n=v.options,r=n.container,i=n.pinchOutside,o=n.preventWheelClick,a=n.preventRightClick,s=n.preventDefault,c=n.checkInput,l=n.preventClickEventOnDragStart,u=n.preventClickEventOnDrag,n=n.preventClickEventByCondition,h=v.isTouch,f=!v.flag;if(v._isSecondaryButton=3===t.which||2===t.button,o&&(2===t.which||1===t.button)||a&&(3===t.which||2===t.button))return v.stop(),!1;if(f){o=document.activeElement,a=t.target;if(a){var p=a.tagName.toLowerCase(),p=-1<nt.indexOf(p),d=a.isContentEditable;if(p||d){if(c||o===a)return!1;if(o&&d&&o.isContentEditable&&o.contains(a))return!1}else(s||"touchstart"===t.type)&&o&&(p=o.tagName.toLowerCase(),(o.isContentEditable||-1<nt.indexOf(p))&&o.blur());(l||u||n)&&_(window,"click",v._onClick,!0)}v.clientStores=[new w(D(t))],v.flag=!0,v.isDrag=!1,v._isTrusted=e,v._dragFlag=!0,v._prevInputEvent=t,v.data={},v.doubleFlag=m()-v.prevTime<200,v._isMouseEvent=(c=t)&&(-1<c.type.indexOf("mouse")||"button"in c),!v._isMouseEvent&&v._preventMouseEvent&&(v._preventMouseEvent=!1),!1===(v._preventMouseEvent||v.emit("dragStart",k(k({data:v.data,datas:v.data,inputEvent:t,isMouseEvent:v._isMouseEvent,isSecondaryButton:v._isSecondaryButton,isTrusted:e,isDouble:v.doubleFlag},v.getCurrentStore().getPosition()),{preventDefault:function(){t.preventDefault()},preventDrag:function(){v._dragFlag=!1}})))&&v.stop(),v._isMouseEvent&&v.flag&&s&&t.preventDefault()}if(!v.flag)return!1;d=0;f?(v._attchDragEvent(),h&&i&&(d=setTimeout(function(){_(r,"touchstart",v.onDragStart,{passive:!1})}))):h&&i&&b(r,"touchstart",v.onDragStart),v.flag&&((a=t).touches&&2<=a.touches.length)&&(clearTimeout(d),f&&t.touches.length!==t.changedTouches.length||v.pinchFlag||v.onPinchStart(t))}},v.onDrag=function(t,e){if(v.flag){var n=v.options.preventDefault,n=(!v._isMouseEvent&&n&&t.preventDefault(),D(v._prevInputEvent=t)),r=v.moveClients(n,t,!1);if(v._dragFlag){if(v.pinchFlag||r.deltaX||r.deltaY)if(!1===(v._preventMouseEvent||v.emit("drag",k(k({},r),{isScroll:!!e,inputEvent:t}))))return void v.stop();v.pinchFlag&&v.onPinch(t,n)}v.getCurrentStore().getPosition(n,!0)}},v.onDragEnd=function(t){var e,n,r,i,o,a;v.flag&&(a=(r=v.options).pinchOutside,e=r.container,o=r.preventClickEventOnDrag,i=r.preventClickEventOnDragStart,r=r.preventClickEventByCondition,n=v.isDrag,(o||i||r)&&requestAnimationFrame(function(){v._allowClickEvent()}),r||i||!o||n||v._allowClickEvent(),v.isTouch&&a&&b(e,"touchstart",v.onDragStart),v.pinchFlag&&v.onPinchEnd(t),0!==(r=null!=t&&t.touches?D(t):[]).length&&v.options.keepDragging?v._addStore(new w(r)):v.flag=!1,i=v._getPosition(),o=m(),a=!n&&v.doubleFlag,v._prevInputEvent=null,v.prevTime=n||a?0:o,v.flag||(v._dettachDragEvent(),v._preventMouseEvent||v.emit("dragEnd",k({data:v.data,datas:v.data,isDouble:a,isDrag:n,isClick:!n,isMouseEvent:v._isMouseEvent,isSecondaryButton:v._isSecondaryButton,inputEvent:t,isTrusted:v._isTrusted},i)),v.clientStores=[],v._isMouseEvent||(v._preventMouseEvent=!0,requestAnimationFrame(function(){requestAnimationFrame(function(){v._preventMouseEvent=!1})}))))},v.onBlur=function(){v.onDragEnd()},v._allowClickEvent=function(){b(window,"click",v._onClick,!0)},v._onClick=function(t){v._allowClickEvent(),v._preventMouseEvent=!1;var e=v.options.preventClickEventByCondition;null!=e&&e(t)||(t.stopPropagation(),t.preventDefault())},v._onContextMenu=function(t){v.options.preventRightClick?v.onDragEnd(t):t.preventDefault()},v._passCallback=function(){},[].concat(t)),e=(v.options=k({checkInput:!1,container:1<t.length?window:t[0],preventRightClick:!0,preventWheelClick:!0,preventClickEventOnDragStart:!1,preventClickEventOnDrag:!1,preventClickEventByCondition:null,preventDefault:!0,checkWindowBlur:!1,keepDragging:!1,pinchThreshold:0,events:["touch","mouse"]},e),v.options),r=e.container,i=e.events,e=e.checkWindowBlur;return v.isTouch=-1<i.indexOf("touch"),v.isMouse=-1<i.indexOf("mouse"),v.targets=t,v.isMouse&&(t.forEach(function(t){_(t,"mousedown",v.onDragStart),_(t,"mousemove",v._passCallback)}),_(r,"contextmenu",v._onContextMenu)),e&&_(window,"blur",v.onBlur),v.isTouch&&(n={passive:!1},t.forEach(function(t){_(t,"touchstart",v.onDragStart,n),_(t,"touchmove",v._passCallback,n)})),v}return Q(e=r,n=o),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t),r.prototype.stop=function(){this.isDrag=!1,this.data={},this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1,this._allowClickEvent(),this._dettachDragEvent()},r.prototype.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce(function(t,e){return t+e.movement},0)},r.prototype.isDragging=function(){return this.isDrag},r.prototype.isFlag=function(){return this.flag},r.prototype.isPinchFlag=function(){return this.pinchFlag},r.prototype.isDoubleFlag=function(){return this.doubleFlag},r.prototype.isPinching=function(){return this.isPinch},r.prototype.scrollBy=function(t,e,n,r){void 0===r&&(r=!0),this.flag&&(this.clientStores[0].move(t,e),r&&this.onDrag(n,!0))},r.prototype.move=function(t,e){var n=t[0],r=t[1],t=this.getCurrentStore().prevClients;return this.moveClients(t.map(function(t){var e=t.clientX,t=t.clientY;return{clientX:e+n,clientY:t+r,originalClientX:e,originalClientY:t}}),e,!0)},r.prototype.triggerDragStart=function(t){this.onDragStart(t,!1)},r.prototype.setEventData=function(t){var e,n=this.data;for(e in t)n[e]=t[e];return this},r.prototype.setEventDatas=function(t){return this.setEventData(t)},r.prototype.getCurrentEvent=function(t){return void 0===t&&(t=this._prevInputEvent),k(k({data:this.data,datas:this.data},this._getPosition()),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:t})},r.prototype.getEventData=function(){return this.data},r.prototype.getEventDatas=function(){return this.data},r.prototype.unset=function(){var e=this,t=this.targets,n=this.options.container;this.off(),b(window,"blur",this.onBlur),this.isMouse&&(t.forEach(function(t){b(t,"mousedown",e.onDragStart)}),b(n,"contextmenu",this._onContextMenu)),this.isTouch&&(t.forEach(function(t){b(t,"touchstart",e.onDragStart)}),b(n,"touchstart",this.onDragStart)),this._prevInputEvent=null,this._allowClickEvent(),this._dettachDragEvent()},r.prototype.onPinchStart=function(t){var e=this.options.pinchThreshold;this.isDrag&&this.getMovement()>e||(e=new w(D(t)),this.pinchFlag=!0,this._addStore(e),!1===this.emit("pinchStart",k(k({data:this.data,datas:this.data,angle:e.getAngle(),touches:this.getCurrentStore().getPositions()},e.getPosition()),{inputEvent:t,isTrusted:this._isTrusted}))&&(this.pinchFlag=!1))},r.prototype.onPinch=function(t,e){var n;!this.flag||!this.pinchFlag||e.length<2||(n=this.getCurrentStore(),this.isPinch=!0,this.emit("pinch",k(k({data:this.data,datas:this.data,movement:this.getMovement(e),angle:n.getAngle(e),rotation:n.getRotation(e),touches:n.getPositions(e),scale:n.getScale(e),distance:n.getDistance(e)},n.getPosition(e)),{inputEvent:t,isTrusted:this._isTrusted})))},r.prototype.onPinchEnd=function(t){var e,n;this.pinchFlag&&(e=this.isPinch,this.isPinch=!1,this.pinchFlag=!1,n=this.getCurrentStore(),this.emit("pinchEnd",k(k({data:this.data,datas:this.data,isPinch:e,touches:n.getPositions()},n.getPosition()),{inputEvent:t})))},r.prototype.getCurrentStore=function(){return this.clientStores[0]},r.prototype.moveClients=function(t,e,n){var n=this._getPosition(t,n),r=this.isDrag,i=((n.deltaX||n.deltaY)&&(this.isDrag=!0),!1);return!r&&this.isDrag&&(i=!0),k(k({data:this.data,datas:this.data},n),{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,isMouseEvent:this._isMouseEvent,isSecondaryButton:this._isSecondaryButton,inputEvent:e,isTrusted:this._isTrusted,isFirstDrag:i})},r.prototype._addStore=function(t){this.clientStores.splice(0,0,t)},r.prototype._getPosition=function(t,e){var t=this.getCurrentStore().getPosition(t,e),e=this.clientStores.slice(1).reduce(function(t,e){e=e.getPosition();return t.distX+=e.distX,t.distY+=e.distY,t},t),n=e.distX,e=e.distY;return k(k({},t),{distX:n,distY:e})},r.prototype._attchDragEvent=function(){var t=this.options.container,e={passive:!1};this.isMouse&&(_(t,"mousemove",this.onDrag),_(t,"mouseup",this.onDragEnd)),this.isTouch&&(_(t,"touchmove",this.onDrag,e),_(t,"touchend",this.onDragEnd,e),_(t,"touchcancel",this.onDragEnd,e))},r.prototype._dettachDragEvent=function(){var t=this.options.container;this.isMouse&&(b(t,"mousemove",this.onDrag),b(t,"mouseup",this.onDragEnd)),this.isTouch&&(b(t,"touchstart",this.onDragStart),b(t,"touchmove",this.onDrag),b(t,"touchend",this.onDragEnd),b(t,"touchcancel",this.onDragEnd))},r}(t);var it=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,r=this.values,i=n.indexOf(t),i=-1===i?n.length:i;n[i]=t,r[i]=e},t}(),ot=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}(),at="function"==typeof Map,st=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 ct=function(){function t(t,e,n,r,i,o,a,s){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=a,this.fixed=s}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(){t=this.changedBeforeAdded,n=this.fixed,i=[],o=[],t.forEach(function(t){var e=t[0],t=t[1],n=new st;i[e]=n,o[t]=n}),i.forEach(function(t,e){t.connect(i[e-1])});var n,i,o,t=t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],t=t[1];if(n===t)return[0,0];var n=i[n],t=o[t-1],r=n.getIndex();return n.disconnect(),t?n.connect(t,t.next):n.connect(void 0,i[0]),[r,n.getIndex()]}),a=this.changed,s=[];this.cacheOrdered=t.filter(function(t,e){var n=t[0],t=t[1],e=a[e],r=e[0],e=e[1];if(n!==t)return s.push([r,e]),!0}),this.cachePureChanged=s},t}();var lt,ut="function"==typeof Map?void 0:(lt=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++lt)});function M(t,e){return t=t,e=e,n=ut,r=at?Map:n?ot:it,n=n||function(t){return t},i=[],o=[],a=[],s=t.map(n),n=e.map(n),c=new r,l=new r,u=[],h=[],f={},p=[],v=d=0,s.forEach(function(t,e){c.set(t,e)}),n.forEach(function(t,e){l.set(t,e)}),s.forEach(function(t,e){t=l.get(t);void 0===t?(++v,o.push(e)):f[t]=v}),n.forEach(function(t,e){t=c.get(t);void 0===t?(i.push(e),++d):(a.push([t,e]),v=f[e]||0,u.push([t-v,e-d]),h.push(e===t),t!==e&&p.push([t,e]))}),o.reverse(),new ct(t,e,i,o,p,a,u,h);var n,r,i,o,a,s,c,l,u,h,f,p,d,v}var ht=function(t,e){return(ht=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 f=function(){return(f=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 ft(t){t=t.container;return t===document.body?[t.scrollLeft||document.documentElement.scrollLeft,t.scrollTop||document.documentElement.scrollTop]:[t.scrollLeft,t.scrollTop]}function pt(t,e){return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}function p(t){return t?S(t)?document.querySelector(t):L(t)?t():t instanceof Element?t:"current"in t?t.current:"value"in t?t.value:void 0:null}var dt=function(t){function e(){this.constructor=n}var n;function r(){var n=null!==t&&t.apply(this,arguments)||this;return n._startRect=null,n._startPos=[],n._prevTime=0,n._timer=0,n._prevScrollPos=[0,0],n._isWait=!1,n._flag=!1,n._currentOptions=null,n._lock=!1,n._unregister=null,n._onScroll=function(){var e=n._currentOptions;!n._lock&&e&&n.emit("scrollDrag",{next:function(t){n.checkScroll({container:e.container,inputEvent:t})}})},n}ht(n=r,i=t),n.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e);var i=r.prototype;return i.dragStart=function(t,e){var n,r,i,o,a=p(e.container);a?(o=i=r=n=0,o=a===document.body?(i=window.innerWidth,window.innerHeight):(n=(a=a.getBoundingClientRect()).top,r=a.left,i=a.width,a.height),this._flag=!0,this._startPos=[t.clientX,t.clientY],this._startRect={top:n,left:r,width:i,height:o},this._prevScrollPos=this._getScrollPosition([0,0],e),this._currentOptions=e,this._registerScrollEvent(e)):this._flag=!1},i.drag=function(t,e){var n,r,i,o,a,s;if(clearTimeout(this._timer),this._flag)return n=t.clientX,r=t.clientY,i=e.threshold,i=void 0===i?0:i,o=this._startRect,a=this._startPos,this._currentOptions=e,s=[0,0],o.top>r-i?(a[1]>o.top||r<a[1])&&(s[1]=-1):o.top+o.height<r+i&&(a[1]<o.top+o.height||r>a[1])&&(s[1]=1),o.left>n-i?(a[0]>o.left||n<a[0])&&(s[0]=-1):o.left+o.width<n+i&&(a[0]<o.left+o.width||n>a[0])&&(s[0]=1),!(!s[0]&&!s[1])&&this._continueDrag(f(f({},e),{direction:s,inputEvent:t,isDrag:!0}))},i.checkScroll=function(t){var e=this;if(this._isWait)return!1;var n=t.prevScrollPos,n=void 0===n?this._prevScrollPos:n,r=t.direction,i=t.throttleTime,i=void 0===i?0:i,o=t.inputEvent,a=t.isDrag,s=this._getScrollPosition(r||[0,0],t),c=s[0]-n[0],n=s[1]-n[1],r=r||[c?Math.abs(c)/c:0,n?Math.abs(n)/n:0];return this._prevScrollPos=s,this._lock=!1,!(!c&&!n)&&(this.emit("move",{offsetX:r[0]?c:0,offsetY:r[1]?n:0,inputEvent:o}),i&&a&&(clearTimeout(this._timer),this._timer=window.setTimeout(function(){e._continueDrag(t)},i)),!0)},i.dragEnd=function(){this._flag=!1,this._lock=!1,clearTimeout(this._timer),this._unregisterScrollEvent()},i._getScrollPosition=function(t,e){var n=e.container,e=e.getScrollPosition;return(void 0===e?ft:e)({container:p(n),direction:t})},i._continueDrag=function(t){var e=this,n=t.container,r=t.direction,i=t.throttleTime,o=t.useScroll,a=t.isDrag,s=t.inputEvent;if(!(!this._flag||a&&this._isWait)){var c=m(),i=Math.max(i+this._prevTime-c,0);if(0<i)return clearTimeout(this._timer),this._timer=window.setTimeout(function(){e._continueDrag(t)},i),!1;this._prevTime=c;i=this._getScrollPosition(r,t),c=(this._prevScrollPos=i,a&&(this._isWait=!0),o||(this._lock=!0),{container:p(n),direction:r,inputEvent:s});return null!=(a=t.requestScroll)&&a.call(t,c),this.emit("scroll",c),this._isWait=!1,o||this.checkScroll(f(f({},t),{prevScrollPos:i,direction:r,inputEvent:s}))}},i._registerScrollEvent=function(t){this._unregisterScrollEvent();var e,n=t.checkScrollEvent;n&&(e=!0===n?pt:n,t=p(t.container),!0!==n||t!==document.body&&t!==document.documentElement?this._unregister=e(t,this._onScroll):this._unregister=pt(window,this._onScroll))},i._unregisterScrollEvent=function(){var t;null!=(t=this._unregister)&&t.call(this),this._unregister=null},r}(t),vt=function(t,e){return(vt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function gt(t){return t&&"object"==typeof t}function mt(t){return Array.isArray(t)}function yt(t){return"string"==typeof t}function a(t,e,n,r){t.addEventListener(e,n,r)}function s(t,e,n,r){t.removeEventListener(e,n,r)}var Et=function(){return(Et=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)};var St=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(gt(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(gt(t))for(var n in t)this.off(n);else{var r,i;e?(r=this._events[t])&&-1<(i=function(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}(r,function(t){return t.listener===e}))&&r.splice(i,1):this._events[t]=[]}else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this,t=(void 0===n&&(n={}),this._events[e]);if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return this.emit(t,e=void 0===e?{}:e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Et({listener:e},n))},t}();(function(t,e){function n(t){if(!t||"object"!=typeof t||(e=t.which||t.keyCode||t.charCode)&&(t=e),"number"==typeof t)return s[t];var e=String(t),t=r[e.toLowerCase()];return t||((t=i[e.toLowerCase()])?t:1===e.length?e.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){t=t.which||t.keyCode||t.charCode;if(null!=t)if("string"==typeof e){var n=r[e.toLowerCase()];if(n)return n===t;if(n=i[e.toLowerCase()])return n===t}else if("number"==typeof e)return e===t;return!1}};for(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},i=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},o=97;o<123;o++)r[String.fromCharCode(o)]=o-32;for(var o=48;o<58;o++)r[o-48]=o;for(o=1;o<13;o++)r["f"+o]=o+111;for(o=0;o<10;o++)r["numpad "+o]=o+96;var a,s=e.names=e.title={};for(o in r)s[r[o]]=o;for(a in i)r[a]=i[a]})(r={exports:{}},r.exports);var Ct,r=r.exports,_t=(r.code,r.codes,r.aliases,r.names),bt=(r.title,{"+":"plus","left command":"meta","right command":"meta"}),kt={shift:1,ctrl:2,alt:3,meta:4};function Dt(t,e){var n,r=(_t[t]||e||"").toLowerCase();for(n in bt)r=r.replace(n,bt[n]);return r.replace(/\s/g,"")}function wt(t,e){void 0===e&&(e=Dt(t.keyCode,t.key));t=[t.shiftKey&&"shift",t.ctrlKey&&"ctrl",t.altKey&&"alt",t.metaKey&&"meta"].filter(Boolean);return-1===t.indexOf(e)&&t.push(e),t.filter(Boolean)}function Mt(t){t=t.slice();return t.sort(function(t,e){return(kt[t]||5)-(kt[e]||5)}),t}var Ot=function(n){var t=i,e=n;if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}function i(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")},a(t,"blur",e.blur),a(t,"keydown",e.keydownEvent),a(t,"keyup",e.keyupEvent),e}vt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);e=i.prototype;return Object.defineProperty(i,"global",{get:function(){return Ct=Ct||new i},enumerable:!1,configurable:!0}),i.setGlobal=function(){return this.global},e.destroy=function(){var t=this.container;this.clear(),this.off(),s(t,"blur",this.blur),s(t,"keydown",this.keydownEvent),s(t,"keyup",this.keyupEvent)},e.keydown=function(t,e){return this.addEvent("keydown",t,e)},e.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},e.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},e.keyup=function(t,e){return this.addEvent("keyup",t,e)},e.addEvent=function(t,e,n){return mt(e)?this.on(t+"."+Mt(e).join("."),n):yt(e)?this.on(t+"."+e,n):this.on(t,e),this},e.removeEvent=function(t,e,n){return mt(e)?this.off(t+"."+Mt(e).join("."),n):yt(e)?this.off(t+"."+e,n):this.off(t,e),this},e.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=Dt(e.keyCode,e.key),r={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},e=(this.trigger(t,r),this.trigger(t+"."+n,r),wt(e,n));1<e.length&&this.trigger(t+"."+e.join("."),r)},i}(St);function d(t){return j(t,B)}function P(n){return n.length<3?0:Math.abs(function(t){for(var e=0,n=t.length-1;0<=n;--n)e+=t[n];return e}(n.map(function(t,e){e=n[e+1]||n[0];return t[0]*e[1]-e[0]*t[1]})))/2}function Tt(t){var e=t.map(function(t){return t[0]}),t=t.map(function(t){return t[1]});return{minX:Math.min.apply(Math,e),minY:Math.min.apply(Math,t),maxX:Math.max.apply(Math,e),maxY:Math.max.apply(Math,t)}}function x(i,t,e){var r=i[0],o=i[1],n=Tt(t),a=n.minX,n=n.maxX,s=[[a,o],[n,o]],c=v(s[0],s[1]),a=O(t),l=[];if(a.forEach(function(t){var n,e=v(t[0],t[1]),r=t[0];n=e,c.every(function(t,e){return 0===d(t-n[e])})?l.push({pos:i,line:t,type:"line"}):xt(Pt(c,e),[s,t]).forEach(function(n){t.some(function(t){return e=n,!d((t=t)[0]-e[0])&&!d(t[1]-e[1]);var e})?l.push({pos:n,line:t,type:"point"}):0!==d(r[1]-o)&&l.push({pos:n,line:t,type:"intersection"})})}),!e&&C(l,function(t){return t[0]===r}))return!0;var u=0,h={};return l.forEach(function(t){var e=t.pos,n=t.type,t=t.line;e[0]>r||("intersection"===n?++u:"line"!==n&&"point"===n&&(n=C(t,function(t){return t[1]!==o}),t=h[e[0]],n=n[1]>o?1:-1,t?t!==n&&++u:h[e[0]]=n))}),u%2==1}function v(t,e){var n=t[0],t=t[1],r=e[0]-n,e=e[1]-t,i=(Math.abs(r)<B&&(r=0),Math.abs(e)<B&&(e=0),0),o=0,a=0;return r?a=e?(o=1,-(i=-e/r)*n-t):(o=1,-t):e&&(i=-1,a=n),[i,o,a]}function Pt(t,e){var n,r,i=t[0],o=t[1],t=t[2],a=e[0],s=e[1],e=e[2],c=0===i&&0===a,l=0===o&&0===s;return c&&l?[]:c?(c=-t/o)!=-e/s?[]:[[-1/0,c],[1/0,c]]:l?(c=-t/i)!=-e/a?[]:[[c,-1/0],[c,1/0]]:(0===i?[[n=-(s*(r=-t/o)+e)/a,r]]:0===a?[[n=-(o*(r=-e/s)+t)/i,r]]:0===o?[[n=-t/i,r=-(a*n+e)/s]]:0===s?[[n=-e/a,r=-(i*n+t)/o]]:[[n=(o*e-s*t)/(s*i-o*a),r=-(i*n+t)/o]]).map(function(t){return[t[0],t[1]]})}function xt(t,e){var r=e.map(function(e){return[0,1].map(function(t){return[Math.min(e[0][t],e[1][t]),Math.max(e[0][t],e[1][t])]})}),e=[];if(2===t.length){var n=t[0],i=n[0],n=n[1];if(d(i-t[1][0])){if(!d(n-t[1][1])){var o=Math.max.apply(Math,r.map(function(t){return t[0][0]})),a=Math.min.apply(Math,r.map(function(t){return t[0][1]}));if(0<d(o-a))return[];e=[[o,n],[a,n]]}}else{o=Math.max.apply(Math,r.map(function(t){return t[1][0]})),a=Math.min.apply(Math,r.map(function(t){return t[1][1]}));if(0<d(o-a))return[];e=[[i,o],[i,a]]}}return(e=e.length?e:t.filter(function(t){var e=t[0],n=t[1];return r.every(function(t){return 0<=d(e-t[0][0])&&0<=d(t[0][1]-e)&&0<=d(n-t[1][0])&&0<=d(t[1][1]-n)})})).map(function(t){return[d(t[0]),d(t[1])]})}function O(n){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(n.slice(1),[n[0]]).map(function(t,e){return[n[e],t]})}function Ft(t,e){var i,a,s,c,l,u,n;return e=e,i=(t=t).slice(),a=e.slice(),-1===$(i)&&i.reverse(),-1===$(a)&&a.reverse(),s=O(i),c=O(a),t=s.map(function(t){return v(t[0],t[1])}),l=c.map(function(t){return v(t[0],t[1])}),u=[],t.forEach(function(n,r){var i=s[r],o=[];l.forEach(function(t,e){t=xt(Pt(n,t),[i,c[e]]);o.push.apply(o,t.map(function(t){return{index1:r,index2:e,pos:t,type:"intersection"}}))}),o.sort(function(t,e){return h(i[0],t.pos)-h(i[0],e.pos)}),u.push.apply(u,o),x(i[1],a)&&u.push({index1:r,index2:-1,pos:i[1],type:"inside"})}),c.forEach(function(t,n){var r,e;x(t[1],i)&&(r=!1,-1===(e=o(u,function(t){if(t.index2!==n)return!!r;r=!0}))&&(r=!1,e=o(u,function(t){var e=t.index1,t=t.index2;if(-1!==e||t+1!==n)return!!r;r=!0})),-1===e?u.push({index1:-1,index2:n,pos:t[1],type:"inside"}):u.splice(e,0,{index1:-1,index2:n,pos:t[1],type:"inside"}))}),n={},u.filter(function(t){t=t.pos,t=t[0]+"x"+t[1];return!n[t]&&(n[t]=!0)}).map(function(t){return t.pos})}function i(t,e,n){void 0===n&&(n=Math.sqrt(t.length));var r=[],i=t.length/n,o=e.length/i;if(!i)return e;if(!o)return t;for(var a=0;a<n;++a)for(var s=0;s<o;++s)for(var c=r[s*n+a]=0;c<i;++c)r[s*n+a]+=t[c*n+a]*e[s*i+c];return r}function Yt(t,e){return i(t,[1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1],4)}function Xt(t,e){return i(t,[Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1],4)}function Bt(t,e){return i(t,(t=e,e=4,n=Math.cos(t),t=Math.sin(t),(r=It(e))[0]=n,r[1]=t,r[e]=-t,r[e+1]=n,r));var n,r}function T(t,e){var n=e[0],r=e[1],e=e[2];return i(t,[void 0===n?1:n,0,0,0,0,void 0===r?1:r,0,0,0,0,void 0===e?1:e,0,0,0,0,1],4)}function jt(t,e){var n=e[0],r=e[1],e=e[2];return i(t,[1,0,0,0,0,1,0,0,0,0,1,0,void 0===n?0:n,void 0===r?0:r,void 0===e?0:e,1],4)}function Kt(t,e){return i(t,e,4)}function It(t){for(var e=t*t,n=[],r=0;r<e;++r)n[r]=r%(t+1)?0:1;return n}function Wt(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function At(t){return t=(R(t=t)?t:function(t){return q(t,"")}(t)).map(function(t){var e,n,r,t=!(t=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t=t))||t.length<4?{}:{prefix:t[1],value:t[2],suffix:t[3]},i=t.prefix,t=t.value,o=null,a=i,s="";return"translate"===i||"translateX"===i||"translate3d"===i?(o=jt,s=[(r=l(t).map(function(t){return parseFloat(t)}))[0],void 0===(e=r[1])?0:e,void 0===(e=r[2])?0:e]):"translateY"===i?(o=jt,s=[0,parseFloat(t),0]):"translateZ"===i?(o=jt,s=[0,0,parseFloat(t)]):"scale"===i||"scale3d"===i?(o=T,s=[n=(r=l(t).map(function(t){return parseFloat(t)}))[0],void 0===(e=r[1])?n:e,void 0===(e=r[2])?1:e]):"scaleX"===i?(o=T,s=[n=parseFloat(t),1,1]):"scaleY"===i?(o=T,s=[1,parseFloat(t),1]):"scaleZ"===i?(o=T,s=[1,1,parseFloat(t)]):"rotate"===i||"rotateZ"===i||"rotateX"===i||"rotateY"===i?(e=(r=G(t)).unit,n=r.value,"rotate"===i||"rotateZ"===i?(a="rotateZ",o=Bt):"rotateX"===i?o=Yt:"rotateY"===i&&(o=Xt),s="rad"===e?n:n*Math.PI/180):"matrix3d"===i?(o=Kt,s=l(t).map(function(t){return parseFloat(t)})):"matrix"===i?(o=Kt,s=[(r=l(t).map(function(t){return parseFloat(t)}))[0],r[1],0,0,r[2],r[3],0,0,0,0,1,0,r[4],r[5],0,1]):a="",{name:i,functionName:a,value:t,matrixFunction:o,functionValue:s}}),n=Wt(),t.forEach(function(t){var e=t.matrixFunction,t=t.functionValue;e&&(n=e(n,t))}),n;var n}function Rt(t,e){n=t,e=[e[0],e[1]||0,e[2]||0,1],r=(n=i(t,e,t=void 0===(t=4)?e.length:t))[t-1];var n,r,e=n.map(function(t){return t/r}),t=e[3]||1;return[e[0]/t,e[1]/t,e[2]/t]}function Lt(t,e){void 0===e&&(e=document.body);for(var n=t,r=Wt();n;){r=Kt(At(getComputedStyle(n).transform),r);if(n===e)break;n=n.parentElement}return(r=function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=t.slice(),r=It(e),i=0;i<e;++i){var o=e*i+i;if(!j(n[o],B))for(var a=i+1;a<e;++a)if(n[e*i+a]){g=v=d=p=f=h=u=l=c=s=void 0;for(var s=n,c=r,l=i,u=a,h=e,f=0;f<h;++f){var p=l+f*h,d=u+f*h,v=s[p],g=c[p];s[p]=s[d],s[d]=v,c[p]=c[d],c[d]=g}break}if(!j(n[o],B))return[];b=_=C=S=E=y=m=void 0;for(var m=n,y=r,E=i,S=e,C=n[o],_=0;_<S;++_){var b=E+_*S;m[b]/=C,y[b]/=C}for(a=0;a<e;++a){var k=a,D=n[a+i*e];if(j(D,B)&&i!==a){X=Y=F=x=P=T=O=M=w=void 0;for(var w=n,M=r,O=k,T=i,P=e,x=-D,F=0;F<P;++F){var Y=O+F*P,X=T+F*P;w[Y]+=w[X]*x,M[Y]+=M[X]*x}}}}return r}(r,4))[12]=0,r[13]=0,r[14]=0,r}function Nt(t,e,n){var r=t.tag,i=t.children,o=t.attributes,a=t.className,s=t.style,c=e||document.createElement(r);for(u in o)c.setAttribute(u,o[u]);var l=c.children;if(i.forEach(function(t,e){Nt(t,l[e],c)}),a&&a.split(" ").forEach(function(t){var e,n;n=t,((e=c).classList?e.classList.contains(n):e.className.match(new RegExp("(\\s|^)"+n+"(\\s|$)")))||(e=t,(n=c).classList?n.classList.add(e):n.className+=" "+e)}),s){var u,h=c.style;for(u in s)h[u]=s[u]}return!e&&n&&n.appendChild(c),c}function qt(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var e=e||{},i=e.className,o=e.style;return{tag:t,className:void 0===i?"":i,style:void 0===o?{}:o,attributes:function(t,e){var n={};for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,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}(e,["className","style"]),children:n}}function Gt(t,e,n){t!==e&&n(t,e)}function Ht(t,e,n){void 0===n&&(n=t.data.boundArea);var r=t.distX,r=void 0===r?0:r,i=t.distY,i=void 0===i?0:i,t=t.data,o=t.startX,t=t.startY;0<e&&(r=(0<=r?1:-1)*(e*(a=Math.sqrt((r*r+i*i)/(1+e*e)))),i=(0<=i?1:-1)*a),r=(0<=r?1:-1)*(n=(a=function(t,n,r,e){if(!e)return t.map(function(t,e){return Z(t,n[e],r[e])});var i=t[0],o=t[1],a=(s=U(t,n,!1,e=!0===e?i/o:e))[0],s=s[1],e=(t=U(t,r,!0,e))[0],t=t[1];return i<a||o<s?(i=a,o=s):(e<i||t<o)&&(i=e,o=t),[i,o]}([Math.abs(r),Math.abs(i)],[0,0],[r<0?o-n.left:n.right-o,i<0?t-n.top:n.bottom-t],!!e))[0]),i=(0<=i?1:-1)*(e=a[1]);var a=o+Math.min(0,r),o=t+Math.min(0,i);return{left:a,top:o,right:a+n,bottom:o+e,width:n,height:e}}function F(t){var t=t.getBoundingClientRect(),e=t.left,n=t.top,r=t.width,t=t.height;return{pos1:[e,n],pos2:[e+r,n],pos3:[e,n+t],pos4:[e+r,n+t]}}function Zt(t,e,n){var t=M(t,e),r=t.list,i=t.prevList,e=t.added,o=t.removed,t=t.maintained;return c(c(c([],e.map(function(t){return r[t]}),!0),o.map(function(t){return i[t]}),!0),n?t.map(function(t){t=t[1];return r[t]}):[],!0)}function Ut(t){for(var e=0,n=t.length,r=1;r<n;++r)e=Math.max(h(t[r],t[r-1]),e);return e}function Y(t){return t.ownerDocument||document}function Vt(t,e,n,r,i){var o,a=document.createElement("style"),e=(a.setAttribute("type","text/css"),a.setAttribute("data-styled-id",t),a.setAttribute("data-styled-count","1"),n.nonce&&a.setAttribute("nonce",n.nonce),a.innerHTML=(o=t,t=e,n.original?t:t.replace(/([^};{\s}][^};{]*|^\s*){/gm,function(t,e){e=e.trim();return(e?l(e):[""]).map(function(t){t=t.trim();return 0===t.indexOf("@")?t:-1<t.indexOf(":global")?t.replace(/\:global/g,""):-1<t.indexOf(":host")?"".concat(t.replace(/\:host/g,".".concat(o))):t?".".concat(o," ").concat(t):".".concat(o)}).join(", ")+" {"})),r.ownerDocument||document);return(i||e.head||e.body).appendChild(a),a}var zt,$t,Jt,Qt={className:$t="rCS"+function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0}(zt="\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n pointer-events: none;\n will-change: transform;\n z-index: 100;\n}\n").toString(36),inject:function(t,e){void 0===e&&(e={});var n,r=function(t){if(t&&t.getRootNode){t=t.getRootNode();if(11===t.nodeType)return t}}(t),i=(r||t.ownerDocument||document).querySelector('style[data-styled-id="'.concat($t,'"]'));return i?(n=parseFloat(i.getAttribute("data-styled-count"))||0,i.setAttribute("data-styled-count","".concat(n+1))):i=Vt($t,zt,e,t,r),{destroy:function(){var t,e=parseFloat(i.getAttribute("data-styled-count"))||0;e<=1?(i.remove?i.remove():null!=(t=i.parentNode)&&t.removeChild(i),i=null):i.setAttribute("data-styled-count","".concat(e-1))}}}},te="selecto-selection ".concat(Qt.className),ee=["boundContainer","selectableTargets","selectByClick","selectFromInside","continueSelect","continueSelectWithoutDeselect","toggleContinueSelect","toggleContinueSelectWithoutDeselect","keyContainer","hitRate","scrollOptions","checkInput","preventDefault","ratio","getElementRect","preventDragFromInside","rootContainer","dragCondition","clickBySelectEnd","checkOverflow","innerScrollOptions"],r=c(["dragContainer","cspNonce","preventClickEventOnDrag","preventClickEventOnDragStart","preventRightClick"],ee,!0),St={boundContainer:null,portalContainer:null,container:null,dragContainer:null,selectableTargets:Array,selectByClick:Boolean,selectFromInside:Boolean,continueSelect:Boolean,toggleContinueSelect:Array,toggleContinueSelectWithoutDeselect:Array,keyContainer:null,hitRate:Number,scrollOptions:Object,checkInput:Boolean,preventDefault:Boolean,cspNonce:String,ratio:Number,getElementRect:Function,preventDragFromInside:Boolean,rootContainer:Object,dragCondition:Function,clickBySelectEnd:Boolean,continueSelectWithoutDeselect:Boolean,preventClickEventOnDragStart:Boolean,preventClickEventOnDrag:Boolean,checkOverflow:Boolean,innerScrollOptions:Object},ne=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return K(e,t),e}(function(n){function t(t){void 0===t&&(t={});var m=n.call(this)||this,e=(m.selectedTargets=[],m.dragScroll=new dt,m._onDragStart=function(t,e){var n=t.data,r=t.clientX,i=t.clientY,o=t.inputEvent,a=m.options,s=a.selectFromInside,c=a.selectByClick,l=a.rootContainer,u=a.boundContainer,h=a.preventDragFromInside,h=void 0===h||h,f=a.clickBySelectEnd,a=a.dragCondition;if(!a||a(t)){n.data={},n.innerWidth=window.innerWidth,n.innerHeight=window.innerHeight,m.findSelectableTargets(n),n.startSelectedTargets=m.selectedTargets,n.scaleMatrix=Wt(),n.containerX=0,n.containerY=0;var p=m.container,a={left:-1/0,top:-1/0,right:1/0,bottom:1/0},d=(l&&(d=m.container.getBoundingClientRect(),n.containerX=d.left,n.containerY=d.top,n.scaleMatrix=Lt(m.container,l)),u&&((u=(d=E(u)&&"element"in u?y({left:!0,top:!0,bottom:!0,right:!0},u):{element:u,left:!0,top:!0,bottom:!0,right:!0}).element)&&(u=(S(u)?Y(p).querySelector(u):!0===u?m.container:u).getBoundingClientRect(),d.left&&(a.left=u.left),d.top&&(a.top=u.top),d.right&&(a.right=u.right),d.bottom&&(a.bottom=u.bottom))),n.boundArea=a,{left:r,top:i,right:r,bottom:i,width:0,height:0}),u=[],e=0<(u=s&&(!c||f)?u:(a=m._findElement(e||o.target,n.selectableTargets))?[a]:[]).length,a=!s&&e;if(a&&!c)return t.stop(),!1;s=o.type;if(!(!(!t.isClick&&("mousedown"===s||"touchstart"===s))||m.emit("dragStart",y(y({},t),{data:n.data}))))return t.stop(),!1;if(m.continueSelect?(u=Zt(m.selectedTargets,u,m.continueSelectWithoutDeselect),n.startPassedTargets=m.selectedTargets):n.startPassedTargets=[],m._select(u,d,t,!0),n.startX=r,n.startY=i,n.selectFlag=!1,n.preventDragFromInside=!1,o.target&&(e=Rt(n.scaleMatrix,[r-n.containerX,i-n.containerY]),m.target.style.cssText+="position: ".concat(l?"absolute":"fixed",";")+"left:0px;top:0px;"+"transform: translate(".concat(e[0],"px, ").concat(e[1],"px)")),a&&c&&!f)o.preventDefault(),h&&(m._selectEnd(n.startSelectedTargets,n.startPassedTargets,d,t),n.preventDragFromInside=!0);else{n.selectFlag=!0;s=m.options,u=s.scrollOptions,r=s.innerScrollOptions,i=!1;if(r){for(var v=null,g=t.inputEvent.target;g&&g!==Y(p).body;){if("visible"!==getComputedStyle(g).overflow){v=g;break}g=g.parentElement}v&&(n.innerScrollOptions=y({container:v,checkScrollEvent:!0},!0===r?{}:r),m.dragScroll.dragStart(t,n.innerScrollOptions),i=!0)}!i&&u&&u.container&&m.dragScroll.dragStart(t,u),f&&(n.selectFlag=!1,t.preventDrag())}return!0}t.stop()},m._onDrag=function(t){if(t.data.selectFlag){var e=m.scrollOptions,n=t.data.innerScrollOptions;if((n||(null==e?void 0:e.container))&&!t.isScroll&&m.dragScroll.drag(t,n||e))return}m._checkSelected(t)},m._onDragEnd=function(t){var e=t.data,n=t.inputEvent,r=Ht(t,m.options.ratio),i=e.selectFlag,o=m.container;n&&m.emit("dragEnd",y(y({isDouble:!!t.isDouble,isClick:!!t.isClick,isDrag:!1,isSelect:i},t),{data:e.data,rect:r})),m.target.style.cssText+="display: none;",i?(e.selectFlag=!1,m.dragScroll.dragEnd()):m.selectByClick&&m.clickBySelectEnd&&(i=m._findElement((null==n?void 0:n.target)||(i=o,n=t.clientX,o=t.clientY,(i=Y(i)).elementFromPoint&&i.elementFromPoint(n,o)||null),e.selectableTargets),m._select(i?[i]:[],r,t)),e.preventDragFromInside||m._selectEnd(e.startSelectedTargets,e.startPassedTargets,r,t)},m._onKeyDown=function(t){var e,n=m.options,r=!1;m._keydownContinueSelect||(e=m._sameCombiKey(t,n.toggleContinueSelect),m._keydownContinueSelect=e,r=r||e),m._keydownContinueSelectWithoutDeselection||(e=m._sameCombiKey(t,n.toggleContinueSelectWithoutDeselect),m._keydownContinueSelectWithoutDeselection=e,r=r||e),r&&m.emit("keydown",{keydownContinueSelect:m._keydownContinueSelect,keydownContinueSelectWithoutDeselection:m._keydownContinueSelectWithoutDeselection})},m._onKeyUp=function(t){var e,n=m.options,r=!1;m._keydownContinueSelect&&(e=m._sameCombiKey(t,n.toggleContinueSelect,!0),m._keydownContinueSelect=!e,r=r||e),m._keydownContinueSelectWithoutDeselection&&(e=m._sameCombiKey(t,n.toggleContinueSelectWithoutDeselect,!0),m._keydownContinueSelectWithoutDeselection=!e,r=r||e),r&&m.emit("keyup",{keydownContinueSelect:m._keydownContinueSelect,keydownContinueSelectWithoutDeselection:m._keydownContinueSelectWithoutDeselection})},m._onBlur=function(){(m._keydownContinueSelect||m._keydownContinueSelectWithoutDeselection)&&(m._keydownContinueSelect=!1,m._keydownContinueSelectWithoutDeselection=!1,m.emit("keyup",{keydownContinueSelect:m._keydownContinueSelect,keydownContinueSelectWithoutDeselection:m._keydownContinueSelectWithoutDeselection}))},m._onDocumentSelectStart=function(e){var t,n,r=Y(m.container);m.gesto.isFlag()&&(r=(t=(t=m.dragContainer)===window?r.documentElement:t)instanceof Element?[t]:[].slice.call(t),n=e.target,r.some(function(t){if(t===n||t.contains(n))return e.preventDefault(),!0}))},m.target=t.portalContainer,t.container),t=(m.options=y({portalContainer:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,clickBySelectEnd:!1,hitRate:100,continueSelect:!1,continueSelectWithoutDeselect:!1,toggleContinueSelect:null,toggleContinueSelectWithoutDeselect:null,keyContainer:null,scrollOptions:void 0,checkInput:!1,preventDefault:!1,boundContainer:!1,preventDragFromInside:!0,dragCondition:null,rootContainer:null,checkOverflow:!1,innerScrollOptions:!1,getElementRect:F,cspNonce:"",ratio:0},t),m.options.portalContainer);return t&&(e=t.parentElement),m.container=e||document.body,m.initElement(),m.initDragScroll(),m.setKeyController(),m}K(t,n);var r,i,e=t.prototype;return e.setSelectedTargets=function(t){var e=this.selectedTargets,n=M(e,t),r=n.added,i=n.removed,o=n.prevList,a=n.list;return this.selectedTargets=t,{added:r.map(function(t){return a[t]}),removed:i.map(function(t){return o[t]}),beforeSelected:e,selected:t}},e.setSelectedTargetsByPoints=function(t,e){var n=Math.min(t[0],e[0]),r=Math.min(t[1],e[1]),i=Math.max(t[0],e[0]),t=Math.max(t[1],e[1]),e={left:n,top:r,right:i,bottom:t,width:i-n,height:t-r},i={ignoreClick:!0},n=(this.findSelectableTargets(i),this.hitTest(e,i)),t=this.setSelectedTargets(n);return y(y({},t),{rect:e})},e.selectTargetsByPoints=function(t,e){var t=new MouseEvent("mousedown",{clientX:t[0],clientY:t[1],cancelable:!0,bubbles:!0}),n=new MouseEvent("mousemove",{clientX:e[0],clientY:e[1],cancelable:!0,bubbles:!0}),e=new MouseEvent("mousemove",{clientX:e[0],clientY:e[1],cancelable:!0,bubbles:!0}),r=this.gesto;!1!==r.onDragStart(t)&&(r.onDrag(n),r.onDragEnd(e))},e.getSelectedTargets=function(){return this.selectedTargets},e.triggerDragStart=function(t){return this.gesto.triggerDragStart(t),this},e.destroy=function(){var t;this.off(),this.keycon&&this.keycon.destroy(),this.gesto.unset(),this.injectResult.destroy(),this.dragScroll.dragEnd(),b(document,"selectstart",this._onDocumentSelectStart),this.options.portalContainer||null!=(t=this.target.parentElement)&&t.removeChild(this.target),this.keycon=null,this.gesto=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},e.getElementPoints=function(t){var e,n,r,i,o,a,s,c,l,u=this.getElementRect||F,h=u(t),h=[h.pos1,h.pos2,h.pos4,h.pos3];return u!==F?(u=t.getBoundingClientRect(),t=h,e=(u=u).width,n=u.height,r=u.left,i=u.top,o=(u=Tt(t)).minX,a=u.minY,s=u.maxX,u=u.maxY,c=e/(s-o),l=n/(u-a),t.map(function(t){return[r+(t[0]-o)*c,i+(t[1]-a)*l]})):h},e.getSelectableElements=function(){var n=this.container,r=[];return this.options.selectableTargets.forEach(function(t){var e;L(t)?(e=t())&&r.push.apply(r,[].slice.call(e)):t instanceof Node?r.push(t):E(t)?r.push(t.value||t.current):(e=[].slice.call(Y(n).querySelectorAll(t)),r.push.apply(r,e))}),r},e.checkScroll=function(){var t,e;this.gesto.isFlag()&&(t=this.scrollOptions,((e=this.gesto.getEventData().innerScrollOptions)||(null==t?void 0:t.container))&&this.dragScroll.checkScroll(y({inputEvent:this.gesto.getCurrentEvent()},e||t)))},e.findSelectableTargets=function(t){var a,e=this,n=(void 0===t&&(t=this.gesto.getEventData()),this.getSelectableElements()),r=n.map(function(t){return e.getElementPoints(t)}),r=(t.selectableTargets=n,t.selectablePoints=r,t.selectableParentMap=null,this.options),i=r.checkOverflow||r.innerScrollOptions,s=Y(this.container);return i&&(a=new Map,t.selectableInnerScrollParentMap=a,t.selectableInnerScrollPathsList=n.map(function(t,n){for(var r=t.parentElement,i=[],o=[];r&&r!==s.body;)!function(){var t,e=a.get(r);e||"visible"!==getComputedStyle(r).overflow&&(t=F(r),e={parentElement:r,indexes:[],points:[t.pos1,t.pos2,t.pos4,t.pos3],paths:c([],o,!0)},i.push(r),i.forEach(function(t){a.set(t,e)}),i=[]),e?(r=e.parentElement,a.get(r).indexes.push(n),o.push(r)):i.push(r),r=r.parentElement}();return o})),r.checkOverflow||(t.selectableInners=n.map(function(){return!0})),this._refreshGroups(t),n},e.clickTarget=function(t,e){var n="touches"in(r=t)?{clientX:(n=r.touches[0]||r.changedTouches[0]).clientX,clientY:n.clientY}:{clientX:r.clientX,clientY:r.clientY},r={data:{selectFlag:!1},clientX:n.clientX,clientY:n.clientY,inputEvent:t,isClick:!0,isTrusted:!1,stop:function(){return!1}};return this._onDragStart(r,e)&&this._onDragEnd(r),this},e.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect,t=t.toggleContinueSelectWithoutDeselect;this.keycon&&(this.keycon.destroy(),this.keycon=null),(n||t)&&(this.keycon=new Ot(e||window),this.keycon.keydown(this._onKeyDown).keyup(this._onKeyUp).on("blur",this._onBlur))},e.setKeyEvent=function(){var t=this.options,e=t.toggleContinueSelect,t=t.toggleContinueSelectWithoutDeselect;!e&&!t||this.keycon||this.setKeyController()},e.setKeyContainer=function(t){var e=this,n=this.options;Gt(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},e.getContinueSelect=function(){var t=this.options,e=t.continueSelect;return t.toggleContinueSelect&&this._keydownContinueSelect?!e:e},e.getContinueSelectWithoutDeselect=function(){var t=this.options,e=t.continueSelectWithoutDeselect;return t.toggleContinueSelectWithoutDeselect&&this._keydownContinueSelectWithoutDeselection?!e:e},e.setToggleContinueSelect=function(t){var e=this,n=this.options;Gt(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},e.setToggleContinueSelectWithoutDeselect=function(t){var e=this,n=this.options;Gt(n.toggleContinueSelectWithoutDeselect,t,function(){n.toggleContinueSelectWithoutDeselect=t,e.setKeyEvent()})},e.setPreventDefault=function(t){this.gesto.options.preventDefault=t},e.setCheckInput=function(t){this.gesto.options.checkInput=t},e.initElement=function(){var t=this.container,e=(this.target=Nt(qt("div",{className:te}),this.target,t),this.target),n=this.options,r=n.dragContainer,i=n.checkInput,o=n.preventDefault,a=n.preventClickEventOnDragStart,s=n.preventClickEventOnDrag,c=n.preventClickEventByCondition,n=n.preventRightClick,n=void 0===n||n;this.dragContainer="string"==typeof r?[].slice.call(Y(t).querySelectorAll(r)):r||this.target.parentNode,this.gesto=new rt(this.dragContainer,{checkWindowBlur:!0,container:window,checkInput:i,preventDefault:o,preventClickEventOnDragStart:a,preventClickEventOnDrag:s,preventClickEventByCondition:c,preventRightClick:n}).on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd}),_(document,"selectstart",this._onDocumentSelectStart),this.injectResult=Qt.inject(e,{nonce:this.options.cspNonce})},e.hitTest=function(t,e,n){function r(t,e){var n=!d&&x([f,p],t);if(a&&n)return!0;if(!(n=Ft(v,t)).length)return!1;var r=P(n),i=0;return 0===r&&0===P(t)?(i=Ut(t),r=Ut(n)):i=P(t),"px"===g.unit?r>=g.value:Z(Math.round(r/i*100),0,100)>=Math.min(100,g.value)}var i=this.options,o=i.hitRate,a=i.selectByClick,i=t.left,s=t.top,c=t.right,t=t.bottom,l=e.innerGroups,u=e.innerWidth,h=e.innerHeight,f=null==n?void 0:n.clientX,p=null==n?void 0:n.clientY,d=e.ignoreClick,v=[[i,s],[c,s],[c,t],[i,t]],g=G("".concat(o)),m=e.selectableTargets,y=e.selectablePoints,E=e.selectableInners;if(!l)return m.filter(function(t,e){return!!E[e]&&r(y[e],m[e])});for(var S=[],n=Math.floor(i/u),C=Math.floor(c/u),_=Math.floor(s/h),b=Math.floor(t/h),k=n;k<=C;++k){var D=l[k];if(D)for(var w=_;w<=b;++w){var M=D[w];M&&M.forEach(function(t){var e=y[t],n=E[t],t=m[t];n&&r(e)&&S.push(t)})}}var O=S;if("undefined"==typeof Map)return O.filter(function(t,e){return O.indexOf(t)===e});var T=new Map;return O.filter(function(t){return!T.has(t)&&(T.set(t,!0),!0)})},e.initDragScroll=function(){var c=this;this.dragScroll.on("scrollDrag",function(t){(0,t.next)(c.gesto.getCurrentEvent())}).on("scroll",function(t){var e=t.container,t=t.direction;c.gesto.getEventData().innerScrollOptions?c.emit("innerScroll",{container:e,direction:t}):c.emit("scroll",{container:e,direction:t})}).on("move",function(t){var e,n,r,i,o=t.offsetX,a=t.offsetY,t=t.inputEvent,s=c.gesto;s&&s.isFlag()&&(s=(e=c.gesto.getEventData()).boundArea,e.startX-=o,e.startY-=a,n=!1,(i=null==(i=c.gesto.getEventData().innerScrollOptions)?void 0:i.container)&&(i=(r=e.selectableInnerScrollParentMap).get(i))&&(i.paths.forEach(function(t){r.get(t).points.forEach(function(t){t[0]-=o,t[1]-=a})}),i.indexes.forEach(function(t){e.selectablePoints[t].forEach(function(t){t[0]-=o,t[1]-=a})}),n=!0),n||e.selectablePoints.forEach(function(t){t.forEach(function(t){t[0]-=o,t[1]-=a})}),c._refreshGroups(e),s.left-=o,s.right-=o,s.top-=a,s.bottom-=a,c.gesto.scrollBy(o,a,t.inputEvent),c._checkSelected(c.gesto.getCurrentEvent()))})},e._select=function(t,e,n,r){var i=n.inputEvent,o=n.data,t=this.setSelectedTargets(t);r&&this.emit("selectStart",y(y({},t),{rect:e,inputEvent:i,data:o.data,isTrusted:n.isTrusted})),(t.added.length||t.removed.length)&&this.emit("select",y(y({},t),{rect:e,inputEvent:i,data:o.data,isTrusted:n.isTrusted}))},e._selectEnd=function(t,e,n,r){var i=r.inputEvent,o=r.isDouble,a=r.data,s=M(t,this.selectedTargets),c=s.added,l=s.removed,u=s.prevList,h=s.list,s=M(e,this.selectedTargets),f=s.added,p=s.removed,d=s.prevList,v=s.list,s=i&&i.type,s="mousedown"===s||"touchstart"===s;this.emit("selectEnd",{startSelected:t,beforeSelected:e,selected:this.selectedTargets,added:c.map(function(t){return h[t]}),removed:l.map(function(t){return u[t]}),afterAdded:f.map(function(t){return v[t]}),afterRemoved:p.map(function(t){return d[t]}),isDragStart:s,isClick:!!r.isClick,isDouble:!!o,rect:n,inputEvent:i,data:a.data,isTrusted:r.isTrusted})},e._checkSelected=function(t,e){void 0===e&&(e=Ht(t,this.options.ratio));var n=t.data,r=e.top,i=e.left,o=e.width,a=e.height,s=n.selectFlag,c=n.containerX,l=n.containerY,u=n.scaleMatrix,i=Rt(u,[i-c,r-l]),c=Rt(u,[o,a]),r=[];s&&(this.target.style.cssText+="display: block;left:0px;top:0px;"+"transform: translate(".concat(i[0],"px, ").concat(i[1],"px);")+"width:".concat(c[0],"px;height:").concat(c[1],"px;"),l=this.hitTest(e,n,t),r=Zt(n.startPassedTargets,l,this.continueSelect&&this.continueSelectWithoutDeselect)),!1===this.emit("drag",y(y({},t),{data:n.data,isSelect:s,rect:e}))?(this.target.style.cssText+="display: none;",t.stop()):s&&this._select(r,e,t)},e._sameCombiKey=function(t,e,n){if(!e)return!1;var r,i=wt(t.inputEvent,t.key),e=[].concat(e),e=R(e[0])?e:[e];return n?(r=t.key,e.some(function(t){return t.some(function(t){return t===r})})):e.some(function(t){return t.every(function(t){return-1<i.indexOf(t)})})},e._findElement=function(t,e){for(var n=t;n&&!(-1<e.indexOf(n));)n=n.parentElement;return n},e._refreshGroups=function(t){var r,i,e,c,l=t.innerWidth,u=t.innerHeight,o=t.selectablePoints;this.options.checkOverflow&&(r=null==(e=this.gesto.getEventData().innerScrollOptions)?void 0:e.container,i=t.selectableInnerScrollParentMap,e=t.selectableInnerScrollPathsList,t.selectableInners=e.map(function(t,e){var n=!1;return t.every(function(t){if(!n){if(t===r)return n=!0;t=i.get(t);if(t)if(!Ft(o[e],t.points).length)return!1}return!0})})),l&&u?(e=t.selectablePoints,c={},e.forEach(function(t,e){var n=1/0,r=-1/0,i=1/0,o=-1/0;t.forEach(function(t){var e=Math.floor(t[0]/l),t=Math.floor(t[1]/u);n=Math.min(e,n),r=Math.max(e,r),i=Math.min(t,i),o=Math.max(t,o)});for(var a=n;a<=r;++a)for(var s=i;s<=o;++s)c[a]=c[a]||{},c[a][s]=c[a][s]||[],c[a][s].push(e)}),t.innerGroups=c):t.innerGroups=null},function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(o<3?i(a):3<o?i(e,n,a):i(e,n))||a);return 3<o&&a&&Object.defineProperty(e,n,a),a}([(r=ee,i=function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=H("get ".concat(e)),i=(t[r]?n.get=function(){return this[r]()}:n.get=function(){return this.options[e]},H("set ".concat(e)));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;r.forEach(function(t){i(e,t)})})],t)}(t)),re={__proto__:null,default:ne,OPTIONS:r,OPTION_TYPES:St,PROPERTIES:ee,EVENTS:["dragStart","drag","dragEnd","selectStart","select","selectEnd","keydown","keyup","scroll","innerScroll"],METHODS:["clickTarget","getSelectableElements","setSelectedTargets","getElementPoints","getSelectedTargets","findSelectableTargets","triggerDragStart","checkScroll","selectTargetsByPoints","setSelectedTargetsByPoints"],CLASS_NAME:te};for(Jt in re)ne[Jt]=re[Jt];return ne});
//# sourceMappingURL=selecto.min.js.map
{
"name": "selecto",
"version": "1.22.3",
"version": "1.22.4",
"description": "Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.",

@@ -40,3 +40,3 @@ "main": "./dist/selecto.cjs.js",

"@scena/event-emitter": "^1.0.5",
"css-styled": "^1.0.0",
"css-styled": "^1.0.7",
"css-to-mat": "^1.0.3",

@@ -43,0 +43,0 @@ "framework-utils": "^1.1.0",

@@ -36,5 +36,9 @@ import type { Hypertext, Point, Rect } from "./types";

}
export function elementFromPoint(clientX: number, clientY: number): HTMLElement | SVGElement | null {
return (document.elementFromPoint && document.elementFromPoint(clientX, clientY)) as any || null;
export function elementFromPoint(baseNode: Node, clientX: number, clientY: number): HTMLElement | SVGElement | null {
const doc = getDocument(baseNode);
return (doc.elementFromPoint && doc.elementFromPoint(clientX, clientY)) as any || null;
}
export function createElement(

@@ -214,1 +218,5 @@ jsx: Hypertext,

}
export function getDocument(el: Node) {
return el.ownerDocument || document;
}

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

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