vuedraggable.js 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739
  1. var Ke = Object.defineProperty, Ze = Object.defineProperties;
  2. var Qe = Object.getOwnPropertyDescriptors;
  3. var fe = Object.getOwnPropertySymbols;
  4. var Je = Object.prototype.hasOwnProperty, tn = Object.prototype.propertyIsEnumerable;
  5. 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) => {
  6. for (var n in t || (t = {}))
  7. Je.call(t, n) && he(e, n, t[n]);
  8. if (fe)
  9. for (var n of fe(t))
  10. tn.call(t, n) && he(e, n, t[n]);
  11. return e;
  12. }, yt = (e, t) => Ze(e, Qe(t));
  13. import { TransitionGroup as en, resolveComponent as nn, defineComponent as on, nextTick as xe, h as pe } from "vue";
  14. /**!
  15. * Sortable 1.14.0
  16. * @author RubaXa <trash@rubaxa.org>
  17. * @author owenm <owen23355@gmail.com>
  18. * @license MIT
  19. */
  20. function me(e, t) {
  21. var n = Object.keys(e);
  22. if (Object.getOwnPropertySymbols) {
  23. var o = Object.getOwnPropertySymbols(e);
  24. t && (o = o.filter(function(r) {
  25. return Object.getOwnPropertyDescriptor(e, r).enumerable;
  26. })), n.push.apply(n, o);
  27. }
  28. return n;
  29. }
  30. function j(e) {
  31. for (var t = 1; t < arguments.length; t++) {
  32. var n = arguments[t] != null ? arguments[t] : {};
  33. t % 2 ? me(Object(n), !0).forEach(function(o) {
  34. rn(e, o, n[o]);
  35. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : me(Object(n)).forEach(function(o) {
  36. Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(n, o));
  37. });
  38. }
  39. return e;
  40. }
  41. function Lt(e) {
  42. "@babel/helpers - typeof";
  43. return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Lt = function(t) {
  44. return typeof t;
  45. } : Lt = function(t) {
  46. return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  47. }, Lt(e);
  48. }
  49. function rn(e, t, n) {
  50. return t in e ? Object.defineProperty(e, t, {
  51. value: n,
  52. enumerable: !0,
  53. configurable: !0,
  54. writable: !0
  55. }) : e[t] = n, e;
  56. }
  57. function q() {
  58. return q = Object.assign || function(e) {
  59. for (var t = 1; t < arguments.length; t++) {
  60. var n = arguments[t];
  61. for (var o in n)
  62. Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
  63. }
  64. return e;
  65. }, q.apply(this, arguments);
  66. }
  67. function an(e, t) {
  68. if (e == null) return {};
  69. var n = {}, o = Object.keys(e), r, i;
  70. for (i = 0; i < o.length; i++)
  71. r = o[i], !(t.indexOf(r) >= 0) && (n[r] = e[r]);
  72. return n;
  73. }
  74. function ln(e, t) {
  75. if (e == null) return {};
  76. var n = an(e, t), o, r;
  77. if (Object.getOwnPropertySymbols) {
  78. var i = Object.getOwnPropertySymbols(e);
  79. for (r = 0; r < i.length; r++)
  80. o = i[r], !(t.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(e, o) && (n[o] = e[o]);
  81. }
  82. return n;
  83. }
  84. var sn = "1.14.0";
  85. function U(e) {
  86. if (typeof window != "undefined" && window.navigator)
  87. return !!/* @__PURE__ */ navigator.userAgent.match(e);
  88. }
  89. 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 = {
  90. capture: !1,
  91. passive: !1
  92. };
  93. function y(e, t, n) {
  94. e.addEventListener(t, n, !K && Oe);
  95. }
  96. function b(e, t, n) {
  97. e.removeEventListener(t, n, !K && Oe);
  98. }
  99. function Bt(e, t) {
  100. if (t) {
  101. if (t[0] === ">" && (t = t.substring(1)), e)
  102. try {
  103. if (e.matches)
  104. return e.matches(t);
  105. if (e.msMatchesSelector)
  106. return e.msMatchesSelector(t);
  107. if (e.webkitMatchesSelector)
  108. return e.webkitMatchesSelector(t);
  109. } catch (n) {
  110. return !1;
  111. }
  112. return !1;
  113. }
  114. }
  115. function cn(e) {
  116. return e.host && e !== document && e.host.nodeType ? e.host : e.parentNode;
  117. }
  118. function V(e, t, n, o) {
  119. if (e) {
  120. n = n || document;
  121. do {
  122. if (t != null && (t[0] === ">" ? e.parentNode === n && Bt(e, t) : Bt(e, t)) || o && e === n)
  123. return e;
  124. if (e === n) break;
  125. } while (e = cn(e));
  126. }
  127. return null;
  128. }
  129. var ve = /\s+/g;
  130. function F(e, t, n) {
  131. if (e && t)
  132. if (e.classList)
  133. e.classList[n ? "add" : "remove"](t);
  134. else {
  135. var o = (" " + e.className + " ").replace(ve, " ").replace(" " + t + " ", " ");
  136. e.className = (o + (n ? " " + t : "")).replace(ve, " ");
  137. }
  138. }
  139. function h(e, t, n) {
  140. var o = e && e.style;
  141. if (o) {
  142. if (n === void 0)
  143. return document.defaultView && document.defaultView.getComputedStyle ? n = document.defaultView.getComputedStyle(e, "") : e.currentStyle && (n = e.currentStyle), t === void 0 ? n : n[t];
  144. !(t in o) && t.indexOf("webkit") === -1 && (t = "-webkit-" + t), o[t] = n + (typeof n == "string" ? "" : "px");
  145. }
  146. }
  147. function ft(e, t) {
  148. var n = "";
  149. if (typeof e == "string")
  150. n = e;
  151. else
  152. do {
  153. var o = h(e, "transform");
  154. o && o !== "none" && (n = o + " " + n);
  155. } while (!t && (e = e.parentNode));
  156. var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
  157. return r && new r(n);
  158. }
  159. function Ae(e, t, n) {
  160. if (e) {
  161. var o = e.getElementsByTagName(t), r = 0, i = o.length;
  162. if (n)
  163. for (; r < i; r++)
  164. n(o[r], r);
  165. return o;
  166. }
  167. return [];
  168. }
  169. function W() {
  170. var e = document.scrollingElement;
  171. return e || document.documentElement;
  172. }
  173. function T(e, t, n, o, r) {
  174. if (!(!e.getBoundingClientRect && e !== window)) {
  175. var i, a, l, s, u, d, f;
  176. 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))
  177. do
  178. if (r && r.getBoundingClientRect && (h(r, "transform") !== "none" || n && h(r, "position") !== "static")) {
  179. var g = r.getBoundingClientRect();
  180. 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;
  181. break;
  182. }
  183. while (r = r.parentNode);
  184. if (o && e !== window) {
  185. var w = ft(r || e), v = w && w.a, E = w && w.d;
  186. w && (a /= E, l /= v, f /= v, d /= E, s = a + d, u = l + f);
  187. }
  188. return {
  189. top: a,
  190. left: l,
  191. bottom: s,
  192. right: u,
  193. width: f,
  194. height: d
  195. };
  196. }
  197. }
  198. function be(e, t, n) {
  199. for (var o = et(e, !0), r = T(e)[t]; o; ) {
  200. var i = T(o)[n], a = void 0;
  201. if (a = r >= i, !a) return o;
  202. if (o === W()) break;
  203. o = et(o, !1);
  204. }
  205. return !1;
  206. }
  207. function ht(e, t, n, o) {
  208. for (var r = 0, i = 0, a = e.children; i < a.length; ) {
  209. if (a[i].style.display !== "none" && a[i] !== p.ghost && (o || a[i] !== p.dragged) && V(a[i], n.draggable, e, !1)) {
  210. if (r === t)
  211. return a[i];
  212. r++;
  213. }
  214. i++;
  215. }
  216. return null;
  217. }
  218. function se(e, t) {
  219. for (var n = e.lastElementChild; n && (n === p.ghost || h(n, "display") === "none" || t && !Bt(n, t)); )
  220. n = n.previousElementSibling;
  221. return n || null;
  222. }
  223. function k(e, t) {
  224. var n = 0;
  225. if (!e || !e.parentNode)
  226. return -1;
  227. for (; e = e.previousElementSibling; )
  228. e.nodeName.toUpperCase() !== "TEMPLATE" && e !== p.clone && (!t || Bt(e, t)) && n++;
  229. return n;
  230. }
  231. function ye(e) {
  232. var t = 0, n = 0, o = W();
  233. if (e)
  234. do {
  235. var r = ft(e), i = r.a, a = r.d;
  236. t += e.scrollLeft * i, n += e.scrollTop * a;
  237. } while (e !== o && (e = e.parentNode));
  238. return [t, n];
  239. }
  240. function dn(e, t) {
  241. for (var n in e)
  242. if (e.hasOwnProperty(n)) {
  243. for (var o in t)
  244. if (t.hasOwnProperty(o) && t[o] === e[n][o]) return Number(n);
  245. }
  246. return -1;
  247. }
  248. function et(e, t) {
  249. if (!e || !e.getBoundingClientRect) return W();
  250. var n = e, o = !1;
  251. do
  252. if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
  253. var r = h(n);
  254. if (n.clientWidth < n.scrollWidth && (r.overflowX == "auto" || r.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (r.overflowY == "auto" || r.overflowY == "scroll")) {
  255. if (!n.getBoundingClientRect || n === document.body) return W();
  256. if (o || t) return n;
  257. o = !0;
  258. }
  259. }
  260. while (n = n.parentNode);
  261. return W();
  262. }
  263. function fn(e, t) {
  264. if (e && t)
  265. for (var n in t)
  266. t.hasOwnProperty(n) && (e[n] = t[n]);
  267. return e;
  268. }
  269. function $t(e, t) {
  270. 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);
  271. }
  272. var St;
  273. function Pe(e, t) {
  274. return function() {
  275. if (!St) {
  276. var n = arguments, o = this;
  277. n.length === 1 ? e.call(o, n[0]) : e.apply(o, n), St = setTimeout(function() {
  278. St = void 0;
  279. }, t);
  280. }
  281. };
  282. }
  283. function hn() {
  284. clearTimeout(St), St = void 0;
  285. }
  286. function Ne(e, t, n) {
  287. e.scrollLeft += t, e.scrollTop += n;
  288. }
  289. function Fe(e) {
  290. var t = window.Polymer, n = window.jQuery || window.Zepto;
  291. return t && t.dom ? t.dom(e).cloneNode(!0) : n ? n(e).clone(!0)[0] : e.cloneNode(!0);
  292. }
  293. var L = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
  294. function pn() {
  295. var e = [], t;
  296. return {
  297. captureAnimationState: function() {
  298. if (e = [], !!this.options.animation) {
  299. var o = [].slice.call(this.el.children);
  300. o.forEach(function(r) {
  301. if (!(h(r, "display") === "none" || r === p.ghost)) {
  302. e.push({
  303. target: r,
  304. rect: T(r)
  305. });
  306. var i = j({}, e[e.length - 1].rect);
  307. if (r.thisAnimationDuration) {
  308. var a = ft(r, !0);
  309. a && (i.top -= a.f, i.left -= a.e);
  310. }
  311. r.fromRect = i;
  312. }
  313. });
  314. }
  315. },
  316. addAnimationState: function(o) {
  317. e.push(o);
  318. },
  319. removeAnimationState: function(o) {
  320. e.splice(dn(e, {
  321. target: o
  322. }), 1);
  323. },
  324. animateAll: function(o) {
  325. var r = this;
  326. if (!this.options.animation) {
  327. clearTimeout(t), typeof o == "function" && o();
  328. return;
  329. }
  330. var i = !1, a = 0;
  331. e.forEach(function(l) {
  332. 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);
  333. 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
  334. (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() {
  335. u.animationTime = 0, u.prevFromRect = null, u.fromRect = null, u.prevToRect = null, u.thisAnimationDuration = null;
  336. }, s), u.thisAnimationDuration = s);
  337. }), clearTimeout(t), i ? t = setTimeout(function() {
  338. typeof o == "function" && o();
  339. }, a) : typeof o == "function" && o(), e = [];
  340. },
  341. animate: function(o, r, i, a) {
  342. if (a) {
  343. h(o, "transition", ""), h(o, "transform", "");
  344. 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);
  345. 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() {
  346. h(o, "transition", ""), h(o, "transform", ""), o.animated = !1, o.animatingX = !1, o.animatingY = !1;
  347. }, a);
  348. }
  349. }
  350. };
  351. }
  352. function mn(e) {
  353. return e.offsetWidth;
  354. }
  355. function gn(e, t, n, o) {
  356. 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;
  357. }
  358. var st = [], zt = {
  359. initializeByDefault: !0
  360. }, Ot = {
  361. mount: function(t) {
  362. for (var n in zt)
  363. zt.hasOwnProperty(n) && !(n in t) && (t[n] = zt[n]);
  364. st.forEach(function(o) {
  365. if (o.pluginName === t.pluginName)
  366. throw "Sortable: Cannot mount plugin ".concat(t.pluginName, " more than once");
  367. }), st.push(t);
  368. },
  369. pluginEvent: function(t, n, o) {
  370. var r = this;
  371. this.eventCanceled = !1, o.cancel = function() {
  372. r.eventCanceled = !0;
  373. };
  374. var i = t + "Global";
  375. st.forEach(function(a) {
  376. n[a.pluginName] && (n[a.pluginName][i] && n[a.pluginName][i](j({
  377. sortable: n
  378. }, o)), n.options[a.pluginName] && n[a.pluginName][t] && n[a.pluginName][t](j({
  379. sortable: n
  380. }, o)));
  381. });
  382. },
  383. initializePlugins: function(t, n, o, r) {
  384. st.forEach(function(l) {
  385. var s = l.pluginName;
  386. if (!(!t.options[s] && !l.initializeByDefault)) {
  387. var u = new l(t, n, t.options);
  388. u.sortable = t, u.options = t.options, t[s] = u, q(o, u.defaults);
  389. }
  390. });
  391. for (var i in t.options)
  392. if (t.options.hasOwnProperty(i)) {
  393. var a = this.modifyOption(t, i, t.options[i]);
  394. typeof a != "undefined" && (t.options[i] = a);
  395. }
  396. },
  397. getEventProperties: function(t, n) {
  398. var o = {};
  399. return st.forEach(function(r) {
  400. typeof r.eventProperties == "function" && q(o, r.eventProperties.call(n[r.pluginName], t));
  401. }), o;
  402. },
  403. modifyOption: function(t, n, o) {
  404. var r;
  405. return st.forEach(function(i) {
  406. t[i.pluginName] && i.optionListeners && typeof i.optionListeners[n] == "function" && (r = i.optionListeners[n].call(t[i.pluginName], o));
  407. }), r;
  408. }
  409. };
  410. function vn(e) {
  411. 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;
  412. if (t = t || n && n[L], !!t) {
  413. var E, R = t.options, G = "on" + o.charAt(0).toUpperCase() + o.substr(1);
  414. window.CustomEvent && !K && !It ? E = new CustomEvent(o, {
  415. bubbles: !0,
  416. cancelable: !0
  417. }) : (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;
  418. var O = j(j({}, v), Ot.getEventProperties(o, t));
  419. for (var X in O)
  420. E[X] = O[X];
  421. n && n.dispatchEvent(E), R[G] && R[G].call(t, E);
  422. }
  423. }
  424. var bn = ["evt"], P = function(t, n) {
  425. var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = o.evt, i = ln(o, bn);
  426. Ot.pluginEvent.bind(p)(t, n, j({
  427. dragEl: c,
  428. parentEl: D,
  429. ghostEl: m,
  430. rootEl: _,
  431. nextEl: lt,
  432. lastDownEl: kt,
  433. cloneEl: S,
  434. cloneHidden: tt,
  435. dragStarted: Et,
  436. putSortable: x,
  437. activeSortable: p.active,
  438. originalEvent: r,
  439. oldIndex: dt,
  440. oldDraggableIndex: Ct,
  441. newIndex: M,
  442. newDraggableIndex: J,
  443. hideGhostForTarget: Re,
  444. unhideGhostForTarget: Xe,
  445. cloneNowHidden: function() {
  446. tt = !0;
  447. },
  448. cloneNowShown: function() {
  449. tt = !1;
  450. },
  451. dispatchSortableEvent: function(l) {
  452. A({
  453. sortable: n,
  454. name: l,
  455. originalEvent: r
  456. });
  457. }
  458. }, i));
  459. };
  460. function A(e) {
  461. vn(j({
  462. putSortable: x,
  463. cloneEl: S,
  464. targetEl: c,
  465. rootEl: _,
  466. oldIndex: dt,
  467. oldDraggableIndex: Ct,
  468. newIndex: M,
  469. newDraggableIndex: J
  470. }, e));
  471. }
  472. 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() {
  473. if (Gt) {
  474. if (K)
  475. return !1;
  476. var e = document.createElement("x");
  477. return e.style.cssText = "pointer-events:auto", e.style.pointerEvents === "auto";
  478. }
  479. }(), Le = function(t, n) {
  480. 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;
  481. if (o.display === "flex")
  482. return o.flexDirection === "column" || o.flexDirection === "column-reverse" ? "vertical" : "horizontal";
  483. if (o.display === "grid")
  484. return o.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
  485. if (i && l.float && l.float !== "none") {
  486. var f = l.float === "left" ? "left" : "right";
  487. return a && (s.clear === "both" || s.clear === f) ? "vertical" : "horizontal";
  488. }
  489. 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";
  490. }, En = function(t, n, o) {
  491. 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;
  492. return r === l || i === s || r + a / 2 === l + u / 2;
  493. }, wn = function(t, n) {
  494. var o;
  495. return Vt.some(function(r) {
  496. var i = r[L].options.emptyInsertThreshold;
  497. if (!(!i || se(r))) {
  498. var a = T(r), l = t >= a.left - i && t <= a.right + i, s = n >= a.top - i && n <= a.bottom + i;
  499. if (l && s)
  500. return o = r;
  501. }
  502. }), o;
  503. }, ke = function(t) {
  504. function n(i, a) {
  505. return function(l, s, u, d) {
  506. var f = l.options.group.name && s.options.group.name && l.options.group.name === s.options.group.name;
  507. if (i == null && (a || f))
  508. return !0;
  509. if (i == null || i === !1)
  510. return !1;
  511. if (a && i === "clone")
  512. return i;
  513. if (typeof i == "function")
  514. return n(i(l, s, u, d), a)(l, s, u, d);
  515. var g = (a ? l : s).options.group.name;
  516. return i === !0 || typeof i == "string" && i === g || i.join && i.indexOf(g) > -1;
  517. };
  518. }
  519. var o = {}, r = t.group;
  520. (!r || Lt(r) != "object") && (r = {
  521. name: r
  522. }), o.name = r.name, o.checkPull = n(r.pull, !0), o.checkPut = n(r.put), o.revertClone = r.revertClone, t.group = o;
  523. }, Re = function() {
  524. !Me && m && h(m, "display", "none");
  525. }, Xe = function() {
  526. !Me && m && h(m, "display", "");
  527. };
  528. Gt && document.addEventListener("click", function(e) {
  529. if (Ht)
  530. return e.preventDefault(), e.stopPropagation && e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), Ht = !1, !1;
  531. }, !0);
  532. var at = function(t) {
  533. if (c) {
  534. t = t.touches ? t.touches[0] : t;
  535. var n = wn(t.clientX, t.clientY);
  536. if (n) {
  537. var o = {};
  538. for (var r in t)
  539. t.hasOwnProperty(r) && (o[r] = t[r]);
  540. o.target = o.rootEl = n, o.preventDefault = void 0, o.stopPropagation = void 0, n[L]._onDragOver(o);
  541. }
  542. }
  543. }, _n = function(t) {
  544. c && c.parentNode[L]._isOutsideThisEl(t.target);
  545. };
  546. function p(e, t) {
  547. if (!(e && e.nodeType && e.nodeType === 1))
  548. throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));
  549. this.el = e, this.options = t = q({}, t), e[L] = this;
  550. var n = {
  551. group: null,
  552. sort: !0,
  553. disabled: !1,
  554. store: null,
  555. handle: null,
  556. draggable: /^[uo]l$/i.test(e.nodeName) ? ">li" : ">*",
  557. swapThreshold: 1,
  558. // percentage; 0 <= x <= 1
  559. invertSwap: !1,
  560. // invert always
  561. invertedSwapThreshold: null,
  562. // will be set to same as swapThreshold if default
  563. removeCloneOnHide: !0,
  564. direction: function() {
  565. return Le(e, this.options);
  566. },
  567. ghostClass: "sortable-ghost",
  568. chosenClass: "sortable-chosen",
  569. dragClass: "sortable-drag",
  570. ignore: "a, img",
  571. filter: null,
  572. preventOnFilter: !0,
  573. animation: 0,
  574. easing: null,
  575. setData: function(a, l) {
  576. a.setData("Text", l.textContent);
  577. },
  578. dropBubble: !1,
  579. dragoverBubble: !1,
  580. dataIdAttr: "data-id",
  581. delay: 0,
  582. delayOnTouchOnly: !1,
  583. touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
  584. forceFallback: !1,
  585. fallbackClass: "sortable-fallback",
  586. fallbackOnBody: !1,
  587. fallbackTolerance: 0,
  588. fallbackOffset: {
  589. x: 0,
  590. y: 0
  591. },
  592. supportPointer: p.supportPointer !== !1 && "PointerEvent" in window && !Dt,
  593. emptyInsertThreshold: 5
  594. };
  595. Ot.initializePlugins(this, e, n);
  596. for (var o in n)
  597. !(o in t) && (t[o] = n[o]);
  598. ke(t);
  599. for (var r in this)
  600. r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this));
  601. 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());
  602. }
  603. p.prototype = /** @lends Sortable.prototype */
  604. {
  605. constructor: p,
  606. _isOutsideThisEl: function(t) {
  607. !this.el.contains(t) && t !== this.el && (ut = null);
  608. },
  609. _getDirection: function(t, n) {
  610. return typeof this.options.direction == "function" ? this.options.direction.call(this, t, n, c) : this.options.direction;
  611. },
  612. _onTapStart: function(t) {
  613. if (t.cancelable) {
  614. 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;
  615. 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)) {
  616. if (dt = k(s), Ct = k(s, r.draggable), typeof d == "function") {
  617. if (d.call(this, t, s, this)) {
  618. A({
  619. sortable: n,
  620. rootEl: u,
  621. name: "filter",
  622. targetEl: s,
  623. toEl: o,
  624. fromEl: o
  625. }), P("filter", n, {
  626. evt: t
  627. }), i && t.cancelable && t.preventDefault();
  628. return;
  629. }
  630. } else if (d && (d = d.split(",").some(function(f) {
  631. if (f = V(u, f.trim(), o, !1), f)
  632. return A({
  633. sortable: n,
  634. rootEl: f,
  635. name: "filter",
  636. targetEl: s,
  637. fromEl: o,
  638. toEl: o
  639. }), P("filter", n, {
  640. evt: t
  641. }), !0;
  642. }), d)) {
  643. i && t.cancelable && t.preventDefault();
  644. return;
  645. }
  646. r.handle && !V(u, r.handle, o, !1) || this._prepareDragStart(t, l, s);
  647. }
  648. }
  649. },
  650. _prepareDragStart: function(t, n, o) {
  651. var r = this, i = r.el, a = r.options, l = i.ownerDocument, s;
  652. if (o && !c && o.parentNode === i) {
  653. var u = T(o);
  654. if (_ = i, c = o, D = c.parentNode, lt = c.nextSibling, kt = o, Pt = a.group, p.dragged = c, it = {
  655. target: c,
  656. clientX: (n || t).clientX,
  657. clientY: (n || t).clientY
  658. }, 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() {
  659. if (P("delayEnded", r, {
  660. evt: t
  661. }), p.eventCanceled) {
  662. r._onDrop();
  663. return;
  664. }
  665. r._disableDelayedDragEvents(), !ge && r.nativeDraggable && (c.draggable = !0), r._triggerDragStart(t, n), A({
  666. sortable: r,
  667. name: "choose",
  668. originalEvent: t
  669. }), F(c, a.chosenClass, !0);
  670. }, a.ignore.split(",").forEach(function(d) {
  671. Ae(c, d.trim(), Zt);
  672. }), 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, {
  673. evt: t
  674. }), a.delay && (!a.delayOnTouchOnly || n) && (!this.nativeDraggable || !(It || K))) {
  675. if (p.eventCanceled) {
  676. this._onDrop();
  677. return;
  678. }
  679. 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);
  680. } else
  681. s();
  682. }
  683. },
  684. _delayedDragTouchMoveHandler: function(t) {
  685. var n = t.touches ? t.touches[0] : t;
  686. 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();
  687. },
  688. _disableDelayedDrag: function() {
  689. c && Zt(c), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
  690. },
  691. _disableDelayedDragEvents: function() {
  692. var t = this.el.ownerDocument;
  693. 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);
  694. },
  695. _triggerDragStart: function(t, n) {
  696. 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));
  697. try {
  698. document.selection ? Xt(function() {
  699. document.selection.empty();
  700. }) : window.getSelection().removeAllRanges();
  701. } catch (o) {
  702. }
  703. },
  704. _dragStarted: function(t, n) {
  705. if (ct = !1, _ && c) {
  706. P("dragStarted", this, {
  707. evt: n
  708. }), this.nativeDraggable && y(document, "dragover", _n);
  709. var o = this.options;
  710. !t && F(c, o.dragClass, !1), F(c, o.ghostClass, !0), p.active = this, t && this._appendGhost(), A({
  711. sortable: this,
  712. name: "start",
  713. originalEvent: n
  714. });
  715. } else
  716. this._nulling();
  717. },
  718. _emulateDragOver: function() {
  719. if (Y) {
  720. this._lastX = Y.clientX, this._lastY = Y.clientY, Re();
  721. for (var t = document.elementFromPoint(Y.clientX, Y.clientY), n = t; t && t.shadowRoot && (t = t.shadowRoot.elementFromPoint(Y.clientX, Y.clientY), t !== n); )
  722. n = t;
  723. if (c.parentNode[L]._isOutsideThisEl(t), n)
  724. do {
  725. if (n[L]) {
  726. var o = void 0;
  727. if (o = n[L]._onDragOver({
  728. clientX: Y.clientX,
  729. clientY: Y.clientY,
  730. target: t,
  731. rootEl: n
  732. }), o && !this.options.dragoverBubble)
  733. break;
  734. }
  735. t = n;
  736. } while (n = n.parentNode);
  737. Xe();
  738. }
  739. },
  740. _onTouchMove: function(t) {
  741. if (it) {
  742. 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);
  743. if (!p.active && !ct) {
  744. if (o && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < o)
  745. return;
  746. this._onDragStart(t, !0);
  747. }
  748. if (m) {
  749. a ? (a.e += d - (Ut || 0), a.f += f - (qt || 0)) : a = {
  750. a: 1,
  751. b: 0,
  752. c: 0,
  753. d: 1,
  754. e: d,
  755. f
  756. };
  757. var g = "matrix(".concat(a.a, ",").concat(a.b, ",").concat(a.c, ",").concat(a.d, ",").concat(a.e, ",").concat(a.f, ")");
  758. h(m, "webkitTransform", g), h(m, "mozTransform", g), h(m, "msTransform", g), h(m, "transform", g), Ut = d, qt = f, Y = i;
  759. }
  760. t.cancelable && t.preventDefault();
  761. }
  762. },
  763. _appendGhost: function() {
  764. if (!m) {
  765. var t = this.options.fallbackOnBody ? document.body : _, n = T(c, !0, Ft, !0, t), o = this.options;
  766. if (Ft) {
  767. for (I = t; h(I, "position") === "static" && h(I, "transform") === "none" && I !== document; )
  768. I = I.parentNode;
  769. I !== document.body && I !== document.documentElement ? (I === document && (I = W()), n.top += I.scrollTop, n.left += I.scrollLeft) : I = W(), Kt = ye(I);
  770. }
  771. 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 + "%");
  772. }
  773. },
  774. _onDragStart: function(t, n) {
  775. var o = this, r = t.dataTransfer, i = o.options;
  776. if (P("dragStart", this, {
  777. evt: t
  778. }), p.eventCanceled) {
  779. this._onDrop();
  780. return;
  781. }
  782. 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() {
  783. P("clone", o), !p.eventCanceled && (o.options.removeCloneOnHide || _.insertBefore(S, c), o._hideClone(), A({
  784. sortable: o,
  785. name: "clone"
  786. }));
  787. }), !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");
  788. },
  789. // Returns true - if no further action is needed (either inserted or another condition)
  790. _onDragOver: function(t) {
  791. 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;
  792. if (oe) return;
  793. function R(bt, Ue) {
  794. P(bt, v, j({
  795. evt: t,
  796. isOwner: d,
  797. axis: w ? "vertical" : "horizontal",
  798. revert: a,
  799. dragRect: r,
  800. targetRect: i,
  801. canSort: f,
  802. fromSortable: g,
  803. target: o,
  804. completed: O,
  805. onMove: function(de, qe) {
  806. return Mt(_, n, c, r, de, T(de), t, qe);
  807. },
  808. changed: X
  809. }, Ue));
  810. }
  811. function G() {
  812. R("dragOverAnimationCapture"), v.captureAnimationState(), v !== g && g.captureAnimationState();
  813. }
  814. function O(bt) {
  815. return R("dragOverCompleted", {
  816. insertion: bt
  817. }), 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() {
  818. R("dragOverAnimationComplete"), v._ignoreWhileAnimating = null;
  819. }), 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;
  820. }
  821. function X() {
  822. M = k(c), J = k(c, l.draggable), A({
  823. sortable: v,
  824. name: "change",
  825. toEl: n,
  826. newIndex: M,
  827. newDraggableIndex: J,
  828. originalEvent: t
  829. });
  830. }
  831. if (t.preventDefault !== void 0 && t.cancelable && t.preventDefault(), o = V(o, l.draggable, n, !0), R("dragOver"), p.eventCanceled) return E;
  832. if (c.contains(t.target) || o.animated && o.animatingX && o.animatingY || v._ignoreWhileAnimating === o)
  833. return O(!1);
  834. 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))) {
  835. if (w = this._getDirection(t, o) === "vertical", r = T(c), R("dragOverValid"), p.eventCanceled) return E;
  836. if (a)
  837. return D = _, G(), this._hideClone(), R("revert"), p.eventCanceled || (lt ? _.insertBefore(c, lt) : _.appendChild(c)), O(!0);
  838. var B = se(n, l.draggable);
  839. if (!B || Tn(t, w, this) && !B.animated) {
  840. if (B === c)
  841. return O(!1);
  842. if (B && n === t.target && (o = B), o && (i = T(o)), Mt(_, n, c, r, o, i, t, !!o) !== !1)
  843. return G(), n.appendChild(c), D = n, X(), O(!0);
  844. } else if (B && Cn(t, w, this)) {
  845. var nt = ht(n, 0, l, !0);
  846. if (nt === c)
  847. return O(!1);
  848. if (o = nt, i = T(o), Mt(_, n, c, r, o, i, t, !1) !== !1)
  849. return G(), n.insertBefore(c, nt), D = n, X(), O(!0);
  850. } else if (o.parentNode === n) {
  851. i = T(o);
  852. 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;
  853. 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);
  854. var $;
  855. if (H !== 0) {
  856. var rt = k(c);
  857. do
  858. rt -= H, $ = D.children[rt];
  859. while ($ && (h($, "display") === "none" || $ === m));
  860. }
  861. if (H === 0 || $ === o)
  862. return O(!1);
  863. ut = o, Tt = H;
  864. var vt = o.nextElementSibling, Q = !1;
  865. Q = H === 1;
  866. var At = Mt(_, n, c, r, o, i, t, Q);
  867. if (At !== !1)
  868. 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);
  869. }
  870. if (n.contains(c))
  871. return O(!1);
  872. }
  873. return !1;
  874. },
  875. _ignoreWhileAnimating: null,
  876. _offMoveEvents: function() {
  877. 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);
  878. },
  879. _offUpEvents: function() {
  880. var t = this.el.ownerDocument;
  881. b(t, "mouseup", this._onDrop), b(t, "touchend", this._onDrop), b(t, "pointerup", this._onDrop), b(t, "touchcancel", this._onDrop), b(document, "selectstart", this);
  882. },
  883. _onDrop: function(t) {
  884. var n = this.el, o = this.options;
  885. if (M = k(c), J = k(c, o.draggable), P("drop", this, {
  886. evt: t
  887. }), D = c && c.parentNode, M = k(c), J = k(c, o.draggable), p.eventCanceled) {
  888. this._nulling();
  889. return;
  890. }
  891. 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({
  892. sortable: this,
  893. name: "unchoose",
  894. toEl: D,
  895. newIndex: null,
  896. newDraggableIndex: null,
  897. originalEvent: t
  898. }), _ !== D ? (M >= 0 && (A({
  899. rootEl: D,
  900. name: "add",
  901. toEl: D,
  902. fromEl: _,
  903. originalEvent: t
  904. }), A({
  905. sortable: this,
  906. name: "remove",
  907. toEl: D,
  908. originalEvent: t
  909. }), A({
  910. rootEl: D,
  911. name: "sort",
  912. toEl: D,
  913. fromEl: _,
  914. originalEvent: t
  915. }), A({
  916. sortable: this,
  917. name: "sort",
  918. toEl: D,
  919. originalEvent: t
  920. })), x && x.save()) : M !== dt && M >= 0 && (A({
  921. sortable: this,
  922. name: "update",
  923. toEl: D,
  924. originalEvent: t
  925. }), A({
  926. sortable: this,
  927. name: "sort",
  928. toEl: D,
  929. originalEvent: t
  930. })), p.active && ((M == null || M === -1) && (M = dt, J = Ct), A({
  931. sortable: this,
  932. name: "end",
  933. toEl: D,
  934. originalEvent: t
  935. }), this.save()))), this._nulling();
  936. },
  937. _nulling: function() {
  938. 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) {
  939. t.checked = !0;
  940. }), Wt.length = Ut = qt = 0;
  941. },
  942. handleEvent: function(t) {
  943. switch (t.type) {
  944. case "drop":
  945. case "dragend":
  946. this._onDrop(t);
  947. break;
  948. case "dragenter":
  949. case "dragover":
  950. c && (this._onDragOver(t), Dn(t));
  951. break;
  952. case "selectstart":
  953. t.preventDefault();
  954. break;
  955. }
  956. },
  957. /**
  958. * Serializes the item into an array of string.
  959. * @returns {String[]}
  960. */
  961. toArray: function() {
  962. for (var t = [], n, o = this.el.children, r = 0, i = o.length, a = this.options; r < i; r++)
  963. n = o[r], V(n, a.draggable, this.el, !1) && t.push(n.getAttribute(a.dataIdAttr) || On(n));
  964. return t;
  965. },
  966. /**
  967. * Sorts the elements according to the array.
  968. * @param {String[]} order order of the items
  969. */
  970. sort: function(t, n) {
  971. var o = {}, r = this.el;
  972. this.toArray().forEach(function(i, a) {
  973. var l = r.children[a];
  974. V(l, this.options.draggable, r, !1) && (o[i] = l);
  975. }, this), n && this.captureAnimationState(), t.forEach(function(i) {
  976. o[i] && (r.removeChild(o[i]), r.appendChild(o[i]));
  977. }), n && this.animateAll();
  978. },
  979. /**
  980. * Save the current sorting
  981. */
  982. save: function() {
  983. var t = this.options.store;
  984. t && t.set && t.set(this);
  985. },
  986. /**
  987. * 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.
  988. * @param {HTMLElement} el
  989. * @param {String} [selector] default: `options.draggable`
  990. * @returns {HTMLElement|null}
  991. */
  992. closest: function(t, n) {
  993. return V(t, n || this.options.draggable, this.el, !1);
  994. },
  995. /**
  996. * Set/get option
  997. * @param {string} name
  998. * @param {*} [value]
  999. * @returns {*}
  1000. */
  1001. option: function(t, n) {
  1002. var o = this.options;
  1003. if (n === void 0)
  1004. return o[t];
  1005. var r = Ot.modifyOption(this, t, n);
  1006. typeof r != "undefined" ? o[t] = r : o[t] = n, t === "group" && ke(o);
  1007. },
  1008. /**
  1009. * Destroy
  1010. */
  1011. destroy: function() {
  1012. P("destroy", this);
  1013. var t = this.el;
  1014. 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) {
  1015. n.removeAttribute("draggable");
  1016. }), this._onDrop(), this._disableDelayedDragEvents(), Vt.splice(Vt.indexOf(this.el), 1), this.el = t = null;
  1017. },
  1018. _hideClone: function() {
  1019. if (!tt) {
  1020. if (P("hideClone", this), p.eventCanceled) return;
  1021. h(S, "display", "none"), this.options.removeCloneOnHide && S.parentNode && S.parentNode.removeChild(S), tt = !0;
  1022. }
  1023. },
  1024. _showClone: function(t) {
  1025. if (t.lastPutMode !== "clone") {
  1026. this._hideClone();
  1027. return;
  1028. }
  1029. if (tt) {
  1030. if (P("showClone", this), p.eventCanceled) return;
  1031. 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;
  1032. }
  1033. }
  1034. };
  1035. function Dn(e) {
  1036. e.dataTransfer && (e.dataTransfer.dropEffect = "move"), e.cancelable && e.preventDefault();
  1037. }
  1038. function Mt(e, t, n, o, r, i, a, l) {
  1039. var s, u = e[L], d = u.options.onMove, f;
  1040. return window.CustomEvent && !K && !It ? s = new CustomEvent("move", {
  1041. bubbles: !0,
  1042. cancelable: !0
  1043. }) : (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;
  1044. }
  1045. function Zt(e) {
  1046. e.draggable = !1;
  1047. }
  1048. function Sn() {
  1049. oe = !1;
  1050. }
  1051. function Cn(e, t, n) {
  1052. var o = T(ht(n.el, 0, n.options, !0)), r = 10;
  1053. 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;
  1054. }
  1055. function Tn(e, t, n) {
  1056. var o = T(se(n.el, n.options.draggable)), r = 10;
  1057. 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;
  1058. }
  1059. function xn(e, t, n, o, r, i, a, l) {
  1060. 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;
  1061. if (!a) {
  1062. if (l && Rt < u * r) {
  1063. if (!xt && (Tt === 1 ? s > d + u * i / 2 : s < f - u * i / 2) && (xt = !0), xt)
  1064. g = !0;
  1065. else if (Tt === 1 ? s < d + Rt : s > f - Rt)
  1066. return -Tt;
  1067. } else if (s > d + u * (1 - r) / 2 && s < f - u * (1 - r) / 2)
  1068. return In(t);
  1069. }
  1070. return g = g || a, g && (s < d + u * i / 2 || s > f - u * i / 2) ? s > d + u / 2 ? 1 : -1 : 0;
  1071. }
  1072. function In(e) {
  1073. return k(c) < k(e) ? 1 : -1;
  1074. }
  1075. function On(e) {
  1076. for (var t = e.tagName + e.className + e.src + e.href + e.textContent, n = t.length, o = 0; n--; )
  1077. o += t.charCodeAt(n);
  1078. return o.toString(36);
  1079. }
  1080. function An(e) {
  1081. Wt.length = 0;
  1082. for (var t = e.getElementsByTagName("input"), n = t.length; n--; ) {
  1083. var o = t[n];
  1084. o.checked && Wt.push(o);
  1085. }
  1086. }
  1087. function Xt(e) {
  1088. return setTimeout(e, 0);
  1089. }
  1090. function re(e) {
  1091. return clearTimeout(e);
  1092. }
  1093. Gt && y(document, "touchmove", function(e) {
  1094. (p.active || ct) && e.cancelable && e.preventDefault();
  1095. });
  1096. p.utils = {
  1097. on: y,
  1098. off: b,
  1099. css: h,
  1100. find: Ae,
  1101. is: function(t, n) {
  1102. return !!V(t, n, t, !1);
  1103. },
  1104. extend: fn,
  1105. throttle: Pe,
  1106. closest: V,
  1107. toggleClass: F,
  1108. clone: Fe,
  1109. index: k,
  1110. nextTick: Xt,
  1111. cancelNextTick: re,
  1112. detectDirection: Le,
  1113. getChild: ht
  1114. };
  1115. p.get = function(e) {
  1116. return e[L];
  1117. };
  1118. p.mount = function() {
  1119. for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
  1120. t[n] = arguments[n];
  1121. t[0].constructor === Array && (t = t[0]), t.forEach(function(o) {
  1122. if (!o.prototype || !o.prototype.constructor)
  1123. throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));
  1124. o.utils && (p.utils = j(j({}, p.utils), o.utils)), Ot.mount(o);
  1125. });
  1126. };
  1127. p.create = function(e, t) {
  1128. return new p(e, t);
  1129. };
  1130. p.version = sn;
  1131. var C = [], wt, ie, ae = !1, Qt, Jt, jt, _t;
  1132. function Pn() {
  1133. function e() {
  1134. this.defaults = {
  1135. scroll: !0,
  1136. forceAutoScrollFallback: !1,
  1137. scrollSensitivity: 30,
  1138. scrollSpeed: 10,
  1139. bubbleScroll: !0
  1140. };
  1141. for (var t in this)
  1142. t.charAt(0) === "_" && typeof this[t] == "function" && (this[t] = this[t].bind(this));
  1143. }
  1144. return e.prototype = {
  1145. dragStarted: function(n) {
  1146. var o = n.originalEvent;
  1147. 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);
  1148. },
  1149. dragOverCompleted: function(n) {
  1150. var o = n.originalEvent;
  1151. !this.options.dragOverBubble && !o.rootEl && this._handleAutoScroll(o);
  1152. },
  1153. drop: function() {
  1154. 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();
  1155. },
  1156. nulling: function() {
  1157. jt = ie = wt = ae = _t = Qt = Jt = null, C.length = 0;
  1158. },
  1159. _handleFallbackAutoScroll: function(n) {
  1160. this._handleAutoScroll(n, !0);
  1161. },
  1162. _handleAutoScroll: function(n, o) {
  1163. var r = this, i = (n.touches ? n.touches[0] : n).clientX, a = (n.touches ? n.touches[0] : n).clientY, l = document.elementFromPoint(i, a);
  1164. if (jt = n, o || this.options.forceAutoScrollFallback || It || K || Dt) {
  1165. te(n, this.options, l, o);
  1166. var s = et(l, !0);
  1167. ae && (!_t || i !== Qt || a !== Jt) && (_t && De(), _t = setInterval(function() {
  1168. var u = et(document.elementFromPoint(i, a), !0);
  1169. u !== s && (s = u, Yt()), te(n, r.options, u, o);
  1170. }, 10), Qt = i, Jt = a);
  1171. } else {
  1172. if (!this.options.bubbleScroll || et(l, !0) === W()) {
  1173. Yt();
  1174. return;
  1175. }
  1176. te(n, this.options, et(l, !1), !1);
  1177. }
  1178. }
  1179. }, q(e, {
  1180. pluginName: "scroll",
  1181. initializeByDefault: !0
  1182. });
  1183. }
  1184. function Yt() {
  1185. C.forEach(function(e) {
  1186. clearInterval(e.pid);
  1187. }), C = [];
  1188. }
  1189. function De() {
  1190. clearInterval(_t);
  1191. }
  1192. var te = Pe(function(e, t, n, o) {
  1193. if (t.scroll) {
  1194. 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;
  1195. ie !== n && (ie = n, Yt(), wt = t.scroll, d = t.scrollFn, wt === !0 && (wt = et(n, !0)));
  1196. var f = 0, g = wt;
  1197. do {
  1198. 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;
  1199. 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"));
  1200. 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);
  1201. if (!C[f])
  1202. for (var rt = 0; rt <= f; rt++)
  1203. C[rt] || (C[rt] = {});
  1204. (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() {
  1205. o && this.layer === 0 && p.active._onTouchMove(jt);
  1206. var vt = C[this.layer].vy ? C[this.layer].vy * l : 0, Q = C[this.layer].vx ? C[this.layer].vx * l : 0;
  1207. 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);
  1208. }.bind({
  1209. layer: f
  1210. }), 24))), f++;
  1211. } while (t.bubbleScroll && g !== s && (g = et(g, !1)));
  1212. ae = u;
  1213. }
  1214. }, 30), Ye = function(t) {
  1215. var n = t.originalEvent, o = t.putSortable, r = t.dragEl, i = t.activeSortable, a = t.dispatchSortableEvent, l = t.hideGhostForTarget, s = t.unhideGhostForTarget;
  1216. if (n) {
  1217. var u = o || i;
  1218. l();
  1219. var d = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, f = document.elementFromPoint(d.clientX, d.clientY);
  1220. s(), u && !u.el.contains(f) && (a("spill"), this.onSpill({
  1221. dragEl: r,
  1222. putSortable: o
  1223. }));
  1224. }
  1225. };
  1226. function ue() {
  1227. }
  1228. ue.prototype = {
  1229. startIndex: null,
  1230. dragStart: function(t) {
  1231. var n = t.oldDraggableIndex;
  1232. this.startIndex = n;
  1233. },
  1234. onSpill: function(t) {
  1235. var n = t.dragEl, o = t.putSortable;
  1236. this.sortable.captureAnimationState(), o && o.captureAnimationState();
  1237. var r = ht(this.sortable.el, this.startIndex, this.options);
  1238. r ? this.sortable.el.insertBefore(n, r) : this.sortable.el.appendChild(n), this.sortable.animateAll(), o && o.animateAll();
  1239. },
  1240. drop: Ye
  1241. };
  1242. q(ue, {
  1243. pluginName: "revertOnSpill"
  1244. });
  1245. function ce() {
  1246. }
  1247. ce.prototype = {
  1248. onSpill: function(t) {
  1249. var n = t.dragEl, o = t.putSortable, r = o || this.sortable;
  1250. r.captureAnimationState(), n.parentNode && n.parentNode.removeChild(n), r.animateAll();
  1251. },
  1252. drop: Ye
  1253. };
  1254. q(ce, {
  1255. pluginName: "removeOnSpill"
  1256. });
  1257. p.mount(new Pn());
  1258. p.mount(ce, ue);
  1259. function ee(e) {
  1260. e.parentElement !== null && e.parentElement.removeChild(e);
  1261. }
  1262. function Se(e, t, n) {
  1263. const o = n === 0 ? e.children[0] : e.children[n - 1].nextSibling;
  1264. e.insertBefore(t, o);
  1265. }
  1266. function Nn() {
  1267. return typeof window != "undefined" ? window.console : global.console;
  1268. }
  1269. const Fn = Nn();
  1270. function Mn(e) {
  1271. const t = /* @__PURE__ */ Object.create(null);
  1272. return function(o) {
  1273. return t[o] || (t[o] = e(o));
  1274. };
  1275. }
  1276. 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 = {
  1277. manage: Ve,
  1278. manageAndEmit: Be,
  1279. emit: He
  1280. };
  1281. function Xn(e) {
  1282. return Rn.indexOf(e) !== -1;
  1283. }
  1284. const Yn = [
  1285. "a",
  1286. "abbr",
  1287. "address",
  1288. "area",
  1289. "article",
  1290. "aside",
  1291. "audio",
  1292. "b",
  1293. "base",
  1294. "bdi",
  1295. "bdo",
  1296. "blockquote",
  1297. "body",
  1298. "br",
  1299. "button",
  1300. "canvas",
  1301. "caption",
  1302. "cite",
  1303. "code",
  1304. "col",
  1305. "colgroup",
  1306. "data",
  1307. "datalist",
  1308. "dd",
  1309. "del",
  1310. "details",
  1311. "dfn",
  1312. "dialog",
  1313. "div",
  1314. "dl",
  1315. "dt",
  1316. "em",
  1317. "embed",
  1318. "fieldset",
  1319. "figcaption",
  1320. "figure",
  1321. "footer",
  1322. "form",
  1323. "h1",
  1324. "h2",
  1325. "h3",
  1326. "h4",
  1327. "h5",
  1328. "h6",
  1329. "head",
  1330. "header",
  1331. "hgroup",
  1332. "hr",
  1333. "html",
  1334. "i",
  1335. "iframe",
  1336. "img",
  1337. "input",
  1338. "ins",
  1339. "kbd",
  1340. "label",
  1341. "legend",
  1342. "li",
  1343. "link",
  1344. "main",
  1345. "map",
  1346. "mark",
  1347. "math",
  1348. "menu",
  1349. "menuitem",
  1350. "meta",
  1351. "meter",
  1352. "nav",
  1353. "noscript",
  1354. "object",
  1355. "ol",
  1356. "optgroup",
  1357. "option",
  1358. "output",
  1359. "p",
  1360. "param",
  1361. "picture",
  1362. "pre",
  1363. "progress",
  1364. "q",
  1365. "rb",
  1366. "rp",
  1367. "rt",
  1368. "rtc",
  1369. "ruby",
  1370. "s",
  1371. "samp",
  1372. "script",
  1373. "section",
  1374. "select",
  1375. "slot",
  1376. "small",
  1377. "source",
  1378. "span",
  1379. "strong",
  1380. "style",
  1381. "sub",
  1382. "summary",
  1383. "sup",
  1384. "svg",
  1385. "table",
  1386. "tbody",
  1387. "td",
  1388. "template",
  1389. "textarea",
  1390. "tfoot",
  1391. "th",
  1392. "thead",
  1393. "time",
  1394. "title",
  1395. "tr",
  1396. "track",
  1397. "u",
  1398. "ul",
  1399. "var",
  1400. "video",
  1401. "wbr"
  1402. ];
  1403. function Bn(e) {
  1404. return Yn.includes(e);
  1405. }
  1406. function Hn(e) {
  1407. return ["transition-group", "TransitionGroup"].includes(e);
  1408. }
  1409. function We(e) {
  1410. return ["id", "class", "role", "style"].includes(e) || e.startsWith("data-") || e.startsWith("aria-") || e.startsWith("on");
  1411. }
  1412. function je(e) {
  1413. return e.reduce((t, [n, o]) => (t[n] = o, t), {});
  1414. }
  1415. function Vn({ $attrs: e, componentData: t = {} }) {
  1416. const n = je(
  1417. Object.entries(e).filter(([o, r]) => We(o))
  1418. );
  1419. return z(z({}, n), t);
  1420. }
  1421. function Wn({ $attrs: e, callBackBuilder: t }) {
  1422. const n = je(Ge(e));
  1423. Object.entries(t).forEach(([r, i]) => {
  1424. le[r].forEach((a) => {
  1425. n[`on${a}`] = i(a);
  1426. });
  1427. });
  1428. const o = `[data-draggable]${n.draggable || ""}`;
  1429. return yt(z({}, n), {
  1430. draggable: o
  1431. });
  1432. }
  1433. function Ge(e) {
  1434. return Object.entries(e).filter(([t, n]) => !We(t)).map(([t, n]) => [kn(t), n]).filter(([t, n]) => !Xn(t));
  1435. }
  1436. const Ce = ({ el: e }) => e, jn = (e, t) => e.__draggable_context = t, Te = (e) => e.__draggable_context;
  1437. class Gn {
  1438. constructor({
  1439. nodes: { header: t, default: n, footer: o },
  1440. root: r,
  1441. realList: i
  1442. }) {
  1443. this.defaultNodes = n, this.children = [...t, ...n, ...o], this.externalComponent = r.externalComponent, this.rootTransition = r.transition, this.tag = r.tag, this.realList = i;
  1444. }
  1445. get _isRootComponent() {
  1446. return this.externalComponent || this.rootTransition;
  1447. }
  1448. render(t, n) {
  1449. const { tag: o, children: r, _isRootComponent: i } = this;
  1450. return t(o, n, i ? { default: () => r } : r);
  1451. }
  1452. updated() {
  1453. const { defaultNodes: t, realList: n } = this;
  1454. t.forEach((o, r) => {
  1455. jn(Ce(o), {
  1456. element: n[r],
  1457. index: r
  1458. });
  1459. });
  1460. }
  1461. getUnderlyingVm(t) {
  1462. return Te(t);
  1463. }
  1464. getVmIndexFromDomIndex(t, n) {
  1465. const { defaultNodes: o } = this, { length: r } = o, i = n.children, a = i.item(t);
  1466. if (a === null)
  1467. return r;
  1468. const l = Te(a);
  1469. if (l)
  1470. return l.index;
  1471. if (r === 0)
  1472. return 0;
  1473. const s = Ce(o[0]), u = [...i].findIndex(
  1474. (d) => d === s
  1475. );
  1476. return t < u ? 0 : r;
  1477. }
  1478. }
  1479. function $n(e, t) {
  1480. const n = e[t];
  1481. return n ? n() : [];
  1482. }
  1483. function zn({ $slots: e, realList: t, getKey: n }) {
  1484. const o = t || [], [r, i] = ["header", "footer"].map(
  1485. (s) => $n(e, s)
  1486. ), { item: a } = e;
  1487. if (!a)
  1488. throw new Error("draggable element must have an item slot");
  1489. const l = o.flatMap(
  1490. (s, u) => a({ element: s, index: u }).map((d) => (d.key = n(s), d.props = yt(z({}, d.props || {}), { "data-draggable": !0 }), d))
  1491. );
  1492. if (l.length !== o.length)
  1493. throw new Error("Item slot must have only one child");
  1494. return {
  1495. header: r,
  1496. footer: i,
  1497. default: l
  1498. };
  1499. }
  1500. function Un(e) {
  1501. const t = Hn(e), n = !Bn(e) && !t;
  1502. return {
  1503. transition: t,
  1504. externalComponent: n,
  1505. tag: n ? nn(e) : t ? en : e
  1506. };
  1507. }
  1508. function qn({ $slots: e, tag: t, realList: n, getKey: o }) {
  1509. const r = zn({ $slots: e, realList: n, getKey: o }), i = Un(t);
  1510. return new Gn({ nodes: r, root: i, realList: n });
  1511. }
  1512. function $e(e, t) {
  1513. xe(() => this.$emit(e.toLowerCase(), t));
  1514. }
  1515. function ze(e) {
  1516. return (t, n) => {
  1517. if (this.realList !== null)
  1518. return this[`onDrag${e}`](t, n);
  1519. };
  1520. }
  1521. function Kn(e) {
  1522. const t = ze.call(this, e);
  1523. return (n, o) => {
  1524. t.call(this, n, o), $e.call(this, e, n);
  1525. };
  1526. }
  1527. let ne = null;
  1528. const Zn = {
  1529. list: {
  1530. type: Array,
  1531. required: !1,
  1532. default: null
  1533. },
  1534. modelValue: {
  1535. type: Array,
  1536. required: !1,
  1537. default: null
  1538. },
  1539. itemKey: {
  1540. type: [String, Function],
  1541. required: !0
  1542. },
  1543. clone: {
  1544. type: Function,
  1545. default: (e) => e
  1546. },
  1547. tag: {
  1548. type: String,
  1549. default: "div"
  1550. },
  1551. move: {
  1552. type: Function,
  1553. default: null
  1554. },
  1555. componentData: {
  1556. type: Object,
  1557. required: !1,
  1558. default: null
  1559. }
  1560. }, Qn = [
  1561. "update:modelValue",
  1562. "change",
  1563. ...[...le.manageAndEmit, ...le.emit].map((e) => e.toLowerCase())
  1564. ], no = on({
  1565. name: "draggable",
  1566. inheritAttrs: !1,
  1567. props: Zn,
  1568. emits: Qn,
  1569. data() {
  1570. return {
  1571. error: !1
  1572. };
  1573. },
  1574. render() {
  1575. try {
  1576. this.error = !1;
  1577. const { $slots: e, $attrs: t, tag: n, componentData: o, realList: r, getKey: i } = this, a = qn({
  1578. $slots: e,
  1579. tag: n,
  1580. realList: r,
  1581. getKey: i
  1582. });
  1583. this.componentStructure = a;
  1584. const l = Vn({ $attrs: t, componentData: o });
  1585. return a.render(pe, l);
  1586. } catch (e) {
  1587. return this.error = !0, pe("pre", { style: { color: "red" } }, e.stack);
  1588. }
  1589. },
  1590. created() {
  1591. this.list !== null && this.modelValue !== null && Fn.error(
  1592. "modelValue and list props are mutually exclusive! Please set one or another."
  1593. );
  1594. },
  1595. mounted() {
  1596. if (this.error)
  1597. return;
  1598. const { $attrs: e, $el: t, componentStructure: n } = this;
  1599. n.updated();
  1600. const o = Wn({
  1601. $attrs: e,
  1602. callBackBuilder: {
  1603. manageAndEmit: (i) => Kn.call(this, i),
  1604. emit: (i) => $e.bind(this, i),
  1605. manage: (i) => ze.call(this, i)
  1606. }
  1607. }), r = t.nodeType === 1 ? t : t.parentElement;
  1608. this._sortable = new p(r, o), this.targetDomElement = r, r.__draggable_component__ = this;
  1609. },
  1610. updated() {
  1611. this.componentStructure.updated();
  1612. },
  1613. beforeUnmount() {
  1614. this._sortable !== void 0 && this._sortable.destroy();
  1615. },
  1616. computed: {
  1617. realList() {
  1618. const { list: e } = this;
  1619. return e || this.modelValue;
  1620. },
  1621. getKey() {
  1622. const { itemKey: e } = this;
  1623. return typeof e == "function" ? e : (t) => t[e];
  1624. }
  1625. },
  1626. watch: {
  1627. $attrs: {
  1628. handler(e) {
  1629. const { _sortable: t } = this;
  1630. t && Ge(e).forEach(([n, o]) => {
  1631. t.option(n, o);
  1632. });
  1633. },
  1634. deep: !0
  1635. }
  1636. },
  1637. methods: {
  1638. getUnderlyingVm(e) {
  1639. return this.componentStructure.getUnderlyingVm(e) || null;
  1640. },
  1641. getUnderlyingPotencialDraggableComponent(e) {
  1642. return e.__draggable_component__;
  1643. },
  1644. emitChanges(e) {
  1645. xe(() => this.$emit("change", e));
  1646. },
  1647. alterList(e) {
  1648. if (this.list) {
  1649. e(this.list);
  1650. return;
  1651. }
  1652. const t = [...this.modelValue];
  1653. e(t), this.$emit("update:modelValue", t);
  1654. },
  1655. spliceList() {
  1656. const e = (t) => t.splice(...arguments);
  1657. this.alterList(e);
  1658. },
  1659. updatePosition(e, t) {
  1660. const n = (o) => o.splice(t, 0, o.splice(e, 1)[0]);
  1661. this.alterList(n);
  1662. },
  1663. getRelatedContextFromMoveEvent({ to: e, related: t }) {
  1664. const n = this.getUnderlyingPotencialDraggableComponent(e);
  1665. if (!n)
  1666. return { component: n };
  1667. const o = n.realList, r = { list: o, component: n };
  1668. if (e !== t && o) {
  1669. const i = n.getUnderlyingVm(t) || {};
  1670. return z(z({}, i), r);
  1671. }
  1672. return r;
  1673. },
  1674. getVmIndexFromDomIndex(e) {
  1675. return this.componentStructure.getVmIndexFromDomIndex(
  1676. e,
  1677. this.targetDomElement
  1678. );
  1679. },
  1680. onDragStart(e) {
  1681. this.context = this.getUnderlyingVm(e.item), e.item._underlying_vm_ = this.clone(this.context.element), ne = e.item;
  1682. },
  1683. onDragAdd(e) {
  1684. const t = e.item._underlying_vm_;
  1685. if (t === void 0)
  1686. return;
  1687. ee(e.item);
  1688. const n = this.getVmIndexFromDomIndex(e.newIndex);
  1689. this.spliceList(n, 0, t);
  1690. const o = { element: t, newIndex: n };
  1691. this.emitChanges({ added: o });
  1692. },
  1693. onDragRemove(e) {
  1694. if (Se(this.$el, e.item, e.oldIndex), e.pullMode === "clone") {
  1695. ee(e.clone);
  1696. return;
  1697. }
  1698. const { index: t, element: n } = this.context;
  1699. this.spliceList(t, 1);
  1700. const o = { element: n, oldIndex: t };
  1701. this.emitChanges({ removed: o });
  1702. },
  1703. onDragUpdate(e) {
  1704. ee(e.item), Se(e.from, e.item, e.oldIndex);
  1705. const t = this.context.index, n = this.getVmIndexFromDomIndex(e.newIndex);
  1706. this.updatePosition(t, n);
  1707. const o = { element: this.context.element, oldIndex: t, newIndex: n };
  1708. this.emitChanges({ moved: o });
  1709. },
  1710. computeFutureIndex(e, t) {
  1711. if (!e.element)
  1712. return 0;
  1713. const n = [...t.to.children].filter(
  1714. (a) => a.style.display !== "none"
  1715. ), o = n.indexOf(t.related), r = e.component.getVmIndexFromDomIndex(
  1716. o
  1717. );
  1718. return n.indexOf(ne) !== -1 || !t.willInsertAfter ? r : r + 1;
  1719. },
  1720. onDragMove(e, t) {
  1721. const { move: n, realList: o } = this;
  1722. if (!n || !o)
  1723. return !0;
  1724. const r = this.getRelatedContextFromMoveEvent(e), i = this.computeFutureIndex(r, e), a = yt(z({}, this.context), {
  1725. futureIndex: i
  1726. }), l = yt(z({}, e), {
  1727. relatedContext: r,
  1728. draggedContext: a
  1729. });
  1730. return n(l, t);
  1731. },
  1732. onDragEnd() {
  1733. ne = null;
  1734. }
  1735. }
  1736. });
  1737. export {
  1738. no as d
  1739. };