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

selecto

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selecto - npm Package Compare versions

Comparing version 1.22.6 to 1.23.0

9

CHANGELOG.md

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

## [1.22.6](https://github.com/daybrush/selecto/compare/selecto@1.22.5...selecto@1.22.6) (2023-06-04)
### :bug: Bug Fix
* fix node, window condition #132 ([865029d](https://github.com/daybrush/selecto/commit/865029dfbb845775e76f52d332dc2ad940e52466))
## [1.22.5](https://github.com/daybrush/selecto/compare/selecto@1.22.3...selecto@1.22.5) (2023-06-04)

@@ -8,0 +17,0 @@

2

declaration/types.d.ts

@@ -83,3 +83,3 @@ import { IObject } from "@daybrush/utils";

*/
hitRate: number | string;
hitRate: number | string | ((element: Element) => number | string);
/**

@@ -86,0 +86,0 @@ * Container to bound the selection area. If false, do not bound. If true, it is the container of selecto.

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

repository: git+https://github.com/daybrush/selecto.git
version: 1.22.6
version: 1.23.0
*/

@@ -1312,5 +1312,5 @@ 'use strict';

var rectPoints = [[left, top], [right, top], [right, bottom], [left, bottom]];
var hitRateValue = utils.splitUnit("".concat(hitRate));
var isHit = function (points, el) {
var hitRateValue = typeof hitRate === "function" ? utils.splitUnit("".concat(hitRate(el))) : utils.splitUnit("".concat(hitRate));
var inArea = ignoreClick ? false : overlapArea.isInside([clientX, clientY], points);

@@ -1386,3 +1386,3 @@

if (inner && isHit(points)) {
if (inner && isHit(points, target)) {
selectedTargets.push(target);

@@ -1389,0 +1389,0 @@ }

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

repository: git+https://github.com/daybrush/selecto.git
version: 1.22.6
version: 1.23.0
*/

@@ -13,3 +13,3 @@ import EventEmitter from '@scena/event-emitter';

import { Properties } from 'framework-utils';
import { getDocument, hasClass, addClass, calculateBoundSize, getDist, getWindow, isObject, isString, isNode, removeEvent, isFunction, addEvent, splitUnit, isArray, camelize, between } from '@daybrush/utils';
import { getDocument, hasClass, addClass, calculateBoundSize, getDist, getWindow, isObject, isString, isNode, removeEvent, isFunction, addEvent, isArray, camelize, splitUnit, between } from '@daybrush/utils';
import { diff } from '@egjs/children-differ';

@@ -1311,5 +1311,5 @@ import DragScroll from '@scena/dragscroll';

var rectPoints = [[left, top], [right, top], [right, bottom], [left, bottom]];
var hitRateValue = splitUnit("".concat(hitRate));
var isHit = function (points, el) {
var hitRateValue = typeof hitRate === "function" ? splitUnit("".concat(hitRate(el))) : splitUnit("".concat(hitRate));
var inArea = ignoreClick ? false : isInside([clientX, clientY], points);

@@ -1385,3 +1385,3 @@

if (inner && isHit(points)) {
if (inner && isHit(points, target)) {
selectedTargets.push(target);

@@ -1388,0 +1388,0 @@ }

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

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

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

"css-styled": "^1.0.8",
"css-to-mat": "^1.0.3",
"css-to-mat": "^1.1.1",
"framework-utils": "^1.1.0",

@@ -44,0 +44,0 @@ "gesto": "^1.19.1",

@@ -88,3 +88,3 @@ import { IObject } from "@daybrush/utils";

*/
hitRate: number | string;
hitRate: number | string | ((element: Element) => number | string);
/**

@@ -91,0 +91,0 @@ * Container to bound the selection area. If false, do not bound. If true, it is the container of selecto.

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