audiobookshelf/client/static/libs/sortable.js

3 lines
30 KiB
JavaScript
Raw Normal View History

/*! Sortable 1.8.4 - MIT | git://github.com/SortableJS/Sortable.git */
!function (t) { "use strict"; "function" == typeof define && define.amd ? define(t) : "undefined" != typeof module && void 0 !== module.exports ? module.exports = t() : window.Sortable = t() }(function () { "use strict"; if ("undefined" == typeof window || !window.document) return function () { throw new Error("Sortable.js requires a window with a document") }; var U, V, f, u, q, G, h, X, Y, A, K, n, Z, Q, l, s, c, p, k, J, $, tt, et, ot, g, nt, I = [], B = !1, v = !1, it = !1, d = [], rt = !1, at = !1, m = [], i = /\s+/g, lt = "Sortable" + (new Date).getTime(), b = window, st = b.document, w = b.parseInt, ct = b.setTimeout, e = b.jQuery || b.Zepto, o = b.Polymer, r = { capture: !1, passive: !1 }, dt = !!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie|iemobile)/i), _ = !!navigator.userAgent.match(/Edge/i), y = !!navigator.userAgent.match(/firefox/i), D = !(!navigator.userAgent.match(/safari/i) || navigator.userAgent.match(/chrome/i) || navigator.userAgent.match(/android/i)), S = !!navigator.userAgent.match(/iP(ad|od|hone)/i), T = _ || dt ? "cssFloat" : "float", a = "draggable" in st.createElement("div"), C = function () { if (dt) return !1; var t = st.createElement("x"); return t.style.cssText = "pointer-events:auto", "auto" === t.style.pointerEvents }(), ht = !1, E = !1, ut = Math.abs, x = Math.min, N = Math.max, M = [], P = function (t, e) { var o = Dt(t), n = w(o.width) - w(o.paddingLeft) - w(o.paddingRight) - w(o.borderLeftWidth) - w(o.borderRightWidth), i = Mt(t, 0, e), r = Mt(t, 1, e), a = i && Dt(i), l = r && Dt(r), s = a && w(a.marginLeft) + w(a.marginRight) + Lt(i).width, c = l && w(l.marginLeft) + w(l.marginRight) + Lt(r).width; if ("flex" === o.display) return "column" === o.flexDirection || "column-reverse" === o.flexDirection ? "vertical" : "horizontal"; if ("grid" === o.display) return o.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal"; if (i && "none" !== a.float) { var d = "left" === a.float ? "left" : "right"; return !r || "both" !== l.clear && l.clear !== d ? "horizontal" : "vertical" } return i && ("block" === a.display || "flex" === a.display || "table" === a.display || "grid" === a.display || n <= s && "none" === o[T] || r && "none" === o[T] && n < s + c) ? "vertical" : "horizontal" }, O = function (t, e) { if (!t || !t.getBoundingClientRect) return H(); var o = t, n = !1; do { if (o.clientWidth < o.scrollWidth || o.clientHeight < o.scrollHeight) { var i = Dt(o); if (o.clientWidth < o.scrollWidth && ("auto" == i.overflowX || "scroll" == i.overflowX) || o.clientHeight < o.scrollHeight && ("auto" == i.overflowY || "scroll" == i.overflowY)) { if (!o || !o.getBoundingClientRect || o === st.body) return H(); if (n || e) return o; n = !0 } } } while (o = o.parentNode); return H() }, H = function () { return dt ? st.documentElement : st.scrollingElement }, ft = function (t, e, o) { t.scrollLeft += e, t.scrollTop += o }, R = It(function (o, t, e, n) { if (t.scroll) { var i = e ? e[lt] : window, r = t.scrollSensitivity, a = t.scrollSpeed, l = o.clientX, s = o.clientY, c = H(), d = !1; Y !== e && (L(), X = t.scroll, A = t.scrollFn, !0 === X && (X = O(e, !0), Y = X)); var h = 0, u = X; do { var f, p, g, v, m, b, w, _, y, D = u, S = Lt(D), T = S.top, C = S.bottom, E = S.left, x = S.right, N = S.width, M = S.height; if (f = D.scrollWidth, p = D.scrollHeight, g = Dt(D), _ = D.scrollLeft, y = D.scrollTop, w = D === c ? (b = N < f && ("auto" === g.overflowX || "scroll" === g.overflowX || "visible" === g.overflowX), M < p && ("auto" === g.overflowY || "scroll" === g.overflowY || "visible" === g.overflowY)) : (b = N < f && ("auto" === g.overflowX || "scroll" === g.overflowX), M < p && ("auto" === g.overflowY || "scroll" === g.overflowY)), v = b && (ut(x - l) <= r && _ + N < f) - (ut(E - l) <= r && !!_), m = w && (ut(C - s) <= r && y + M < p) - (ut(T - s) <= r && !!y), !I[h]) for (var P = 0; P <= h; P++)I[P] || (I[P] = {}); I[h].vx == v && I[h].vy == m && I[h].el === D || (I[h].el = D, I[h].vx = v, I[h].vy = m, clearInterval(I[h].pid), !D || 0 == v && 0 == m || (d = !0, I[h].pid = setInte