yxuse 3.0.68 → 3.0.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/lib/api.cjs.js +0 -1
  2. package/lib/api.es.js +0 -1
  3. package/lib/app.cjs.js +0 -1
  4. package/lib/app.es.js +0 -1
  5. package/lib/components.cjs.js +0 -1
  6. package/lib/components.es.js +0 -1
  7. package/lib/directives.cjs.js +0 -1
  8. package/lib/directives.es.js +0 -1
  9. package/lib/hooks.cjs.js +0 -1
  10. package/lib/hooks.es.js +0 -1
  11. package/lib/index.cjs.js +0 -1
  12. package/lib/index.cjs10.js +0 -1
  13. package/lib/index.cjs11.js +1 -2
  14. package/lib/index.cjs12.js +1 -2
  15. package/lib/index.cjs13.js +1 -2
  16. package/lib/index.cjs14.js +0 -1
  17. package/lib/index.cjs2.js +1 -2
  18. package/lib/index.cjs3.js +0 -1
  19. package/lib/index.cjs4.js +0 -1
  20. package/lib/index.cjs5.js +1 -2
  21. package/lib/index.cjs5.js.gz +0 -0
  22. package/lib/index.cjs6.js +1 -2
  23. package/lib/index.cjs6.js.gz +0 -0
  24. package/lib/index.cjs7.js +0 -1
  25. package/lib/index.cjs8.js +0 -1
  26. package/lib/index.cjs9.js +0 -1
  27. package/lib/index.es.js +0 -1
  28. package/lib/index.es10.js +0 -1
  29. package/lib/index.es11.js +1 -2
  30. package/lib/index.es12.js +1 -2
  31. package/lib/index.es12.js.gz +0 -0
  32. package/lib/index.es13.js +1 -2
  33. package/lib/index.es14.js +0 -1
  34. package/lib/index.es2.js +1 -2
  35. package/lib/index.es3.js +0 -1
  36. package/lib/index.es4.js +0 -1
  37. package/lib/index.es5.js +8 -2
  38. package/lib/index.es5.js.gz +0 -0
  39. package/lib/index.es6.js +8 -6
  40. package/lib/index.es6.js.gz +0 -0
  41. package/lib/index.es7.js +0 -1
  42. package/lib/index.es8.js +0 -1
  43. package/lib/index.es9.js +0 -1
  44. package/lib/theme.cjs.js +1 -2
  45. package/lib/theme.es.js +5 -2
  46. package/lib/translate.cjs.js +1 -2
  47. package/lib/translate.es.js +7 -2
  48. package/lib/utils.cjs.js +0 -1
  49. package/lib/utils.es.js +0 -1
  50. package/lib/vendor-axios.cjs.js +1 -0
  51. package/lib/vendor-axios.cjs.js.gz +0 -0
  52. package/lib/vendor-axios.es.js +2378 -0
  53. package/lib/vendor-axios.es.js.gz +0 -0
  54. package/lib/vendor-dayjs.cjs.js +1 -0
  55. package/lib/vendor-dayjs.es.js +294 -0
  56. package/lib/vendor-dayjs.es.js.gz +0 -0
  57. package/lib/vendor-file-saver.cjs.js +1 -0
  58. package/lib/vendor-file-saver.es.js +77 -0
  59. package/lib/vendor-localforage.cjs.js +7 -0
  60. package/lib/vendor-localforage.cjs.js.gz +0 -0
  61. package/lib/vendor-localforage.es.js +2139 -0
  62. package/lib/vendor-localforage.es.js.gz +0 -0
  63. package/lib/vendor-lodash.cjs.js +9 -0
  64. package/lib/vendor-lodash.cjs.js.gz +0 -0
  65. package/lib/vendor-lodash.es.js +5493 -0
  66. package/lib/vendor-lodash.es.js.gz +0 -0
  67. package/lib/vendor-mqtt.cjs.js +1 -0
  68. package/lib/vendor-mqtt.cjs.js.gz +0 -0
  69. package/lib/vendor-mqtt.es.js +6822 -0
  70. package/lib/vendor-mqtt.es.js.gz +0 -0
  71. package/lib/vendor-sortablejs.cjs.js +7 -0
  72. package/lib/vendor-sortablejs.cjs.js.gz +0 -0
  73. package/lib/vendor-sortablejs.es.js +2160 -0
  74. package/lib/vendor-sortablejs.es.js.gz +0 -0
  75. package/lib/yxIcon.cjs.js +0 -1
  76. package/lib/yxIcon.es.js +0 -1
  77. package/lib/yxi18n.cjs.js +0 -1
  78. package/lib/yxi18n.es.js +0 -1
  79. package/lib/yxuse.css +1 -1
  80. package/lib/yxuse.css.gz +0 -0
  81. package/package.json +1 -1
  82. package/lib/.pnpm.cjs.js +0 -26
  83. package/lib/.pnpm.cjs.js.gz +0 -0
  84. package/lib/.pnpm.cjs.js.map +0 -1
  85. package/lib/.pnpm.es.js +0 -54020
  86. package/lib/.pnpm.es.js.gz +0 -0
  87. package/lib/.pnpm.es.js.map +0 -1
  88. package/lib/api.cjs.js.map +0 -1
  89. package/lib/api.es.js.map +0 -1
  90. package/lib/app.cjs.js.map +0 -1
  91. package/lib/app.es.js.map +0 -1
  92. package/lib/components.cjs.js.map +0 -1
  93. package/lib/components.es.js.map +0 -1
  94. package/lib/directives.cjs.js.map +0 -1
  95. package/lib/directives.es.js.map +0 -1
  96. package/lib/hooks.cjs.js.map +0 -1
  97. package/lib/hooks.es.js.map +0 -1
  98. package/lib/index.cjs.js.map +0 -1
  99. package/lib/index.cjs10.js.map +0 -1
  100. package/lib/index.cjs11.js.map +0 -1
  101. package/lib/index.cjs12.js.map +0 -1
  102. package/lib/index.cjs13.js.map +0 -1
  103. package/lib/index.cjs14.js.map +0 -1
  104. package/lib/index.cjs2.js.map +0 -1
  105. package/lib/index.cjs3.js.map +0 -1
  106. package/lib/index.cjs4.js.map +0 -1
  107. package/lib/index.cjs5.js.map +0 -1
  108. package/lib/index.cjs6.js.map +0 -1
  109. package/lib/index.cjs7.js.map +0 -1
  110. package/lib/index.cjs8.js.map +0 -1
  111. package/lib/index.cjs9.js.map +0 -1
  112. package/lib/index.es.js.map +0 -1
  113. package/lib/index.es10.js.map +0 -1
  114. package/lib/index.es11.js.map +0 -1
  115. package/lib/index.es12.js.map +0 -1
  116. package/lib/index.es13.js.map +0 -1
  117. package/lib/index.es14.js.map +0 -1
  118. package/lib/index.es2.js.map +0 -1
  119. package/lib/index.es3.js.map +0 -1
  120. package/lib/index.es4.js.map +0 -1
  121. package/lib/index.es5.js.map +0 -1
  122. package/lib/index.es6.js.map +0 -1
  123. package/lib/index.es7.js.map +0 -1
  124. package/lib/index.es8.js.map +0 -1
  125. package/lib/index.es9.js.map +0 -1
  126. package/lib/theme.cjs.js.map +0 -1
  127. package/lib/theme.es.js.map +0 -1
  128. package/lib/translate.cjs.js.map +0 -1
  129. package/lib/translate.es.js.map +0 -1
  130. package/lib/utils.cjs.js.map +0 -1
  131. package/lib/utils.es.js.map +0 -1
  132. package/lib/yxIcon.cjs.js.map +0 -1
  133. package/lib/yxIcon.es.js.map +0 -1
  134. package/lib/yxi18n.cjs.js.map +0 -1
  135. package/lib/yxi18n.es.js.map +0 -1
