UNPKG

allotment

Version:
1,237 lines (1,235 loc) 83.6 kB
"use strict"; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n9 = 0, F = function F() {}; return { s: F, n: function n() { return _n9 >= r.length ? { done: !0 } : { done: !1, value: r[_n9++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } function _inherits(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 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var e = require("react"), t = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; function i(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e["default"] : e; } var n, s = { exports: {} }; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ var r, o, a, u = (n || (n = 1, r = s, function () { var e = {}.hasOwnProperty; function t() { for (var i = [], n = 0; n < arguments.length; n++) { var s = arguments[n]; if (s) { var r = _typeof(s); if ("string" === r || "number" === r) i.push(s);else if (Array.isArray(s)) { if (s.length) { var o = t.apply(null, s); o && i.push(o); } } else if ("object" === r) if (s.toString === Object.prototype.toString) for (var a in s) e.call(s, a) && s[a] && i.push(a);else i.push(s.toString()); } } return i.join(" "); } r.exports ? (t["default"] = t, r.exports = t) : window.classNames = t; }()), s.exports), c = i(u); var h, l = i(function () { if (a) return o; a = 1; var e = /^\s+|\s+$/g, t = /^[-+]0x[0-9a-f]+$/i, i = /^0b[01]+$/i, n = /^0o[0-7]+$/i, s = parseInt, r = Object.prototype.toString; function u(e) { var t = _typeof(e); return !!e && ("object" == t || "function" == t); } function c(o) { if ("number" == typeof o) return o; if (function (e) { return "symbol" == _typeof(e) || function (e) { return !!e && "object" == _typeof(e); }(e) && "[object Symbol]" == r.call(e); }(o)) return NaN; if (u(o)) { var a = "function" == typeof o.valueOf ? o.valueOf() : o; o = u(a) ? a + "" : a; } if ("string" != typeof o) return 0 === o ? o : +o; o = o.replace(e, ""); var c = i.test(o); return c || n.test(o) ? s(o.slice(2), c ? 2 : 8) : t.test(o) ? NaN : +o; } return o = function o(e, t, i) { return void 0 === i && (i = t, t = void 0), void 0 !== i && (i = (i = c(i)) == i ? i : 0), void 0 !== t && (t = (t = c(t)) == t ? t : 0), function (e, t, i) { return e == e && (void 0 !== i && (e = e <= i ? e : i), void 0 !== t && (e = e >= t ? e : t)), e; }(c(e), t, i); }; }()), f = { exports: {} }; var m = (h || (h = 1, function (e, i) { var n = "__lodash_hash_undefined__", s = 9007199254740991, r = "[object Arguments]", o = "[object Array]", a = "[object Boolean]", u = "[object Date]", c = "[object Error]", h = "[object Function]", l = "[object Map]", f = "[object Number]", m = "[object Object]", d = "[object Promise]", p = "[object RegExp]", v = "[object Set]", y = "[object String]", b = "[object Symbol]", g = "[object WeakMap]", z = "[object ArrayBuffer]", w = "[object DataView]", S = /^\[object .+?Constructor\]$/, _ = /^(?:0|[1-9]\d*)$/, I = {}; I["[object Float32Array]"] = I["[object Float64Array]"] = I["[object Int8Array]"] = I["[object Int16Array]"] = I["[object Int32Array]"] = I["[object Uint8Array]"] = I["[object Uint8ClampedArray]"] = I["[object Uint16Array]"] = I["[object Uint32Array]"] = !0, I[r] = I[o] = I[z] = I[a] = I[w] = I[u] = I[c] = I[h] = I[l] = I[f] = I[m] = I[p] = I[v] = I[y] = I[g] = !1; var x = "object" == _typeof(t) && t && t.Object === Object && t, E = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self, V = x || E || Function("return this")(), j = i && !i.nodeType && i, L = j && e && !e.nodeType && e, N = L && L.exports === j, O = N && x.process, D = function () { try { return O && O.binding && O.binding("util"); } catch (e) {} }(), M = D && D.isTypedArray; function P(e, t) { for (var i = -1, n = null == e ? 0 : e.length; ++i < n;) if (t(e[i], i, e)) return !0; return !1; } function A(e) { var t = -1, i = Array(e.size); return e.forEach(function (e, n) { i[++t] = [n, e]; }), i; } function C(e) { var t = -1, i = Array(e.size); return e.forEach(function (e) { i[++t] = e; }), i; } var T, F, k, R = Array.prototype, H = Function.prototype, $ = Object.prototype, Y = V["__core-js_shared__"], B = H.toString, W = $.hasOwnProperty, G = (T = /[^.]+$/.exec(Y && Y.keys && Y.keys.IE_PROTO || "")) ? "Symbol(src)_1." + T : "", U = $.toString, X = RegExp("^" + B.call(W).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), J = N ? V.Buffer : void 0, K = V.Symbol, Z = V.Uint8Array, q = $.propertyIsEnumerable, Q = R.splice, ee = K ? K.toStringTag : void 0, te = Object.getOwnPropertySymbols, ie = J ? J.isBuffer : void 0, ne = (F = Object.keys, k = Object, function (e) { return F(k(e)); }), se = De(V, "DataView"), re = De(V, "Map"), oe = De(V, "Promise"), ae = De(V, "Set"), ue = De(V, "WeakMap"), ce = De(Object, "create"), he = Ce(se), le = Ce(re), fe = Ce(oe), me = Ce(ae), de = Ce(ue), pe = K ? K.prototype : void 0, ve = pe ? pe.valueOf : void 0; function ye(e) { var t = -1, i = null == e ? 0 : e.length; for (this.clear(); ++t < i;) { var n = e[t]; this.set(n[0], n[1]); } } function be(e) { var t = -1, i = null == e ? 0 : e.length; for (this.clear(); ++t < i;) { var n = e[t]; this.set(n[0], n[1]); } } function ge(e) { var t = -1, i = null == e ? 0 : e.length; for (this.clear(); ++t < i;) { var n = e[t]; this.set(n[0], n[1]); } } function ze(e) { var t = -1, i = null == e ? 0 : e.length; for (this.__data__ = new ge(); ++t < i;) this.add(e[t]); } function we(e) { var t = this.__data__ = new be(e); this.size = t.size; } function Se(e, t) { var i = ke(e), n = !i && Fe(e), s = !i && !n && Re(e), r = !i && !n && !s && We(e), o = i || n || s || r, a = o ? function (e, t) { for (var i = -1, n = Array(e); ++i < e;) n[i] = t(i); return n; }(e.length, String) : [], u = a.length; for (var c in e) !W.call(e, c) || o && ("length" == c || s && ("offset" == c || "parent" == c) || r && ("buffer" == c || "byteLength" == c || "byteOffset" == c) || Ae(c, u)) || a.push(c); return a; } function _e(e, t) { for (var i = e.length; i--;) if (Te(e[i][0], t)) return i; return -1; } function Ie(e) { return null == e ? void 0 === e ? "[object Undefined]" : "[object Null]" : ee && ee in Object(e) ? function (e) { var t = W.call(e, ee), i = e[ee]; try { e[ee] = void 0; var n = !0; } catch (e) {} var s = U.call(e); return n && (t ? e[ee] = i : delete e[ee]), s; }(e) : function (e) { return U.call(e); }(e); } function xe(e) { return Be(e) && Ie(e) == r; } function Ee(e, t, i, n, s) { return e === t || (null == e || null == t || !Be(e) && !Be(t) ? e != e && t != t : function (e, t, i, n, s, h) { var d = ke(e), g = ke(t), S = d ? o : Pe(e), _ = g ? o : Pe(t), I = (S = S == r ? m : S) == m, x = (_ = _ == r ? m : _) == m, E = S == _; if (E && Re(e)) { if (!Re(t)) return !1; d = !0, I = !1; } if (E && !I) return h || (h = new we()), d || We(e) ? Le(e, t, i, n, s, h) : function (e, t, i, n, s, r, o) { switch (i) { case w: if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1; e = e.buffer, t = t.buffer; case z: return !(e.byteLength != t.byteLength || !r(new Z(e), new Z(t))); case a: case u: case f: return Te(+e, +t); case c: return e.name == t.name && e.message == t.message; case p: case y: return e == t + ""; case l: var h = A; case v: var m = 1 & n; if (h || (h = C), e.size != t.size && !m) return !1; var d = o.get(e); if (d) return d == t; n |= 2, o.set(e, t); var g = Le(h(e), h(t), n, s, r, o); return o["delete"](e), g; case b: if (ve) return ve.call(e) == ve.call(t); } return !1; }(e, t, S, i, n, s, h); if (!(1 & i)) { var V = I && W.call(e, "__wrapped__"), j = x && W.call(t, "__wrapped__"); if (V || j) { var L = V ? e.value() : e, N = j ? t.value() : t; return h || (h = new we()), s(L, N, i, n, h); } } return !!E && (h || (h = new we()), function (e, t, i, n, s, r) { var o = 1 & i, a = Ne(e), u = a.length, c = Ne(t), h = c.length; if (u != h && !o) return !1; for (var l = u; l--;) { var f = a[l]; if (!(o ? f in t : W.call(t, f))) return !1; } var m = r.get(e); if (m && r.get(t)) return m == t; var d = !0; r.set(e, t), r.set(t, e); for (var p = o; ++l < u;) { var v = e[f = a[l]], y = t[f]; if (n) var b = o ? n(y, v, f, t, e, r) : n(v, y, f, e, t, r); if (!(void 0 === b ? v === y || s(v, y, i, n, r) : b)) { d = !1; break; } p || (p = "constructor" == f); } if (d && !p) { var g = e.constructor, z = t.constructor; g == z || !("constructor" in e) || !("constructor" in t) || "function" == typeof g && g instanceof g && "function" == typeof z && z instanceof z || (d = !1); } return r["delete"](e), r["delete"](t), d; }(e, t, i, n, s, h)); }(e, t, i, n, Ee, s)); } function Ve(e) { return !(!Ye(e) || function (e) { return !!G && G in e; }(e)) && (He(e) ? X : S).test(Ce(e)); } function je(e) { if (i = (t = e) && t.constructor, n = "function" == typeof i && i.prototype || $, t !== n) return ne(e); var t, i, n, s = []; for (var r in Object(e)) W.call(e, r) && "constructor" != r && s.push(r); return s; } function Le(e, t, i, n, s, r) { var o = 1 & i, a = e.length, u = t.length; if (a != u && !(o && u > a)) return !1; var c = r.get(e); if (c && r.get(t)) return c == t; var h = -1, l = !0, f = 2 & i ? new ze() : void 0; for (r.set(e, t), r.set(t, e); ++h < a;) { var m = e[h], d = t[h]; if (n) var p = o ? n(d, m, h, t, e, r) : n(m, d, h, e, t, r); if (void 0 !== p) { if (p) continue; l = !1; break; } if (f) { if (!P(t, function (e, t) { if (o = t, !f.has(o) && (m === e || s(m, e, i, n, r))) return f.push(t); var o; })) { l = !1; break; } } else if (m !== d && !s(m, d, i, n, r)) { l = !1; break; } } return r["delete"](e), r["delete"](t), l; } function Ne(e) { return function (e, t, i) { var n = t(e); return ke(e) ? n : function (e, t) { for (var i = -1, n = t.length, s = e.length; ++i < n;) e[s + i] = t[i]; return e; }(n, i(e)); }(e, Ge, Me); } function Oe(e, t) { var i, n, s = e.__data__; return ("string" == (n = _typeof(i = t)) || "number" == n || "symbol" == n || "boolean" == n ? "__proto__" !== i : null === i) ? s["string" == typeof t ? "string" : "hash"] : s.map; } function De(e, t) { var i = function (e, t) { return null == e ? void 0 : e[t]; }(e, t); return Ve(i) ? i : void 0; } ye.prototype.clear = function () { this.__data__ = ce ? ce(null) : {}, this.size = 0; }, ye.prototype["delete"] = function (e) { var t = this.has(e) && delete this.__data__[e]; return this.size -= t ? 1 : 0, t; }, ye.prototype.get = function (e) { var t = this.__data__; if (ce) { var i = t[e]; return i === n ? void 0 : i; } return W.call(t, e) ? t[e] : void 0; }, ye.prototype.has = function (e) { var t = this.__data__; return ce ? void 0 !== t[e] : W.call(t, e); }, ye.prototype.set = function (e, t) { var i = this.__data__; return this.size += this.has(e) ? 0 : 1, i[e] = ce && void 0 === t ? n : t, this; }, be.prototype.clear = function () { this.__data__ = [], this.size = 0; }, be.prototype["delete"] = function (e) { var t = this.__data__, i = _e(t, e); return !(i < 0 || (i == t.length - 1 ? t.pop() : Q.call(t, i, 1), --this.size, 0)); }, be.prototype.get = function (e) { var t = this.__data__, i = _e(t, e); return i < 0 ? void 0 : t[i][1]; }, be.prototype.has = function (e) { return _e(this.__data__, e) > -1; }, be.prototype.set = function (e, t) { var i = this.__data__, n = _e(i, e); return n < 0 ? (++this.size, i.push([e, t])) : i[n][1] = t, this; }, ge.prototype.clear = function () { this.size = 0, this.__data__ = { hash: new ye(), map: new (re || be)(), string: new ye() }; }, ge.prototype["delete"] = function (e) { var t = Oe(this, e)["delete"](e); return this.size -= t ? 1 : 0, t; }, ge.prototype.get = function (e) { return Oe(this, e).get(e); }, ge.prototype.has = function (e) { return Oe(this, e).has(e); }, ge.prototype.set = function (e, t) { var i = Oe(this, e), n = i.size; return i.set(e, t), this.size += i.size == n ? 0 : 1, this; }, ze.prototype.add = ze.prototype.push = function (e) { return this.__data__.set(e, n), this; }, ze.prototype.has = function (e) { return this.__data__.has(e); }, we.prototype.clear = function () { this.__data__ = new be(), this.size = 0; }, we.prototype["delete"] = function (e) { var t = this.__data__, i = t["delete"](e); return this.size = t.size, i; }, we.prototype.get = function (e) { return this.__data__.get(e); }, we.prototype.has = function (e) { return this.__data__.has(e); }, we.prototype.set = function (e, t) { var i = this.__data__; if (i instanceof be) { var n = i.__data__; if (!re || n.length < 199) return n.push([e, t]), this.size = ++i.size, this; i = this.__data__ = new ge(n); } return i.set(e, t), this.size = i.size, this; }; var Me = te ? function (e) { return null == e ? [] : (e = Object(e), function (e, t) { for (var i = -1, n = null == e ? 0 : e.length, s = 0, r = []; ++i < n;) { var o = e[i]; t(o, i, e) && (r[s++] = o); } return r; }(te(e), function (t) { return q.call(e, t); })); } : function () { return []; }, Pe = Ie; function Ae(e, t) { return !!(t = null == t ? s : t) && ("number" == typeof e || _.test(e)) && e > -1 && e % 1 == 0 && e < t; } function Ce(e) { if (null != e) { try { return B.call(e); } catch (e) {} try { return e + ""; } catch (e) {} } return ""; } function Te(e, t) { return e === t || e != e && t != t; } (se && Pe(new se(new ArrayBuffer(1))) != w || re && Pe(new re()) != l || oe && Pe(oe.resolve()) != d || ae && Pe(new ae()) != v || ue && Pe(new ue()) != g) && (Pe = function Pe(e) { var t = Ie(e), i = t == m ? e.constructor : void 0, n = i ? Ce(i) : ""; if (n) switch (n) { case he: return w; case le: return l; case fe: return d; case me: return v; case de: return g; } return t; }); var Fe = xe(function () { return arguments; }()) ? xe : function (e) { return Be(e) && W.call(e, "callee") && !q.call(e, "callee"); }, ke = Array.isArray, Re = ie || function () { return !1; }; function He(e) { if (!Ye(e)) return !1; var t = Ie(e); return t == h || "[object GeneratorFunction]" == t || "[object AsyncFunction]" == t || "[object Proxy]" == t; } function $e(e) { return "number" == typeof e && e > -1 && e % 1 == 0 && e <= s; } function Ye(e) { var t = _typeof(e); return null != e && ("object" == t || "function" == t); } function Be(e) { return null != e && "object" == _typeof(e); } var We = M ? function (e) { return function (t) { return e(t); }; }(M) : function (e) { return Be(e) && $e(e.length) && !!I[Ie(e)]; }; function Ge(e) { return null != (t = e) && $e(t.length) && !He(t) ? Se(e) : je(e); var t; } e.exports = function (e, t) { return Ee(e, t); }; }(f, f.exports)), f.exports), d = i(m); function p(e, t, i) { return e[t] ? e[t][0] ? e[t][0][i] : e[t][i] : "contentBoxSize" === t ? e.contentRect["inlineSize" === i ? "width" : "height"] : void 0; } function v(t) { void 0 === t && (t = {}); var i = t.onResize, n = e.useRef(void 0); n.current = i; var s = t.round || Math.round, r = e.useRef(), o = e.useState({ width: void 0, height: void 0 }), a = o[0], u = o[1], c = e.useRef(!1); e.useEffect(function () { return c.current = !1, function () { c.current = !0; }; }, []); var h = e.useRef({ width: void 0, height: void 0 }), l = function (t, i) { var n = e.useRef(null), s = e.useRef(null); s.current = i; var r = e.useRef(null); e.useEffect(function () { o(); }); var o = e.useCallback(function () { var e = r.current, i = s.current, o = e || (i ? i instanceof Element ? i : i.current : null); n.current && n.current.element === o && n.current.subscriber === t || (n.current && n.current.cleanup && n.current.cleanup(), n.current = { element: o, subscriber: t, cleanup: o ? t(o) : void 0 }); }, [t]); return e.useEffect(function () { return function () { n.current && n.current.cleanup && (n.current.cleanup(), n.current = null); }; }, []), e.useCallback(function (e) { r.current = e, o(); }, [o]); }(e.useCallback(function (e) { return r.current && r.current.box === t.box && r.current.round === s || (r.current = { box: t.box, round: s, instance: new ResizeObserver(function (e) { var i = e[0], r = "border-box" === t.box ? "borderBoxSize" : "device-pixel-content-box" === t.box ? "devicePixelContentBoxSize" : "contentBoxSize", o = p(i, r, "inlineSize"), a = p(i, r, "blockSize"), l = o ? s(o) : void 0, f = a ? s(a) : void 0; if (h.current.width !== l || h.current.height !== f) { var m = { width: l, height: f }; h.current.width = l, h.current.height = f, n.current ? n.current(m) : c.current || u(m); } }) }), r.current.instance.observe(e, { box: t.box }), function () { r.current && r.current.instance.unobserve(e); }; }, [t.box, s]), t.ref); return e.useMemo(function () { return { ref: l, width: a.width, height: a.height }; }, [l, a.width, a.height]); } var y = "allotment-module_splitView__L-yRc", b = "allotment-module_sashContainer__fzwJF", g = "allotment-module_splitViewContainer__rQnVa", z = "allotment-module_splitViewView__MGZ6O", w = "allotment-module_vertical__WSwwa", S = "allotment-module_horizontal__7doS8", _ = "allotment-module_separatorBorder__x-rDS"; var I, x = !1, E = !1; "object" == (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) && (I = navigator.userAgent, E = I.indexOf("Macintosh") >= 0, x = (I.indexOf("Macintosh") >= 0 || I.indexOf("iPad") >= 0 || I.indexOf("iPhone") >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0); var V = x, j = E, L = "undefined" != typeof window && void 0 !== window.document && void 0 !== window.document.createElement ? e.useLayoutEffect : e.useEffect; var N = /*#__PURE__*/function () { function N() { _classCallCheck(this, N); this._size = void 0; } return _createClass(N, [{ key: "getSize", value: function getSize() { return this._size; } }, { key: "setSize", value: function setSize(e) { this._size = e; } }]); }(); function O(e, t) { var i = e.length, n = i - t.length; return n >= 0 && e.slice(n, i) === t; } var D, M = { exports: {} }; var P, A, C = (D || (D = 1, function (e) { var t = Object.prototype.hasOwnProperty, i = "~"; function n() {} function s(e, t, i) { this.fn = e, this.context = t, this.once = i || !1; } function r(e, t, n, r, o) { if ("function" != typeof n) throw new TypeError("The listener must be a function"); var a = new s(n, r || e, o), u = i ? i + t : t; return e._events[u] ? e._events[u].fn ? e._events[u] = [e._events[u], a] : e._events[u].push(a) : (e._events[u] = a, e._eventsCount++), e; } function o(e, t) { 0 == --e._eventsCount ? e._events = new n() : delete e._events[t]; } function a() { this._events = new n(), this._eventsCount = 0; } Object.create && (n.prototype = Object.create(null), new n().__proto__ || (i = !1)), a.prototype.eventNames = function () { var e, n, s = []; if (0 === this._eventsCount) return s; for (n in e = this._events) t.call(e, n) && s.push(i ? n.slice(1) : n); return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(e)) : s; }, a.prototype.listeners = function (e) { var t = i ? i + e : e, n = this._events[t]; if (!n) return []; if (n.fn) return [n.fn]; for (var s = 0, r = n.length, o = new Array(r); s < r; s++) o[s] = n[s].fn; return o; }, a.prototype.listenerCount = function (e) { var t = i ? i + e : e, n = this._events[t]; return n ? n.fn ? 1 : n.length : 0; }, a.prototype.emit = function (e, t, n, s, r, o) { var a = i ? i + e : e; if (!this._events[a]) return !1; var u, c, h = this._events[a], l = arguments.length; if (h.fn) { switch (h.once && this.removeListener(e, h.fn, void 0, !0), l) { case 1: return h.fn.call(h.context), !0; case 2: return h.fn.call(h.context, t), !0; case 3: return h.fn.call(h.context, t, n), !0; case 4: return h.fn.call(h.context, t, n, s), !0; case 5: return h.fn.call(h.context, t, n, s, r), !0; case 6: return h.fn.call(h.context, t, n, s, r, o), !0; } for (c = 1, u = new Array(l - 1); c < l; c++) u[c - 1] = arguments[c]; h.fn.apply(h.context, u); } else { var f, m = h.length; for (c = 0; c < m; c++) switch (h[c].once && this.removeListener(e, h[c].fn, void 0, !0), l) { case 1: h[c].fn.call(h[c].context); break; case 2: h[c].fn.call(h[c].context, t); break; case 3: h[c].fn.call(h[c].context, t, n); break; case 4: h[c].fn.call(h[c].context, t, n, s); break; default: if (!u) for (f = 1, u = new Array(l - 1); f < l; f++) u[f - 1] = arguments[f]; h[c].fn.apply(h[c].context, u); } } return !0; }, a.prototype.on = function (e, t, i) { return r(this, e, t, i, !1); }, a.prototype.once = function (e, t, i) { return r(this, e, t, i, !0); }, a.prototype.removeListener = function (e, t, n, s) { var r = i ? i + e : e; if (!this._events[r]) return this; if (!t) return o(this, r), this; var a = this._events[r]; if (a.fn) a.fn !== t || s && !a.once || n && a.context !== n || o(this, r);else { for (var u = 0, c = [], h = a.length; u < h; u++) (a[u].fn !== t || s && !a[u].once || n && a[u].context !== n) && c.push(a[u]); c.length ? this._events[r] = 1 === c.length ? c[0] : c : o(this, r); } return this; }, a.prototype.removeAllListeners = function (e) { var t; return e ? (t = i ? i + e : e, this._events[t] && o(this, t)) : (this._events = new n(), this._eventsCount = 0), this; }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = i, a.EventEmitter = a, e.exports = a; }(M)), M.exports), T = i(C); function F(e, t) { var i = e.indexOf(t); i > -1 && (e.splice(i, 1), e.unshift(t)); } function k(e, t) { var i = e.indexOf(t); i > -1 && (e.splice(i, 1), e.push(t)); } function R(e, t) { var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; var n = Math.max(0, Math.ceil((t - e) / i)), s = new Array(n); var r = -1; for (; ++r < n;) s[r] = e + r * i; return s; } var H = i(function () { if (A) return P; A = 1; var e = /^\s+|\s+$/g, i = /^[-+]0x[0-9a-f]+$/i, n = /^0b[01]+$/i, s = /^0o[0-7]+$/i, r = parseInt, o = "object" == _typeof(t) && t && t.Object === Object && t, a = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self, u = o || a || Function("return this")(), c = Object.prototype.toString, h = Math.max, l = Math.min, f = function f() { return u.Date.now(); }; function m(e) { var t = _typeof(e); return !!e && ("object" == t || "function" == t); } function d(t) { if ("number" == typeof t) return t; if (function (e) { return "symbol" == _typeof(e) || function (e) { return !!e && "object" == _typeof(e); }(e) && "[object Symbol]" == c.call(e); }(t)) return NaN; if (m(t)) { var o = "function" == typeof t.valueOf ? t.valueOf() : t; t = m(o) ? o + "" : o; } if ("string" != typeof t) return 0 === t ? t : +t; t = t.replace(e, ""); var a = n.test(t); return a || s.test(t) ? r(t.slice(2), a ? 2 : 8) : i.test(t) ? NaN : +t; } return P = function P(e, t, i) { var n, s, r, o, a, u, c = 0, p = !1, v = !1, y = !0; if ("function" != typeof e) throw new TypeError("Expected a function"); function b(t) { var i = n, r = s; return n = s = void 0, c = t, o = e.apply(r, i); } function g(e) { var i = e - u; return void 0 === u || i >= t || i < 0 || v && e - c >= r; } function z() { var e = f(); if (g(e)) return w(e); a = setTimeout(z, function (e) { var i = t - (e - u); return v ? l(i, r - (e - c)) : i; }(e)); } function w(e) { return a = void 0, y && n ? b(e) : (n = s = void 0, o); } function S() { var e = f(), i = g(e); if (n = arguments, s = this, u = e, i) { if (void 0 === a) return function (e) { return c = e, a = setTimeout(z, t), p ? b(e) : o; }(u); if (v) return a = setTimeout(z, t), b(u); } return void 0 === a && (a = setTimeout(z, t)), o; } return t = d(t) || 0, m(i) && (p = !!i.leading, r = (v = "maxWait" in i) ? h(d(i.maxWait) || 0, t) : r, y = "trailing" in i ? !!i.trailing : y), S.cancel = function () { void 0 !== a && clearTimeout(a), c = 0, n = u = s = a = void 0; }, S.flush = function () { return void 0 === a ? o : w(f()); }, S; }; }()), $ = "sash-module_sash__K-9lB", Y = "sash-module_disabled__Hm-wx", B = "sash-module_mac__Jf6OJ", W = "sash-module_vertical__pB-rs", G = "sash-module_minimum__-UKxp", U = "sash-module_maximum__TCWxD", X = "sash-module_horizontal__kFbiw", J = "sash-module_hover__80W6I", K = "sash-module_active__bJspD"; var Z = function (e) { return e.Vertical = "VERTICAL", e.Horizontal = "HORIZONTAL", e; }({}), q = function (e) { return e.Disabled = "DISABLED", e.Minimum = "MINIMUM", e.Maximum = "MAXIMUM", e.Enabled = "ENABLED", e; }({}), Q = V ? 20 : 8; var ee = new T(); var te = /*#__PURE__*/function (_T) { function te(e, t, i) { var _i$orientation; var _this; _classCallCheck(this, te); _this = _callSuper(this, te), _this.el = void 0, _this.layoutProvider = void 0, _this.orientation = void 0, _this.size = void 0, _this.hoverDelay = 300, _this.hoverDelayer = H(function (e) { return e.classList.add("sash-hover", J); }, _this.hoverDelay), _this._state = q.Enabled, _this.onPointerStart = function (e) { var t = e.pageX, i = e.pageY, n = { startX: t, currentX: t, startY: i, currentY: i }; _this.el.classList.add("sash-active", K), _this.emit("start", n), _this.el.setPointerCapture(e.pointerId); var s = function s(e) { e.preventDefault(); var n = { startX: t, currentX: e.pageX, startY: i, currentY: e.pageY }; _this.emit("change", n); }, _r = function r(e) { e.preventDefault(), _this.el.classList.remove("sash-active", K), _this.hoverDelayer.cancel(), _this.emit("end"), _this.el.releasePointerCapture(e.pointerId), window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", _r); }; window.addEventListener("pointermove", s), window.addEventListener("pointerup", _r); }, _this.onPointerDoublePress = function () { _this.emit("reset"); }, _this.onMouseEnter = function () { _this.el.classList.contains(K) ? (_this.hoverDelayer.cancel(), _this.el.classList.add("sash-hover", J)) : _this.hoverDelayer(_this.el); }, _this.onMouseLeave = function () { _this.hoverDelayer.cancel(), _this.el.classList.remove("sash-hover", J); }, _this.el = document.createElement("div"), _this.el.classList.add("sash", $), _this.el.dataset.testid = "sash", e.append(_this.el), j && _this.el.classList.add("sash-mac", B), _this.el.addEventListener("pointerdown", _this.onPointerStart), _this.el.addEventListener("dblclick", _this.onPointerDoublePress), _this.el.addEventListener("mouseenter", _this.onMouseEnter), _this.el.addEventListener("mouseleave", _this.onMouseLeave), "number" == typeof i.size ? (_this.size = i.size, i.orientation === Z.Vertical ? _this.el.style.width = "".concat(_this.size, "px") : _this.el.style.height = "".concat(_this.size, "px")) : (_this.size = Q, ee.on("onDidChangeGlobalSize", function (e) { _this.size = e, _this.layout(); })), _this.layoutProvider = t, _this.orientation = (_i$orientation = i.orientation) !== null && _i$orientation !== void 0 ? _i$orientation : Z.Vertical, _this.orientation === Z.Horizontal ? (_this.el.classList.add("sash-horizontal", X), _this.el.classList.remove("sash-vertical", W)) : (_this.el.classList.remove("sash-horizontal", X), _this.el.classList.add("sash-vertical", W)), _this.layout(); return _this; } _inherits(te, _T); return _createClass(te, [{ key: "state", get: function get() { return this._state; }, set: function set(e) { this._state !== e && (this.el.classList.toggle(Y, e === q.Disabled), this.el.classList.toggle("sash-disabled", e === q.Disabled), this.el.classList.toggle(G, e === q.Minimum), this.el.classList.toggle("sash-minimum", e === q.Minimum), this.el.classList.toggle(U, e === q.Maximum), this.el.classList.toggle("sash-maximum", e === q.Maximum), this._state = e, this.emit("enablementChange", e)); } }, { key: "layout", value: function layout() { if (this.orientation === Z.Vertical) { var _e2 = this.layoutProvider; this.el.style.left = _e2.getVerticalSashLeft(this) - this.size / 2 + "px", _e2.getVerticalSashTop && (this.el.style.top = _e2.getVerticalSashTop(this) + "px"), _e2.getVerticalSashHeight && (this.el.style.height = _e2.getVerticalSashHeight(this) + "px"); } else { var _e3 = this.layoutProvider; this.el.style.top = _e3.getHorizontalSashTop(this) - this.size / 2 + "px", _e3.getHorizontalSashLeft && (this.el.style.left = _e3.getHorizontalSashLeft(this) + "px"), _e3.getHorizontalSashWidth && (this.el.style.width = _e3.getHorizontalSashWidth(this) + "px"); } } }, { key: "dispose", value: function dispose() { var _this2 = this; this.el.removeEventListener("pointerdown", this.onPointerStart), this.el.removeEventListener("dblclick", this.onPointerDoublePress), this.el.removeEventListener("mouseenter", this.onMouseEnter), this.el.removeEventListener("mouseleave", function () { return _this2.onMouseLeave; }), this.el.remove(); } }]); }(T); var ie; var ne; (ne = ie || (ie = {})).Distribute = { type: "distribute" }, ne.Split = function (e) { return { type: "split", index: e }; }, ne.Invisible = function (e) { return { type: "invisible", cachedVisibleSize: e }; }; var se = function (e) { return e.Normal = "NORMAL", e.Low = "LOW", e.High = "HIGH", e; }({}); var re = /*#__PURE__*/function () { function re(e, t, i) { _classCallCheck(this, re); this.container = void 0, this.view = void 0, this._size = void 0, this._cachedVisibleSize = void 0, this.container = e, this.view = t, this.container.classList.add("split-view-view", z), this.container.dataset.testid = "split-view-view", "number" == typeof i ? (this._size = i, this._cachedVisibleSize = void 0, e.classList.add("split-view-view-visible")) : (this._size = 0, this._cachedVisibleSize = i.cachedVisibleSize); } return _createClass(re, [{ key: "size", get: function get() { return this._size; }, set: function set(e) { this._size = e; } }, { key: "priority", get: function get() { return this.view.priority; } }, { key: "snap", get: function get() { return !!this.view.snap; } }, { key: "cachedVisibleSize", get: function get() { return this._cachedVisibleSize; } }, { key: "visible", get: function get() { return void 0 === this._cachedVisibleSize; } }, { key: "setVisible", value: function setVisible(e, t) { e !== this.visible && (e ? (this.size = l(this._cachedVisibleSize, this.viewMinimumSize, this.viewMaximumSize), this._cachedVisibleSize = void 0) : (this._cachedVisibleSize = "number" == typeof t ? t : this.size, this.size = 0), this.container.classList.toggle("split-view-view-visible", e), this.view.setVisible && this.view.setVisible(e)); } }, { key: "minimumSize", get: function get() { return this.visible ? this.view.minimumSize : 0; } }, { key: "viewMinimumSize", get: function get() { return this.view.minimumSize; } }, { key: "maximumSize", get: function get() { return this.visible ? this.view.maximumSize : 0; } }, { key: "viewMaximumSize", get: function get() { return this.view.maximumSize; } }, { key: "enabled", set: function set(e) { this.container.style.pointerEvents = e ? "" : "none"; } }, { key: "layout", value: function layout(e) { this.layoutContainer(e), this.view.layout(this.size, e); } }]); }(); var oe = /*#__PURE__*/function (_re) { function oe() { _classCallCheck(this, oe); return _callSuper(this, oe, arguments); } _inherits(oe, _re); return _createClass(oe, [{ key: "layoutContainer", value: function layoutContainer(e) { this.container.style.left = "".concat(e, "px"), this.container.style.width = "".concat(this.size, "px"); } }]); }(re); var ae = /*#__PURE__*/function (_re2) { function ae() { _classCallCheck(this, ae); return _callSuper(this, ae, arguments); } _inherits(ae, _re2); return _createClass(ae, [{ key: "layoutContainer", value: function layoutContainer(e) { this.container.style.top = "".concat(e, "px"), this.container.style.height = "".concat(this.size, "px"); } }]); }(re); var ue = /*#__PURE__*/function (_T2) { function ue(e) { var _t$orientation, _t$proportionalLayout; var _this3; var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var i = arguments.length > 2 ? arguments[2] : undefined; var n = arguments.length > 3 ? arguments[3] : undefined; var s = arguments.length > 4 ? arguments[4] : undefined; _classCallCheck(this, ue); if (_this3 = _callSuper(this, ue), _this3.onDidChange = void 0, _this3.onDidDragStart = void 0, _this3.onDidDragEnd = void 0, _this3.orientation = void 0, _this3.sashContainer = void 0, _this3.size = 0, _this3.contentSize = 0, _this3.proportions = void 0, _this3.viewItems = [], _this3.sashItems = [], _this3.sashDragState = void 0, _this3.proportionalLayout = void 0, _this3.getSashOrthogonalSize = void 0, _this3._startSnappingEnabled = !0, _this3._endSnappingEnabled = !0, _this3.onSashEnd = function (e) { _this3.emit("sashchange", e), _this3.saveProportions(); var _iterator = _createForOfIteratorHelper(_this3.viewItems), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var _e4 = _step.value; _e4.enabled = !0; } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } }, _this3.orientation = (_t$orientation = t.orientation) !== null && _t$orientation !== void 0 ? _t$orientation : Z.Vertical, _this3.proportionalLayout = (_t$proportionalLayout = t.proportionalLayout) !== null && _t$proportionalLayout !== void 0 ? _t$proportionalLayout : !0, _this3.getSashOrthogonalSize = t.getSashOrthogonalSize, i && (_this3.onDidChange = i), n && (_this3.onDidDragStart = n), s && (_this3.onDidDragEnd = s), _this3.sashContainer = document.createElement("div"), _this3.sashContainer.classList.add("sash-container", b), e.prepend(_this3.sashContainer), t.descriptor) { _this3.size = t.descriptor.size; var _iterator2 = _createForOfIteratorHelper(t.descriptor.views.entries()), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var _step2$value = _slicedToArray(_step2.value, 2), _e5 = _step2$value[0], _i = _step2$value[1]; var _t = _i.size, _n = _i.container, _s = _i.view; _this3.addView(_n, _s, _t, _e5, !0); } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } _this3.contentSize = _this3.viewItems.reduce(function (e, t) { return e + t.size; }, 0), _this3.saveProportions(); } return _this3; } _inherits(ue, _T2); return _createClass(ue, [{ key: "startSnappingEnabled", get: function get() { return this._startSnappingEnabled; }, set: function set(e) { this._startSnappingEnabled !== e && (this._startSnappingEnabled = e, this.updateSashEnablement()); } }, { key: "endSnappingEnabled", get: function get() { return this._endSnappingEnabled; }, set: function set(e) { this._endSnappingEnabled !== e && (this._endSnappingEnabled = e, this.updateSashEnablement()); } }, { key: "addView", value: function addView(e, t, i) { var _this4 = this; var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.viewItems.length; var s = arguments.length > 4 ? arguments[4] : undefined; var r; r = "number" == typeof i ? i : "split" === i.type ? this.getViewSize(i.index) / 2 : "invisible" === i.type ? { cachedVisibleSize: i.cachedVisibleSize } : t.minimumSize; var o = this.orientation === Z.Vertical ? new ae(e, t, r) : new oe(e, t, r); if (this.viewItems.splice(n, 0, o), this.viewItems.length > 1) { var _e6 = this.orientation === Z.Vertical ? new te(this.sashContainer, { getHorizontalSashTop: function getHorizontalSashTop(e) { return _this4.getSashPosition(e); }, getHorizontalSashWidth: this.getSashOrthogonalSize }, { orientation: Z.Horizontal }) : new te(this.sashContainer, { getVerticalSashLeft: function getVerticalSashLeft(e) { return _this4.getSashPosition(e); }, getVerticalSashHeight: this.getSashOrthogonalSize }, { orientation: Z.Vertical }), _t2 = this.orientation === Z.Vertical ? function (t) { return { sash: _e6, start: t.startY, current: t.currentY }; } : function (t) { return { sash: _e6, start: t.startX, current: t.currentX }; }; _e6.on("start", function (e) { var _this4$onDidDragStart; _this4.emit("sashDragStart"), _this4.onSashStart(_t2(e)); var i = _this4.viewItems.map(function (e) { return e.size; }); (_this4$onDidDragStart = _this4.onDidDragStart) === null || _this4$onDidDragStart === void 0 || _this4$onDidDragStart.call(_this4, i); }), _e6.on("change", function (e) { return _this4.onSashChange(_t2(e)); }), _e6.on("end", function () { var _this4$onDidDragEnd; _this4.emit("sashDragEnd"), _this4.onSashEnd(_this4.sashItems.findIndex(function (t) { return t.sash === _e6;