{"version":3,"file":"grid-layout-plus.mjs","sources":["../node_modules/.pnpm/@vexip-ui+utils@2.16.1/node_modules/@vexip-ui/utils/dist/index.mjs","../src/helpers/common.ts","../src/helpers/draggable.ts","../src/helpers/responsive.ts","../src/helpers/dom.ts","../node_modules/.pnpm/interactjs@1.10.27/node_modules/interactjs/dist/interact.min.js","../src/components/grid-item.vue","../node_modules/.pnpm/@vexip-ui+hooks@2.8.0_vue@3.5.13_typescript@5.8.3_/node_modules/@vexip-ui/hooks/dist/index.mjs","../src/components/grid-layout.vue"],"sourcesContent":["const y = typeof window < \"u\";\nvar At;\nconst mn = y && ((At = window == null ? void 0 : window.navigator) == null ? void 0 : At.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent), ee = Object.prototype.toString, ne = Object.prototype.hasOwnProperty;\nfunction B(t, e) {\n return ee.call(t) === `[object ${e}]`;\n}\nfunction bn(t, e) {\n return ne.call(t, e);\n}\nfunction S(t) {\n return t != null;\n}\nfunction re(t) {\n return t == null;\n}\nfunction yn(t) {\n return typeof t == \"number\";\n}\nfunction oe(t) {\n return Number.isNaN(t);\n}\nfunction Mn(t) {\n return typeof t == \"string\";\n}\nfunction Sn(t) {\n return typeof t == \"boolean\";\n}\nfunction wn(t) {\n return t === !0;\n}\nfunction En(t) {\n return t === !1;\n}\nfunction Nn(t) {\n return typeof t == \"symbol\";\n}\nfunction An(t) {\n return typeof t == \"bigint\";\n}\nfunction Fn(t) {\n return Array.isArray(t);\n}\nfunction Y(t) {\n return B(t, \"Object\");\n}\nfunction $n(t) {\n return !!t && typeof t.then == \"function\" && typeof t.catch == \"function\";\n}\nfunction Ft(t) {\n return typeof t == \"function\";\n}\nfunction Tn(t) {\n return B(t, \"Set\");\n}\nfunction Cn(t) {\n return B(t, \"Map\");\n}\nfunction On(t) {\n return B(t, \"Date\");\n}\nfunction Rn(t) {\n return B(t, \"RegExp\");\n}\nfunction _n(t) {\n return Array.isArray(t) || typeof t == \"string\" ? t.length === 0 : t instanceof Map || t instanceof Set ? t.size === 0 : Y(t) ? Object.keys(t).length === 0 : typeof t == \"number\" ? oe(t) : re(t);\n}\nfunction kn(t, e = !1) {\n return !e && !y ? !1 : !!(t && \"nodeType\" in t);\n}\nfunction G(t) {\n return S(t) && typeof t[Symbol.iterator] == \"function\";\n}\nfunction ot() {\n}\nfunction ie() {\n return !0;\n}\nfunction xn() {\n return !1;\n}\nfunction Dn(t, e = 1, n = 1) {\n const r = [];\n for (let o = 0; o < t; ++o)\n r.push(e + o * n);\n return r;\n}\nfunction se(t) {\n return Object.prototype.toString.call(t).slice(8, -1);\n}\nfunction In(t = 16) {\n const e = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\", n = e.length;\n let r = \"\";\n for (; t--; )\n r += e.charAt(Math.floor(Math.random() * n));\n return r;\n}\nasync function Ln(t, e = {}) {\n if (t.length) {\n for (const [n, r] of t)\n if (typeof n == \"function\" ? n() : n)\n return typeof e.beforeMatchAny == \"function\" && await e.beforeMatchAny(), await r(), typeof e.afterMatchAny == \"function\" && await e.afterMatchAny(), !0;\n }\n return !1;\n}\nasync function Hn(t) {\n if (!y)\n return !1;\n try {\n return await navigator.clipboard.writeText(t), !0;\n } catch {\n let e = !1;\n const n = document.createElement(\"textarea\"), r = document.activeElement;\n n.value = t, n.setAttribute(\"readonly\", \"\"), n.style.contain = \"strict\", n.style.position = \"absolute\", n.style.height = \"0\", n.style.fontSize = \"12pt\";\n const o = document.getSelection(), i = o ? o.rangeCount > 0 && o.getRangeAt(0) : null;\n return document.body.appendChild(n), n.select(), n.selectionStart = 0, n.selectionEnd = t.length, e = document.execCommand(\"copy\"), document.body.removeChild(n), i && (o.removeAllRanges(), o.addRange(i)), r && r.focus(), e;\n }\n}\nconst ce = \"[-\\\\+]?\\\\d+%?\", ae = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\", F = `(?:${ae})|(?:${ce})`, fe = `[\\\\s|\\\\(]+(${F})[,|\\\\s]+(${F})[,|\\\\s]+(${F})\\\\s*\\\\)?`, U = `[\\\\s|\\\\(]+(${F})[,|\\\\s]+(${F})[,|\\\\s]+(${F})[,|\\\\s]+(${F})\\\\s*\\\\)?`, $t = new RegExp(`rgb${fe}`), Tt = new RegExp(`rgba${U}`), Ct = new RegExp(`hsl${U}`), Ot = new RegExp(`hsla${U}`), Rt = new RegExp(`hsv${U}`), _t = new RegExp(`hsva${U}`), kt = /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, xt = /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, Dt = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, It = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, W = Object.freeze({\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n}), ue = Object.freeze(new Set(Object.keys(W)));\nfunction Pn(t) {\n return t = String(t).trim().toLowerCase(), t ? t === \"transparent\" || W[t] ? !0 : t === \"transparent\" || ue.has(t) || $t.test(t) || Tt.test(t) || Ct.test(t) || Ot.test(t) || Rt.test(t) || _t.test(t) || kt.test(t) || xt.test(t) || Dt.test(t) || It.test(t) : !1;\n}\nfunction le(t) {\n if (t = t.toString().trim().toLowerCase(), t === \"transparent\")\n return { r: 0, g: 0, b: 0, a: 0, format: \"name\", toString: M };\n let e = !1;\n W[t] && (t = W[t], e = !0);\n let n;\n if (n = $t.exec(t)) {\n const { r, g: o, b: i } = R(n[1], n[2], n[3]);\n return {\n r: r * 255,\n g: o * 255,\n b: i * 255,\n format: \"rgb\",\n toString: M\n };\n }\n if (n = Tt.exec(t)) {\n const { r, g: o, b: i } = R(n[1], n[2], n[3]);\n return {\n r: r * 255,\n g: o * 255,\n b: i * 255,\n a: O(n[4]),\n format: \"rgba\",\n toString: M\n };\n }\n if (n = Ct.exec(t)) {\n const { h: r, s: o, l: i } = z(n[0], n[1], n[3]);\n return { h: r * 360, s: o, l: i, format: \"hsl\", toString: H };\n }\n if (n = Ot.exec(t)) {\n const { h: r, s: o, l: i } = z(n[0], n[1], n[3]);\n return {\n h: r * 360,\n s: o,\n l: i,\n a: O(n[4]),\n format: \"hsla\",\n toString: H\n };\n }\n if (n = Rt.exec(t)) {\n const { h: r, s: o, v: i } = q(n[0], n[1], n[3]);\n return { h: r * 360, s: o, v: i, format: \"hsv\", toString: j };\n }\n if (n = _t.exec(t)) {\n const { h: r, s: o, v: i } = q(n[0], n[1], n[3]);\n return {\n h: r * 360,\n s: o,\n v: i,\n a: O(n[4]),\n format: \"hsva\",\n toString: j\n };\n }\n return (n = kt.exec(t)) ? {\n r: parseInt(`${n[1]}${n[1]}`, 16),\n g: parseInt(`${n[2]}${n[2]}`, 16),\n b: parseInt(`${n[3]}${n[3]}`, 16),\n format: e ? \"name\" : \"hex3\",\n toString: M\n } : (n = xt.exec(t)) ? {\n r: parseInt(`${n[1]}${n[1]}`, 16),\n g: parseInt(`${n[2]}${n[2]}`, 16),\n b: parseInt(`${n[3]}${n[3]}`, 16),\n a: pt(`${n[4]}${n[4]}`),\n format: e ? \"name\" : \"hex4\",\n toString: M\n } : (n = Dt.exec(t)) ? {\n r: parseInt(n[1], 16),\n g: parseInt(n[2], 16),\n b: parseInt(n[3], 16),\n format: e ? \"name\" : \"hex6\",\n toString: M\n } : (n = It.exec(t)) ? {\n r: parseInt(n[1], 16),\n g: parseInt(n[2], 16),\n b: parseInt(n[3], 16),\n a: pt(n[4]),\n format: e ? \"name\" : \"hex8\",\n toString: M\n } : null;\n}\nfunction Bn(t) {\n const { a: e, ...n } = $(t);\n delete n.format;\n const r = Ht(n.r, n.g, n.b), o = Pt(n.r, n.g, n.b), i = it(n.r, n.g, n.b), s = st(n.r, n.g, n.b, e);\n return {\n rgb: n,\n hsl: r,\n hsv: o,\n hex: i,\n alpha: e,\n rgba: { ...n, a: e, format: \"rgba\" },\n hsla: { ...r, a: e, format: \"hsla\" },\n hsva: { ...o, a: e, format: \"hsva\" },\n hex8: s,\n gray: Ut(n),\n origin: t\n };\n}\nfunction $(t) {\n let e = { r: 0, g: 0, b: 0 }, n = 1, r;\n return typeof t == \"string\" ? r = le(t) : r = t, r !== null && typeof r == \"object\" && (\"l\" in r ? e = Lt(r.h, r.s, r.l) : \"v\" in r && (e = he(r.h, r.s, r.v)), \"a\" in r && (n = O(r.a ?? 1), Number.isNaN(n) && (n = 1)), e = r), { ...e, a: n, format: \"rgba\", toString: M };\n}\nfunction z(t, e, n) {\n return {\n h: w(t, 0, 360) / 360,\n s: w(I(e) ? L(e) : e, 0, 1),\n l: w(I(n) ? L(n) : n, 0, 1)\n };\n}\nfunction R(t, e, n) {\n return {\n r: w(t, 0, 255) / 255,\n g: w(e, 0, 255) / 255,\n b: w(n, 0, 255) / 255\n };\n}\nfunction q(t, e, n) {\n return {\n h: w(t, 0, 360) / 360,\n s: w(I(e) ? L(e) : e, 0, 1),\n v: w(I(n) ? L(n) : n, 0, 1)\n };\n}\nfunction O(t) {\n return w(I(t) ? L(t) : t, 0, 1);\n}\nfunction Lt(t, e, n) {\n let r, o, i;\n if ({ h: t, s: e, l: n } = z(t, e, n), e === 0)\n r = o = i = n;\n else {\n const s = n < 0.5 ? 1 * (1 + e) : n + e - n * e, c = 2 * n - s;\n r = tt(c, s, t + 1 / 3), o = tt(c, s, t), i = tt(c, s, t - 1 / 3);\n }\n return r *= 255, o *= 255, i *= 255, { r, g: o, b: i, toString: M };\n}\nfunction Ht(t, e, n) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const r = Math.max(t, e, n), o = Math.min(t, e, n);\n let i, s;\n const c = (r + o) / 2;\n if (r === o)\n i = s = 0;\n else {\n const a = r - o;\n switch (s = c > 0.5 ? a / (2 - r - o) : a / (r + o), r) {\n case t: {\n i = (e - n) / a + (e < n ? 6 : 0);\n break;\n }\n case e: {\n i = (n - t) / a + 2;\n break;\n }\n case n: {\n i = (t - e) / a + 4;\n break;\n }\n default:\n i = 0;\n }\n i *= 60;\n }\n return { h: i, s, l: c, toString: H };\n}\nfunction de(t, e, n) {\n ({ h: t, s: e, l: n } = z(t, e, n));\n const r = 0.5 * (2 * n + e * (1 - Math.abs(2 * n - 1)));\n return e = 2 * (r - n) / r, { h: t * 360, s: e, v: r, toString: j };\n}\nfunction Un(t, e, n) {\n ({ h: t, s: e, v: n } = q(t, e, n));\n const r = 0.5 * n * (2 - e);\n return e = n * e / (1 - Math.abs(2 * r - 1)), { h: t * 360, s: e, l: r, toString: H };\n}\nfunction he(t, e, n) {\n ({ h: t, s: e, v: n } = q(t, e, n)), t *= 6;\n const r = Math.floor(t), o = t - r, i = n * (1 - e), s = n * (1 - o * e), c = n * (1 - (1 - o) * e), a = r % 6;\n let f = [n, s, i, i, c, n][a], u = [c, n, n, s, i, i][a], d = [i, i, c, n, n, s][a];\n return f *= 255, u *= 255, d *= 255, { r: f, g: u, b: d, toString: M };\n}\nfunction Pt(t, e, n) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const r = Math.max(t, e, n), o = Math.min(t, e, n);\n let i;\n const s = r, c = r - o, a = r === 0 ? 0 : c / r;\n if (r === o)\n i = 0;\n else {\n switch (r) {\n case t: {\n i = (e - n) / c + (e < n ? 6 : 0);\n break;\n }\n case e: {\n i = (n - t) / c + 2;\n break;\n }\n case n: {\n i = (t - e) / c + 4;\n break;\n }\n default:\n i = 0;\n }\n i *= 60;\n }\n return { h: i, s: a, v: s, toString: j };\n}\nfunction it(t, e, n, r = !1) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const o = [\n T(Math.round(t * 255).toString(16)),\n T(Math.round(e * 255).toString(16)),\n T(Math.round(n * 255).toString(16))\n ];\n return r && C(o[0]) && C(o[1]) && C(o[2]) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) : \"#\" + o.join(\"\");\n}\nfunction st(t, e, n, r, o = !1) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const i = [\n T(Math.round(t * 255).toString(16)),\n T(Math.round(e * 255).toString(16)),\n T(Math.round(n * 255).toString(16)),\n T(ge(O(r)))\n ];\n return o && C(i[0]) && C(i[1]) && C(i[2]) && C(i[3]) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) + i[3].charAt(0) : \"#\" + i.join(\"\");\n}\nfunction Yn(t, e, n = 0.5) {\n if (!t && !e)\n return { r: 0, g: 0, b: 0, a: 1 };\n if (!t)\n return $(e);\n if (!e)\n return $(t);\n const r = $(t), o = $(e), i = w(n, 0, 1), s = i * 2 - 1, c = r.a - o.a, f = ((s * c === -1 ? s : (s + c) / (1 + s * c)) + 1) / 2, u = 1 - f;\n return {\n r: Math.round(r.r * f + o.r * u),\n g: Math.round(r.g * f + o.g * u),\n b: Math.round(r.b * f + o.b * u),\n a: Math.round(r.a * i + o.a * (1 - i)),\n format: \"rgba\",\n toString: M\n };\n}\nfunction Gn(t, e) {\n const n = $(t);\n return n.a = O(e), n;\n}\nfunction Wn(t = !1, e = \"hex\") {\n const n = Math.round(Math.random() * 255), r = Math.round(Math.random() * 255), o = Math.round(Math.random() * 255);\n if (e === \"hex\")\n return t ? st(n, r, o, Math.random()) : it(n, r, o);\n let i;\n return e === \"hsl\" ? i = Ht(n, r, o) : e === \"hsv\" ? i = Pt(n, r, o) : i = /* @__PURE__ */ Object.create({ r: n, g: r, b: o, toString: M }), t && (i.a = Math.random()), i.toString();\n}\nfunction Bt(t, e = !1, n = \"hex\") {\n const r = Math.round(Math.random() * 360), o = Math.round(t === \"hard\" ? 80 + Math.random() * 20 : 20 + Math.random() * 70) / 100, i = Math.round(t === \"hard\" ? 40 + Math.random() * 20 : 80 + Math.random() * 15) / 100;\n if (n === \"hsl\")\n return H.bind({ h: r, s: o, l: i })();\n let s;\n if (n === \"hex\" || n === \"rgb\") {\n if (s = Lt(r, o, i), n === \"hex\") {\n const { r: c, g: a, b: f } = s;\n return e ? st(c, a, f, Math.random()) : it(c, a, f);\n }\n } else\n n === \"hsv\" && (s = de(r, o, i));\n return e && (s.a = Math.random()), s.toString();\n}\nfunction zn(t = !1, e = \"hex\") {\n return Bt(\"hard\", t, e);\n}\nfunction qn(t = !1, e = \"hex\") {\n return Bt(\"soft\", t, e);\n}\nfunction jn(t) {\n return Ut($(t));\n}\nfunction T(t) {\n return t.length === 1 ? `0${t}` : t.toString();\n}\nfunction C(t) {\n return t.charAt(0) === t.charAt(1);\n}\nfunction ge(t) {\n return Math.round(parseFloat(t) * 255).toString(16);\n}\nfunction pt(t) {\n return parseInt(t, 16) / 255;\n}\nfunction w(t, e, n) {\n return Math.max(e, Math.min(n, parseFloat(t)));\n}\nfunction tt(t, e, n) {\n return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;\n}\nfunction I(t) {\n return String(t).trim().includes(\"%\");\n}\nfunction L(t) {\n const e = parseFloat(t) / 100;\n return Number.isNaN(e) ? 0 : e;\n}\nfunction M() {\n return S(this.a) && this.a >= 0 && this.a < 1 ? `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})` : `rgb(${this.r}, ${this.g}, ${this.b})`;\n}\nfunction H() {\n const t = `${this.s * 100}%`, e = `${this.l * 100}%`;\n return S(this.a) && this.a >= 0 && this.a < 1 ? `hsla(${this.h}, ${t}, ${e}, ${this.a})` : `hsl(${this.h}, ${t}, ${e})`;\n}\nfunction j() {\n const t = `${this.s * 100}%`, e = `${this.v * 100}%`;\n return S(this.a) && this.a >= 0 && this.a < 1 ? `hsva(${this.h}, ${t}, ${e}, ${this.a})` : `hsv(${this.h}, ${t}, ${e})`;\n}\nfunction Ut(t) {\n return (t.r * 0.2126 + t.g * 0.7152 + t.b * 0.0722) / 255;\n}\nlet Yt = 0;\nfunction Kn() {\n return Yt++;\n}\nfunction Qn(t) {\n Yt = Math.round(t);\n}\nfunction Xn(t = 0) {\n return {\n getCount: () => t++,\n setCount: (e) => {\n t = e;\n }\n };\n}\nfunction mt(t) {\n return t & -t;\n}\nfunction Vn(t, e = 0) {\n const n = new Array(t + 1).fill(0);\n function r(c, a) {\n if (!(!a || c >= t))\n for (c += 1; c <= t; )\n n[c] += a, c += mt(c);\n }\n function o(c = t) {\n if (c <= 0)\n return 0;\n c > t && (c = t);\n let a = c * e;\n for (; c > 0; )\n a += n[c], c -= mt(c);\n return a;\n }\n function i(c) {\n return o(c + 1) - o(c);\n }\n function s(c) {\n let a = 0, f = t;\n for (; f > a; ) {\n const u = Math.floor((a + f) / 2), d = o(u);\n if (d > c) {\n f = u;\n continue;\n } else if (d < c) {\n if (a === u)\n return o(a + 1) <= c ? a + 1 : a;\n a = u;\n } else\n return u;\n }\n return a;\n }\n return { tree: n, add: r, sum: o, get: i, boundIndex: s };\n}\nconst pe = /^\\s*[+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?\\s*$/;\nfunction me(t, e = !1) {\n return typeof t == \"number\" ? !Number.isNaN(t) : e ? pe.test(String(t)) : !Number.isNaN(parseFloat(t)) || !Number.isNaN(Number(t));\n}\nfunction be(t) {\n let e = parseFloat(t);\n return Number.isNaN(e) && (e = Number(t)), Number.isNaN(e) ? 0 : e;\n}\nfunction ye(t, e) {\n return e <= 0 ? t.toString() : `${t < 0 ? \"-\" : \"\"}${String(Math.abs(Math.round(t))).padStart(e, \"0\")}`;\n}\nfunction N(t) {\n return ye(t, 2);\n}\nfunction E(t) {\n const e = t.toString().split(/[eE]/), n = (e[0].split(\".\")[1] || \"\").length - +(e[1] || 0);\n return n > 0 ? n : 0;\n}\nfunction Zn(t) {\n return E(t);\n}\nfunction vn(t, e = 3, n = \",\") {\n if (typeof t != \"number\" && (t = parseFloat(t)), Number.isNaN(t))\n return \"0\";\n let [r, o] = String(t).split(\".\");\n const i = new RegExp(`(\\\\d+)(\\\\d{${e}})`);\n for (; i.test(r); )\n r = r.replace(i, `$1${n}$2`);\n return o = o ? `.${o}` : \"\", `${r}${o}`;\n}\nfunction Gt(t, e) {\n if (e === 0)\n return Math.round(t);\n let n = t.toFixed(E(t));\n const r = n.indexOf(\".\");\n if (r === -1)\n return t;\n const o = n.replace(\".\", \"\").split(\"\"), i = r + e;\n return o[i] ? (n.charAt(i + 1) === \"5\" ? n = n.substring(0, i + 1) + \"6\" : n = n.substring(0, i + 2), parseFloat(Number(n).toFixed(e))) : t;\n}\nfunction Jn(t, e, n) {\n return Gt(t * e, n);\n}\nfunction tr(t, e) {\n if (e < 0 || e > 1)\n return Math.round(t);\n const n = Math.ceil(t);\n return t + 1 - e >= n ? n : Math.floor(t);\n}\nfunction er(t, e, n) {\n return Math.max(e, Math.min(n, parseFloat(t)));\n}\nfunction nr(t, e, n = 0) {\n if (t <= 0 || e <= 1)\n return [t];\n n < 1 && (n = 1 / 0);\n const r = [];\n let o = 0;\n for (; t >= e && o < n; )\n r.push(t % e), t = Math.floor(t / e), ++o;\n return r.push(t), r.reverse();\n}\nfunction rr(t) {\n if (t < 0)\n return `${t}th`;\n const e = [\"th\", \"st\", \"nd\", \"rd\"], n = t % 100;\n return `${t}${e[n] || e[t % 10] || e[0]}`;\n}\nconst bt = Object.freeze([\n \"B\",\n \"KB\",\n \"MB\",\n \"GB\",\n \"TB\",\n \"AUTO\"\n]);\nfunction or(t, e = \"AUTO\", n = !1, r) {\n typeof r > \"u\" && (typeof n == \"number\" ? (r = n, n = !1) : r = 2);\n let o = e.toUpperCase();\n o = bt.includes(o) ? o : \"AUTO\";\n let i;\n switch (o) {\n case \"AUTO\":\n i = 0;\n break;\n case \"KB\":\n i = 1;\n break;\n case \"MB\":\n i = 2;\n break;\n case \"GB\":\n i = 3;\n break;\n case \"TB\":\n i = 4;\n break;\n default:\n return t;\n }\n let s;\n if (i)\n s = t / 1024 ** i;\n else\n for (s = t; s > 1024 && !(i > 4); ++i)\n s = s / 1024;\n return s = Gt(s, r), n ? `${s}${o === \"AUTO\" ? bt[Math.min(i, 4)] : o}` : s;\n}\nfunction ir(t, e = 0) {\n return e === t ? e : (e > t && ([e, t] = [t, e]), Math.random() * (t - e) + e);\n}\nfunction Wt(t, e = 15) {\n return +parseFloat(Number(t).toPrecision(e));\n}\nfunction K(t) {\n const e = String(t);\n if (!e.includes(\"e\"))\n return Number(e.replace(\".\", \"\"));\n const n = E(t);\n return n > 0 ? Wt(Number(t) * 10 ** n) : Number(t);\n}\nfunction Q(t) {\n return (...e) => {\n let n = e[0];\n for (let r = 1, o = e.length; r < o; ++r)\n n = t(n, e[r]);\n return n;\n };\n}\nconst P = Q((t, e) => {\n const n = K(t), r = K(e), o = E(t) + E(e);\n return n * r / 10 ** o;\n}), sr = Q((t, e) => {\n const n = 10 ** Math.max(E(t), E(e));\n return (P(t, n) + P(e, n)) / n;\n}), cr = Q((t, e) => {\n const n = 10 ** Math.max(E(t), E(e));\n return (P(t, n) - P(e, n)) / n;\n}), ar = Q((t, e) => {\n const n = K(t), r = K(e);\n return P(n / r, Wt(10 ** (E(e) - E(t))));\n}), Me = 1e3, A = 1e3, k = 60, Se = k * A, fr = k * A, X = 60, zt = X * k, we = zt * A, ur = zt * A, qt = 24, Ee = qt * X, jt = Ee * k, Ne = jt * A, lr = jt * A, ct = 7, Ae = ct * qt, Fe = Ae * X, Kt = Fe * k, $e = Kt * A, dr = Kt * A, Qt = 3, Te = 4, Ce = Te * Qt, Oe = {\n y(t, e) {\n const n = t.getFullYear();\n return e.length === 4 ? n : n % 1e3 % 100;\n },\n M(t, e) {\n const n = t.getMonth() + 1;\n return e.length === 2 ? N(n) : n;\n },\n d(t, e) {\n const n = t.getDate();\n return e.length === 2 ? N(n) : n;\n },\n H(t, e) {\n const n = t.getHours();\n return e.length === 2 ? N(n) : n;\n },\n m(t, e) {\n const n = t.getMinutes();\n return e.length === 2 ? N(n) : n;\n },\n s(t, e) {\n const n = t.getSeconds();\n return e.length === 2 ? N(n) : n;\n },\n q(t, e) {\n const n = Math.ceil((t.getMonth() + 1) / 3);\n return e.length === 2 ? N(n) : n;\n }\n}, Re = /[yMdHmsq](\\w)*|./g, _e = /'(.+?)'/g;\nfunction h(t, e = !1) {\n const n = new Date(t);\n if (e && Number.isNaN(+n))\n throw new RangeError(\"Invalid date value\");\n return typeof t == \"string\" && !t.includes(\":\") && (n.setHours(0), n.setMinutes(0), n.setSeconds(0)), n;\n}\nfunction hr(t, e = \"yyyy-MM-dd HH:mm:ss\") {\n t = h(t);\n const n = e.match(Re), r = n == null ? void 0 : n.length;\n if (!r)\n return e;\n let o = 0, i = \"\";\n for (; o < r; ) {\n const s = n[o], c = s[0], a = Oe[c];\n a ? i += a(t, s) : i += s, ++o;\n }\n return i.replace(_e, \"$1\");\n}\nfunction gr(t) {\n return t = h(t), `${N(t.getHours())}:${N(t.getMinutes())}:${N(\n t.getSeconds()\n )}`;\n}\nfunction rt(t) {\n return t = h(t), Math.floor(t.getMonth() / 3) + 1;\n}\nconst ke = [\"日\", \"一\", \"二\", \"三\", \"四\", \"五\", \"六\"];\nfunction pr(t) {\n return ke[t.getDay()];\n}\nfunction xe(t, e) {\n return t = h(t), t.setTime(t.getTime() + e), t;\n}\nfunction De(t, e) {\n return e *= A, xe(t, e);\n}\nfunction Ie(t, e) {\n return e *= k, De(t, e);\n}\nfunction Le(t, e) {\n return e *= X, Ie(t, e);\n}\nfunction mr(t, e) {\n return e *= 12, Le(t, e);\n}\nfunction at(t, e) {\n return t = h(t), e = ~~e, t.setDate(t.getDate() + e), t;\n}\nfunction br(t, e) {\n return e *= ct, at(t, e);\n}\nfunction ft(t, e) {\n return t = h(t), e = ~~e, t.setMonth(t.getMonth() + e), t;\n}\nfunction yr(t, e) {\n return e *= Qt, ft(t, e);\n}\nfunction Mr(t, e) {\n return e *= Ce, ft(t, e);\n}\nfunction Sr(t, e = 42, n = 1) {\n t = h(t);\n const r = [];\n for (let o = 0; o < e; ++o)\n r.push(at(t, o * n));\n return r;\n}\nfunction wr(t, e = 12, n = 1) {\n t = h(t);\n const r = [];\n for (let o = 0; o < e; ++o)\n r.push(ft(t, o * n));\n return r;\n}\nfunction Er(t) {\n const e = t.getDay() ?? 7;\n return at(t, -e);\n}\nfunction yt(t) {\n return t = h(t), t.setMilliseconds(0), t;\n}\nfunction Mt(t) {\n return t = h(t), t.setSeconds(0, 0), t;\n}\nfunction St(t) {\n return t = h(t), t.setMinutes(0, 0, 0), t;\n}\nfunction wt(t) {\n return t = h(t), t.setHours(0, 0, 0, 0), t;\n}\nfunction Nr(t) {\n return t = h(t), t.setHours(23, 59, 59, 999), t;\n}\nfunction Et(t, e = 0) {\n e = e % 7, e < 0 && (e += 7), t = h(t);\n const n = t.getDay(), r = (n < e ? 7 : 0) + n - e;\n return t.setDate(t.getDate() - r), t.setHours(0, 0, 0, 0), t;\n}\nfunction He(t) {\n return t % 4 === 0 && t % 100 !== 0 || t % 400 === 0;\n}\nfunction Pe(t, e) {\n let n;\n return e < 7 ? e !== 2 ? n = 30 + e % 2 : He(t) ? n = 29 : n = 28 : n = 31 - e % 2, n;\n}\nfunction Ar(t, e = 1) {\n t = h(t);\n const n = t.getFullYear(), r = t.getMonth() + 1, o = t.getDate(), i = Pe(n, r);\n return e = e % i, e < 0 && (e += i), o < e && t.setMonth(r - 1), t.setDate(e), t.setHours(0, 0, 0, 0), t;\n}\nfunction Fr(t) {\n t = h(t);\n const e = rt(t);\n return t.setDate(1), t.setHours(0, 0, 0, 0), t.setMonth((e - 1) * 3), t;\n}\nfunction $r(t, e = 0) {\n e = e % 11, e < 0 && (e += 11), t = h(t);\n const n = t.getMonth(), r = (n < e ? 11 : 0) + n - e;\n return t.setMonth(t.getMonth() - r), t.setDate(1), t.setHours(0, 0, 0, 0), t;\n}\nfunction ut(t, e) {\n return t = h(t), e = h(e), e.getTime() - t.getTime();\n}\nfunction Be(t, e) {\n const n = ut(t, e) / Me;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Ue(t, e) {\n const n = ut(t, e) / Se;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Ye(t, e) {\n const n = ut(t, e) / we;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Ge(t, e) {\n return t = wt(t), e = wt(e), (e.getTime() - t.getTime()) / Ne;\n}\nfunction Tr(t, e, n = 0) {\n return t = Et(t, n), e = Et(e, n), (e.getTime() - t.getTime()) / $e;\n}\nfunction We(t, e) {\n t = h(t), e = h(e);\n const n = e.getFullYear() - t.getFullYear(), r = e.getMonth() - t.getMonth();\n return n * 12 + r;\n}\nfunction Cr(t, e) {\n t = h(t), e = h(e);\n const n = e.getFullYear() - t.getFullYear(), r = rt(e) - rt(t);\n return n * 4 + r;\n}\nfunction ze(t, e) {\n return t = h(t), e = h(e), e.getFullYear() - t.getFullYear();\n}\nfunction qe(t, e) {\n t = h(t), e = h(e);\n const n = t.getTime() - e.getTime();\n return n < 0 ? -1 : n > 0 ? 1 : n;\n}\nfunction _(t, e) {\n return -qe(t, e);\n}\nfunction Or(t, e) {\n return t = yt(t), e = yt(e), Be(t, e);\n}\nfunction Rr(t, e) {\n return t = Mt(t), e = Mt(e), Ue(t, e);\n}\nfunction _r(t, e) {\n return t = St(t), e = St(e), Ye(t, e);\n}\nfunction je(t, e) {\n const n = _(t, e), r = Math.abs(Ge(t, e));\n t = h(t), t.setDate(t.getDate() + n * r);\n const o = _(t, e) === -n;\n return n * (r - (o ? 1 : 0));\n}\nfunction kr(t, e) {\n const n = je(t, e) / ct;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Ke(t, e) {\n const n = _(t, e), r = Math.abs(We(t, e));\n t = h(t), t.setMonth(t.getMonth() + n * r);\n const o = _(t, e) === -n;\n return n * (r - (o ? 1 : 0));\n}\nfunction xr(t, e) {\n const n = Ke(t, e) / 3;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Dr(t, e) {\n const n = _(t, e), r = Math.abs(ze(t, e));\n t = h(t), t.setFullYear(t.getFullYear() + n * r);\n const o = _(t, e) === -n;\n return n * (r - (o ? 1 : 0));\n}\nfunction Qe(t, e = {}) {\n if (t == null || typeof t != \"object\")\n return t;\n const { cloneObject: n = ot } = e, r = {}, o = [\n {\n parent: r,\n prop: \"root\",\n data: t\n }\n ], i = /* @__PURE__ */ new WeakMap(), s = [], c = [];\n for (; o.length; ) {\n const { parent: a, prop: f, data: u } = o.pop();\n if (!a)\n continue;\n const d = se(u);\n if (d === \"Date\") {\n a[f] = new Date(u);\n continue;\n }\n if (d !== \"Array\") {\n const l = n(d, u);\n if (l != null) {\n a[f] = l;\n continue;\n }\n }\n const g = a[f] = d === \"Array\" || d === \"Set\" || d === \"Map\" ? [] : {};\n if (d === \"Set\" || d === \"Map\") {\n let l = 0;\n if (d === \"Set\") {\n for (const p of u)\n i.has(p) ? g[l] = i.get(p) : p !== null && typeof p == \"object\" ? o.push({\n parent: g,\n prop: l,\n data: p\n }) : g[l] = p, ++l;\n s.push({ parent: a, prop: f });\n } else {\n for (const p of u) {\n const b = [];\n l = 0;\n for (const m of p)\n i.has(m) ? b[l] = i.get(m) : m !== null && typeof m == \"object\" ? o.push({\n parent: b,\n prop: l,\n data: m\n }) : b[l] = m, ++l;\n g.push(b);\n }\n c.push({ parent: a, prop: f });\n }\n } else\n for (const l of Object.keys(u)) {\n const p = u[l];\n i.has(p) ? g[l] = i.get(p) : p !== null && typeof p == \"object\" ? o.push({\n parent: g,\n prop: l,\n data: p\n }) : g[l] = p;\n }\n i.set(u, g);\n }\n for (const { parent: a, prop: f } of s)\n a[f] = new Set(a[f]);\n for (const { parent: a, prop: f } of c)\n a[f] = new Map(a[f]);\n return r.root;\n}\nconst Xe = \"This object was destroyed, do not use it anywhere\", Ve = () => !0;\nfunction Ir(t, e = Xe) {\n const n = () => {\n throw new Error(e);\n };\n Object.keys(t).forEach((r) => {\n typeof t[r] == \"function\" ? t[r] = n.bind(t) : t[r] = null;\n }), Object.getOwnPropertyNames(t.constructor.prototype).forEach((r) => {\n r !== \"constructor\" && typeof t[r] == \"function\" && (t[r] = n.bind(t));\n }), t.isDestroyed = Ve;\n}\nconst Ze = y && (\"ontouchstart\" in window || ve() > 0), Lr = Ze ? \"pointerdown\" : \"click\";\nfunction ve() {\n return typeof navigator < \"u\" && (navigator.maxTouchPoints || navigator.msMaxTouchPoints) || 0;\n}\nfunction Hr(t, e, n = window.Event) {\n const { type: r, bubbles: o = !1, cancelable: i = !1, ...s } = e;\n if (!S(r) || r === \"\")\n return !1;\n let c;\n return S(n) ? c = new n(r, { bubbles: o, cancelable: i }) : (c = document.createEvent(\"HTMLEvents\"), c.initEvent(r, o, i)), Object.assign(c, s), t.dispatchEvent(c);\n}\nconst Je = [\n \"button\",\n \"[href]:not(.disabled)\",\n \"input\",\n \"select\",\n \"textarea\",\n \"[tabindex]\",\n \"[contenteditable]\"\n].map((t) => `${t}:not(:disabled):not([disabled])`).join(\", \");\nfunction V(t) {\n return !!t && t.nodeType === 1;\n}\nfunction tn(t) {\n return V(t) ? t : document.body;\n}\nfunction en(t, e) {\n return !y || !t ? [] : Array.from(tn(e).querySelectorAll(t));\n}\nfunction Pr(t) {\n if (!y)\n return !1;\n const e = document.activeElement;\n return !V(t) || !e ? !1 : t === e || Xt(e, t);\n}\nfunction Xt(t, e) {\n if (!t || !e)\n return !1;\n const n = e.__transferElement;\n return e.contains(t) || !!n && (n === t || n.contains(t));\n}\nfunction nn(t) {\n if (!y || !V(t) || !t.parentNode || !Xt(t, document.body) || t.style.display === \"none\")\n return !0;\n const e = t.getBoundingClientRect();\n return !(e && e.width > 0 && e.height > 0);\n}\nfunction rn(t) {\n return !nn(t);\n}\nfunction on(t) {\n return !V(t) || t.hasAttribute(\"disabled\") && t.getAttribute(\"disabled\") !== \"false\" || t.disabled;\n}\nfunction Br(t, e = !1) {\n const n = e ? () => !1 : on;\n return en(Je, t).filter(\n (r) => rn(r) && r.tabIndex > -1 && !n(r)\n );\n}\nfunction sn(t) {\n if (!y || !t)\n return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.paddingLeft) + parseFloat(e.paddingRight) || 0;\n}\nfunction Ur(t) {\n if (!y || !t)\n return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.paddingTop) + parseFloat(e.paddingBottom) || 0;\n}\nfunction Yr(t) {\n if (!y || !t)\n return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.marginLeft) + parseFloat(e.marginRight) || 0;\n}\nfunction Gr(t) {\n if (!y || !t)\n return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.marginTop) + parseFloat(e.marginBottom) || 0;\n}\nfunction Wr(t) {\n if (!y || !t)\n return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.borderLeftWidth) + parseFloat(e.borderRightWidth) || 0;\n}\nfunction zr(t) {\n if (!y || !t)\n return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.borderTopWidth) + parseFloat(e.borderBottomWidth) || 0;\n}\nfunction qr(t) {\n if (!y || !t)\n return 0;\n const e = document.createRange();\n e.setStart(t, 0), e.setEnd(t, t.childNodes.length);\n const n = e.getBoundingClientRect().width, r = sn(t);\n return n + r;\n}\nfunction jr(t) {\n return me(t, !0) ? `${be(t)}px` : String(t).trim();\n}\nfunction Kr(t) {\n return S(t) && t !== !1 ? String(t) : void 0;\n}\nconst cn = /[\"'&<>]/;\nfunction Qr(t) {\n const e = \"\" + t, n = cn.exec(e);\n if (!n)\n return e;\n let r = \"\", o, i, s = 0;\n for (i = n.index; i < e.length; i++) {\n switch (e.charCodeAt(i)) {\n case 34:\n o = \""\";\n break;\n case 38:\n o = \"&\";\n break;\n case 39:\n o = \"'\";\n break;\n case 60:\n o = \"<\";\n break;\n case 62:\n o = \">\";\n break;\n default:\n continue;\n }\n s !== i && (r += e.substring(s, i)), s = i + 1, r += o;\n }\n return s !== i ? r + e.substring(s, i) : r;\n}\nfunction Xr() {\n const t = /* @__PURE__ */ new Map();\n return {\n on(e, n) {\n const r = t.get(e);\n (r == null ? void 0 : r.add(n)) || t.set(e, /* @__PURE__ */ new Set([n]));\n },\n off(e, n) {\n const r = t.get(e);\n r && r.delete(n);\n },\n clear(e) {\n const n = t.get(e);\n n && n.clear();\n },\n clearAll() {\n t.clear();\n },\n emit(e, ...n) {\n const r = t.get(e);\n r && r.forEach((o) => {\n o(...n);\n });\n }\n };\n}\nfunction lt(t, e, n) {\n t && !e.has(t) && (n(t), e.add(t));\n}\nconst an = /* @__PURE__ */ new Set();\nfunction Vr(t, e = console.info) {\n lt(t, an, e);\n}\nconst fn = /* @__PURE__ */ new Set();\nfunction Zr(t, e = console.warn) {\n lt(t, fn, e);\n}\nconst un = /* @__PURE__ */ new Set();\nfunction vr(t, e = console.warn) {\n lt(t, un, e);\n}\nconst dt = y ? requestAnimationFrame : (t) => {\n setTimeout(t, 16);\n};\nfunction Jr(t, e = 16) {\n if (typeof t != \"function\")\n return ot;\n const n = (...i) => {\n t(...i);\n };\n if (e <= 0)\n return Vt(n);\n let r = 0, o;\n return function(...i) {\n const s = Date.now(), c = s - r;\n clearTimeout(o), c >= e ? (r = s, n(...i)) : o = setTimeout(\n () => {\n r = Date.now(), n(...i);\n },\n Math.max(0, e - c)\n );\n };\n}\nfunction to(t, e = 100) {\n if (typeof t != \"function\")\n return ot;\n const n = (...o) => {\n t(...o);\n };\n if (e <= 0)\n return Vt(n);\n let r;\n return function(...o) {\n clearTimeout(r), r = setTimeout(() => {\n n(...o);\n }, e);\n };\n}\nfunction Vt(t) {\n if (typeof t != \"function\")\n return t;\n let e = !1, n, r;\n return function(...o) {\n return n = o, e || (e = !0, r = Promise.resolve().then(() => (e = !1, r = void 0, t(...n)))), r;\n };\n}\nfunction eo(t) {\n if (typeof t != \"function\")\n return t;\n let e = !1, n, r;\n return function(...o) {\n return n = o, e || (e = !0, r = new Promise(\n (i) => dt(() => {\n e = !1, r = void 0, i(t(...n));\n })\n )), r;\n };\n}\nconst x = /* @__PURE__ */ new Set(), Zt = /* @__PURE__ */ new WeakMap();\nfunction ln() {\n x.forEach((t) => {\n t(...Zt.get(t));\n }), x.clear();\n}\nfunction no(t, ...e) {\n if (typeof t != \"function\")\n return t;\n Zt.set(t, e), !x.has(t) && (x.add(t), x.size === 1 && Promise.resolve().then(ln));\n}\nconst D = /* @__PURE__ */ new Set(), vt = /* @__PURE__ */ new WeakMap();\nfunction dn() {\n D.forEach((t) => {\n t(...vt.get(t));\n }), D.clear();\n}\nfunction ro(t, ...e) {\n if (typeof t != \"function\")\n return t;\n vt.set(t, e), !D.has(t) && (D.add(t), D.size === 1 && dt(dn));\n}\nasync function oo(t, e, n) {\n const r = [], o = [];\n for (const i of e) {\n const s = Promise.resolve().then(() => n(i, e));\n if (r.push(s), t <= e.length) {\n const c = s.then(() => o.splice(o.indexOf(c), 1));\n o.push(c), o.length >= t && await Promise.race(o);\n }\n }\n return Promise.all(r);\n}\nlet et = null;\nfunction io() {\n if (!y)\n return !0;\n if (et === null) {\n const t = document.createElement(\"div\");\n t.style.display = \"flex\", t.style.flexDirection = \"column\", t.style.rowGap = \"1px\", t.appendChild(document.createElement(\"div\")), t.appendChild(document.createElement(\"div\")), document.body.appendChild(t), et = t.scrollHeight === 1, document.body.removeChild(t);\n }\n return et;\n}\nlet nt = null;\nfunction so() {\n return y ? (nt === null && (nt = \"loading\" in document.createElement(\"img\")), nt) : !1;\n}\nfunction co(t) {\n return Array.isArray(t) ? t : [t];\n}\nfunction ao(t, ...e) {\n return Ft(t) ? t(...e) : t;\n}\nfunction fo(t) {\n return t.replace(/[\\\\/]+/g, \"/\");\n}\nfunction uo(t) {\n return t[t.length - 1];\n}\nfunction lo(t, e, n = (o) => o, r = !1) {\n const o = r ? /* @__PURE__ */ new Map() : {};\n if (!S(e))\n return o;\n const i = r ? (c, a) => o.set(c, a) : (c, a) => o[c] = a, s = Ft(e) ? e : (c) => c[e];\n return t.forEach((c) => {\n const a = s(c);\n S(a) && i(a, n(c));\n }), o;\n}\nfunction ho(t, e, n = !1) {\n let r = -1;\n return n || typeof e != \"function\" ? r = t.findIndex((o) => o === e) : r = t.findIndex(e), ~r ? t.splice(r, 1)[0] : null;\n}\nfunction go(t, e = []) {\n (typeof e == \"string\" || typeof e == \"function\") && (e = [e]);\n const n = e.length, r = {};\n for (const o of t) {\n let i;\n for (let s = 0; s < n; ++s) {\n const c = s === n - 1, a = e[s], f = typeof a == \"function\" ? a(o) : o[a];\n i ? (i[f] || (i[f] = c ? [] : {}), i = i[f]) : (r[f] || (r[f] = c ? [] : {}), i = r[f]);\n }\n i.push(o);\n }\n return r;\n}\nfunction po(t, e = {}) {\n const {\n keyField: n = \"id\",\n childField: r = \"children\",\n parentField: o = \"parent\",\n rootId: i = null\n } = e, s = S(i) && i !== \"\", c = [], a = /* @__PURE__ */ new Map();\n for (let f = 0, u = t.length; f < u; ++f) {\n const d = t[f], g = d[n];\n if (!(s ? g === i : !S(g)))\n if (a.has(g) ? d[r] = a.get(g) : (d[r] = [], a.set(g, d[r])), d[o] && (!s || d[o] !== i)) {\n const l = d[o];\n a.has(l) || a.set(l, []), a.get(l).push(d);\n } else\n c.push(d);\n }\n return c;\n}\nfunction mo(t, e = {}) {\n const {\n keyField: n = \"id\",\n childField: r = \"children\",\n parentField: o = \"parent\",\n rootId: i = null,\n depthFirst: s = !1,\n injectId: c = !0,\n buildId: a = (m) => m,\n filter: f = ie,\n cascaded: u = !1,\n forceInject: d = !1\n } = e;\n let g = 1;\n const l = S(i) && i !== \"\", p = [], b = [...t];\n for (; b.length; ) {\n const m = b.shift(), Z = m[r], v = Array.isArray(Z) && Z.length ? Z : [];\n c && (d || !m[n]) && (m[n] = a(g++));\n const Jt = m[n];\n c && o && (l ? m[o] === i : !m[o]) && (m[o] = i);\n const ht = f(m);\n if (ht && p.push(m), ht || !u) {\n for (let J = 0, te = v.length; J < te; ++J) {\n const gt = v[J];\n c && o && (gt[o] = Jt), !s && b.push(gt);\n }\n s && b.unshift(...v);\n }\n }\n return p;\n}\nfunction bo(t, e, n = {}) {\n const { childField: r = \"children\", depthFirst: o = !1 } = n, i = [...t.map((s) => ({ item: s, depth: 0, parent: null }))];\n for (; i.length; ) {\n const { item: s, depth: c, parent: a } = i.shift(), f = s[r];\n e(s, c, a), G(f) && i[o ? \"unshift\" : \"push\"](\n ...Array.from(f).map((u) => ({ item: u, depth: c + 1, parent: s }))\n );\n }\n}\nfunction yo(t, e, n = {}) {\n const { childField: r = \"children\", depthFirst: o = !1, clearChildren: i = !0 } = n, s = [], c = [...t.map((a) => ({ item: a, depth: 0, parent: null, result: s }))];\n for (; c.length; ) {\n const { item: a, depth: f, parent: u, result: d } = c.shift(), g = a[r], l = e(a, f, u) ?? {};\n i && (l[r] = []), d.push(l), G(g) && Array.from(g).length && (l[r] = [], c[o ? \"unshift\" : \"push\"](\n ...Array.from(g).map((b) => ({\n item: b,\n depth: f + 1,\n parent: a,\n result: l[r]\n }))\n ));\n }\n return s;\n}\nfunction Mo(t, e, n = {}) {\n const {\n childField: r = \"children\",\n leafOnly: o = !1,\n isLeaf: i = (c) => !G(c[r])\n } = n, s = (c, a, f) => c.map((u) => ({ ...u })).filter((u) => {\n const d = u[r], g = i(u), l = G(d) && Array.from(d);\n if (o && !g) {\n if (l && l.length) {\n const b = s(l, a + 1, u);\n return u[r] = b, !!b.length;\n }\n return !1;\n }\n const p = e(u, a, f);\n if (g)\n return p;\n if (!o && p)\n return !0;\n if (l && l.length) {\n const b = s(l, a + 1, u);\n return u[r] = b, !!b.length;\n }\n return p;\n });\n return s(t, 0, null);\n}\nconst Nt = (t, e) => Number.isNaN(Number(t) - Number(e)) ? String(t).localeCompare(e) : t - e;\nfunction So(t, e) {\n if (!t.sort || Y(e) && !e.key || !e.length)\n return t;\n const n = Array.from(t);\n Array.isArray(e) || (e = [e]);\n const r = e.map(\n (o) => typeof o == \"string\" ? {\n key: o,\n method: Nt,\n type: \"asc\"\n } : o\n ).map((o) => (typeof o.accessor != \"function\" && (o.accessor = (i) => i[o.key]), typeof o.method != \"function\" && (o.method = Nt), o.params = Array.isArray(o.params) ? o.params : [], o));\n return n.sort((o, i) => {\n let s = 0;\n for (const c of r) {\n const { method: a, type: f, accessor: u, params: d } = c, g = f === \"desc\", l = a(u(o, ...d), u(i, ...d));\n if (s = g ? -l : l, s)\n break;\n }\n return s;\n }), n;\n}\nfunction wo(t, e, n = !0) {\n t = n ? Qe(t) : t;\n const r = [\n {\n source: t,\n target: e\n }\n ];\n for (; r.length; ) {\n const { source: o, target: i } = r.pop();\n Object.keys(i).forEach((s) => {\n Y(i[s]) ? (Y(o[s]) || (o[s] = {}), r.push({\n source: o[s],\n target: i[s]\n })) : Array.isArray(i[s]) ? (Array.isArray(o[s]) || (o[s] = []), r.push({\n source: o[s],\n target: i[s]\n })) : o[s] = i[s];\n });\n }\n return t;\n}\nfunction Eo(t) {\n t = Array.from(t);\n let e = !1;\n const n = () => {\n var r;\n e || ((r = t.shift()) == null || r(), t.length && dt(n));\n };\n return n(), () => e = !0;\n}\nfunction hn(t) {\n const e = t.match(/[A-Z]+/);\n return e && e[0] === t;\n}\nconst gn = /\\B([A-Z])(?=[^A-Z_-])/g;\nfunction No(t) {\n return t.replace(gn, \"-$1\").toLowerCase();\n}\nfunction pn(t) {\n return t = t.trim().replace(/\\s+/g, \"-\"), t = t.replace(/-+(\\w)/g, (e, n) => n ? n.toUpperCase() : \"\"), (t.charAt(0).toLocaleUpperCase() + t.slice(1)).replace(\n /[^\\w]/g,\n \"\"\n );\n}\nfunction Ao(t) {\n const e = pn(t);\n return hn(e) ? e.toLocaleLowerCase() : e.charAt(0).toLowerCase() + e.slice(1);\n}\nexport {\n Lr as CLICK_TYPE,\n ue as COLOR_NAMES,\n qt as DAY_ON_HOURS,\n lr as DAY_ON_MILLISECONDS,\n Ne as DAY_ON_MILLS,\n Ee as DAY_ON_MINUTES,\n jt as DAY_ON_SECONDS,\n kt as HEX_REG_3,\n xt as HEX_REG_4,\n Dt as HEX_REG_6,\n It as HEX_REG_8,\n ur as HOUR_ON_MILLISECONDS,\n we as HOUR_ON_MILLS,\n X as HOUR_ON_MINUTES,\n zt as HOUR_ON_SECONDS,\n Ot as HSLA_REG,\n Ct as HSL_REG,\n _t as HSVA_REG,\n Rt as HSV_REG,\n fr as MINUTE_ON_MILLISECONDS,\n Se as MINUTE_ON_MILLS,\n k as MINUTE_ON_SECONDS,\n W as NAMED_COLORS,\n Qt as QUARTER_ON_MONTHS,\n Tt as RGBA_REG,\n $t as RGB_REG,\n A as SECOND_ON_MILLISECONDS,\n Me as SECOND_ON_MILLS,\n Ze as USE_TOUCH,\n ct as WEEK_ON_DAYS,\n Ae as WEEK_ON_HOURS,\n dr as WEEK_ON_MILLISECONDS,\n $e as WEEK_ON_MILLS,\n Fe as WEEK_ON_MINUTES,\n Kt as WEEK_ON_SECONDS,\n Ce as YEAR_ON_MONTHS,\n Te as YEAR_ON_QUARTERS,\n at as addDays,\n mr as addHalfDays,\n Le as addHours,\n xe as addMilliseconds,\n Ie as addMinutes,\n ft as addMonths,\n yr as addQuarters,\n De as addSeconds,\n br as addWeeks,\n Mr as addYears,\n Gn as adjustAlpha,\n er as boundRange,\n po as buildTree,\n ao as callIfFunc,\n qe as compareAsc,\n _ as compareDesc,\n Xt as contains,\n Vn as createBITree,\n Xn as createCounter,\n Xr as createEventEmitter,\n to as debounce,\n eo as debounceFrame,\n Vt as debounceMinor,\n Ln as decide,\n E as decimalLength,\n Qe as deepClone,\n Ir as destroyObject,\n Ge as differenceDays,\n je as differenceFullDays,\n _r as differenceFullHours,\n Rr as differenceFullMinutes,\n Ke as differenceFullMonths,\n xr as differenceFullQuarters,\n Or as differenceFullSeconds,\n kr as differenceFullWeeks,\n Dr as differenceFullYears,\n Ye as differenceHours,\n ut as differenceMilliseconds,\n Ue as differenceMinutes,\n We as differenceMonths,\n Cr as differenceQuarters,\n Be as differenceSeconds,\n Tr as differenceWeeks,\n ze as differenceYears,\n Zn as digitLength,\n Hr as dispatchEvent,\n ar as divide,\n N as doubleDigits,\n Nr as endOfDay,\n co as ensureArray,\n vr as errorOnce,\n Qr as escapeHtml,\n Mo as filterTree,\n mo as flatTree,\n hr as format,\n or as formatByteSize,\n pr as getChineseWeek,\n Kn as getGlobalCount,\n uo as getLast,\n Pe as getLastDayOfMonth,\n Er as getLastSunday,\n rt as getQuarter,\n qr as getRangeWidth,\n gr as getTime,\n se as getType,\n Wr as getXBorder,\n Yr as getXMargin,\n sn as getXPadding,\n zr as getYBorder,\n Gr as getYMargin,\n Ur as getYPadding,\n go as groupByProps,\n bn as has,\n de as hslToHsv,\n Lt as hslToRgb,\n Un as hsvToHsl,\n he as hsvToRgb,\n Vr as infoOnce,\n B as is,\n Fn as isArray,\n An as isBigInt,\n Sn as isBoolean,\n y as isClient,\n Pn as isColor,\n On as isDate,\n S as isDefined,\n on as isDisabled,\n kn as isElement,\n _n as isEmpty,\n En as isFalse,\n Pr as isFocusIn,\n Ft as isFunction,\n nn as isHidden,\n mn as isIOS,\n G as isIterable,\n He as isLeapYear,\n Cn as isMap,\n oe as isNaN,\n re as isNull,\n yn as isNumber,\n Y as isObject,\n $n as isPromise,\n Rn as isRegExp,\n Tn as isSet,\n Mn as isString,\n Nn as isSymbol,\n wn as isTrue,\n me as isValidNumber,\n rn as isVisible,\n nr as leaveNumber,\n lo as listToMap,\n yo as mapTree,\n wo as mergeObjects,\n cr as minus,\n Yn as mixColor,\n Jn as multipleFixed,\n ro as nextFrameOnce,\n no as nextTickOnce,\n ot as noop,\n O as normalizeAlpha,\n z as normalizeHsl,\n q as normalizeHsv,\n fo as normalizePath,\n R as normalizeRgb,\n pe as numberRE,\n rr as ordinalNumber,\n ye as padStartZeros,\n Bn as parseColor,\n $ as parseColorToRgba,\n le as parseStringColor,\n sr as plus,\n en as queryAll,\n Br as queryTabables,\n dt as raf,\n ir as random,\n Wn as randomColor,\n zn as randomHardColor,\n Bt as randomPreferColor,\n qn as randomSoftColor,\n In as randomString,\n Dn as range,\n Sr as rangeDate,\n wr as rangeMonth,\n ho as removeArrayItem,\n it as rgbToHex,\n Ht as rgbToHsl,\n Pt as rgbToHsv,\n st as rgbaToHex,\n tr as round,\n oo as runParallel,\n Eo as runQueueFrame,\n vn as segmentNumber,\n Qn as setGlobalCount,\n So as sortByProps,\n wt as startOfDay,\n St as startOfHour,\n Mt as startOfMinute,\n Ar as startOfMonth,\n Fr as startOfQuarter,\n yt as startOfSecond,\n Et as startOfWeek,\n $r as startOfYear,\n io as supportFlexGap,\n so as supportImgLoading,\n Jr as throttle,\n P as times,\n Kr as toAttrValue,\n Ao as toCamelCase,\n pn as toCapitalCase,\n jr as toCssSize,\n h as toDate,\n xn as toFalse,\n Gt as toFixed,\n jn as toGrayScale,\n No as toKebabCase,\n be as toNumber,\n Wt as toPrecision,\n ie as toTrue,\n lo as transformListToMap,\n po as transformTree,\n bo as walkTree,\n Zr as warnOnce,\n Hn as writeClipboard\n};\n//# sourceMappingURL=index.mjs.map\n","import type { InjectionKey } from 'vue'\nimport type { EventEmitter } from '@vexip-ui/utils'\nimport type { Layout, LayoutInstance, LayoutItem } from './types'\n\nexport const LAYOUT_KEY = Symbol('LAYOUT_KEY') as InjectionKey\nexport const EMITTER_KEY = Symbol('EMITTER_KEY') as InjectionKey\n\n/**\n * Return the bottom coordinate of the layout.\n *\n * @param layout Layout array.\n * @return Bottom coordinate.\n */\nexport function bottom(layout: Layout): number {\n let max = 0\n let bottomY\n for (let i = 0, len = layout.length; i < len; i++) {\n bottomY = layout[i].y + layout[i].h\n if (bottomY > max) max = bottomY\n }\n return max\n}\n\nexport function cloneLayout(layout: Layout): Layout {\n const newLayout = Array(layout.length)\n for (let i = 0, len = layout.length; i < len; i++) {\n newLayout[i] = cloneLayoutItem(layout[i])\n }\n return newLayout\n}\n\n// Fast path to cloning, since this is monomorphic\nexport function cloneLayoutItem(layoutItem: LayoutItem): LayoutItem {\n // return JSON.parse(JSON.stringify(layoutItem))\n return { ...layoutItem }\n}\n\n/**\n * Given two layoutitems, check if they collide.\n *\n * @return True if colliding.\n */\nexport function collides(l1: LayoutItem, l2: LayoutItem): boolean {\n if (l1 === l2) return false // same element\n if (l1.x + l1.w <= l2.x) return false // l1 is left of l2\n if (l1.x >= l2.x + l2.w) return false // l1 is right of l2\n if (l1.y + l1.h <= l2.y) return false // l1 is above l2\n if (l1.y >= l2.y + l2.h) return false // l1 is below l2\n return true // boxes overlap\n}\n\n/**\n * Given a layout, compact it. This involves going down each y coordinate and removing gaps\n * between items.\n *\n * @param layout Layout.\n * @param verticalCompact Whether or not to compact the layout vertically.\n * @param minPositions\n * @return Compacted Layout.\n */\nexport function compact(layout: Layout, verticalCompact?: boolean, minPositions?: any): Layout {\n // Statics go in the compareWith array right away so items flow around them.\n const compareWith = getStatics(layout)\n // We go through the items by row and column.\n const sorted = sortLayoutItemsByRowCol(layout)\n // Holding for new items.\n const out: Layout = Array(layout.length)\n\n for (let i = 0, len = sorted.length; i < len; i++) {\n let l = sorted[i]\n\n // Don't move static elements\n if (!l.static) {\n l = compactItem(compareWith, l, verticalCompact, minPositions)\n\n // Add to comparison array. We only collide with items before this one.\n // Statics are already in this array.\n compareWith.push(l)\n }\n\n // Add to output array to make sure they still come out in the right order.\n out[layout.findIndex(i => i.i === l.i)] = l\n\n // Clear moved flag, if it exists.\n l.moved = false\n }\n\n return out\n}\n\n/**\n * Compact an item in the layout.\n */\nexport function compactItem(\n compareWith: Layout,\n l: LayoutItem,\n verticalCompact?: boolean,\n minPositions?: any\n): LayoutItem {\n if (verticalCompact) {\n // Move the element up as far as it can go without colliding.\n while (l.y > 0 && !getFirstCollision(compareWith, l)) {\n l.y--\n }\n } else if (minPositions) {\n const minY = minPositions[l.i].y\n while (l.y > minY && !getFirstCollision(compareWith, l)) {\n l.y--\n }\n }\n\n // Move it down, and keep moving it down if it's colliding.\n let collides\n while ((collides = getFirstCollision(compareWith, l))) {\n l.y = collides.y + collides.h\n }\n return l\n}\n\n/**\n * Given a layout, make sure all elements fit within its bounds.\n *\n * @param layout Layout array.\n * @param bounds Number of columns.\n */\nexport function correctBounds(layout: Layout, bounds: { cols: number }): Layout {\n const collidesWith = getStatics(layout)\n for (let i = 0, len = layout.length; i < len; i++) {\n const l = layout[i]\n // Overflows right\n if (l.x + l.w > bounds.cols) l.x = bounds.cols - l.w\n // Overflows left\n if (l.x < 0) {\n l.x = 0\n l.w = bounds.cols\n }\n if (!l.static) collidesWith.push(l)\n else {\n // If this is static and collides with other statics, we must move it down.\n // We have to do something nicer than just letting them overlap.\n while (getFirstCollision(collidesWith, l)) {\n l.y++\n }\n }\n }\n return layout\n}\n\n/**\n * Get a layout item by ID. Used so we can override later on if necessary.\n *\n * @param layout Layout array.\n * @param id ID\n * @return Item at ID.\n */\nexport function getLayoutItem(layout: Layout, id: number | string): LayoutItem | undefined {\n for (let i = 0, len = layout.length; i < len; i++) {\n if (layout[i].i === id) return layout[i]\n }\n}\n\n/**\n * Returns the first item this layout collides with.\n * It doesn't appear to matter which order we approach this from, although\n * perhaps that is the wrong thing to do.\n *\n * @param {Object} layoutItem Layout item.\n * @return {Object|undefined} A colliding layout item, or undefined.\n */\nexport function getFirstCollision(layout: Layout, layoutItem: LayoutItem): LayoutItem | undefined {\n for (let i = 0, len = layout.length; i < len; i++) {\n if (collides(layout[i], layoutItem)) return layout[i]\n }\n}\n\nexport function getAllCollisions(layout: Layout, layoutItem: LayoutItem): Array {\n return layout.filter(l => collides(l, layoutItem))\n}\n\n/**\n * Get all static elements.\n * @param layout Array of layout objects.\n * @return Array of static layout items..\n */\nexport function getStatics(layout: Layout): Array {\n return layout.filter(l => l.static)\n}\n\n/**\n * Move an element. Responsible for doing cascading movements of other elements.\n *\n * @param layout Full layout to modify.\n * @param layoutItem element to move.\n * @param x X position in grid units.\n * @param y Y position in grid units.\n * @param isUserAction If true, designates that the item we're moving is\n * being dragged/resized by th euser.\n */\nexport function moveElement(\n layout: Layout,\n layoutItem: LayoutItem,\n x?: number,\n y?: number,\n isUserAction = false,\n preventCollision = false\n): Layout {\n if (layoutItem.static) return layout\n\n const oldX = layoutItem.x\n const oldY = layoutItem.y\n\n const movingUp = y && layoutItem.y > y\n // This is quite a bit faster than extending the object\n if (typeof x === 'number') layoutItem.x = x\n if (typeof y === 'number') layoutItem.y = y\n layoutItem.moved = true\n\n // If this collides with anything, move it.\n // When doing this comparison, we have to sort the items we compare with\n // to ensure, in the case of multiple collisions, that we're getting the\n // nearest collision.\n let sorted = sortLayoutItemsByRowCol(layout)\n if (movingUp) sorted = sorted.reverse()\n const collisions = getAllCollisions(sorted, layoutItem)\n\n if (preventCollision && collisions.length) {\n layoutItem.x = oldX\n layoutItem.y = oldY\n layoutItem.moved = false\n return layout\n }\n\n // Move each item that collides away from this element.\n for (let i = 0, len = collisions.length; i < len; i++) {\n const collision = collisions[i]\n\n // Short circuit so we can't infinite loop\n if (collision.moved) continue\n\n // This makes it feel a bit more precise by waiting to swap for just a bit when moving up.\n if (layoutItem.y > collision.y && layoutItem.y - collision.y > collision.h / 4) continue\n\n // Don't move static items - we have to move *this* element away\n if (collision.static) {\n layout = moveElementAwayFromCollision(layout, collision, layoutItem, isUserAction)\n } else {\n layout = moveElementAwayFromCollision(layout, layoutItem, collision, isUserAction)\n }\n }\n\n return layout\n}\n\n/**\n * This is where the magic needs to happen - given a collision, move an element away from the collision.\n * We attempt to move it up if there's room, otherwise it goes below.\n *\n * @param layout Full layout to modify.\n * @param collidesWith Layout item we're colliding with.\n * @param itemToMove Layout item we're moving.\n * @param isUserAction If true, designates that the item we're moving is being dragged/resized\n * by the user.\n */\nexport function moveElementAwayFromCollision(\n layout: Layout,\n collidesWith: LayoutItem,\n itemToMove: LayoutItem,\n isUserAction?: boolean\n): Layout {\n const preventCollision = false // we're already colliding\n // If there is enough space above the collision to put this element, move it there.\n // We only do this on the main collision as this can get funky in cascades and cause\n // unwanted swapping behavior.\n if (isUserAction) {\n // Make a mock item so we don't modify the item here, only modify in moveElement.\n const fakeItem: LayoutItem = {\n x: itemToMove.x,\n y: itemToMove.y,\n w: itemToMove.w,\n h: itemToMove.h,\n i: '-1'\n }\n fakeItem.y = Math.max(collidesWith.y - itemToMove.h, 0)\n if (!getFirstCollision(layout, fakeItem)) {\n return moveElement(layout, itemToMove, undefined, fakeItem.y, preventCollision)\n }\n }\n\n // Previously this was optimized to move below the collision directly, but this can cause problems\n // with cascading moves, as an item may actually leapflog a collision and cause a reversal in order.\n return moveElement(layout, itemToMove, undefined, itemToMove.y + 1, preventCollision)\n}\n\n/**\n * Helper to convert a number to a percentage string.\n *\n * @param num Any number\n * @return That number as a percentage.\n */\nexport function perc(num: number): string {\n return num * 100 + '%'\n}\n\nexport function setTransform(top: number, left: number, width: number, height: number) {\n // Replace unitless items with px\n const translate = 'translate3d(' + left + 'px,' + top + 'px, 0)'\n return {\n transform: translate,\n WebkitTransform: translate,\n MozTransform: translate,\n msTransform: translate,\n OTransform: translate,\n width: width + 'px',\n height: height + 'px',\n position: 'absolute'\n }\n}\n/**\n * Just like the setTransform method, but instead it will return a negative value of right.\n *\n * @param top\n * @param right\n * @param width\n * @param height\n * @returns {{transform: string, WebkitTransform: string, MozTransform: string, msTransform: string, OTransform: string, width: string, height: string, position: string}}\n */\nexport function setTransformRtl(top: number, right: number, width: number, height: number) {\n // Replace unitless items with px\n const translate = 'translate3d(' + right * -1 + 'px,' + top + 'px, 0)'\n return {\n transform: translate,\n WebkitTransform: translate,\n MozTransform: translate,\n msTransform: translate,\n OTransform: translate,\n width: width + 'px',\n height: height + 'px',\n position: 'absolute'\n }\n}\n\nexport function setTopLeft(top: number, left: number, width: number, height: number) {\n return {\n top: top + 'px',\n left: left + 'px',\n width: width + 'px',\n height: height + 'px',\n position: 'absolute'\n }\n}\n/**\n * Just like the setTopLeft method, but instead, it will return a right property instead of left.\n *\n * @param top\n * @param right\n * @param width\n * @param height\n * @returns position style\n */\nexport function setTopRight(top: number, right: number, width: number, height: number) {\n return {\n top: top + 'px',\n right: right + 'px',\n width: width + 'px',\n height: height + 'px',\n position: 'absolute'\n }\n}\n\n/**\n * Get layout items sorted from top left to right and down.\n *\n * @return Layout, sorted static items first.\n */\nexport function sortLayoutItemsByRowCol(layout: Layout): Layout {\n return Array.from(layout).sort(function (a, b) {\n if (a.y === b.y && a.x === b.x) {\n return 0\n }\n\n if (a.y > b.y || (a.y === b.y && a.x > b.x)) {\n return 1\n }\n\n return -1\n })\n}\n\n/**\n * Validate a layout. Throws errors.\n *\n * @param layout Array of layout items.\n * @param contextName Context name for errors.\n * @throw Validation error.\n */\nexport function validateLayout(layout: Layout, contextName?: string): void {\n contextName = contextName || 'Layout'\n const subProps = ['x', 'y', 'w', 'h']\n const keyArr = []\n if (!Array.isArray(layout)) throw new Error(contextName + ' must be an array!')\n for (let i = 0, len = layout.length; i < len; i++) {\n const item = layout[i]\n for (let j = 0; j < subProps.length; j++) {\n if (typeof (item as any)[subProps[j]] !== 'number') {\n throw new Error(\n 'VueGridLayout: ' + contextName + '[' + i + '].' + subProps[j] + ' must be a number!'\n )\n }\n }\n\n if (item.i === undefined || item.i === null) {\n throw new Error('VueGridLayout: ' + contextName + '[' + i + '].i cannot be null!')\n }\n\n if (typeof item.i !== 'number' && typeof item.i !== 'string') {\n throw new Error('VueGridLayout: ' + contextName + '[' + i + '].i must be a string or number!')\n }\n\n if (keyArr.indexOf(item.i) >= 0) {\n throw new Error('VueGridLayout: ' + contextName + '[' + i + '].i must be unique!')\n }\n keyArr.push(item.i)\n\n if (item.static !== undefined && typeof item.static !== 'boolean') {\n throw new Error('VueGridLayout: ' + contextName + '[' + i + '].static must be a boolean!')\n }\n }\n}\n\n// Flow can't really figure this out, so we just use Object\nexport function autoBindHandlers(\n el: Record any>,\n fns: Array\n): void {\n fns.forEach(key => (el[key] = el[key].bind(el)))\n}\n\n/**\n * Convert a JS object to CSS string. Similar to React's output of CSS.\n * @param obj\n * @returns\n */\nexport function createMarkup(obj: Record) {\n const keys = Object.keys(obj)\n if (!keys.length) return ''\n let i\n const len = keys.length\n let result = ''\n\n for (i = 0; i < len; i++) {\n const key = keys[i]\n const val = obj[key]\n result += hyphenate(key) + ':' + addPx(key, val) + ';'\n }\n\n return result\n}\n\n/* The following list is defined in React's core */\nexport const IS_UNITLESS: Record = {\n animationIterationCount: true,\n boxFlex: true,\n boxFlexGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n flexOrder: true,\n gridRow: true,\n gridColumn: true,\n fontWeight: true,\n lineClamp: true,\n lineHeight: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n\n // SVG-related properties\n fillOpacity: true,\n stopOpacity: true,\n strokeDashoffset: true,\n strokeOpacity: true,\n strokeWidth: true\n}\n\n/**\n * Will add px to the end of style values which are Numbers.\n * @param name\n * @param value\n * @returns {*}\n */\nexport function addPx(name: string, value: number | string) {\n if (typeof value === 'number' && !IS_UNITLESS[name]) {\n return value + 'px'\n } else {\n return value\n }\n}\n\nexport const hyphenateRE = /([a-z\\d])([A-Z])/g\n\n/**\n * Hyphenate a camelCase string.\n *\n * @param str\n * @return\n */\nexport function hyphenate(str: string) {\n return str.replace(hyphenateRE, '$1-$2').toLowerCase()\n}\n\nexport function findItemInArray(array: any[], property: string, value: any) {\n for (let i = 0; i < array.length; i++) {\n if (array[i][property] === value) {\n return true\n }\n }\n\n return false\n}\n\nexport function findAndRemove(array: any[], property: string, value: any) {\n array.forEach(function (result, index) {\n if (result[property] === value) {\n // Remove from array\n array.splice(index, 1)\n }\n })\n}\n\nexport function useNameHelper(block: string, namespace = 'vgl') {\n /**\n * @returns `${namespace}-${block}`\n */\n const b = () => `${namespace}-${block}`\n /**\n * @returns `${namespace}-${block}__${element}`\n */\n const be = (element: string) => `${b()}__${element}`\n /**\n * @returns `${namespace}-${block}--${modifier}`\n */\n const bm = (modifier: string | number) => `${b()}--${modifier}`\n /**\n * @returns `${namespace}-${block}__${element}--${modifier}`\n */\n const bem = (element: string, modifier: string | number) => `${b()}__${element}--${modifier}`\n\n return {\n b,\n be,\n bm,\n bem\n }\n}\n","// Get {x, y} positions from event.\nexport function getControlPosition(e: MouseEvent) {\n return offsetXYFromParentOf(e)\n}\n\n// Get from offsetParent\nexport function offsetXYFromParentOf(evt: MouseEvent) {\n const offsetParent = (evt.target as HTMLElement)?.offsetParent || document.body\n const offsetParentRect =\n (evt as any).offsetParent === document.body\n ? { left: 0, top: 0 }\n : offsetParent.getBoundingClientRect()\n\n const x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left\n const y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top\n\n /* const x = Math.round(evt.clientX + offsetParent.scrollLeft - offsetParentRect.left);\n const y = Math.round(evt.clientY + offsetParent.scrollTop - offsetParentRect.top); */\n\n return { x, y }\n}\n\n// Create an data object exposed by 's events\nexport function createCoreData(lastX: number, lastY: number, x: number, y: number) {\n // State changes are often (but not always!) async. We want the latest value.\n const isStart = !isNum(lastX)\n\n if (isStart) {\n // If this is our first move, use the x and y as last coords.\n return {\n deltaX: 0,\n deltaY: 0,\n lastX: x,\n lastY: y,\n x,\n y\n }\n } else {\n // Otherwise calculate proper values.\n return {\n deltaX: x - lastX,\n deltaY: y - lastY,\n lastX,\n lastY,\n x,\n y\n }\n }\n}\n\nfunction isNum(num: unknown): num is number {\n return typeof num === 'number' && !Number.isNaN(num)\n}\n","import { cloneLayout, compact, correctBounds } from './common'\n\nimport type { Breakpoint, Breakpoints, Layout, ResponsiveLayout } from './types'\n\n/**\n * Given a width, find the highest breakpoint that matches is valid for it (width > breakpoint).\n *\n * @param breakpoints Breakpoints object (e.g. {lg: 1200, md: 960, ...})\n * @param width Screen width.\n * @return Highest breakpoint that is less than width.\n */\nexport function getBreakpointFromWidth(breakpoints: Breakpoints, width: number): Breakpoint {\n const sorted = sortBreakpoints(breakpoints)\n let matching = sorted[0]\n for (let i = 1, len = sorted.length; i < len; i++) {\n const breakpointName = sorted[i]\n if (width > breakpoints[breakpointName]) matching = breakpointName\n }\n return matching\n}\n\n/**\n * Given a breakpoint, get the # of cols set for it.\n * @param breakpoint Breakpoint name.\n * @param cols Map of breakpoints to cols.\n * @return Number of cols.\n */\nexport function getColsFromBreakpoint(breakpoint: Breakpoint, cols: Breakpoints): number {\n if (!cols[breakpoint]) {\n throw new Error(\n 'ResponsiveGridLayout: `cols` entry for breakpoint ' + breakpoint + ' is missing!'\n )\n }\n return cols[breakpoint]\n}\n\n/**\n * Given existing layouts and a new breakpoint, find or generate a new layout.\n *\n * This finds the layout above the new one and generates from it, if it exists.\n *\n * @param orgLayout Original layout.\n * @param layouts Existing layouts.\n * @param breakpoints All breakpoints.\n * @param breakpoint New breakpoint.\n * @param breakpoint Last breakpoint (for fallback).\n * @param cols Column count at new breakpoint.\n * @param verticalCompact Whether or not to compact the layout\n * vertically.\n * @return New layout.\n */\nexport function findOrGenerateResponsiveLayout(\n orgLayout: Layout,\n layouts: ResponsiveLayout,\n breakpoints: Breakpoints,\n breakpoint: Breakpoint,\n lastBreakpoint: Breakpoint,\n cols: number,\n verticalCompact: boolean\n): Layout {\n debugger\n // If it already exists, just return it.\n if (layouts[breakpoint]) return cloneLayout(layouts[breakpoint])\n // Find or generate the next layout\n let layout = orgLayout\n\n const breakpointsSorted = sortBreakpoints(breakpoints)\n const breakpointsAbove = breakpointsSorted.slice(breakpointsSorted.indexOf(breakpoint))\n for (let i = 0, len = breakpointsAbove.length; i < len; i++) {\n const b = breakpointsAbove[i]\n if (layouts[b]) {\n layout = layouts[b]\n break\n }\n }\n layout = cloneLayout(layout || []) // clone layout so we don't modify existing items\n return compact(correctBounds(layout, { cols }), verticalCompact)\n}\n\nexport function generateResponsiveLayout(\n layout: Layout,\n breakpoints: Breakpoints,\n breakpoint: Breakpoint,\n lastBreakpoint: Breakpoint,\n cols: number,\n verticalCompact: boolean\n): Layout {\n // If it already exists, just return it.\n /* if (layouts[breakpoint]) return cloneLayout(layouts[breakpoint]);\n // Find or generate the next layout\n let layout = layouts[lastBreakpoint]; */\n /* const breakpointsSorted = sortBreakpoints(breakpoints);\nconst breakpointsAbove = breakpointsSorted.slice(breakpointsSorted.indexOf(breakpoint));\nfor (let i = 0, len = breakpointsAbove.length; i < len; i++) {\n const b = breakpointsAbove[i];\n if (layouts[b]) {\n layout = layouts[b];\n break;\n }\n} */\n layout = cloneLayout(layout || []) // clone layout so we don't modify existing items\n return compact(correctBounds(layout, { cols }), verticalCompact)\n}\n\n/**\n * Given breakpoints, return an array of breakpoints sorted by width. This is usually\n * e.g. ['xxs', 'xs', 'sm', ...]\n *\n * @param breakpoints Key/value pair of breakpoint names to widths.\n * @return Sorted breakpoints.\n */\nexport function sortBreakpoints(breakpoints: Breakpoints): Array {\n const keys = Object.keys(breakpoints) as Array\n return keys.sort((a, b) => breakpoints[a] - breakpoints[b])\n}\n","let currentDir: 'ltr' | 'rtl' | 'auto' = 'auto'\n\nfunction hasDocument() {\n return typeof document !== 'undefined'\n}\n\nexport function getDocumentDir() {\n if (!hasDocument()) {\n return currentDir\n }\n const direction =\n typeof document.dir !== 'undefined'\n ? document.dir\n : document.getElementsByTagName('html')[0].getAttribute('dir')\n return direction\n}\n\nexport function setDocumentDir(dir: 'ltr' | 'rtl' | 'auto') {\n if (!hasDocument()) {\n currentDir = dir\n return\n }\n\n const html = document.getElementsByTagName('html')[0]\n html.setAttribute('dir', dir)\n}\n","/* interact.js 1.10.27 | https://raw.github.com/taye/interact.js/main/LICENSE */\n\n!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).interact=e()}(this,(function(){\"use strict\";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function e(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:function(t){return!0},r=arguments.length>3?arguments[3]:void 0;if(r=r||{},w.string(t)&&-1!==t.search(\" \")&&(t=J(t)),w.array(t))return t.forEach((function(t){return $(t,e,n,r)})),r;if(w.object(t)&&(e=t,t=\"\"),w.func(e)&&n(t))r[t]=r[t]||[],r[t].push(e);else if(w.array(e))for(var i=0,o=e;i1?lt(e):e[0];ot(r,t.page),function(t,e){e=e||{},I.isOperaMobile&&rt(t)?it(\"screen\",t,e):it(\"client\",t,e)}(r,t.client),t.timeStamp=n}function ct(t){var e=[];return w.array(t)?(e[0]=t[0],e[1]=t[1]):\"touchend\"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e}function lt(t){for(var e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0},n=0;n=(parseInt(y(r).getComputedStyle(r).zIndex,10)||0)&&(e=o);else e=o}else e=o}return e}(a);return r.activeDrops[h]||null}function St(t,e,n){var r=t.dropState,i={enter:null,leave:null,activate:null,deactivate:null,move:null,drop:null};return\"dragstart\"===n.type&&(i.activate=new xt(r,n,\"dropactivate\"),i.activate.target=null,i.activate.dropzone=null),\"dragend\"===n.type&&(i.deactivate=new xt(r,n,\"dropdeactivate\"),i.deactivate.target=null,i.deactivate.dropzone=null),r.rejected||(r.cur.element!==r.prev.element&&(r.prev.dropzone&&(i.leave=new xt(r,n,\"dragleave\"),n.dragLeave=i.leave.target=r.prev.element,n.prevDropzone=i.leave.dropzone=r.prev.dropzone),r.cur.dropzone&&(i.enter=new xt(r,n,\"dragenter\"),n.dragEnter=r.cur.element,n.dropzone=r.cur.dropzone)),\"dragend\"===n.type&&r.cur.dropzone&&(i.drop=new xt(r,n,\"drop\"),n.dropzone=r.cur.dropzone,n.relatedTarget=r.cur.element),\"dragmove\"===n.type&&r.cur.dropzone&&(i.move=new xt(r,n,\"dropmove\"),n.dropzone=r.cur.dropzone)),i}function _t(t,e){var n=t.dropState,r=n.activeDrops,i=n.cur,o=n.prev;e.leave&&o.dropzone.fire(e.leave),e.enter&&i.dropzone.fire(e.enter),e.move&&i.dropzone.fire(e.move),e.drop&&i.dropzone.fire(e.drop),e.deactivate&&wt(r,e.deactivate),n.prev.dropzone=i.dropzone,n.prev.element=i.element}function Pt(t,e){var n=t.interaction,r=t.iEvent,i=t.event;if(\"dragmove\"===r.type||\"dragend\"===r.type){var o=n.dropState;e.dynamicDrop&&(o.activeDrops=Et(e,n.element));var a=r,s=Tt(n,a,i);o.rejected=o.rejected&&!!s&&s.dropzone===o.cur.dropzone&&s.element===o.cur.element,o.cur.dropzone=s&&s.dropzone,o.cur.element=s&&s.element,o.events=St(n,0,a)}}var Ot={id:\"actions/drop\",install:function(t){var e=t.actions,n=t.interactStatic,r=t.Interactable,i=t.defaults;t.usePlugin(_),r.prototype.dropzone=function(t){return function(t,e){if(w.object(e)){if(t.options.drop.enabled=!1!==e.enabled,e.listeners){var n=$(e.listeners),r=Object.keys(n).reduce((function(t,e){return t[/^(enter|leave)/.test(e)?\"drag\".concat(e):/^(activate|deactivate|move)/.test(e)?\"drop\".concat(e):e]=n[e],t}),{}),i=t.options.drop.listeners;i&&t.off(i),t.on(r),t.options.drop.listeners=r}return w.func(e.ondrop)&&t.on(\"drop\",e.ondrop),w.func(e.ondropactivate)&&t.on(\"dropactivate\",e.ondropactivate),w.func(e.ondropdeactivate)&&t.on(\"dropdeactivate\",e.ondropdeactivate),w.func(e.ondragenter)&&t.on(\"dragenter\",e.ondragenter),w.func(e.ondragleave)&&t.on(\"dragleave\",e.ondragleave),w.func(e.ondropmove)&&t.on(\"dropmove\",e.ondropmove),/^(pointer|center)$/.test(e.overlap)?t.options.drop.overlap=e.overlap:w.number(e.overlap)&&(t.options.drop.overlap=Math.max(Math.min(1,e.overlap),0)),\"accept\"in e&&(t.options.drop.accept=e.accept),\"checker\"in e&&(t.options.drop.checker=e.checker),t}if(w.bool(e))return t.options.drop.enabled=e,t;return t.options.drop}(this,t)},r.prototype.dropCheck=function(t,e,n,r,i,o){return function(t,e,n,r,i,o,a){var s=!1;if(!(a=a||t.getRect(o)))return!!t.options.drop.checker&&t.options.drop.checker(e,n,s,t,o,r,i);var c=t.options.drop.overlap;if(\"pointer\"===c){var l=K(r,i,\"drag\"),u=ot(e);u.x+=l.x,u.y+=l.y;var p=u.x>a.left&&u.xa.top&&u.y=a.left&&h<=a.right&&v>=a.top&&v<=a.bottom}if(d&&w.number(c)){s=Math.max(0,Math.min(a.right,d.right)-Math.max(a.left,d.left))*Math.max(0,Math.min(a.bottom,d.bottom)-Math.max(a.top,d.top))/(d.width*d.height)>=c}t.options.drop.checker&&(s=t.options.drop.checker(e,n,s,t,o,r,i));return s}(this,t,e,n,r,i,o)},n.dynamicDrop=function(e){return w.bool(e)?(t.dynamicDrop=e,n):t.dynamicDrop},V(e.phaselessTypes,{dragenter:!0,dragleave:!0,dropactivate:!0,dropdeactivate:!0,dropmove:!0,drop:!0}),e.methodDict.drop=\"dropzone\",t.dynamicDrop=!1,i.actions.drop=Ot.defaults},listeners:{\"interactions:before-action-start\":function(t){var e=t.interaction;\"drag\"===e.prepared.name&&(e.dropState={cur:{dropzone:null,element:null},prev:{dropzone:null,element:null},rejected:null,events:null,activeDrops:[]})},\"interactions:after-action-start\":function(t,e){var n=t.interaction,r=(t.event,t.iEvent);if(\"drag\"===n.prepared.name){var i=n.dropState;i.activeDrops=[],i.events={},i.activeDrops=Et(e,n.element),i.events=St(n,0,r),i.events.activate&&(wt(i.activeDrops,i.events.activate),e.fire(\"actions/drop:start\",{interaction:n,dragEvent:r}))}},\"interactions:action-move\":Pt,\"interactions:after-action-move\":function(t,e){var n=t.interaction,r=t.iEvent;if(\"drag\"===n.prepared.name){var i=n.dropState;_t(n,i.events),e.fire(\"actions/drop:move\",{interaction:n,dragEvent:r}),i.events={}}},\"interactions:action-end\":function(t,e){if(\"drag\"===t.interaction.prepared.name){var n=t.interaction,r=t.iEvent;Pt(t,e),_t(n,n.dropState.events),e.fire(\"actions/drop:end\",{interaction:n,dragEvent:r})}},\"interactions:stop\":function(t){var e=t.interaction;if(\"drag\"===e.prepared.name){var n=e.dropState;n&&(n.activeDrops=null,n.events=null,n.cur.dropzone=null,n.cur.element=null,n.prev.dropzone=null,n.prev.element=null,n.rejected=!1)}}},getActiveDrops:Et,getDrop:Tt,getDropEvents:St,fireDropEvents:_t,filterEventType:function(t){return 0===t.search(\"drag\")||0===t.search(\"drop\")},defaults:{enabled:!1,accept:null,overlap:\"pointer\"}},kt=Ot;function Dt(t){var e=t.interaction,n=t.iEvent,r=t.phase;if(\"gesture\"===e.prepared.name){var i=e.pointers.map((function(t){return t.pointer})),o=\"start\"===r,a=\"end\"===r,s=e.interactable.options.deltaSource;if(n.touches=[i[0],i[1]],o)n.distance=pt(i,s),n.box=ut(i),n.scale=1,n.ds=0,n.angle=ft(i,s),n.da=0,e.gesture.startDistance=n.distance,e.gesture.startAngle=n.angle;else if(a||e.pointers.length<2){var c=e.prevEvent;n.distance=c.distance,n.box=c.box,n.scale=c.scale,n.ds=0,n.angle=c.angle,n.da=0}else n.distance=pt(i,s),n.box=ut(i),n.scale=n.distance/e.gesture.startDistance,n.angle=ft(i,s),n.ds=n.scale-e.gesture.scale,n.da=n.angle-e.gesture.angle;e.gesture.distance=n.distance,e.gesture.angle=n.angle,w.number(n.scale)&&n.scale!==1/0&&!isNaN(n.scale)&&(e.gesture.scale=n.scale)}}var It={id:\"actions/gesture\",before:[\"actions/drag\",\"actions/resize\"],install:function(t){var e=t.actions,n=t.Interactable,r=t.defaults;n.prototype.gesturable=function(t){return w.object(t)?(this.options.gesture.enabled=!1!==t.enabled,this.setPerAction(\"gesture\",t),this.setOnEvents(\"gesture\",t),this):w.bool(t)?(this.options.gesture.enabled=t,this):this.options.gesture},e.map.gesture=It,e.methodDict.gesture=\"gesturable\",r.actions.gesture=It.defaults},listeners:{\"interactions:action-start\":Dt,\"interactions:action-move\":Dt,\"interactions:action-end\":Dt,\"interactions:new\":function(t){t.interaction.gesture={angle:0,distance:0,scale:1,startAngle:0,startDistance:0}},\"auto-start:check\":function(t){if(!(t.interaction.pointers.length<2)){var e=t.interactable.options.gesture;if(e&&e.enabled)return t.action={name:\"gesture\"},!1}}},defaults:{},getCursor:function(){return\"\"},filterEventType:function(t){return 0===t.search(\"gesture\")}},Mt=It;function zt(t,e,n,r,i,o,a){if(!e)return!1;if(!0===e){var s=w.number(o.width)?o.width:o.right-o.left,c=w.number(o.height)?o.height:o.bottom-o.top;if(a=Math.min(a,Math.abs((\"left\"===t||\"right\"===t?s:c)/2)),s<0&&(\"left\"===t?t=\"right\":\"right\"===t&&(t=\"left\")),c<0&&(\"top\"===t?t=\"bottom\":\"bottom\"===t&&(t=\"top\")),\"left\"===t){var l=s>=0?o.left:o.right;return n.x=0?o.top:o.bottom;return n.y(s>=0?o.right:o.left)-a;if(\"bottom\"===t)return n.y>(c>=0?o.bottom:o.top)-a}return!!w.element(r)&&(w.element(e)?e===r:F(r,e,i))}function At(t){var e=t.iEvent,n=t.interaction;if(\"resize\"===n.prepared.name&&n.resizeAxes){var r=e;n.interactable.options.resize.square?(\"y\"===n.resizeAxes?r.delta.x=r.delta.y:r.delta.y=r.delta.x,r.axes=\"xy\"):(r.axes=n.resizeAxes,\"x\"===n.resizeAxes?r.delta.y=0:\"y\"===n.resizeAxes&&(r.delta.x=0))}}var Rt,Ct,jt={id:\"actions/resize\",before:[\"actions/drag\"],install:function(t){var e=t.actions,n=t.browser,r=t.Interactable,i=t.defaults;jt.cursors=function(t){return t.isIe9?{x:\"e-resize\",y:\"s-resize\",xy:\"se-resize\",top:\"n-resize\",left:\"w-resize\",bottom:\"s-resize\",right:\"e-resize\",topleft:\"se-resize\",bottomright:\"se-resize\",topright:\"ne-resize\",bottomleft:\"ne-resize\"}:{x:\"ew-resize\",y:\"ns-resize\",xy:\"nwse-resize\",top:\"ns-resize\",left:\"ew-resize\",bottom:\"ns-resize\",right:\"ew-resize\",topleft:\"nwse-resize\",bottomright:\"nwse-resize\",topright:\"nesw-resize\",bottomleft:\"nesw-resize\"}}(n),jt.defaultMargin=n.supportsTouch||n.supportsPointerEvent?20:10,r.prototype.resizable=function(e){return function(t,e,n){if(w.object(e))return t.options.resize.enabled=!1!==e.enabled,t.setPerAction(\"resize\",e),t.setOnEvents(\"resize\",e),w.string(e.axis)&&/^x$|^y$|^xy$/.test(e.axis)?t.options.resize.axis=e.axis:null===e.axis&&(t.options.resize.axis=n.defaults.actions.resize.axis),w.bool(e.preserveAspectRatio)?t.options.resize.preserveAspectRatio=e.preserveAspectRatio:w.bool(e.square)&&(t.options.resize.square=e.square),t;if(w.bool(e))return t.options.resize.enabled=e,t;return t.options.resize}(this,e,t)},e.map.resize=jt,e.methodDict.resize=\"resizable\",i.actions.resize=jt.defaults},listeners:{\"interactions:new\":function(t){t.interaction.resizeAxes=\"xy\"},\"interactions:action-start\":function(t){!function(t){var e=t.iEvent,n=t.interaction;if(\"resize\"===n.prepared.name&&n.prepared.edges){var r=e,i=n.rect;n._rects={start:V({},i),corrected:V({},i),previous:V({},i),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},r.edges=n.prepared.edges,r.rect=n._rects.corrected,r.deltaRect=n._rects.delta}}(t),At(t)},\"interactions:action-move\":function(t){!function(t){var e=t.iEvent,n=t.interaction;if(\"resize\"===n.prepared.name&&n.prepared.edges){var r=e,i=n.interactable.options.resize.invert,o=\"reposition\"===i||\"negate\"===i,a=n.rect,s=n._rects,c=s.start,l=s.corrected,u=s.delta,p=s.previous;if(V(p,l),o){if(V(l,a),\"reposition\"===i){if(l.top>l.bottom){var f=l.top;l.top=l.bottom,l.bottom=f}if(l.left>l.right){var d=l.left;l.left=l.right,l.right=d}}}else l.top=Math.min(a.top,c.bottom),l.bottom=Math.max(a.bottom,c.top),l.left=Math.min(a.left,c.right),l.right=Math.max(a.right,c.left);for(var h in l.width=l.right-l.left,l.height=l.bottom-l.top,l)u[h]=l[h]-p[h];r.edges=n.prepared.edges,r.rect=l,r.deltaRect=u}}(t),At(t)},\"interactions:action-end\":function(t){var e=t.iEvent,n=t.interaction;if(\"resize\"===n.prepared.name&&n.prepared.edges){var r=e;r.edges=n.prepared.edges,r.rect=n._rects.corrected,r.deltaRect=n._rects.delta}},\"auto-start:check\":function(t){var e=t.interaction,n=t.interactable,r=t.element,i=t.rect,o=t.buttons;if(i){var a=V({},e.coords.cur.page),s=n.options.resize;if(s&&s.enabled&&(!e.pointerIsDown||!/mouse|pointer/.test(e.pointerType)||0!=(o&s.mouseButtons))){if(w.object(s.edges)){var c={left:!1,right:!1,top:!1,bottom:!1};for(var l in c)c[l]=zt(l,s.edges[l],a,e._latestPointer.eventTarget,r,i,s.margin||jt.defaultMargin);c.left=c.left&&!c.right,c.top=c.top&&!c.bottom,(c.left||c.right||c.top||c.bottom)&&(t.action={name:\"resize\",edges:c})}else{var u=\"y\"!==s.axis&&a.x>i.right-jt.defaultMargin,p=\"x\"!==s.axis&&a.y>i.bottom-jt.defaultMargin;(u||p)&&(t.action={name:\"resize\",axes:(u?\"x\":\"\")+(p?\"y\":\"\")})}return!t.action&&void 0}}}},defaults:{square:!1,preserveAspectRatio:!1,axis:\"xy\",margin:NaN,edges:null,invert:\"none\"},cursors:null,getCursor:function(t){var e=t.edges,n=t.axis,r=t.name,i=jt.cursors,o=null;if(n)o=i[r+n];else if(e){for(var a=\"\",s=0,c=[\"top\",\"bottom\",\"left\",\"right\"];s=1){var l={x:qt.x*c,y:qt.y*c};if(l.x||l.y){var u=Vt(o);w.window(o)?o.scrollBy(l.x,l.y):o&&(o.scrollLeft+=l.x,o.scrollTop+=l.y);var p=Vt(o),f={x:p.x-u.x,y:p.y-u.y};(f.x||f.y)&&e.fire({type:\"autoscroll\",target:n,interactable:e,delta:f,interaction:t,container:o})}qt.prevTime=a}qt.isScrolling&&(Lt.cancel(qt.i),qt.i=Lt.request(qt.scroll))},check:function(t,e){var n;return null==(n=t.options[e].autoScroll)?void 0:n.enabled},onInteractionMove:function(t){var e=t.interaction,n=t.pointer;if(e.interacting()&&qt.check(e.interactable,e.prepared.name))if(e.simulation)qt.x=qt.y=0;else{var r,i,o,a,s=e.interactable,c=e.element,l=e.prepared.name,u=s.options[l].autoScroll,p=Bt(u.container,s,c);if(w.window(p))a=n.clientXp.innerWidth-qt.margin,o=n.clientY>p.innerHeight-qt.margin;else{var f=Y(p);a=n.clientXf.right-qt.margin,o=n.clientY>f.bottom-qt.margin}qt.x=i?1:a?-1:0,qt.y=o?1:r?-1:0,qt.isScrolling||(qt.margin=u.margin,qt.speed=u.speed,qt.start(e))}}};function Bt(t,e,n){return(w.string(t)?W(t,e,n):t)||y(n)}function Vt(t){return w.window(t)&&(t=window.document.body),{x:t.scrollLeft,y:t.scrollTop}}var Wt={id:\"auto-scroll\",install:function(t){var e=t.defaults,n=t.actions;t.autoScroll=qt,qt.now=function(){return t.now()},n.phaselessTypes.autoscroll=!0,e.perAction.autoScroll=qt.defaults},listeners:{\"interactions:new\":function(t){t.interaction.autoScroll=null},\"interactions:destroy\":function(t){t.interaction.autoScroll=null,qt.stop(),qt.interaction&&(qt.interaction=null)},\"interactions:stop\":qt.stop,\"interactions:action-move\":function(t){return qt.onInteractionMove(t)}}},Gt=Wt;function Nt(t,e){var n=!1;return function(){return n||(g.console.warn(e),n=!0),t.apply(this,arguments)}}function Ut(t,e){return t.name=e.name,t.axis=e.axis,t.edges=e.edges,t}function Ht(t){return w.bool(t)?(this.options.styleCursor=t,this):null===t?(delete this.options.styleCursor,this):this.options.styleCursor}function Kt(t){return w.func(t)?(this.options.actionChecker=t,this):null===t?(delete this.options.actionChecker,this):this.options.actionChecker}var $t={id:\"auto-start/interactableMethods\",install:function(t){var e=t.Interactable;e.prototype.getAction=function(e,n,r,i){var o=function(t,e,n,r,i){var o=t.getRect(r),a=e.buttons||{0:1,1:4,3:8,4:16}[e.button],s={action:null,interactable:t,interaction:n,element:r,rect:o,buttons:a};return i.fire(\"auto-start:check\",s),s.action}(this,n,r,i,t);return this.options.actionChecker?this.options.actionChecker(e,n,o,this,i,r):o},e.prototype.ignoreFrom=Nt((function(t){return this._backCompatOption(\"ignoreFrom\",t)}),\"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).\"),e.prototype.allowFrom=Nt((function(t){return this._backCompatOption(\"allowFrom\",t)}),\"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).\"),e.prototype.actionChecker=Kt,e.prototype.styleCursor=Ht}};function Jt(t,e,n,r,i){return e.testIgnoreAllow(e.options[t.name],n,r)&&e.options[t.name].enabled&&ee(e,n,t,i)?t:null}function Qt(t,e,n,r,i,o,a){for(var s=0,c=r.length;s=s)return!1;if(d.interactable===t){if((l+=h===n.name?1:0)>=o)return!1;if(d.element===e&&(u++,h===n.name&&u>=a))return!1}}}return s>0}function ne(t,e){return w.number(t)?(e.autoStart.maxInteractions=t,this):e.autoStart.maxInteractions}function re(t,e,n){var r=n.autoStart.cursorElement;r&&r!==t&&(r.style.cursor=\"\"),t.ownerDocument.documentElement.style.cursor=e,t.style.cursor=e,n.autoStart.cursorElement=e?t:null}function ie(t,e){var n=t.interactable,r=t.element,i=t.prepared;if(\"mouse\"===t.pointerType&&n&&n.options.styleCursor){var o=\"\";if(i.name){var a=n.options[i.name].cursorChecker;o=w.func(a)?a(i,n,r,t._interacting):e.actions.map[i.name].getCursor(i)}re(t.element,o||\"\",e)}else e.autoStart.cursorElement&&re(e.autoStart.cursorElement,\"\",e)}var oe={id:\"auto-start/base\",before:[\"actions\"],install:function(t){var e=t.interactStatic,n=t.defaults;t.usePlugin($t),n.base.actionChecker=null,n.base.styleCursor=!0,V(n.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),e.maxInteractions=function(e){return ne(e,t)},t.autoStart={maxInteractions:1/0,withinInteractionLimit:ee,cursorElement:null}},listeners:{\"interactions:down\":function(t,e){var n=t.interaction,r=t.pointer,i=t.event,o=t.eventTarget;n.interacting()||te(n,Zt(n,r,i,o,e),e)},\"interactions:move\":function(t,e){!function(t,e){var n=t.interaction,r=t.pointer,i=t.event,o=t.eventTarget;\"mouse\"!==n.pointerType||n.pointerIsDown||n.interacting()||te(n,Zt(n,r,i,o,e),e)}(t,e),function(t,e){var n=t.interaction;if(n.pointerIsDown&&!n.interacting()&&n.pointerWasMoved&&n.prepared.name){e.fire(\"autoStart:before-start\",t);var r=n.interactable,i=n.prepared.name;i&&r&&(r.options[i].manualStart||!ee(r,n.element,n.prepared,e)?n.stop():(n.start(n.prepared,r,n.element),ie(n,e)))}}(t,e)},\"interactions:stop\":function(t,e){var n=t.interaction,r=n.interactable;r&&r.options.styleCursor&&re(n.element,\"\",e)}},maxInteractions:ne,withinInteractionLimit:ee,validateAction:Jt},ae=oe;var se={id:\"auto-start/dragAxis\",listeners:{\"autoStart:before-start\":function(t,e){var n=t.interaction,r=t.eventTarget,i=t.dx,o=t.dy;if(\"drag\"===n.prepared.name){var a=Math.abs(i),s=Math.abs(o),c=n.interactable.options.drag,l=c.startAxis,u=a>s?\"x\":a0&&(e.autoStartHoldTimer=setTimeout((function(){e.start(e.prepared,e.interactable,e.element)}),n))},\"interactions:move\":function(t){var e=t.interaction,n=t.duplicate;e.autoStartHoldTimer&&e.pointerWasMoved&&!n&&(clearTimeout(e.autoStartHoldTimer),e.autoStartHoldTimer=null)},\"autoStart:before-start\":function(t){var e=t.interaction;ce(e)>0&&(e.prepared.name=null)}},getHoldDuration:ce},ue=le,pe={id:\"auto-start\",install:function(t){t.usePlugin(ae),t.usePlugin(ue),t.usePlugin(se)}},fe=function(t){return/^(always|never|auto)$/.test(t)?(this.options.preventDefault=t,this):w.bool(t)?(this.options.preventDefault=t?\"always\":\"never\",this):this.options.preventDefault};function de(t){var e=t.interaction,n=t.event;e.interactable&&e.interactable.checkAndPreventDefault(n)}var he={id:\"core/interactablePreventDefault\",install:function(t){var e=t.Interactable;e.prototype.preventDefault=fe,e.prototype.checkAndPreventDefault=function(e){return function(t,e,n){var r=t.options.preventDefault;if(\"never\"!==r)if(\"always\"!==r){if(e.events.supportsPassive&&/^touch(start|move)$/.test(n.type)){var i=y(n.target).document,o=e.getDocOptions(i);if(!o||!o.events||!1!==o.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(n.type)||w.element(n.target)&&R(n.target,\"input,select,textarea,[contenteditable=true],[contenteditable=true] *\")||n.preventDefault()}else n.preventDefault()}(this,t,e)},t.interactions.docEvents.push({type:\"dragstart\",listener:function(e){for(var n=0,r=t.interactions.list;n150)return null;var e=180*Math.atan2(t.prevEvent.velocityY,t.prevEvent.velocityX)/Math.PI;e<0&&(e+=360);var n=112.5<=e&&e<247.5,r=202.5<=e&&e<337.5;return{up:r,down:!r&&22.5<=e&&e<157.5,left:n,right:!n&&(292.5<=e||e<67.5),angle:e,speed:t.prevEvent.speed,velocity:{x:t.prevEvent.velocityX,y:t.prevEvent.velocityY}}}},{key:\"preventDefault\",value:function(){}},{key:\"stopImmediatePropagation\",value:function(){this.immediatePropagationStopped=this.propagationStopped=!0}},{key:\"stopPropagation\",value:function(){this.propagationStopped=!0}}]),n}(vt);Object.defineProperties(Se.prototype,{pageX:{get:function(){return this.page.x},set:function(t){this.page.x=t}},pageY:{get:function(){return this.page.y},set:function(t){this.page.y=t}},clientX:{get:function(){return this.client.x},set:function(t){this.client.x=t}},clientY:{get:function(){return this.client.y},set:function(t){this.client.y=t}},dx:{get:function(){return this.delta.x},set:function(t){this.delta.x=t}},dy:{get:function(){return this.delta.y},set:function(t){this.delta.y=t}},velocityX:{get:function(){return this.velocity.x},set:function(t){this.velocity.x=t}},velocityY:{get:function(){return this.velocity.y},set:function(t){this.velocity.y=t}}});var _e=o((function t(e,n,i,o,a){r(this,t),this.id=void 0,this.pointer=void 0,this.event=void 0,this.downTime=void 0,this.downTarget=void 0,this.id=e,this.pointer=n,this.event=i,this.downTime=o,this.downTarget=a})),Pe=function(t){return t.interactable=\"\",t.element=\"\",t.prepared=\"\",t.pointerIsDown=\"\",t.pointerWasMoved=\"\",t._proxy=\"\",t}({}),Oe=function(t){return t.start=\"\",t.move=\"\",t.end=\"\",t.stop=\"\",t.interacting=\"\",t}({}),ke=0,De=function(){function t(e){var n=this,i=e.pointerType,o=e.scopeFire;r(this,t),this.interactable=null,this.element=null,this.rect=null,this._rects=void 0,this.edges=null,this._scopeFire=void 0,this.prepared={name:null,axis:null,edges:null},this.pointerType=void 0,this.pointers=[],this.downEvent=null,this.downPointer={},this._latestPointer={pointer:null,event:null,eventTarget:null},this.prevEvent=null,this.pointerIsDown=!1,this.pointerWasMoved=!1,this._interacting=!1,this._ending=!1,this._stopped=!0,this._proxy=void 0,this.simulation=null,this.doMove=Nt((function(t){this.move(t)}),\"The interaction.doMove() method has been renamed to interaction.move()\"),this.coords={start:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},prev:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},cur:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},delta:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},velocity:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}},this._id=ke++,this._scopeFire=o,this.pointerType=i;var a=this;this._proxy={};var s=function(t){Object.defineProperty(n._proxy,t,{get:function(){return a[t]}})};for(var c in Pe)s(c);var l=function(t){Object.defineProperty(n._proxy,t,{value:function(){return a[t].apply(a,arguments)}})};for(var u in Oe)l(u);this._scopeFire(\"interactions:new\",{interaction:this})}return o(t,[{key:\"pointerMoveTolerance\",get:function(){return 1}},{key:\"pointerDown\",value:function(t,e,n){var r=this.updatePointer(t,e,n,!0),i=this.pointers[r];this._scopeFire(\"interactions:down\",{pointer:t,event:e,eventTarget:n,pointerIndex:r,pointerInfo:i,type:\"down\",interaction:this})}},{key:\"start\",value:function(t,e,n){return!(this.interacting()||!this.pointerIsDown||this.pointers.length<(\"gesture\"===t.name?2:1)||!e.options[t.name].enabled)&&(Ut(this.prepared,t),this.interactable=e,this.element=n,this.rect=e.getRect(n),this.edges=this.prepared.edges?V({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:\"start\"})&&!this._stopped,this._interacting)}},{key:\"pointerMove\",value:function(t,e,n){this.simulation||this.modification&&this.modification.endResult||this.updatePointer(t,e,n,!1);var r,i,o=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;this.pointerIsDown&&!this.pointerWasMoved&&(r=this.coords.cur.client.x-this.coords.start.client.x,i=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=Q(r,i)>this.pointerMoveTolerance);var a,s,c,l=this.getPointerIndex(t),u={pointer:t,pointerIndex:l,pointerInfo:this.pointers[l],event:e,type:\"move\",eventTarget:n,dx:r,dy:i,duplicate:o,interaction:this};o||(a=this.coords.velocity,s=this.coords.delta,c=Math.max(s.timeStamp/1e3,.001),a.page.x=s.page.x/c,a.page.y=s.page.y/c,a.client.x=s.client.x/c,a.client.y=s.client.y/c,a.timeStamp=c),this._scopeFire(\"interactions:move\",u),o||this.simulation||(this.interacting()&&(u.type=null,this.move(u)),this.pointerWasMoved&&et(this.coords.prev,this.coords.cur))}},{key:\"move\",value:function(t){t&&t.event||nt(this.coords.delta),(t=V({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},t||{})).phase=\"move\",this._doPhase(t)}},{key:\"pointerUp\",value:function(t,e,n,r){var i=this.getPointerIndex(t);-1===i&&(i=this.updatePointer(t,e,n,!1));var o=/cancel$/i.test(e.type)?\"cancel\":\"up\";this._scopeFire(\"interactions:\".concat(o),{pointer:t,pointerIndex:i,pointerInfo:this.pointers[i],event:e,eventTarget:n,type:o,curEventTarget:r,interaction:this}),this.simulation||this.end(e),this.removePointer(t,e)}},{key:\"documentBlur\",value:function(t){this.end(t),this._scopeFire(\"interactions:blur\",{event:t,type:\"blur\",interaction:this})}},{key:\"end\",value:function(t){var e;this._ending=!0,t=t||this._latestPointer.event,this.interacting()&&(e=this._doPhase({event:t,interaction:this,phase:\"end\"})),this._ending=!1,!0===e&&this.stop()}},{key:\"currentAction\",value:function(){return this._interacting?this.prepared.name:null}},{key:\"interacting\",value:function(){return this._interacting}},{key:\"stop\",value:function(){this._scopeFire(\"interactions:stop\",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}},{key:\"getPointerIndex\",value:function(t){var e=at(t);return\"mouse\"===this.pointerType||\"pen\"===this.pointerType?this.pointers.length-1:yt(this.pointers,(function(t){return t.id===e}))}},{key:\"getPointerInfo\",value:function(t){return this.pointers[this.getPointerIndex(t)]}},{key:\"updatePointer\",value:function(t,e,n,r){var i,o,a,s=at(t),c=this.getPointerIndex(t),l=this.pointers[c];return r=!1!==r&&(r||/(down|start)$/i.test(e.type)),l?l.pointer=t:(l=new _e(s,t,e,null,null),c=this.pointers.length,this.pointers.push(l)),st(this.coords.cur,this.pointers.map((function(t){return t.pointer})),this._now()),i=this.coords.delta,o=this.coords.prev,a=this.coords.cur,i.page.x=a.page.x-o.page.x,i.page.y=a.page.y-o.page.y,i.client.x=a.client.x-o.client.x,i.client.y=a.client.y-o.client.y,i.timeStamp=a.timeStamp-o.timeStamp,r&&(this.pointerIsDown=!0,l.downTime=this.coords.cur.timeStamp,l.downTarget=n,tt(this.downPointer,t),this.interacting()||(et(this.coords.start,this.coords.cur),et(this.coords.prev,this.coords.cur),this.downEvent=e,this.pointerWasMoved=!1)),this._updateLatestPointer(t,e,n),this._scopeFire(\"interactions:update-pointer\",{pointer:t,event:e,eventTarget:n,down:r,pointerInfo:l,pointerIndex:c,interaction:this}),c}},{key:\"removePointer\",value:function(t,e){var n=this.getPointerIndex(t);if(-1!==n){var r=this.pointers[n];this._scopeFire(\"interactions:remove-pointer\",{pointer:t,event:e,eventTarget:null,pointerIndex:n,pointerInfo:r,interaction:this}),this.pointers.splice(n,1),this.pointerIsDown=!1}}},{key:\"_updateLatestPointer\",value:function(t,e,n){this._latestPointer.pointer=t,this._latestPointer.event=e,this._latestPointer.eventTarget=n}},{key:\"destroy\",value:function(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}},{key:\"_createPreparedEvent\",value:function(t,e,n,r){return new Se(this,t,this.prepared.name,e,this.element,n,r)}},{key:\"_fireEvent\",value:function(t){var e;null==(e=this.interactable)||e.fire(t),(!this.prevEvent||t.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=t)}},{key:\"_doPhase\",value:function(t){var e=t.event,n=t.phase,r=t.preEnd,i=t.type,o=this.rect;if(o&&\"move\"===n&&(H(this.edges,o,this.coords.delta[this.interactable.options.deltaSource]),o.width=o.right-o.left,o.height=o.bottom-o.top),!1===this._scopeFire(\"interactions:before-action-\".concat(n),t))return!1;var a=t.iEvent=this._createPreparedEvent(e,n,r,i);return this._scopeFire(\"interactions:action-\".concat(n),t),\"start\"===n&&(this.prevEvent=a),this._fireEvent(a),this._scopeFire(\"interactions:after-action-\".concat(n),t),!0}},{key:\"_now\",value:function(){return Date.now()}}]),t}();function Ie(t){Me(t.interaction)}function Me(t){if(!function(t){return!(!t.offset.pending.x&&!t.offset.pending.y)}(t))return!1;var e=t.offset.pending;return Ae(t.coords.cur,e),Ae(t.coords.delta,e),H(t.edges,t.rect,e),e.x=0,e.y=0,!0}function ze(t){var e=t.x,n=t.y;this.offset.pending.x+=e,this.offset.pending.y+=n,this.offset.total.x+=e,this.offset.total.y+=n}function Ae(t,e){var n=t.page,r=t.client,i=e.x,o=e.y;n.x+=i,n.y+=o,r.x+=i,r.y+=o}Oe.offsetBy=\"\";var Re={id:\"offset\",before:[\"modifiers\",\"pointer-events\",\"actions\",\"inertia\"],install:function(t){t.Interaction.prototype.offsetBy=ze},listeners:{\"interactions:new\":function(t){t.interaction.offset={total:{x:0,y:0},pending:{x:0,y:0}}},\"interactions:update-pointer\":function(t){return function(t){t.pointerIsDown&&(Ae(t.coords.cur,t.offset.total),t.offset.pending.x=0,t.offset.pending.y=0)}(t.interaction)},\"interactions:before-action-start\":Ie,\"interactions:before-action-move\":Ie,\"interactions:before-action-end\":function(t){var e=t.interaction;if(Me(e))return e.move({offset:!0}),e.end(),!1},\"interactions:stop\":function(t){var e=t.interaction;e.offset.total.x=0,e.offset.total.y=0,e.offset.pending.x=0,e.offset.pending.y=0}}},Ce=Re;var je=function(){function t(e){r(this,t),this.active=!1,this.isModified=!1,this.smoothEnd=!1,this.allowResume=!1,this.modification=void 0,this.modifierCount=0,this.modifierArg=void 0,this.startCoords=void 0,this.t0=0,this.v0=0,this.te=0,this.targetOffset=void 0,this.modifiedOffset=void 0,this.currentOffset=void 0,this.lambda_v0=0,this.one_ve_v0=0,this.timeout=void 0,this.interaction=void 0,this.interaction=e}return o(t,[{key:\"start\",value:function(t){var e=this.interaction,n=Fe(e);if(!n||!n.enabled)return!1;var r=e.coords.velocity.client,i=Q(r.x,r.y),o=this.modification||(this.modification=new me(e));if(o.copyFrom(e.modification),this.t0=e._now(),this.allowResume=n.allowResume,this.v0=i,this.currentOffset={x:0,y:0},this.startCoords=e.coords.cur.page,this.modifierArg=o.fillArg({pageCoords:this.startCoords,preEnd:!0,phase:\"inertiastart\"}),this.t0-e.coords.cur.timeStamp<50&&i>n.minSpeed&&i>n.endSpeed)this.startInertia();else{if(o.result=o.setAll(this.modifierArg),!o.result.changed)return!1;this.startSmoothEnd()}return e.modification.result.rect=null,e.offsetBy(this.targetOffset),e._doPhase({interaction:e,event:t,phase:\"inertiastart\"}),e.offsetBy({x:-this.targetOffset.x,y:-this.targetOffset.y}),e.modification.result.rect=null,this.active=!0,e.simulation=this,!0}},{key:\"startInertia\",value:function(){var t=this,e=this.interaction.coords.velocity.client,n=Fe(this.interaction),r=n.resistance,i=-Math.log(n.endSpeed/this.v0)/r;this.targetOffset={x:(e.x-i)/r,y:(e.y-i)/r},this.te=i,this.lambda_v0=r/this.v0,this.one_ve_v0=1-n.endSpeed/this.v0;var o=this.modification,a=this.modifierArg;a.pageCoords={x:this.startCoords.x+this.targetOffset.x,y:this.startCoords.y+this.targetOffset.y},o.result=o.setAll(a),o.result.changed&&(this.isModified=!0,this.modifiedOffset={x:this.targetOffset.x+o.result.delta.x,y:this.targetOffset.y+o.result.delta.y}),this.onNextFrame((function(){return t.inertiaTick()}))}},{key:\"startSmoothEnd\",value:function(){var t=this;this.smoothEnd=!0,this.isModified=!0,this.targetOffset={x:this.modification.result.delta.x,y:this.modification.result.delta.y},this.onNextFrame((function(){return t.smoothEndTick()}))}},{key:\"onNextFrame\",value:function(t){var e=this;this.timeout=Lt.request((function(){e.active&&t()}))}},{key:\"inertiaTick\",value:function(){var t,e,n,r,i,o,a,s=this,c=this.interaction,l=Fe(c).resistance,u=(c._now()-this.t0)/1e3;if(u=0;a--){var d=p[a];if(d.selector===t&&d.context===e){for(var h=d.listeners,v=h.length-1;v>=0;v--){var g=h[v];if(g.func===i&&Ne(g.options,u)){h.splice(v,1),h.length||(p.splice(a,1),s(e,n,c),s(e,n,l,!0)),f=!0;break}}if(f)break}}},delegateListener:c,delegateUseCapture:l,delegatedEvents:r,documents:i,targets:n,supportsOptions:!1,supportsPassive:!1};function a(t,e,r,i){if(t.addEventListener){var a=Ge(i),s=bt(n,(function(e){return e.eventTarget===t}));s||(s={eventTarget:t,events:{}},n.push(s)),s.events[e]||(s.events[e]=[]),bt(s.events[e],(function(t){return t.func===r&&Ne(t.options,a)}))||(t.addEventListener(e,r,o.supportsOptions?a:a.capture),s.events[e].push({func:r,options:a}))}}function s(t,e,r,i){if(t.addEventListener&&t.removeEventListener){var a=yt(n,(function(e){return e.eventTarget===t})),c=n[a];if(c&&c.events)if(\"all\"!==e){var l=!1,u=c.events[e];if(u){if(\"all\"===r){for(var p=u.length-1;p>=0;p--){var f=u[p];s(t,e,f.func,f.options)}return}for(var d=Ge(i),h=0;h=2)continue;if(!i.interacting()&&e===i.pointerType)return i}return null}};function Ke(t,e){return t.pointers.some((function(t){return t.id===e}))}var $e=He,Je=[\"pointerDown\",\"pointerMove\",\"pointerUp\",\"updatePointer\",\"removePointer\",\"windowBlur\"];function Qe(t,e){return function(n){var r=e.interactions.list,i=dt(n),o=ht(n),a=o[0],s=o[1],c=[];if(/^touch/.test(n.type)){e.prevTouchTime=e.now();for(var l=0,u=n.changedTouches;l=0;r--){var i=e.interactions.list[r];i.interactable===n&&(i.stop(),e.fire(\"interactions:destroy\",{interaction:i}),i.destroy(),e.interactions.list.length>2&&e.interactions.list.splice(r,1))}}},onDocSignal:tn,doOnInteractions:Qe,methodNames:Je},nn=en,rn=function(t){return t[t.On=0]=\"On\",t[t.Off=1]=\"Off\",t}(rn||{}),on=function(){function t(e,n,i,o){r(this,t),this.target=void 0,this.options=void 0,this._actions=void 0,this.events=new Ve,this._context=void 0,this._win=void 0,this._doc=void 0,this._scopeEvents=void 0,this._actions=n.actions,this.target=e,this._context=n.context||i,this._win=y(B(e)?this._context:e),this._doc=this._win.document,this._scopeEvents=o,this.set(n)}return o(t,[{key:\"_defaults\",get:function(){return{base:{},perAction:{},actions:{}}}},{key:\"setOnEvents\",value:function(t,e){return w.func(e.onstart)&&this.on(\"\".concat(t,\"start\"),e.onstart),w.func(e.onmove)&&this.on(\"\".concat(t,\"move\"),e.onmove),w.func(e.onend)&&this.on(\"\".concat(t,\"end\"),e.onend),w.func(e.oninertiastart)&&this.on(\"\".concat(t,\"inertiastart\"),e.oninertiastart),this}},{key:\"updatePerActionListeners\",value:function(t,e,n){var r,i=this,o=null==(r=this._actions.map[t])?void 0:r.filterEventType,a=function(t){return(null==o||o(t))&&ve(t,i._actions)};(w.array(e)||w.object(e))&&this._onOff(rn.Off,t,e,void 0,a),(w.array(n)||w.object(n))&&this._onOff(rn.On,t,n,void 0,a)}},{key:\"setPerAction\",value:function(t,e){var n=this._defaults;for(var r in e){var i=r,o=this.options[t],a=e[i];\"listeners\"===i&&this.updatePerActionListeners(t,o.listeners,a),w.array(a)?o[i]=mt(a):w.plainObject(a)?(o[i]=V(o[i]||{},ge(a)),w.object(n.perAction[i])&&\"enabled\"in n.perAction[i]&&(o[i].enabled=!1!==a.enabled)):w.bool(a)&&w.object(n.perAction[i])?o[i].enabled=a:o[i]=a}}},{key:\"getRect\",value:function(t){return t=t||(w.element(this.target)?this.target:null),w.string(this.target)&&(t=t||this._context.querySelector(this.target)),L(t)}},{key:\"rectChecker\",value:function(t){var e=this;return w.func(t)?(this.getRect=function(n){var r=V({},t.apply(e,n));return\"width\"in r||(r.width=r.right-r.left,r.height=r.bottom-r.top),r},this):null===t?(delete this.getRect,this):this.getRect}},{key:\"_backCompatOption\",value:function(t,e){if(B(e)||w.object(e)){for(var n in this.options[t]=e,this._actions.map)this.options[n][t]=e;return this}return this.options[t]}},{key:\"origin\",value:function(t){return this._backCompatOption(\"origin\",t)}},{key:\"deltaSource\",value:function(t){return\"page\"===t||\"client\"===t?(this.options.deltaSource=t,this):this.options.deltaSource}},{key:\"getAllElements\",value:function(){var t=this.target;return w.string(t)?Array.from(this._context.querySelectorAll(t)):w.func(t)&&t.getAllElements?t.getAllElements():w.element(t)?[t]:[]}},{key:\"context\",value:function(){return this._context}},{key:\"inContext\",value:function(t){return this._context===t.ownerDocument||M(this._context,t)}},{key:\"testIgnoreAllow\",value:function(t,e,n){return!this.testIgnore(t.ignoreFrom,e,n)&&this.testAllow(t.allowFrom,e,n)}},{key:\"testAllow\",value:function(t,e,n){return!t||!!w.element(n)&&(w.string(t)?F(n,t,e):!!w.element(t)&&M(t,n))}},{key:\"testIgnore\",value:function(t,e,n){return!(!t||!w.element(n))&&(w.string(t)?F(n,t,e):!!w.element(t)&&M(t,n))}},{key:\"fire\",value:function(t){return this.events.fire(t),this}},{key:\"_onOff\",value:function(t,e,n,r,i){w.object(e)&&!w.array(e)&&(r=n,n=null);var o=$(e,n,i);for(var a in o){\"wheel\"===a&&(a=I.wheelEvent);for(var s=0,c=o[a];s=0;n--){var r=e[n],i=r.selector,o=r.context,a=r.listeners;i===this.target&&o===this._context&&e.splice(n,1);for(var s=a.length-1;s>=0;s--)this._scopeEvents.removeDelegate(this.target,this._context,t,a[s][0],a[s][1])}else this._scopeEvents.remove(this.target,\"all\")}}]),t}(),an=function(){function t(e){var n=this;r(this,t),this.list=[],this.selectorMap={},this.scope=void 0,this.scope=e,e.addListeners({\"interactable:unset\":function(t){var e=t.interactable,r=e.target,i=w.string(r)?n.selectorMap[r]:r[n.scope.id],o=yt(i,(function(t){return t===e}));i.splice(o,1)}})}return o(t,[{key:\"new\",value:function(t,e){e=V(e||{},{actions:this.scope.actions});var n=new this.scope.Interactable(t,e,this.scope.document,this.scope.events);return this.scope.addDocument(n._doc),this.list.push(n),w.string(t)?(this.selectorMap[t]||(this.selectorMap[t]=[]),this.selectorMap[t].push(n)):(n.target[this.scope.id]||Object.defineProperty(t,this.scope.id,{value:[],configurable:!0}),t[this.scope.id].push(n)),this.scope.fire(\"interactable:new\",{target:t,options:e,interactable:n,win:this.scope._win}),n}},{key:\"getExisting\",value:function(t,e){var n=e&&e.context||this.scope.document,r=w.string(t),i=r?this.selectorMap[t]:t[this.scope.id];if(i)return bt(i,(function(e){return e._context===n&&(r||e.inContext(t))}))}},{key:\"forEachMatch\",value:function(t,e){for(var n=0,r=this.list;nMath.abs(u.y),l.coords,l.rect),V(i,l.coords));return l.eventProps},defaults:{ratio:\"preserve\",equalDelta:!1,modifiers:[],enabled:!1}};function gn(t,e,n){var r=t.startCoords,i=t.edgeSign;e?n.y=r.y+(n.x-r.x)*i.y:n.x=r.x+(n.y-r.y)*i.x}function mn(t,e,n,r){var i=t.startRect,o=t.startCoords,a=t.ratio,s=t.edgeSign;if(e){var c=r.width/a;n.y=o.y+(c-i.height)*s.y}else{var l=r.height*a;n.x=o.x+(l-i.width)*s.x}}var yn=be(vn,\"aspectRatio\"),bn=function(){};bn._defaults={};var xn=bn;function wn(t,e,n){return w.func(t)?G(t,e.interactable,e.element,[n.x,n.y,e]):G(t,e.interactable,e.element)}var En={start:function(t){var e=t.rect,n=t.startOffset,r=t.state,i=t.interaction,o=t.pageCoords,a=r.options,s=a.elementRect,c=V({left:0,top:0,right:0,bottom:0},a.offset||{});if(e&&s){var l=wn(a.restriction,i,o);if(l){var u=l.right-l.left-e.width,p=l.bottom-l.top-e.height;u<0&&(c.left+=u,c.right+=u),p<0&&(c.top+=p,c.bottom+=p)}c.left+=n.left-e.width*s.left,c.top+=n.top-e.height*s.top,c.right+=n.right-e.width*(1-s.right),c.bottom+=n.bottom-e.height*(1-s.bottom)}r.offset=c},set:function(t){var e=t.coords,n=t.interaction,r=t.state,i=r.options,o=r.offset,a=wn(i.restriction,n,e);if(a){var s=function(t){return!t||\"left\"in t&&\"top\"in t||((t=V({},t)).left=t.x||0,t.top=t.y||0,t.right=t.right||t.left+t.width,t.bottom=t.bottom||t.top+t.height),t}(a);e.x=Math.max(Math.min(s.right-o.right,e.x),s.left+o.left),e.y=Math.max(Math.min(s.bottom-o.bottom,e.y),s.top+o.top)}},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}},Tn=be(En,\"restrict\"),Sn={top:1/0,left:1/0,bottom:-1/0,right:-1/0},_n={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function Pn(t,e){for(var n=0,r=[\"top\",\"left\",\"bottom\",\"right\"];n\nimport {\n computed,\n inject,\n onBeforeMount,\n onBeforeUnmount,\n onMounted,\n reactive,\n ref,\n toRef,\n watch,\n watchEffect\n} from 'vue'\n\nimport { isNull, nextTickOnce, throttle } from '@vexip-ui/utils'\nimport {\n EMITTER_KEY,\n LAYOUT_KEY,\n setTopLeft,\n setTopRight,\n setTransform,\n setTransformRtl,\n useNameHelper\n} from '../helpers/common'\nimport { createCoreData, getControlPosition } from '../helpers/draggable'\nimport { getColsFromBreakpoint } from '../helpers/responsive'\nimport { getDocumentDir } from '../helpers/dom'\n\nimport interact from 'interactjs'\n\nimport type { GridItemProps } from './types'\n\nconst props = withDefaults(defineProps(), {\n isDraggable: undefined,\n isResizable: undefined,\n isBounded: undefined,\n static: false,\n minH: 1,\n minW: 1,\n maxH: Infinity,\n maxW: Infinity,\n dragIgnoreFrom: 'a, button',\n dragAllowFrom: undefined,\n resizeIgnoreFrom: 'a, button',\n preserveAspectRatio: false,\n dragOption: () => ({}),\n resizeOption: () => ({})\n})\n\nconst emit = defineEmits(['container-resized', 'resize', 'resized', 'move', 'moved'])\n\nconst layout = inject(LAYOUT_KEY)\nconst emitter = inject(EMITTER_KEY)!\n\nif (!layout) {\n throw new Error('[grid-layout-plus]: missing layout store, GridItem must under a GridLayout.')\n}\n\nconst interactObj = ref | null>(null)\n\nconst state = reactive({\n cols: 1,\n containerWidth: 100,\n rowHeight: 30,\n margin: [10, 10],\n maxRows: Infinity,\n draggable: undefined as boolean | undefined,\n resizable: undefined as boolean | undefined,\n bounded: undefined as boolean | undefined,\n transformScale: 1,\n useCssTransforms: true,\n useStyleCursor: true,\n\n isDragging: false,\n dragging: {\n top: -1,\n left: -1\n },\n isResizing: false,\n resizing: {\n width: -1,\n height: -1\n },\n style: {} as Record,\n rtl: false\n})\n\nlet dragEventSet = false\nlet resizeEventSet = false\n\nlet lastX = NaN\nlet lastY = NaN\nlet lastW = NaN\nlet lastH = NaN\n\nlet previousW = -1\nlet previousH = -1\nlet previousX = -1\nlet previousY = -1\n\nlet innerX = props.x\nlet innerY = props.y\nlet innerW = props.w\nlet innerH = props.h\n\nconst wrapper = ref()\n\nconst instance = reactive({\n i: toRef(props, 'i'),\n state,\n wrapper,\n calcXY\n})\n\nfunction updateWidthHandler(width: number) {\n updateWidth(width)\n}\n\nfunction compactHandler() {\n compact()\n}\n\nfunction setDraggableHandler(isDraggable: boolean) {\n if (isNull(props.isDraggable)) {\n state.draggable = isDraggable\n }\n}\n\nfunction setResizableHandler(isResizable: boolean) {\n if (isNull(props.isResizable)) {\n state.resizable = isResizable\n }\n}\n\nfunction setBoundedHandler(isBounded: boolean) {\n if (isNull(props.isBounded)) {\n state.bounded = isBounded\n }\n}\n\nfunction setTransformScaleHandler(transformScale: number) {\n state.transformScale = transformScale\n}\n\nfunction setRowHeightHandler(rowHeight: number) {\n state.rowHeight = rowHeight\n}\n\nfunction setMaxRowsHandler(maxRows: number) {\n state.maxRows = maxRows\n}\n\nfunction directionchangeHandler() {\n state.rtl = getDocumentDir() === 'rtl'\n compact()\n}\n\nfunction setColNum(colNum: number) {\n state.cols = Math.floor(colNum)\n}\n\nlayout.increaseItem(instance)\n\nonBeforeMount(() => {\n state.rtl = getDocumentDir() === 'rtl'\n})\n\nonMounted(() => {\n if (layout.responsive && layout.lastBreakpoint) {\n state.cols = getColsFromBreakpoint(layout.lastBreakpoint, layout.cols)\n } else {\n state.cols = layout.colNum\n }\n state.rowHeight = layout.rowHeight\n state.containerWidth = layout.width !== null ? layout.width : 100\n state.margin = layout.margin !== undefined ? layout.margin.map(Number) : [10, 10]\n state.maxRows = layout.maxRows\n\n if (isNull(props.isDraggable)) {\n state.draggable = layout.isDraggable\n } else {\n state.draggable = props.isDraggable\n }\n if (isNull(props.isResizable)) {\n state.resizable = layout.isResizable\n } else {\n state.resizable = props.isResizable\n }\n if (isNull(props.isBounded)) {\n state.bounded = layout.isBounded\n } else {\n state.bounded = props.isBounded\n }\n state.transformScale = layout.transformScale\n state.useCssTransforms = layout.useCssTransforms\n state.useStyleCursor = layout.useStyleCursor\n\n watchEffect(() => {\n innerX = props.x\n innerY = props.y\n innerH = props.h\n innerW = props.w\n nextTickOnce(createStyle)\n })\n\n emitter.on('updateWidth', updateWidthHandler)\n emitter.on('compact', compactHandler)\n emitter.on('setDraggable', setDraggableHandler)\n emitter.on('setResizable', setResizableHandler)\n emitter.on('setBounded', setBoundedHandler)\n emitter.on('setTransformScale', setTransformScaleHandler)\n emitter.on('setRowHeight', setRowHeightHandler)\n emitter.on('setMaxRows', setMaxRowsHandler)\n emitter.on('directionchange', directionchangeHandler)\n emitter.on('setColNum', setColNum)\n})\n\nonBeforeUnmount(() => {\n emitter.off('updateWidth', updateWidthHandler)\n emitter.off('compact', compactHandler)\n emitter.off('setDraggable', setDraggableHandler)\n emitter.off('setResizable', setResizableHandler)\n emitter.off('setBounded', setBoundedHandler)\n emitter.off('setTransformScale', setTransformScaleHandler)\n emitter.off('setRowHeight', setRowHeightHandler)\n emitter.off('setMaxRows', setMaxRowsHandler)\n emitter.off('directionchange', directionchangeHandler)\n emitter.off('setColNum', setColNum)\n\n if (interactObj.value) {\n interactObj.value.unset()\n interactObj.value = null\n }\n\n layout.decreaseItem(instance)\n})\n\ndefineExpose({ state, wrapper })\n\nconst isAndroid =\n typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().includes('android') : false\n\nconst resizableAndNotStatic = computed(() => state.resizable && !props.static)\nconst renderRtl = computed(() => (layout.isMirrored ? !state.rtl : state.rtl))\nconst draggableOrResizableAndNotStatic = computed(() => {\n return (state.draggable || state.resizable) && !props.static\n})\n\nconst nh = useNameHelper('item')\n\nconst className = computed(() => {\n return {\n [nh.b()]: true,\n [nh.bm('resizable')]: resizableAndNotStatic.value,\n [nh.bm('static')]: props.static,\n [nh.bm('resizing')]: state.isResizing,\n [nh.bm('dragging')]: state.isDragging,\n [nh.bm('transform')]: state.useCssTransforms,\n [nh.bm('rtl')]: renderRtl.value,\n [nh.bm('no-touch')]: isAndroid && draggableOrResizableAndNotStatic.value\n }\n})\nconst resizerClass = computed(() => {\n // return renderRtl.value ? 'vue-resizable-handle vue-rtl-resizable-handle' : 'vue-resizable-handle'\n return [nh.be('resizer'), renderRtl.value && nh.bem('resizer', 'rtl')].filter(Boolean)\n})\n\nwatch(\n () => props.isDraggable,\n value => {\n state.draggable = value\n }\n)\nwatch(\n () => props.static,\n () => {\n nextTickOnce(tryMakeDraggable)\n nextTickOnce(tryMakeResizable)\n }\n)\nwatch(\n () => state.draggable,\n () => {\n nextTickOnce(tryMakeDraggable)\n }\n)\nwatch(\n () => props.isResizable,\n value => {\n state.resizable = value\n }\n)\nwatch(\n () => props.isBounded,\n value => {\n state.bounded = value\n }\n)\nwatch(\n () => state.resizable,\n () => {\n nextTickOnce(tryMakeResizable)\n }\n)\nwatch(\n () => state.rowHeight,\n () => {\n nextTickOnce(createStyle)\n nextTickOnce(emitContainerResized)\n }\n)\nwatch([() => state.cols, () => state.containerWidth], () => {\n nextTickOnce(tryMakeResizable)\n nextTickOnce(createStyle)\n nextTickOnce(emitContainerResized)\n})\nwatch([() => props.minH, () => props.maxH, () => props.minW, () => props.maxW], () => {\n nextTickOnce(tryMakeResizable)\n})\nwatch(renderRtl, () => {\n nextTickOnce(tryMakeResizable)\n nextTickOnce(createStyle)\n})\nwatch([() => layout.margin, () => layout.margin[0], () => layout.margin[1]], () => {\n const margin = layout.margin\n\n if (!margin || (margin[0] === state.margin[0] && margin[1] === state.margin[1])) {\n return\n }\n\n state.margin = margin.map(Number)\n nextTickOnce(createStyle)\n nextTickOnce(emitContainerResized)\n})\n\nfunction createStyle() {\n if (props.x + props.w > state.cols) {\n innerX = 0\n innerW = props.w > state.cols ? state.cols : props.w\n } else {\n innerX = props.x\n innerW = props.w\n }\n\n const pos = calcPosition(innerX, innerY, innerW, innerH)\n\n if (state.isDragging) {\n pos.top = state.dragging.top\n // Add rtl support\n if (renderRtl.value) {\n pos.right = state.dragging.left\n } else {\n pos.left = state.dragging.left\n }\n }\n if (state.isResizing) {\n pos.width = state.resizing.width\n pos.height = state.resizing.height\n }\n\n let style\n // CSS Transforms support (default)\n if (state.useCssTransforms) {\n // Add rtl support\n if (renderRtl.value) {\n style = setTransformRtl(pos.top, pos.right!, pos.width, pos.height)\n } else {\n style = setTransform(pos.top, pos.left!, pos.width, pos.height)\n }\n } else {\n // top,left (slow)\n // Add rtl support\n if (renderRtl.value) {\n style = setTopRight(pos.top, pos.right!, pos.width, pos.height)\n } else {\n style = setTopLeft(pos.top, pos.left!, pos.width, pos.height)\n }\n }\n\n state.style = style\n}\n\nfunction emitContainerResized() {\n // this.style has width and height with trailing 'px'. The\n // resized event is without them\n const styleProps: Record = {}\n for (const prop of ['width', 'height']) {\n const val = state.style[prop]\n const matches = val.match(/^(\\d+)px$/)\n if (!matches) {\n return\n }\n styleProps[prop] = matches[1]\n }\n emit('container-resized', props.i, props.h, props.w, styleProps.height, styleProps.width)\n}\n\nfunction handleResize(event: MouseEvent & { edges: any }) {\n if (props.static) return\n\n const type = event.type\n if (\n (type === 'resizestart' && state.isResizing) ||\n (type !== 'resizestart' && !state.isResizing)\n ) {\n return\n }\n\n const position = getControlPosition(event)\n // Get the current drag point from the event. This is used as the offset.\n if (isNull(position)) return // not possible but satisfies flow\n\n const { x, y } = position\n const newSize = { width: 0, height: 0 }\n let pos\n switch (type) {\n case 'resizestart': {\n tryMakeResizable()\n previousW = innerW\n previousH = innerH\n pos = calcPosition(innerX, innerY, innerW, innerH)\n newSize.width = pos.width\n newSize.height = pos.height\n state.resizing = newSize\n state.isResizing = true\n break\n }\n case 'resizemove': {\n // A vertical resize ignores the horizontal delta\n if (!event.edges.right && !event.edges.left) {\n lastW = x\n }\n\n // An horizontal resize ignores the vertical delta\n if (!event.edges.top && !event.edges.bottom) {\n lastH = y\n }\n\n const coreEvent = createCoreData(lastW, lastH, x, y)\n if (renderRtl.value) {\n newSize.width = state.resizing.width - coreEvent.deltaX / state.transformScale\n } else {\n newSize.width = state.resizing.width + coreEvent.deltaX / state.transformScale\n }\n newSize.height = state.resizing.height + coreEvent.deltaY / state.transformScale\n state.resizing = newSize\n break\n }\n case 'resizeend': {\n pos = calcPosition(innerX, innerY, innerW, innerH)\n newSize.width = pos.width\n newSize.height = pos.height\n\n state.resizing = { width: -1, height: -1 }\n state.isResizing = false\n break\n }\n }\n\n // Get new WH\n pos = calcWH(newSize.height, newSize.width)\n if (pos.w < props.minW) {\n pos.w = props.minW\n }\n if (pos.w > props.maxW) {\n pos.w = props.maxW\n }\n if (pos.h < props.minH) {\n pos.h = props.minH\n }\n if (pos.h > props.maxH) {\n pos.h = props.maxH\n }\n\n if (pos.h < 1) {\n pos.h = 1\n }\n if (pos.w < 1) {\n pos.w = 1\n }\n\n lastW = x\n lastH = y\n\n if (innerW !== pos.w || innerH !== pos.h) {\n emit('resize', props.i, pos.h, pos.w, newSize.height, newSize.width)\n }\n if (event.type === 'resizeend' && (previousW !== innerW || previousH !== innerH)) {\n emit('resized', props.i, pos.h, pos.w, newSize.height, newSize.width)\n }\n emitter.emit('resizeEvent', event.type, props.i, innerX, innerY, pos.h, pos.w)\n}\n\nfunction handleDrag(event: MouseEvent) {\n if (props.static || state.isResizing) return\n\n const type = event.type\n if ((type === 'dragstart' && state.isDragging) || (type !== 'dragstart' && !state.isDragging)) {\n return\n }\n\n const position = getControlPosition(event)\n\n // Get the current drag point from the event. This is used as the offset.\n if (isNull(position)) return // not possible but satisfies flow\n const { x, y } = position\n const target = event.target as HTMLElement\n\n if (!target.offsetParent) return\n\n // let shouldUpdate = false;\n const newPosition = { top: 0, left: 0 }\n switch (type) {\n case 'dragstart': {\n previousX = innerX\n previousY = innerY\n\n const parentRect = target.offsetParent.getBoundingClientRect()\n const clientRect = target.getBoundingClientRect()\n\n const cLeft = clientRect.left / state.transformScale\n const pLeft = parentRect.left / state.transformScale\n const cRight = clientRect.right / state.transformScale\n const pRight = parentRect.right / state.transformScale\n const cTop = clientRect.top / state.transformScale\n const pTop = parentRect.top / state.transformScale\n\n if (renderRtl.value) {\n newPosition.left = (cRight - pRight) * -1\n } else {\n newPosition.left = cLeft - pLeft\n }\n newPosition.top = cTop - pTop\n state.dragging = newPosition\n state.isDragging = true\n break\n }\n case 'dragmove': {\n const coreEvent = createCoreData(lastX, lastY, x, y)\n // Add rtl support\n if (renderRtl.value) {\n newPosition.left = state.dragging.left - coreEvent.deltaX / state.transformScale\n } else {\n newPosition.left = state.dragging.left + coreEvent.deltaX / state.transformScale\n }\n newPosition.top = state.dragging.top + coreEvent.deltaY / state.transformScale\n if (state.bounded) {\n const bottomBoundary =\n target.offsetParent.clientHeight -\n calcGridItemWHPx(props.h, state.rowHeight, state.margin[1])\n newPosition.top = clamp(newPosition.top, 0, bottomBoundary)\n const colWidth = calcColWidth()\n const rightBoundary =\n state.containerWidth - calcGridItemWHPx(props.w, colWidth, state.margin[0])\n newPosition.left = clamp(newPosition.left, 0, rightBoundary)\n }\n\n state.dragging = newPosition\n break\n }\n case 'dragend': {\n const parentRect = target.offsetParent.getBoundingClientRect()\n const clientRect = target.getBoundingClientRect()\n\n const cLeft = clientRect.left / state.transformScale\n const pLeft = parentRect.left / state.transformScale\n const cRight = clientRect.right / state.transformScale\n const pRight = parentRect.right / state.transformScale\n const cTop = clientRect.top / state.transformScale\n const pTop = parentRect.top / state.transformScale\n\n // Add rtl support\n if (renderRtl.value) {\n newPosition.left = (cRight - pRight) * -1\n } else {\n newPosition.left = cLeft - pLeft\n }\n newPosition.top = cTop - pTop\n state.dragging = { top: -1, left: -1 }\n state.isDragging = false\n break\n }\n }\n\n // Get new XY\n let pos\n if (renderRtl.value) {\n pos = calcXY(newPosition.top, newPosition.left)\n } else {\n pos = calcXY(newPosition.top, newPosition.left)\n }\n\n lastX = x\n lastY = y\n\n if (innerX !== pos.x || innerY !== pos.y) {\n emit('move', props.i, pos.x, pos.y)\n }\n if (event.type === 'dragend' && (previousX !== innerX || previousY !== innerY)) {\n emit('moved', props.i, pos.x, pos.y)\n }\n emitter.emit('dragEvent', event.type, props.i, pos.x, pos.y, innerH, innerW)\n}\n\nfunction calcPosition(x: number, y: number, w: number, h: number) {\n const colWidth = calcColWidth()\n // add rtl support\n let out\n if (renderRtl.value) {\n out = {\n right: Math.round(colWidth * x + (x + 1) * state.margin[0]),\n top: Math.round(state.rowHeight * y + (y + 1) * state.margin[1]),\n // 0 * Infinity === NaN, which causes problems with resize constraints;\n // Fix this if it occurs.\n // Note we do it here rather than later because Math.round(Infinity) causes depot\n width: w === Infinity ? w : Math.round(colWidth * w + Math.max(0, w - 1) * state.margin[0]),\n height:\n h === Infinity ? h : Math.round(state.rowHeight * h + Math.max(0, h - 1) * state.margin[1])\n }\n } else {\n out = {\n left: Math.round(colWidth * x + (x + 1) * state.margin[0]),\n top: Math.round(state.rowHeight * y + (y + 1) * state.margin[1]),\n // 0 * Infinity === NaN, which causes problems with resize constraints;\n // Fix this if it occurs.\n // Note we do it here rather than later because Math.round(Infinity) causes depot\n width: w === Infinity ? w : Math.round(colWidth * w + Math.max(0, w - 1) * state.margin[0]),\n height:\n h === Infinity ? h : Math.round(state.rowHeight * h + Math.max(0, h - 1) * state.margin[1])\n }\n }\n\n return out\n}\n\n/**\n * Translate x and y coordinates from pixels to grid units.\n * @param top Top position (relative to parent) in pixels.\n * @param left Left position (relative to parent) in pixels.\n * @return x and y in grid units.\n */\n// TODO check if this function needs change in order to support rtl.\nfunction calcXY(top: number, left: number) {\n const colWidth = calcColWidth()\n\n // left = colWidth * x + margin * (x + 1)\n // l = cx + m(x+1)\n // l = cx + mx + m\n // l - m = cx + mx\n // l - m = x(c + m)\n // (l - m) / (c + m) = x\n // x = (left - margin) / (coldWidth + margin)\n let x = Math.round((left - state.margin[0]) / (colWidth + state.margin[0]))\n let y = Math.round((top - state.margin[1]) / (state.rowHeight + state.margin[1]))\n\n // Capping\n x = Math.max(Math.min(x, state.cols - innerW), 0)\n y = Math.max(Math.min(y, state.maxRows - innerH), 0)\n\n return { x, y }\n}\n\nfunction calcColWidth() {\n return (state.containerWidth - state.margin[0] * (state.cols + 1)) / state.cols\n}\n\nfunction calcGridItemWHPx(gridUnits: number, colOrRowSize: number, marginPx: number) {\n // 0 * Infinity === NaN, which causes problems with resize constraints\n if (!Number.isFinite(gridUnits)) return gridUnits\n return Math.round(colOrRowSize * gridUnits + Math.max(0, gridUnits - 1) * marginPx)\n}\n\nfunction clamp(num: number, lowerBound: number, upperBound: number) {\n return Math.max(Math.min(num, upperBound), lowerBound)\n}\n\n/**\n * Given a height and width in pixel values, calculate grid units.\n * @param height Height in pixels.\n * @param width Width in pixels.\n * @param autoSizeFlag function autoSize identifier.\n * @return w, h as grid units.\n */\nfunction calcWH(height: number, width: number, autoSizeFlag = false) {\n const colWidth = calcColWidth()\n\n // width = colWidth * w - (margin * (w - 1))\n // ...\n // w = (width + margin) / (colWidth + margin)\n let w = Math.round((width + state.margin[0]) / (colWidth + state.margin[0]))\n let h = 0\n if (!autoSizeFlag) {\n h = Math.round((height + state.margin[1]) / (state.rowHeight + state.margin[1]))\n } else {\n h = Math.ceil((height + state.margin[1]) / (state.rowHeight + state.margin[1]))\n }\n\n // Capping\n w = Math.max(Math.min(w, state.cols - innerX), 0)\n h = Math.max(Math.min(h, state.maxRows - innerY), 0)\n return { w, h }\n}\n\nfunction updateWidth(width: number, colNum?: number) {\n state.containerWidth = width\n if (colNum !== undefined && colNum !== null) {\n state.cols = colNum\n }\n}\n\nfunction compact() {\n createStyle()\n}\n\nfunction tryInteract() {\n if (!interactObj.value && wrapper.value) {\n interactObj.value = interact(wrapper.value)\n if (!state.useStyleCursor) {\n interactObj.value.styleCursor(false)\n }\n }\n}\n\nconst throttleDrag = throttle(handleDrag)\n\nfunction tryMakeDraggable() {\n tryInteract()\n\n if (!interactObj.value) return\n\n if (state.draggable && !props.static) {\n const opts = {\n ignoreFrom: props.dragIgnoreFrom,\n allowFrom: props.dragAllowFrom,\n ...props.dragOption\n }\n interactObj.value.draggable(opts)\n\n if (!dragEventSet) {\n dragEventSet = true\n interactObj.value.on('dragstart dragmove dragend', event => {\n event.type === 'dragmove' ? throttleDrag(event) : handleDrag(event)\n })\n }\n } else {\n interactObj.value.draggable({ enabled: false })\n }\n}\n\nconst throttleResize = throttle(handleResize)\n\nfunction tryMakeResizable() {\n tryInteract()\n\n if (!interactObj.value) return\n\n if (state.resizable && !props.static) {\n const maximum = calcPosition(0, 0, props.maxW, props.maxH)\n const minimum = calcPosition(0, 0, props.minW, props.minH)\n\n const opts: Record = {\n edges: {\n left: renderRtl.value ? `.${resizerClass.value[0]}` : false,\n right: !renderRtl.value ? `.${resizerClass.value[0]}` : false,\n bottom: `.${resizerClass.value[0]}`,\n top: false\n },\n ignoreFrom: props.resizeIgnoreFrom,\n restrictSize: {\n min: {\n height: minimum.height * state.transformScale,\n width: minimum.width * state.transformScale\n },\n max: {\n height: maximum.height * state.transformScale,\n width: maximum.width * state.transformScale\n }\n },\n ...props.resizeOption\n }\n\n if (props.preserveAspectRatio) {\n opts.modifiers = [interact.modifiers.aspectRatio({ ratio: 'preserve' })]\n }\n\n interactObj.value.resizable(opts)\n if (!resizeEventSet) {\n resizeEventSet = true\n interactObj.value.on('resizestart resizemove resizeend', event => {\n event.type === 'resizemove' ? throttleResize(event) : handleResize(event)\n })\n }\n } else {\n interactObj.value.resizable({ enabled: false })\n }\n}\n\n\n\n","import { computed as W, watch as J, unref as E, getCurrentScope as _e, onScopeDispose as Q, ref as k, onMounted as rt, nextTick as _t, onBeforeUnmount as ot, renderSlot as mn, isVNode as pn, Comment as vn, createTextVNode as gn, Fragment as bn, readonly as Nt, toRef as yn, isRef as se, customRef as wn, reactive as Ye, shallowRef as $e, watchEffect as mt } from \"vue\";\nconst D = typeof window < \"u\";\nvar pt;\nD && ((pt = window == null ? void 0 : window.navigator) != null && pt.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);\nfunction Ke(e) {\n return e != null;\n}\nfunction P() {\n}\nconst xn = Object.freeze({\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n});\nObject.freeze(new Set(Object.keys(xn)));\nfunction vt(e) {\n return e & -e;\n}\nfunction En(e, t = 0) {\n const n = new Array(e + 1).fill(0);\n function r(c, a) {\n if (!(!a || c >= e))\n for (c += 1; c <= e; )\n n[c] += a, c += vt(c);\n }\n function o(c = e) {\n if (c <= 0) return 0;\n c > e && (c = e);\n let a = c * t;\n for (; c > 0; )\n a += n[c], c -= vt(c);\n return a;\n }\n function i(c) {\n return o(c + 1) - o(c);\n }\n function s(c) {\n let a = 0, l = e;\n for (; l > a; ) {\n const f = Math.floor((a + l) / 2), d = o(f);\n if (d > c) {\n l = f;\n continue;\n } else if (d < c) {\n if (a === f)\n return o(a + 1) <= c ? a + 1 : a;\n a = f;\n } else\n return f;\n }\n return a;\n }\n return { tree: n, add: r, sum: o, get: i, boundIndex: s };\n}\nfunction Rn(e) {\n let t = parseFloat(e);\n return Number.isNaN(t) && (t = Number(e)), Number.isNaN(t) ? 0 : t;\n}\nconst Tn = D && (\"ontouchstart\" in window || On() > 0), Sn = Tn ? \"pointerdown\" : \"click\";\nfunction On() {\n return typeof navigator < \"u\" && (navigator.maxTouchPoints || navigator.msMaxTouchPoints) || 0;\n}\nfunction kn(e, t, n = window.Event) {\n const { type: r, bubbles: o = !1, cancelable: i = !1, ...s } = t;\n if (!Ke(r) || r === \"\") return !1;\n let c;\n return Ke(n) ? c = new n(r, { bubbles: o, cancelable: i }) : (c = document.createEvent(\"HTMLEvents\"), c.initEvent(r, o, i)), Object.assign(c, s), e.dispatchEvent(c);\n}\nconst zn = D ? requestAnimationFrame : (e) => {\n setTimeout(e, 16);\n};\nfunction Wt(e, t = 16) {\n if (typeof e != \"function\")\n return P;\n const n = (...i) => {\n e(...i);\n };\n if (t <= 0)\n return An(n);\n let r = 0, o;\n return function(...i) {\n const s = Date.now(), c = s - r;\n clearTimeout(o), c >= t ? (r = s, n(...i)) : o = setTimeout(\n () => {\n r = Date.now(), n(...i);\n },\n Math.max(0, t - c)\n );\n };\n}\nfunction An(e) {\n if (typeof e != \"function\")\n return e;\n let t = !1, n, r;\n return function(...o) {\n return n = o, t || (t = !0, r = Promise.resolve().then(() => (t = !1, r = void 0, e(...n)))), r;\n };\n}\nconst ve = /* @__PURE__ */ new Set(), It = /* @__PURE__ */ new WeakMap();\nfunction Cn() {\n ve.forEach((e) => {\n e(...It.get(e));\n }), ve.clear();\n}\nfunction Mn(e, ...t) {\n if (typeof e != \"function\")\n return e;\n It.set(e, t), !ve.has(e) && (ve.add(e), ve.size === 1 && zn(Cn));\n}\nfunction Ht(e) {\n return Array.isArray(e) ? e : [e];\n}\nfunction K(e, t, n, r) {\n if (!e)\n return P;\n const o = W(() => typeof r == \"boolean\" ? { capture: r } : r || {});\n let i = P;\n const s = J(\n () => E(e),\n (a) => {\n if (i(), !a)\n return;\n const { disabled: l, ...f } = o.value, d = (p) => {\n E(l) || n(p);\n };\n a.addEventListener(t, d, f), i = () => {\n a.removeEventListener(t, d, f), i = P;\n };\n },\n { immediate: !0, flush: \"post\" }\n ), c = () => {\n s(), i();\n };\n return _e() && Q(c), c;\n}\nconst $t = \"clickoutside\", Ue = /* @__PURE__ */ new Set();\nD && document.addEventListener(\n Sn,\n (e) => {\n const t = e.target, n = e.composedPath && e.composedPath();\n Ue.forEach((r) => {\n r !== t && (n ? !n.includes(r) : !r.contains(t)) && (!r.__transferElement || r.__transferElement !== t && !r.__transferElement.contains(t)) && kn(r, { type: $t });\n });\n },\n !0\n);\nfunction oo(e, t = k(null)) {\n let n = P;\n const r = J(\n () => E(t),\n (i) => {\n n(), i && (Ue.add(i), n = () => {\n Ue.delete(i), n = P;\n });\n },\n { immediate: !0, flush: \"post\" }\n ), o = () => {\n r(), n();\n };\n return _e() && Q(o), K(t, $t, e), t;\n}\nfunction io(e = P, t = k(null)) {\n let n;\n return rt(() => {\n _t(() => {\n const r = Vt(t.value);\n r ? (n = new MutationObserver(() => {\n r.style.display !== \"none\" && (typeof e == \"function\" && e(), n == null || n.disconnect(), n = null);\n }), n.observe(r, {\n attributes: !0,\n childList: !0,\n characterData: !0,\n attributeFilter: [\"style\"]\n })) : typeof e == \"function\" && e();\n });\n }), ot(() => {\n n == null || n.disconnect(), n = null;\n }), t;\n}\nfunction Vt(e) {\n if (e) {\n let t = e.parentElement;\n for (; t && t !== document.body; ) {\n if (t.style.display === \"none\")\n return t;\n t = t.parentElement;\n }\n }\n return null;\n}\nfunction gt(e) {\n return (e == null ? void 0 : e.style.display) !== \"none\" ? !!Vt(e) : !0;\n}\nfunction so(e, t, n) {\n for (const r of t)\n if (e[r])\n return (o) => mn(e, r, o, () => {\n const i = n == null ? void 0 : n(o);\n return i ? Ht(i) : [];\n });\n return n || null;\n}\nfunction co(e) {\n const t = [], n = Array.isArray(e) ? [...e] : [];\n for (; n.length; ) {\n const r = n.shift();\n r !== null && (Array.isArray(r) && n.unshift(...r), !(typeof r != \"string\" && typeof r != \"number\" && (!pn(r) || r.type === vn)) && (typeof r == \"string\" || typeof r == \"number\" ? t.push(gn(String(r))) : r.type === bn && Array.isArray(r.children) ? n.unshift(r.children) : t.push(r)));\n }\n return t;\n}\nfunction Re(e) {\n const t = E(e);\n return typeof t == \"string\" ? D ? document.querySelector(t) : null : (t == null ? void 0 : t.$el) ?? t;\n}\nfunction ao(e) {\n return new Proxy({}, {\n get(t, n) {\n var r, o, i;\n if (e.component)\n return ((r = e.component.proxy) == null ? void 0 : r[n]) ?? ((o = e.component.exposeProxy) == null ? void 0 : o[n]) ?? ((i = e.component.exposed) == null ? void 0 : i[n]);\n }\n });\n}\nfunction lo(...e) {\n const t = k(!0), n = e[1] || P;\n function r() {\n t.value = !1;\n }\n function o() {\n t.value = !0;\n }\n const i = J(\n e[0],\n (...s) => new Promise((c, a) => {\n t.value && Promise.resolve(n(...s)).then(c).catch(a);\n }),\n e[2]\n );\n return { active: Nt(t), pause: r, resume: o, stop: i };\n}\nfunction fo(e, t) {\n return t.map((n) => yn(e, n));\n}\nconst Ln = [\n [\n \"requestFullscreen\",\n \"exitFullscreen\",\n \"fullscreenElement\",\n \"fullscreenEnabled\",\n \"fullscreenchange\",\n \"fullscreenerror\"\n ],\n // New WebKit\n [\n \"webkitRequestFullscreen\",\n \"webkitExitFullscreen\",\n \"webkitFullscreenElement\",\n \"webkitFullscreenEnabled\",\n \"webkitfullscreenchange\",\n \"webkitfullscreenerror\"\n ],\n // Old WebKit\n [\n \"webkitRequestFullScreen\",\n \"webkitCancelFullScreen\",\n \"webkitCurrentFullScreenElement\",\n \"webkitCancelFullScreen\",\n \"webkitfullscreenchange\",\n \"webkitfullscreenerror\"\n ],\n [\n \"mozRequestFullScreen\",\n \"mozCancelFullScreen\",\n \"mozFullScreenElement\",\n \"mozFullScreenEnabled\",\n \"mozfullscreenchange\",\n \"mozfullscreenerror\"\n ],\n [\n \"msRequestFullscreen\",\n \"msExitFullscreen\",\n \"msFullscreenElement\",\n \"msFullscreenEnabled\",\n \"MSFullscreenChange\",\n \"MSFullscreenError\"\n ]\n];\nlet ce;\nif (D) {\n for (const e of Ln)\n if (e[1] in document) {\n ce = e;\n break;\n }\n}\nconst Ge = !!ce, Bn = {\n supported: Ge,\n full: W(() => !1),\n enter: P,\n exit: P,\n toggle: P\n}, qt = /* @__PURE__ */ new Set(), Je = /* @__PURE__ */ new WeakMap();\nif (D && ce) {\n const e = ce[2], t = ce[4];\n document.addEventListener(\n t,\n () => {\n if (qt.forEach((n) => {\n n.value = !1;\n }), document[e]) {\n const n = Je.get(document[e]);\n n && (n.value = !0);\n }\n },\n !1\n );\n}\nfunction uo(e = k(null)) {\n const t = W({\n get: () => Re(e),\n set: (l) => {\n se(e) && (e.value = l);\n }\n });\n if (!D || !Ge)\n return { ...Bn, target: t };\n const [n, r, o] = ce, i = k(!1);\n J(\n () => Re(e),\n (l, f) => {\n f && Je.delete(f), l && Je.set(l, i);\n },\n { immediate: !0, flush: \"post\" }\n ), qt.add(i), _e() && Q(c);\n async function s(l = !1) {\n await c();\n const f = Re(e);\n return f && (l || !document[o]) ? (await f[n](), i.value = !0, document[o] === f) : !1;\n }\n async function c(l = !1) {\n const f = Re(e);\n return l || document[o] && document[o] === f ? (await document[r](), i.value = !1, document[o] !== f) : !1;\n }\n async function a(l = !1) {\n return i.value ? await c(l) : await s(l);\n }\n return {\n supported: Ge,\n target: t,\n full: W(() => i.value),\n enter: s,\n exit: c,\n toggle: a\n };\n}\nfunction ho(e = k(null)) {\n const t = k(!1);\n K(e, \"mouseenter\", n), K(e, \"mouseleave\", r);\n function n() {\n t.value = !0;\n }\n function r() {\n t.value = !1;\n }\n return { wrapper: e, isHover: t };\n}\nconst Te = /* @__PURE__ */ new WeakMap(), Pn = /\\s+/g, Dn = /(px|%)$/;\nfunction mo(e) {\n const t = e.target || k(null);\n if (!D)\n return { target: t, disconnect: P };\n const { handler: n } = e;\n let r = e.root ?? document;\n const o = Ht(e.threshold || 0).join() || \"0\", i = m(e.rootMargin);\n Te.has(r) || Te.set(r, /* @__PURE__ */ new Map());\n const s = Te.get(r);\n s.has(o) || s.set(o, /* @__PURE__ */ new Map());\n const c = s.get(o);\n c.has(i) || c.set(i, {\n ob: new IntersectionObserver(b, { ...e, rootMargin: i }),\n count: 0,\n handlers: /* @__PURE__ */ new WeakMap()\n });\n let a = c.get(i), { ob: l, handlers: f } = a, d = P;\n const p = J(\n () => E(t),\n (v) => {\n d(), !(!v || !l) && (f.set(v, n), l.observe(v), a && a.count++, d = () => {\n l.unobserve(v), f.delete(v), a && a.count--, d = P;\n });\n },\n { immediate: !0, flush: \"post\" }\n );\n _e() && Q(g);\n function m(v) {\n if (!v || !v.trim()) return \"_\";\n const h = v.trim().split(Pn, 4);\n h.length = 4;\n for (let u = 0; u < 4; ++u) {\n const y = h[u];\n h[u] = Dn.test(y) ? y : `${Rn(y)}px`;\n }\n return h.join(\" \");\n }\n function b(v) {\n for (let h = 0, u = v.length; h < u; ++h) {\n const y = v[h], O = f.get(y.target);\n typeof O == \"function\" && O(y);\n }\n }\n function g() {\n p(), d(), a && (a.count <= 0 && (c.delete(i), c.size || (s.delete(o), s.size || Te.delete(r))), a = void 0, l = void 0, f = void 0, r = void 0);\n }\n return { target: t, disconnect: g };\n}\nfunction po() {\n const e = /* @__PURE__ */ new Set();\n function t(r) {\n return wn((o, i) => {\n let s = r;\n const c = () => {\n r !== s && (s = r, i());\n };\n return {\n get: () => (o(), r),\n set: (a) => {\n a !== r && (r = a, e.add(c));\n }\n };\n });\n }\n function n() {\n for (const r of e)\n r();\n e.clear();\n }\n return { updateSet: e, manualRef: t, triggerUpdate: n };\n}\nconst Fn = {\n ctrl: \"control\",\n command: \"meta\",\n cmd: \"meta\",\n option: \"alt\",\n up: \"arrowup\",\n down: \"arrowdown\",\n left: \"arrowleft\",\n right: \"arrowright\"\n}, _n = /[+_-]/, Nn = /[+_-]/g, Wn = [\"activeKeys\", \"resetAll\"];\nfunction vo(e = {}) {\n const {\n autoReset: t = !0,\n capture: n = !1,\n passive: r = !0,\n strictTarget: o = !1,\n onKeyDown: i = P,\n onKeyUp: s = P\n } = e, c = e.target || k(null), a = se(e.disabled) ? e.disabled : k(e.disabled || !1), l = { ...Fn, ...e.aliasMap || {} }, f = Ye(/* @__PURE__ */ new Set()), d = /* @__PURE__ */ new Set(), p = Ye({ activeKeys: f, resetAll: g });\n function m(h, u) {\n h in p && (p[h] = u);\n }\n function b(h, u) {\n var S, C;\n const y = (S = h.key) == null ? void 0 : S.toLocaleLowerCase(), R = [(C = h.code) == null ? void 0 : C.toLocaleLowerCase(), y].filter(Boolean);\n for (const z of R)\n f[u ? \"add\" : \"delete\"](z), m(z, u);\n if (!u && y === \"meta\") {\n for (const z of d)\n f.delete(z), m(z, !1);\n d.clear();\n } else if (u && typeof h.getModifierState == \"function\" && h.getModifierState(\"Meta\"))\n for (const z of [...f, ...R])\n d.add(z);\n }\n function g() {\n Object.keys(p).forEach((h) => {\n p[h] = !1;\n }), p.activeKeys = f, p.resetAll = g;\n }\n const v = new Proxy(p, {\n get(h, u, y) {\n if (typeof u != \"string\" || Wn.includes(u))\n return Reflect.get(h, u, y);\n if (u = u.toLocaleLowerCase(), u in l && (u = l[u]), !(u in p))\n if (_n.test(u)) {\n const O = u.split(Nn).map((R) => R.trim());\n p[u] = W(() => O.every((R) => E(v[R])));\n } else\n p[u] = k(f.has(u));\n return E(Reflect.get(h, u, y));\n }\n });\n return K(\n c,\n \"keydown\",\n (h) => {\n o && h.target !== E(c) || (b(h, !0), i(h, v));\n },\n { capture: n, passive: r, disabled: a }\n ), K(\n c,\n \"keyup\",\n (h) => {\n o && h.target !== E(c) || (b(h, !1), s(h, v));\n },\n { capture: n, passive: r, disabled: a }\n ), t && K(c, \"blur\", g, { capture: n, passive: r, disabled: a }), { target: c, modifier: v };\n}\nfunction go(e) {\n const t = k(!1), n = () => t.value = !0;\n return rt(() => {\n e === \"tick\" ? _t(n) : e === \"frame\" ? requestAnimationFrame(n) : n();\n }), ot(() => {\n t.value = !1;\n }), { isMounted: Nt(t) };\n}\nfunction Ve(e) {\n e.cancelable && (e.stopPropagation(), e.preventDefault());\n}\nfunction bo(e) {\n const t = e.target || k(null), n = se(e.x) ? e.x : k(0), r = se(e.y) ? e.y : k(0), o = se(e.lazy) ? e.lazy : k(e.lazy || !1), i = se(e.disabled) ? e.disabled : k(e.disabled || !1), { capture: s = !0, stopMouse: c = !0, stopTouch: a = !0 } = e, l = k(!1), f = {\n xStart: 0,\n yStart: 0,\n xEnd: 0,\n yEnd: 0,\n clientX: 0,\n clientY: 0,\n deltaX: 0,\n deltaY: 0,\n lazy: !1\n };\n let d = 0, p = 0;\n const m = Wt((u) => {\n var y;\n p < d || (h(u), f.lazy || (n.value = f.xEnd, r.value = f.yEnd), (y = e.onMove) == null || y.call(e, f, u));\n });\n function b(u) {\n var y;\n i.value || (Object.assign(f, {\n xStart: n.value,\n yStart: r.value,\n xEnd: n.value,\n yEnd: r.value,\n clientX: u.clientX,\n clientY: u.clientY,\n lazy: o.value\n }), ((y = e.onStart) == null ? void 0 : y.call(e, f, u)) !== !1 && (document.addEventListener(\"pointermove\", g, { capture: s }), document.addEventListener(\"pointerup\", v, { capture: s }), p = d, l.value = !0));\n }\n function g(u) {\n i.value || (Ve(u), m(u));\n }\n function v(u) {\n var y;\n document.removeEventListener(\"pointermove\", g, { capture: s }), document.removeEventListener(\"pointerup\", v, { capture: s }), !i.value && (h(u), f.lazy && (n.value = f.xEnd, r.value = f.yEnd), l.value = !1, ++d, (y = e.onEnd) == null || y.call(e, f, u));\n }\n function h(u) {\n const { clientX: y, clientY: O } = u, { xStart: R, yStart: S, clientX: C, clientY: z } = f, L = y - C, B = O - z;\n f.deltaX = L, f.deltaY = B, f.xEnd = R + L, f.yEnd = S + B;\n }\n return K(t, \"pointerdown\", b, { capture: s }), c && K(t, \"mousedown\", Ve, { capture: s }), a && K(t, \"touchstart\", Ve, { capture: s }), {\n target: t,\n moving: W(() => l.value),\n x: n,\n y: r,\n lazy: o,\n disabled: i\n };\n}\nconst be = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Map();\nU.set(\"x\", 0);\nU.set(\"y\", 0);\nfunction In(e) {\n const { pageX: t, pageY: n } = e;\n U.set(\"x\", t), U.set(\"y\", n), be.forEach((r) => {\n r.x.value = t, r.y.value = n;\n });\n}\nconst Xt = Wt(In);\nfunction Hn(e) {\n !be.size && window && (U.set(\"x\", 0), U.set(\"y\", 0), window.addEventListener(\"pointermove\", Xt, { passive: !0 })), be.add(e);\n}\nfunction bt(e) {\n be.delete(e), !be.size && window && window.removeEventListener(\"pointermove\", Xt);\n}\nfunction yo(e = {}) {\n const t = k(e.x ?? U.get(\"x\")), n = k(e.y ?? U.get(\"y\")), r = { x: t, y: n };\n return Hn(r), e.manualStop || ot(() => {\n bt(r);\n }), { ...r, unregister: () => bt(r) };\n}\nconst $n = [\"top\", \"right\", \"bottom\", \"left\"], fe = Math.min, te = Math.max, Me = Math.round, Se = Math.floor, X = (e) => ({\n x: e,\n y: e\n}), Vn = {\n left: \"right\",\n right: \"left\",\n bottom: \"top\",\n top: \"bottom\"\n}, qn = {\n start: \"end\",\n end: \"start\"\n};\nfunction Qe(e, t, n) {\n return te(e, fe(t, n));\n}\nfunction he(e, t) {\n return typeof e == \"function\" ? e(t) : e;\n}\nfunction oe(e) {\n return e.split(\"-\")[0];\n}\nfunction xe(e) {\n return e.split(\"-\")[1];\n}\nfunction jt(e) {\n return e === \"x\" ? \"y\" : \"x\";\n}\nfunction it(e) {\n return e === \"y\" ? \"height\" : \"width\";\n}\nfunction ue(e) {\n return [\"top\", \"bottom\"].includes(oe(e)) ? \"y\" : \"x\";\n}\nfunction st(e) {\n return jt(ue(e));\n}\nfunction Xn(e, t, n) {\n n === void 0 && (n = !1);\n const r = xe(e), o = st(e), i = it(o);\n let s = o === \"x\" ? r === (n ? \"end\" : \"start\") ? \"right\" : \"left\" : r === \"start\" ? \"bottom\" : \"top\";\n return t.reference[i] > t.floating[i] && (s = Le(s)), [s, Le(s)];\n}\nfunction jn(e) {\n const t = Le(e);\n return [Ze(e), t, Ze(t)];\n}\nfunction Ze(e) {\n return e.replace(/start|end/g, (t) => qn[t]);\n}\nfunction Yn(e, t, n) {\n const r = [\"left\", \"right\"], o = [\"right\", \"left\"], i = [\"top\", \"bottom\"], s = [\"bottom\", \"top\"];\n switch (e) {\n case \"top\":\n case \"bottom\":\n return n ? t ? o : r : t ? r : o;\n case \"left\":\n case \"right\":\n return t ? i : s;\n default:\n return [];\n }\n}\nfunction Kn(e, t, n, r) {\n const o = xe(e);\n let i = Yn(oe(e), n === \"start\", r);\n return o && (i = i.map((s) => s + \"-\" + o), t && (i = i.concat(i.map(Ze)))), i;\n}\nfunction Le(e) {\n return e.replace(/left|right|bottom|top/g, (t) => Vn[t]);\n}\nfunction Un(e) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...e\n };\n}\nfunction Yt(e) {\n return typeof e != \"number\" ? Un(e) : {\n top: e,\n right: e,\n bottom: e,\n left: e\n };\n}\nfunction Be(e) {\n const {\n x: t,\n y: n,\n width: r,\n height: o\n } = e;\n return {\n width: r,\n height: o,\n top: n,\n left: t,\n right: t + r,\n bottom: n + o,\n x: t,\n y: n\n };\n}\nfunction yt(e, t, n) {\n let {\n reference: r,\n floating: o\n } = e;\n const i = ue(t), s = st(t), c = it(s), a = oe(t), l = i === \"y\", f = r.x + r.width / 2 - o.width / 2, d = r.y + r.height / 2 - o.height / 2, p = r[c] / 2 - o[c] / 2;\n let m;\n switch (a) {\n case \"top\":\n m = {\n x: f,\n y: r.y - o.height\n };\n break;\n case \"bottom\":\n m = {\n x: f,\n y: r.y + r.height\n };\n break;\n case \"right\":\n m = {\n x: r.x + r.width,\n y: d\n };\n break;\n case \"left\":\n m = {\n x: r.x - o.width,\n y: d\n };\n break;\n default:\n m = {\n x: r.x,\n y: r.y\n };\n }\n switch (xe(t)) {\n case \"start\":\n m[s] -= p * (n && l ? -1 : 1);\n break;\n case \"end\":\n m[s] += p * (n && l ? -1 : 1);\n break;\n }\n return m;\n}\nconst Gn = async (e, t, n) => {\n const {\n placement: r = \"bottom\",\n strategy: o = \"absolute\",\n middleware: i = [],\n platform: s\n } = n, c = i.filter(Boolean), a = await (s.isRTL == null ? void 0 : s.isRTL(t));\n let l = await s.getElementRects({\n reference: e,\n floating: t,\n strategy: o\n }), {\n x: f,\n y: d\n } = yt(l, r, a), p = r, m = {}, b = 0;\n for (let g = 0; g < c.length; g++) {\n const {\n name: v,\n fn: h\n } = c[g], {\n x: u,\n y,\n data: O,\n reset: R\n } = await h({\n x: f,\n y: d,\n initialPlacement: r,\n placement: p,\n strategy: o,\n middlewareData: m,\n rects: l,\n platform: s,\n elements: {\n reference: e,\n floating: t\n }\n });\n f = u ?? f, d = y ?? d, m = {\n ...m,\n [v]: {\n ...m[v],\n ...O\n }\n }, R && b <= 50 && (b++, typeof R == \"object\" && (R.placement && (p = R.placement), R.rects && (l = R.rects === !0 ? await s.getElementRects({\n reference: e,\n floating: t,\n strategy: o\n }) : R.rects), {\n x: f,\n y: d\n } = yt(l, p, a)), g = -1);\n }\n return {\n x: f,\n y: d,\n placement: p,\n strategy: o,\n middlewareData: m\n };\n};\nasync function Pe(e, t) {\n var n;\n t === void 0 && (t = {});\n const {\n x: r,\n y: o,\n platform: i,\n rects: s,\n elements: c,\n strategy: a\n } = e, {\n boundary: l = \"clippingAncestors\",\n rootBoundary: f = \"viewport\",\n elementContext: d = \"floating\",\n altBoundary: p = !1,\n padding: m = 0\n } = he(t, e), b = Yt(m), v = c[p ? d === \"floating\" ? \"reference\" : \"floating\" : d], h = Be(await i.getClippingRect({\n element: (n = await (i.isElement == null ? void 0 : i.isElement(v))) == null || n ? v : v.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),\n boundary: l,\n rootBoundary: f,\n strategy: a\n })), u = d === \"floating\" ? {\n x: r,\n y: o,\n width: s.floating.width,\n height: s.floating.height\n } : s.reference, y = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), O = await (i.isElement == null ? void 0 : i.isElement(y)) ? await (i.getScale == null ? void 0 : i.getScale(y)) || {\n x: 1,\n y: 1\n } : {\n x: 1,\n y: 1\n }, R = Be(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements: c,\n rect: u,\n offsetParent: y,\n strategy: a\n }) : u);\n return {\n top: (h.top - R.top + b.top) / O.y,\n bottom: (R.bottom - h.bottom + b.bottom) / O.y,\n left: (h.left - R.left + b.left) / O.x,\n right: (R.right - h.right + b.right) / O.x\n };\n}\nconst Jn = (e) => ({\n name: \"arrow\",\n options: e,\n async fn(t) {\n const {\n x: n,\n y: r,\n placement: o,\n rects: i,\n platform: s,\n elements: c,\n middlewareData: a\n } = t, {\n element: l,\n padding: f = 0\n } = he(e, t) || {};\n if (l == null)\n return {};\n const d = Yt(f), p = {\n x: n,\n y: r\n }, m = st(o), b = it(m), g = await s.getDimensions(l), v = m === \"y\", h = v ? \"top\" : \"left\", u = v ? \"bottom\" : \"right\", y = v ? \"clientHeight\" : \"clientWidth\", O = i.reference[b] + i.reference[m] - p[m] - i.floating[b], R = p[m] - i.reference[m], S = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l));\n let C = S ? S[y] : 0;\n (!C || !await (s.isElement == null ? void 0 : s.isElement(S))) && (C = c.floating[y] || i.floating[b]);\n const z = O / 2 - R / 2, L = C / 2 - g[b] / 2 - 1, B = fe(d[h], L), H = fe(d[u], L), _ = B, w = C - g[b] - H, x = C / 2 - g[b] / 2 + z, T = Qe(_, x, w), M = !a.arrow && xe(o) != null && x !== T && i.reference[b] / 2 - (x < _ ? B : H) - g[b] / 2 < 0, A = M ? x < _ ? x - _ : x - w : 0;\n return {\n [m]: p[m] + A,\n data: {\n [m]: T,\n centerOffset: x - T - A,\n ...M && {\n alignmentOffset: A\n }\n },\n reset: M\n };\n }\n}), Qn = function(e) {\n return e === void 0 && (e = {}), {\n name: \"flip\",\n options: e,\n async fn(t) {\n var n, r;\n const {\n placement: o,\n middlewareData: i,\n rects: s,\n initialPlacement: c,\n platform: a,\n elements: l\n } = t, {\n mainAxis: f = !0,\n crossAxis: d = !0,\n fallbackPlacements: p,\n fallbackStrategy: m = \"bestFit\",\n fallbackAxisSideDirection: b = \"none\",\n flipAlignment: g = !0,\n ...v\n } = he(e, t);\n if ((n = i.arrow) != null && n.alignmentOffset)\n return {};\n const h = oe(o), u = ue(c), y = oe(c) === c, O = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), R = p || (y || !g ? [Le(c)] : jn(c)), S = b !== \"none\";\n !p && S && R.push(...Kn(c, g, b, O));\n const C = [c, ...R], z = await Pe(t, v), L = [];\n let B = ((r = i.flip) == null ? void 0 : r.overflows) || [];\n if (f && L.push(z[h]), d) {\n const x = Xn(o, s, O);\n L.push(z[x[0]], z[x[1]]);\n }\n if (B = [...B, {\n placement: o,\n overflows: L\n }], !L.every((x) => x <= 0)) {\n var H, _;\n const x = (((H = i.flip) == null ? void 0 : H.index) || 0) + 1, T = C[x];\n if (T)\n return {\n data: {\n index: x,\n overflows: B\n },\n reset: {\n placement: T\n }\n };\n let M = (_ = B.filter((A) => A.overflows[0] <= 0).sort((A, N) => A.overflows[1] - N.overflows[1])[0]) == null ? void 0 : _.placement;\n if (!M)\n switch (m) {\n case \"bestFit\": {\n var w;\n const A = (w = B.filter((N) => {\n if (S) {\n const F = ue(N.placement);\n return F === u || // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n F === \"y\";\n }\n return !0;\n }).map((N) => [N.placement, N.overflows.filter((F) => F > 0).reduce((F, Z) => F + Z, 0)]).sort((N, F) => N[1] - F[1])[0]) == null ? void 0 : w[0];\n A && (M = A);\n break;\n }\n case \"initialPlacement\":\n M = c;\n break;\n }\n if (o !== M)\n return {\n reset: {\n placement: M\n }\n };\n }\n return {};\n }\n };\n};\nfunction wt(e, t) {\n return {\n top: e.top - t.height,\n right: e.right - t.width,\n bottom: e.bottom - t.height,\n left: e.left - t.width\n };\n}\nfunction xt(e) {\n return $n.some((t) => e[t] >= 0);\n}\nconst Zn = function(e) {\n return e === void 0 && (e = {}), {\n name: \"hide\",\n options: e,\n async fn(t) {\n const {\n rects: n\n } = t, {\n strategy: r = \"referenceHidden\",\n ...o\n } = he(e, t);\n switch (r) {\n case \"referenceHidden\": {\n const i = await Pe(t, {\n ...o,\n elementContext: \"reference\"\n }), s = wt(i, n.reference);\n return {\n data: {\n referenceHiddenOffsets: s,\n referenceHidden: xt(s)\n }\n };\n }\n case \"escaped\": {\n const i = await Pe(t, {\n ...o,\n altBoundary: !0\n }), s = wt(i, n.floating);\n return {\n data: {\n escapedOffsets: s,\n escaped: xt(s)\n }\n };\n }\n default:\n return {};\n }\n }\n };\n};\nasync function er(e, t) {\n const {\n placement: n,\n platform: r,\n elements: o\n } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = oe(n), c = xe(n), a = ue(n) === \"y\", l = [\"left\", \"top\"].includes(s) ? -1 : 1, f = i && a ? -1 : 1, d = he(t, e);\n let {\n mainAxis: p,\n crossAxis: m,\n alignmentAxis: b\n } = typeof d == \"number\" ? {\n mainAxis: d,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: d.mainAxis || 0,\n crossAxis: d.crossAxis || 0,\n alignmentAxis: d.alignmentAxis\n };\n return c && typeof b == \"number\" && (m = c === \"end\" ? b * -1 : b), a ? {\n x: m * f,\n y: p * l\n } : {\n x: p * l,\n y: m * f\n };\n}\nconst tr = function(e) {\n return e === void 0 && (e = 0), {\n name: \"offset\",\n options: e,\n async fn(t) {\n var n, r;\n const {\n x: o,\n y: i,\n placement: s,\n middlewareData: c\n } = t, a = await er(t, e);\n return s === ((n = c.offset) == null ? void 0 : n.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : {\n x: o + a.x,\n y: i + a.y,\n data: {\n ...a,\n placement: s\n }\n };\n }\n };\n}, nr = function(e) {\n return e === void 0 && (e = {}), {\n name: \"shift\",\n options: e,\n async fn(t) {\n const {\n x: n,\n y: r,\n placement: o\n } = t, {\n mainAxis: i = !0,\n crossAxis: s = !1,\n limiter: c = {\n fn: (v) => {\n let {\n x: h,\n y: u\n } = v;\n return {\n x: h,\n y: u\n };\n }\n },\n ...a\n } = he(e, t), l = {\n x: n,\n y: r\n }, f = await Pe(t, a), d = ue(oe(o)), p = jt(d);\n let m = l[p], b = l[d];\n if (i) {\n const v = p === \"y\" ? \"top\" : \"left\", h = p === \"y\" ? \"bottom\" : \"right\", u = m + f[v], y = m - f[h];\n m = Qe(u, m, y);\n }\n if (s) {\n const v = d === \"y\" ? \"top\" : \"left\", h = d === \"y\" ? \"bottom\" : \"right\", u = b + f[v], y = b - f[h];\n b = Qe(u, b, y);\n }\n const g = c.fn({\n ...t,\n [p]: m,\n [d]: b\n });\n return {\n ...g,\n data: {\n x: g.x - n,\n y: g.y - r,\n enabled: {\n [p]: i,\n [d]: s\n }\n }\n };\n }\n };\n};\nfunction Ne() {\n return typeof window < \"u\";\n}\nfunction me(e) {\n return Kt(e) ? (e.nodeName || \"\").toLowerCase() : \"#document\";\n}\nfunction I(e) {\n var t;\n return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;\n}\nfunction Y(e) {\n var t;\n return (t = (Kt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;\n}\nfunction Kt(e) {\n return Ne() ? e instanceof Node || e instanceof I(e).Node : !1;\n}\nfunction $(e) {\n return Ne() ? e instanceof Element || e instanceof I(e).Element : !1;\n}\nfunction j(e) {\n return Ne() ? e instanceof HTMLElement || e instanceof I(e).HTMLElement : !1;\n}\nfunction Et(e) {\n return !Ne() || typeof ShadowRoot > \"u\" ? !1 : e instanceof ShadowRoot || e instanceof I(e).ShadowRoot;\n}\nfunction Ee(e) {\n const {\n overflow: t,\n overflowX: n,\n overflowY: r,\n display: o\n } = V(e);\n return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && ![\"inline\", \"contents\"].includes(o);\n}\nfunction rr(e) {\n return [\"table\", \"td\", \"th\"].includes(me(e));\n}\nfunction We(e) {\n return [\":popover-open\", \":modal\"].some((t) => {\n try {\n return e.matches(t);\n } catch {\n return !1;\n }\n });\n}\nfunction ct(e) {\n const t = at(), n = $(e) ? V(e) : e;\n return [\"transform\", \"translate\", \"scale\", \"rotate\", \"perspective\"].some((r) => n[r] ? n[r] !== \"none\" : !1) || (n.containerType ? n.containerType !== \"normal\" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== \"none\" : !1) || !t && (n.filter ? n.filter !== \"none\" : !1) || [\"transform\", \"translate\", \"scale\", \"rotate\", \"perspective\", \"filter\"].some((r) => (n.willChange || \"\").includes(r)) || [\"paint\", \"layout\", \"strict\", \"content\"].some((r) => (n.contain || \"\").includes(r));\n}\nfunction or(e) {\n let t = G(e);\n for (; j(t) && !de(t); ) {\n if (ct(t))\n return t;\n if (We(t))\n return null;\n t = G(t);\n }\n return null;\n}\nfunction at() {\n return typeof CSS > \"u\" || !CSS.supports ? !1 : CSS.supports(\"-webkit-backdrop-filter\", \"none\");\n}\nfunction de(e) {\n return [\"html\", \"body\", \"#document\"].includes(me(e));\n}\nfunction V(e) {\n return I(e).getComputedStyle(e);\n}\nfunction Ie(e) {\n return $(e) ? {\n scrollLeft: e.scrollLeft,\n scrollTop: e.scrollTop\n } : {\n scrollLeft: e.scrollX,\n scrollTop: e.scrollY\n };\n}\nfunction G(e) {\n if (me(e) === \"html\")\n return e;\n const t = (\n // Step into the shadow DOM of the parent of a slotted node.\n e.assignedSlot || // DOM Element detected.\n e.parentNode || // ShadowRoot detected.\n Et(e) && e.host || // Fallback.\n Y(e)\n );\n return Et(t) ? t.host : t;\n}\nfunction Ut(e) {\n const t = G(e);\n return de(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : j(t) && Ee(t) ? t : Ut(t);\n}\nfunction ye(e, t, n) {\n var r;\n t === void 0 && (t = []), n === void 0 && (n = !0);\n const o = Ut(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = I(o);\n if (i) {\n const c = et(s);\n return t.concat(s, s.visualViewport || [], Ee(o) ? o : [], c && n ? ye(c) : []);\n }\n return t.concat(o, ye(o, [], n));\n}\nfunction et(e) {\n return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;\n}\nfunction Gt(e) {\n const t = V(e);\n let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;\n const o = j(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, c = Me(n) !== i || Me(r) !== s;\n return c && (n = i, r = s), {\n width: n,\n height: r,\n $: c\n };\n}\nfunction lt(e) {\n return $(e) ? e : e.contextElement;\n}\nfunction ae(e) {\n const t = lt(e);\n if (!j(t))\n return X(1);\n const n = t.getBoundingClientRect(), {\n width: r,\n height: o,\n $: i\n } = Gt(t);\n let s = (i ? Me(n.width) : n.width) / r, c = (i ? Me(n.height) : n.height) / o;\n return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {\n x: s,\n y: c\n };\n}\nconst ir = /* @__PURE__ */ X(0);\nfunction Jt(e) {\n const t = I(e);\n return !at() || !t.visualViewport ? ir : {\n x: t.visualViewport.offsetLeft,\n y: t.visualViewport.offsetTop\n };\n}\nfunction sr(e, t, n) {\n return t === void 0 && (t = !1), !n || t && n !== I(e) ? !1 : t;\n}\nfunction ie(e, t, n, r) {\n t === void 0 && (t = !1), n === void 0 && (n = !1);\n const o = e.getBoundingClientRect(), i = lt(e);\n let s = X(1);\n t && (r ? $(r) && (s = ae(r)) : s = ae(e));\n const c = sr(i, n, r) ? Jt(i) : X(0);\n let a = (o.left + c.x) / s.x, l = (o.top + c.y) / s.y, f = o.width / s.x, d = o.height / s.y;\n if (i) {\n const p = I(i), m = r && $(r) ? I(r) : r;\n let b = p, g = et(b);\n for (; g && r && m !== b; ) {\n const v = ae(g), h = g.getBoundingClientRect(), u = V(g), y = h.left + (g.clientLeft + parseFloat(u.paddingLeft)) * v.x, O = h.top + (g.clientTop + parseFloat(u.paddingTop)) * v.y;\n a *= v.x, l *= v.y, f *= v.x, d *= v.y, a += y, l += O, b = I(g), g = et(b);\n }\n }\n return Be({\n width: f,\n height: d,\n x: a,\n y: l\n });\n}\nfunction ft(e, t) {\n const n = Ie(e).scrollLeft;\n return t ? t.left + n : ie(Y(e)).left + n;\n}\nfunction Qt(e, t, n) {\n n === void 0 && (n = !1);\n const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (\n // RTL scrollbar.\n ft(e, r)\n )), i = r.top + t.scrollTop;\n return {\n x: o,\n y: i\n };\n}\nfunction cr(e) {\n let {\n elements: t,\n rect: n,\n offsetParent: r,\n strategy: o\n } = e;\n const i = o === \"fixed\", s = Y(r), c = t ? We(t.floating) : !1;\n if (r === s || c && i)\n return n;\n let a = {\n scrollLeft: 0,\n scrollTop: 0\n }, l = X(1);\n const f = X(0), d = j(r);\n if ((d || !d && !i) && ((me(r) !== \"body\" || Ee(s)) && (a = Ie(r)), j(r))) {\n const m = ie(r);\n l = ae(r), f.x = m.x + r.clientLeft, f.y = m.y + r.clientTop;\n }\n const p = s && !d && !i ? Qt(s, a, !0) : X(0);\n return {\n width: n.width * l.x,\n height: n.height * l.y,\n x: n.x * l.x - a.scrollLeft * l.x + f.x + p.x,\n y: n.y * l.y - a.scrollTop * l.y + f.y + p.y\n };\n}\nfunction ar(e) {\n return Array.from(e.getClientRects());\n}\nfunction lr(e) {\n const t = Y(e), n = Ie(e), r = e.ownerDocument.body, o = te(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = te(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);\n let s = -n.scrollLeft + ft(e);\n const c = -n.scrollTop;\n return V(r).direction === \"rtl\" && (s += te(t.clientWidth, r.clientWidth) - o), {\n width: o,\n height: i,\n x: s,\n y: c\n };\n}\nfunction fr(e, t) {\n const n = I(e), r = Y(e), o = n.visualViewport;\n let i = r.clientWidth, s = r.clientHeight, c = 0, a = 0;\n if (o) {\n i = o.width, s = o.height;\n const l = at();\n (!l || l && t === \"fixed\") && (c = o.offsetLeft, a = o.offsetTop);\n }\n return {\n width: i,\n height: s,\n x: c,\n y: a\n };\n}\nfunction ur(e, t) {\n const n = ie(e, !0, t === \"fixed\"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = j(e) ? ae(e) : X(1), s = e.clientWidth * i.x, c = e.clientHeight * i.y, a = o * i.x, l = r * i.y;\n return {\n width: s,\n height: c,\n x: a,\n y: l\n };\n}\nfunction Rt(e, t, n) {\n let r;\n if (t === \"viewport\")\n r = fr(e, n);\n else if (t === \"document\")\n r = lr(Y(e));\n else if ($(t))\n r = ur(t, n);\n else {\n const o = Jt(e);\n r = {\n x: t.x - o.x,\n y: t.y - o.y,\n width: t.width,\n height: t.height\n };\n }\n return Be(r);\n}\nfunction Zt(e, t) {\n const n = G(e);\n return n === t || !$(n) || de(n) ? !1 : V(n).position === \"fixed\" || Zt(n, t);\n}\nfunction dr(e, t) {\n const n = t.get(e);\n if (n)\n return n;\n let r = ye(e, [], !1).filter((c) => $(c) && me(c) !== \"body\"), o = null;\n const i = V(e).position === \"fixed\";\n let s = i ? G(e) : e;\n for (; $(s) && !de(s); ) {\n const c = V(s), a = ct(s);\n !a && c.position === \"fixed\" && (o = null), (i ? !a && !o : !a && c.position === \"static\" && !!o && [\"absolute\", \"fixed\"].includes(o.position) || Ee(s) && !a && Zt(e, s)) ? r = r.filter((f) => f !== s) : o = c, s = G(s);\n }\n return t.set(e, r), r;\n}\nfunction hr(e) {\n let {\n element: t,\n boundary: n,\n rootBoundary: r,\n strategy: o\n } = e;\n const s = [...n === \"clippingAncestors\" ? We(t) ? [] : dr(t, this._c) : [].concat(n), r], c = s[0], a = s.reduce((l, f) => {\n const d = Rt(t, f, o);\n return l.top = te(d.top, l.top), l.right = fe(d.right, l.right), l.bottom = fe(d.bottom, l.bottom), l.left = te(d.left, l.left), l;\n }, Rt(t, c, o));\n return {\n width: a.right - a.left,\n height: a.bottom - a.top,\n x: a.left,\n y: a.top\n };\n}\nfunction mr(e) {\n const {\n width: t,\n height: n\n } = Gt(e);\n return {\n width: t,\n height: n\n };\n}\nfunction pr(e, t, n) {\n const r = j(t), o = Y(t), i = n === \"fixed\", s = ie(e, !0, i, t);\n let c = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const a = X(0);\n if (r || !r && !i)\n if ((me(t) !== \"body\" || Ee(o)) && (c = Ie(t)), r) {\n const p = ie(t, !0, i, t);\n a.x = p.x + t.clientLeft, a.y = p.y + t.clientTop;\n } else o && (a.x = ft(o));\n const l = o && !r && !i ? Qt(o, c) : X(0), f = s.left + c.scrollLeft - a.x - l.x, d = s.top + c.scrollTop - a.y - l.y;\n return {\n x: f,\n y: d,\n width: s.width,\n height: s.height\n };\n}\nfunction qe(e) {\n return V(e).position === \"static\";\n}\nfunction Tt(e, t) {\n if (!j(e) || V(e).position === \"fixed\")\n return null;\n if (t)\n return t(e);\n let n = e.offsetParent;\n return Y(e) === n && (n = n.ownerDocument.body), n;\n}\nfunction en(e, t) {\n const n = I(e);\n if (We(e))\n return n;\n if (!j(e)) {\n let o = G(e);\n for (; o && !de(o); ) {\n if ($(o) && !qe(o))\n return o;\n o = G(o);\n }\n return n;\n }\n let r = Tt(e, t);\n for (; r && rr(r) && qe(r); )\n r = Tt(r, t);\n return r && de(r) && qe(r) && !ct(r) ? n : r || or(e) || n;\n}\nconst vr = async function(e) {\n const t = this.getOffsetParent || en, n = this.getDimensions, r = await n(e.floating);\n return {\n reference: pr(e.reference, await t(e.floating), e.strategy),\n floating: {\n x: 0,\n y: 0,\n width: r.width,\n height: r.height\n }\n };\n};\nfunction gr(e) {\n return V(e).direction === \"rtl\";\n}\nconst tn = {\n convertOffsetParentRelativeRectToViewportRelativeRect: cr,\n getDocumentElement: Y,\n getClippingRect: hr,\n getOffsetParent: en,\n getElementRects: vr,\n getClientRects: ar,\n getDimensions: mr,\n getScale: ae,\n isElement: $,\n isRTL: gr\n};\nfunction nn(e, t) {\n return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;\n}\nfunction br(e, t) {\n let n = null, r;\n const o = Y(e);\n function i() {\n var c;\n clearTimeout(r), (c = n) == null || c.disconnect(), n = null;\n }\n function s(c, a) {\n c === void 0 && (c = !1), a === void 0 && (a = 1), i();\n const l = e.getBoundingClientRect(), {\n left: f,\n top: d,\n width: p,\n height: m\n } = l;\n if (c || t(), !p || !m)\n return;\n const b = Se(d), g = Se(o.clientWidth - (f + p)), v = Se(o.clientHeight - (d + m)), h = Se(f), y = {\n rootMargin: -b + \"px \" + -g + \"px \" + -v + \"px \" + -h + \"px\",\n threshold: te(0, fe(1, a)) || 1\n };\n let O = !0;\n function R(S) {\n const C = S[0].intersectionRatio;\n if (C !== a) {\n if (!O)\n return s();\n C ? s(!1, C) : r = setTimeout(() => {\n s(!1, 1e-7);\n }, 1e3);\n }\n C === 1 && !nn(l, e.getBoundingClientRect()) && s(), O = !1;\n }\n try {\n n = new IntersectionObserver(R, {\n ...y,\n // Handle