tradex-chart
Version:
TradeX-chart is a highly customizable stock trade chart with **one** dependency written in plain JavaScript; use it with any framework or backend.
1,549 lines • 1.03 MB
JavaScript
function PC(n, A) {
for (var e = 0; e < A.length; e++) {
const i = A[e];
if (typeof i != "string" && !Array.isArray(i)) {
for (const s in i)
if (s !== "default" && !(s in n)) {
const o = Object.getOwnPropertyDescriptor(i, s);
o && Object.defineProperty(n, s, o.get ? o : {
enumerable: !0,
get: () => i[s]
});
}
}
}
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
}
const ai = "TradeX-Chart", Xe = "TX", OC = "tradeXutils", VI = "tradeXmenus", xC = "tradeXmenu", XI = "tradeXdividers", jI = "tradeXwindows", qC = "tradeXwindow", $I = "tradeXprogress", JC = 500, Qh = "stream_None", li = "stream_Listening", Xs = "stream_Started", dh = "stream_Stopped", HC = "stream_Error", rs = "stream_candleFirst", Me = "stream_candleUpdate", as = "stream_candleNew", _C = 250, WC = 8, zI = 2, YC = 2, mh = 18, dt = 100, Ci = /^(\d*\.?\d+)\s?(px|em|ex|%|in|cn|mm|pt|pc+)$/igm;
let ZC = Object.prototype.hasOwnProperty;
function VC(n, A, e = void 0) {
const i = (o) => String.prototype.split.call(A, o).filter(Boolean).reduce((r, a) => r != null ? r[a] : r, n), s = i(/[,[\]]+?/) || i(/[,[\].]+?/);
return s === void 0 || s === n ? e : s;
}
function XC(n, A, e) {
if (A.length === 0)
return;
let i = n, s = A[A.length - 1];
if (A.length === 1)
return Q(i) ? i[s] = e : void 0;
for (let o = 0; o < A.length - 1; o++) {
let r = A[o];
(!ZC.call(i, r) || !Q(i[r])) && (i[r] = {}), i = i[r];
}
return i[s] = e;
}
function Dh(n, A) {
let e = Object.getPrototypeOf(A);
for (; n--; ) e = Object.getPrototypeOf(e);
return e;
}
function ph(n, A, e = 3) {
(!K(e) || e < 1) && (e = 3);
for (let i = e; i >= 0; i--)
if (Dh(i, A)[n]) return !0;
return !1;
}
function ce(n, A) {
return !Q(n) || !Q(A) ? A : (Object.keys(A).forEach((e) => {
const i = n[e], s = A[e];
N(i) && N(s) ? n[e] = ce(i.concat([]), s) : Q(i) && Q(s) ? n[e] = ce(Object.assign({}, i), s) : n[e] = s;
}), n);
}
function ao(n) {
if (n === null || typeof n != "object")
return n;
let A;
n instanceof Date ? A = new n.constructor() : A = N(n) ? [] : {};
for (let e in n)
Object.prototype.hasOwnProperty.call(n, e) && (typeof n[e] != "object" || n[e] === n ? A[e] = n[e] : A[e] = ao(n[e]));
return A;
}
function sA(n) {
try {
return structuredClone(n);
} catch {
return ao(n);
}
}
function yh(n, A) {
if (n == null)
return String(n);
switch (typeof n) {
case "string":
return '"' + n + '"';
case "function":
return n.toString();
case "object":
let e = Array(A || 1).join(" "), i = Array.isArray(n);
return "{["[+i] + Object.keys(n).map(function(s) {
return `
` + e + s + ": " + yh(n[s], (A || 1) + 1);
}).join(",") + `
` + e + "}]"[+i];
default:
return n.toString();
}
}
function wh(n, A) {
if (Q(n))
for (let e in n)
typeof n[e] == "object" && n[e] !== null ? wh(n[e], A) : n.hasOwnProperty(e) && A(e, n[e]);
}
const fh = (n, A, e) => {
if (n.Id === A)
return e(n);
for (let i in n)
n[i] !== null && typeof n[i] == "object" && (n[i] = fh(n[i], A, e));
return n;
};
function jC(n, A) {
n.split(".");
}
function Io(n, A, e) {
const [i, ...s] = A.split(".");
return {
...n,
[i]: s.length ? Io(n[i], s.join("."), e) : e
};
}
function Fn(n, A) {
return A.split(".").reduce((i, s) => i && i[s] !== "undefined" ? i[s] : void 0, n);
}
class $C {
constructor() {
this.nodes = [];
}
get size() {
return this.nodes.length;
}
get head() {
return this.size ? this.nodes[0] : null;
}
get tail() {
return this.size ? this.nodes[this.size - 1] : null;
}
insertAt(A, e) {
const i = this.nodes[A - 1] || null, s = this.nodes[A] || null, o = { value: e, next: s, previous: i };
i && (i.next = o), s && (s.previous = o), this.nodes.splice(A, 0, o);
}
insertFirst(A) {
this.insertAt(0, A);
}
insertLast(A) {
this.insertAt(this.size, A);
}
getAt(A) {
return this.nodes[A];
}
removeAt(A) {
const e = this.nodes[A - 1] || null, i = this.nodes[A + 1] || null;
return e && (e.next = i), i && (i.previous = e), this.nodes.splice(A, 1);
}
clear() {
this.nodes = [];
}
reverse() {
this.nodes = this.nodes.reduce((A, { value: e }) => {
const i = A[0] || null, s = { value: e, next: i, previous: null };
return i && (i.previous = s), [s, ...A];
}, []);
}
*[Symbol.iterator]() {
yield* this.nodes;
}
}
function ms(n, A) {
if (!N(n) || !N(A) || n.length !== A.length) return !1;
let e = n.length;
for (; e--; ) {
if (N(n[e]) || N(A[e])) {
if (!ms(n[e], A[e])) return !1;
continue;
}
if (Q(n[e]) || Q(n[e])) {
if (!Bt(n[e], A[e])) return !1;
continue;
}
if (n[e] !== A[e]) return !1;
}
return !0;
}
function zC(n, A) {
let e = 1 / 0, i = -1, s = null, o = 0;
for (; o++ < A.length; ) {
let r = A[o], a = Math.abs(r - n);
a < e && (e = a, i = o, s = r);
}
return [i, s];
}
function Mh(n, A, e) {
let i = n[A];
n.splice(A, 1), n.splice(e, 0, i);
}
function Sh(n, A, e) {
[n[A], n[e]] = [n[e], n[A]];
}
function Ds(n, A) {
return N(A) ? N(n) ? n.every((e) => A.includes(e)) : A.includes(n) : !1;
}
const AE = (n) => [...new Set(n)], eE = (n, A) => Object.values(n.reduce((e, i) => (e[A(i)] = i, e), {})), tE = (n, A) => n.filter((e) => A.includes(e)), pi = (n, A) => n.filter((e) => !A.includes(e)), iE = (n, A) => pi(n, A).concat(pi(A, n)), sE = (n, A) => pi(n, A).concat(A);
function nE(n) {
return !(!Q(n) || Object.keys.length);
}
function Rh(n) {
return Q(n) ? !!Object.keys(n).length : !1;
}
function Bt(n, A) {
if (!Q(n) || !Q(A)) return !1;
const e = Object.keys(n).sort(), i = Object.keys(A).sort();
return e.length !== i.length ? !1 : e.every((o, r) => {
const a = n[o], I = A[i[r]];
return N(a) || N(I) ? ms(a, I) : Q(a) || Q(I) ? Bt(a, I) : a === I;
});
}
function uA(n = "ID") {
K(n) ? n = n.toString() : R(n) || (n = "ID"), n = Re(n);
const A = Date.now().toString(36), e = Math.random().toString(36).substring(2, 5);
return `${n}_${A}_${e}`;
}
function Re(n) {
return String(n).replace(/ |,|;|:|\.|#/g, "_");
}
function oE(n, A, e) {
A = A || "", e = e || 512;
let i = atob(n), s = [];
for (let r = 0; r < i.length; r += e) {
let a = i.slice(r, r + e), I = new Array(a.length);
for (let E = 0; E < a.length; E++)
I[E] = a.charCodeAt(E);
let l = new Uint8Array(I);
s.push(l);
}
return new Blob(s, { type: A });
}
function rE(n, A) {
return A instanceof Map ? {
dataType: "Map",
value: [...A.entries()]
} : A;
}
function aE(n, A) {
return typeof A == "object" && A !== null && A.dataType === "Map" ? new Map(A.value) : A;
}
const Lh = (n) => n.entries().next().value, Gh = (n) => n.entries().next().value[0], Nh = (n) => n.entries().next().value[1], Kh = (n) => [...n].pop(), Fh = (n) => [...n.keys()].pop(), bh = (n) => [...n.values()].pop();
class QA extends Map {
constructor(A) {
super(A);
}
indexOfKey(A) {
return [...this.keys()].indexOf(A);
}
indexOfValue(A) {
return [...this.values()].indexOf(A);
}
entryAtIndex(A) {
return [...this.entries()][A];
}
keyAtIndex(A) {
return [...this.keys()][A];
}
valueAtIndex(A) {
return [...this.values()][A];
}
insert(A, e, i) {
return this.insertIndex(i, A, e);
}
remove(A) {
return this.removeIndex(A);
}
firstEntry() {
return Lh(this);
}
firstKey() {
return Gh(this);
}
firstValue() {
return Nh(this);
}
lastEntry() {
return Kh(this);
}
lastKey() {
return Fh(this);
}
lastValue() {
return bh(this);
}
prevCurrNext(A) {
let e = curr = next = null;
for (let i of this)
if (e = curr, curr = i, i.key == A) break;
return { prev: e, curr, next };
}
union(...A) {
if (typeof super.prototype.union == "function")
super.union(...A);
else
for (const e of A)
for (const i of e)
this.set(...i);
}
setMultiple(A) {
return N(A) ? (A.forEach(([e, i]) => this.set(e, i)), !0) : !1;
}
populate(A) {
return N(A) ? (this.clear(), A.forEach(([e, i]) => this.set(e, i)), !0) : !1;
}
insertIndex(A, e, i) {
if (!K(A)) return !1;
const s = [...this];
return s.splice(A, 0, [e, i]), this.populate(s), !0;
}
removeIndex(A) {
if (!K(A)) return !1;
const e = [...this];
return e.splice(A, 1), this.populate(e), !0;
}
swapIndices(A, e) {
if (!K(A) || !K(e)) return !1;
const i = [...this];
return Sh(i, A, e), this.populate(i), !0;
}
swapKeys(A, e) {
const i = [...this], s = i.findIndex(([r]) => r === A), o = i.findIndex(([r]) => r === e);
return [i[s], i[o]] = [i[o], i[s]], this.clear(), i.forEach(([r, a]) => this.set(r, a)), !0;
}
}
function qA(n, A = 100, e, i = !1) {
let s;
return function() {
let o = e || this, r = arguments, a = function() {
s = null, i || n.apply(o, r);
}, I = i && !s;
clearTimeout(s), s = setTimeout(a, A), I && n.apply(o, r);
};
}
function kh(n, A = 250, e) {
let i, s, o = function() {
let a = e || this, I = /* @__PURE__ */ new Date(), l = arguments;
i && I < i + A ? (clearTimeout(s), s = setTimeout(function() {
i = I, n.apply(a, l);
}, A)) : (i = I, n.apply(a, l));
};
function r() {
timeout && (clearTimeout(s), timeout = void 0);
}
return o.reset = function() {
r(), i = 0;
}, o;
}
const IE = (n, ...A) => {
class e extends n {
constructor(...o) {
super(...o), A.forEach((r) => {
i(this, new r());
});
}
}
let i = (s, o) => {
Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o)).forEach((r) => {
r.match(/^(?:constructor|prototype|arguments|caller|name|bind|call|apply|toString|length)$/) || Object.defineProperty(s, r, Object.getOwnPropertyDescriptor(o, r));
});
};
return A.forEach((s) => {
i(e.prototype, s.prototype), i(e, s);
}), e;
};
function gE(n) {
const A = {};
return Promise.race([n, A]).then((e) => e === A ? "pending" : "fulfilled", () => "rejected");
}
class hE {
constructor() {
this.promise = new Promise((A, e) => {
this.resolve = A, this.reject = e;
});
}
}
function Th(n) {
return String.fromCharCode.apply(null, new Uint16Array(n));
}
function vh(n) {
let A = new ArrayBuffer(n.length * 2), e = new Uint16Array(A);
for (let i = 0, s = n.length; i < s; i++)
e[i] = n.charCodeAt(i);
return A;
}
function lE(n) {
const A = document.createElement("canvas"), e = A.getContext("2d");
let i;
n.isView(n) ? i = n : typeof n == "string" && (i = vh(n));
const s = new Uint8ClampedArray.from(i), o = s.length;
A.height = 1, A.width = o, e.putImageData(s);
const r = e.toDataURL(), a = getBase64StringFromDataURL(r);
return { dataURL: r, base64: a };
}
function CE(n, A, e = "string") {
const i = new Image(), s = document.createElement("canvas").getContext("2d");
return i.src = n, i.decode().then(() => {
s.width = i.width, s.height = i.height, s.drawImage(i, 0, 0);
const o = s.getImageData(0, 0, i.width, i.height).data, r = e === "string" ? Th(o) : o;
A(r);
});
}
class pA {
static #A = new QA();
static get entries() {
return pA.#A;
}
static isValid(A, e, i, s) {
return !Q(A) || !dA(e) || !R(i) || !O(s);
}
static add(A, e, i, s) {
if (!this.isValid(A, e, i, s)) return !1;
e.addEventListener(i, s), pA.#A.has(A) || pA.#A.set(A, new QA());
const o = pA.#A.get(A);
o.has(e) || o.set(e, {});
const r = o.get(e);
return N(r[i]) || (r[i] = []), r[i].push(s), !0;
}
static remove(A, e, i, s) {
if (!pA.isValid(A, e, i, s) || !pA.#A.has(A)) return !1;
const o = pA.#A.get(A);
if (!o.has(e)) return !1;
const r = o.get(e);
if (!(i in r)) return !1;
const a = r[i].indexOf(s);
return a < 0 ? !1 : (r[i].splice(a, 1), r[i].length == 0 && delete r[i], Object.keys(r).length == 0 && o.delete(e), o.size == 0 && pA.#A.delete(A), !0);
}
static expungeEvent(A, e, i) {
if (!Q(A) || !dA(e) || !R(i))
return !1;
const s = pA.#A.get(A);
if (!s.has(e)) return !1;
const o = s.get(e);
if (i in o) {
for (let r of o[i])
e.removeEventListener(i, r);
delete o[i];
}
return !0;
}
static expungeElement(A, e) {
if (!Q(A) || !dA(e))
return !1;
const i = pA.#A.get(A);
if (i.has(e)) {
let s = i.get(e);
for (let o in s)
pA.expungeEvent(A, e, o);
i.delete(e);
}
return !0;
}
static expungeContext(A) {
if (!Q(A))
return !1;
if (pA.#A.has(A)) {
const e = pA.#A.get(A);
for (let i of e)
pA.expungeElement(A, i);
pA.#A.delete(A);
}
return !0;
}
static expungeAll() {
}
static destroy() {
for (let A of pA.#A)
pA.expungeContext(A);
return pA.#A = void 0, !0;
}
}
async function EE(n, A) {
const e = (a) => new Uint8Array([...decodeURIComponent(encodeURIComponent(a))].map((I) => I.charCodeAt(0))), i = e(n), s = e(A), o = await crypto.subtle.importKey("raw", i, { name: "HMAC", hash: "SHA-256" }, !0, ["sign"]), r = await crypto.subtle.sign("HMAC", o, s);
return btoa(String.fromCharCode(...new Uint8Array(r)));
}
async function uE(n) {
const A = new TextEncoder().encode(n), e = await crypto.subtle.digest("SHA-256", A);
return Array.from(new Uint8Array(e)).map((o) => o.toString(16).padStart(2, "0")).join("");
}
function go(n, A = 0) {
let e = 3735928559 ^ A, i = 1103547991 ^ A;
for (let s = 0, o; s < n.length; s++)
o = n.charCodeAt(s), e = Math.imul(e ^ o, 2654435761), i = Math.imul(i ^ o, 1597334677);
return e = Math.imul(e ^ e >>> 16, 2246822507), e ^= Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507), i ^= Math.imul(e ^ e >>> 13, 3266489909), (i >>> 0).toString(16).padStart(8, 0) + (e >>> 0).toString(16).padStart(8, 0);
}
const CS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
Deferred: hE,
DoubleLinkedList: $C,
EventHandlers: pA,
H: uE,
HMAC: EE,
_get: VC,
_set: XC,
ab2str: Th,
arrayMove: Mh,
b64toBlob: oE,
copyDeep: ao,
cyrb53: go,
debounce: qA,
decodePNGDataStore: CE,
diff: pi,
doStructuredClone: sA,
encodePNGDataStore: lE,
extender: IE,
findInObjectById: fh,
firstEntryInMap: Lh,
firstKeyInMap: Gh,
firstValueInMap: Nh,
getProperty: Fn,
getPrototypeAt: Dh,
idSanitize: Re,
intersection: tE,
isArrayEqual: ms,
isObjectAndEmpty: nE,
isObjectEqual: Bt,
isObjectNotEmpty: Rh,
lastEntryInMap: Kh,
lastKeyInMap: Fh,
lastValueInMap: bh,
mergeDeep: ce,
nearestArrayValue: zC,
objRecurse: wh,
objRecurseUpdate: jC,
objToString: yh,
promiseState: gE,
prototypeHas: ph,
replacer: rE,
reviver: aE,
setProperty: Io,
str2ab: vh,
swapArrayElements: Sh,
symDiff: iE,
throttle: kh,
uid: uA,
union: sE,
unique: AE,
uniqueBy: eE,
valuesInArray: Ds,
xMap: QA
}, Symbol.toStringTag, { value: "Module" }));
function N(n) {
return Array.isArray(n);
}
function $e(n, A) {
return N(n) ? n.every((e) => Gi(A, e)) : !1;
}
function O(n) {
return n && typeof n == "function";
}
function Uh(n) {
return O(n) && Object.prototype.toString.call(n) === "[object AsyncFunction]";
}
function Q(n) {
return typeof n == "object" && !Array.isArray(n) && n !== null;
}
function ho(n, A, e) {
if (!Q(n) || !Q(A))
return !1;
const i = Object.keys(n), s = Object.keys(A);
if (e && !ms(i, s))
return !1;
for (let o of s)
if (!Gi(A[o], n[o])) return !1;
return !0;
}
function K(n) {
return typeof n == "number" && !isNaN(n);
}
function _(n) {
return typeof n == "number" && Math.abs(n % 1) === 0;
}
function Ph(n) {
return n != null;
}
function gA(n) {
return typeof n == "boolean";
}
function R(n) {
return typeof n == "string";
}
function Oh(n) {
return n instanceof Map;
}
function ps(n) {
return !!n && (Q(n) || O(n)) && O(n.then) && n[Symbol.toStringTag] === "Promise";
}
function xh(n) {
return n instanceof Error;
}
function ze(n) {
return !(n && n.constructor === Function) || n.prototype === void 0 || Object.getOwnPropertyNames(n).includes("arguments") ? !1 : Function.prototype !== Object.getPrototypeOf(n) ? !0 : Object.getOwnPropertyNames(n.prototype).length > 1;
}
const qh = [
"array",
"error",
"class",
"function",
"asyncfunction",
"map",
"promise",
"object",
"integer",
"number",
"boolean",
"string"
];
function Gi(n, A) {
const e = [...qh, "valid"];
if (A == null || !e.includes(n))
return !1;
switch (n) {
case "array":
return N(A);
case "asyncfunction":
return Uh(A);
case "function":
return O(A);
case "object":
return Q(A);
case "integer":
return _(A);
case "number":
return K(A);
case "valid":
return Ph(A);
case "boolean":
return gA(A);
case "string":
return R(A);
case "map":
return Oh(A);
case "promise":
return ps(A);
case "error":
return xh(A);
case "class":
return ze(A);
default:
throw new Error(`No known test for type: ${n}`);
}
}
function cE(n) {
for (let A of qh)
try {
if (Gi(A, n)) return A;
} catch {
return typeof n;
}
}
const ES = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
checkType: Gi,
isArray: N,
isArrayOfType: $e,
isAsyncFunction: Uh,
isBoolean: gA,
isClass: ze,
isError: xh,
isFunction: O,
isInteger: _,
isMap: Oh,
isNumber: K,
isObject: Q,
isObjectOfTypes: ho,
isPromise: ps,
isString: R,
isValid: Ph,
typeOf: cE
}, Symbol.toStringTag, { value: "Module" })), Jh = ["id", "class", "style", "alt", "width", "height", "title"], Hh = [...Jh, "name", "type", "value", "default", "placeholder", "max", "min", "maxlenght", "src", "checked", "disabled", "pattern", "readonly", "required", "size", "step", "multiple", "autofocus", "list", "autocomplete"], BE = ["button", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week"];
function QE(n, A = document) {
return A.getElementById(n);
}
function dE(n, A = document) {
return A.getElementsByClassName(n);
}
function mE(n, A = document) {
return A.getElementsByName(n);
}
function DE(n, A = document) {
return A.getElementsByTagName(n);
}
function _h(n, A = document) {
return A.querySelector(n);
}
function Wh(n, A = document) {
return A.querySelectorAll(n);
}
function pE(n) {
return typeof Node == "object" ? n instanceof Node : n && typeof n == "object" && typeof n.nodeType == "number" && typeof n.nodeName == "string";
}
function dA(n) {
return typeof HTMLElement == "object" ? n instanceof HTMLElement : n && typeof n == "object" && n !== null && n.nodeType === 1 && typeof n.nodeName == "string";
}
function Dt(n) {
return dA(n) ? !!n && !!(n.offsetWidth || n.offsetHeight || n.getClientRects().length) : !1;
}
function lo(n) {
if (!dA(n)) return !1;
const A = n.getBoundingClientRect();
return A.top >= 0 && A.left >= 0 && A.bottom <= (window.innerHeight || document.documentElement.clientHeight) && A.right <= (window.innerWidth || document.documentElement.clientWidth);
}
function yE(n) {
if (!dA(n)) return !1;
const A = getComputedStyle(n);
if (A.display === "none" || A.visibility !== "visible" || parseFloat(A.opacity) < 0.1 || n.offsetWidth + n.offsetHeight + n.getBoundingClientRect().height + n.getBoundingClientRect().width === 0)
return !1;
const e = {
x: n.getBoundingClientRect().left + n.offsetWidth / 2,
y: n.getBoundingClientRect().top + n.offsetHeight / 2
};
if (e.x < 0 || e.x > (document.documentElement.clientWidth || window.innerWidth) || e.y < 0 || e.y > (document.documentElement.clientHeight || window.innerHeight))
return !1;
let i = document.elementFromPoint(e.x, e.y);
do
if (i === elem) return !0;
while (i = i.parentNode);
return !1;
}
function Co(n, A) {
if (Eo(n)) {
var e = window.URL || window.webkitURL || window;
n = new Blob([n], { type: "image/svg+xml" }), n = e.createObjectURL(n);
}
const i = new Image();
if (i.src = n, O(A))
i.complete ? A(i) : (i.onload = () => A(i), i.onerror = () => A(!1));
else
return new Promise(function(s, o) {
i.complete ? s(i) : (i.onload = () => s(i), i.onerror = () => o(!1));
});
}
function Eo(n) {
return R(n) ? /<\s*svg[^>]*>(.*?)<\s*\/\s*svg>/.test(n) : !1;
}
function wE(n) {
return new Promise((A) => {
if (document.querySelector(n))
return A(document.querySelector(n));
const e = new MutationObserver((i) => {
document.querySelector(n) && (e.disconnect(), A(document.querySelector(n)));
});
e.observe(document.body, {
childList: !0,
subtree: !0
});
});
}
function JA(n) {
if (!dA(n)) return !1;
let A = 0, e = 0, i = n;
for (; i && i.tagName.toLowerCase() != "body" && !isNaN(i.offsetLeft) && !isNaN(i.offsetTop); )
A += i.offsetLeft - i.scrollLeft, e += i.offsetTop - i.scrollTop, i = i.offsetParent;
const s = n.getBoundingClientRect();
let o = s.right - s.left, r = s.bottom - s.top, a = Dt(n), I = lo(n);
return {
top: e,
bottom: e + r,
left: A,
right: A + o,
width: o,
height: r,
visible: a,
viewport: I
};
}
function fE(n, A) {
if (!dA(n) || !dA(n)) return !1;
const e = JA(n), i = JA(A);
return {
x: e.top - i.top,
y: e.left - i.left,
el1Location: e,
el2Location: i
};
}
function Yh(n) {
if (!R(n)) return !1;
const A = document.createElement("template");
return n = n.trim(), A.innerHTML = n, A.content.firstChild;
}
function ME(n) {
if (!R(n)) return !1;
const A = document.createElement("template");
return A.innerHTML = n, A.content.childNodes;
}
function Is(n, A, e) {
if (!Eo(n) || !K(e?.w) || !K(e?.h))
return !1;
let i = e.w, s = e.h, o = document.createElement("canvas");
o.width = i, o.height = s;
let r = Yh(n);
r.style.fill = A, r.setAttribute("width", i), r.setAttribute("height", s), r.xmlns = "http://www.w3.org/2000/svg";
let a = new XMLSerializer().serializeToString(r), E = "data:image/svg+xml;base64," + btoa(a), f = new Image();
return f.setAttribute("width", i), f.setAttribute("height", s), f.onload = () => {
o.getContext("2d").drawImage(f, 0, 0, i, s);
}, f.src = E, f;
}
function SE(n) {
if (!dA(n)) return !1;
const A = (i) => {
!n.contains(i.target) && Dt(n) && (n.style.display = "none", e());
}, e = () => {
document.removeEventListener("click", A);
};
document.addEventListener("click", A);
}
function RE(n, A) {
if (!dA(n)) return !1;
const e = (s) => {
!n.contains(s.target) && Dt(n) && (A(), i());
}, i = () => {
document.removeEventListener("click", e);
};
document.addEventListener("click", e);
}
function Zh(n, A) {
let e, i;
if (R(n)) e = document.getElementById(n);
else if (dA(n)) e = n;
else return !1;
const s = (e.ownerDocument || document).defaultView;
return R(A) ? (s && s.getComputedStyle ? (A = A.replace(/([A-Z])/g, "-$1").toLowerCase(), i = document.defaultView.getComputedStyle(e, null).getPropertyValue(A)) : e.currentStyle && (i = e.currentStyle[A]), i) : !1;
}
function LE(n, A, e, i) {
let s = uo(n, A, e, i);
if (s) s.i >= 0 ? s.rules[s.i].style[s.property] = s.value : Xh(s.styleSheet, s.selector, s.rules, s.index);
else return;
}
function GE(n, A, e) {
let i = uo(n, A, e, "");
(i.styleSheet.deleteRule || i.styleSheet.removeRule)(i.i);
}
function uo(n, A, e, i) {
if (!n || !Q(n)) return null;
if (n.constructor.name == "HTMLStyleElement")
n = n.sheet;
else if (n.constructor.name != "CSSStyleSheet") return null;
let s = Vh(A, e, i);
A = s[0], e = s[1], i = s[2];
const o = n.cssRules || n.rules;
for (var r = o.length - 1; r > 0 && o[r].selectorText !== A; --r)
;
return { styleSheet: n, rules: o, selector: A, property: e, value: i, i: r };
}
function Vh(n, A, e) {
return [
n = n.toLowerCase().replace(/\s+/g, " "),
A = A.toLowerCase(),
e = e.toLowerCase()
];
}
function Xh(n, A, e, i) {
n.insertRule ? n.insertRule(A + "{" + e + "}", i) : n.addRule(A, e, i);
}
function co(n, A) {
return !dA(n) || !R(A) ? null : n.classList.contains(A) ? n : co(n.parentElement, A);
}
function jh(n, A) {
let e = R(A?.entry) ? A?.entry : "", s = `${R(n) ? `<label for="${e}">${n}</label>` : ""}<input id="${e}" class="subject" `;
for (let o in A)
(Hh.includes(o) || /^(data-[^\t\n\f \/>"'=]+)/g.test(o)) && (s += `${o}="${A[o]}" `);
return s += `>
`;
}
function NE(n, A) {
let e = R(A?.entry) ? A?.entry : "", i = R(n) ? `<label for="${e}">${n}</label>` : "", s = "";
for (let r in A?.options)
s += `<option value="${A.options[r]}">${r}</option>`;
return `${i}<select id="${e}" class="subject">${s}</select>
`;
}
function $h(n) {
return new Promise((A) => {
let e = new FileReader();
e.onload = () => A(e.result), e.readAsDataURL(n);
});
}
const uS = {
addCSSRule: Xh,
addStyleRule: LE,
blobToDataURL: $h,
deleteStyleRule: GE,
elementDimPos: JA,
elementsDistance: fE,
findByClass: dE,
findByID: QE,
findByName: mE,
findBySelector: _h,
findBySelectorAll: Wh,
findStyleRule: uo,
findTargetParentWithClass: co,
fndByTag: DE,
getStyle: Zh,
hideOnClickOutside: SE,
htmlAttr: Jh,
htmlInput: jh,
htmlToElement: Yh,
htmlToElements: ME,
inputAttr: Hh,
inputTypes: BE,
isHTMLElement: dA,
isImage: Co,
isInViewport: lo,
isNode: pE,
isSVG: Eo,
isVisible: Dt,
isVisibleToUser: yE,
onClickOutside: RE,
styleRuleSanitize: Vh,
svgToImage: Is,
waitForElm: wE
}, KE = typeof window < "u" && typeof window.document < "u";
typeof process < "u" && process.versions != null && process.versions.node != null;
typeof window < "u" && window.name === "nodejs" || typeof navigator < "u" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
const FE = ((n) => typeof n < "u" && ("onorientationchange" in n || typeof n.matchMedia == "function" && n.matchMedia("(any-pointer:coarse)").matches || typeof navigator < "u" && (navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0 || "ontouchstart" in n || n.DocumentTouch && document instanceof n.DocumentTouch)))(typeof window < "u" ? window : {}), bE = {
idle: 0
};
class lt {
#A = 0;
#e = 0;
constructor() {
if (arguments.length === 1) {
const { x: A, y: e } = arguments[0];
this.x = A || 0, this.y = e || 0;
} else if (arguments.length > 1) {
const [A, e] = arguments;
this.x = A || 0, this.y = e || 0;
}
}
set x(A) {
K(A) && (this.#A = A);
}
get x() {
return this.#A;
}
set y(A) {
K(A) && (this.#e = A);
}
get y() {
return this.#e;
}
clone() {
return new lt(this.x, this.y);
}
}
function kE(n) {
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
}
var js = { exports: {} };
/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */
var Ag;
function TE() {
return Ag || (Ag = 1, function(n) {
(function(A, e, i, s) {
var o = ["", "webkit", "Moz", "MS", "ms", "o"], r = e.createElement("div"), a = "function", I = Math.round, l = Math.abs, E = Date.now;
function f(g, C, u) {
return setTimeout(iA(g, u), C);
}
function L(g, C, u) {
return Array.isArray(g) ? (M(g, u[C], u), !0) : !1;
}
function M(g, C, u) {
var p;
if (g)
if (g.forEach)
g.forEach(C, u);
else if (g.length !== s)
for (p = 0; p < g.length; )
C.call(u, g[p], p, g), p++;
else
for (p in g)
g.hasOwnProperty(p) && C.call(u, g[p], p, g);
}
function T(g, C, u) {
var p = "DEPRECATED METHOD: " + C + `
` + u + ` AT
`;
return function() {
var G = new Error("get-stack-trace"), k = G && G.stack ? G.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace", Z = A.console && (A.console.warn || A.console.log);
return Z && Z.call(A.console, p, k), g.apply(this, arguments);
};
}
var U;
typeof Object.assign != "function" ? U = function(C) {
if (C === s || C === null)
throw new TypeError("Cannot convert undefined or null to object");
for (var u = Object(C), p = 1; p < arguments.length; p++) {
var G = arguments[p];
if (G !== s && G !== null)
for (var k in G)
G.hasOwnProperty(k) && (u[k] = G[k]);
}
return u;
} : U = Object.assign;
var V = T(function(C, u, p) {
for (var G = Object.keys(u), k = 0; k < G.length; )
(!p || p && C[G[k]] === s) && (C[G[k]] = u[G[k]]), k++;
return C;
}, "extend", "Use `assign`."), X = T(function(C, u) {
return V(C, u, !0);
}, "merge", "Use `assign`.");
function H(g, C, u) {
var p = C.prototype, G;
G = g.prototype = Object.create(p), G.constructor = g, G._super = p, u && U(G, u);
}
function iA(g, C) {
return function() {
return g.apply(C, arguments);
};
}
function z(g, C) {
return typeof g == a ? g.apply(C && C[0] || s, C) : g;
}
function cA(g, C) {
return g === s ? C : g;
}
function AA(g, C, u) {
M(_A(C), function(p) {
g.addEventListener(p, u, !1);
});
}
function wA(g, C, u) {
M(_A(C), function(p) {
g.removeEventListener(p, u, !1);
});
}
function BA(g, C) {
for (; g; ) {
if (g == C)
return !0;
g = g.parentNode;
}
return !1;
}
function RA(g, C) {
return g.indexOf(C) > -1;
}
function _A(g) {
return g.trim().split(/\s+/g);
}
function LA(g, C, u) {
if (g.indexOf && !u)
return g.indexOf(C);
for (var p = 0; p < g.length; ) {
if (u && g[p][u] == C || !u && g[p] === C)
return p;
p++;
}
return -1;
}
function j(g) {
return Array.prototype.slice.call(g, 0);
}
function eA(g, C, u) {
for (var p = [], G = [], k = 0; k < g.length; ) {
var Z = g[k][C];
LA(G, Z) < 0 && p.push(g[k]), G[k] = Z, k++;
}
return p = p.sort(function(hA, GA) {
return hA[C] > GA[C];
}), p;
}
function WA(g, C) {
for (var u, p, G = C[0].toUpperCase() + C.slice(1), k = 0; k < o.length; ) {
if (u = o[k], p = u ? u + G : C, p in g)
return p;
k++;
}
return s;
}
var Ki = 1;
function wt() {
return Ki++;
}
function le(g) {
var C = g.ownerDocument || g;
return C.defaultView || C.parentWindow || A;
}
var bs = /mobile|tablet|ip(ad|hone|od)|android/i, Fi = "ontouchstart" in A, ks = WA(A, "PointerEvent") !== s, Ts = Fi && bs.test(navigator.userAgent), Oe = "touch", bi = "pen", zt = "mouse", ki = "kinect", vs = 25, FA = 1, Be = 2, EA = 4, fA = 8, xe = 1, te = 2, Qe = 4, At = 8, Le = 16, mA = te | Qe, de = At | Le, ft = mA | de, Ti = ["x", "y"], et = ["clientX", "clientY"];
function TA(g, C) {
var u = this;
this.manager = g, this.callback = C, this.element = g.element, this.target = g.options.inputTarget, this.domHandler = function(p) {
z(g.options.enable, [g]) && u.handler(p);
}, this.init();
}
TA.prototype = {
handler: function() {
},
init: function() {
this.evEl && AA(this.element, this.evEl, this.domHandler), this.evTarget && AA(this.target, this.evTarget, this.domHandler), this.evWin && AA(le(this.element), this.evWin, this.domHandler);
},
destroy: function() {
this.evEl && wA(this.element, this.evEl, this.domHandler), this.evTarget && wA(this.target, this.evTarget, this.domHandler), this.evWin && wA(le(this.element), this.evWin, this.domHandler);
}
};
function Us(g) {
var C, u = g.options.inputClass;
return u ? C = u : ks ? C = Je : Ts ? C = Lt : Fi ? C = ti : C = st, new C(g, Ps);
}
function Ps(g, C, u) {
var p = u.pointers.length, G = u.changedPointers.length, k = C & FA && p - G === 0, Z = C & (EA | fA) && p - G === 0;
u.isFirst = !!k, u.isFinal = !!Z, k && (g.session = {}), u.eventType = C, Os(g, u), g.emit("hammer.input", u), g.recognize(u), g.session.prevInput = u;
}
function Os(g, C) {
var u = g.session, p = C.pointers, G = p.length;
u.firstInput || (u.firstInput = vi(C)), G > 1 && !u.firstMultiple ? u.firstMultiple = vi(C) : G === 1 && (u.firstMultiple = !1);
var k = u.firstInput, Z = u.firstMultiple, DA = Z ? Z.center : k.center, hA = C.center = Ui(p);
C.timeStamp = E(), C.deltaTime = C.timeStamp - k.timeStamp, C.angle = Mt(DA, hA), C.distance = tt(DA, hA), xs(u, C), C.offsetDirection = qe(C.deltaX, C.deltaY);
var GA = Ce(C.deltaTime, C.deltaX, C.deltaY);
C.overallVelocityX = GA.x, C.overallVelocityY = GA.y, C.overallVelocity = l(GA.x) > l(GA.y) ? GA.x : GA.y, C.scale = Z ? Js(Z.pointers, p) : 1, C.rotation = Z ? it(Z.pointers, p) : 0, C.maxPointers = u.prevInput ? C.pointers.length > u.prevInput.maxPointers ? C.pointers.length : u.prevInput.maxPointers : C.pointers.length, qs(u, C);
var $A = g.element;
BA(C.srcEvent.target, $A) && ($A = C.srcEvent.target), C.target = $A;
}
function xs(g, C) {
var u = C.center, p = g.offsetDelta || {}, G = g.prevDelta || {}, k = g.prevInput || {};
(C.eventType === FA || k.eventType === EA) && (G = g.prevDelta = {
x: k.deltaX || 0,
y: k.deltaY || 0
}, p = g.offsetDelta = {
x: u.x,
y: u.y
}), C.deltaX = G.x + (u.x - p.x), C.deltaY = G.y + (u.y - p.y);
}
function qs(g, C) {
var u = g.lastInterval || C, p = C.timeStamp - u.timeStamp, G, k, Z, DA;
if (C.eventType != fA && (p > vs || u.velocity === s)) {
var hA = C.deltaX - u.deltaX, GA = C.deltaY - u.deltaY, $A = Ce(p, hA, GA);
k = $A.x, Z = $A.y, G = l($A.x) > l($A.y) ? $A.x : $A.y, DA = qe(hA, GA), g.lastInterval = C;
} else
G = u.velocity, k = u.velocityX, Z = u.velocityY, DA = u.direction;
C.velocity = G, C.velocityX = k, C.velocityY = Z, C.direction = DA;
}
function vi(g) {
for (var C = [], u = 0; u < g.pointers.length; )
C[u] = {
clientX: I(g.pointers[u].clientX),
clientY: I(g.pointers[u].clientY)
}, u++;
return {
timeStamp: E(),
pointers: C,
center: Ui(C),
deltaX: g.deltaX,
deltaY: g.deltaY
};
}
function Ui(g) {
var C = g.length;
if (C === 1)
return {
x: I(g[0].clientX),
y: I(g[0].clientY)
};
for (var u = 0, p = 0, G = 0; G < C; )
u += g[G].clientX, p += g[G].clientY, G++;
return {
x: I(u / C),
y: I(p / C)
};
}
function Ce(g, C, u) {
return {
x: C / g || 0,
y: u / g || 0
};
}
function qe(g, C) {
return g === C ? xe : l(g) >= l(C) ? g < 0 ? te : Qe : C < 0 ? At : Le;
}
function tt(g, C, u) {
u || (u = Ti);
var p = C[u[0]] - g[u[0]], G = C[u[1]] - g[u[1]];
return Math.sqrt(p * p + G * G);
}
function Mt(g, C, u) {
u || (u = Ti);
var p = C[u[0]] - g[u[0]], G = C[u[1]] - g[u[1]];
return Math.atan2(G, p) * 180 / Math.PI;
}
function it(g, C) {
return Mt(C[1], C[0], et) + Mt(g[1], g[0], et);
}
function Js(g, C) {
return tt(C[0], C[1], et) / tt(g[0], g[1], et);
}
var Pi = {
mousedown: FA,
mousemove: Be,
mouseup: EA
}, Oi = "mousedown", vA = "mousemove mouseup";
function st() {
this.evEl = Oi, this.evWin = vA, this.pressed = !1, TA.apply(this, arguments);
}
H(st, TA, {
handler: function(C) {
var u = Pi[C.type];
u & FA && C.button === 0 && (this.pressed = !0), u & Be && C.which !== 1 && (u = EA), this.pressed && (u & EA && (this.pressed = !1), this.callback(this.manager, u, {
pointers: [C],
changedPointers: [C],
pointerType: zt,
srcEvent: C
}));
}
});
var Hs = {
pointerdown: FA,
pointermove: Be,
pointerup: EA,
pointercancel: fA,
pointerout: fA
}, _s = {
2: Oe,
3: bi,
4: zt,
5: ki
}, bA = "pointerdown", nt = "pointermove pointerup pointercancel";
A.MSPointerEvent && !A.PointerEvent && (bA = "MSPointerDown", nt = "MSPointerMove MSPointerUp MSPointerCancel");
function Je() {
this.evEl = bA, this.evWin = nt, TA.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
}
H(Je, TA, {
handler: function(C) {
var u = this.store, p = !1, G = C.type.toLowerCase().replace("ms", ""), k = Hs[G], Z = _s[C.pointerType] || C.pointerType, DA = Z == Oe, hA = LA(u, C.pointerId, "pointerId");
k & FA && (C.button === 0 || DA) ? hA < 0 && (u.push(C), hA = u.length - 1) : k & (EA | fA) && (p = !0), !(hA < 0) && (u[hA] = C, this.callback(this.manager, k, {
pointers: u,
changedPointers: [C],
pointerType: Z,
srcEvent: C
}), p && u.splice(hA, 1));
}
});
var xi = {
touchstart: FA,
touchmove: Be,
touchend: EA,
touchcancel: fA
}, St = "touchstart", Ws = "touchstart touchmove touchend touchcancel";
function Ai() {
this.evTarget = St, this.evWin = Ws, this.started = !1, TA.apply(this, arguments);
}
H(Ai, TA, {
handler: function(C) {
var u = xi[C.type];
if (u === FA && (this.started = !0), !!this.started) {
var p = ei.call(this, C, u);
u & (EA | fA) && p[0].length - p[1].length === 0 && (this.started = !1), this.callback(this.manager, u, {
pointers: p[0],
changedPointers: p[1],
pointerType: Oe,
srcEvent: C
});
}
}
});
function ei(g, C) {
var u = j(g.touches), p = j(g.changedTouches);
return C & (EA | fA) && (u = eA(u.concat(p), "identifier")), [u, p];
}
var Rt = {
touchstart: FA,
touchmove: Be,
touchend: EA,
touchcancel: fA
}, Ys = "touchstart touchmove touchend touchcancel";
function Lt() {
this.evTarget = Ys, this.targetIds = {}, TA.apply(this, arguments);
}
H(Lt, TA, {
handler: function(C) {
var u = Rt[C.type], p = Zs.call(this, C, u);
p && this.callback(this.manager, u, {
pointers: p[0],
changedPointers: p[1],
pointerType: Oe,
srcEvent: C
});
}
});
function Zs(g, C) {
var u = j(g.touches), p = this.targetIds;
if (C & (FA | Be) && u.length === 1)
return p[u[0].identifier] = !0, [u, u];
var G, k, Z = j(g.changedTouches), DA = [], hA = this.target;
if (k = u.filter(function(GA) {
return BA(GA.target, hA);
}), C === FA)
for (G = 0; G < k.length; )
p[k[G].identifier] = !0, G++;
for (G = 0; G < Z.length; )
p[Z[G].identifier] && DA.push(Z[G]), C & (EA | fA) && delete p[Z[G].identifier], G++;
if (DA.length)
return [
eA(k.concat(DA), "identifier"),
DA
];
}
var Gt = 2500, qi = 25;
function ti() {
TA.apply(this, arguments);
var g = iA(this.handler, this);
this.touch = new Lt(this.manager, g), this.mouse = new st(this.manager, g), this.primaryTouch = null, this.lastTouches = [];
}
H(ti, TA, {
handler: function(C, u, p) {
var G = p.pointerType == Oe, k = p.pointerType == zt;
if (!(k && p.sourceCapabilities && p.sourceCapabilities.firesTouchEvents)) {
if (G)
Vs.call(this, u, p);
else if (k && Ji.call(this, p))
return;
this.callback(C, u, p);
}
},
destroy: function() {
this.touch.destroy(), this.mouse.destroy();
}
});
function Vs(g, C) {
g & FA ? (this.primaryTouch = C.changedPointers[0].identifier, ii.call(this, C)) : g & (EA | fA) && ii.call(this, C);
}
function ii(g) {
var C = g.changedPointers[0];
if (C.identifier === this.primaryTouch) {
var u = { x: C.clientX, y: C.clientY };
this.lastTouches.push(u);
var p = this.lastTouches, G = function() {
var k = p.indexOf(u);
k > -1 && p.splice(k, 1);
};
setTimeout(G, Gt);
}
}
function Ji(g) {
for (var C = g.srcEvent.clientX, u = g.srcEvent.clientY, p = 0; p < this.lastTouches.length; p++) {
var G = this.lastTouches[p], k = Math.abs(C - G.x), Z = Math.abs(u - G.y);
if (k <= qi && Z <= qi)
return !0;
}
return !1;
}
var Hi = WA(r.style, "touchAction"), si = Hi !== s, Nt = "compute", Kt = "auto", ni = "manipulation", me = "none", ot = "pan-x", rt = "pan-y", Ft = ri();
function oi(g, C) {
this.manager = g, this.set(C);
}
oi.prototype = {
set: function(g) {
g == Nt && (g = this.compute()), si && this.manager.element.style && Ft[g] && (this.manager.element.style[Hi] = g), this.actions = g.toLowerCase().trim();
},
update: function() {
this.set(this.manager.options.touchAction);
},
compute: function() {
var g = [];
return M(this.manager.recognizers, function(C) {
z(C.options.enable, [C]) && (g = g.concat(C.getTouchAction()));
}), ie(g.join(" "));
},
preventDefaults: function(g) {
var C = g.srcEvent, u = g.offsetDirection;
if (this.manager.session.prevented) {
C.preventDefault();
return;
}
var p = this.actions, G = RA(p, me) && !Ft[me], k = RA(p, rt) && !Ft[rt], Z = RA(p, ot) && !Ft[ot];
if (G) {
var DA = g.pointers.length === 1, hA = g.distance < 2, GA = g.deltaTime < 250;
if (DA && hA && GA)
return;
}
if (!(Z && k) && (G || k && u & mA || Z && u & de))
return this.preventSrc(C);
},
preventSrc: function(g) {
this.manager.session.prevented = !0, g.preventDefault();
}
};
function ie(g) {
if (RA(g, me))
return me;
var C = RA(g, ot), u = RA(g, rt);
return C && u ? me : C || u ? C ? ot : rt : RA(g, ni) ? ni : Kt;
}
function ri() {
if (!si)
return !1;
var g = {}, C = A.CSS && A.CSS.supports;
return ["auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none"].forEach(function(u) {
g[u] = C ? A.CSS.supports("touch-action", u) : !0;
}), g;
}
var He = 1, UA = 2, jA = 4, Ee = 8, YA = Ee, Ge = 16, se = 32;
function ne(g) {
this.options = U({}, this.defaults, g || {}), this.id = wt(), this.manager = null, this.options.enable = cA(this.options.enable, !0), this.state = He, this.simultaneous = {}, this.requireFail = [];
}
ne.prototype = {
defaults: {},
set: function(g) {
return U(this.options, g), this.manager && this.manager.touchAction.update(), this;
},
recognizeWith: function(g) {
if (L(g, "recognizeWith", this))
return this;
var C = this.simultaneous;
return g = kt(g, this), C[g.id] || (C[g.id] = g, g.recognizeWith(this)), this;
},
dropRecognizeWith: function(g) {
return L(g, "dropRecognizeWith", this) ? this : (g = kt(g, this), delete this.simultaneous[g.id], this);
},
requireFailure: function(g) {
if (L(g, "requireFailure", this))
return this;
var C = this.requireFail;
return g = kt(g, this), LA(C, g) === -1 && (C.push(g), g.requireFailure(this)), this;
},
dropRequireFailure: function(g) {
if (L(g, "dropRequireFailure", this))
return this;
g = kt(g, this);
var C = LA(this.requireFail, g);
return C > -1 && this.requireFail.splice(C, 1), this;
},
hasRequireFailures: function() {
return this.requireFail.length > 0;
},
canRecognizeWith: function(g) {
return !!this.simultaneous[g.id];
},
emit: function(g) {
var C = this, u = this.state;
function p(G) {
C.manager.emit(G, g);
}
u < Ee && p(C.options.event + bt(u)), p(C.options.event), g.additionalEvent && p(g.additionalEvent), u >= Ee && p(C.options.event + bt(u));
},
tryEmit: function(g) {
if (this.canEmit())
return this.emit(g);
this.state = se;
},
canEmit: function() {
for (var g = 0; g < this.requireFail.length; ) {
if (!(this.requireFail[g].state & (se | He)))
return !1;
g++;
}
return !0;
},
recognize: function(g) {
var C = U({}, g);
if (!z(this.options.enable, [this, C])) {
this.reset(), this.state = se;
return;
}
this.state & (YA | Ge | se) && (this.state = He), this.state = this.process(C), this.state & (UA | jA | Ee | Ge) && this.tryEmit(C);
},
process: function(g) {
},
getTouchAction: function() {
},
reset: function() {
}
};
function bt(g) {
return g & Ge ? "cancel" : g & Ee ? "end" : g & jA ? "move" : g & UA ? "start" : "";
}
function _i(g) {
return g == Le ? "down" : g == At ? "up" : g == te ? "left" : g == Qe ? "right" : "";
}
function kt(g, C) {
var u = C.manager;
return u ? u.get(g) : g;
}
function ZA() {
ne.apply(this, arguments);
}
H(ZA, ne, {
defaults: {
pointers: 1
},
attrTest: function(g) {
var C = this.options.pointers;
return C === 0 || g.pointers.length === C;
},
process: function(g) {
var C = this.state, u = g.eventType, p = C & (UA | jA), G = this.attrTest(g);
return p && (u & fA || !G) ? C | Ge : p || G ? u & EA ? C | Ee : C & UA ? C | jA : UA : se;
}
});
function c() {
ZA.apply(this, arguments), this.pX = null, this.pY = null;
}
H(c, ZA, {
defaults: {
event: "pan",
threshold: 10,
pointers: 1,
direction: ft
},
getTouchAction: function() {
var g = this.options.direction, C = [];
return g & mA && C.push(rt), g & de && C.push(ot), C;
},
directionTest: function(g) {
var C = this.options, u = !0, p = g.distance, G = g.direction, k = g.deltaX, Z = g.deltaY;
return G & C.direction || (C.direction & mA ? (G = k === 0 ? xe : k < 0 ? te : Qe, u = k != this.pX, p = Math.abs(g.deltaX)) : (G = Z === 0 ? xe : Z < 0 ? At : Le, u = Z != this.pY, p = Math.abs(g.deltaY))), g.direction = G, u && p > C.threshold && G & C.direction;
},
attrTest: function(g) {
return ZA.prototype.attrTest.call(this, g) && (this.state & UA || !(this.state & UA) && this.directionTest(g));
},
emit: function(g) {
this.pX = g.deltaX, this.pY = g.deltaY;
var C = _i(g.direction);
C && (g.additionalEvent = this.options.event + C), this._super.emit.call(this, g);
}
});
function B() {
ZA.apply(this, arguments);
}
H(B, ZA, {
defaults: {
event: "pinch",
threshold: 0,
pointers: 2
},
getTouchAction: function() {
return [me];
},
attrTest: function(g) {
return this._super.attrTest.call(this, g) && (Math.abs(g.scale - 1) > this.options.threshold || this.state & UA);
},
emit: function(g) {
if (g.scale !== 1) {
var C = g.scale < 1 ? "in" : "out";
g.additionalEvent = this.options.event + C;
}
this._super.emit.call(this, g);
}
});
function S() {
ne.apply(this, arguments), this._timer = null, this._input = null;
}
H(S, ne, {
defaults: {
event: "press",
pointers: 1,
time: 251,
threshold: 9
},
getTouchAction: function() {
return [Kt];
},
process: function(g) {
var C = this.options, u = g.pointers.length === C.p