var Ke = Object.defineProperty, Ze = Object.defineProperties; var Qe = Object.getOwnPropertyDescriptors; var fe = Object.getOwnPropertySymbols; var Je = Object.prototype.hasOwnProperty, tn = Object.prototype.propertyIsEnumerable; var he = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, z = (e, t) => { for (var n in t || (t = {})) Je.call(t, n) && he(e, n, t[n]); if (fe) for (var n of fe(t)) tn.call(t, n) && he(e, n, t[n]); return e; }, yt = (e, t) => Ze(e, Qe(t)); import { TransitionGroup as en, resolveComponent as nn, defineComponent as on, nextTick as xe, h as pe } from "vue"; /**! * Sortable 1.14.0 * @author RubaXa * @author owenm * @license MIT */ function me(e, t) { var n = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); t && (o = o.filter(function(r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), n.push.apply(n, o); } return n; } function j(e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t] != null ? arguments[t] : {}; t % 2 ? me(Object(n), !0).forEach(function(o) { rn(e, o, n[o]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : me(Object(n)).forEach(function(o) { Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(n, o)); }); } return e; } function Lt(e) { "@babel/helpers - typeof"; return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Lt = function(t) { return typeof t; } : Lt = function(t) { return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; }, Lt(e); } function rn(e, t, n) { return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e; } function q() { return q = Object.assign || function(e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t]; for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]); } return e; }, q.apply(this, arguments); } function an(e, t) { if (e == null) return {}; var n = {}, o = Object.keys(e), r, i; for (i = 0; i < o.length; i++) r = o[i], !(t.indexOf(r) >= 0) && (n[r] = e[r]); return n; } function ln(e, t) { if (e == null) return {}; var n = an(e, t), o, r; if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(e); for (r = 0; r < i.length; r++) o = i[r], !(t.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(e, o) && (n[o] = e[o]); } return n; } var sn = "1.14.0"; function U(e) { if (typeof window != "undefined" && window.navigator) return !!/* @__PURE__ */ navigator.userAgent.match(e); } var K = U(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), It = U(/Edge/i), ge = U(/firefox/i), Dt = U(/safari/i) && !U(/chrome/i) && !U(/android/i), Ie = U(/iP(ad|od|hone)/i), un = U(/chrome/i) && U(/android/i), Oe = { capture: !1, passive: !1 }; function y(e, t, n) { e.addEventListener(t, n, !K && Oe); } function b(e, t, n) { e.removeEventListener(t, n, !K && Oe); } function Bt(e, t) { if (t) { if (t[0] === ">" && (t = t.substring(1)), e) try { if (e.matches) return e.matches(t); if (e.msMatchesSelector) return e.msMatchesSelector(t); if (e.webkitMatchesSelector) return e.webkitMatchesSelector(t); } catch (n) { return !1; } return !1; } } function cn(e) { return e.host && e !== document && e.host.nodeType ? e.host : e.parentNode; } function V(e, t, n, o) { if (e) { n = n || document; do { if (t != null && (t[0] === ">" ? e.parentNode === n && Bt(e, t) : Bt(e, t)) || o && e === n) return e; if (e === n) break; } while (e = cn(e)); } return null; } var ve = /\s+/g; function F(e, t, n) { if (e && t) if (e.classList) e.classList[n ? "add" : "remove"](t); else { var o = (" " + e.className + " ").replace(ve, " ").replace(" " + t + " ", " "); e.className = (o + (n ? " " + t : "")).replace(ve, " "); } } function h(e, t, n) { var o = e && e.style; if (o) { if (n === void 0) return document.defaultView && document.defaultView.getComputedStyle ? n = document.defaultView.getComputedStyle(e, "") : e.currentStyle && (n = e.currentStyle), t === void 0 ? n : n[t]; !(t in o) && t.indexOf("webkit") === -1 && (t = "-webkit-" + t), o[t] = n + (typeof n == "string" ? "" : "px"); } } function ft(e, t) { var n = ""; if (typeof e == "string") n = e; else do { var o = h(e, "transform"); o && o !== "none" && (n = o + " " + n); } while (!t && (e = e.parentNode)); var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; return r && new r(n); } function Ae(e, t, n) { if (e) { var o = e.getElementsByTagName(t), r = 0, i = o.length; if (n) for (; r < i; r++) n(o[r], r); return o; } return []; } function W() { var e = document.scrollingElement; return e || document.documentElement; } function T(e, t, n, o, r) { if (!(!e.getBoundingClientRect && e !== window)) { var i, a, l, s, u, d, f; if (e !== window && e.parentNode && e !== W() ? (i = e.getBoundingClientRect(), a = i.top, l = i.left, s = i.bottom, u = i.right, d = i.height, f = i.width) : (a = 0, l = 0, s = window.innerHeight, u = window.innerWidth, d = window.innerHeight, f = window.innerWidth), (t || n) && e !== window && (r = r || e.parentNode, !K)) do if (r && r.getBoundingClientRect && (h(r, "transform") !== "none" || n && h(r, "position") !== "static")) { var g = r.getBoundingClientRect(); a -= g.top + parseInt(h(r, "border-top-width")), l -= g.left + parseInt(h(r, "border-left-width")), s = a + i.height, u = l + i.width; break; } while (r = r.parentNode); if (o && e !== window) { var w = ft(r || e), v = w && w.a, E = w && w.d; w && (a /= E, l /= v, f /= v, d /= E, s = a + d, u = l + f); } return { top: a, left: l, bottom: s, right: u, width: f, height: d }; } } function be(e, t, n) { for (var o = et(e, !0), r = T(e)[t]; o; ) { var i = T(o)[n], a = void 0; if (a = r >= i, !a) return o; if (o === W()) break; o = et(o, !1); } return !1; } function ht(e, t, n, o) { for (var r = 0, i = 0, a = e.children; i < a.length; ) { if (a[i].style.display !== "none" && a[i] !== p.ghost && (o || a[i] !== p.dragged) && V(a[i], n.draggable, e, !1)) { if (r === t) return a[i]; r++; } i++; } return null; } function se(e, t) { for (var n = e.lastElementChild; n && (n === p.ghost || h(n, "display") === "none" || t && !Bt(n, t)); ) n = n.previousElementSibling; return n || null; } function k(e, t) { var n = 0; if (!e || !e.parentNode) return -1; for (; e = e.previousElementSibling; ) e.nodeName.toUpperCase() !== "TEMPLATE" && e !== p.clone && (!t || Bt(e, t)) && n++; return n; } function ye(e) { var t = 0, n = 0, o = W(); if (e) do { var r = ft(e), i = r.a, a = r.d; t += e.scrollLeft * i, n += e.scrollTop * a; } while (e !== o && (e = e.parentNode)); return [t, n]; } function dn(e, t) { for (var n in e) if (e.hasOwnProperty(n)) { for (var o in t) if (t.hasOwnProperty(o) && t[o] === e[n][o]) return Number(n); } return -1; } function et(e, t) { if (!e || !e.getBoundingClientRect) return W(); var n = e, o = !1; do if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) { var r = h(n); if (n.clientWidth < n.scrollWidth && (r.overflowX == "auto" || r.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (r.overflowY == "auto" || r.overflowY == "scroll")) { if (!n.getBoundingClientRect || n === document.body) return W(); if (o || t) return n; o = !0; } } while (n = n.parentNode); return W(); } function fn(e, t) { if (e && t) for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); return e; } function $t(e, t) { return Math.round(e.top) === Math.round(t.top) && Math.round(e.left) === Math.round(t.left) && Math.round(e.height) === Math.round(t.height) && Math.round(e.width) === Math.round(t.width); } var St; function Pe(e, t) { return function() { if (!St) { var n = arguments, o = this; n.length === 1 ? e.call(o, n[0]) : e.apply(o, n), St = setTimeout(function() { St = void 0; }, t); } }; } function hn() { clearTimeout(St), St = void 0; } function Ne(e, t, n) { e.scrollLeft += t, e.scrollTop += n; } function Fe(e) { var t = window.Polymer, n = window.jQuery || window.Zepto; return t && t.dom ? t.dom(e).cloneNode(!0) : n ? n(e).clone(!0)[0] : e.cloneNode(!0); } var L = "Sortable" + (/* @__PURE__ */ new Date()).getTime(); function pn() { var e = [], t; return { captureAnimationState: function() { if (e = [], !!this.options.animation) { var o = [].slice.call(this.el.children); o.forEach(function(r) { if (!(h(r, "display") === "none" || r === p.ghost)) { e.push({ target: r, rect: T(r) }); var i = j({}, e[e.length - 1].rect); if (r.thisAnimationDuration) { var a = ft(r, !0); a && (i.top -= a.f, i.left -= a.e); } r.fromRect = i; } }); } }, addAnimationState: function(o) { e.push(o); }, removeAnimationState: function(o) { e.splice(dn(e, { target: o }), 1); }, animateAll: function(o) { var r = this; if (!this.options.animation) { clearTimeout(t), typeof o == "function" && o(); return; } var i = !1, a = 0; e.forEach(function(l) { var s = 0, u = l.target, d = u.fromRect, f = T(u), g = u.prevFromRect, w = u.prevToRect, v = l.rect, E = ft(u, !0); E && (f.top -= E.f, f.left -= E.e), u.toRect = f, u.thisAnimationDuration && $t(g, f) && !$t(d, f) && // Make sure animatingRect is on line between toRect & fromRect (v.top - f.top) / (v.left - f.left) === (d.top - f.top) / (d.left - f.left) && (s = gn(v, g, w, r.options)), $t(f, d) || (u.prevFromRect = d, u.prevToRect = f, s || (s = r.options.animation), r.animate(u, v, f, s)), s && (i = !0, a = Math.max(a, s), clearTimeout(u.animationResetTimer), u.animationResetTimer = setTimeout(function() { u.animationTime = 0, u.prevFromRect = null, u.fromRect = null, u.prevToRect = null, u.thisAnimationDuration = null; }, s), u.thisAnimationDuration = s); }), clearTimeout(t), i ? t = setTimeout(function() { typeof o == "function" && o(); }, a) : typeof o == "function" && o(), e = []; }, animate: function(o, r, i, a) { if (a) { h(o, "transition", ""), h(o, "transform", ""); var l = ft(this.el), s = l && l.a, u = l && l.d, d = (r.left - i.left) / (s || 1), f = (r.top - i.top) / (u || 1); o.animatingX = !!d, o.animatingY = !!f, h(o, "transform", "translate3d(" + d + "px," + f + "px,0)"), this.forRepaintDummy = mn(o), h(o, "transition", "transform " + a + "ms" + (this.options.easing ? " " + this.options.easing : "")), h(o, "transform", "translate3d(0,0,0)"), typeof o.animated == "number" && clearTimeout(o.animated), o.animated = setTimeout(function() { h(o, "transition", ""), h(o, "transform", ""), o.animated = !1, o.animatingX = !1, o.animatingY = !1; }, a); } } }; } function mn(e) { return e.offsetWidth; } function gn(e, t, n, o) { return Math.sqrt(Math.pow(t.top - e.top, 2) + Math.pow(t.left - e.left, 2)) / Math.sqrt(Math.pow(t.top - n.top, 2) + Math.pow(t.left - n.left, 2)) * o.animation; } var st = [], zt = { initializeByDefault: !0 }, Ot = { mount: function(t) { for (var n in zt) zt.hasOwnProperty(n) && !(n in t) && (t[n] = zt[n]); st.forEach(function(o) { if (o.pluginName === t.pluginName) throw "Sortable: Cannot mount plugin ".concat(t.pluginName, " more than once"); }), st.push(t); }, pluginEvent: function(t, n, o) { var r = this; this.eventCanceled = !1, o.cancel = function() { r.eventCanceled = !0; }; var i = t + "Global"; st.forEach(function(a) { n[a.pluginName] && (n[a.pluginName][i] && n[a.pluginName][i](j({ sortable: n }, o)), n.options[a.pluginName] && n[a.pluginName][t] && n[a.pluginName][t](j({ sortable: n }, o))); }); }, initializePlugins: function(t, n, o, r) { st.forEach(function(l) { var s = l.pluginName; if (!(!t.options[s] && !l.initializeByDefault)) { var u = new l(t, n, t.options); u.sortable = t, u.options = t.options, t[s] = u, q(o, u.defaults); } }); for (var i in t.options) if (t.options.hasOwnProperty(i)) { var a = this.modifyOption(t, i, t.options[i]); typeof a != "undefined" && (t.options[i] = a); } }, getEventProperties: function(t, n) { var o = {}; return st.forEach(function(r) { typeof r.eventProperties == "function" && q(o, r.eventProperties.call(n[r.pluginName], t)); }), o; }, modifyOption: function(t, n, o) { var r; return st.forEach(function(i) { t[i.pluginName] && i.optionListeners && typeof i.optionListeners[n] == "function" && (r = i.optionListeners[n].call(t[i.pluginName], o)); }), r; } }; function vn(e) { var t = e.sortable, n = e.rootEl, o = e.name, r = e.targetEl, i = e.cloneEl, a = e.toEl, l = e.fromEl, s = e.oldIndex, u = e.newIndex, d = e.oldDraggableIndex, f = e.newDraggableIndex, g = e.originalEvent, w = e.putSortable, v = e.extraEventProperties; if (t = t || n && n[L], !!t) { var E, R = t.options, G = "on" + o.charAt(0).toUpperCase() + o.substr(1); window.CustomEvent && !K && !It ? E = new CustomEvent(o, { bubbles: !0, cancelable: !0 }) : (E = document.createEvent("Event"), E.initEvent(o, !0, !0)), E.to = a || n, E.from = l || n, E.item = r || n, E.clone = i, E.oldIndex = s, E.newIndex = u, E.oldDraggableIndex = d, E.newDraggableIndex = f, E.originalEvent = g, E.pullMode = w ? w.lastPutMode : void 0; var O = j(j({}, v), Ot.getEventProperties(o, t)); for (var X in O) E[X] = O[X]; n && n.dispatchEvent(E), R[G] && R[G].call(t, E); } } var bn = ["evt"], P = function(t, n) { var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = o.evt, i = ln(o, bn); Ot.pluginEvent.bind(p)(t, n, j({ dragEl: c, parentEl: D, ghostEl: m, rootEl: _, nextEl: lt, lastDownEl: kt, cloneEl: S, cloneHidden: tt, dragStarted: Et, putSortable: x, activeSortable: p.active, originalEvent: r, oldIndex: dt, oldDraggableIndex: Ct, newIndex: M, newDraggableIndex: J, hideGhostForTarget: Re, unhideGhostForTarget: Xe, cloneNowHidden: function() { tt = !0; }, cloneNowShown: function() { tt = !1; }, dispatchSortableEvent: function(l) { A({ sortable: n, name: l, originalEvent: r }); } }, i)); }; function A(e) { vn(j({ putSortable: x, cloneEl: S, targetEl: c, rootEl: _, oldIndex: dt, oldDraggableIndex: Ct, newIndex: M, newDraggableIndex: J }, e)); } var c, D, m, _, lt, kt, S, tt, dt, M, Ct, J, Pt, x, ct = !1, Ht = !1, Vt = [], it, Y, Ut, qt, Ee, we, Et, ut, Tt, xt = !1, Nt = !1, Rt, I, Kt = [], oe = !1, Wt = [], Gt = typeof document != "undefined", Ft = Ie, _e = It || K ? "cssFloat" : "float", yn = Gt && !un && !Ie && "draggable" in document.createElement("div"), Me = function() { if (Gt) { if (K) return !1; var e = document.createElement("x"); return e.style.cssText = "pointer-events:auto", e.style.pointerEvents === "auto"; } }(), Le = function(t, n) { var o = h(t), r = parseInt(o.width) - parseInt(o.paddingLeft) - parseInt(o.paddingRight) - parseInt(o.borderLeftWidth) - parseInt(o.borderRightWidth), i = ht(t, 0, n), a = ht(t, 1, n), l = i && h(i), s = a && h(a), u = l && parseInt(l.marginLeft) + parseInt(l.marginRight) + T(i).width, d = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + T(a).width; if (o.display === "flex") return o.flexDirection === "column" || o.flexDirection === "column-reverse" ? "vertical" : "horizontal"; if (o.display === "grid") return o.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal"; if (i && l.float && l.float !== "none") { var f = l.float === "left" ? "left" : "right"; return a && (s.clear === "both" || s.clear === f) ? "vertical" : "horizontal"; } return i && (l.display === "block" || l.display === "flex" || l.display === "table" || l.display === "grid" || u >= r && o[_e] === "none" || a && o[_e] === "none" && u + d > r) ? "vertical" : "horizontal"; }, En = function(t, n, o) { var r = o ? t.left : t.top, i = o ? t.right : t.bottom, a = o ? t.width : t.height, l = o ? n.left : n.top, s = o ? n.right : n.bottom, u = o ? n.width : n.height; return r === l || i === s || r + a / 2 === l + u / 2; }, wn = function(t, n) { var o; return Vt.some(function(r) { var i = r[L].options.emptyInsertThreshold; if (!(!i || se(r))) { var a = T(r), l = t >= a.left - i && t <= a.right + i, s = n >= a.top - i && n <= a.bottom + i; if (l && s) return o = r; } }), o; }, ke = function(t) { function n(i, a) { return function(l, s, u, d) { var f = l.options.group.name && s.options.group.name && l.options.group.name === s.options.group.name; if (i == null && (a || f)) return !0; if (i == null || i === !1) return !1; if (a && i === "clone") return i; if (typeof i == "function") return n(i(l, s, u, d), a)(l, s, u, d); var g = (a ? l : s).options.group.name; return i === !0 || typeof i == "string" && i === g || i.join && i.indexOf(g) > -1; }; } var o = {}, r = t.group; (!r || Lt(r) != "object") && (r = { name: r }), o.name = r.name, o.checkPull = n(r.pull, !0), o.checkPut = n(r.put), o.revertClone = r.revertClone, t.group = o; }, Re = function() { !Me && m && h(m, "display", "none"); }, Xe = function() { !Me && m && h(m, "display", ""); }; Gt && document.addEventListener("click", function(e) { if (Ht) return e.preventDefault(), e.stopPropagation && e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), Ht = !1, !1; }, !0); var at = function(t) { if (c) { t = t.touches ? t.touches[0] : t; var n = wn(t.clientX, t.clientY); if (n) { var o = {}; for (var r in t) t.hasOwnProperty(r) && (o[r] = t[r]); o.target = o.rootEl = n, o.preventDefault = void 0, o.stopPropagation = void 0, n[L]._onDragOver(o); } } }, _n = function(t) { c && c.parentNode[L]._isOutsideThisEl(t.target); }; function p(e, t) { if (!(e && e.nodeType && e.nodeType === 1)) throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e)); this.el = e, this.options = t = q({}, t), e[L] = this; var n = { group: null, sort: !0, disabled: !1, store: null, handle: null, draggable: /^[uo]l$/i.test(e.nodeName) ? ">li" : ">*", swapThreshold: 1, // percentage; 0 <= x <= 1 invertSwap: !1, // invert always invertedSwapThreshold: null, // will be set to same as swapThreshold if default removeCloneOnHide: !0, direction: function() { return Le(e, this.options); }, ghostClass: "sortable-ghost", chosenClass: "sortable-chosen", dragClass: "sortable-drag", ignore: "a, img", filter: null, preventOnFilter: !0, animation: 0, easing: null, setData: function(a, l) { a.setData("Text", l.textContent); }, dropBubble: !1, dragoverBubble: !1, dataIdAttr: "data-id", delay: 0, delayOnTouchOnly: !1, touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, forceFallback: !1, fallbackClass: "sortable-fallback", fallbackOnBody: !1, fallbackTolerance: 0, fallbackOffset: { x: 0, y: 0 }, supportPointer: p.supportPointer !== !1 && "PointerEvent" in window && !Dt, emptyInsertThreshold: 5 }; Ot.initializePlugins(this, e, n); for (var o in n) !(o in t) && (t[o] = n[o]); ke(t); for (var r in this) r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this)); this.nativeDraggable = t.forceFallback ? !1 : yn, this.nativeDraggable && (this.options.touchStartThreshold = 1), t.supportPointer ? y(e, "pointerdown", this._onTapStart) : (y(e, "mousedown", this._onTapStart), y(e, "touchstart", this._onTapStart)), this.nativeDraggable && (y(e, "dragover", this), y(e, "dragenter", this)), Vt.push(this.el), t.store && t.store.get && this.sort(t.store.get(this) || []), q(this, pn()); } p.prototype = /** @lends Sortable.prototype */ { constructor: p, _isOutsideThisEl: function(t) { !this.el.contains(t) && t !== this.el && (ut = null); }, _getDirection: function(t, n) { return typeof this.options.direction == "function" ? this.options.direction.call(this, t, n, c) : this.options.direction; }, _onTapStart: function(t) { if (t.cancelable) { var n = this, o = this.el, r = this.options, i = r.preventOnFilter, a = t.type, l = t.touches && t.touches[0] || t.pointerType && t.pointerType === "touch" && t, s = (l || t).target, u = t.target.shadowRoot && (t.path && t.path[0] || t.composedPath && t.composedPath()[0]) || s, d = r.filter; if (An(o), !c && !(/mousedown|pointerdown/.test(a) && t.button !== 0 || r.disabled) && !u.isContentEditable && !(!this.nativeDraggable && Dt && s && s.tagName.toUpperCase() === "SELECT") && (s = V(s, r.draggable, o, !1), !(s && s.animated) && kt !== s)) { if (dt = k(s), Ct = k(s, r.draggable), typeof d == "function") { if (d.call(this, t, s, this)) { A({ sortable: n, rootEl: u, name: "filter", targetEl: s, toEl: o, fromEl: o }), P("filter", n, { evt: t }), i && t.cancelable && t.preventDefault(); return; } } else if (d && (d = d.split(",").some(function(f) { if (f = V(u, f.trim(), o, !1), f) return A({ sortable: n, rootEl: f, name: "filter", targetEl: s, fromEl: o, toEl: o }), P("filter", n, { evt: t }), !0; }), d)) { i && t.cancelable && t.preventDefault(); return; } r.handle && !V(u, r.handle, o, !1) || this._prepareDragStart(t, l, s); } } }, _prepareDragStart: function(t, n, o) { var r = this, i = r.el, a = r.options, l = i.ownerDocument, s; if (o && !c && o.parentNode === i) { var u = T(o); if (_ = i, c = o, D = c.parentNode, lt = c.nextSibling, kt = o, Pt = a.group, p.dragged = c, it = { target: c, clientX: (n || t).clientX, clientY: (n || t).clientY }, Ee = it.clientX - u.left, we = it.clientY - u.top, this._lastX = (n || t).clientX, this._lastY = (n || t).clientY, c.style["will-change"] = "all", s = function() { if (P("delayEnded", r, { evt: t }), p.eventCanceled) { r._onDrop(); return; } r._disableDelayedDragEvents(), !ge && r.nativeDraggable && (c.draggable = !0), r._triggerDragStart(t, n), A({ sortable: r, name: "choose", originalEvent: t }), F(c, a.chosenClass, !0); }, a.ignore.split(",").forEach(function(d) { Ae(c, d.trim(), Zt); }), y(l, "dragover", at), y(l, "mousemove", at), y(l, "touchmove", at), y(l, "mouseup", r._onDrop), y(l, "touchend", r._onDrop), y(l, "touchcancel", r._onDrop), ge && this.nativeDraggable && (this.options.touchStartThreshold = 4, c.draggable = !0), P("delayStart", this, { evt: t }), a.delay && (!a.delayOnTouchOnly || n) && (!this.nativeDraggable || !(It || K))) { if (p.eventCanceled) { this._onDrop(); return; } y(l, "mouseup", r._disableDelayedDrag), y(l, "touchend", r._disableDelayedDrag), y(l, "touchcancel", r._disableDelayedDrag), y(l, "mousemove", r._delayedDragTouchMoveHandler), y(l, "touchmove", r._delayedDragTouchMoveHandler), a.supportPointer && y(l, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(s, a.delay); } else s(); } }, _delayedDragTouchMoveHandler: function(t) { var n = t.touches ? t.touches[0] : t; Math.max(Math.abs(n.clientX - this._lastX), Math.abs(n.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag(); }, _disableDelayedDrag: function() { c && Zt(c), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents(); }, _disableDelayedDragEvents: function() { var t = this.el.ownerDocument; b(t, "mouseup", this._disableDelayedDrag), b(t, "touchend", this._disableDelayedDrag), b(t, "touchcancel", this._disableDelayedDrag), b(t, "mousemove", this._delayedDragTouchMoveHandler), b(t, "touchmove", this._delayedDragTouchMoveHandler), b(t, "pointermove", this._delayedDragTouchMoveHandler); }, _triggerDragStart: function(t, n) { n = n || t.pointerType == "touch" && t, !this.nativeDraggable || n ? this.options.supportPointer ? y(document, "pointermove", this._onTouchMove) : n ? y(document, "touchmove", this._onTouchMove) : y(document, "mousemove", this._onTouchMove) : (y(c, "dragend", this), y(_, "dragstart", this._onDragStart)); try { document.selection ? Xt(function() { document.selection.empty(); }) : window.getSelection().removeAllRanges(); } catch (o) { } }, _dragStarted: function(t, n) { if (ct = !1, _ && c) { P("dragStarted", this, { evt: n }), this.nativeDraggable && y(document, "dragover", _n); var o = this.options; !t && F(c, o.dragClass, !1), F(c, o.ghostClass, !0), p.active = this, t && this._appendGhost(), A({ sortable: this, name: "start", originalEvent: n }); } else this._nulling(); }, _emulateDragOver: function() { if (Y) { this._lastX = Y.clientX, this._lastY = Y.clientY, Re(); for (var t = document.elementFromPoint(Y.clientX, Y.clientY), n = t; t && t.shadowRoot && (t = t.shadowRoot.elementFromPoint(Y.clientX, Y.clientY), t !== n); ) n = t; if (c.parentNode[L]._isOutsideThisEl(t), n) do { if (n[L]) { var o = void 0; if (o = n[L]._onDragOver({ clientX: Y.clientX, clientY: Y.clientY, target: t, rootEl: n }), o && !this.options.dragoverBubble) break; } t = n; } while (n = n.parentNode); Xe(); } }, _onTouchMove: function(t) { if (it) { var n = this.options, o = n.fallbackTolerance, r = n.fallbackOffset, i = t.touches ? t.touches[0] : t, a = m && ft(m, !0), l = m && a && a.a, s = m && a && a.d, u = Ft && I && ye(I), d = (i.clientX - it.clientX + r.x) / (l || 1) + (u ? u[0] - Kt[0] : 0) / (l || 1), f = (i.clientY - it.clientY + r.y) / (s || 1) + (u ? u[1] - Kt[1] : 0) / (s || 1); if (!p.active && !ct) { if (o && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < o) return; this._onDragStart(t, !0); } if (m) { a ? (a.e += d - (Ut || 0), a.f += f - (qt || 0)) : a = { a: 1, b: 0, c: 0, d: 1, e: d, f }; var g = "matrix(".concat(a.a, ",").concat(a.b, ",").concat(a.c, ",").concat(a.d, ",").concat(a.e, ",").concat(a.f, ")"); h(m, "webkitTransform", g), h(m, "mozTransform", g), h(m, "msTransform", g), h(m, "transform", g), Ut = d, qt = f, Y = i; } t.cancelable && t.preventDefault(); } }, _appendGhost: function() { if (!m) { var t = this.options.fallbackOnBody ? document.body : _, n = T(c, !0, Ft, !0, t), o = this.options; if (Ft) { for (I = t; h(I, "position") === "static" && h(I, "transform") === "none" && I !== document; ) I = I.parentNode; I !== document.body && I !== document.documentElement ? (I === document && (I = W()), n.top += I.scrollTop, n.left += I.scrollLeft) : I = W(), Kt = ye(I); } m = c.cloneNode(!0), F(m, o.ghostClass, !1), F(m, o.fallbackClass, !0), F(m, o.dragClass, !0), h(m, "transition", ""), h(m, "transform", ""), h(m, "box-sizing", "border-box"), h(m, "margin", 0), h(m, "top", n.top), h(m, "left", n.left), h(m, "width", n.width), h(m, "height", n.height), h(m, "opacity", "0.8"), h(m, "position", Ft ? "absolute" : "fixed"), h(m, "zIndex", "100000"), h(m, "pointerEvents", "none"), p.ghost = m, t.appendChild(m), h(m, "transform-origin", Ee / parseInt(m.style.width) * 100 + "% " + we / parseInt(m.style.height) * 100 + "%"); } }, _onDragStart: function(t, n) { var o = this, r = t.dataTransfer, i = o.options; if (P("dragStart", this, { evt: t }), p.eventCanceled) { this._onDrop(); return; } P("setupClone", this), p.eventCanceled || (S = Fe(c), S.draggable = !1, S.style["will-change"] = "", this._hideClone(), F(S, this.options.chosenClass, !1), p.clone = S), o.cloneId = Xt(function() { P("clone", o), !p.eventCanceled && (o.options.removeCloneOnHide || _.insertBefore(S, c), o._hideClone(), A({ sortable: o, name: "clone" })); }), !n && F(c, i.dragClass, !0), n ? (Ht = !0, o._loopId = setInterval(o._emulateDragOver, 50)) : (b(document, "mouseup", o._onDrop), b(document, "touchend", o._onDrop), b(document, "touchcancel", o._onDrop), r && (r.effectAllowed = "move", i.setData && i.setData.call(o, r, c)), y(document, "drop", o), h(c, "transform", "translateZ(0)")), ct = !0, o._dragStartId = Xt(o._dragStarted.bind(o, n, t)), y(document, "selectstart", o), Et = !0, Dt && h(document.body, "user-select", "none"); }, // Returns true - if no further action is needed (either inserted or another condition) _onDragOver: function(t) { var n = this.el, o = t.target, r, i, a, l = this.options, s = l.group, u = p.active, d = Pt === s, f = l.sort, g = x || u, w, v = this, E = !1; if (oe) return; function R(bt, Ue) { P(bt, v, j({ evt: t, isOwner: d, axis: w ? "vertical" : "horizontal", revert: a, dragRect: r, targetRect: i, canSort: f, fromSortable: g, target: o, completed: O, onMove: function(de, qe) { return Mt(_, n, c, r, de, T(de), t, qe); }, changed: X }, Ue)); } function G() { R("dragOverAnimationCapture"), v.captureAnimationState(), v !== g && g.captureAnimationState(); } function O(bt) { return R("dragOverCompleted", { insertion: bt }), bt && (d ? u._hideClone() : u._showClone(v), v !== g && (F(c, x ? x.options.ghostClass : u.options.ghostClass, !1), F(c, l.ghostClass, !0)), x !== v && v !== p.active ? x = v : v === p.active && x && (x = null), g === v && (v._ignoreWhileAnimating = o), v.animateAll(function() { R("dragOverAnimationComplete"), v._ignoreWhileAnimating = null; }), v !== g && (g.animateAll(), g._ignoreWhileAnimating = null)), (o === c && !c.animated || o === n && !o.animated) && (ut = null), !l.dragoverBubble && !t.rootEl && o !== document && (c.parentNode[L]._isOutsideThisEl(t.target), !bt && at(t)), !l.dragoverBubble && t.stopPropagation && t.stopPropagation(), E = !0; } function X() { M = k(c), J = k(c, l.draggable), A({ sortable: v, name: "change", toEl: n, newIndex: M, newDraggableIndex: J, originalEvent: t }); } if (t.preventDefault !== void 0 && t.cancelable && t.preventDefault(), o = V(o, l.draggable, n, !0), R("dragOver"), p.eventCanceled) return E; if (c.contains(t.target) || o.animated && o.animatingX && o.animatingY || v._ignoreWhileAnimating === o) return O(!1); if (Ht = !1, u && !l.disabled && (d ? f || (a = D !== _) : x === this || (this.lastPutMode = Pt.checkPull(this, u, c, t)) && s.checkPut(this, u, c, t))) { if (w = this._getDirection(t, o) === "vertical", r = T(c), R("dragOverValid"), p.eventCanceled) return E; if (a) return D = _, G(), this._hideClone(), R("revert"), p.eventCanceled || (lt ? _.insertBefore(c, lt) : _.appendChild(c)), O(!0); var B = se(n, l.draggable); if (!B || Tn(t, w, this) && !B.animated) { if (B === c) return O(!1); if (B && n === t.target && (o = B), o && (i = T(o)), Mt(_, n, c, r, o, i, t, !!o) !== !1) return G(), n.appendChild(c), D = n, X(), O(!0); } else if (B && Cn(t, w, this)) { var nt = ht(n, 0, l, !0); if (nt === c) return O(!1); if (o = nt, i = T(o), Mt(_, n, c, r, o, i, t, !1) !== !1) return G(), n.insertBefore(c, nt), D = n, X(), O(!0); } else if (o.parentNode === n) { i = T(o); var H = 0, ot, pt = c.parentNode !== n, N = !En(c.animated && c.toRect || r, o.animated && o.toRect || i, w), mt = w ? "top" : "left", Z = be(o, "top", "top") || be(c, "top", "top"), gt = Z ? Z.scrollTop : void 0; ut !== o && (ot = i[mt], xt = !1, Nt = !N && l.invertSwap || pt), H = xn(t, o, i, w, N ? 1 : l.swapThreshold, l.invertedSwapThreshold == null ? l.swapThreshold : l.invertedSwapThreshold, Nt, ut === o); var $; if (H !== 0) { var rt = k(c); do rt -= H, $ = D.children[rt]; while ($ && (h($, "display") === "none" || $ === m)); } if (H === 0 || $ === o) return O(!1); ut = o, Tt = H; var vt = o.nextElementSibling, Q = !1; Q = H === 1; var At = Mt(_, n, c, r, o, i, t, Q); if (At !== !1) return (At === 1 || At === -1) && (Q = At === 1), oe = !0, setTimeout(Sn, 30), G(), Q && !vt ? n.appendChild(c) : o.parentNode.insertBefore(c, Q ? vt : o), Z && Ne(Z, 0, gt - Z.scrollTop), D = c.parentNode, ot !== void 0 && !Nt && (Rt = Math.abs(ot - T(o)[mt])), X(), O(!0); } if (n.contains(c)) return O(!1); } return !1; }, _ignoreWhileAnimating: null, _offMoveEvents: function() { b(document, "mousemove", this._onTouchMove), b(document, "touchmove", this._onTouchMove), b(document, "pointermove", this._onTouchMove), b(document, "dragover", at), b(document, "mousemove", at), b(document, "touchmove", at); }, _offUpEvents: function() { var t = this.el.ownerDocument; b(t, "mouseup", this._onDrop), b(t, "touchend", this._onDrop), b(t, "pointerup", this._onDrop), b(t, "touchcancel", this._onDrop), b(document, "selectstart", this); }, _onDrop: function(t) { var n = this.el, o = this.options; if (M = k(c), J = k(c, o.draggable), P("drop", this, { evt: t }), D = c && c.parentNode, M = k(c), J = k(c, o.draggable), p.eventCanceled) { this._nulling(); return; } ct = !1, Nt = !1, xt = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), re(this.cloneId), re(this._dragStartId), this.nativeDraggable && (b(document, "drop", this), b(n, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Dt && h(document.body, "user-select", ""), h(c, "transform", ""), t && (Et && (t.cancelable && t.preventDefault(), !o.dropBubble && t.stopPropagation()), m && m.parentNode && m.parentNode.removeChild(m), (_ === D || x && x.lastPutMode !== "clone") && S && S.parentNode && S.parentNode.removeChild(S), c && (this.nativeDraggable && b(c, "dragend", this), Zt(c), c.style["will-change"] = "", Et && !ct && F(c, x ? x.options.ghostClass : this.options.ghostClass, !1), F(c, this.options.chosenClass, !1), A({ sortable: this, name: "unchoose", toEl: D, newIndex: null, newDraggableIndex: null, originalEvent: t }), _ !== D ? (M >= 0 && (A({ rootEl: D, name: "add", toEl: D, fromEl: _, originalEvent: t }), A({ sortable: this, name: "remove", toEl: D, originalEvent: t }), A({ rootEl: D, name: "sort", toEl: D, fromEl: _, originalEvent: t }), A({ sortable: this, name: "sort", toEl: D, originalEvent: t })), x && x.save()) : M !== dt && M >= 0 && (A({ sortable: this, name: "update", toEl: D, originalEvent: t }), A({ sortable: this, name: "sort", toEl: D, originalEvent: t })), p.active && ((M == null || M === -1) && (M = dt, J = Ct), A({ sortable: this, name: "end", toEl: D, originalEvent: t }), this.save()))), this._nulling(); }, _nulling: function() { P("nulling", this), _ = c = D = m = lt = S = kt = tt = it = Y = Et = M = J = dt = Ct = ut = Tt = x = Pt = p.dragged = p.ghost = p.clone = p.active = null, Wt.forEach(function(t) { t.checked = !0; }), Wt.length = Ut = qt = 0; }, handleEvent: function(t) { switch (t.type) { case "drop": case "dragend": this._onDrop(t); break; case "dragenter": case "dragover": c && (this._onDragOver(t), Dn(t)); break; case "selectstart": t.preventDefault(); break; } }, /** * Serializes the item into an array of string. * @returns {String[]} */ toArray: function() { for (var t = [], n, o = this.el.children, r = 0, i = o.length, a = this.options; r < i; r++) n = o[r], V(n, a.draggable, this.el, !1) && t.push(n.getAttribute(a.dataIdAttr) || On(n)); return t; }, /** * Sorts the elements according to the array. * @param {String[]} order order of the items */ sort: function(t, n) { var o = {}, r = this.el; this.toArray().forEach(function(i, a) { var l = r.children[a]; V(l, this.options.draggable, r, !1) && (o[i] = l); }, this), n && this.captureAnimationState(), t.forEach(function(i) { o[i] && (r.removeChild(o[i]), r.appendChild(o[i])); }), n && this.animateAll(); }, /** * Save the current sorting */ save: function() { var t = this.options.store; t && t.set && t.set(this); }, /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. * @param {HTMLElement} el * @param {String} [selector] default: `options.draggable` * @returns {HTMLElement|null} */ closest: function(t, n) { return V(t, n || this.options.draggable, this.el, !1); }, /** * Set/get option * @param {string} name * @param {*} [value] * @returns {*} */ option: function(t, n) { var o = this.options; if (n === void 0) return o[t]; var r = Ot.modifyOption(this, t, n); typeof r != "undefined" ? o[t] = r : o[t] = n, t === "group" && ke(o); }, /** * Destroy */ destroy: function() { P("destroy", this); var t = this.el; t[L] = null, b(t, "mousedown", this._onTapStart), b(t, "touchstart", this._onTapStart), b(t, "pointerdown", this._onTapStart), this.nativeDraggable && (b(t, "dragover", this), b(t, "dragenter", this)), Array.prototype.forEach.call(t.querySelectorAll("[draggable]"), function(n) { n.removeAttribute("draggable"); }), this._onDrop(), this._disableDelayedDragEvents(), Vt.splice(Vt.indexOf(this.el), 1), this.el = t = null; }, _hideClone: function() { if (!tt) { if (P("hideClone", this), p.eventCanceled) return; h(S, "display", "none"), this.options.removeCloneOnHide && S.parentNode && S.parentNode.removeChild(S), tt = !0; } }, _showClone: function(t) { if (t.lastPutMode !== "clone") { this._hideClone(); return; } if (tt) { if (P("showClone", this), p.eventCanceled) return; c.parentNode == _ && !this.options.group.revertClone ? _.insertBefore(S, c) : lt ? _.insertBefore(S, lt) : _.appendChild(S), this.options.group.revertClone && this.animate(c, S), h(S, "display", ""), tt = !1; } } }; function Dn(e) { e.dataTransfer && (e.dataTransfer.dropEffect = "move"), e.cancelable && e.preventDefault(); } function Mt(e, t, n, o, r, i, a, l) { var s, u = e[L], d = u.options.onMove, f; return window.CustomEvent && !K && !It ? s = new CustomEvent("move", { bubbles: !0, cancelable: !0 }) : (s = document.createEvent("Event"), s.initEvent("move", !0, !0)), s.to = t, s.from = e, s.dragged = n, s.draggedRect = o, s.related = r || t, s.relatedRect = i || T(t), s.willInsertAfter = l, s.originalEvent = a, e.dispatchEvent(s), d && (f = d.call(u, s, a)), f; } function Zt(e) { e.draggable = !1; } function Sn() { oe = !1; } function Cn(e, t, n) { var o = T(ht(n.el, 0, n.options, !0)), r = 10; return t ? e.clientX < o.left - r || e.clientY < o.top && e.clientX < o.right : e.clientY < o.top - r || e.clientY < o.bottom && e.clientX < o.left; } function Tn(e, t, n) { var o = T(se(n.el, n.options.draggable)), r = 10; return t ? e.clientX > o.right + r || e.clientX <= o.right && e.clientY > o.bottom && e.clientX >= o.left : e.clientX > o.right && e.clientY > o.top || e.clientX <= o.right && e.clientY > o.bottom + r; } function xn(e, t, n, o, r, i, a, l) { var s = o ? e.clientY : e.clientX, u = o ? n.height : n.width, d = o ? n.top : n.left, f = o ? n.bottom : n.right, g = !1; if (!a) { if (l && Rt < u * r) { if (!xt && (Tt === 1 ? s > d + u * i / 2 : s < f - u * i / 2) && (xt = !0), xt) g = !0; else if (Tt === 1 ? s < d + Rt : s > f - Rt) return -Tt; } else if (s > d + u * (1 - r) / 2 && s < f - u * (1 - r) / 2) return In(t); } return g = g || a, g && (s < d + u * i / 2 || s > f - u * i / 2) ? s > d + u / 2 ? 1 : -1 : 0; } function In(e) { return k(c) < k(e) ? 1 : -1; } function On(e) { for (var t = e.tagName + e.className + e.src + e.href + e.textContent, n = t.length, o = 0; n--; ) o += t.charCodeAt(n); return o.toString(36); } function An(e) { Wt.length = 0; for (var t = e.getElementsByTagName("input"), n = t.length; n--; ) { var o = t[n]; o.checked && Wt.push(o); } } function Xt(e) { return setTimeout(e, 0); } function re(e) { return clearTimeout(e); } Gt && y(document, "touchmove", function(e) { (p.active || ct) && e.cancelable && e.preventDefault(); }); p.utils = { on: y, off: b, css: h, find: Ae, is: function(t, n) { return !!V(t, n, t, !1); }, extend: fn, throttle: Pe, closest: V, toggleClass: F, clone: Fe, index: k, nextTick: Xt, cancelNextTick: re, detectDirection: Le, getChild: ht }; p.get = function(e) { return e[L]; }; p.mount = function() { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n]; t[0].constructor === Array && (t = t[0]), t.forEach(function(o) { if (!o.prototype || !o.prototype.constructor) throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o)); o.utils && (p.utils = j(j({}, p.utils), o.utils)), Ot.mount(o); }); }; p.create = function(e, t) { return new p(e, t); }; p.version = sn; var C = [], wt, ie, ae = !1, Qt, Jt, jt, _t; function Pn() { function e() { this.defaults = { scroll: !0, forceAutoScrollFallback: !1, scrollSensitivity: 30, scrollSpeed: 10, bubbleScroll: !0 }; for (var t in this) t.charAt(0) === "_" && typeof this[t] == "function" && (this[t] = this[t].bind(this)); } return e.prototype = { dragStarted: function(n) { var o = n.originalEvent; this.sortable.nativeDraggable ? y(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? y(document, "pointermove", this._handleFallbackAutoScroll) : o.touches ? y(document, "touchmove", this._handleFallbackAutoScroll) : y(document, "mousemove", this._handleFallbackAutoScroll); }, dragOverCompleted: function(n) { var o = n.originalEvent; !this.options.dragOverBubble && !o.rootEl && this._handleAutoScroll(o); }, drop: function() { this.sortable.nativeDraggable ? b(document, "dragover", this._handleAutoScroll) : (b(document, "pointermove", this._handleFallbackAutoScroll), b(document, "touchmove", this._handleFallbackAutoScroll), b(document, "mousemove", this._handleFallbackAutoScroll)), De(), Yt(), hn(); }, nulling: function() { jt = ie = wt = ae = _t = Qt = Jt = null, C.length = 0; }, _handleFallbackAutoScroll: function(n) { this._handleAutoScroll(n, !0); }, _handleAutoScroll: function(n, o) { var r = this, i = (n.touches ? n.touches[0] : n).clientX, a = (n.touches ? n.touches[0] : n).clientY, l = document.elementFromPoint(i, a); if (jt = n, o || this.options.forceAutoScrollFallback || It || K || Dt) { te(n, this.options, l, o); var s = et(l, !0); ae && (!_t || i !== Qt || a !== Jt) && (_t && De(), _t = setInterval(function() { var u = et(document.elementFromPoint(i, a), !0); u !== s && (s = u, Yt()), te(n, r.options, u, o); }, 10), Qt = i, Jt = a); } else { if (!this.options.bubbleScroll || et(l, !0) === W()) { Yt(); return; } te(n, this.options, et(l, !1), !1); } } }, q(e, { pluginName: "scroll", initializeByDefault: !0 }); } function Yt() { C.forEach(function(e) { clearInterval(e.pid); }), C = []; } function De() { clearInterval(_t); } var te = Pe(function(e, t, n, o) { if (t.scroll) { var r = (e.touches ? e.touches[0] : e).clientX, i = (e.touches ? e.touches[0] : e).clientY, a = t.scrollSensitivity, l = t.scrollSpeed, s = W(), u = !1, d; ie !== n && (ie = n, Yt(), wt = t.scroll, d = t.scrollFn, wt === !0 && (wt = et(n, !0))); var f = 0, g = wt; do { var w = g, v = T(w), E = v.top, R = v.bottom, G = v.left, O = v.right, X = v.width, B = v.height, nt = void 0, H = void 0, ot = w.scrollWidth, pt = w.scrollHeight, N = h(w), mt = w.scrollLeft, Z = w.scrollTop; w === s ? (nt = X < ot && (N.overflowX === "auto" || N.overflowX === "scroll" || N.overflowX === "visible"), H = B < pt && (N.overflowY === "auto" || N.overflowY === "scroll" || N.overflowY === "visible")) : (nt = X < ot && (N.overflowX === "auto" || N.overflowX === "scroll"), H = B < pt && (N.overflowY === "auto" || N.overflowY === "scroll")); var gt = nt && (Math.abs(O - r) <= a && mt + X < ot) - (Math.abs(G - r) <= a && !!mt), $ = H && (Math.abs(R - i) <= a && Z + B < pt) - (Math.abs(E - i) <= a && !!Z); if (!C[f]) for (var rt = 0; rt <= f; rt++) C[rt] || (C[rt] = {}); (C[f].vx != gt || C[f].vy != $ || C[f].el !== w) && (C[f].el = w, C[f].vx = gt, C[f].vy = $, clearInterval(C[f].pid), (gt != 0 || $ != 0) && (u = !0, C[f].pid = setInterval(function() { o && this.layer === 0 && p.active._onTouchMove(jt); var vt = C[this.layer].vy ? C[this.layer].vy * l : 0, Q = C[this.layer].vx ? C[this.layer].vx * l : 0; typeof d == "function" && d.call(p.dragged.parentNode[L], Q, vt, e, jt, C[this.layer].el) !== "continue" || Ne(C[this.layer].el, Q, vt); }.bind({ layer: f }), 24))), f++; } while (t.bubbleScroll && g !== s && (g = et(g, !1))); ae = u; } }, 30), Ye = function(t) { var n = t.originalEvent, o = t.putSortable, r = t.dragEl, i = t.activeSortable, a = t.dispatchSortableEvent, l = t.hideGhostForTarget, s = t.unhideGhostForTarget; if (n) { var u = o || i; l(); var d = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, f = document.elementFromPoint(d.clientX, d.clientY); s(), u && !u.el.contains(f) && (a("spill"), this.onSpill({ dragEl: r, putSortable: o })); } }; function ue() { } ue.prototype = { startIndex: null, dragStart: function(t) { var n = t.oldDraggableIndex; this.startIndex = n; }, onSpill: function(t) { var n = t.dragEl, o = t.putSortable; this.sortable.captureAnimationState(), o && o.captureAnimationState(); var r = ht(this.sortable.el, this.startIndex, this.options); r ? this.sortable.el.insertBefore(n, r) : this.sortable.el.appendChild(n), this.sortable.animateAll(), o && o.animateAll(); }, drop: Ye }; q(ue, { pluginName: "revertOnSpill" }); function ce() { } ce.prototype = { onSpill: function(t) { var n = t.dragEl, o = t.putSortable, r = o || this.sortable; r.captureAnimationState(), n.parentNode && n.parentNode.removeChild(n), r.animateAll(); }, drop: Ye }; q(ce, { pluginName: "removeOnSpill" }); p.mount(new Pn()); p.mount(ce, ue); function ee(e) { e.parentElement !== null && e.parentElement.removeChild(e); } function Se(e, t, n) { const o = n === 0 ? e.children[0] : e.children[n - 1].nextSibling; e.insertBefore(t, o); } function Nn() { return typeof window != "undefined" ? window.console : global.console; } const Fn = Nn(); function Mn(e) { const t = /* @__PURE__ */ Object.create(null); return function(o) { return t[o] || (t[o] = e(o)); }; } const Ln = /-(\w)/g, kn = Mn((e) => e.replace(Ln, (t, n) => n.toUpperCase())), Be = ["Start", "Add", "Remove", "Update", "End"], He = ["Choose", "Unchoose", "Sort", "Filter", "Clone"], Ve = ["Move"], Rn = [Ve, Be, He].flatMap((e) => e).map((e) => `on${e}`), le = { manage: Ve, manageAndEmit: Be, emit: He }; function Xn(e) { return Rn.indexOf(e) !== -1; } const Yn = [ "a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "math", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr" ]; function Bn(e) { return Yn.includes(e); } function Hn(e) { return ["transition-group", "TransitionGroup"].includes(e); } function We(e) { return ["id", "class", "role", "style"].includes(e) || e.startsWith("data-") || e.startsWith("aria-") || e.startsWith("on"); } function je(e) { return e.reduce((t, [n, o]) => (t[n] = o, t), {}); } function Vn({ $attrs: e, componentData: t = {} }) { const n = je( Object.entries(e).filter(([o, r]) => We(o)) ); return z(z({}, n), t); } function Wn({ $attrs: e, callBackBuilder: t }) { const n = je(Ge(e)); Object.entries(t).forEach(([r, i]) => { le[r].forEach((a) => { n[`on${a}`] = i(a); }); }); const o = `[data-draggable]${n.draggable || ""}`; return yt(z({}, n), { draggable: o }); } function Ge(e) { return Object.entries(e).filter(([t, n]) => !We(t)).map(([t, n]) => [kn(t), n]).filter(([t, n]) => !Xn(t)); } const Ce = ({ el: e }) => e, jn = (e, t) => e.__draggable_context = t, Te = (e) => e.__draggable_context; class Gn { constructor({ nodes: { header: t, default: n, footer: o }, root: r, realList: i }) { this.defaultNodes = n, this.children = [...t, ...n, ...o], this.externalComponent = r.externalComponent, this.rootTransition = r.transition, this.tag = r.tag, this.realList = i; } get _isRootComponent() { return this.externalComponent || this.rootTransition; } render(t, n) { const { tag: o, children: r, _isRootComponent: i } = this; return t(o, n, i ? { default: () => r } : r); } updated() { const { defaultNodes: t, realList: n } = this; t.forEach((o, r) => { jn(Ce(o), { element: n[r], index: r }); }); } getUnderlyingVm(t) { return Te(t); } getVmIndexFromDomIndex(t, n) { const { defaultNodes: o } = this, { length: r } = o, i = n.children, a = i.item(t); if (a === null) return r; const l = Te(a); if (l) return l.index; if (r === 0) return 0; const s = Ce(o[0]), u = [...i].findIndex( (d) => d === s ); return t < u ? 0 : r; } } function $n(e, t) { const n = e[t]; return n ? n() : []; } function zn({ $slots: e, realList: t, getKey: n }) { const o = t || [], [r, i] = ["header", "footer"].map( (s) => $n(e, s) ), { item: a } = e; if (!a) throw new Error("draggable element must have an item slot"); const l = o.flatMap( (s, u) => a({ element: s, index: u }).map((d) => (d.key = n(s), d.props = yt(z({}, d.props || {}), { "data-draggable": !0 }), d)) ); if (l.length !== o.length) throw new Error("Item slot must have only one child"); return { header: r, footer: i, default: l }; } function Un(e) { const t = Hn(e), n = !Bn(e) && !t; return { transition: t, externalComponent: n, tag: n ? nn(e) : t ? en : e }; } function qn({ $slots: e, tag: t, realList: n, getKey: o }) { const r = zn({ $slots: e, realList: n, getKey: o }), i = Un(t); return new Gn({ nodes: r, root: i, realList: n }); } function $e(e, t) { xe(() => this.$emit(e.toLowerCase(), t)); } function ze(e) { return (t, n) => { if (this.realList !== null) return this[`onDrag${e}`](t, n); }; } function Kn(e) { const t = ze.call(this, e); return (n, o) => { t.call(this, n, o), $e.call(this, e, n); }; } let ne = null; const Zn = { list: { type: Array, required: !1, default: null }, modelValue: { type: Array, required: !1, default: null }, itemKey: { type: [String, Function], required: !0 }, clone: { type: Function, default: (e) => e }, tag: { type: String, default: "div" }, move: { type: Function, default: null }, componentData: { type: Object, required: !1, default: null } }, Qn = [ "update:modelValue", "change", ...[...le.manageAndEmit, ...le.emit].map((e) => e.toLowerCase()) ], no = on({ name: "draggable", inheritAttrs: !1, props: Zn, emits: Qn, data() { return { error: !1 }; }, render() { try { this.error = !1; const { $slots: e, $attrs: t, tag: n, componentData: o, realList: r, getKey: i } = this, a = qn({ $slots: e, tag: n, realList: r, getKey: i }); this.componentStructure = a; const l = Vn({ $attrs: t, componentData: o }); return a.render(pe, l); } catch (e) { return this.error = !0, pe("pre", { style: { color: "red" } }, e.stack); } }, created() { this.list !== null && this.modelValue !== null && Fn.error( "modelValue and list props are mutually exclusive! Please set one or another." ); }, mounted() { if (this.error) return; const { $attrs: e, $el: t, componentStructure: n } = this; n.updated(); const o = Wn({ $attrs: e, callBackBuilder: { manageAndEmit: (i) => Kn.call(this, i), emit: (i) => $e.bind(this, i), manage: (i) => ze.call(this, i) } }), r = t.nodeType === 1 ? t : t.parentElement; this._sortable = new p(r, o), this.targetDomElement = r, r.__draggable_component__ = this; }, updated() { this.componentStructure.updated(); }, beforeUnmount() { this._sortable !== void 0 && this._sortable.destroy(); }, computed: { realList() { const { list: e } = this; return e || this.modelValue; }, getKey() { const { itemKey: e } = this; return typeof e == "function" ? e : (t) => t[e]; } }, watch: { $attrs: { handler(e) { const { _sortable: t } = this; t && Ge(e).forEach(([n, o]) => { t.option(n, o); }); }, deep: !0 } }, methods: { getUnderlyingVm(e) { return this.componentStructure.getUnderlyingVm(e) || null; }, getUnderlyingPotencialDraggableComponent(e) { return e.__draggable_component__; }, emitChanges(e) { xe(() => this.$emit("change", e)); }, alterList(e) { if (this.list) { e(this.list); return; } const t = [...this.modelValue]; e(t), this.$emit("update:modelValue", t); }, spliceList() { const e = (t) => t.splice(...arguments); this.alterList(e); }, updatePosition(e, t) { const n = (o) => o.splice(t, 0, o.splice(e, 1)[0]); this.alterList(n); }, getRelatedContextFromMoveEvent({ to: e, related: t }) { const n = this.getUnderlyingPotencialDraggableComponent(e); if (!n) return { component: n }; const o = n.realList, r = { list: o, component: n }; if (e !== t && o) { const i = n.getUnderlyingVm(t) || {}; return z(z({}, i), r); } return r; }, getVmIndexFromDomIndex(e) { return this.componentStructure.getVmIndexFromDomIndex( e, this.targetDomElement ); }, onDragStart(e) { this.context = this.getUnderlyingVm(e.item), e.item._underlying_vm_ = this.clone(this.context.element), ne = e.item; }, onDragAdd(e) { const t = e.item._underlying_vm_; if (t === void 0) return; ee(e.item); const n = this.getVmIndexFromDomIndex(e.newIndex); this.spliceList(n, 0, t); const o = { element: t, newIndex: n }; this.emitChanges({ added: o }); }, onDragRemove(e) { if (Se(this.$el, e.item, e.oldIndex), e.pullMode === "clone") { ee(e.clone); return; } const { index: t, element: n } = this.context; this.spliceList(t, 1); const o = { element: n, oldIndex: t }; this.emitChanges({ removed: o }); }, onDragUpdate(e) { ee(e.item), Se(e.from, e.item, e.oldIndex); const t = this.context.index, n = this.getVmIndexFromDomIndex(e.newIndex); this.updatePosition(t, n); const o = { element: this.context.element, oldIndex: t, newIndex: n }; this.emitChanges({ moved: o }); }, computeFutureIndex(e, t) { if (!e.element) return 0; const n = [...t.to.children].filter( (a) => a.style.display !== "none" ), o = n.indexOf(t.related), r = e.component.getVmIndexFromDomIndex( o ); return n.indexOf(ne) !== -1 || !t.willInsertAfter ? r : r + 1; }, onDragMove(e, t) { const { move: n, realList: o } = this; if (!n || !o) return !0; const r = this.getRelatedContextFromMoveEvent(e), i = this.computeFutureIndex(r, e), a = yt(z({}, this.context), { futureIndex: i }), l = yt(z({}, e), { relatedContext: r, draggedContext: a }); return n(l, t); }, onDragEnd() { ne = null; } } }); export { no as d };