UNPKG

@vdnd/v3

Version:

Easy used vue drag and drop component library.

1 lines 63.9 kB
var Vdnd3=function(e,t){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)}function o(e,t,n){return t=v(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function u(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=O(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function l(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},c.apply(null,arguments)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function y(){y=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),u=new x(r||[]);return o(a,"_invoke",{value:T(e,n,u)}),a}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var d="suspendedStart",f="suspendedYield",p="executing",h="completed",g={};function m(){}function b(){}function E(){}var w={};l(w,a,(function(){return this}));var D=Object.getPrototypeOf,O=D&&D(D(j([])));O&&O!==n&&r.call(O,a)&&(w=O);var L=E.prototype=m.prototype=Object.create(w);function S(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,i,a,u){var s=v(e[o],e,i);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(c).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function T(t,n,r){var o=d;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===h){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var s=P(u,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var l=v(t,n,r);if("normal"===l.type){if(o=r.done?h:f,l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=h,r.method="throw",r.arg=l.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=v(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function j(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=E,o(L,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:b,configurable:!0}),b.displayName=l(E,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,l(e,s,"GeneratorFunction")),e.prototype=Object.create(L),e},t.awrap=function(e){return{__await:e}},S(k.prototype),l(k.prototype,u,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new k(c(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(L),l(L,s,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=j,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function b(e,t,n,r){var o=c(v(e.prototype),t,n);return"function"==typeof o?function(e){return o.apply(n,e)}:o}function E(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function D(e){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D(e)}function O(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}var L=u((function e(t){i(this,e),this.dnd=t})),S=function(){return u((function e(){i(this,e),l(this,"_canceled",!1)}),[{key:"cancelable",get:function(){return this.constructor.cancelable}},{key:"type",get:function(){return this.constructor.type}},{key:"cancel",value:function(){this.cancelable&&(this._canceled=!0)}},{key:"canceled",value:function(){return this._canceled}}])}();l(S,"type","event"),l(S,"cancelable",!1);var k=function(e){function t(e,n,r,a){var u;return i(this,t),(u=o(this,t)).source=e,u.mirror=n,u.container=r,u.dndEvent=a,u}return d(t,e),u(t)}(S),T=function(e){function t(){return i(this,t),o(this,t,arguments)}return d(t,e),u(t)}(k);l(T,"type","mirror:created");var P=function(e){function t(){return i(this,t),o(this,t,arguments)}return d(t,e),u(t)}(k);l(P,"type","mirror:attached");var M=function(e){function t(){return i(this,t),o(this,t,arguments)}return d(t,e),u(t)}(k);l(M,"type","mirror:move");var A=function(e){function t(){return i(this,t),o(this,t,arguments)}return d(t,e),u(t)}(k);l(A,"type","mirror:detached");var x=function(){return u((function e(){i(this,e),l(this,"callbacks",{}),l(this,"onceCallbacks",new Set)}),[{key:"on",value:function(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}},{key:"once",value:function(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this.onceCallbacks.add(t),this}},{key:"off",value:function(e,t){if(!this.callbacks[e])return this;var n=this.callbacks[e],r=n.indexOf(t);return r>=0&&n.splice(r,1),this.onceCallbacks.delete(t),this}},{key:"emit",value:function(e,t){if(!this.callbacks[e])return this;for(var n=E(this.callbacks[e]),r=[],o=0;o<=n.length-1;o++){var i=n[o];try{i(t)}catch(e){r.push(e)}this.onceCallbacks.has(i)&&this.off(e,i)}return r.length&&(console.error("[vdnd error]: caught errors while emitting '".concat(e,"':")),r.forEach((function(e){return console.error(e)}))),this}},{key:"destroy",value:function(){this.callbacks={},this.onceCallbacks.clear()}}])}(),j=function(){};function z(e){return Array.isArray(e)?e:[e]}function I(e){return null!=e}function Y(e){if(null===e)return"null";if(void 0===e)return"undefined";if("string"==typeof e)return"string";if("number"==typeof e)return"number";if("boolean"==typeof e)return"boolean";if("symbol"===D(e))return"symbol";if("bigint"==typeof e)return"bigint";var t=Object.prototype.toString.call(e);return t.slice(8,t.length-1)}var R=["mirrorOffset","initialX","initialY"],X=["lastMovedX","lastMovedY"],N=["source"],C=["dragEvent","sourceRect","options"],_=["mirror","source","options"],F=["mirror","mirrorClasses"],$=["mirror","source"],B=["mirror","dragEvent","mirrorOffset","initialY","initialX","scrollOffset","options","lastMovedX","lastMovedY"],U={className:"dnd-mirror",create:function(e){return e.source.cloneNode(!0)},appendTo:function(e){return e.source.parentNode||document.body},constrainDimensions:!1},H=function(e){function t(e){var n;return i(this,t),l(n=o(this,t,[e]),"scrollOffset",{x:0,y:0}),l(n,"initialScrollOffset",{x:window.scrollX,y:window.scrollY}),l(n,"lastMovedX",0),l(n,"lastMovedY",0),l(n,"mirrorOffset",{top:0,left:0}),l(n,"initialX",0),l(n,"initialY",0),l(n,"mirror",null),l(n,"onDragStart",function(){var e,t=(e=y().mark((function e(t){var r,o,i,a,u,s;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"ontouchstart"in window&&document.addEventListener("scroll",n.onScroll,!0),n.initialScrollOffset={x:window.scrollX,y:window.scrollY},r=t.source,o=t.container,i=n.getAppendableContainer({source:r,event:t})||document.body,a=n.options.create,n.mirror=a({source:r,event:t}),u=new T(r,n.mirror,o,t),n.dnd.emit("mirror:created",u),s=new P(r,n.mirror,o,t),i.appendChild(n.mirror),n.dnd.emit("mirror:attached",s);case 11:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function u(e){r(a,o,i,u,s,"next",e)}function s(e){r(a,o,i,u,s,"throw",e)}u(void 0)}))});return function(e){return t.apply(this,arguments)}}()),l(n,"onDragMove",(function(e){if(n.mirror){var t=e.source,r=e.container,o=new M(t,n.mirror,r,e);n.dnd.emit("mirror:move",o)}})),l(n,"onDragEnd",(function(e){if("ontouchstart"in window&&document.removeEventListener("scroll",n.onScroll,!0),n.initialScrollOffset={x:0,y:0},n.scrollOffset={x:0,y:0},n.mirror){var t=e.source,r=e.container,o=new A(t,n.mirror,r,e);n.mirror.remove(),n.dnd.emit("mirror:detached",o)}})),l(n,"onScroll",(function(){n.scrollOffset={x:window.scrollX-n.initialScrollOffset.x,y:window.scrollY-n.initialScrollOffset.y}})),l(n,"onMirrorCreated",(function(e){var t=e.mirror,r=e.source,o=e.dndEvent,i=z(n.options.className||"");"style"in t&&"object"===D(t.style)&&(t.style.display="none");var a={mirror:t,source:r,dragEvent:o,mirrorClasses:i,scrollOffset:n.scrollOffset,options:n.options};Promise.resolve(a).then(G).then(q).then(K).then(V).then(J({initial:!0})).then(W).then((function(e){var t=e.mirrorOffset,r=e.initialX,o=e.initialY,i=g(e,R);return n.mirrorOffset=t,n.initialX=r,n.initialY=o,n.lastMovedX=r,n.lastMovedY=o,h({mirrorOffset:t,initialX:r,initialY:o},i)}))})),l(n,"onMirrorMove",(function(e){var t={mirror:e.mirror,dragEvent:e.dndEvent,mirrorOffset:n.mirrorOffset,options:n.options,initialX:n.initialX,initialY:n.initialY,scrollOffset:n.scrollOffset,lastMovedX:n.lastMovedX,lastMovedY:n.lastMovedY};return Promise.resolve(t).then(J({raf:!0})).then((function(e){var t=e.lastMovedX,r=e.lastMovedY,o=g(e,X);return n.lastMovedX=t,n.lastMovedY=r,h({lastMovedX:t,lastMovedY:r},o)}))})),n.options=h(h({},U),n.getOptions()),n}return d(t,e),u(t,[{key:"attach",value:function(){this.dnd.on("drag:start",this.onDragStart).on("drag:move",this.onDragMove).on("drag:end",this.onDragEnd).on("mirror:created",this.onMirrorCreated).on("mirror:move",this.onMirrorMove)}},{key:"detach",value:function(){this.dnd.off("drag:start",this.onDragStart).off("drag:move",this.onDragMove).off("drag:end",this.onDragEnd).off("mirror:created",this.onMirrorCreated).off("mirror:move",this.onMirrorMove)}},{key:"getOptions",value:function(){return this.dnd.options.mirror||{}}},{key:"getAppendableContainer",value:function(e){var t=e.source,n=e.event,r=this.options.appendTo;return"string"==typeof r?document.querySelector(r):r instanceof HTMLElement?r:"function"==typeof r?r({source:t,event:n}):t.parentNode}}])}(L);function G(e){var t=e.source,n=g(e,N);return Q((function(e){var r=t.getBoundingClientRect();e(h({source:t,sourceRect:r},n))}))}function q(e){var t=e.dragEvent,n=e.sourceRect,r=e.options,o=g(e,C);return Q((function(e){var i="number"!=typeof r.cursorOffsetY?t.clientY-n.top:r.cursorOffsetY,a="number"!=typeof r.cursorOffsetX?t.clientX-n.left:r.cursorOffsetX;e(h({dragEvent:t,sourceRect:n,mirrorOffset:{top:i,left:a},options:r},o))}))}function K(e){var t=e.mirror,n=e.source,r=e.options,o=g(e,_);return Q((function(e){var i,a;if(r.constrainDimensions){var u=getComputedStyle(n);i=u.getPropertyValue("height"),a=u.getPropertyValue("width")}t.style.display=null,t.style.position="fixed",t.style.pointerEvents="none",t.style.top=0,t.style.left=0,t.style.margin=0,r.constrainDimensions&&(t.style.height=i,t.style.width=a),e(h({mirror:t,source:n,options:r},o))}))}function V(e){var t=e.mirror,n=e.mirrorClasses,r=g(e,F);return Q((function(e){var o;(o=t.classList).add.apply(o,E(n)),e(h({mirror:t,mirrorClasses:n},r))}))}function W(e){var t=e.mirror,n=e.source,r=g(e,$);return Q((function(e){n.getAttribute("id")===t.getAttribute("id")&&(t.removeAttribute("id"),delete t.id),e(h({mirror:t},r))}))}function J(e){var t=e.raf,n=void 0!==t&&t,r=e.initial,o=void 0!==r&&r;return function(e){var t=e.mirror,r=e.dragEvent,i=e.mirrorOffset;e.initialY,e.initialX;var a=e.scrollOffset,u=e.options;e.lastMovedX,e.lastMovedY;var s=g(e,B);return Q((function(e){var n=h({mirror:t,dragEvent:r,mirrorOffset:i,options:u},s);if(i){var l=Math.round(r.clientX-i.left-a.x),c=Math.round(r.clientY-i.top-a.y);t.style.transform="translate3d(".concat(l,"px, ").concat(c,"px, 0)"),o&&(n.initialX=l,n.initialY=c),n.lastMovedX=l,n.lastMovedY=c}e(n)}),{raf:n})}}function Q(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).raf,n=void 0!==t&&t;return new Promise((function(t,r){n?requestAnimationFrame((function(){e(t,r)})):e(t,r)}))}function Z(e,t){if(t instanceof Node)return Z(e,[t]);if(t instanceof NodeList)return Z(e,Array.from(t));function n(e){return function(e){return"string"==typeof e}(t)?e.classList.contains(t):function(e){return"function"==typeof e}(t)?t(e):function(e){return Array.isArray(e)}(t)?t.includes(e):void 0}var r=e;do{var o;if(n(r))return r;r=(null===(o=r)||void 0===o?void 0:o.parentElement)||null}while(null!=r&&r!==document.body);return null}function ee(e,t){for(var n,r=t.isHandle,o=t.isSource,i=[],a=0;a<e.children.length;a++)(n=e.children.item(a))instanceof Element&&!o(n)&&(r(n)?i.push(n):i.push.apply(i,E(ee(n,t))));return i}var te=function(){return u((function e(t,n,r,o,a,u){i(this,e),l(this,"startEvent",null),l(this,"source",null),this.env=t,this.container=n,this.options=r,this.onDragStrat=o,this.onDragMove=a,this.onDragEnd=u}),[{key:"getSource",value:function(e){var t=this;if(!(e.target instanceof Element&&Z(e.target,this.container)))return null;var n=Z(e.target,this.options.source);if(!n)return null;if(this.options.handle){var r=ee(n,{isSource:function(e){return e.classList.contains(t.options.source)},isHandle:function(e){return e.classList.contains(t.options.handle)}});if(r.length>0&&r.every((function(t){return!Z(e.target,t)})))return null}return n}},{key:"dragging",get:function(){return null!==this.source}}])}(),ne=function(e){function t(e,n,r,a,u,s){var l;return i(this,t),(l=o(this,t)).target=e,l.source=n,l.container=r,l.clientX=a,l.clientY=u,l.originalEvent=s,l}return d(t,e),u(t)}(S),re=function(e){function t(){return i(this,t),o(this,t,arguments)}return d(t,e),u(t)}(ne);l(re,"type","drag:start"),l(re,"cancelable",!0);var oe=function(e){function t(){return i(this,t),o(this,t,arguments)}return d(t,e),u(t)}(ne);l(oe,"type","drag:move");var ie=function(e){function t(){return i(this,t),o(this,t,arguments)}return d(t,e),u(t)}(ne);l(ie,"type","drag:end");var ae=function(e){function t(){var e;i(this,t);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l(e=o(this,t,[].concat(r)),"onMouseDown",(function(t){if(0===t.button&&!t.altKey&&!e.dragging){var n=e.getSource(t);n&&(e.source=n,e.startEvent=t,e.env.addEventListener("mouseup",e.onMouseUp),e.env.addEventListener("dragstart",ue),e.env.addEventListener("mousemove",e.onFirstMouseMove))}})),l(e,"onKeyDown",(function(t){var n;if(e.dragging&&t.target&&!t.isComposing&&"escape"===(null===(n=t.code)||void 0===n?void 0:n.toLowerCase())){var r=e,o=r.source,i=r.container;e.cancel(),e.onDragEnd(new ie(t.target,o,i,0,0,t))}})),l(e,"onFirstMouseMove",(function(){e.env.removeEventListener("mousemove",e.onFirstMouseMove),e.startDrag()})),l(e,"onMouseMove",(function(t){if(t.target instanceof Element){var n=new oe(t.target,e.source,e.container,t.clientX,t.clientY,t);e.onDragMove(n)}})),l(e,"onMouseUp",(function(t){if(0===t.button&&t.target instanceof Element){var n=e.source;if(e.cancel(),n){var r=new ie(t.target,n,e.container,t.clientX,t.clientY,t);e.onDragEnd(r)}}})),l(e,"onContextMenuWhileDragging",(function(e){e.preventDefault()})),e}return d(t,e),u(t,[{key:"attach",value:function(){return this.env.addEventListener("mousedown",this.onMouseDown,!0),this}},{key:"detach",value:function(){return this.env.removeEventListener("mousedown",this.onMouseDown,!0),this.cancel(),this}},{key:"startDrag",value:function(){var e=new re(this.startEvent.target,this.source,this.container,this.startEvent.clientX,this.startEvent.clientY,this.startEvent);this.onDragStrat(e),e.canceled()?this.cancel():(this.env.addEventListener("keydown",this.onKeyDown),this.env.addEventListener("contextmenu",this.onContextMenuWhileDragging,!0),this.env.addEventListener("mousemove",this.onMouseMove))}},{key:"cancel",value:function(){this.source=null,this.startEvent=null,this.env.removeEventListener("mouseup",this.onMouseUp),this.env.removeEventListener("dragstart",ue),this.env.removeEventListener("mousemove",this.onFirstMouseMove),this.env.removeEventListener("keydown",this.onKeyDown),this.env.removeEventListener("contextmenu",this.onContextMenuWhileDragging,!0),this.env.removeEventListener("mousemove",this.onMouseMove)}}])}(te);function ue(e){e.preventDefault()}function se(e){var t=e.touches,n=e.changedTouches;return t&&t[0]||n&&n[0]}var le=!1;window.addEventListener("touchmove",(function(e){le&&e.preventDefault()}),{passive:!1});var ce=function(e){function t(){var e;i(this,t);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l(e=o(this,t,[].concat(r)),"onTouchStartAt",0),l(e,"onTouchStart",(function(t){if(!e.dragging&&t.target instanceof Element){var n=e.getSource(t);n&&(e.source=n,e.startEvent=t,e.onTouchStartAt=Date.now(),e.env.addEventListener("touchend",e.onTouchEnd),e.env.addEventListener("touchcancel",e.onTouchEnd),e.env.addEventListener("touchmove",e.checkElapsedTime),e.env.addEventListener("contextmenu",ve))}})),l(e,"startDrag",(function(){var t=se(e.startEvent),n=new re(e.startEvent.target,e.source,e.container,t.pageX,t.pageY,e.startEvent);e.onDragStrat(n),n.canceled()?e.cancel():(le=!0,e.env.addEventListener("touchmove",e.onTouchMove))})),l(e,"checkElapsedTime",(function(){e.env.removeEventListener("touchmove",e.checkElapsedTime),Date.now()-e.onTouchStartAt>=e.delay&&e.startDrag()})),l(e,"onTouchMove",(function(t){var n=se(t),r=n.pageX,o=n.pageY,i=document.elementFromPoint(r-window.scrollX,o-window.scrollY);if(i){var a=new oe(i,e.source,e.container,r,o,t);e.onDragMove(a)}})),l(e,"onTouchEnd",(function(t){var n=e.source;if(e.cancel(),n){t.preventDefault();var r=se(t),o=r.pageX,i=r.pageY,a=document.elementFromPoint(o-window.scrollX,i-window.scrollY);if(!a)return;var u=new ie(a,n,e.container,o,i,t);e.onDragEnd(u)}})),e}return d(t,e),u(t,[{key:"attach",value:function(){return this.env.addEventListener("touchstart",this.onTouchStart),this}},{key:"detach",value:function(){return this.env.removeEventListener("touchstart",this.onTouchStart),this.cancel(),this}},{key:"delay",get:function(){var e;return null!==(e=this.options.delay)&&void 0!==e?e:100}},{key:"cancel",value:function(){le=!1,this.source=null,this.env.removeEventListener("touchend",this.onTouchEnd),this.env.removeEventListener("touchcancel",this.onTouchEnd),this.env.removeEventListener("touchmove",this.checkElapsedTime),this.env.removeEventListener("contextmenu",ve),this.env.removeEventListener("touchmove",this.onTouchMove)}}])}(te);function ve(e){e.preventDefault(),e.stopPropagation()}var de=function(e){function t(e,n){var r;return i(this,t),l(r=o(this,t),"source",null),l(r,"currentOver",null),r.container=e,r.options=n,r}return d(t,e),u(t,[{key:"isDraggable",value:function(e){var t,n,r;return null===(t=null===(n=(r=this.options).isDraggable)||void 0===n?void 0:n.call(r,e))||void 0===t||t}},{key:"isDroppable",value:function(e){var t,n,r;return null===(t=null===(n=(r=this.options).isDroppable)||void 0===n?void 0:n.call(r,e))||void 0===t||t}},{key:"dragging",get:function(){return null!==this.source}},{key:"isDragging",value:function(e){return!!this.dragging&&(e?this.source===e:this.dragging)}}])}(x),fe=function(e){function t(e,n,r,a){var u;return i(this,t),(u=o(this,t)).source=e,u.over=n,u.container=r,u.originalEvent=a,u}return d(t,e),u(t)}(S);l(fe,"type","drag");var pe=function(e){function t(e,n,r,a,u){var s;return i(this,t),(s=o(this,t)).source=e,s.container=n,s.originalEvent=r,s.clientX=a,s.clientY=u,s}return d(t,e),u(t)}(S);l(pe,"type","drag:start");var he=function(e){function t(e,n,r){var a;return i(this,t),(a=o(this,t)).source=e,a.container=n,a.originalEvent=r,a}return d(t,e),u(t)}(S);l(he,"type","drag:prevent");var ge=function(e){function t(e,n,r,a){var u;return i(this,t),(u=o(this,t)).source=e,u.enter=n,u.container=r,u.originalEvent=a,u}return d(t,e),u(t)}(S);l(ge,"type","drag:enter");var ye=function(e){function t(e,n,r,a,u,s){var l;return i(this,t),(l=o(this,t)).source=e,l.over=n,l.container=r,l.originalEvent=a,l.clientX=u,l.clientY=s,l}return d(t,e),u(t)}(S);l(ye,"type","drag:move");var me=function(e){function t(e,n,r,a){var u;return i(this,t),(u=o(this,t)).source=e,u.over=n,u.container=r,u.originalEvent=a,u}return d(t,e),u(t)}(S);l(me,"type","drag:over");var be=function(e){function t(e,n,r,a){var u;return i(this,t),(u=o(this,t)).source=e,u.leave=n,u.container=r,u.originalEvent=a,u}return d(t,e),u(t)}(S);l(be,"type","drag:leave");var Ee=function(e){function t(e,n,r,a){var u;return i(this,t),(u=o(this,t)).source=e,u.dropzone=n,u.container=r,u.originalEvent=a,u}return d(t,e),u(t)}(S);l(Ee,"type","drop");var we=function(e){function t(e,n,r,a){var u;return i(this,t),(u=o(this,t)).source=e,u.over=n,u.container=r,u.originalEvent=a,u}return d(t,e),u(t)}(S);l(we,"type","drag:end");var De=function(){return u((function e(t,n,r){var o=this;i(this,e),l(this,"destoryed",!1),l(this,"onSignalAborted",(function(){o.destroy()})),this.type=t,this.listener=n,this.options=r,this.options.signal&&(this.options.signal.aborted?this.destroy():this.options.signal.addEventListener("abort",this.onSignalAborted))}),[{key:"is",value:function(e){return this.listener===e}},{key:"call",value:function(e){if(!this.destoryed&&e.type===this.type)try{this.options.passive&&(e.preventDefault=function(){}),this.listener(e)}finally{this.options.once&&this.destroy()}}},{key:"destroy",value:function(){var e;this.destoryed=!0,null===(e=this.options.signal)||void 0===e||e.removeEventListener("abort",this.onSignalAborted)}}])}();function Oe(e,t){var n,r=s(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.is(t))return o}}catch(e){r.e(e)}finally{r.f()}return null}var Le=function(){return u((function e(t,n,r,o){var a=this;i(this,e),l(this,"scopeToAliveListeners",new Map),l(this,"suppress",(function(e){if(a.isEnabled()&&a.isTrustedEvent(e)){a.behavior.preventDefault&&e.preventDefault(),a.behavior.stopPropagation&&e.stopPropagation(),a.behavior.stopImmediatePropagation&&e.stopImmediatePropagation();var t,n=s(a.scopeToAliveListeners.values());try{for(n.s();!(t=n.n()).done;){var r,o=t.value,i=s(o);try{for(i.s();!(r=i.n()).done;){var u=r.value;u.options.capture&&u.call(e)}}catch(e){i.e(e)}finally{i.f()}var l,c=s(o);try{for(c.s();!(l=c.n()).done;){var v=l.value;v.options.capture||v.call(e)}}catch(e){c.e(e)}finally{c.f()}}}catch(e){n.e(e)}finally{n.f()}}})),this.type=t,this.behavior=n,this.isEnabled=r,this.isTrustedEvent=o,document.addEventListener(t,this.suppress,{capture:!0})}),[{key:"findAliveListener",value:function(e,t){var n=this.scopeToAliveListeners.get(e);return n?Oe(n.values(),t):null}},{key:"addAliveEventListener",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(this.type===t){var o=new De(t,n,r);o.call=o.call.bind(o),document.addEventListener(t,o.call,r);var i=this.scopeToAliveListeners.get(e);i||(i=new Set,this.scopeToAliveListeners.set(e,i)),i.add(o)}}},{key:"removeAliveEventListener",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(this.type===t){var o=this.findAliveListener(e,n);o&&(this.scopeToAliveListeners.get(e).delete(o),document.removeEventListener(t,o.call,r))}}},{key:"clear",value:function(e){var t=this.scopeToAliveListeners.get(e);if(t){var n,r=s(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.destroy(),document.removeEventListener(o.type,o.call,o.options)}}catch(e){r.e(e)}finally{r.f()}this.scopeToAliveListeners.delete(e)}}},{key:"destroy",value:function(){var e,t=s(this.scopeToAliveListeners.values());try{for(t.s();!(e=t.n()).done;){var n,r=s(e.value);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.destroy(),document.removeEventListener(o.type,o.call,o.options)}}catch(e){r.e(e)}finally{r.f()}}}catch(e){t.e(e)}finally{t.f()}this.scopeToAliveListeners.clear(),document.removeEventListener(this.type,this.suppress,{capture:!0})}}])}();function Se(e){return ke.isTrustedEvent(e)}var ke=function(){return u((function e(t){var n=this;i(this,e),l(this,"enabled",!1),l(this,"typeToSpecificEventSuppressor",new Map);for(var r=function(){return n.enabled},o=0,a=Object.keys(t);o<a.length;o++){var u=a[o],s=new Le(u,t[u],r,Se);this.typeToSpecificEventSuppressor.set(u,s)}}),[{key:"enable",value:function(){this.enabled=!0}},{key:"disable",value:function(){this.enabled=!1}},{key:"getSpecificEventSuppressor",value:function(e){return this.typeToSpecificEventSuppressor.get(e)||null}},{key:"getAllSpecificEventSuppressors",value:function(){return this.typeToSpecificEventSuppressor.values()}},{key:"destroy",value:function(){var e,t=s(this.getAllSpecificEventSuppressors());try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(e){t.e(e)}finally{t.f()}}}])}();l(ke,"isTrustedEvent",(function(e){return e.isTrusted}));var Te=function(){return u((function e(t,n){i(this,e),l(this,"nativeListenerProxys",new Set),this.env=t,this.scope=n}),[{key:"enable",value:function(){this.env.enable()}},{key:"disable",value:function(){this.env.disable()}},{key:"addAliveEventListener",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.env.getSpecificEventSuppressor(e);r?r.addAliveEventListener(this.scope,e,t,n):this.addNativeEventListener(e,t,n)}},{key:"removeAliveEventListener",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.env.getSpecificEventSuppressor(e);r?r.removeAliveEventListener(this.scope,e,t,n):this.removeNativeEventListener(e,t,n)}},{key:"addNativeEventListener",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new De(e,t,n);r.call=r.call.bind(r),document.addEventListener(e,r.call,n),this.nativeListenerProxys.add(r)}},{key:"removeNativeEventListener",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Oe(this.nativeListenerProxys.values(),t);r&&(document.removeEventListener(e,r.call,n),this.nativeListenerProxys.delete(r))}},{key:"destroy",value:function(){var e,t=s(this.env.getAllSpecificEventSuppressors());try{for(t.s();!(e=t.n()).done;){e.value.clear(this.scope)}}catch(e){t.e(e)}finally{t.f()}var n,r=s(this.nativeListenerProxys.values());try{for(r.s();!(n=r.n()).done;){var o=n.value;document.removeEventListener(o.type,o.call,o.options)}}catch(e){r.e(e)}finally{r.f()}this.nativeListenerProxys.clear()}}])}();function Pe(e,t){e.dropEffect=t?xe(e.effectAllowed):"none"}function Me(e,t){t?"none"===e.dropEffect&&(e.dropEffect=xe(e.effectAllowed),console.warn("[vdnd warn]: Do you set the 'dataTransfer.dropEffect' to 'none'? The 'dataTransfer.dropEffect' for a droppable dropzone must not be 'none', vdnd will force it to be set to not 'none'.")):"none"!==e.dropEffect&&(e.dropEffect="none",console.warn("[vdnd warn]: Do you set the 'dataTransfer.dropEffect' to not 'none'? The 'dataTransfer.dropEffect' for a not droppable dropzone must be 'none', vdnd will force it to be set to 'none'."))}var Ae=function(e){function t(e,n){var r;return i(this,t),l(r=o(this,t,[e,n]),"shouldSkipDragLeaveHandler",!1),l(r,"temporaryPreviousOver",null),l(r,"temporaryLeave",null),l(r,"trigger",null),l(r,"onDrag",(function(e){if(r.dragging&&e.target instanceof Element&&e.dataTransfer&&Z(e.target,r.trigger)){var t=new fe(r.source,r.currentOver,r.container,e);r.emit("drag",t)}})),l(r,"onDragStart",(function(e){if(!r.dragging&&e.dataTransfer){if(!Z(e.target,r.container))return null;var t=Z(e.target,r.options.source);if(t){var n,o=[];if(r.options.handle&&(o=ee(t,{isSource:function(e){return e.classList.contains(r.options.source)},isHandle:function(e){return e.classList.contains(r.options.handle)}})).length){if(!(n=o.find((function(t){return!!Z(e.target,t)}))))return void e.preventDefault();if(!function(e,t){for(var n=e;n!==t&&!n.draggable&&n.parentElement;)n=n.parentElement;return n!==t}(n,t))return void console.error("[vdnd error]: NativeDnd requires the handle must be draggable, the illegal handle is ",n)}if(r.isDraggable(t)){if(r.source=t,r.trigger=n||t,n&&e.dataTransfer){var i=r.source.getBoundingClientRect(),a=i.top,u=i.left;e.dataTransfer.setDragImage(r.source,e.clientX-u,e.clientY-a)}var s=new pe(t,r.container,e);r.emit("drag:start",s)}else{e.preventDefault();var l=new he(t,r.container,e);r.emit("drag:prevent",l)}}}})),l(r,"onDragEnter",(function(e){if(r.dragging&&e.target instanceof Element&&e.dataTransfer){var t=Z(e.target,r.container)&&Z(e.target,r.options.dropzone);if(t)if(e.preventDefault(),Pe(e.dataTransfer,r.isDroppable(t)),r.temporaryLeave=null,t!==r.currentOver){r.temporaryPreviousOver=r.currentOver,r.currentOver=t;var n=new ge(r.source,t,r.container,e);r.emit("drag:enter",n),Me(e.dataTransfer,r.isDroppable(t))}else r.shouldSkipDragLeaveHandler=!0}})),l(r,"onDragLeave",(function(e){if(!r.dragging||r.shouldSkipDragLeaveHandler||!e.dataTransfer||e.target!==r.temporaryPreviousOver&&e.target!==r.currentOver)r.shouldSkipDragLeaveHandler=!1;else{r.shouldSkipDragLeaveHandler=!1;var t=r.temporaryPreviousOver||r.currentOver;r.temporaryPreviousOver=null,null===e.relatedTarget&&(r.temporaryLeave=t),t===r.currentOver&&(r.currentOver=null);var n=new be(r.source,t,r.container,e);r.emit("drag:leave",n)}})),l(r,"onDragOver",(function(e){if(r.dragging&&r.currentOver&&e.target instanceof Element&&e.dataTransfer&&Z(e.target,r.currentOver)){var t=r.isDroppable(r.currentOver);t&&e.preventDefault(),Pe(e.dataTransfer,t);var n=new me(r.source,r.currentOver,r.container,e);r.emit("drag:over",n),Me(e.dataTransfer,r.isDroppable(r.currentOver))}})),l(r,"onDrop",(function(e){if(r.dragging&&r.currentOver&&e.target instanceof Element&&e.dataTransfer&&Z(e.target,r.currentOver)&&r.isDroppable(r.currentOver)){var t=new Ee(r.source,r.currentOver,r.container,e);r.emit("drop",t)}})),l(r,"onDragEnd",(function(e){if(r.dragging&&e.target instanceof Element&&e.dataTransfer&&Z(e.target,r.trigger)){var t=new we(r.source,r.currentOver||r.temporaryLeave,r.container,e);r.emit("drag:end",t),r.trigger=null,r.source=null,r.currentOver=null,r.temporaryPreviousOver=null,r.temporaryLeave=null,r.shouldSkipDragLeaveHandler=!1}})),r.container=e,r.options=n,document.addEventListener("drag",r.onDrag),document.addEventListener("dragstart",r.onDragStart),document.addEventListener("dragenter",r.onDragEnter),document.addEventListener("dragover",r.onDragOver),document.addEventListener("dragleave",r.onDragLeave),document.addEventListener("dragend",r.onDragEnd),document.addEventListener("drop",r.onDrop),r}return d(t,e),u(t,[{key:"destroy",value:function(){this.dragging||(document.removeEventListener("drag",this.onDrag),document.removeEventListener("dragstart",this.onDragStart),document.removeEventListener("dragenter",this.onDragEnter),document.removeEventListener("dragover",this.onDragOver),document.removeEventListener("dragleave",this.onDragLeave),document.removeEventListener("dragend",this.onDragEnd),document.removeEventListener("drop",this.onDrop),b(t,"destroy",this)([]))}}])}(de);function xe(e){switch(e){case"all":case"copy":case"none":case"copyLink":case"copyMove":case"uninitialized":return"copy";case"link":case"linkMove":return"link";case"move":return"move"}}var je=function(e){function t(e,n){var r,a;return i(this,t),l(a=o(this,t,[e,n]),"plugins",[]),l(a,"simulator",null),l(a,"eventSuppressor",null),l(a,"clearIntervalTaskForDrag",j),l(a,"clearIntervalTaskForDragOver",j),a.container=e,a.options=n,(r=a).addPlugin.apply(r,E(t.defaultPlugins)),a.eventSuppressor=n.eventSuppressor||null,a.setSimulator(a.options.simulator),a.initIntervalTasks(),a}return d(t,e),u(t,[{key:"destroy",value:function(){var e;this.dragging||(this.removePlugin.apply(this,E(this.plugins.map((function(e){return e.constructor})))),this.setSimulator(null),null===(e=this.eventSuppressor)||void 0===e||e.destroy(),b(t,"destroy",this)([]))}},{key:"addPlugin",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n.map((function(t){return new t(e)}));return o.forEach((function(e){return e.attach()})),this.plugins=[].concat(E(this.plugins),E(o)),this}},{key:"removePlugin",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this.plugins.filter((function(e){return t.some((function(t){return e instanceof t}))}));return r.forEach((function(e){return e.detach()})),this.plugins=this.plugins.filter((function(e){return t.some((function(t){return e instanceof t}))})),this}},{key:"initIntervalTasks",value:function(){var e=this;this.runIntervalTaskForDrag=function(n){var r=setInterval((function(){if(!n.canceled()&&e.dragging){var t=new fe(e.source,e.currentOver,e.container,null);e.emit("drag",t)}}),t.eventTriggeringInterval.drag);e.clearIntervalTaskForDrag=function(){clearInterval(r),e.clearIntervalTaskForDrag=j}},this.on("drag:start",this.runIntervalTaskForDrag),this.on("drag:end",(function(){return e.clearIntervalTaskForDrag()})),this.runIntervalTaskForDragOver=function(){var n=setInterval((function(){if(e.dragging&&e.currentOver){var t=new me(e.source,e.currentOver,e.container,null);e.emit("drag:over",t)}}),t.eventTriggeringInterval.dragover);e.clearIntervalTaskForDragOver=function(){clearInterval(n),e.clearIntervalTaskForDragOver=j}},this.on("drag:enter",this.runIntervalTaskForDragOver),this.on("drag:leave",(function(){return e.clearIntervalTaskForDragOver()}))}},{key:"setSimulator",value:function(e){var t;if(!this.dragging){var n;if(!e)return null===(n=this.simulator)||void 0===n||n.detach(),void(this.simulator=null);null===(t=this.simulator)||void 0===t||t.detach();var r=this.eventSuppressor?{addEventListener:this.eventSuppressor.addAliveEventListener.bind(this.eventSuppressor),removeEventListener:this.eventSuppressor.removeAliveEventListener.bind(this.eventSuppressor)}:document;return this.simulator=new e(r,this.container,this.options,this.onDragStart.bind(this),this.onDragMove.bind(this),this.onDragEnd.bind(this)),this.simulator.attach(),this}}},{key:"onDragStart",value:function(e){var t;if(!this.dragging){if(!this.isDraggable(e.source)){var n=new he(e.source,this.container,e.originalEvent);return this.emit("drag:prevent",n),void e.cancel()}this.source=e.source,null===(t=this.eventSuppressor)||void 0===t||t.enable(),ze(document.body,"none");var r=new pe(this.source,this.container,e.originalEvent,e.clientX,e.clientY);if(this.emit("drag:start",r),Z(this.source,this.options.dropzone)){this.currentOver=this.source;var o=new ge(this.source,this.source,this.container,e.originalEvent);this.emit("drag:enter",o)}}}},{key:"onDragMove",value:function(e){if(this.dragging){var t=Z(e.target,this.container)&&Z(e.target,this.options.dropzone),n=t?!!this.currentOver&&t!==this.currentOver:!!this.currentOver,r=null;if(t&&this.currentOver!==t){r=t;var o=new ge(this.source,t,this.container,e.originalEvent);this.emit("drag:enter",o)}if(n){var i=new be(this.source,this.currentOver,this.container,e.originalEvent);this.emit("drag:leave",i),this.currentOver=null}r&&(this.currentOver=r);var a=new ye(this.source,this.currentOver,this.container,e.originalEvent,e.clientX,e.clientY);this.emit("drag:move",a)}}},{key:"onDragEnd",value:function(e){var t;if(this.dragging){if(null===(t=this.eventSuppressor)||void 0===t||t.disable(),ze(document.body,""),this.currentOver)if(!(e.originalEvent instanceof KeyboardEvent)&&this.isDroppable(this.currentOver)){var n=new Ee(this.source,this.currentOver,this.container,e.originalEvent);this.emit("drop",n)}else{var r=new be(this.source,this.currentOver,this.container,e.originalEvent);this.emit("drag:leave",r)}var o=new we(this.source,this.currentOver,this.container,e.originalEvent);this.emit("drag:end",o),this.source=null,this.currentOver=null}}}])}(de);function ze(e,t){e.style.webkitUserSelect=t,e.style.mozUserSelect=t,e.style.msUserSelect=t,e.style.oUserSelect=t,e.style.userSelect=t}l(je,"defaultPlugins",[H]),l(je,"eventTriggeringInterval",{drag:50,dragover:50});var Ie=Symbol("DndContextSymbol"),Ye=Symbol("DndParentElementSymbol"),Re={"source:dragging":"dnd-source--dragging","source:draggable":"dnd-source--draggable","source:disabled":"dnd-source--disabled","dropzone:over":"dnd-dropzone--over","dropzone:droppable":"dnd-dropzone--droppable","dropzone:disabled":"dnd-dropzone--disabled"},Xe={create:function(e){return e.source.nativeEl.cloneNode(!0)},appendTo:function(e){return e.source.nativeEl.parentNode||document.body}};function Ne(e){var n=e.type,r=t.shallowRef();function o(e){var t,n,o,i,a,u,s,l=h({},e);(null!==(t=l.debug)&&void 0!==t||(l.debug=!1),null!==(n=l.strict)&&void 0!==n||(l.strict=!1),null!==(o=l.source)&&void 0!==o||(l.source="dnd-source"),null!==(i=l.dropzone)&&void 0!==i||(l.dropzone="dnd-dropzone"),null!==(a=l.handle)&&void 0!==a||(l.handle="dnd-handle"),l.classes=h(h({},Re),l.classes||{}),"mouse"!==l.type&&"touch"!==l.type||(l.mirror=h(h({},Xe),l.mirror||{})),"mouse"===l.type)&&(null!==(u=l.suppressUIEvent)&&void 0!==u||(l.suppressUIEvent=!1));"touch"===l.type&&(null!==(s=l.delay)&&void 0!==s||(l.delay=100));r.value=l}o(h({type:n},e.options));var i=!1,a=function(){var r=t.watch(t.toRef(e,"options"),(function(){e.isDragging()?(i=!0,r()):o(h({type:n},e.options))}),{flush:"pre",deep:!0})};return a(),e.on("drag:end",(function(){i&&(i=!1,o(h({type:n},e.options)),a())})),r}function Ce(e,n,r){t.provide(Ye,e.rootDndElement),e.$setRootDndElement(e.rootDndElement),t.onMounted((function(){e.rootDndElement.nativeEl=r.value||null,e.rootDndElement.nativeEl&&e.rootDndElement.nativeEl}));var o,i=(o=new Map,{storeDndElement:function(e,t){return o.set(e,t)},getDndElementByNativeEl:function(e){return o.get(e)||null},deleteDndElementByNativeEl:function(e){return o.delete(e)}}),a=i.storeDndElement,u=i.getDndElementByNativeEl,s=i.deleteDndElementByNativeEl,l={instance:e,get options(){return n.value},storeDndElement:a,getDndElementByNativeEl:u,deleteDndElementByNativeEl:s,classnamesOf:function(e){return z("source"===e||"dropzone"===e||"handle"===e?t.unref(n)[e]:t.unref(n).classes[e])},isDraggable:function(e){var t,n=u(e);return null!==(t=null==n?void 0:n.draggable)&&void 0!==t&&t},isDroppable:function(t){var r=u(t);return!!r&&(!!r.droppable&&(!n.value.strict||!e.isDragging({id:r.id})))}};return t.provide(Ie,l),l}function _e(e,n){var r=t.shallowRef(null);return t.onMounted((function(){t.watchEffect((function(t){r.value=e(n()),t((function(){var e;null===(e=r.value)||void 0===e||e.destroy(),r.value=null}))}))})),r}function Fe(e,n){var r=e.instance,o=e.getDndElementByNativeEl,i=r.isDragging,a=function(){return e.options.strict},u=function(e){var t=e.over,n=e.container,u=e.originalEvent,s=t&&o(t);r.$emit("drag",{type:"drag",source:r.source,container:n,over:s?a()&&i({id:s.id})?null:s:null,originalEvent:u})},s=function(e){var t=e.container,n=e.originalEvent,i=o(e.source);r.$setSource(i),r.$emit("drag:start",{type:"drag:start",source:i,container:t,originalEvent:n})},l=function(e){var t=e.container,n=e.originalEvent,i=o(e.source);I(i)?r.$emit("drag:prevent",{type:"drag:prevent",source:i,container:t,originalEvent:n}):console.warn("[vdnd warn]: currently attempting to drag an uncontrolled 'source', this means that the 'source' was not created through '<DndSource />', vdnd will ignore it")},c=function(e){var t=o(e.enter);if(I(t)){if(!a()||!i({id:t.id})){r.$setOver(t);var n=e.container,u=e.originalEvent;r.$emit("drag:enter",{type:"drag:enter",source:r.source,enter:t,container:n,originalEvent:u})}}else console.warn("[vdnd warn]: currently attempting to indicate an uncontrolled 'dropzone' as the current drop target, this means that the 'dropzone' was not created through '<DndDropzone />', vdnd will ignore it")},v=function(e){var t=o(e.over);if(I(t)&&(!a()||!i({id:t.id}))){var n=e.container,u=e.originalEvent;r.$emit("drag:over",{type:"drag:over",source:r.source,over:t,container:n,originalEvent:u})}},d=function(e){var t,n=o(e.leave);if(I(n)&&(!a()||!i({id:n.id}))){var u=e.container,s=e.originalEvent;n.id===(null===(t=r.over)||void 0===t?void 0:t.id)&&r.$setOver(null),r.$emit("drag:leave",{type:"drag:leave",source:r.source,leave:n,container:u,originalEvent:s})}},f=j,p=function(e){var t=e.container,n=e.originalEvent,u=o(e.dropzone);if(!a()||!i({id:u.id})){var s={type:"drop",dropzone:u,source:r.source,container:t,originalEvent:n};f=function(){return r.$emit("drop",s)}}},h=function(e){f(),f=j;var n=e.container,u=e.originalEvent,s=r.source,l=e.over&&o(e.over),c=i({id:null==l?void 0:l.id});r.$setOver(null),r.$setSource(null),t.nextTick((function(){r.$emit("drag:end",{type:"drag:end",source:s,over:l?a()&&c?null:l:null,container:n,originalEvent:u})}))};t.watchEffect((function(){var e=n.value;e&&function(e){e.on("drag",u).on("drag:prevent",l).on("drag:start",s).on("drag:enter",c).on("drag:over",v).on("drag:leave",d).on("drag:end",h).on("drop",p)}(e)}),{flush:"sync"}),t.onUpdated((function(){var t,n;if(r.isDragging()){var o=e.getDndElementByNativeEl;if(null!==(t=r.source)&&void 0!==t&&t.nativeEl)o(r.source.nativeEl)||console.error("[vdnd error]: the current source was removed while dragging, this may lead to bugs");if(null!==(n=r.over)&&void 0!==n&&n.nativeEl)o(r.over.nativeEl)||console.error("[vdnd error]: the current drop target was removed while dragging, this may lead to bugs")}}))}var $e=t.defineComponent({name:"NativeDnd",props:{tag:{type:String,default:"div"},instance:{type:Object,required:!0}},emits:{drag:function(e){return!0},"drag:start":function(e){return!0},"drag:prevent":function(e){return!0},"drag:enter":function(e){return!0},"drag:over":function(e){return!0},"drag:leave":function(e){return!0},drop:function(e){return!0},"drag:end":function(e){return!0},initialized:function(){return!0}},setup:function(e,n){var r=n.emit,o=n.slots,i=e.instance,a=Ne(i),u=t.shallowRef(),s=Ce(i,a,u),l=_e((function(e){return new Ae(u.value,e)}),(function(){var e=a.value;return{source:e.source,dropzone:e.dropzone,handle:e.handle,isDraggable:s.isDraggable,isDroppable:s.isDroppable}}));Fe(s,l),i.on("drag",(function(e){return r("drag",e)})),i.on("drag:start",(function(e){return r("drag:start",e)})),i.on("drag:prevent",(function(e){return r("drag:prevent",e)})),i.on("drag:enter",(function(e){return r("drag:enter",e)})),i.on("drag:leave",(function(e){return r("drag:leave",e)})),i.on("drag:over",(function(e){return r("drag:over",e)})),i.on("drag:end",(function(e){return r("drag:end",e)})),i.on("drop",(function(e){return r("drop",e)})),t.onMounted((function(){r("initialized")})),t.onBeforeUnmount((function(){i.$destroy()}));return function(){return t.h(e.t