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.18.1 to 1.18.2

1

declaration/utils.d.ts

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

};
export declare function filterDuplicated<T>(arr: T[]): T[];
export declare function elementFromPoint(clientX: number, clientY: number): HTMLElement | SVGElement | null;

@@ -9,0 +10,0 @@ export declare function createElement(jsx: Hypertext, prevTarget?: HTMLElement | SVGElement, container?: HTMLElement | SVGElement): HTMLElement | SVGElement;

61

dist/selecto.cjs.js

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

repository: git+https://github.com/daybrush/selecto.git
version: 1.18.1
version: 1.18.2
*/

@@ -115,2 +115,19 @@ 'use strict';

}
function filterDuplicated(arr) {
if (typeof Map === "undefined") {
return arr.filter(function (value, index) {
return arr.indexOf(value) === index;
});
}
var map = new Map();
return arr.filter(function (value) {
if (map.has(value)) {
return false;
}
map.set(value, true);
return true;
});
}
function elementFromPoint(clientX, clientY) {

@@ -1129,3 +1146,3 @@ return document.elementFromPoint && document.elementFromPoint(clientX, clientY) || null;

return selectedTargets;
return filterDuplicated(selectedTargets);
};

@@ -1462,15 +1479,29 @@

selectablePoints.forEach(function (points, i) {
var pos = points[0];
var x = Math.floor(pos[0] / innerWidth);
var y = Math.floor(pos[1] / innerHeight);
groups_1[x] = groups_1[x] || {};
groups_1[x][y] = groups_1[x][y] || {
points: [],
targets: []
};
var _a = groups_1[x][y],
targets = _a.targets,
groupPoints = _a.points;
targets.push(selectableTargets_1[i]);
groupPoints.push(points);
var minX = Infinity;
var maxX = -Infinity;
var minY = Infinity;
var maxY = -Infinity;
points.forEach(function (pos) {
var x = Math.floor(pos[0] / innerWidth);
var y = Math.floor(pos[1] / innerHeight);
minX = Math.min(x, minX);
maxX = Math.max(x, maxX);
minY = Math.min(y, minY);
maxY = Math.max(y, maxY);
});
for (var x = minX; x <= maxX; ++x) {
for (var y = minY; y <= maxY; ++y) {
groups_1[x] = groups_1[x] || {};
groups_1[x][y] = groups_1[x][y] || {
points: [],
targets: []
};
var _a = groups_1[x][y],
targets = _a.targets,
groupPoints = _a.points;
targets.push(selectableTargets_1[i]);
groupPoints.push(points);
}
}
});

@@ -1477,0 +1508,0 @@ datas.innerGroups = groups_1;

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

repository: git+https://github.com/daybrush/selecto.git
version: 1.18.1
version: 1.18.2
*/

@@ -113,2 +113,19 @@ import EventEmitter from '@scena/event-emitter';

}
function filterDuplicated(arr) {
if (typeof Map === "undefined") {
return arr.filter(function (value, index) {
return arr.indexOf(value) === index;
});
}
var map = new Map();
return arr.filter(function (value) {
if (map.has(value)) {
return false;
}
map.set(value, true);
return true;
});
}
function elementFromPoint(clientX, clientY) {

@@ -1127,3 +1144,3 @@ return document.elementFromPoint && document.elementFromPoint(clientX, clientY) || null;

return selectedTargets;
return filterDuplicated(selectedTargets);
};

@@ -1460,15 +1477,29 @@

selectablePoints.forEach(function (points, i) {
var pos = points[0];
var x = Math.floor(pos[0] / innerWidth);
var y = Math.floor(pos[1] / innerHeight);
groups_1[x] = groups_1[x] || {};
groups_1[x][y] = groups_1[x][y] || {
points: [],
targets: []
};
var _a = groups_1[x][y],
targets = _a.targets,
groupPoints = _a.points;
targets.push(selectableTargets_1[i]);
groupPoints.push(points);
var minX = Infinity;
var maxX = -Infinity;
var minY = Infinity;
var maxY = -Infinity;
points.forEach(function (pos) {
var x = Math.floor(pos[0] / innerWidth);
var y = Math.floor(pos[1] / innerHeight);
minX = Math.min(x, minX);
maxX = Math.max(x, maxX);
minY = Math.min(y, minY);
maxY = Math.max(y, maxY);
});
for (var x = minX; x <= maxX; ++x) {
for (var y = minY; y <= maxY; ++y) {
groups_1[x] = groups_1[x] || {};
groups_1[x][y] = groups_1[x][y] || {
points: [],
targets: []
};
var _a = groups_1[x][y],
targets = _a.targets,
groupPoints = _a.points;
targets.push(selectableTargets_1[i]);
groupPoints.push(points);
}
}
});

@@ -1475,0 +1506,0 @@ datas.innerGroups = groups_1;

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

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

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

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

}
export function filterDuplicated<T>(arr: T[]): T[] {
if (typeof Map === "undefined") {
return arr.filter((value, index) => {
return arr.indexOf(value) === index;
});
}
const map = new Map<T, true>();
return arr.filter(value => {
if (map.has(value)) {
return false;
}
map.set(value, true);
return true;
});
}
export function elementFromPoint(clientX: number, clientY: number): HTMLElement | SVGElement | null {

@@ -24,0 +38,0 @@ return (document.elementFromPoint && document.elementFromPoint(clientX, clientY)) as any || null;

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