@@ -0,0 +1,2160 @@
1
+ /**!
2
+ * Sortable 1.15.6
3
+ * @author RubaXa <trash@rubaxa.org>
4
+ * @author owenm <owen23355@gmail.com>
5
+ * @license MIT
6
+ */
7
+ function ownKeys(object, enumerableOnly) {
8
+ var keys = Object.keys(object);
9
+ if (Object.getOwnPropertySymbols) {
10
+ var symbols = Object.getOwnPropertySymbols(object);
11
+ if (enumerableOnly) {
12
+ symbols = symbols.filter(function(sym) {
13
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
+ });
15
+ }
16
+ keys.push.apply(keys, symbols);
17
+ }
18
+ return keys;
19
+ }
20
+ function _objectSpread2(target) {
21
+ for (var i = 1; i < arguments.length; i++) {
22
+ var source = arguments[i] != null ? arguments[i] : {};
23
+ if (i % 2) {
24
+ ownKeys(Object(source), true).forEach(function(key) {
25
+ _defineProperty(target, key, source[key]);
26
+ });
27
+ } else if (Object.getOwnPropertyDescriptors) {
28
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
29
+ } else {
30
+ ownKeys(Object(source)).forEach(function(key) {
31
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
32
+ });
33
+ }
34
+ }
35
+ return target;
36
+ }
37
+ function _typeof(obj) {
38
+ "@babel/helpers - typeof";
39
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
40
+ _typeof = function(obj2) {
41
+ return typeof obj2;
42
+ };
43
+ } else {
44
+ _typeof = function(obj2) {
45
+ return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
46
+ };
47
+ }
48
+ return _typeof(obj);
49
+ }
50
+ function _defineProperty(obj, key, value) {
51
+ if (key in obj) {
52
+ Object.defineProperty(obj, key, {
53
+ value,
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true
57
+ });
58
+ } else {
59
+ obj[key] = value;
60
+ }
61
+ return obj;
62
+ }
63
+ function _extends() {
64
+ _extends = Object.assign || function(target) {
65
+ for (var i = 1; i < arguments.length; i++) {
66
+ var source = arguments[i];
67
+ for (var key in source) {
68
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
69
+ target[key] = source[key];
70
+ }
71
+ }
72
+ }
73
+ return target;
74
+ };
75
+ return _extends.apply(this, arguments);
76
+ }
77
+ function _objectWithoutPropertiesLoose(source, excluded) {
78
+ if (source == null) return {};
79
+ var target = {};
80
+ var sourceKeys = Object.keys(source);
81
+ var key, i;
82
+ for (i = 0; i < sourceKeys.length; i++) {
83
+ key = sourceKeys[i];
84
+ if (excluded.indexOf(key) >= 0) continue;
85
+ target[key] = source[key];
86
+ }
87
+ return target;
88
+ }
89
+ function _objectWithoutProperties(source, excluded) {
90
+ if (source == null) return {};
91
+ var target = _objectWithoutPropertiesLoose(source, excluded);
92
+ var key, i;
93
+ if (Object.getOwnPropertySymbols) {
94
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
95
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
96
+ key = sourceSymbolKeys[i];
97
+ if (excluded.indexOf(key) >= 0) continue;
98
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
99
+ target[key] = source[key];
100
+ }
101
+ }
102
+ return target;
103
+ }
104
+ var version = "1.15.6";
105
+ function userAgent(pattern) {
106
+ if (typeof window !== "undefined" && window.navigator) {
107
+ return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
108
+ }
109
+ }
110
+ var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
111
+ var Edge = userAgent(/Edge/i);
112
+ var FireFox = userAgent(/firefox/i);
113
+ var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
114
+ var IOS = userAgent(/iP(ad|od|hone)/i);
115
+ var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
116
+ var captureMode = {
117
+ capture: false,
118
+ passive: false
119
+ };
120
+ function on(el, event, fn) {
121
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
122
+ }
123
+ function off(el, event, fn) {
124
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
125
+ }
126
+ function matches(el, selector) {
127
+ if (!selector) return;
128
+ selector[0] === ">" && (selector = selector.substring(1));
129
+ if (el) {
130
+ try {
131
+ if (el.matches) {
132
+ return el.matches(selector);
133
+ } else if (el.msMatchesSelector) {
134
+ return el.msMatchesSelector(selector);
135
+ } else if (el.webkitMatchesSelector) {
136
+ return el.webkitMatchesSelector(selector);
137
+ }
138
+ } catch (_) {
139
+ return false;
140
+ }
141
+ }
142
+ return false;
143
+ }
144
+ function getParentOrHost(el) {
145
+ return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
146
+ }
147
+ function closest(el, selector, ctx, includeCTX) {
148
+ if (el) {
149
+ ctx = ctx || document;
150
+ do {
151
+ if (selector != null && (selector[0] === ">" ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
152
+ return el;
153
+ }
154
+ if (el === ctx) break;
155
+ } while (el = getParentOrHost(el));
156
+ }
157
+ return null;
158
+ }
159
+ var R_SPACE = /\s+/g;
160
+ function toggleClass(el, name, state) {
161
+ if (el && name) {
162
+ if (el.classList) {
163
+ el.classList[state ? "add" : "remove"](name);
164
+ } else {
165
+ var className = (" " + el.className + " ").replace(R_SPACE, " ").replace(" " + name + " ", " ");
166
+ el.className = (className + (state ? " " + name : "")).replace(R_SPACE, " ");
167
+ }
168
+ }
169
+ }
170
+ function css(el, prop, val) {
171
+ var style = el && el.style;
172
+ if (style) {
173
+ if (val === void 0) {
174
+ if (document.defaultView && document.defaultView.getComputedStyle) {
175
+ val = document.defaultView.getComputedStyle(el, "");
176
+ } else if (el.currentStyle) {
177
+ val = el.currentStyle;
178
+ }
179
+ return prop === void 0 ? val : val[prop];
180
+ } else {
181
+ if (!(prop in style) && prop.indexOf("webkit") === -1) {
182
+ prop = "-webkit-" + prop;
183
+ }
184
+ style[prop] = val + (typeof val === "string" ? "" : "px");
185
+ }
186
+ }
187
+ }
188
+ function matrix(el, selfOnly) {
189
+ var appliedTransforms = "";
190
+ if (typeof el === "string") {
191
+ appliedTransforms = el;
192
+ } else {
193
+ do {
194
+ var transform = css(el, "transform");
195
+ if (transform && transform !== "none") {
196
+ appliedTransforms = transform + " " + appliedTransforms;
197
+ }
198
+ } while (!selfOnly && (el = el.parentNode));
199
+ }
200
+ var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
201
+ return matrixFn && new matrixFn(appliedTransforms);
202
+ }
203
+ function find(ctx, tagName, iterator) {
204
+ if (ctx) {
205
+ var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
206
+ if (iterator) {
207
+ for (; i < n; i++) {
208
+ iterator(list[i], i);
209
+ }
210
+ }
211
+ return list;
212
+ }
213
+ return [];
214
+ }
215
+ function getWindowScrollingElement() {
216
+ var scrollingElement = document.scrollingElement;
217
+ if (scrollingElement) {
218
+ return scrollingElement;
219
+ } else {
220
+ return document.documentElement;
221
+ }
222
+ }
223
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
224
+ if (!el.getBoundingClientRect && el !== window) return;
225
+ var elRect, top, left, bottom, right, height, width;
226
+ if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
227
+ elRect = el.getBoundingClientRect();
228
+ top = elRect.top;
229
+ left = elRect.left;
230
+ bottom = elRect.bottom;
231
+ right = elRect.right;
232
+ height = elRect.height;
233
+ width = elRect.width;
234
+ } else {
235
+ top = 0;
236
+ left = 0;
237
+ bottom = window.innerHeight;
238
+ right = window.innerWidth;
239
+ height = window.innerHeight;
240
+ width = window.innerWidth;
241
+ }
242
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
243
+ container = container || el.parentNode;
244
+ if (!IE11OrLess) {
245
+ do {
246
+ if (container && container.getBoundingClientRect && (css(container, "transform") !== "none" || relativeToNonStaticParent && css(container, "position") !== "static")) {
247
+ var containerRect = container.getBoundingClientRect();
248
+ top -= containerRect.top + parseInt(css(container, "border-top-width"));
249
+ left -= containerRect.left + parseInt(css(container, "border-left-width"));
250
+ bottom = top + elRect.height;
251
+ right = left + elRect.width;
252
+ break;
253
+ }
254
+ } while (container = container.parentNode);
255
+ }
256
+ }
257
+ if (undoScale && el !== window) {
258
+ var elMatrix = matrix(container || el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d;
259
+ if (elMatrix) {
260
+ top /= scaleY;
261
+ left /= scaleX;
262
+ width /= scaleX;
263
+ height /= scaleY;
264
+ bottom = top + height;
265
+ right = left + width;
266
+ }
267
+ }
268
+ return {
269
+ top,
270
+ left,
271
+ bottom,
272
+ right,
273
+ width,
274
+ height
275
+ };
276
+ }
277
+ function isScrolledPast(el, elSide, parentSide) {
278
+ var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
279
+ while (parent) {
280
+ var parentSideVal = getRect(parent)[parentSide], visible = void 0;
281
+ {
282
+ visible = elSideVal >= parentSideVal;
283
+ }
284
+ if (!visible) return parent;
285
+ if (parent === getWindowScrollingElement()) break;
286
+ parent = getParentAutoScrollElement(parent, false);
287
+ }
288
+ return false;
289
+ }
290
+ function getChild(el, childNum, options, includeDragEl) {
291
+ var currentChild = 0, i = 0, children = el.children;
292
+ while (i < children.length) {
293
+ if (children[i].style.display !== "none" && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
294
+ if (currentChild === childNum) {
295
+ return children[i];
296
+ }
297
+ currentChild++;
298
+ }
299
+ i++;
300
+ }
301
+ return null;
302
+ }
303
+ function lastChild(el, selector) {
304
+ var last = el.lastElementChild;
305
+ while (last && (last === Sortable.ghost || css(last, "display") === "none" || selector && !matches(last, selector))) {
306
+ last = last.previousElementSibling;
307
+ }
308
+ return last || null;
309
+ }
310
+ function index(el, selector) {
311
+ var index2 = 0;
312
+ if (!el || !el.parentNode) {
313
+ return -1;
314
+ }
315
+ while (el = el.previousElementSibling) {
316
+ if (el.nodeName.toUpperCase() !== "TEMPLATE" && el !== Sortable.clone && (!selector || matches(el, selector))) {
317
+ index2++;
318
+ }
319
+ }
320
+ return index2;
321
+ }
322
+ function getRelativeScrollOffset(el) {
323
+ var offsetLeft = 0, offsetTop = 0, winScroller = getWindowScrollingElement();
324
+ if (el) {
325
+ do {
326
+ var elMatrix = matrix(el), scaleX = elMatrix.a, scaleY = elMatrix.d;
327
+ offsetLeft += el.scrollLeft * scaleX;
328
+ offsetTop += el.scrollTop * scaleY;
329
+ } while (el !== winScroller && (el = el.parentNode));
330
+ }
331
+ return [offsetLeft, offsetTop];
332
+ }
333
+ function indexOfObject(arr, obj) {
334
+ for (var i in arr) {
335
+ if (!arr.hasOwnProperty(i)) continue;
336
+ for (var key in obj) {
337
+ if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
338
+ }
339
+ }
340
+ return -1;
341
+ }
342
+ function getParentAutoScrollElement(el, includeSelf) {
343
+ if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
344
+ var elem = el;
345
+ var gotSelf = false;
346
+ do {
347
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
348
+ var elemCSS = css(elem);
349
+ if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == "auto" || elemCSS.overflowX == "scroll") || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == "auto" || elemCSS.overflowY == "scroll")) {
350
+ if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
351
+ if (gotSelf || includeSelf) return elem;
352
+ gotSelf = true;
353
+ }
354
+ }
355
+ } while (elem = elem.parentNode);
356
+ return getWindowScrollingElement();
357
+ }
358
+ function extend(dst, src) {
359
+ if (dst && src) {
360
+ for (var key in src) {
361
+ if (src.hasOwnProperty(key)) {
362
+ dst[key] = src[key];
363
+ }
364
+ }
365
+ }
366
+ return dst;
367
+ }
368
+ function isRectEqual(rect1, rect2) {
369
+ return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
370
+ }
371
+ var _throttleTimeout;
372
+ function throttle(callback, ms) {
373
+ return function() {
374
+ if (!_throttleTimeout) {
375
+ var args = arguments, _this = this;
376
+ if (args.length === 1) {
377
+ callback.call(_this, args[0]);
378
+ } else {
379
+ callback.apply(_this, args);
380
+ }
381
+ _throttleTimeout = setTimeout(function() {
382
+ _throttleTimeout = void 0;
383
+ }, ms);
384
+ }
385
+ };
386
+ }
387
+ function cancelThrottle() {
388
+ clearTimeout(_throttleTimeout);
389
+ _throttleTimeout = void 0;
390
+ }
391
+ function scrollBy(el, x, y) {
392
+ el.scrollLeft += x;
393
+ el.scrollTop += y;
394
+ }
395
+ function clone(el) {
396
+ var Polymer = window.Polymer;
397
+ var $ = window.jQuery || window.Zepto;
398
+ if (Polymer && Polymer.dom) {
399
+ return Polymer.dom(el).cloneNode(true);
400
+ } else if ($) {
401
+ return $(el).clone(true)[0];
402
+ } else {
403
+ return el.cloneNode(true);
404
+ }
405
+ }
406
+ function getChildContainingRectFromElement(container, options, ghostEl2) {
407
+ var rect = {};
408
+ Array.from(container.children).forEach(function(child) {
409
+ var _rect$left, _rect$top, _rect$right, _rect$bottom;
410
+ if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl2) return;
411
+ var childRect = getRect(child);
412
+ rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
413
+ rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
414
+ rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
415
+ rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
416
+ });
417
+ rect.width = rect.right - rect.left;
418
+ rect.height = rect.bottom - rect.top;
419
+ rect.x = rect.left;
420
+ rect.y = rect.top;
421
+ return rect;
422
+ }
423
+ var expando = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
424
+ function AnimationStateManager() {
425
+ var animationStates = [], animationCallbackId;
426
+ return {
427
+ captureAnimationState: function captureAnimationState() {
428
+ animationStates = [];
429
+ if (!this.options.animation) return;
430
+ var children = [].slice.call(this.el.children);
431
+ children.forEach(function(child) {
432
+ if (css(child, "display") === "none" || child === Sortable.ghost) return;
433
+ animationStates.push({
434
+ target: child,
435
+ rect: getRect(child)
436
+ });
437
+ var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
438
+ if (child.thisAnimationDuration) {
439
+ var childMatrix = matrix(child, true);
440
+ if (childMatrix) {
441
+ fromRect.top -= childMatrix.f;
442
+ fromRect.left -= childMatrix.e;
443
+ }
444
+ }
445
+ child.fromRect = fromRect;
446
+ });
447
+ },
448
+ addAnimationState: function addAnimationState(state) {
449
+ animationStates.push(state);
450
+ },
451
+ removeAnimationState: function removeAnimationState(target) {
452
+ animationStates.splice(indexOfObject(animationStates, {
453
+ target
454
+ }), 1);
455
+ },
456
+ animateAll: function animateAll(callback) {
457
+ var _this = this;
458
+ if (!this.options.animation) {
459
+ clearTimeout(animationCallbackId);
460
+ if (typeof callback === "function") callback();
461
+ return;
462
+ }
463
+ var animating = false, animationTime = 0;
464
+ animationStates.forEach(function(state) {
465
+ var time = 0, target = state.target, fromRect = target.fromRect, toRect = getRect(target), prevFromRect = target.prevFromRect, prevToRect = target.prevToRect, animatingRect = state.rect, targetMatrix = matrix(target, true);
466
+ if (targetMatrix) {
467
+ toRect.top -= targetMatrix.f;
468
+ toRect.left -= targetMatrix.e;
469
+ }
470
+ target.toRect = toRect;
471
+ if (target.thisAnimationDuration) {
472
+ if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
473
+ (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
474
+ time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
475
+ }
476
+ }
477
+ if (!isRectEqual(toRect, fromRect)) {
478
+ target.prevFromRect = fromRect;
479
+ target.prevToRect = toRect;
480
+ if (!time) {
481
+ time = _this.options.animation;
482
+ }
483
+ _this.animate(target, animatingRect, toRect, time);
484
+ }
485
+ if (time) {
486
+ animating = true;
487
+ animationTime = Math.max(animationTime, time);
488
+ clearTimeout(target.animationResetTimer);
489
+ target.animationResetTimer = setTimeout(function() {
490
+ target.animationTime = 0;
491
+ target.prevFromRect = null;
492
+ target.fromRect = null;
493
+ target.prevToRect = null;
494
+ target.thisAnimationDuration = null;
495
+ }, time);
496
+ target.thisAnimationDuration = time;
497
+ }
498
+ });
499
+ clearTimeout(animationCallbackId);
500
+ if (!animating) {
501
+ if (typeof callback === "function") callback();
502
+ } else {
503
+ animationCallbackId = setTimeout(function() {
504
+ if (typeof callback === "function") callback();
505
+ }, animationTime);
506
+ }
507
+ animationStates = [];
508
+ },
509
+ animate: function animate(target, currentRect, toRect, duration) {
510
+ if (duration) {
511
+ css(target, "transition", "");
512
+ css(target, "transform", "");
513
+ var elMatrix = matrix(this.el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d, translateX = (currentRect.left - toRect.left) / (scaleX || 1), translateY = (currentRect.top - toRect.top) / (scaleY || 1);
514
+ target.animatingX = !!translateX;
515
+ target.animatingY = !!translateY;
516
+ css(target, "transform", "translate3d(" + translateX + "px," + translateY + "px,0)");
517
+ this.forRepaintDummy = repaint(target);
518
+ css(target, "transition", "transform " + duration + "ms" + (this.options.easing ? " " + this.options.easing : ""));
519
+ css(target, "transform", "translate3d(0,0,0)");
520
+ typeof target.animated === "number" && clearTimeout(target.animated);
521
+ target.animated = setTimeout(function() {
522
+ css(target, "transition", "");
523
+ css(target, "transform", "");
524
+ target.animated = false;
525
+ target.animatingX = false;
526
+ target.animatingY = false;
527
+ }, duration);
528
+ }
529
+ }
530
+ };
531
+ }
532
+ function repaint(target) {
533
+ return target.offsetWidth;
534
+ }
535
+ function calculateRealTime(animatingRect, fromRect, toRect, options) {
536
+ return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
537
+ }
538
+ var plugins = [];
539
+ var defaults = {
540
+ initializeByDefault: true
541
+ };
542
+ var PluginManager = {
543
+ mount: function mount(plugin) {
544
+ for (var option2 in defaults) {
545
+ if (defaults.hasOwnProperty(option2) && !(option2 in plugin)) {
546
+ plugin[option2] = defaults[option2];
547
+ }
548
+ }
549
+ plugins.forEach(function(p) {
550
+ if (p.pluginName === plugin.pluginName) {
551
+ throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
552
+ }
553
+ });
554
+ plugins.push(plugin);
555
+ },
556
+ pluginEvent: function pluginEvent(eventName, sortable, evt) {
557
+ var _this = this;
558
+ this.eventCanceled = false;
559
+ evt.cancel = function() {
560
+ _this.eventCanceled = true;
561
+ };
562
+ var eventNameGlobal = eventName + "Global";
563
+ plugins.forEach(function(plugin) {
564
+ if (!sortable[plugin.pluginName]) return;
565
+ if (sortable[plugin.pluginName][eventNameGlobal]) {
566
+ sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
567
+ sortable
568
+ }, evt));
569
+ }
570
+ if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
571
+ sortable[plugin.pluginName][eventName](_objectSpread2({
572
+ sortable
573
+ }, evt));
574
+ }
575
+ });
576
+ },
577
+ initializePlugins: function initializePlugins(sortable, el, defaults2, options) {
578
+ plugins.forEach(function(plugin) {
579
+ var pluginName = plugin.pluginName;
580
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
581
+ var initialized = new plugin(sortable, el, sortable.options);
582
+ initialized.sortable = sortable;
583
+ initialized.options = sortable.options;
584
+ sortable[pluginName] = initialized;
585
+ _extends(defaults2, initialized.defaults);
586
+ });
587
+ for (var option2 in sortable.options) {
588
+ if (!sortable.options.hasOwnProperty(option2)) continue;
589
+ var modified = this.modifyOption(sortable, option2, sortable.options[option2]);
590
+ if (typeof modified !== "undefined") {
591
+ sortable.options[option2] = modified;
592
+ }
593
+ }
594
+ },
595
+ getEventProperties: function getEventProperties(name, sortable) {
596
+ var eventProperties = {};
597
+ plugins.forEach(function(plugin) {
598
+ if (typeof plugin.eventProperties !== "function") return;
599
+ _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
600
+ });
601
+ return eventProperties;
602
+ },
603
+ modifyOption: function modifyOption(sortable, name, value) {
604
+ var modifiedValue;
605
+ plugins.forEach(function(plugin) {
606
+ if (!sortable[plugin.pluginName]) return;
607
+ if (plugin.optionListeners && typeof plugin.optionListeners[name] === "function") {
608
+ modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
609
+ }
610
+ });
611
+ return modifiedValue;
612
+ }
613
+ };
614
+ function dispatchEvent(_ref) {
615
+ var sortable = _ref.sortable, rootEl2 = _ref.rootEl, name = _ref.name, targetEl = _ref.targetEl, cloneEl2 = _ref.cloneEl, toEl = _ref.toEl, fromEl = _ref.fromEl, oldIndex2 = _ref.oldIndex, newIndex2 = _ref.newIndex, oldDraggableIndex2 = _ref.oldDraggableIndex, newDraggableIndex2 = _ref.newDraggableIndex, originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, extraEventProperties = _ref.extraEventProperties;
616
+ sortable = sortable || rootEl2 && rootEl2[expando];
617
+ if (!sortable) return;
618
+ var evt, options = sortable.options, onName = "on" + name.charAt(0).toUpperCase() + name.substr(1);
619
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
620
+ evt = new CustomEvent(name, {
621
+ bubbles: true,
622
+ cancelable: true
623
+ });
624
+ } else {
625
+ evt = document.createEvent("Event");
626
+ evt.initEvent(name, true, true);
627
+ }
628
+ evt.to = toEl || rootEl2;
629
+ evt.from = fromEl || rootEl2;
630
+ evt.item = targetEl || rootEl2;
631
+ evt.clone = cloneEl2;
632
+ evt.oldIndex = oldIndex2;
633
+ evt.newIndex = newIndex2;
634
+ evt.oldDraggableIndex = oldDraggableIndex2;
635
+ evt.newDraggableIndex = newDraggableIndex2;
636
+ evt.originalEvent = originalEvent;
637
+ evt.pullMode = putSortable2 ? putSortable2.lastPutMode : void 0;
638
+ var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
639
+ for (var option2 in allEventProperties) {
640
+ evt[option2] = allEventProperties[option2];
641
+ }
642
+ if (rootEl2) {
643
+ rootEl2.dispatchEvent(evt);
644
+ }
645
+ if (options[onName]) {
646
+ options[onName].call(sortable, evt);
647
+ }
648
+ }
649
+ var _excluded = ["evt"];
650
+ var pluginEvent2 = function pluginEvent3(eventName, sortable) {
651
+ var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, _excluded);
652
+ PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
653
+ dragEl,
654
+ parentEl,
655
+ ghostEl,
656
+ rootEl,
657
+ nextEl,
658
+ lastDownEl,
659
+ cloneEl,
660
+ cloneHidden,
661
+ dragStarted: moved,
662
+ putSortable,
663
+ activeSortable: Sortable.active,
664
+ originalEvent,
665
+ oldIndex,
666
+ oldDraggableIndex,
667
+ newIndex,
668
+ newDraggableIndex,
669
+ hideGhostForTarget: _hideGhostForTarget,
670
+ unhideGhostForTarget: _unhideGhostForTarget,
671
+ cloneNowHidden: function cloneNowHidden() {
672
+ cloneHidden = true;
673
+ },
674
+ cloneNowShown: function cloneNowShown() {
675
+ cloneHidden = false;
676
+ },
677
+ dispatchSortableEvent: function dispatchSortableEvent(name) {
678
+ _dispatchEvent({
679
+ sortable,
680
+ name,
681
+ originalEvent
682
+ });
683
+ }
684
+ }, data));
685
+ };
686
+ function _dispatchEvent(info) {
687
+ dispatchEvent(_objectSpread2({
688
+ putSortable,
689
+ cloneEl,
690
+ targetEl: dragEl,
691
+ rootEl,
692
+ oldIndex,
693
+ oldDraggableIndex,
694
+ newIndex,
695
+ newDraggableIndex
696
+ }, info));
697
+ }
698
+ var dragEl, parentEl, ghostEl, rootEl, nextEl, lastDownEl, cloneEl, cloneHidden, oldIndex, newIndex, oldDraggableIndex, newDraggableIndex, activeGroup, putSortable, awaitingDragStarted = false, ignoreNextClick = false, sortables = [], tapEvt, touchEvt, lastDx, lastDy, tapDistanceLeft, tapDistanceTop, moved, lastTarget, lastDirection, pastFirstInvertThresh = false, isCircumstantialInvert = false, targetMoveDistance, ghostRelativeParent, ghostRelativeParentInitialScroll = [], _silent = false, savedInputChecked = [];
699
+ var documentExists = typeof document !== "undefined", PositionGhostAbsolutely = IOS, CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float", supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"), supportCssPointerEvents = function() {
700
+ if (!documentExists) return;
701
+ if (IE11OrLess) {
702
+ return false;
703
+ }
704
+ var el = document.createElement("x");
705
+ el.style.cssText = "pointer-events:auto";
706
+ return el.style.pointerEvents === "auto";
707
+ }(), _detectDirection = function _detectDirection2(el, options) {
708
+ var elCSS = css(el), elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), child1 = getChild(el, 0, options), child2 = getChild(el, 1, options), firstChildCSS = child1 && css(child1), secondChildCSS = child2 && css(child2), firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
709
+ if (elCSS.display === "flex") {
710
+ return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal";
711
+ }
712
+ if (elCSS.display === "grid") {
713
+ return elCSS.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
714
+ }
715
+ if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== "none") {
716
+ var touchingSideChild2 = firstChildCSS["float"] === "left" ? "left" : "right";
717
+ return child2 && (secondChildCSS.clear === "both" || secondChildCSS.clear === touchingSideChild2) ? "vertical" : "horizontal";
718
+ }
719
+ return child1 && (firstChildCSS.display === "block" || firstChildCSS.display === "flex" || firstChildCSS.display === "table" || firstChildCSS.display === "grid" || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === "none" || child2 && elCSS[CSSFloatProperty] === "none" && firstChildWidth + secondChildWidth > elWidth) ? "vertical" : "horizontal";
720
+ }, _dragElInRowColumn = function _dragElInRowColumn2(dragRect, targetRect, vertical) {
721
+ var dragElS1Opp = vertical ? dragRect.left : dragRect.top, dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, dragElOppLength = vertical ? dragRect.width : dragRect.height, targetS1Opp = vertical ? targetRect.left : targetRect.top, targetS2Opp = vertical ? targetRect.right : targetRect.bottom, targetOppLength = vertical ? targetRect.width : targetRect.height;
722
+ return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
723
+ }, _detectNearestEmptySortable = function _detectNearestEmptySortable2(x, y) {
724
+ var ret;
725
+ sortables.some(function(sortable) {
726
+ var threshold = sortable[expando].options.emptyInsertThreshold;
727
+ if (!threshold || lastChild(sortable)) return;
728
+ var rect = getRect(sortable), insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
729
+ if (insideHorizontally && insideVertically) {
730
+ return ret = sortable;
731
+ }
732
+ });
733
+ return ret;
734
+ }, _prepareGroup = function _prepareGroup2(options) {
735
+ function toFn(value, pull) {
736
+ return function(to, from, dragEl2, evt) {
737
+ var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
738
+ if (value == null && (pull || sameGroup)) {
739
+ return true;
740
+ } else if (value == null || value === false) {
741
+ return false;
742
+ } else if (pull && value === "clone") {
743
+ return value;
744
+ } else if (typeof value === "function") {
745
+ return toFn(value(to, from, dragEl2, evt), pull)(to, from, dragEl2, evt);
746
+ } else {
747
+ var otherGroup = (pull ? to : from).options.group.name;
748
+ return value === true || typeof value === "string" && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
749
+ }
750
+ };
751
+ }
752
+ var group = {};
753
+ var originalGroup = options.group;
754
+ if (!originalGroup || _typeof(originalGroup) != "object") {
755
+ originalGroup = {
756
+ name: originalGroup
757
+ };
758
+ }
759
+ group.name = originalGroup.name;
760
+ group.checkPull = toFn(originalGroup.pull, true);
761
+ group.checkPut = toFn(originalGroup.put);
762
+ group.revertClone = originalGroup.revertClone;
763
+ options.group = group;
764
+ }, _hideGhostForTarget = function _hideGhostForTarget2() {
765
+ if (!supportCssPointerEvents && ghostEl) {
766
+ css(ghostEl, "display", "none");
767
+ }
768
+ }, _unhideGhostForTarget = function _unhideGhostForTarget2() {
769
+ if (!supportCssPointerEvents && ghostEl) {
770
+ css(ghostEl, "display", "");
771
+ }
772
+ };
773
+ if (documentExists && !ChromeForAndroid) {
774
+ document.addEventListener("click", function(evt) {
775
+ if (ignoreNextClick) {
776
+ evt.preventDefault();
777
+ evt.stopPropagation && evt.stopPropagation();
778
+ evt.stopImmediatePropagation && evt.stopImmediatePropagation();
779
+ ignoreNextClick = false;
780
+ return false;
781
+ }
782
+ }, true);
783
+ }
784
+ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt) {
785
+ if (dragEl) {
786
+ evt = evt.touches ? evt.touches[0] : evt;
787
+ var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
788
+ if (nearest) {
789
+ var event = {};
790
+ for (var i in evt) {
791
+ if (evt.hasOwnProperty(i)) {
792
+ event[i] = evt[i];
793
+ }
794
+ }
795
+ event.target = event.rootEl = nearest;
796
+ event.preventDefault = void 0;
797
+ event.stopPropagation = void 0;
798
+ nearest[expando]._onDragOver(event);
799
+ }
800
+ }
801
+ };
802
+ var _checkOutsideTargetEl = function _checkOutsideTargetEl2(evt) {
803
+ if (dragEl) {
804
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
805
+ }
806
+ };
807
+ function Sortable(el, options) {
808
+ if (!(el && el.nodeType && el.nodeType === 1)) {
809
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
810
+ }
811
+ this.el = el;
812
+ this.options = options = _extends({}, options);
813
+ el[expando] = this;
814
+ var defaults2 = {
815
+ group: null,
816
+ sort: true,
817
+ disabled: false,
818
+ store: null,
819
+ handle: null,
820
+ draggable: /^[uo]l$/i.test(el.nodeName) ? ">li" : ">*",
821
+ swapThreshold: 1,
822
+ // percentage; 0 <= x <= 1
823
+ invertSwap: false,
824
+ // invert always
825
+ invertedSwapThreshold: null,
826
+ // will be set to same as swapThreshold if default
827
+ removeCloneOnHide: true,
828
+ direction: function direction() {
829
+ return _detectDirection(el, this.options);
830
+ },
831
+ ghostClass: "sortable-ghost",
832
+ chosenClass: "sortable-chosen",
833
+ dragClass: "sortable-drag",
834
+ ignore: "a, img",
835
+ filter: null,
836
+ preventOnFilter: true,
837
+ animation: 0,
838
+ easing: null,
839
+ setData: function setData(dataTransfer, dragEl2) {
840
+ dataTransfer.setData("Text", dragEl2.textContent);
841
+ },
842
+ dropBubble: false,
843
+ dragoverBubble: false,
844
+ dataIdAttr: "data-id",
845
+ delay: 0,
846
+ delayOnTouchOnly: false,
847
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
848
+ forceFallback: false,
849
+ fallbackClass: "sortable-fallback",
850
+ fallbackOnBody: false,
851
+ fallbackTolerance: 0,
852
+ fallbackOffset: {
853
+ x: 0,
854
+ y: 0
855
+ },
856
+ // Disabled on Safari: #1571; Enabled on Safari IOS: #2244
857
+ supportPointer: Sortable.supportPointer !== false && "PointerEvent" in window && (!Safari || IOS),
858
+ emptyInsertThreshold: 5
859
+ };
860
+ PluginManager.initializePlugins(this, el, defaults2);
861
+ for (var name in defaults2) {
862
+ !(name in options) && (options[name] = defaults2[name]);
863
+ }
864
+ _prepareGroup(options);
865
+ for (var fn in this) {
866
+ if (fn.charAt(0) === "_" && typeof this[fn] === "function") {
867
+ this[fn] = this[fn].bind(this);
868
+ }
869
+ }
870
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
871
+ if (this.nativeDraggable) {
872
+ this.options.touchStartThreshold = 1;
873
+ }
874
+ if (options.supportPointer) {
875
+ on(el, "pointerdown", this._onTapStart);
876
+ } else {
877
+ on(el, "mousedown", this._onTapStart);
878
+ on(el, "touchstart", this._onTapStart);
879
+ }
880
+ if (this.nativeDraggable) {
881
+ on(el, "dragover", this);
882
+ on(el, "dragenter", this);
883
+ }
884
+ sortables.push(this.el);
885
+ options.store && options.store.get && this.sort(options.store.get(this) || []);
886
+ _extends(this, AnimationStateManager());
887
+ }
888
+ Sortable.prototype = /** @lends Sortable.prototype */
889
+ {
890
+ constructor: Sortable,
891
+ _isOutsideThisEl: function _isOutsideThisEl(target) {
892
+ if (!this.el.contains(target) && target !== this.el) {
893
+ lastTarget = null;
894
+ }
895
+ },
896
+ _getDirection: function _getDirection(evt, target) {
897
+ return typeof this.options.direction === "function" ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
898
+ },
899
+ _onTapStart: function _onTapStart(evt) {
900
+ if (!evt.cancelable) return;
901
+ var _this = this, el = this.el, options = this.options, preventOnFilter = options.preventOnFilter, type = evt.type, touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === "touch" && evt, target = (touch || evt).target, originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, filter = options.filter;
902
+ _saveInputCheckedState(el);
903
+ if (dragEl) {
904
+ return;
905
+ }
906
+ if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
907
+ return;
908
+ }
909
+ if (originalTarget.isContentEditable) {
910
+ return;
911
+ }
912
+ if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === "SELECT") {
913
+ return;
914
+ }
915
+ target = closest(target, options.draggable, el, false);
916
+ if (target && target.animated) {
917
+ return;
918
+ }
919
+ if (lastDownEl === target) {
920
+ return;
921
+ }
922
+ oldIndex = index(target);
923
+ oldDraggableIndex = index(target, options.draggable);
924
+ if (typeof filter === "function") {
925
+ if (filter.call(this, evt, target, this)) {
926
+ _dispatchEvent({
927
+ sortable: _this,
928
+ rootEl: originalTarget,
929
+ name: "filter",
930
+ targetEl: target,
931
+ toEl: el,
932
+ fromEl: el
933
+ });
934
+ pluginEvent2("filter", _this, {
935
+ evt
936
+ });
937
+ preventOnFilter && evt.preventDefault();
938
+ return;
939
+ }
940
+ } else if (filter) {
941
+ filter = filter.split(",").some(function(criteria) {
942
+ criteria = closest(originalTarget, criteria.trim(), el, false);
943
+ if (criteria) {
944
+ _dispatchEvent({
945
+ sortable: _this,
946
+ rootEl: criteria,
947
+ name: "filter",
948
+ targetEl: target,
949
+ fromEl: el,
950
+ toEl: el
951
+ });
952
+ pluginEvent2("filter", _this, {
953
+ evt
954
+ });
955
+ return true;
956
+ }
957
+ });
958
+ if (filter) {
959
+ preventOnFilter && evt.preventDefault();
960
+ return;
961
+ }
962
+ }
963
+ if (options.handle && !closest(originalTarget, options.handle, el, false)) {
964
+ return;
965
+ }
966
+ this._prepareDragStart(evt, touch, target);
967
+ },
968
+ _prepareDragStart: function _prepareDragStart(evt, touch, target) {
969
+ var _this = this, el = _this.el, options = _this.options, ownerDocument = el.ownerDocument, dragStartFn;
970
+ if (target && !dragEl && target.parentNode === el) {
971
+ var dragRect = getRect(target);
972
+ rootEl = el;
973
+ dragEl = target;
974
+ parentEl = dragEl.parentNode;
975
+ nextEl = dragEl.nextSibling;
976
+ lastDownEl = target;
977
+ activeGroup = options.group;
978
+ Sortable.dragged = dragEl;
979
+ tapEvt = {
980
+ target: dragEl,
981
+ clientX: (touch || evt).clientX,
982
+ clientY: (touch || evt).clientY
983
+ };
984
+ tapDistanceLeft = tapEvt.clientX - dragRect.left;
985
+ tapDistanceTop = tapEvt.clientY - dragRect.top;
986
+ this._lastX = (touch || evt).clientX;
987
+ this._lastY = (touch || evt).clientY;
988
+ dragEl.style["will-change"] = "all";
989
+ dragStartFn = function dragStartFn2() {
990
+ pluginEvent2("delayEnded", _this, {
991
+ evt
992
+ });
993
+ if (Sortable.eventCanceled) {
994
+ _this._onDrop();
995
+ return;
996
+ }
997
+ _this._disableDelayedDragEvents();
998
+ if (!FireFox && _this.nativeDraggable) {
999
+ dragEl.draggable = true;
1000
+ }
1001
+ _this._triggerDragStart(evt, touch);
1002
+ _dispatchEvent({
1003
+ sortable: _this,
1004
+ name: "choose",
1005
+ originalEvent: evt
1006
+ });
1007
+ toggleClass(dragEl, options.chosenClass, true);
1008
+ };
1009
+ options.ignore.split(",").forEach(function(criteria) {
1010
+ find(dragEl, criteria.trim(), _disableDraggable);
1011
+ });
1012
+ on(ownerDocument, "dragover", nearestEmptyInsertDetectEvent);
1013
+ on(ownerDocument, "mousemove", nearestEmptyInsertDetectEvent);
1014
+ on(ownerDocument, "touchmove", nearestEmptyInsertDetectEvent);
1015
+ if (options.supportPointer) {
1016
+ on(ownerDocument, "pointerup", _this._onDrop);
1017
+ !this.nativeDraggable && on(ownerDocument, "pointercancel", _this._onDrop);
1018
+ } else {
1019
+ on(ownerDocument, "mouseup", _this._onDrop);
1020
+ on(ownerDocument, "touchend", _this._onDrop);
1021
+ on(ownerDocument, "touchcancel", _this._onDrop);
1022
+ }
1023
+ if (FireFox && this.nativeDraggable) {
1024
+ this.options.touchStartThreshold = 4;
1025
+ dragEl.draggable = true;
1026
+ }
1027
+ pluginEvent2("delayStart", this, {
1028
+ evt
1029
+ });
1030
+ if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
1031
+ if (Sortable.eventCanceled) {
1032
+ this._onDrop();
1033
+ return;
1034
+ }
1035
+ if (options.supportPointer) {
1036
+ on(ownerDocument, "pointerup", _this._disableDelayedDrag);
1037
+ on(ownerDocument, "pointercancel", _this._disableDelayedDrag);
1038
+ } else {
1039
+ on(ownerDocument, "mouseup", _this._disableDelayedDrag);
1040
+ on(ownerDocument, "touchend", _this._disableDelayedDrag);
1041
+ on(ownerDocument, "touchcancel", _this._disableDelayedDrag);
1042
+ }
1043
+ on(ownerDocument, "mousemove", _this._delayedDragTouchMoveHandler);
1044
+ on(ownerDocument, "touchmove", _this._delayedDragTouchMoveHandler);
1045
+ options.supportPointer && on(ownerDocument, "pointermove", _this._delayedDragTouchMoveHandler);
1046
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
1047
+ } else {
1048
+ dragStartFn();
1049
+ }
1050
+ }
1051
+ },
1052
+ _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e) {
1053
+ var touch = e.touches ? e.touches[0] : e;
1054
+ if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
1055
+ this._disableDelayedDrag();
1056
+ }
1057
+ },
1058
+ _disableDelayedDrag: function _disableDelayedDrag() {
1059
+ dragEl && _disableDraggable(dragEl);
1060
+ clearTimeout(this._dragStartTimer);
1061
+ this._disableDelayedDragEvents();
1062
+ },
1063
+ _disableDelayedDragEvents: function _disableDelayedDragEvents() {
1064
+ var ownerDocument = this.el.ownerDocument;
1065
+ off(ownerDocument, "mouseup", this._disableDelayedDrag);
1066
+ off(ownerDocument, "touchend", this._disableDelayedDrag);
1067
+ off(ownerDocument, "touchcancel", this._disableDelayedDrag);
1068
+ off(ownerDocument, "pointerup", this._disableDelayedDrag);
1069
+ off(ownerDocument, "pointercancel", this._disableDelayedDrag);
1070
+ off(ownerDocument, "mousemove", this._delayedDragTouchMoveHandler);
1071
+ off(ownerDocument, "touchmove", this._delayedDragTouchMoveHandler);
1072
+ off(ownerDocument, "pointermove", this._delayedDragTouchMoveHandler);
1073
+ },
1074
+ _triggerDragStart: function _triggerDragStart(evt, touch) {
1075
+ touch = touch || evt.pointerType == "touch" && evt;
1076
+ if (!this.nativeDraggable || touch) {
1077
+ if (this.options.supportPointer) {
1078
+ on(document, "pointermove", this._onTouchMove);
1079
+ } else if (touch) {
1080
+ on(document, "touchmove", this._onTouchMove);
1081
+ } else {
1082
+ on(document, "mousemove", this._onTouchMove);
1083
+ }
1084
+ } else {
1085
+ on(dragEl, "dragend", this);
1086
+ on(rootEl, "dragstart", this._onDragStart);
1087
+ }
1088
+ try {
1089
+ if (document.selection) {
1090
+ _nextTick(function() {
1091
+ document.selection.empty();
1092
+ });
1093
+ } else {
1094
+ window.getSelection().removeAllRanges();
1095
+ }
1096
+ } catch (err) {
1097
+ }
1098
+ },
1099
+ _dragStarted: function _dragStarted(fallback, evt) {
1100
+ awaitingDragStarted = false;
1101
+ if (rootEl && dragEl) {
1102
+ pluginEvent2("dragStarted", this, {
1103
+ evt
1104
+ });
1105
+ if (this.nativeDraggable) {
1106
+ on(document, "dragover", _checkOutsideTargetEl);
1107
+ }
1108
+ var options = this.options;
1109
+ !fallback && toggleClass(dragEl, options.dragClass, false);
1110
+ toggleClass(dragEl, options.ghostClass, true);
1111
+ Sortable.active = this;
1112
+ fallback && this._appendGhost();
1113
+ _dispatchEvent({
1114
+ sortable: this,
1115
+ name: "start",
1116
+ originalEvent: evt
1117
+ });
1118
+ } else {
1119
+ this._nulling();
1120
+ }
1121
+ },
1122
+ _emulateDragOver: function _emulateDragOver() {
1123
+ if (touchEvt) {
1124
+ this._lastX = touchEvt.clientX;
1125
+ this._lastY = touchEvt.clientY;
1126
+ _hideGhostForTarget();
1127
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1128
+ var parent = target;
1129
+ while (target && target.shadowRoot) {
1130
+ target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1131
+ if (target === parent) break;
1132
+ parent = target;
1133
+ }
1134
+ dragEl.parentNode[expando]._isOutsideThisEl(target);
1135
+ if (parent) {
1136
+ do {
1137
+ if (parent[expando]) {
1138
+ var inserted = void 0;
1139
+ inserted = parent[expando]._onDragOver({
1140
+ clientX: touchEvt.clientX,
1141
+ clientY: touchEvt.clientY,
1142
+ target,
1143
+ rootEl: parent
1144
+ });
1145
+ if (inserted && !this.options.dragoverBubble) {
1146
+ break;
1147
+ }
1148
+ }
1149
+ target = parent;
1150
+ } while (parent = getParentOrHost(parent));
1151
+ }
1152
+ _unhideGhostForTarget();
1153
+ }
1154
+ },
1155
+ _onTouchMove: function _onTouchMove(evt) {
1156
+ if (tapEvt) {
1157
+ var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, ghostMatrix = ghostEl && matrix(ghostEl, true), scaleX = ghostEl && ghostMatrix && ghostMatrix.a, scaleY = ghostEl && ghostMatrix && ghostMatrix.d, relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
1158
+ if (!Sortable.active && !awaitingDragStarted) {
1159
+ if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
1160
+ return;
1161
+ }
1162
+ this._onDragStart(evt, true);
1163
+ }
1164
+ if (ghostEl) {
1165
+ if (ghostMatrix) {
1166
+ ghostMatrix.e += dx - (lastDx || 0);
1167
+ ghostMatrix.f += dy - (lastDy || 0);
1168
+ } else {
1169
+ ghostMatrix = {
1170
+ a: 1,
1171
+ b: 0,
1172
+ c: 0,
1173
+ d: 1,
1174
+ e: dx,
1175
+ f: dy
1176
+ };
1177
+ }
1178
+ var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
1179
+ css(ghostEl, "webkitTransform", cssMatrix);
1180
+ css(ghostEl, "mozTransform", cssMatrix);
1181
+ css(ghostEl, "msTransform", cssMatrix);
1182
+ css(ghostEl, "transform", cssMatrix);
1183
+ lastDx = dx;
1184
+ lastDy = dy;
1185
+ touchEvt = touch;
1186
+ }
1187
+ evt.cancelable && evt.preventDefault();
1188
+ }
1189
+ },
1190
+ _appendGhost: function _appendGhost() {
1191
+ if (!ghostEl) {
1192
+ var container = this.options.fallbackOnBody ? document.body : rootEl, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options;
1193
+ if (PositionGhostAbsolutely) {
1194
+ ghostRelativeParent = container;
1195
+ while (css(ghostRelativeParent, "position") === "static" && css(ghostRelativeParent, "transform") === "none" && ghostRelativeParent !== document) {
1196
+ ghostRelativeParent = ghostRelativeParent.parentNode;
1197
+ }
1198
+ if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
1199
+ if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
1200
+ rect.top += ghostRelativeParent.scrollTop;
1201
+ rect.left += ghostRelativeParent.scrollLeft;
1202
+ } else {
1203
+ ghostRelativeParent = getWindowScrollingElement();
1204
+ }
1205
+ ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
1206
+ }
1207
+ ghostEl = dragEl.cloneNode(true);
1208
+ toggleClass(ghostEl, options.ghostClass, false);
1209
+ toggleClass(ghostEl, options.fallbackClass, true);
1210
+ toggleClass(ghostEl, options.dragClass, true);
1211
+ css(ghostEl, "transition", "");
1212
+ css(ghostEl, "transform", "");
1213
+ css(ghostEl, "box-sizing", "border-box");
1214
+ css(ghostEl, "margin", 0);
1215
+ css(ghostEl, "top", rect.top);
1216
+ css(ghostEl, "left", rect.left);
1217
+ css(ghostEl, "width", rect.width);
1218
+ css(ghostEl, "height", rect.height);
1219
+ css(ghostEl, "opacity", "0.8");
1220
+ css(ghostEl, "position", PositionGhostAbsolutely ? "absolute" : "fixed");
1221
+ css(ghostEl, "zIndex", "100000");
1222
+ css(ghostEl, "pointerEvents", "none");
1223
+ Sortable.ghost = ghostEl;
1224
+ container.appendChild(ghostEl);
1225
+ css(ghostEl, "transform-origin", tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + "% " + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + "%");
1226
+ }
1227
+ },
1228
+ _onDragStart: function _onDragStart(evt, fallback) {
1229
+ var _this = this;
1230
+ var dataTransfer = evt.dataTransfer;
1231
+ var options = _this.options;
1232
+ pluginEvent2("dragStart", this, {
1233
+ evt
1234
+ });
1235
+ if (Sortable.eventCanceled) {
1236
+ this._onDrop();
1237
+ return;
1238
+ }
1239
+ pluginEvent2("setupClone", this);
1240
+ if (!Sortable.eventCanceled) {
1241
+ cloneEl = clone(dragEl);
1242
+ cloneEl.removeAttribute("id");
1243
+ cloneEl.draggable = false;
1244
+ cloneEl.style["will-change"] = "";
1245
+ this._hideClone();
1246
+ toggleClass(cloneEl, this.options.chosenClass, false);
1247
+ Sortable.clone = cloneEl;
1248
+ }
1249
+ _this.cloneId = _nextTick(function() {
1250
+ pluginEvent2("clone", _this);
1251
+ if (Sortable.eventCanceled) return;
1252
+ if (!_this.options.removeCloneOnHide) {
1253
+ rootEl.insertBefore(cloneEl, dragEl);
1254
+ }
1255
+ _this._hideClone();
1256
+ _dispatchEvent({
1257
+ sortable: _this,
1258
+ name: "clone"
1259
+ });
1260
+ });
1261
+ !fallback && toggleClass(dragEl, options.dragClass, true);
1262
+ if (fallback) {
1263
+ ignoreNextClick = true;
1264
+ _this._loopId = setInterval(_this._emulateDragOver, 50);
1265
+ } else {
1266
+ off(document, "mouseup", _this._onDrop);
1267
+ off(document, "touchend", _this._onDrop);
1268
+ off(document, "touchcancel", _this._onDrop);
1269
+ if (dataTransfer) {
1270
+ dataTransfer.effectAllowed = "move";
1271
+ options.setData && options.setData.call(_this, dataTransfer, dragEl);
1272
+ }
1273
+ on(document, "drop", _this);
1274
+ css(dragEl, "transform", "translateZ(0)");
1275
+ }
1276
+ awaitingDragStarted = true;
1277
+ _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
1278
+ on(document, "selectstart", _this);
1279
+ moved = true;
1280
+ window.getSelection().removeAllRanges();
1281
+ if (Safari) {
1282
+ css(document.body, "user-select", "none");
1283
+ }
1284
+ },
1285
+ // Returns true - if no further action is needed (either inserted or another condition)
1286
+ _onDragOver: function _onDragOver(evt) {
1287
+ var el = this.el, target = evt.target, dragRect, targetRect, revert, options = this.options, group = options.group, activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, vertical, _this = this, completedFired = false;
1288
+ if (_silent) return;
1289
+ function dragOverEvent(name, extra) {
1290
+ pluginEvent2(name, _this, _objectSpread2({
1291
+ evt,
1292
+ isOwner,
1293
+ axis: vertical ? "vertical" : "horizontal",
1294
+ revert,
1295
+ dragRect,
1296
+ targetRect,
1297
+ canSort,
1298
+ fromSortable,
1299
+ target,
1300
+ completed,
1301
+ onMove: function onMove(target2, after2) {
1302
+ return _onMove(rootEl, el, dragEl, dragRect, target2, getRect(target2), evt, after2);
1303
+ },
1304
+ changed
1305
+ }, extra));
1306
+ }
1307
+ function capture() {
1308
+ dragOverEvent("dragOverAnimationCapture");
1309
+ _this.captureAnimationState();
1310
+ if (_this !== fromSortable) {
1311
+ fromSortable.captureAnimationState();
1312
+ }
1313
+ }
1314
+ function completed(insertion) {
1315
+ dragOverEvent("dragOverCompleted", {
1316
+ insertion
1317
+ });
1318
+ if (insertion) {
1319
+ if (isOwner) {
1320
+ activeSortable._hideClone();
1321
+ } else {
1322
+ activeSortable._showClone(_this);
1323
+ }
1324
+ if (_this !== fromSortable) {
1325
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
1326
+ toggleClass(dragEl, options.ghostClass, true);
1327
+ }
1328
+ if (putSortable !== _this && _this !== Sortable.active) {
1329
+ putSortable = _this;
1330
+ } else if (_this === Sortable.active && putSortable) {
1331
+ putSortable = null;
1332
+ }
1333
+ if (fromSortable === _this) {
1334
+ _this._ignoreWhileAnimating = target;
1335
+ }
1336
+ _this.animateAll(function() {
1337
+ dragOverEvent("dragOverAnimationComplete");
1338
+ _this._ignoreWhileAnimating = null;
1339
+ });
1340
+ if (_this !== fromSortable) {
1341
+ fromSortable.animateAll();
1342
+ fromSortable._ignoreWhileAnimating = null;
1343
+ }
1344
+ }
1345
+ if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
1346
+ lastTarget = null;
1347
+ }
1348
+ if (!options.dragoverBubble && !evt.rootEl && target !== document) {
1349
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1350
+ !insertion && nearestEmptyInsertDetectEvent(evt);
1351
+ }
1352
+ !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
1353
+ return completedFired = true;
1354
+ }
1355
+ function changed() {
1356
+ newIndex = index(dragEl);
1357
+ newDraggableIndex = index(dragEl, options.draggable);
1358
+ _dispatchEvent({
1359
+ sortable: _this,
1360
+ name: "change",
1361
+ toEl: el,
1362
+ newIndex,
1363
+ newDraggableIndex,
1364
+ originalEvent: evt
1365
+ });
1366
+ }
1367
+ if (evt.preventDefault !== void 0) {
1368
+ evt.cancelable && evt.preventDefault();
1369
+ }
1370
+ target = closest(target, options.draggable, el, true);
1371
+ dragOverEvent("dragOver");
1372
+ if (Sortable.eventCanceled) return completedFired;
1373
+ if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
1374
+ return completed(false);
1375
+ }
1376
+ ignoreNextClick = false;
1377
+ if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
1378
+ vertical = this._getDirection(evt, target) === "vertical";
1379
+ dragRect = getRect(dragEl);
1380
+ dragOverEvent("dragOverValid");
1381
+ if (Sortable.eventCanceled) return completedFired;
1382
+ if (revert) {
1383
+ parentEl = rootEl;
1384
+ capture();
1385
+ this._hideClone();
1386
+ dragOverEvent("revert");
1387
+ if (!Sortable.eventCanceled) {
1388
+ if (nextEl) {
1389
+ rootEl.insertBefore(dragEl, nextEl);
1390
+ } else {
1391
+ rootEl.appendChild(dragEl);
1392
+ }
1393
+ }
1394
+ return completed(true);
1395
+ }
1396
+ var elLastChild = lastChild(el, options.draggable);
1397
+ if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
1398
+ if (elLastChild === dragEl) {
1399
+ return completed(false);
1400
+ }
1401
+ if (elLastChild && el === evt.target) {
1402
+ target = elLastChild;
1403
+ }
1404
+ if (target) {
1405
+ targetRect = getRect(target);
1406
+ }
1407
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
1408
+ capture();
1409
+ if (elLastChild && elLastChild.nextSibling) {
1410
+ el.insertBefore(dragEl, elLastChild.nextSibling);
1411
+ } else {
1412
+ el.appendChild(dragEl);
1413
+ }
1414
+ parentEl = el;
1415
+ changed();
1416
+ return completed(true);
1417
+ }
1418
+ } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
1419
+ var firstChild = getChild(el, 0, options, true);
1420
+ if (firstChild === dragEl) {
1421
+ return completed(false);
1422
+ }
1423
+ target = firstChild;
1424
+ targetRect = getRect(target);
1425
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
1426
+ capture();
1427
+ el.insertBefore(dragEl, firstChild);
1428
+ parentEl = el;
1429
+ changed();
1430
+ return completed(true);
1431
+ }
1432
+ } else if (target.parentNode === el) {
1433
+ targetRect = getRect(target);
1434
+ var direction = 0, targetBeforeFirstSwap, differentLevel = dragEl.parentNode !== el, differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), side1 = vertical ? "top" : "left", scrolledPastTop = isScrolledPast(target, "top", "top") || isScrolledPast(dragEl, "top", "top"), scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
1435
+ if (lastTarget !== target) {
1436
+ targetBeforeFirstSwap = targetRect[side1];
1437
+ pastFirstInvertThresh = false;
1438
+ isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
1439
+ }
1440
+ direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
1441
+ var sibling;
1442
+ if (direction !== 0) {
1443
+ var dragIndex = index(dragEl);
1444
+ do {
1445
+ dragIndex -= direction;
1446
+ sibling = parentEl.children[dragIndex];
1447
+ } while (sibling && (css(sibling, "display") === "none" || sibling === ghostEl));
1448
+ }
1449
+ if (direction === 0 || sibling === target) {
1450
+ return completed(false);
1451
+ }
1452
+ lastTarget = target;
1453
+ lastDirection = direction;
1454
+ var nextSibling = target.nextElementSibling, after = false;
1455
+ after = direction === 1;
1456
+ var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
1457
+ if (moveVector !== false) {
1458
+ if (moveVector === 1 || moveVector === -1) {
1459
+ after = moveVector === 1;
1460
+ }
1461
+ _silent = true;
1462
+ setTimeout(_unsilent, 30);
1463
+ capture();
1464
+ if (after && !nextSibling) {
1465
+ el.appendChild(dragEl);
1466
+ } else {
1467
+ target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
1468
+ }
1469
+ if (scrolledPastTop) {
1470
+ scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
1471
+ }
1472
+ parentEl = dragEl.parentNode;
1473
+ if (targetBeforeFirstSwap !== void 0 && !isCircumstantialInvert) {
1474
+ targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
1475
+ }
1476
+ changed();
1477
+ return completed(true);
1478
+ }
1479
+ }
1480
+ if (el.contains(dragEl)) {
1481
+ return completed(false);
1482
+ }
1483
+ }
1484
+ return false;
1485
+ },
1486
+ _ignoreWhileAnimating: null,
1487
+ _offMoveEvents: function _offMoveEvents() {
1488
+ off(document, "mousemove", this._onTouchMove);
1489
+ off(document, "touchmove", this._onTouchMove);
1490
+ off(document, "pointermove", this._onTouchMove);
1491
+ off(document, "dragover", nearestEmptyInsertDetectEvent);
1492
+ off(document, "mousemove", nearestEmptyInsertDetectEvent);
1493
+ off(document, "touchmove", nearestEmptyInsertDetectEvent);
1494
+ },
1495
+ _offUpEvents: function _offUpEvents() {
1496
+ var ownerDocument = this.el.ownerDocument;
1497
+ off(ownerDocument, "mouseup", this._onDrop);
1498
+ off(ownerDocument, "touchend", this._onDrop);
1499
+ off(ownerDocument, "pointerup", this._onDrop);
1500
+ off(ownerDocument, "pointercancel", this._onDrop);
1501
+ off(ownerDocument, "touchcancel", this._onDrop);
1502
+ off(document, "selectstart", this);
1503
+ },
1504
+ _onDrop: function _onDrop(evt) {
1505
+ var el = this.el, options = this.options;
1506
+ newIndex = index(dragEl);
1507
+ newDraggableIndex = index(dragEl, options.draggable);
1508
+ pluginEvent2("drop", this, {
1509
+ evt
1510
+ });
1511
+ parentEl = dragEl && dragEl.parentNode;
1512
+ newIndex = index(dragEl);
1513
+ newDraggableIndex = index(dragEl, options.draggable);
1514
+ if (Sortable.eventCanceled) {
1515
+ this._nulling();
1516
+ return;
1517
+ }
1518
+ awaitingDragStarted = false;
1519
+ isCircumstantialInvert = false;
1520
+ pastFirstInvertThresh = false;
1521
+ clearInterval(this._loopId);
1522
+ clearTimeout(this._dragStartTimer);
1523
+ _cancelNextTick(this.cloneId);
1524
+ _cancelNextTick(this._dragStartId);
1525
+ if (this.nativeDraggable) {
1526
+ off(document, "drop", this);
1527
+ off(el, "dragstart", this._onDragStart);
1528
+ }
1529
+ this._offMoveEvents();
1530
+ this._offUpEvents();
1531
+ if (Safari) {
1532
+ css(document.body, "user-select", "");
1533
+ }
1534
+ css(dragEl, "transform", "");
1535
+ if (evt) {
1536
+ if (moved) {
1537
+ evt.cancelable && evt.preventDefault();
1538
+ !options.dropBubble && evt.stopPropagation();
1539
+ }
1540
+ ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
1541
+ if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== "clone") {
1542
+ cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
1543
+ }
1544
+ if (dragEl) {
1545
+ if (this.nativeDraggable) {
1546
+ off(dragEl, "dragend", this);
1547
+ }
1548
+ _disableDraggable(dragEl);
1549
+ dragEl.style["will-change"] = "";
1550
+ if (moved && !awaitingDragStarted) {
1551
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
1552
+ }
1553
+ toggleClass(dragEl, this.options.chosenClass, false);
1554
+ _dispatchEvent({
1555
+ sortable: this,
1556
+ name: "unchoose",
1557
+ toEl: parentEl,
1558
+ newIndex: null,
1559
+ newDraggableIndex: null,
1560
+ originalEvent: evt
1561
+ });
1562
+ if (rootEl !== parentEl) {
1563
+ if (newIndex >= 0) {
1564
+ _dispatchEvent({
1565
+ rootEl: parentEl,
1566
+ name: "add",
1567
+ toEl: parentEl,
1568
+ fromEl: rootEl,
1569
+ originalEvent: evt
1570
+ });
1571
+ _dispatchEvent({
1572
+ sortable: this,
1573
+ name: "remove",
1574
+ toEl: parentEl,
1575
+ originalEvent: evt
1576
+ });
1577
+ _dispatchEvent({
1578
+ rootEl: parentEl,
1579
+ name: "sort",
1580
+ toEl: parentEl,
1581
+ fromEl: rootEl,
1582
+ originalEvent: evt
1583
+ });
1584
+ _dispatchEvent({
1585
+ sortable: this,
1586
+ name: "sort",
1587
+ toEl: parentEl,
1588
+ originalEvent: evt
1589
+ });
1590
+ }
1591
+ putSortable && putSortable.save();
1592
+ } else {
1593
+ if (newIndex !== oldIndex) {
1594
+ if (newIndex >= 0) {
1595
+ _dispatchEvent({
1596
+ sortable: this,
1597
+ name: "update",
1598
+ toEl: parentEl,
1599
+ originalEvent: evt
1600
+ });
1601
+ _dispatchEvent({
1602
+ sortable: this,
1603
+ name: "sort",
1604
+ toEl: parentEl,
1605
+ originalEvent: evt
1606
+ });
1607
+ }
1608
+ }
1609
+ }
1610
+ if (Sortable.active) {
1611
+ if (newIndex == null || newIndex === -1) {
1612
+ newIndex = oldIndex;
1613
+ newDraggableIndex = oldDraggableIndex;
1614
+ }
1615
+ _dispatchEvent({
1616
+ sortable: this,
1617
+ name: "end",
1618
+ toEl: parentEl,
1619
+ originalEvent: evt
1620
+ });
1621
+ this.save();
1622
+ }
1623
+ }
1624
+ }
1625
+ this._nulling();
1626
+ },
1627
+ _nulling: function _nulling() {
1628
+ pluginEvent2("nulling", this);
1629
+ rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
1630
+ savedInputChecked.forEach(function(el) {
1631
+ el.checked = true;
1632
+ });
1633
+ savedInputChecked.length = lastDx = lastDy = 0;
1634
+ },
1635
+ handleEvent: function handleEvent(evt) {
1636
+ switch (evt.type) {
1637
+ case "drop":
1638
+ case "dragend":
1639
+ this._onDrop(evt);
1640
+ break;
1641
+ case "dragenter":
1642
+ case "dragover":
1643
+ if (dragEl) {
1644
+ this._onDragOver(evt);
1645
+ _globalDragOver(evt);
1646
+ }
1647
+ break;
1648
+ case "selectstart":
1649
+ evt.preventDefault();
1650
+ break;
1651
+ }
1652
+ },
1653
+ /**
1654
+ * Serializes the item into an array of string.
1655
+ * @returns {String[]}
1656
+ */
1657
+ toArray: function toArray() {
1658
+ var order = [], el, children = this.el.children, i = 0, n = children.length, options = this.options;
1659
+ for (; i < n; i++) {
1660
+ el = children[i];
1661
+ if (closest(el, options.draggable, this.el, false)) {
1662
+ order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
1663
+ }
1664
+ }
1665
+ return order;
1666
+ },
1667
+ /**
1668
+ * Sorts the elements according to the array.
1669
+ * @param {String[]} order order of the items
1670
+ */
1671
+ sort: function sort(order, useAnimation) {
1672
+ var items = {}, rootEl2 = this.el;
1673
+ this.toArray().forEach(function(id, i) {
1674
+ var el = rootEl2.children[i];
1675
+ if (closest(el, this.options.draggable, rootEl2, false)) {
1676
+ items[id] = el;
1677
+ }
1678
+ }, this);
1679
+ useAnimation && this.captureAnimationState();
1680
+ order.forEach(function(id) {
1681
+ if (items[id]) {
1682
+ rootEl2.removeChild(items[id]);
1683
+ rootEl2.appendChild(items[id]);
1684
+ }
1685
+ });
1686
+ useAnimation && this.animateAll();
1687
+ },
1688
+ /**
1689
+ * Save the current sorting
1690
+ */
1691
+ save: function save() {
1692
+ var store = this.options.store;
1693
+ store && store.set && store.set(this);
1694
+ },
1695
+ /**
1696
+ * 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.
1697
+ * @param {HTMLElement} el
1698
+ * @param {String} [selector] default: `options.draggable`
1699
+ * @returns {HTMLElement|null}
1700
+ */
1701
+ closest: function closest$1(el, selector) {
1702
+ return closest(el, selector || this.options.draggable, this.el, false);
1703
+ },
1704
+ /**
1705
+ * Set/get option
1706
+ * @param {string} name
1707
+ * @param {*} [value]
1708
+ * @returns {*}
1709
+ */
1710
+ option: function option(name, value) {
1711
+ var options = this.options;
1712
+ if (value === void 0) {
1713
+ return options[name];
1714
+ } else {
1715
+ var modifiedValue = PluginManager.modifyOption(this, name, value);
1716
+ if (typeof modifiedValue !== "undefined") {
1717
+ options[name] = modifiedValue;
1718
+ } else {
1719
+ options[name] = value;
1720
+ }
1721
+ if (name === "group") {
1722
+ _prepareGroup(options);
1723
+ }
1724
+ }
1725
+ },
1726
+ /**
1727
+ * Destroy
1728
+ */
1729
+ destroy: function destroy() {
1730
+ pluginEvent2("destroy", this);
1731
+ var el = this.el;
1732
+ el[expando] = null;
1733
+ off(el, "mousedown", this._onTapStart);
1734
+ off(el, "touchstart", this._onTapStart);
1735
+ off(el, "pointerdown", this._onTapStart);
1736
+ if (this.nativeDraggable) {
1737
+ off(el, "dragover", this);
1738
+ off(el, "dragenter", this);
1739
+ }
1740
+ Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function(el2) {
1741
+ el2.removeAttribute("draggable");
1742
+ });
1743
+ this._onDrop();
1744
+ this._disableDelayedDragEvents();
1745
+ sortables.splice(sortables.indexOf(this.el), 1);
1746
+ this.el = el = null;
1747
+ },
1748
+ _hideClone: function _hideClone() {
1749
+ if (!cloneHidden) {
1750
+ pluginEvent2("hideClone", this);
1751
+ if (Sortable.eventCanceled) return;
1752
+ css(cloneEl, "display", "none");
1753
+ if (this.options.removeCloneOnHide && cloneEl.parentNode) {
1754
+ cloneEl.parentNode.removeChild(cloneEl);
1755
+ }
1756
+ cloneHidden = true;
1757
+ }
1758
+ },
1759
+ _showClone: function _showClone(putSortable2) {
1760
+ if (putSortable2.lastPutMode !== "clone") {
1761
+ this._hideClone();
1762
+ return;
1763
+ }
1764
+ if (cloneHidden) {
1765
+ pluginEvent2("showClone", this);
1766
+ if (Sortable.eventCanceled) return;
1767
+ if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
1768
+ rootEl.insertBefore(cloneEl, dragEl);
1769
+ } else if (nextEl) {
1770
+ rootEl.insertBefore(cloneEl, nextEl);
1771
+ } else {
1772
+ rootEl.appendChild(cloneEl);
1773
+ }
1774
+ if (this.options.group.revertClone) {
1775
+ this.animate(dragEl, cloneEl);
1776
+ }
1777
+ css(cloneEl, "display", "");
1778
+ cloneHidden = false;
1779
+ }
1780
+ }
1781
+ };
1782
+ function _globalDragOver(evt) {
1783
+ if (evt.dataTransfer) {
1784
+ evt.dataTransfer.dropEffect = "move";
1785
+ }
1786
+ evt.cancelable && evt.preventDefault();
1787
+ }
1788
+ function _onMove(fromEl, toEl, dragEl2, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
1789
+ var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, retVal;
1790
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
1791
+ evt = new CustomEvent("move", {
1792
+ bubbles: true,
1793
+ cancelable: true
1794
+ });
1795
+ } else {
1796
+ evt = document.createEvent("Event");
1797
+ evt.initEvent("move", true, true);
1798
+ }
1799
+ evt.to = toEl;
1800
+ evt.from = fromEl;
1801
+ evt.dragged = dragEl2;
1802
+ evt.draggedRect = dragRect;
1803
+ evt.related = targetEl || toEl;
1804
+ evt.relatedRect = targetRect || getRect(toEl);
1805
+ evt.willInsertAfter = willInsertAfter;
1806
+ evt.originalEvent = originalEvent;
1807
+ fromEl.dispatchEvent(evt);
1808
+ if (onMoveFn) {
1809
+ retVal = onMoveFn.call(sortable, evt, originalEvent);
1810
+ }
1811
+ return retVal;
1812
+ }
1813
+ function _disableDraggable(el) {
1814
+ el.draggable = false;
1815
+ }
1816
+ function _unsilent() {
1817
+ _silent = false;
1818
+ }
1819
+ function _ghostIsFirst(evt, vertical, sortable) {
1820
+ var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
1821
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
1822
+ var spacer = 10;
1823
+ return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
1824
+ }
1825
+ function _ghostIsLast(evt, vertical, sortable) {
1826
+ var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
1827
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
1828
+ var spacer = 10;
1829
+ return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
1830
+ }
1831
+ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
1832
+ var mouseOnAxis = vertical ? evt.clientY : evt.clientX, targetLength = vertical ? targetRect.height : targetRect.width, targetS1 = vertical ? targetRect.top : targetRect.left, targetS2 = vertical ? targetRect.bottom : targetRect.right, invert = false;
1833
+ if (!invertSwap) {
1834
+ if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
1835
+ if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
1836
+ pastFirstInvertThresh = true;
1837
+ }
1838
+ if (!pastFirstInvertThresh) {
1839
+ if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance : mouseOnAxis > targetS2 - targetMoveDistance) {
1840
+ return -lastDirection;
1841
+ }
1842
+ } else {
1843
+ invert = true;
1844
+ }
1845
+ } else {
1846
+ if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
1847
+ return _getInsertDirection(target);
1848
+ }
1849
+ }
1850
+ }
1851
+ invert = invert || invertSwap;
1852
+ if (invert) {
1853
+ if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
1854
+ return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
1855
+ }
1856
+ }
1857
+ return 0;
1858
+ }
1859
+ function _getInsertDirection(target) {
1860
+ if (index(dragEl) < index(target)) {
1861
+ return 1;
1862
+ } else {
1863
+ return -1;
1864
+ }
1865
+ }
1866
+ function _generateId(el) {
1867
+ var str = el.tagName + el.className + el.src + el.href + el.textContent, i = str.length, sum = 0;
1868
+ while (i--) {
1869
+ sum += str.charCodeAt(i);
1870
+ }
1871
+ return sum.toString(36);
1872
+ }
1873
+ function _saveInputCheckedState(root) {
1874
+ savedInputChecked.length = 0;
1875
+ var inputs = root.getElementsByTagName("input");
1876
+ var idx = inputs.length;
1877
+ while (idx--) {
1878
+ var el = inputs[idx];
1879
+ el.checked && savedInputChecked.push(el);
1880
+ }
1881
+ }
1882
+ function _nextTick(fn) {
1883
+ return setTimeout(fn, 0);
1884
+ }
1885
+ function _cancelNextTick(id) {
1886
+ return clearTimeout(id);
1887
+ }
1888
+ if (documentExists) {
1889
+ on(document, "touchmove", function(evt) {
1890
+ if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
1891
+ evt.preventDefault();
1892
+ }
1893
+ });
1894
+ }
1895
+ Sortable.utils = {
1896
+ on,
1897
+ off,
1898
+ css,
1899
+ find,
1900
+ is: function is(el, selector) {
1901
+ return !!closest(el, selector, el, false);
1902
+ },
1903
+ extend,
1904
+ throttle,
1905
+ closest,
1906
+ toggleClass,
1907
+ clone,
1908
+ index,
1909
+ nextTick: _nextTick,
1910
+ cancelNextTick: _cancelNextTick,
1911
+ detectDirection: _detectDirection,
1912
+ getChild,
1913
+ expando
1914
+ };
1915
+ Sortable.get = function(element) {
1916
+ return element[expando];
1917
+ };
1918
+ Sortable.mount = function() {
1919
+ for (var _len = arguments.length, plugins2 = new Array(_len), _key = 0; _key < _len; _key++) {
1920
+ plugins2[_key] = arguments[_key];
1921
+ }
1922
+ if (plugins2[0].constructor === Array) plugins2 = plugins2[0];
1923
+ plugins2.forEach(function(plugin) {
1924
+ if (!plugin.prototype || !plugin.prototype.constructor) {
1925
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
1926
+ }
1927
+ if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
1928
+ PluginManager.mount(plugin);
1929
+ });
1930
+ };
1931
+ Sortable.create = function(el, options) {
1932
+ return new Sortable(el, options);
1933
+ };
1934
+ Sortable.version = version;
1935
+ var autoScrolls = [], scrollEl, scrollRootEl, scrolling = false, lastAutoScrollX, lastAutoScrollY, touchEvt$1, pointerElemChangedInterval;
1936
+ function AutoScrollPlugin() {
1937
+ function AutoScroll() {
1938
+ this.defaults = {
1939
+ scroll: true,
1940
+ forceAutoScrollFallback: false,
1941
+ scrollSensitivity: 30,
1942
+ scrollSpeed: 10,
1943
+ bubbleScroll: true
1944
+ };
1945
+ for (var fn in this) {
1946
+ if (fn.charAt(0) === "_" && typeof this[fn] === "function") {
1947
+ this[fn] = this[fn].bind(this);
1948
+ }
1949
+ }
1950
+ }
1951
+ AutoScroll.prototype = {
1952
+ dragStarted: function dragStarted(_ref) {
1953
+ var originalEvent = _ref.originalEvent;
1954
+ if (this.sortable.nativeDraggable) {
1955
+ on(document, "dragover", this._handleAutoScroll);
1956
+ } else {
1957
+ if (this.options.supportPointer) {
1958
+ on(document, "pointermove", this._handleFallbackAutoScroll);
1959
+ } else if (originalEvent.touches) {
1960
+ on(document, "touchmove", this._handleFallbackAutoScroll);
1961
+ } else {
1962
+ on(document, "mousemove", this._handleFallbackAutoScroll);
1963
+ }
1964
+ }
1965
+ },
1966
+ dragOverCompleted: function dragOverCompleted(_ref2) {
1967
+ var originalEvent = _ref2.originalEvent;
1968
+ if (!this.options.dragOverBubble && !originalEvent.rootEl) {
1969
+ this._handleAutoScroll(originalEvent);
1970
+ }
1971
+ },
1972
+ drop: function drop3() {
1973
+ if (this.sortable.nativeDraggable) {
1974
+ off(document, "dragover", this._handleAutoScroll);
1975
+ } else {
1976
+ off(document, "pointermove", this._handleFallbackAutoScroll);
1977
+ off(document, "touchmove", this._handleFallbackAutoScroll);
1978
+ off(document, "mousemove", this._handleFallbackAutoScroll);
1979
+ }
1980
+ clearPointerElemChangedInterval();
1981
+ clearAutoScrolls();
1982
+ cancelThrottle();
1983
+ },
1984
+ nulling: function nulling() {
1985
+ touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
1986
+ autoScrolls.length = 0;
1987
+ },
1988
+ _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
1989
+ this._handleAutoScroll(evt, true);
1990
+ },
1991
+ _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
1992
+ var _this = this;
1993
+ var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, elem = document.elementFromPoint(x, y);
1994
+ touchEvt$1 = evt;
1995
+ if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
1996
+ autoScroll(evt, this.options, elem, fallback);
1997
+ var ogElemScroller = getParentAutoScrollElement(elem, true);
1998
+ if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
1999
+ pointerElemChangedInterval && clearPointerElemChangedInterval();
2000
+ pointerElemChangedInterval = setInterval(function() {
2001
+ var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
2002
+ if (newElem !== ogElemScroller) {
2003
+ ogElemScroller = newElem;
2004
+ clearAutoScrolls();
2005
+ }
2006
+ autoScroll(evt, _this.options, newElem, fallback);
2007
+ }, 10);
2008
+ lastAutoScrollX = x;
2009
+ lastAutoScrollY = y;
2010
+ }
2011
+ } else {
2012
+ if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
2013
+ clearAutoScrolls();
2014
+ return;
2015
+ }
2016
+ autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
2017
+ }
2018
+ }
2019
+ };
2020
+ return _extends(AutoScroll, {
2021
+ pluginName: "scroll",
2022
+ initializeByDefault: true
2023
+ });
2024
+ }
2025
+ function clearAutoScrolls() {
2026
+ autoScrolls.forEach(function(autoScroll2) {
2027
+ clearInterval(autoScroll2.pid);
2028
+ });
2029
+ autoScrolls = [];
2030
+ }
2031
+ function clearPointerElemChangedInterval() {
2032
+ clearInterval(pointerElemChangedInterval);
2033
+ }
2034
+ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
2035
+ if (!options.scroll) return;
2036
+ var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, sens = options.scrollSensitivity, speed = options.scrollSpeed, winScroller = getWindowScrollingElement();
2037
+ var scrollThisInstance = false, scrollCustomFn;
2038
+ if (scrollRootEl !== rootEl2) {
2039
+ scrollRootEl = rootEl2;
2040
+ clearAutoScrolls();
2041
+ scrollEl = options.scroll;
2042
+ scrollCustomFn = options.scrollFn;
2043
+ if (scrollEl === true) {
2044
+ scrollEl = getParentAutoScrollElement(rootEl2, true);
2045
+ }
2046
+ }
2047
+ var layersOut = 0;
2048
+ var currentParent = scrollEl;
2049
+ do {
2050
+ var el = currentParent, rect = getRect(el), top = rect.top, bottom = rect.bottom, left = rect.left, right = rect.right, width = rect.width, height = rect.height, canScrollX = void 0, canScrollY = void 0, scrollWidth = el.scrollWidth, scrollHeight = el.scrollHeight, elCSS = css(el), scrollPosX = el.scrollLeft, scrollPosY = el.scrollTop;
2051
+ if (el === winScroller) {
2052
+ canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll" || elCSS.overflowX === "visible");
2053
+ canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll" || elCSS.overflowY === "visible");
2054
+ } else {
2055
+ canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll");
2056
+ canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll");
2057
+ }
2058
+ var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
2059
+ var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
2060
+ if (!autoScrolls[layersOut]) {
2061
+ for (var i = 0; i <= layersOut; i++) {
2062
+ if (!autoScrolls[i]) {
2063
+ autoScrolls[i] = {};
2064
+ }
2065
+ }
2066
+ }
2067
+ if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
2068
+ autoScrolls[layersOut].el = el;
2069
+ autoScrolls[layersOut].vx = vx;
2070
+ autoScrolls[layersOut].vy = vy;
2071
+ clearInterval(autoScrolls[layersOut].pid);
2072
+ if (vx != 0 || vy != 0) {
2073
+ scrollThisInstance = true;
2074
+ autoScrolls[layersOut].pid = setInterval((function() {
2075
+ if (isFallback && this.layer === 0) {
2076
+ Sortable.active._onTouchMove(touchEvt$1);
2077
+ }
2078
+ var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
2079
+ var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
2080
+ if (typeof scrollCustomFn === "function") {
2081
+ if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== "continue") {
2082
+ return;
2083
+ }
2084
+ }
2085
+ scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2086
+ }).bind({
2087
+ layer: layersOut
2088
+ }), 24);
2089
+ }
2090
+ }
2091
+ layersOut++;
2092
+ } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
2093
+ scrolling = scrollThisInstance;
2094
+ }, 30);
2095
+ var drop = function drop2(_ref) {
2096
+ var originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, dragEl2 = _ref.dragEl, activeSortable = _ref.activeSortable, dispatchSortableEvent = _ref.dispatchSortableEvent, hideGhostForTarget = _ref.hideGhostForTarget, unhideGhostForTarget = _ref.unhideGhostForTarget;
2097
+ if (!originalEvent) return;
2098
+ var toSortable = putSortable2 || activeSortable;
2099
+ hideGhostForTarget();
2100
+ var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
2101
+ var target = document.elementFromPoint(touch.clientX, touch.clientY);
2102
+ unhideGhostForTarget();
2103
+ if (toSortable && !toSortable.el.contains(target)) {
2104
+ dispatchSortableEvent("spill");
2105
+ this.onSpill({
2106
+ dragEl: dragEl2,
2107
+ putSortable: putSortable2
2108
+ });
2109
+ }
2110
+ };
2111
+ function Revert() {
2112
+ }
2113
+ Revert.prototype = {
2114
+ startIndex: null,
2115
+ dragStart: function dragStart(_ref2) {
2116
+ var oldDraggableIndex2 = _ref2.oldDraggableIndex;
2117
+ this.startIndex = oldDraggableIndex2;
2118
+ },
2119
+ onSpill: function onSpill(_ref3) {
2120
+ var dragEl2 = _ref3.dragEl, putSortable2 = _ref3.putSortable;
2121
+ this.sortable.captureAnimationState();
2122
+ if (putSortable2) {
2123
+ putSortable2.captureAnimationState();
2124
+ }
2125
+ var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
2126
+ if (nextSibling) {
2127
+ this.sortable.el.insertBefore(dragEl2, nextSibling);
2128
+ } else {
2129
+ this.sortable.el.appendChild(dragEl2);
2130
+ }
2131
+ this.sortable.animateAll();
2132
+ if (putSortable2) {
2133
+ putSortable2.animateAll();
2134
+ }
2135
+ },
2136
+ drop
2137
+ };
2138
+ _extends(Revert, {
2139
+ pluginName: "revertOnSpill"
2140
+ });
2141
+ function Remove() {
2142
+ }
2143
+ Remove.prototype = {
2144
+ onSpill: function onSpill2(_ref4) {
2145
+ var dragEl2 = _ref4.dragEl, putSortable2 = _ref4.putSortable;
2146
+ var parentSortable = putSortable2 || this.sortable;
2147
+ parentSortable.captureAnimationState();
2148
+ dragEl2.parentNode && dragEl2.parentNode.removeChild(dragEl2);
2149
+ parentSortable.animateAll();
2150
+ },
2151
+ drop
2152
+ };
2153
+ _extends(Remove, {
2154
+ pluginName: "removeOnSpill"
2155
+ });
2156
+ Sortable.mount(new AutoScrollPlugin());
2157
+ Sortable.mount(Remove, Revert);
2158
+ export {
2159
+ Sortable as S
2160
+ };