UNPKG

@paresh-barik-neophyte/store-layout-mapper

Version:

A React-based image annotation tool for mapping store layouts

1,302 lines (1,300 loc) 297 kB
import * as H from "react"; import We, { useRef as Ie, useImperativeHandle as No, useEffect as Ve, useContext as zt, useState as J, useCallback as fe, forwardRef as Wn, useLayoutEffect as Xo, createContext as Fo, useMemo as at, Component as Oo, Fragment as yn, createElement as ur } from "react"; import { createPortal as Wo } from "react-dom"; function Do(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var An = { exports: {} }, pt = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var lr; function Mo() { if (lr) return pt; lr = 1; var e = We, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, r = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 }; function a(u, s, l) { var c, d = {}, p = null, g = null; l !== void 0 && (p = "" + l), s.key !== void 0 && (p = "" + s.key), s.ref !== void 0 && (g = s.ref); for (c in s) i.call(s, c) && !o.hasOwnProperty(c) && (d[c] = s[c]); if (u && u.defaultProps) for (c in s = u.defaultProps, s) d[c] === void 0 && (d[c] = s[c]); return { $$typeof: t, type: u, key: p, ref: g, props: d, _owner: r.current }; } return pt.Fragment = n, pt.jsx = a, pt.jsxs = a, pt; } var gt = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var cr; function Zo() { return cr || (cr = 1, process.env.NODE_ENV !== "production" && function() { var e = We, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), g = Symbol.for("react.offscreen"), h = Symbol.iterator, m = "@@iterator"; function v(f) { if (f === null || typeof f != "object") return null; var w = h && f[h] || f[m]; return typeof w == "function" ? w : null; } var C = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function A(f) { { for (var w = arguments.length, B = new Array(w > 1 ? w - 1 : 0), M = 1; M < w; M++) B[M - 1] = arguments[M]; y("error", f, B); } } function y(f, w, B) { { var M = C.ReactDebugCurrentFrame, ne = M.getStackAddendum(); ne !== "" && (w += "%s", B = B.concat([ne])); var se = B.map(function($) { return String($); }); se.unshift("Warning: " + w), Function.prototype.apply.call(console[f], console, se); } } var S = !1, I = !1, E = !1, x = !1, G = !1, X; X = Symbol.for("react.module.reference"); function Y(f) { return !!(typeof f == "string" || typeof f == "function" || f === i || f === o || G || f === r || f === l || f === c || x || f === g || S || I || E || typeof f == "object" && f !== null && (f.$$typeof === p || f.$$typeof === d || f.$$typeof === a || f.$$typeof === u || f.$$typeof === s || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. f.$$typeof === X || f.getModuleId !== void 0)); } function _(f, w, B) { var M = f.displayName; if (M) return M; var ne = w.displayName || w.name || ""; return ne !== "" ? B + "(" + ne + ")" : B; } function Z(f) { return f.displayName || "Context"; } function k(f) { if (f == null) return null; if (typeof f.tag == "number" && A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof f == "function") return f.displayName || f.name || null; if (typeof f == "string") return f; switch (f) { case i: return "Fragment"; case n: return "Portal"; case o: return "Profiler"; case r: return "StrictMode"; case l: return "Suspense"; case c: return "SuspenseList"; } if (typeof f == "object") switch (f.$$typeof) { case u: var w = f; return Z(w) + ".Consumer"; case a: var B = f; return Z(B._context) + ".Provider"; case s: return _(f, f.render, "ForwardRef"); case d: var M = f.displayName || null; return M !== null ? M : k(f.type) || "Memo"; case p: { var ne = f, se = ne._payload, $ = ne._init; try { return k($(se)); } catch { return null; } } } return null; } var Q = Object.assign, z = 0, j, K, oe, he, ye, Ee, q; function ae() { } ae.__reactDisabledLog = !0; function ce() { { if (z === 0) { j = console.log, K = console.info, oe = console.warn, he = console.error, ye = console.group, Ee = console.groupCollapsed, q = console.groupEnd; var f = { configurable: !0, enumerable: !0, value: ae, writable: !0 }; Object.defineProperties(console, { info: f, log: f, warn: f, error: f, group: f, groupCollapsed: f, groupEnd: f }); } z++; } } function we() { { if (z--, z === 0) { var f = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: Q({}, f, { value: j }), info: Q({}, f, { value: K }), warn: Q({}, f, { value: oe }), error: Q({}, f, { value: he }), group: Q({}, f, { value: ye }), groupCollapsed: Q({}, f, { value: Ee }), groupEnd: Q({}, f, { value: q }) }); } z < 0 && A("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var pe = C.ReactCurrentDispatcher, Ae; function ge(f, w, B) { { if (Ae === void 0) try { throw Error(); } catch (ne) { var M = ne.stack.trim().match(/\n( *(at )?)/); Ae = M && M[1] || ""; } return ` ` + Ae + f; } } var Pe = !1, T; { var D = typeof WeakMap == "function" ? WeakMap : Map; T = new D(); } function R(f, w) { if (!f || Pe) return ""; { var B = T.get(f); if (B !== void 0) return B; } var M; Pe = !0; var ne = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var se; se = pe.current, pe.current = null, ce(); try { if (w) { var $ = function() { throw Error(); }; if (Object.defineProperty($.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct($, []); } catch (Oe) { M = Oe; } Reflect.construct(f, [], $); } else { try { $.call(); } catch (Oe) { M = Oe; } f.call($.prototype); } } else { try { throw Error(); } catch (Oe) { M = Oe; } f(); } } catch (Oe) { if (Oe && M && typeof Oe.stack == "string") { for (var U = Oe.stack.split(` `), Be = M.stack.split(` `), Ce = U.length - 1, Se = Be.length - 1; Ce >= 1 && Se >= 0 && U[Ce] !== Be[Se]; ) Se--; for (; Ce >= 1 && Se >= 0; Ce--, Se--) if (U[Ce] !== Be[Se]) { if (Ce !== 1 || Se !== 1) do if (Ce--, Se--, Se < 0 || U[Ce] !== Be[Se]) { var Ye = ` ` + U[Ce].replace(" at new ", " at "); return f.displayName && Ye.includes("<anonymous>") && (Ye = Ye.replace("<anonymous>", f.displayName)), typeof f == "function" && T.set(f, Ye), Ye; } while (Ce >= 1 && Se >= 0); break; } } } finally { Pe = !1, pe.current = se, we(), Error.prepareStackTrace = ne; } var it = f ? f.displayName || f.name : "", et = it ? ge(it) : ""; return typeof f == "function" && T.set(f, et), et; } function le(f, w, B) { return R(f, !1); } function Ge(f) { var w = f.prototype; return !!(w && w.isReactComponent); } function P(f, w, B) { if (f == null) return ""; if (typeof f == "function") return R(f, Ge(f)); if (typeof f == "string") return ge(f); switch (f) { case l: return ge("Suspense"); case c: return ge("SuspenseList"); } if (typeof f == "object") switch (f.$$typeof) { case s: return le(f.render); case d: return P(f.type, w, B); case p: { var M = f, ne = M._payload, se = M._init; try { return P(se(ne), w, B); } catch { } } } return ""; } var N = Object.prototype.hasOwnProperty, V = {}, L = C.ReactDebugCurrentFrame; function me(f) { if (f) { var w = f._owner, B = P(f.type, f._source, w ? w.type : null); L.setExtraStackFrame(B); } else L.setExtraStackFrame(null); } function Xe(f, w, B, M, ne) { { var se = Function.call.bind(N); for (var $ in f) if (se(f, $)) { var U = void 0; try { if (typeof f[$] != "function") { var Be = Error((M || "React class") + ": " + B + " type `" + $ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof f[$] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw Be.name = "Invariant Violation", Be; } U = f[$](w, $, M, B, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (Ce) { U = Ce; } U && !(U instanceof Error) && (me(ne), A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", M || "React class", B, $, typeof U), me(null)), U instanceof Error && !(U.message in V) && (V[U.message] = !0, me(ne), A("Failed %s type: %s", B, U.message), me(null)); } } } var He = Array.isArray; function Ze(f) { return He(f); } function ve(f) { { var w = typeof Symbol == "function" && Symbol.toStringTag, B = w && f[Symbol.toStringTag] || f.constructor.name || "Object"; return B; } } function Fe(f) { try { return qt(f), !1; } catch { return !0; } } function qt(f) { return "" + f; } function Kn(f) { if (Fe(f)) return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ve(f)), qt(f); } var ft = C.ReactCurrentOwner, mo = { key: !0, ref: !0, __self: !0, __source: !0 }, qn, er, en; en = {}; function vo(f) { if (N.call(f, "ref")) { var w = Object.getOwnPropertyDescriptor(f, "ref").get; if (w && w.isReactWarning) return !1; } return f.ref !== void 0; } function bo(f) { if (N.call(f, "key")) { var w = Object.getOwnPropertyDescriptor(f, "key").get; if (w && w.isReactWarning) return !1; } return f.key !== void 0; } function ho(f, w) { if (typeof f.ref == "string" && ft.current && w && ft.current.stateNode !== w) { var B = k(ft.current.type); en[B] || (A('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', k(ft.current.type), f.ref), en[B] = !0); } } function Co(f, w) { { var B = function() { qn || (qn = !0, A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", w)); }; B.isReactWarning = !0, Object.defineProperty(f, "key", { get: B, configurable: !0 }); } } function Io(f, w) { { var B = function() { er || (er = !0, A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", w)); }; B.isReactWarning = !0, Object.defineProperty(f, "ref", { get: B, configurable: !0 }); } } var yo = function(f, w, B, M, ne, se, $) { var U = { // This tag allows us to uniquely identify this as a React Element $$typeof: t, // Built-in properties that belong on the element type: f, key: w, ref: B, props: $, // Record the component responsible for creating this element. _owner: se }; return U._store = {}, Object.defineProperty(U._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(U, "_self", { configurable: !1, enumerable: !1, writable: !1, value: M }), Object.defineProperty(U, "_source", { configurable: !1, enumerable: !1, writable: !1, value: ne }), Object.freeze && (Object.freeze(U.props), Object.freeze(U)), U; }; function Ao(f, w, B, M, ne) { { var se, $ = {}, U = null, Be = null; B !== void 0 && (Kn(B), U = "" + B), bo(w) && (Kn(w.key), U = "" + w.key), vo(w) && (Be = w.ref, ho(w, ne)); for (se in w) N.call(w, se) && !mo.hasOwnProperty(se) && ($[se] = w[se]); if (f && f.defaultProps) { var Ce = f.defaultProps; for (se in Ce) $[se] === void 0 && ($[se] = Ce[se]); } if (U || Be) { var Se = typeof f == "function" ? f.displayName || f.name || "Unknown" : f; U && Co($, Se), Be && Io($, Se); } return yo(f, U, Be, ne, M, ft.current, $); } } var tn = C.ReactCurrentOwner, tr = C.ReactDebugCurrentFrame; function rt(f) { if (f) { var w = f._owner, B = P(f.type, f._source, w ? w.type : null); tr.setExtraStackFrame(B); } else tr.setExtraStackFrame(null); } var nn; nn = !1; function rn(f) { return typeof f == "object" && f !== null && f.$$typeof === t; } function nr() { { if (tn.current) { var f = k(tn.current.type); if (f) return ` Check the render method of \`` + f + "`."; } return ""; } } function So(f) { return ""; } var rr = {}; function xo(f) { { var w = nr(); if (!w) { var B = typeof f == "string" ? f : f.displayName || f.name; B && (w = ` Check the top-level render call using <` + B + ">."); } return w; } } function ir(f, w) { { if (!f._store || f._store.validated || f.key != null) return; f._store.validated = !0; var B = xo(w); if (rr[B]) return; rr[B] = !0; var M = ""; f && f._owner && f._owner !== tn.current && (M = " It was passed a child from " + k(f._owner.type) + "."), rt(f), A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', B, M), rt(null); } } function or(f, w) { { if (typeof f != "object") return; if (Ze(f)) for (var B = 0; B < f.length; B++) { var M = f[B]; rn(M) && ir(M, w); } else if (rn(f)) f._store && (f._store.validated = !0); else if (f) { var ne = v(f); if (typeof ne == "function" && ne !== f.entries) for (var se = ne.call(f), $; !($ = se.next()).done; ) rn($.value) && ir($.value, w); } } } function Eo(f) { { var w = f.type; if (w == null || typeof w == "string") return; var B; if (typeof w == "function") B = w.propTypes; else if (typeof w == "object" && (w.$$typeof === s || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. w.$$typeof === d)) B = w.propTypes; else return; if (B) { var M = k(w); Xe(B, f.props, "prop", M, f); } else if (w.PropTypes !== void 0 && !nn) { nn = !0; var ne = k(w); A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", ne || "Unknown"); } typeof w.getDefaultProps == "function" && !w.getDefaultProps.isReactClassApproved && A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function wo(f) { { for (var w = Object.keys(f.props), B = 0; B < w.length; B++) { var M = w[B]; if (M !== "children" && M !== "key") { rt(f), A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", M), rt(null); break; } } f.ref !== null && (rt(f), A("Invalid attribute `ref` supplied to `React.Fragment`."), rt(null)); } } var ar = {}; function sr(f, w, B, M, ne, se) { { var $ = Y(f); if (!$) { var U = ""; (f === void 0 || typeof f == "object" && f !== null && Object.keys(f).length === 0) && (U += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var Be = So(); Be ? U += Be : U += nr(); var Ce; f === null ? Ce = "null" : Ze(f) ? Ce = "array" : f !== void 0 && f.$$typeof === t ? (Ce = "<" + (k(f.type) || "Unknown") + " />", U = " Did you accidentally export a JSX literal instead of a component?") : Ce = typeof f, A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Ce, U); } var Se = Ao(f, w, B, ne, se); if (Se == null) return Se; if ($) { var Ye = w.children; if (Ye !== void 0) if (M) if (Ze(Ye)) { for (var it = 0; it < Ye.length; it++) or(Ye[it], f); Object.freeze && Object.freeze(Ye); } else A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else or(Ye, f); } if (N.call(w, "key")) { var et = k(f), Oe = Object.keys(w).filter(function(Vo) { return Vo !== "key"; }), on = Oe.length > 0 ? "{key: someKey, " + Oe.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!ar[et + on]) { var Bo = Oe.length > 0 ? "{" + Oe.join(": ..., ") + ": ...}" : "{}"; A(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, on, et, Bo, et), ar[et + on] = !0; } } return f === i ? wo(Se) : Eo(Se), Se; } } function Go(f, w, B) { return sr(f, w, B, !0); } function Po(f, w, B) { return sr(f, w, B, !1); } var Ro = Po, To = Go; gt.Fragment = i, gt.jsx = Ro, gt.jsxs = To; }()), gt; } process.env.NODE_ENV === "production" ? An.exports = Mo() : An.exports = Zo(); var b = An.exports, Le = function(e, t) { return Number(e.toFixed(t)); }, Yo = function(e, t) { return t; }, de = function(e, t, n) { n && typeof n == "function" && n(e, t); }, Lo = function(e) { return -Math.cos(e * Math.PI) / 2 + 0.5; }, Ho = function(e) { return e; }, jo = function(e) { return e * e; }, zo = function(e) { return e * (2 - e); }, ko = function(e) { return e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e; }, Jo = function(e) { return e * e * e; }, _o = function(e) { return --e * e * e + 1; }, Uo = function(e) { return e < 0.5 ? 4 * e * e * e : (e - 1) * (2 * e - 2) * (2 * e - 2) + 1; }, Qo = function(e) { return e * e * e * e; }, $o = function(e) { return 1 - --e * e * e * e; }, Ko = function(e) { return e < 0.5 ? 8 * e * e * e * e : 1 - 8 * --e * e * e * e; }, qo = function(e) { return e * e * e * e * e; }, ea = function(e) { return 1 + --e * e * e * e * e; }, ta = function(e) { return e < 0.5 ? 16 * e * e * e * e * e : 1 + 16 * --e * e * e * e * e; }, ai = { easeOut: Lo, linear: Ho, easeInQuad: jo, easeOutQuad: zo, easeInOutQuad: ko, easeInCubic: Jo, easeOutCubic: _o, easeInOutCubic: Uo, easeInQuart: Qo, easeOutQuart: $o, easeInOutQuart: Ko, easeInQuint: qo, easeOutQuint: ea, easeInOutQuint: ta }, si = function(e) { typeof e == "number" && cancelAnimationFrame(e); }, ke = function(e) { e.mounted && (si(e.animation), e.animate = !1, e.animation = null, e.velocity = null); }; function ui(e, t, n, i) { if (e.mounted) { var r = (/* @__PURE__ */ new Date()).getTime(), o = 1; ke(e), e.animation = function() { if (!e.mounted) return si(e.animation); var a = (/* @__PURE__ */ new Date()).getTime() - r, u = a / n, s = ai[t], l = s(u); a >= n ? (i(o), e.animation = null) : e.animation && (i(l), requestAnimationFrame(e.animation)); }, requestAnimationFrame(e.animation); } } function na(e) { var t = e.scale, n = e.positionX, i = e.positionY; return !(Number.isNaN(t) || Number.isNaN(n) || Number.isNaN(i)); } function qe(e, t, n, i) { var r = na(t); if (!(!e.mounted || !r)) { var o = e.setTransformState, a = e.transformState, u = a.scale, s = a.positionX, l = a.positionY, c = t.scale - u, d = t.positionX - s, p = t.positionY - l; n === 0 ? o(t.scale, t.positionX, t.positionY) : ui(e, i, n, function(g) { var h = u + c * g, m = s + d * g, v = l + p * g; o(h, m, v); }); } } function ra(e, t, n) { var i = e.offsetWidth, r = e.offsetHeight, o = t.offsetWidth, a = t.offsetHeight, u = o * n, s = a * n, l = i - u, c = r - s; return { wrapperWidth: i, wrapperHeight: r, newContentWidth: u, newDiffWidth: l, newContentHeight: s, newDiffHeight: c }; } var ia = function(e, t, n, i, r, o, a) { var u = e > t ? n * (a ? 1 : 0.5) : 0, s = i > r ? o * (a ? 1 : 0.5) : 0, l = e - t - u, c = u, d = i - r - s, p = s; return { minPositionX: l, maxPositionX: c, minPositionY: d, maxPositionY: p }; }, Dn = function(e, t) { var n = e.wrapperComponent, i = e.contentComponent, r = e.setup.centerZoomedOut; if (!n || !i) throw new Error("Components are not mounted"); var o = ra(n, i, t), a = o.wrapperWidth, u = o.wrapperHeight, s = o.newContentWidth, l = o.newDiffWidth, c = o.newContentHeight, d = o.newDiffHeight, p = ia(a, s, l, u, c, d, !!r); return p; }, Sn = function(e, t, n, i) { return i ? e < t ? Le(t, 2) : e > n ? Le(n, 2) : Le(e, 2) : Le(e, 2); }, ut = function(e, t) { var n = Dn(e, t); return e.bounds = n, n; }; function At(e, t, n, i, r, o, a) { var u = n.minPositionX, s = n.minPositionY, l = n.maxPositionX, c = n.maxPositionY, d = 0, p = 0; a && (d = r, p = o); var g = Sn(e, u - d, l + d, i), h = Sn(t, s - p, c + p, i); return { x: g, y: h }; } function kt(e, t, n, i, r, o) { var a = e.transformState, u = a.scale, s = a.positionX, l = a.positionY, c = i - u; if (typeof t != "number" || typeof n != "number") return console.error("Mouse X and Y position were not provided!"), { x: s, y: l }; var d = s - t * c, p = l - n * c, g = At(d, p, r, o, 0, 0, null); return g; } function St(e, t, n, i, r) { var o = r ? i : 0, a = t - o; return !Number.isNaN(n) && e >= n ? n : !Number.isNaN(t) && e <= a ? a : e; } var dr = function(e, t) { var n = e.setup.panning.excluded, i = e.isInitialized, r = e.wrapperComponent, o = t.target, a = "shadowRoot" in o && "composedPath" in t, u = a ? t.composedPath().some(function(c) { return c instanceof Element ? r == null ? void 0 : r.contains(c) : !1; }) : r == null ? void 0 : r.contains(o), s = i && o && u; if (!s) return !1; var l = Jt(o, n); return !l; }, fr = function(e) { var t = e.isInitialized, n = e.isPanning, i = e.setup, r = i.panning.disabled, o = t && n && !r; return !!o; }, oa = function(e, t) { var n = e.transformState, i = n.positionX, r = n.positionY; e.isPanning = !0; var o = t.clientX, a = t.clientY; e.startCoords = { x: o - i, y: a - r }; }, aa = function(e, t) { var n = t.touches, i = e.transformState, r = i.positionX, o = i.positionY; e.isPanning = !0; var a = n.length === 1; if (a) { var u = n[0].clientX, s = n[0].clientY; e.startCoords = { x: u - r, y: s - o }; } }; function sa(e) { var t = e.transformState, n = t.positionX, i = t.positionY, r = t.scale, o = e.setup, a = o.disabled, u = o.limitToBounds, s = o.centerZoomedOut, l = e.wrapperComponent; if (!(a || !l || !e.bounds)) { var c = e.bounds, d = c.maxPositionX, p = c.minPositionX, g = c.maxPositionY, h = c.minPositionY, m = n > d || n < p, v = i > g || i < h, C = n > d ? l.offsetWidth : e.setup.minPositionX || 0, A = i > g ? l.offsetHeight : e.setup.minPositionY || 0, y = kt(e, C, A, r, e.bounds, u || s), S = y.x, I = y.y; return { scale: r, positionX: m ? S : n, positionY: v ? I : i }; } } function li(e, t, n, i, r) { var o = e.setup.limitToBounds, a = e.wrapperComponent, u = e.bounds, s = e.transformState, l = s.scale, c = s.positionX, d = s.positionY; if (!(a === null || u === null || t === c && n === d)) { var p = At(t, n, u, o, i, r, a), g = p.x, h = p.y; e.setTransformState(l, g, h); } } var ua = function(e, t, n) { var i = e.startCoords, r = e.transformState, o = e.setup.panning, a = o.lockAxisX, u = o.lockAxisY, s = r.positionX, l = r.positionY; if (!i) return { x: s, y: l }; var c = t - i.x, d = n - i.y, p = a ? s : c, g = u ? l : d; return { x: p, y: g }; }, Ke = function(e, t) { var n = e.setup, i = e.transformState, r = i.scale, o = n.minScale, a = n.disablePadding; return t > 0 && r >= o && !a ? t : 0; }, la = function(e) { var t = e.mounted, n = e.setup, i = n.disabled, r = n.velocityAnimation, o = e.transformState.scale, a = r.disabled, u = !a || o > 1 || !i || t; return !!u; }, ca = function(e) { var t = e.mounted, n = e.velocity, i = e.bounds, r = e.setup, o = r.disabled, a = r.velocityAnimation, u = e.transformState.scale, s = a.disabled, l = !s || u > 1 || !o || t; return !(!l || !n || !i); }; function da(e, t) { var n = e.setup.velocityAnimation, i = n.equalToMove, r = n.animationTime, o = n.sensitivity; return i ? r * t * o : r; } function pr(e, t, n, i, r, o, a, u, s, l) { if (r) { if (t > a && n > a) { var c = a + (e - a) * l; return c > s ? s : c < a ? a : c; } if (t < o && n < o) { var c = o + (e - o) * l; return c < u ? u : c > o ? o : c; } } return i ? t : Sn(e, o, a, r); } function fa(e, t) { var n = 1; return t ? Math.min(n, e.offsetWidth / window.innerWidth) : n; } function pa(e, t) { var n = la(e); if (n) { var i = e.lastMousePosition, r = e.velocityTime, o = e.setup, a = e.wrapperComponent, u = o.velocityAnimation.equalToMove, s = Date.now(); if (i && r && a) { var l = fa(a, u), c = t.x - i.x, d = t.y - i.y, p = c / l, g = d / l, h = s - r, m = c * c + d * d, v = Math.sqrt(m) / h; e.velocity = { velocityX: p, velocityY: g, total: v }; } e.lastMousePosition = t, e.velocityTime = s; } } function ga(e) { var t = e.velocity, n = e.bounds, i = e.setup, r = e.wrapperComponent, o = ca(e); if (!(!o || !t || !n || !r)) { var a = t.velocityX, u = t.velocityY, s = t.total, l = n.maxPositionX, c = n.minPositionX, d = n.maxPositionY, p = n.minPositionY, g = i.limitToBounds, h = i.alignmentAnimation, m = i.zoomAnimation, v = i.panning, C = v.lockAxisY, A = v.lockAxisX, y = m.animationType, S = h.sizeX, I = h.sizeY, E = h.velocityAlignmentTime, x = E, G = da(e, s), X = Math.max(G, x), Y = Ke(e, S), _ = Ke(e, I), Z = Y * r.offsetWidth / 100, k = _ * r.offsetHeight / 100, Q = l + Z, z = c - Z, j = d + k, K = p - k, oe = e.transformState, he = (/* @__PURE__ */ new Date()).getTime(); ui(e, y, X, function(ye) { var Ee = e.transformState, q = Ee.scale, ae = Ee.positionX, ce = Ee.positionY, we = (/* @__PURE__ */ new Date()).getTime() - he, pe = we / x, Ae = ai[h.animationType], ge = 1 - Ae(Math.min(1, pe)), Pe = 1 - ye, T = ae + a * Pe, D = ce + u * Pe, R = pr(T, oe.positionX, ae, A, g, c, l, z, Q, ge), le = pr(D, oe.positionY, ce, C, g, p, d, K, j, ge); (ae !== T || ce !== D) && e.setTransformState(q, R, le); }); } } function gr(e, t) { var n = e.transformState.scale; ke(e), ut(e, n), window.TouchEvent !== void 0 && t instanceof TouchEvent ? aa(e, t) : oa(e, t); } function ci(e) { var t = e.transformState.scale, n = e.setup, i = n.minScale, r = n.alignmentAnimation, o = r.disabled, a = r.sizeX, u = r.sizeY, s = r.animationTime, l = r.animationType, c = o || t < i || !a && !u; if (!c) { var d = sa(e); d && qe(e, d, s, l); } } function mr(e, t, n) { var i = e.startCoords, r = e.setup, o = r.alignmentAnimation, a = o.sizeX, u = o.sizeY; if (i) { var s = ua(e, t, n), l = s.x, c = s.y, d = Ke(e, a), p = Ke(e, u); pa(e, { x: l, y: c }), li(e, l, c, d, p); } } function ma(e) { if (e.isPanning) { var t = e.setup.panning.velocityDisabled, n = e.velocity, i = e.wrapperComponent, r = e.contentComponent; e.isPanning = !1, e.animate = !1, e.animation = null; var o = i == null ? void 0 : i.getBoundingClientRect(), a = r == null ? void 0 : r.getBoundingClientRect(), u = (o == null ? void 0 : o.width) || 0, s = (o == null ? void 0 : o.height) || 0, l = (a == null ? void 0 : a.width) || 0, c = (a == null ? void 0 : a.height) || 0, d = u < l || s < c, p = !t && n && (n == null ? void 0 : n.total) > 0.1 && d; p ? ga(e) : ci(e); } } function Mn(e, t, n, i) { var r = e.setup, o = r.minScale, a = r.maxScale, u = r.limitToBounds, s = St(Le(t, 2), o, a, 0, !1), l = ut(e, s), c = kt(e, n, i, s, l, u), d = c.x, p = c.y; return { scale: s, positionX: d, positionY: p }; } function di(e, t, n) { var i = e.transformState.scale, r = e.wrapperComponent, o = e.setup, a = o.minScale, u = o.limitToBounds, s = o.zoomAnimation, l = s.disabled, c = s.animationTime, d = s.animationType, p = l || i >= a; if ((i >= 1 || u) && ci(e), !(p || !r || !e.mounted)) { var g = t || r.offsetWidth / 2, h = n || r.offsetHeight / 2, m = Mn(e, a, g, h); m && qe(e, m, c, d); } } var $e = function() { return $e = Object.assign || function(t) { for (var n, i = 1, r = arguments.length; i < r; i++) { n = arguments[i]; for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]); } return t; }, $e.apply(this, arguments); }; function vr(e, t, n) { for (var i = 0, r = t.length, o; i < r; i++) (o || !(i in t)) && (o || (o = Array.prototype.slice.call(t, 0, i)), o[i] = t[i]); return e.concat(o || Array.prototype.slice.call(t)); } var Et = { previousScale: 1, scale: 1, positionX: 0, positionY: 0 }, mt = { disabled: !1, minPositionX: null, maxPositionX: null, minPositionY: null, maxPositionY: null, minScale: 1, maxScale: 8, limitToBounds: !0, centerZoomedOut: !1, centerOnInit: !1, disablePadding: !1, smooth: !0, wheel: { step: 0.2, disabled: !1, smoothStep: 1e-3, wheelDisabled: !1, touchPadDisabled: !1, activationKeys: [], excluded: [] }, panning: { disabled: !1, velocityDisabled: !1, lockAxisX: !1, lockAxisY: !1, allowLeftClickPan: !0, allowMiddleClickPan: !0, allowRightClickPan: !0, wheelPanning: !1, activationKeys: [], excluded: [] }, pinch: { step: 5, disabled: !1, excluded: [] }, doubleClick: { disabled: !1, step: 0.7, mode: "zoomIn", animationType: "easeOut", animationTime: 200, excluded: [] }, zoomAnimation: { disabled: !1, size: 0.4, animationTime: 200, animationType: "easeOut" }, alignmentAnimation: { disabled: !1, sizeX: 100, sizeY: 100, animationTime: 200, velocityAlignmentTime: 400, animationType: "easeOut" }, velocityAnimation: { disabled: !1, sensitivity: 1, animationTime: 400, animationType: "easeOut", equalToMove: !0 } }, xn = { wrapperClass: "react-transform-wrapper", contentClass: "react-transform-component" }, fi = function(e) { var t, n, i, r; return { previousScale: (t = e.initialScale) !== null && t !== void 0 ? t : Et.scale, scale: (n = e.initialScale) !== null && n !== void 0 ? n : Et.scale, positionX: (i = e.initialPositionX) !== null && i !== void 0 ? i : Et.positionX, positionY: (r = e.initialPositionY) !== null && r !== void 0 ? r : Et.positionY }; }, br = function(e) { var t = $e({}, mt); return Object.keys(e).forEach(function(n) { var i = typeof e[n] < "u", r = typeof mt[n] < "u"; if (r && i) { var o = Object.prototype.toString.call(mt[n]), a = o === "[object Object]", u = o === "[object Array]"; a ? t[n] = $e($e({}, mt[n]), e[n]) : u ? t[n] = vr(vr([], mt[n], !0), e[n]) : t[n] = e[n]; } }), t; }, pi = function(e, t, n) { var i = e.transformState.scale, r = e.wrapperComponent, o = e.setup, a = o.maxScale, u = o.minScale, s = o.zoomAnimation, l = o.smooth, c = s.size; if (!r) throw new Error("Wrapper is not mounted"); var d = l ? i * Math.exp(t * n) : i + t * n, p = St(Le(d, 3), u, a, c, !1); return p; }; function gi(e, t, n, i, r) { var o = e.wrapperComponent, a = e.transformState, u = a.scale, s = a.positionX, l = a.positionY; if (!o) return console.error("No WrapperComponent found"); var c = o.offsetWidth, d = o.offsetHeight, p = (c / 2 - s) / u, g = (d / 2 - l) / u, h = pi(e, t, n), m = Mn(e, h, p, g); if (!m) return console.error("Error during zoom event. New transformation state was not calculated."); qe(e, m, i, r); } function mi(e, t, n, i) { var r = e.setup, o = e.wrapperComponent, a = r.limitToBounds, u = fi(e.props), s = e.transformState, l = s.scale, c = s.positionX, d = s.positionY; if (o) { var p = Dn(e, u.scale), g = At(u.positionX, u.positionY, p, a, 0, 0, o), h = { scale: u.scale, positionX: g.x, positionY: g.y }; l === u.scale && c === u.positionX && d === u.positionY || (i == null || i(), qe(e, h, t, n)); } } function va(e, t, n, i) { var r = e.getBoundingClientRect(), o = t.getBoundingClientRect(), a = n.getBoundingClientRect(), u = o.x * i.scale, s = o.y * i.scale; return { x: (r.x - a.x + u) / i.scale, y: (r.y - a.y + s) / i.scale }; } function ba(e, t, n) { var i = e.wrapperComponent, r = e.contentComponent, o = e.transformState, a = e.setup, u = a.limitToBounds, s = a.minScale, l = a.maxScale; if (!i || !r) return o; var c = i.getBoundingClientRect(), d = t.getBoundingClientRect(), p = va(t, i, r, o), g = p.x, h = p.y, m = d.width / o.scale, v = d.height / o.scale, C = i.offsetWidth / m, A = i.offsetHeight / v, y = St(n || Math.min(C, A), s, l, 0, !1), S = (c.width - m * y) / 2, I = (c.height - v * y) / 2, E = (c.left - g) * y + S, x = (c.top - h) * y + I, G = Dn(e, y), X = At(E, x, G, u, 0, 0, i), Y = X.x, _ = X.y; return { positionX: Y, positionY: _, scale: y }; } var ha = function(e) { return function(t, n, i) { t === void 0 && (t = 0.5), n === void 0 && (n = 300), i === void 0 && (i = "easeOut"), gi(e, 1, t, n, i); }; }, Ca = function(e) { return function(t, n, i) { t === void 0 && (t = 0.5), n === void 0 && (n = 300), i === void 0 && (i = "easeOut"), gi(e, -1, t, n, i); }; }, Ia = function(e) { return function(t, n, i, r, o) { r === void 0 && (r = 300), o === void 0 && (o = "easeOut"); var a = e.transformState, u = a.positionX, s = a.positionY, l = a.scale, c = e.wrapperComponent, d = e.contentComponent, p = e.setup.disabled; if (!(p || !c || !d)) { var g = { positionX: Number.isNaN(t) ? u : t, positionY: Number.isNaN(n) ? s : n, scale: Number.isNaN(i) ? l : i }; qe(e, g, r, o); } }; }, ya = function(e) { return function(t, n) { t === void 0 && (t = 200), n === void 0 && (n = "easeOut"), mi(e, t, n); }; }, Aa = function(e) { return function(t, n, i) { n === void 0 && (n = 200), i === void 0 && (i = "easeOut"); var r = e.transformState, o = e.wrapperComponent, a = e.contentComponent; if (o && a) { var u = vi(t || r.scale, o, a); qe(e, u, n, i); } }; }, Sa = function(e) { return function(t, n, i, r) { i === void 0 && (i = 600), r === void 0 && (r = "easeOut"), ke(e); var o = e.wrapperComponent, a = typeof t == "string" ? document.getElementById(t) : t; if (o && a && o.contains(a)) { var u = ba(e, a, n); qe(e, u, i, r); } }; }, En = function(e) { return { instance: e, zoomIn: ha(e), zoomOut: Ca(e), setTransform: Ia(e), resetTransform: ya(e), centerView: Aa(e), zoomToElement: Sa(e) }; }, xa = function(e) { return { instance: e, state: e.transformState }; }, ue = function(e) { var t = {}; return Object.assign(t, xa(e)), Object.assign(t, En(e)), t; }, an = !1; function sn() { try { var e = { get passive() { return an = !0, !1; } }; return e; } catch { return an = !1, an; } } var wt = ".".concat(xn.wrapperClass), Jt = function(e, t) { return t.some(function(n) { return e.matches("".concat(wt, " ").concat(n, ", ").concat(wt, " .").concat(n, ", ").concat(wt, " ").concat(n, " *, ").concat(wt, " .").concat(n, " *")); }); }, wn = function(e) { e && clearTimeout(e); }, Ea = function(e, t, n) { return "translate(".concat(e, "px, ").concat(t, "px) scale(").concat(n, ")"); }, vi = function(e, t, n) { var i = n.offsetWidth * e, r = n.offsetHeight * e, o = (t.offsetWidth - i) / 2, a = (t.offsetHeight - r) / 2; return { scale: e, positionX: o, positionY: a }; }; function wa(e) { return function(t) { e.forEach(function(n) { typeof n == "function" ? n(t) : n != null && (n.current = t); }); }; } var Ga = function(e, t) { var n = e.setup.wheel, i = n.disabled, r = n.wheelDisabled, o = n.touchPadDisabled, a = n.excluded, u = e.isInitialized, s = e.isPanning, l = t.target, c = u && !s && !i && l; if (!c || r && !t.ctrlKey || o && t.ctrlKey) return !1; var d = Jt(l, a); return !d; }, Pa = function(e) { return e ? e.deltaY < 0 ? 1 : -1 : 0; }; function Ra(e, t) { var n = Pa(e), i = Yo(t, n); return i; } function bi(e, t, n) { var i = t.getBoundingClientRect(), r = 0, o = 0; if ("clientX" in e) r = (e.clientX - i.left) / n, o = (e.clientY - i.top) / n; else { var a = e.touches[0]; r = (a.clientX - i.left) / n, o = (a.clientY - i.top) / n; } return (Number.isNaN(r) || Number.isNaN(o)) && console.error("No mouse or touch offset found"), { x: r, y: o }; } var Ta = function(e, t, n, i, r) { var o = e.transformState.scale, a = e.wrapperComponent, u = e.setup, s = u.maxScale, l = u.minScale, c = u.zoomAnimation, d = u.disablePadding, p = c.size, g = c.disabled; if (!a) throw new Error("Wrapper is not mounted"); var h = o + t * n, m = i ? !1 : !g, v = St(Le(h, 3), l, s, p, m && !d); return v; }, Ba = function(e, t) { var n = e.previousWheelEvent, i = e.transformState.scale, r = e.setup, o = r.maxScale, a = r.minScale; return n ? i < o || i > a || Math.sign(n.deltaY) !== Math.sign(t.deltaY) || n.deltaY > 0 && n.deltaY < t.deltaY || n.deltaY < 0 && n.deltaY > t.deltaY || Math.sign(n.deltaY) !== Math.sign(t.deltaY) : !1; }, Va = function(e, t) { var n = e.setup.pinch, i = n.disabled, r = n.excluded, o = e.isInitialized, a = t.target, u = o && !i && a; if (!u) return !1; var s = Jt(a, r); return !s; }, Na = function(e) { var t = e.setup.pinch.disabled, n = e.isInitialized, i = e.pinchStartDistance, r = n && !t && i; return !!r; }, Xa = function(e, t, n) { var i = n.getBoundingClientRect(), r = e.touches, o = Le(r[0].clientX - i.left, 5), a = Le(r[0].clientY - i.top, 5), u = Le(r[1].clientX - i.left, 5), s = Le(r[1].clientY - i.top, 5); return { x: (o + u) / 2 / t, y: (a + s) / 2 / t }; }, hi = function(e) { return Math.sqrt(Math.pow(e.touches[0].pageX - e.touches[1].pageX, 2) + Math.pow(e.touches[0].pageY - e.touches[1].pageY, 2)); }, Fa = function(e, t) { var n = e.pinchStartScale, i = e.pinchStartDistance, r = e.setup, o = r.maxScale, a = r.minScale, u = r.zoomAnimation, s = r.disablePadding, l = u.size, c = u.disabled; if (!n || i === null || !t) throw new Error("Pinch touches distance was not provided"); if (t < 0) return e.transformState.scale; var d = t / i, p = d * n; return St(Le(p, 2), a, o, l, !c && !s); }, Oa = 160, Wa = 100, Da = function(e, t) { var n = e.props, i = n.onWheelStart, r = n.onZoomStart; e.wheelStopEventTimer || (ke(e), de(ue(e), t, i), de(ue(e), t, r)); }, Ma = function(e, t) { var n = e.props, i = n.onWheel, r = n.onZoom, o = e.contentComponent, a = e.setup, u = e.transformState, s = u.scale, l = a.limitToBounds, c = a.centerZoomedOut, d = a.zoomAnimation, p = a.wheel, g = a.disablePadding, h = a.smooth, m = d.size, v = d.disabled, C = p.step, A = p.smoothStep; if (!o) throw new Error("Component not mounted"); t.preventDefault(), t.stopPropagation(); var y = Ra(t, null), S = h ? A * Math.abs(t.deltaY) : C, I = Ta(e, y, S, !t.ctrlKey); if (s !== I) { var E = ut(e, I), x = bi(t, o, s), G = v || m === 0 || c || g, X = l && G, Y = kt(e, x.x, x.y, I, E, X), _ = Y.x, Z = Y.y; e.previousWheelEvent = t, e.setTransformState(I, _, Z), de(ue(e), t, i), de(ue(e), t, r); } }, Za = function(e, t) { var n = e.props, i = n.onWheelStop, r = n.onZoomStop; wn(e.wheelAnimationTimer), e.wheelAnimationTimer = setTimeout(function() { e.mounted && (di(e, t.x, t.y), e.wheelAnimationTimer = null); }, Wa); var o = Ba(e, t); o && (wn(e.wheelStopEventTimer), e.wheelStopEventTimer = setTimeout(function() { e.mounted && (e.wheelStopEventTimer = null, de(ue(e), t, i), de(ue(e), t, r)); }, Oa)); }, Ci = function(e) { for (var t = 0, n = 0, i = 0; i < 2; i += 1) t += e.touches[i].clientX, n += e.touches[i].clientY; var r = t / 2, o = n / 2; return { x: r, y: o }; }, Ya = function(e, t) { var n = hi(t); e.pinchStartDistance = n, e.lastDistance = n, e.pinchStartScale = e.transformState.scale, e.isPanning = !1; var i = Ci(t); e.pinchLastCenterX = i.x, e.pinchLastCenterY = i.y, ke(e); }, La = function(e, t) { var n = e.contentComponent, i = e.pinchStartDistance, r = e.wrapperComponent, o = e.transformState.scale, a = e.setup, u = a.limitToBounds, s = a.centerZoomedOut, l = a.zoomAnimation, c = a.alignmentAnimation, d = l.disabled, p = l.size; if (!(i === null || !n)) { var g = Xa(t, o, n); if (!(!Number.isFinite(g.x) || !Number.isFinite(g.y))) { var h = hi(t), m = Fa(e, h), v = Ci(t), C = v.x - (e.pinchLastCenterX || 0), A = v.y - (e.pinchLastCenterY || 0); if (!(m === o && C === 0 && A === 0)) { e.pinchLastCenterX = v.x, e.pinchLastCenterY = v.y; var y = ut(e, m), S = d || p === 0 || s, I = u && S, E = kt(e, g.x, g.y, m, y, I), x = E.x, G = E.y; e.pinchMidpoint = g, e.lastDistance = h; var X = c.sizeX, Y = c.sizeY, _ = Ke(e, X), Z = Ke(e, Y), k = x + C, Q = G + A, z = At(k, Q, y, u, _, Z, r), j = z.x, K = z.y; e.setTransformState(m, j, K); } } } }, Ha = function(e) { var t = e.pinchMidpoint; e.velocity = null, e.lastDistance = null, e.pinchMidpoint = null, e.pinchStartScale = null, e.pinchStartDistance = null, di(e, t == null ? void 0 : t.x, t == null ? void 0 : t.y); }, Ii = function(e, t) { var n = e.props.onZoomStop, i = e.setup.doubleClick.animationTime; wn(e.doubleClickStopEventTimer), e.doubleClickStopEventTimer = setTimeout(function() { e.doubleClickStopEventTimer = null, de(ue(e), t, n); }, i); }, ja = function(e, t) { var n = e.props, i = n.onZoomStart, r = n.onZoom, o = e.setup.doubleClick, a = o.animationTime, u = o.animationType; de(ue(e), t, i), mi(e, a, u, function() { return de(ue(e), t, r); }), Ii(e, t); }; function za(e, t) { return e === "toggle" ? t === 1 ? 1 : -1 : e === "zoomOut" ? -1 : 1; } function ka(e, t) { var n = e.setup, i = e.doubleClickStopEventTimer, r = e.transformState, o = e.contentComponent, a = r.scale, u = e.props, s = u.onZoomStart, l = u.onZoom, c = n.doubleClick, d = c.disabled, p = c.mode, g = c.step, h = c.animationTime, m = c.animationType; if (!d && !i) { if (p === "reset") return ja(e, t); if (!o) return console.error("No ContentComponent found"); var v = za(p, e.transformState.scale), C = pi(e, v, g); if (a !== C) { de(ue(e), t, s); var A = bi(t, o, a), y = Mn(e, C, A.x, A.y); if (!y) return console.error("Error during zoom event. New transformation state was not calculated."); de(ue(e), t, l), qe(e, y, h, m), Ii(e, t); } } } var Ja = function(e, t) { var n = e.isInitialized, i = e.setup, r = e.wrapperComponent, o = i.doubleClick, a = o.disabled, u = o.excluded, s = t.target, l = r == null ? void 0 : r.contains(s), c = n && s && l && !a; if (!c) return !1; var d = Jt(s, u); return !d; }, _a = ( /** @class */ /* @__PURE__ */ function() { function e(t) { var n = this; this.mounted = !0, this.pinchLastCenterX = null, this.pinchLastCenterY = null, this.onChangeCallbacks = /* @__PURE__ */ new Set(), this.onInitCallbacks = /* @__PURE__ */ new Set(), this.wrapperComponent = null, this.contentComponent = null, this.isInitialized = !1, this.bounds = null, this.previousWheelEvent = null, this.wheelStopEventTimer = null, this.wheelAnimationTimer = null, this.isPanning = !1, this.isWheelPanning = !1, this.startCoords = null, this.lastTouch = null, this.distance = null, this.lastDistance = null, this.pinchStartDistance = null, this.pinchStartScale = null, this.pinchMidpoint = null, this.doubleClickStopEventTimer = null, this.velocity = null, this.velocityTime = null, this.lastMousePosition = null, this.animate = !1, this.animation = null, this.maxBounds = null, this.pressedKeys = {}, this.mount = function() { n.initializeWindowEvents(); }, this.unmount = function() { n.cleanupWindowEvents(); }, this.update = function(i) { n.props = i, ut(n, n.transformState.scale), n.setup = br(i); }, this.initializeWindowEvents = function() { var i, r, o = sn(), a = (i = n.wrapperComponent) === null || i === void 0 ? void 0 : i.ownerDocument, u = a == null ? void 0 : a.defaultView; (r = n.wrapperComponent) === null || r === void 0 || r.addEventListener("wheel", n.onWheelPanning, o), u == null || u.addEventListener("mousedown", n.onPanningStart, o), u == null || u.addEventListener("mousemove", n.onPanning, o), u == null || u.addEventListener("mouseup", n.onPanningStop, o), a == null || a.addEventListener("mouseleave", n.clearPanning, o), u == null || u.addEventListener("keyup", n.setKeyUnPressed, o), u == null || u.addEventListener("keydown", n.setKeyPressed, o); }, this.cleanupWin