novnc
Version:
An HTML5 VNC client
1,304 lines (1,303 loc) • 195 kB
JavaScript
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
/* interact.js 1.10.11 | https://interactjs.io/license */
!function (t) {
"object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).interact = t();
}(function () {
var t = {};
Object.defineProperty(t, "__esModule", {
value: !0
}), t["default"] = void 0, t["default"] = function (t) {
return !(!t || !t.Window) && t instanceof t.Window;
};
var e = {};
Object.defineProperty(e, "__esModule", {
value: !0
}), e.init = o, e.getWindow = function (e) {
return (0, t["default"])(e) ? e : (e.ownerDocument || e).defaultView || r.window;
}, e.window = e.realWindow = void 0;
var n = void 0;
e.realWindow = n;
var r = void 0;
function o(t) {
e.realWindow = n = t;
var o = t.document.createTextNode("");
o.ownerDocument !== t.document && "function" == typeof t.wrap && t.wrap(o) === o && (t = t.wrap(t)), e.window = r = t;
}
e.window = r, "undefined" != typeof window && window && o(window);
var i = {};
function a(t) {
return (a = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (t) {
return _typeof(t);
} : function (t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : _typeof(t);
})(t);
}
Object.defineProperty(i, "__esModule", {
value: !0
}), i["default"] = void 0;
var s = function s(t) {
return !!t && "object" === a(t);
},
l = function l(t) {
return "function" == typeof t;
},
u = {
window: function window(n) {
return n === e.window || (0, t["default"])(n);
},
docFrag: function docFrag(t) {
return s(t) && 11 === t.nodeType;
},
object: s,
func: l,
number: function number(t) {
return "number" == typeof t;
},
bool: function bool(t) {
return "boolean" == typeof t;
},
string: function string(t) {
return "string" == typeof t;
},
element: function element(t) {
if (!t || "object" !== a(t)) return !1;
var n = e.getWindow(t) || e.window;
return /object|function/.test(a(n.Element)) ? t instanceof n.Element : 1 === t.nodeType && "string" == typeof t.nodeName;
},
plainObject: function plainObject(t) {
return s(t) && !!t.constructor && /function Object\b/.test(t.constructor.toString());
},
array: function array(t) {
return s(t) && void 0 !== t.length && l(t.splice);
}
};
i["default"] = u;
var c = {};
function f(t) {
var e = t.interaction;
if ("drag" === e.prepared.name) {
var n = e.prepared.axis;
"x" === n ? (e.coords.cur.page.y = e.coords.start.page.y, e.coords.cur.client.y = e.coords.start.client.y, e.coords.velocity.client.y = 0, e.coords.velocity.page.y = 0) : "y" === n && (e.coords.cur.page.x = e.coords.start.page.x, e.coords.cur.client.x = e.coords.start.client.x, e.coords.velocity.client.x = 0, e.coords.velocity.page.x = 0);
}
}
function d(t) {
var e = t.iEvent,
n = t.interaction;
if ("drag" === n.prepared.name) {
var r = n.prepared.axis;
if ("x" === r || "y" === r) {
var o = "x" === r ? "y" : "x";
e.page[o] = n.coords.start.page[o], e.client[o] = n.coords.start.client[o], e.delta[o] = 0;
}
}
}
Object.defineProperty(c, "__esModule", {
value: !0
}), c["default"] = void 0;
var p = {
id: "actions/drag",
install: function install(t) {
var e = t.actions,
n = t.Interactable,
r = t.defaults;
n.prototype.draggable = p.draggable, e.map.drag = p, e.methodDict.drag = "draggable", r.actions.drag = p.defaults;
},
listeners: {
"interactions:before-action-move": f,
"interactions:action-resume": f,
"interactions:action-move": d,
"auto-start:check": function autoStartCheck(t) {
var e = t.interaction,
n = t.interactable,
r = t.buttons,
o = n.options.drag;
if (o && o.enabled && (!e.pointerIsDown || !/mouse|pointer/.test(e.pointerType) || 0 != (r & n.options.drag.mouseButtons))) return t.action = {
name: "drag",
axis: "start" === o.lockAxis ? o.startAxis : o.lockAxis
}, !1;
}
},
draggable: function draggable(t) {
return i["default"].object(t) ? (this.options.drag.enabled = !1 !== t.enabled, this.setPerAction("drag", t), this.setOnEvents("drag", t), /^(xy|x|y|start)$/.test(t.lockAxis) && (this.options.drag.lockAxis = t.lockAxis), /^(xy|x|y)$/.test(t.startAxis) && (this.options.drag.startAxis = t.startAxis), this) : i["default"].bool(t) ? (this.options.drag.enabled = t, this) : this.options.drag;
},
beforeMove: f,
move: d,
defaults: {
startAxis: "xy",
lockAxis: "xy"
},
getCursor: function getCursor() {
return "move";
}
},
v = p;
c["default"] = v;
var h = {};
Object.defineProperty(h, "__esModule", {
value: !0
}), h["default"] = void 0;
var g = {
init: function init(t) {
var e = t;
g.document = e.document, g.DocumentFragment = e.DocumentFragment || y, g.SVGElement = e.SVGElement || y, g.SVGSVGElement = e.SVGSVGElement || y, g.SVGElementInstance = e.SVGElementInstance || y, g.Element = e.Element || y, g.HTMLElement = e.HTMLElement || g.Element, g.Event = e.Event, g.Touch = e.Touch || y, g.PointerEvent = e.PointerEvent || e.MSPointerEvent;
},
document: null,
DocumentFragment: null,
SVGElement: null,
SVGSVGElement: null,
SVGElementInstance: null,
Element: null,
HTMLElement: null,
Event: null,
Touch: null,
PointerEvent: null
};
function y() {}
var m = g;
h["default"] = m;
var b = {};
Object.defineProperty(b, "__esModule", {
value: !0
}), b["default"] = void 0;
var x = {
init: function init(t) {
var e = h["default"].Element,
n = t.navigator || {};
x.supportsTouch = "ontouchstart" in t || i["default"].func(t.DocumentTouch) && h["default"].document instanceof t.DocumentTouch, x.supportsPointerEvent = !1 !== n.pointerEnabled && !!h["default"].PointerEvent, x.isIOS = /iP(hone|od|ad)/.test(n.platform), x.isIOS7 = /iP(hone|od|ad)/.test(n.platform) && /OS 7[^\d]/.test(n.appVersion), x.isIe9 = /MSIE 9/.test(n.userAgent), x.isOperaMobile = "Opera" === n.appName && x.supportsTouch && /Presto/.test(n.userAgent), x.prefixedMatchesSelector = "matches" in e.prototype ? "matches" : "webkitMatchesSelector" in e.prototype ? "webkitMatchesSelector" : "mozMatchesSelector" in e.prototype ? "mozMatchesSelector" : "oMatchesSelector" in e.prototype ? "oMatchesSelector" : "msMatchesSelector", x.pEventTypes = x.supportsPointerEvent ? h["default"].PointerEvent === t.MSPointerEvent ? {
up: "MSPointerUp",
down: "MSPointerDown",
over: "mouseover",
out: "mouseout",
move: "MSPointerMove",
cancel: "MSPointerCancel"
} : {
up: "pointerup",
down: "pointerdown",
over: "pointerover",
out: "pointerout",
move: "pointermove",
cancel: "pointercancel"
} : null, x.wheelEvent = h["default"].document && "onmousewheel" in h["default"].document ? "mousewheel" : "wheel";
},
supportsTouch: null,
supportsPointerEvent: null,
isIOS7: null,
isIOS: null,
isIe9: null,
isOperaMobile: null,
prefixedMatchesSelector: null,
pEventTypes: null,
wheelEvent: null
},
w = x;
b["default"] = w;
var _ = {};
function P(t) {
var e = t.parentNode;
if (i["default"].docFrag(e)) {
for (; (e = e.host) && i["default"].docFrag(e);) {
;
}
return e;
}
return e;
}
function O(t, n) {
return e.window !== e.realWindow && (n = n.replace(/\/deep\//g, " ")), t[b["default"].prefixedMatchesSelector](n);
}
Object.defineProperty(_, "__esModule", {
value: !0
}), _.nodeContains = function (t, e) {
if (t.contains) return t.contains(e);
for (; e;) {
if (e === t) return !0;
e = e.parentNode;
}
return !1;
}, _.closest = function (t, e) {
for (; i["default"].element(t);) {
if (O(t, e)) return t;
t = P(t);
}
return null;
}, _.parentNode = P, _.matchesSelector = O, _.indexOfDeepestElement = function (t) {
for (var n, r = [], o = 0; o < t.length; o++) {
var i = t[o],
a = t[n];
if (i && o !== n) if (a) {
var s = S(i),
l = S(a);
if (s !== i.ownerDocument) if (l !== i.ownerDocument) {
if (s !== l) {
r = r.length ? r : E(a);
var u = void 0;
if (a instanceof h["default"].HTMLElement && i instanceof h["default"].SVGElement && !(i instanceof h["default"].SVGSVGElement)) {
if (i === l) continue;
u = i.ownerSVGElement;
} else u = i;
for (var c = E(u, a.ownerDocument), f = 0; c[f] && c[f] === r[f];) {
f++;
}
var d = [c[f - 1], c[f], r[f]];
if (d[0]) for (var p = d[0].lastChild; p;) {
if (p === d[1]) {
n = o, r = c;
break;
}
if (p === d[2]) break;
p = p.previousSibling;
}
} else v = i, g = a, void 0, void 0, (parseInt(e.getWindow(v).getComputedStyle(v).zIndex, 10) || 0) >= (parseInt(e.getWindow(g).getComputedStyle(g).zIndex, 10) || 0) && (n = o);
} else n = o;
} else n = o;
}
var v, g;
return n;
}, _.matchesUpTo = function (t, e, n) {
for (; i["default"].element(t);) {
if (O(t, e)) return !0;
if ((t = P(t)) === n) return O(t, e);
}
return !1;
}, _.getActualElement = function (t) {
return t.correspondingUseElement || t;
}, _.getScrollXY = T, _.getElementClientRect = M, _.getElementRect = function (t) {
var n = M(t);
if (!b["default"].isIOS7 && n) {
var r = T(e.getWindow(t));
n.left += r.x, n.right += r.x, n.top += r.y, n.bottom += r.y;
}
return n;
}, _.getPath = function (t) {
for (var e = []; t;) {
e.push(t), t = P(t);
}
return e;
}, _.trySelector = function (t) {
return !!i["default"].string(t) && (h["default"].document.querySelector(t), !0);
};
var S = function S(t) {
return t.parentNode || t.host;
};
function E(t, e) {
for (var n, r = [], o = t; (n = S(o)) && o !== e && n !== o.ownerDocument;) {
r.unshift(o), o = n;
}
return r;
}
function T(t) {
return {
x: (t = t || e.window).scrollX || t.document.documentElement.scrollLeft,
y: t.scrollY || t.document.documentElement.scrollTop
};
}
function M(t) {
var e = t instanceof h["default"].SVGElement ? t.getBoundingClientRect() : t.getClientRects()[0];
return e && {
left: e.left,
right: e.right,
top: e.top,
bottom: e.bottom,
width: e.width || e.right - e.left,
height: e.height || e.bottom - e.top
};
}
var j = {};
Object.defineProperty(j, "__esModule", {
value: !0
}), j["default"] = function (t, e) {
for (var n in e) {
t[n] = e[n];
}
return t;
};
var k = {};
function I(t, e) {
(null == e || e > t.length) && (e = t.length);
for (var n = 0, r = Array(e); n < e; n++) {
r[n] = t[n];
}
return r;
}
function D(t, e, n) {
return "parent" === t ? (0, _.parentNode)(n) : "self" === t ? e.getRect(n) : (0, _.closest)(n, t);
}
Object.defineProperty(k, "__esModule", {
value: !0
}), k.getStringOptionResult = D, k.resolveRectLike = function (t, e, n, r) {
var o,
a = t;
return i["default"].string(a) ? a = D(a, e, n) : i["default"].func(a) && (a = a.apply(void 0, function (t) {
if (Array.isArray(t)) return I(t);
}(o = r) || function (t) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) return Array.from(t);
}(o) || function (t, e) {
if (t) {
if ("string" == typeof t) return I(t, e);
var n = Object.prototype.toString.call(t).slice(8, -1);
return "Object" === n && t.constructor && (n = t.constructor.name), "Map" === n || "Set" === n ? Array.from(t) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? I(t, e) : void 0;
}
}(o) || function () {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}())), i["default"].element(a) && (a = (0, _.getElementRect)(a)), a;
}, k.rectToXY = function (t) {
return t && {
x: "x" in t ? t.x : t.left,
y: "y" in t ? t.y : t.top
};
}, k.xywhToTlbr = function (t) {
return !t || "left" in t && "top" in t || ((t = (0, j["default"])({}, t)).left = t.x || 0, t.top = t.y || 0, t.right = t.right || t.left + t.width, t.bottom = t.bottom || t.top + t.height), t;
}, k.tlbrToXywh = function (t) {
return !t || "x" in t && "y" in t || ((t = (0, j["default"])({}, t)).x = t.left || 0, t.y = t.top || 0, t.width = t.width || (t.right || 0) - t.x, t.height = t.height || (t.bottom || 0) - t.y), t;
}, k.addEdges = function (t, e, n) {
t.left && (e.left += n.x), t.right && (e.right += n.x), t.top && (e.top += n.y), t.bottom && (e.bottom += n.y), e.width = e.right - e.left, e.height = e.bottom - e.top;
};
var A = {};
Object.defineProperty(A, "__esModule", {
value: !0
}), A["default"] = function (t, e, n) {
var r = t.options[n],
o = r && r.origin || t.options.origin,
i = (0, k.resolveRectLike)(o, t, e, [t && e]);
return (0, k.rectToXY)(i) || {
x: 0,
y: 0
};
};
var R = {};
function z(t) {
return t.trim().split(/ +/);
}
Object.defineProperty(R, "__esModule", {
value: !0
}), R["default"] = function t(e, n, r) {
if (r = r || {}, i["default"].string(e) && -1 !== e.search(" ") && (e = z(e)), i["default"].array(e)) return e.reduce(function (e, o) {
return (0, j["default"])(e, t(o, n, r));
}, r);
if (i["default"].object(e) && (n = e, e = ""), i["default"].func(n)) r[e] = r[e] || [], r[e].push(n);else if (i["default"].array(n)) for (var o = 0; o < n.length; o++) {
var a;
a = n[o], t(e, a, r);
} else if (i["default"].object(n)) for (var s in n) {
var l = z(s).map(function (t) {
return "".concat(e).concat(t);
});
t(l, n[s], r);
}
return r;
};
var C = {};
Object.defineProperty(C, "__esModule", {
value: !0
}), C["default"] = void 0, C["default"] = function (t, e) {
return Math.sqrt(t * t + e * e);
};
var F = {};
function X(t, e) {
for (var n in e) {
var r = X.prefixedPropREs,
o = !1;
for (var i in r) {
if (0 === n.indexOf(i) && r[i].test(n)) {
o = !0;
break;
}
}
o || "function" == typeof e[n] || (t[n] = e[n]);
}
return t;
}
Object.defineProperty(F, "__esModule", {
value: !0
}), F["default"] = void 0, X.prefixedPropREs = {
webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/,
moz: /(Pressure)$/
};
var Y = X;
F["default"] = Y;
var B = {};
function W(t) {
return t instanceof h["default"].Event || t instanceof h["default"].Touch;
}
function L(t, e, n) {
return t = t || "page", (n = n || {}).x = e[t + "X"], n.y = e[t + "Y"], n;
}
function U(t, e) {
return e = e || {
x: 0,
y: 0
}, b["default"].isOperaMobile && W(t) ? (L("screen", t, e), e.x += window.scrollX, e.y += window.scrollY) : L("page", t, e), e;
}
function V(t, e) {
return e = e || {}, b["default"].isOperaMobile && W(t) ? L("screen", t, e) : L("client", t, e), e;
}
function N(t) {
var e = [];
return i["default"].array(t) ? (e[0] = t[0], e[1] = t[1]) : "touchend" === t.type ? 1 === t.touches.length ? (e[0] = t.touches[0], e[1] = t.changedTouches[0]) : 0 === t.touches.length && (e[0] = t.changedTouches[0], e[1] = t.changedTouches[1]) : (e[0] = t.touches[0], e[1] = t.touches[1]), e;
}
function q(t) {
for (var e = {
pageX: 0,
pageY: 0,
clientX: 0,
clientY: 0,
screenX: 0,
screenY: 0
}, n = 0; n < t.length; n++) {
var r = t[n];
for (var o in e) {
e[o] += r[o];
}
}
for (var i in e) {
e[i] /= t.length;
}
return e;
}
Object.defineProperty(B, "__esModule", {
value: !0
}), B.copyCoords = function (t, e) {
t.page = t.page || {}, t.page.x = e.page.x, t.page.y = e.page.y, t.client = t.client || {}, t.client.x = e.client.x, t.client.y = e.client.y, t.timeStamp = e.timeStamp;
}, B.setCoordDeltas = function (t, e, n) {
t.page.x = n.page.x - e.page.x, t.page.y = n.page.y - e.page.y, t.client.x = n.client.x - e.client.x, t.client.y = n.client.y - e.client.y, t.timeStamp = n.timeStamp - e.timeStamp;
}, B.setCoordVelocity = function (t, e) {
var n = Math.max(e.timeStamp / 1e3, .001);
t.page.x = e.page.x / n, t.page.y = e.page.y / n, t.client.x = e.client.x / n, t.client.y = e.client.y / n, t.timeStamp = n;
}, B.setZeroCoords = function (t) {
t.page.x = 0, t.page.y = 0, t.client.x = 0, t.client.y = 0;
}, B.isNativePointer = W, B.getXY = L, B.getPageXY = U, B.getClientXY = V, B.getPointerId = function (t) {
return i["default"].number(t.pointerId) ? t.pointerId : t.identifier;
}, B.setCoords = function (t, e, n) {
var r = e.length > 1 ? q(e) : e[0];
U(r, t.page), V(r, t.client), t.timeStamp = n;
}, B.getTouchPair = N, B.pointerAverage = q, B.touchBBox = function (t) {
if (!t.length) return null;
var e = N(t),
n = Math.min(e[0].pageX, e[1].pageX),
r = Math.min(e[0].pageY, e[1].pageY),
o = Math.max(e[0].pageX, e[1].pageX),
i = Math.max(e[0].pageY, e[1].pageY);
return {
x: n,
y: r,
left: n,
top: r,
right: o,
bottom: i,
width: o - n,
height: i - r
};
}, B.touchDistance = function (t, e) {
var n = e + "X",
r = e + "Y",
o = N(t),
i = o[0][n] - o[1][n],
a = o[0][r] - o[1][r];
return (0, C["default"])(i, a);
}, B.touchAngle = function (t, e) {
var n = e + "X",
r = e + "Y",
o = N(t),
i = o[1][n] - o[0][n],
a = o[1][r] - o[0][r];
return 180 * Math.atan2(a, i) / Math.PI;
}, B.getPointerType = function (t) {
return i["default"].string(t.pointerType) ? t.pointerType : i["default"].number(t.pointerType) ? [void 0, void 0, "touch", "pen", "mouse"][t.pointerType] : /touch/.test(t.type || "") || t instanceof h["default"].Touch ? "touch" : "mouse";
}, B.getEventTargets = function (t) {
var e = i["default"].func(t.composedPath) ? t.composedPath() : t.path;
return [_.getActualElement(e ? e[0] : t.target), _.getActualElement(t.currentTarget)];
}, B.newCoords = function () {
return {
page: {
x: 0,
y: 0
},
client: {
x: 0,
y: 0
},
timeStamp: 0
};
}, B.coordsToEvent = function (t) {
return {
coords: t,
get page() {
return this.coords.page;
},
get client() {
return this.coords.client;
},
get timeStamp() {
return this.coords.timeStamp;
},
get pageX() {
return this.coords.page.x;
},
get pageY() {
return this.coords.page.y;
},
get clientX() {
return this.coords.client.x;
},
get clientY() {
return this.coords.client.y;
},
get pointerId() {
return this.coords.pointerId;
},
get target() {
return this.coords.target;
},
get type() {
return this.coords.type;
},
get pointerType() {
return this.coords.pointerType;
},
get buttons() {
return this.coords.buttons;
},
preventDefault: function preventDefault() {}
};
}, Object.defineProperty(B, "pointerExtend", {
enumerable: !0,
get: function get() {
return F["default"];
}
});
var $ = {};
function G(t, e) {
for (var n = 0; n < e.length; n++) {
var r = e[n];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
}
}
function H(t, e, n) {
return e in t ? Object.defineProperty(t, e, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = n, t;
}
Object.defineProperty($, "__esModule", {
value: !0
}), $.BaseEvent = void 0;
var K = function () {
function t(e) {
!function (t, e) {
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
}(this, t), H(this, "type", void 0), H(this, "target", void 0), H(this, "currentTarget", void 0), H(this, "interactable", void 0), H(this, "_interaction", void 0), H(this, "timeStamp", void 0), H(this, "immediatePropagationStopped", !1), H(this, "propagationStopped", !1), this._interaction = e;
}
var e, n;
return e = t, (n = [{
key: "preventDefault",
value: function value() {}
}, {
key: "stopPropagation",
value: function value() {
this.propagationStopped = !0;
}
}, {
key: "stopImmediatePropagation",
value: function value() {
this.immediatePropagationStopped = this.propagationStopped = !0;
}
}]) && G(e.prototype, n), t;
}();
$.BaseEvent = K, Object.defineProperty(K.prototype, "interaction", {
get: function get() {
return this._interaction._proxy;
},
set: function set() {}
});
var Z = {};
Object.defineProperty(Z, "__esModule", {
value: !0
}), Z.find = Z.findIndex = Z.from = Z.merge = Z.remove = Z.contains = void 0, Z.contains = function (t, e) {
return -1 !== t.indexOf(e);
}, Z.remove = function (t, e) {
return t.splice(t.indexOf(e), 1);
};
var J = function J(t, e) {
for (var n = 0; n < e.length; n++) {
var r = e[n];
t.push(r);
}
return t;
};
Z.merge = J, Z.from = function (t) {
return J([], t);
};
var Q = function Q(t, e) {
for (var n = 0; n < t.length; n++) {
if (e(t[n], n, t)) return n;
}
return -1;
};
Z.findIndex = Q, Z.find = function (t, e) {
return t[Q(t, e)];
};
var tt = {};
function et(t) {
return (et = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (t) {
return _typeof(t);
} : function (t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : _typeof(t);
})(t);
}
function nt(t, e) {
for (var n = 0; n < e.length; n++) {
var r = e[n];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
}
}
function rt(t, e) {
return (rt = Object.setPrototypeOf || function (t, e) {
return t.__proto__ = e, t;
})(t, e);
}
function ot(t, e) {
return !e || "object" !== et(e) && "function" != typeof e ? it(t) : e;
}
function it(t) {
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}
function at(t) {
return (at = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
})(t);
}
function st(t, e, n) {
return e in t ? Object.defineProperty(t, e, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = n, t;
}
Object.defineProperty(tt, "__esModule", {
value: !0
}), tt.DropEvent = void 0;
var lt = function (t) {
!function (t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}), e && rt(t, e);
}(a, t);
var e,
n,
r,
o,
i = (r = a, o = function () {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
} catch (t) {
return !1;
}
}(), function () {
var t,
e = at(r);
if (o) {
var n = at(this).constructor;
t = Reflect.construct(e, arguments, n);
} else t = e.apply(this, arguments);
return ot(this, t);
});
function a(t, e, n) {
var r;
!function (t, e) {
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
}(this, a), st(it(r = i.call(this, e._interaction)), "target", void 0), st(it(r), "dropzone", void 0), st(it(r), "dragEvent", void 0), st(it(r), "relatedTarget", void 0), st(it(r), "draggable", void 0), st(it(r), "timeStamp", void 0), st(it(r), "propagationStopped", !1), st(it(r), "immediatePropagationStopped", !1);
var o = "dragleave" === n ? t.prev : t.cur,
s = o.element,
l = o.dropzone;
return r.type = n, r.target = s, r.currentTarget = s, r.dropzone = l, r.dragEvent = e, r.relatedTarget = e.target, r.draggable = e.interactable, r.timeStamp = e.timeStamp, r;
}
return e = a, (n = [{
key: "reject",
value: function value() {
var t = this,
e = this._interaction.dropState;
if ("dropactivate" === this.type || this.dropzone && e.cur.dropzone === this.dropzone && e.cur.element === this.target) if (e.prev.dropzone = this.dropzone, e.prev.element = this.target, e.rejected = !0, e.events.enter = null, this.stopImmediatePropagation(), "dropactivate" === this.type) {
var n = e.activeDrops,
r = Z.findIndex(n, function (e) {
var n = e.dropzone,
r = e.element;
return n === t.dropzone && r === t.target;
});
e.activeDrops.splice(r, 1);
var o = new a(e, this.dragEvent, "dropdeactivate");
o.dropzone = this.dropzone, o.target = this.target, this.dropzone.fire(o);
} else this.dropzone.fire(new a(e, this.dragEvent, "dragleave"));
}
}, {
key: "preventDefault",
value: function value() {}
}, {
key: "stopPropagation",
value: function value() {
this.propagationStopped = !0;
}
}, {
key: "stopImmediatePropagation",
value: function value() {
this.immediatePropagationStopped = this.propagationStopped = !0;
}
}]) && nt(e.prototype, n), a;
}($.BaseEvent);
tt.DropEvent = lt;
var ut = {};
function ct(t, e) {
for (var n = 0; n < t.slice().length; n++) {
var r = t.slice()[n],
o = r.dropzone,
i = r.element;
e.dropzone = o, e.target = i, o.fire(e), e.propagationStopped = e.immediatePropagationStopped = !1;
}
}
function ft(t, e) {
for (var n = function (t, e) {
for (var n = t.interactables, r = [], o = 0; o < n.list.length; o++) {
var a = n.list[o];
if (a.options.drop.enabled) {
var s = a.options.drop.accept;
if (!(i["default"].element(s) && s !== e || i["default"].string(s) && !_.matchesSelector(e, s) || i["default"].func(s) && !s({
dropzone: a,
draggableElement: e
}))) for (var l = i["default"].string(a.target) ? a._context.querySelectorAll(a.target) : i["default"].array(a.target) ? a.target : [a.target], u = 0; u < l.length; u++) {
var c = l[u];
c !== e && r.push({
dropzone: a,
element: c,
rect: a.getRect(c)
});
}
}
}
return r;
}(t, e), r = 0; r < n.length; r++) {
var o = n[r];
o.rect = o.dropzone.getRect(o.element);
}
return n;
}
function dt(t, e, n) {
for (var r = t.dropState, o = t.interactable, i = t.element, a = [], s = 0; s < r.activeDrops.length; s++) {
var l = r.activeDrops[s],
u = l.dropzone,
c = l.element,
f = l.rect;
a.push(u.dropCheck(e, n, o, i, c, f) ? c : null);
}
var d = _.indexOfDeepestElement(a);
return r.activeDrops[d] || null;
}
function pt(t, e, n) {
var r = t.dropState,
o = {
enter: null,
leave: null,
activate: null,
deactivate: null,
move: null,
drop: null
};
return "dragstart" === n.type && (o.activate = new tt.DropEvent(r, n, "dropactivate"), o.activate.target = null, o.activate.dropzone = null), "dragend" === n.type && (o.deactivate = new tt.DropEvent(r, n, "dropdeactivate"), o.deactivate.target = null, o.deactivate.dropzone = null), r.rejected || (r.cur.element !== r.prev.element && (r.prev.dropzone && (o.leave = new tt.DropEvent(r, n, "dragleave"), n.dragLeave = o.leave.target = r.prev.element, n.prevDropzone = o.leave.dropzone = r.prev.dropzone), r.cur.dropzone && (o.enter = new tt.DropEvent(r, n, "dragenter"), n.dragEnter = r.cur.element, n.dropzone = r.cur.dropzone)), "dragend" === n.type && r.cur.dropzone && (o.drop = new tt.DropEvent(r, n, "drop"), n.dropzone = r.cur.dropzone, n.relatedTarget = r.cur.element), "dragmove" === n.type && r.cur.dropzone && (o.move = new tt.DropEvent(r, n, "dropmove"), o.move.dragmove = n, n.dropzone = r.cur.dropzone)), o;
}
function vt(t, e) {
var n = t.dropState,
r = n.activeDrops,
o = n.cur,
i = n.prev;
e.leave && i.dropzone.fire(e.leave), e.enter && o.dropzone.fire(e.enter), e.move && o.dropzone.fire(e.move), e.drop && o.dropzone.fire(e.drop), e.deactivate && ct(r, e.deactivate), n.prev.dropzone = o.dropzone, n.prev.element = o.element;
}
function ht(t, e) {
var n = t.interaction,
r = t.iEvent,
o = t.event;
if ("dragmove" === r.type || "dragend" === r.type) {
var i = n.dropState;
e.dynamicDrop && (i.activeDrops = ft(e, n.element));
var a = r,
s = dt(n, a, o);
i.rejected = i.rejected && !!s && s.dropzone === i.cur.dropzone && s.element === i.cur.element, i.cur.dropzone = s && s.dropzone, i.cur.element = s && s.element, i.events = pt(n, 0, a);
}
}
Object.defineProperty(ut, "__esModule", {
value: !0
}), ut["default"] = void 0;
var gt = {
id: "actions/drop",
install: function install(t) {
var e = t.actions,
n = t.interactStatic,
r = t.Interactable,
o = t.defaults;
t.usePlugin(c["default"]), r.prototype.dropzone = function (t) {
return function (t, e) {
if (i["default"].object(e)) {
if (t.options.drop.enabled = !1 !== e.enabled, e.listeners) {
var n = (0, R["default"])(e.listeners),
r = Object.keys(n).reduce(function (t, e) {
return t[/^(enter|leave)/.test(e) ? "drag".concat(e) : /^(activate|deactivate|move)/.test(e) ? "drop".concat(e) : e] = n[e], t;
}, {});
t.off(t.options.drop.listeners), t.on(r), t.options.drop.listeners = r;
}
return i["default"].func(e.ondrop) && t.on("drop", e.ondrop), i["default"].func(e.ondropactivate) && t.on("dropactivate", e.ondropactivate), i["default"].func(e.ondropdeactivate) && t.on("dropdeactivate", e.ondropdeactivate), i["default"].func(e.ondragenter) && t.on("dragenter", e.ondragenter), i["default"].func(e.ondragleave) && t.on("dragleave", e.ondragleave), i["default"].func(e.ondropmove) && t.on("dropmove", e.ondropmove), /^(pointer|center)$/.test(e.overlap) ? t.options.drop.overlap = e.overlap : i["default"].number(e.overlap) && (t.options.drop.overlap = Math.max(Math.min(1, e.overlap), 0)), "accept" in e && (t.options.drop.accept = e.accept), "checker" in e && (t.options.drop.checker = e.checker), t;
}
return i["default"].bool(e) ? (t.options.drop.enabled = e, t) : t.options.drop;
}(this, t);
}, r.prototype.dropCheck = function (t, e, n, r, o, a) {
return function (t, e, n, r, o, a, s) {
var l = !1;
if (!(s = s || t.getRect(a))) return !!t.options.drop.checker && t.options.drop.checker(e, n, l, t, a, r, o);
var u = t.options.drop.overlap;
if ("pointer" === u) {
var c = (0, A["default"])(r, o, "drag"),
f = B.getPageXY(e);
f.x += c.x, f.y += c.y;
var d = f.x > s.left && f.x < s.right,
p = f.y > s.top && f.y < s.bottom;
l = d && p;
}
var v = r.getRect(o);
if (v && "center" === u) {
var h = v.left + v.width / 2,
g = v.top + v.height / 2;
l = h >= s.left && h <= s.right && g >= s.top && g <= s.bottom;
}
return v && i["default"].number(u) && (l = Math.max(0, Math.min(s.right, v.right) - Math.max(s.left, v.left)) * Math.max(0, Math.min(s.bottom, v.bottom) - Math.max(s.top, v.top)) / (v.width * v.height) >= u), t.options.drop.checker && (l = t.options.drop.checker(e, n, l, t, a, r, o)), l;
}(this, t, e, n, r, o, a);
}, n.dynamicDrop = function (e) {
return i["default"].bool(e) ? (t.dynamicDrop = e, n) : t.dynamicDrop;
}, (0, j["default"])(e.phaselessTypes, {
dragenter: !0,
dragleave: !0,
dropactivate: !0,
dropdeactivate: !0,
dropmove: !0,
drop: !0
}), e.methodDict.drop = "dropzone", t.dynamicDrop = !1, o.actions.drop = gt.defaults;
},
listeners: {
"interactions:before-action-start": function interactionsBeforeActionStart(t) {
var e = t.interaction;
"drag" === e.prepared.name && (e.dropState = {
cur: {
dropzone: null,
element: null
},
prev: {
dropzone: null,
element: null
},
rejected: null,
events: null,
activeDrops: []
});
},
"interactions:after-action-start": function interactionsAfterActionStart(t, e) {
var n = t.interaction,
r = (t.event, t.iEvent);
if ("drag" === n.prepared.name) {
var o = n.dropState;
o.activeDrops = null, o.events = null, o.activeDrops = ft(e, n.element), o.events = pt(n, 0, r), o.events.activate && (ct(o.activeDrops, o.events.activate), e.fire("actions/drop:start", {
interaction: n,
dragEvent: r
}));
}
},
"interactions:action-move": ht,
"interactions:after-action-move": function interactionsAfterActionMove(t, e) {
var n = t.interaction,
r = t.iEvent;
"drag" === n.prepared.name && (vt(n, n.dropState.events), e.fire("actions/drop:move", {
interaction: n,
dragEvent: r
}), n.dropState.events = {});
},
"interactions:action-end": function interactionsActionEnd(t, e) {
if ("drag" === t.interaction.prepared.name) {
var n = t.interaction,
r = t.iEvent;
ht(t, e), vt(n, n.dropState.events), e.fire("actions/drop:end", {
interaction: n,
dragEvent: r
});
}
},
"interactions:stop": function interactionsStop(t) {
var e = t.interaction;
if ("drag" === e.prepared.name) {
var n = e.dropState;
n && (n.activeDrops = null, n.events = null, n.cur.dropzone = null, n.cur.element = null, n.prev.dropzone = null, n.prev.element = null, n.rejected = !1);
}
}
},
getActiveDrops: ft,
getDrop: dt,
getDropEvents: pt,
fireDropEvents: vt,
defaults: {
enabled: !1,
accept: null,
overlap: "pointer"
}
},
yt = gt;
ut["default"] = yt;
var mt = {};
function bt(t) {
var e = t.interaction,
n = t.iEvent,
r = t.phase;
if ("gesture" === e.prepared.name) {
var o = e.pointers.map(function (t) {
return t.pointer;
}),
a = "start" === r,
s = "end" === r,
l = e.interactable.options.deltaSource;
if (n.touches = [o[0], o[1]], a) n.distance = B.touchDistance(o, l), n.box = B.touchBBox(o), n.scale = 1, n.ds = 0, n.angle = B.touchAngle(o, l), n.da = 0, e.gesture.startDistance = n.distance, e.gesture.startAngle = n.angle;else if (s) {
var u = e.prevEvent;
n.distance = u.distance, n.box = u.box, n.scale = u.scale, n.ds = 0, n.angle = u.angle, n.da = 0;
} else n.distance = B.touchDistance(o, l), n.box = B.touchBBox(o), n.scale = n.distance / e.gesture.startDistance, n.angle = B.touchAngle(o, l), n.ds = n.scale - e.gesture.scale, n.da = n.angle - e.gesture.angle;
e.gesture.distance = n.distance, e.gesture.angle = n.angle, i["default"].number(n.scale) && n.scale !== 1 / 0 && !isNaN(n.scale) && (e.gesture.scale = n.scale);
}
}
Object.defineProperty(mt, "__esModule", {
value: !0
}), mt["default"] = void 0;
var xt = {
id: "actions/gesture",
before: ["actions/drag", "actions/resize"],
install: function install(t) {
var e = t.actions,
n = t.Interactable,
r = t.defaults;
n.prototype.gesturable = function (t) {
return i["default"].object(t) ? (this.options.gesture.enabled = !1 !== t.enabled, this.setPerAction("gesture", t), this.setOnEvents("gesture", t), this) : i["default"].bool(t) ? (this.options.gesture.enabled = t, this) : this.options.gesture;
}, e.map.gesture = xt, e.methodDict.gesture = "gesturable", r.actions.gesture = xt.defaults;
},
listeners: {
"interactions:action-start": bt,
"interactions:action-move": bt,
"interactions:action-end": bt,
"interactions:new": function interactionsNew(t) {
t.interaction.gesture = {
angle: 0,
distance: 0,
scale: 1,
startAngle: 0,
startDistance: 0
};
},
"auto-start:check": function autoStartCheck(t) {
if (!(t.interaction.pointers.length < 2)) {
var e = t.interactable.options.gesture;
if (e && e.enabled) return t.action = {
name: "gesture"
}, !1;
}
}
},
defaults: {},
getCursor: function getCursor() {
return "";
}
},
wt = xt;
mt["default"] = wt;
var _t = {};
function Pt(t, e, n, r, o, a, s) {
if (!e) return !1;
if (!0 === e) {
var l = i["default"].number(a.width) ? a.width : a.right - a.left,
u = i["default"].number(a.height) ? a.height : a.bottom - a.top;
if (s = Math.min(s, Math.abs(("left" === t || "right" === t ? l : u) / 2)), l < 0 && ("left" === t ? t = "right" : "right" === t && (t = "left")), u < 0 && ("top" === t ? t = "bottom" : "bottom" === t && (t = "top")), "left" === t) return n.x < (l >= 0 ? a.left : a.right) + s;
if ("top" === t) return n.y < (u >= 0 ? a.top : a.bottom) + s;
if ("right" === t) return n.x > (l >= 0 ? a.right : a.left) - s;
if ("bottom" === t) return n.y > (u >= 0 ? a.bottom : a.top) - s;
}
return !!i["default"].element(r) && (i["default"].element(e) ? e === r : _.matchesUpTo(r, e, o));
}
function Ot(t) {
var e = t.iEvent,
n = t.interaction;
if ("resize" === n.prepared.name && n.resizeAxes) {
var r = e;
n.interactable.options.resize.square ? ("y" === n.resizeAxes ? r.delta.x = r.delta.y : r.delta.y = r.delta.x, r.axes = "xy") : (r.axes = n.resizeAxes, "x" === n.resizeAxes ? r.delta.y = 0 : "y" === n.resizeAxes && (r.delta.x = 0));
}
}
Object.defineProperty(_t, "__esModule", {
value: !0
}), _t["default"] = void 0;
var St = {
id: "actions/resize",
before: ["actions/drag"],
install: function install(t) {
var e = t.actions,
n = t.browser,
r = t.Interactable,
o = t.defaults;
St.cursors = function (t) {
return t.isIe9 ? {
x: "e-resize",
y: "s-resize",
xy: "se-resize",
top: "n-resize",
left: "w-resize",
bottom: "s-resize",
right: "e-resize",
topleft: "se-resize",
bottomright: "se-resize",
topright: "ne-resize",
bottomleft: "ne-resize"
} : {
x: "ew-resize",
y: "ns-resize",
xy: "nwse-resize",
top: "ns-resize",
left: "ew-resize",
bottom: "ns-resize",
right: "ew-resize",
topleft: "nwse-resize",
bottomright: "nwse-resize",
topright: "nesw-resize",
bottomleft: "nesw-resize"
};
}(n), St.defaultMargin = n.supportsTouch || n.supportsPointerEvent ? 20 : 10, r.prototype.resizable = function (e) {
return function (t, e, n) {
return i["default"].object(e) ? (t.options.resize.enabled = !1 !== e.enabled, t.setPerAction("resize", e), t.setOnEvents("resize", e), i["default"].string(e.axis) && /^x$|^y$|^xy$/.test(e.axis) ? t.options.resize.axis = e.axis : null === e.axis && (t.options.resize.axis = n.defaults.actions.resize.axis), i["default"].bool(e.preserveAspectRatio) ? t.options.resize.preserveAspectRatio = e.preserveAspectRatio : i["default"].bool(e.square) && (t.options.resize.square = e.square), t) : i["default"].bool(e) ? (t.options.resize.enabled = e, t) : t.options.resize;
}(this, e, t);
}, e.map.resize = St, e.methodDict.resize = "resizable", o.actions.resize = St.defaults;
},
listeners: {
"interactions:new": function interactionsNew(t) {
t.interaction.resizeAxes = "xy";
},
"interactions:action-start": function interactionsActionStart(t) {
!function (t) {
var e = t.iEvent,
n = t.interaction;
if ("resize" === n.prepared.name && n.prepared.edges) {
var r = e,
o = n.rect;
n._rects = {
start: (0, j["default"])({}, o),
corrected: (0, j["default"])({}, o),
previous: (0, j["default"])({}, o),
delta: {
left: 0,
right: 0,
width: 0,
top: 0,
bottom: 0,
height: 0
}
}, r.edges = n.prepared.edges, r.rect = n._rects.corrected, r.deltaRect = n._rects.delta;
}
}(t), Ot(t);
},
"interactions:action-move": function interactionsActionMove(t) {
!function (t) {
var e = t.iEvent,
n = t.interaction;
if ("resize" === n.prepared.name && n.prepared.edges) {
var r = e,
o = n.interactable.options.resize.invert,
i = "reposition" === o || "negate" === o,
a = n.rect,
s = n._rects,
l = s.start,
u = s.corrected,
c = s.delta,
f = s.previous;
if ((0, j["default"])(f, u), i) {
if ((0, j["default"])(u, a), "reposition" === o) {
if (u.top > u.bottom) {
var d = u.top;
u.top = u.bottom, u.bottom = d;
}
if (u.left > u.right) {
var p = u.left;
u.left = u.right, u.right = p;
}
}
} else u.top = Math.min(a.top, l.bottom), u.bottom = Math.max(a.bottom, l.top), u.left = Math.min(a.left, l.right), u.right = Math.max(a.right, l.left);
for (var v in u.width = u.right - u.left, u.height = u.bottom - u.top, u) {
c[v] = u[v] - f[v];
}
r.edges = n.prepared.edges, r.rect = u, r.deltaRect = c;
}
}(t), Ot(t);
},
"interactions:action-end": function interactionsActionEnd(t) {
var e = t.iEvent,
n = t.interaction;
if ("resize" === n.prepared.name && n.prepared.edges) {
var r = e;
r.edges = n.prepared.edges, r.rect = n._rects.corrected, r.deltaRect = n._rects.delta;
}
},
"auto-start:check": function autoStartCheck(t) {
var e = t.interaction,
n = t.interactable,
r = t.element,
o = t.rect,
a = t.buttons;
if (o) {
var s = (0, j["default"])({}, e.coords.cur.page),
l = n.options.resize;
if (l && l.enabled && (!e.pointerIsDown || !/mouse|pointer/.test(e.pointerType) || 0 != (a & l.mouseButtons))) {
if (i["default"].object(l.edges)) {
var u = {
left: !1,
right: !1,
top: !1,
bottom: !1
};
for (var c in u) {
u[c] = Pt(c, l.edges[c], s, e._latestPointer.eventTarget, r, o, l.margin || St.defaultMargin);
}
u.left = u.left && !u.right, u.top = u.top && !u.bottom, (u.left || u.right || u.top || u.bottom) && (t.action = {
name: "resize",
edges: u
});
} else {
var f = "y" !== l.axis && s.x > o.right - St.defaultMargin,
d = "x" !== l.axis && s.y > o.bottom - St.defaultMargin;
(f || d) && (t.action = {
name: "resize",
axes: (f ? "x" : "") + (d ? "y" : "")
});
}
return !t.action && void 0;
}
}
}
},
defaults: {
square: !1,
preserveAspectRatio: !1,
axis: "xy",
margin: NaN,
edges: null,
invert: "none"
},
cursors: null,
getCursor: function getCursor(t) {
var e = t.edges,
n = t.axis,
r = t.name,
o = St.cursors,
i = null;
if (n) i = o[r + n];else if (e) {
for (var a = "", s = ["top", "bottom", "left", "right"], l = 0; l < s.length; l++) {
var u = s[l];
e[u] && (a += u);
}
i = o[a];
}
return i;
},
defaultMargin: null
},
Et = St;
_t["default"] = Et;
var Tt = {};
Object.defineProperty(Tt, "__esModule", {
value: !0
}), Tt["default"] = void 0;
var Mt = {
id: "actions",
install: function install(t) {
t.usePlugin(mt["default"]), t.usePlugin(_t["default"]), t.usePlugin(c["default"]), t.usePlugin(ut["default"]);
}
};
Tt["default"] = Mt;
var jt = {};
Object.defineProperty(jt, "__esModule", {
value: !0
}), jt["default"] = void 0;
var kt,
It,
Dt = 0,
At = {
request: function request(t) {
return kt(t);
},
cancel: function cancel(t) {
return It(t);
},
init: function init(t) {
if (kt = t.requestAnimationFrame, It = t.cancelAnimationFrame, !kt) for (var e = ["ms", "moz", "webkit", "o"], n = 0; n < e.length; n++) {
var r = e[n];
kt = t["".concat(r, "RequestAnimationFrame")], It = t["".concat(r, "CancelAnimationFrame")] || t["".concat(r, "CancelRequestAnimationFrame")];
}
kt = kt && kt.bind(t), It = It && It.bind(t), kt || (kt = function kt(e) {
var n = Date.now(),
r = Math.max(0, 16 - (n - Dt)),
o = t.setTimeout(function () {
e(n + r);
}, r);
return Dt = n + r, o;
}, It = function It(t) {
return clearTimeout(t);
});
}
};
jt["default"] = At;
var Rt = {};
Object.defineProperty(Rt, "__esModule", {
value: !0
}), Rt.getContainer = Ct, Rt.getScroll = Ft, Rt.getScrollSize = function (t) {
return i["default"].window(t) && (t = window.document.body), {
x: t.scrollWidth,
y: t.scrollHeight
};
}, Rt.getScrollSizeDelta = function (t, e) {
var n = t.interaction,
r = t.element,
o = n && n.interactable.options[n.prepared.name].autoScroll;
if (!o || !o.enabled) return e(), {
x: 0,
y: 0
};
var i = Ct(o.container, n.interactable, r),
a = Ft(i);
e();
var s = Ft(i);
return {
x: s.x - a.x,
y: s.y - a.y
};
}, Rt["default"] = void 0;
var zt = {
defaults: {
enabled: !1,
margin: 60,
container: null,
speed: 300
},
now: Date.now,
interaction: null,
i: 0,
x: 0,
y: 0,
isScrolling: !1,
prevTime: 0,
margin: 0,
speed: 0,
start: function start(t) {
zt.isScro