UNPKG

@vdnd/v2

Version:

Easy used vue drag and drop component library.

1 lines 64.2 kB
var Vdnd2=function(e,n){"use strict";function t(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function r(e,n,t,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?n(s):Promise.resolve(s).then(r,o)}function o(e,n,t){return n=v(n),function(e,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)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(n,t||[],v(e).constructor):n.apply(e,t))}function i(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function u(e,n,t){return n&&a(e.prototype,n),t&&a(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=O(e))||n){t&&(e=t);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(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw i}}}}function l(e,n,t){return(n=w(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,n,t){var r=function(e,n){for(;!{}.hasOwnProperty.call(e,n)&&null!==(e=v(e)););return e}(e,n);if(r){var o=Object.getOwnPropertyDescriptor(r,n);return o.get?o.get.call(arguments.length<3?e:t):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,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&m(e,n)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach((function(n){l(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function g(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==n.indexOf(r))continue;t[r]=e[r]}return t}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],-1===n.indexOf(t)&&{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function y(){y=function(){return n};var e,n={},t=Object.prototype,r=t.hasOwnProperty,o=Object.defineProperty||function(e,n,t){e[n]=t.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{l({},"")}catch(e){l=function(e,n,t){return e[n]=t}}function c(e,n,t,r){var i=n&&n.prototype instanceof m?n:m,a=Object.create(i.prototype),u=new x(r||[]);return o(a,"_invoke",{value:T(e,t,u)}),a}function v(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}n.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!==t&&r.call(O,a)&&(w=O);var L=E.prototype=m.prototype=Object.create(w);function S(e){["next","throw","return"].forEach((function(n){l(e,n,(function(e){return this._invoke(n,e)}))}))}function k(e,n){function t(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")?n.resolve(c.__await).then((function(e){t("next",e,a,u)}),(function(e){t("throw",e,a,u)})):n.resolve(c).then((function(e){l.value=e,a(l)}),(function(e){return t("throw",e,a,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new n((function(n,o){t(e,r,n,o)}))}return i=i?i.then(o,o):o()}})}function T(n,t,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(n,t,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(n,t){var r=t.method,o=n.iterator[r];if(o===e)return t.delegate=null,"throw"===r&&n.iterator.return&&(t.method="return",t.arg=e,P(n,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=v(o,n.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,g;var a=i.arg;return a?a.done?(t[n.resultName]=a.value,t.next=n.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,g):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function M(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function A(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function j(n){if(n||""===n){var t=n[a];if(t)return t.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length)){var o=-1,i=function t(){for(;++o<n.length;)if(r.call(n,o))return t.value=n[o],t.done=!1,t;return t.value=e,t.done=!0,t};return i.next=i}}throw new TypeError(typeof n+" 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"),n.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return!!n&&(n===b||"GeneratorFunction"===(n.displayName||n.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,l(e,s,"GeneratorFunction")),e.prototype=Object.create(L),e},n.awrap=function(e){return{__await:e}},S(k.prototype),l(k.prototype,u,(function(){return this})),n.AsyncIterator=k,n.async=function(e,t,r,o,i){void 0===i&&(i=Promise);var a=new k(c(e,t,r,o),i);return n.isGeneratorFunction(t)?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]"})),n.keys=function(e){var n=Object(e),t=[];for(var r in n)t.push(r);return t.reverse(),function e(){for(;t.length;){var r=t.pop();if(r in n)return e.value=r,e.done=!1,e}return e.done=!0,e}},n.values=j,x.prototype={constructor:x,reset:function(n){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),!n)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var t=this;function o(r,o){return u.type="throw",u.arg=n,t.next=r,o&&(t.method="next",t.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,n){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=n,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(e,n){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&&n&&(this.next=n),g},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),A(t),g}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var r=t.completion;if("throw"===r.type){var o=r.arg;A(t)}return o}}throw Error("illegal catch attempt")},delegateYield:function(n,t,r){return this.delegate={iterator:j(n),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function m(e,n){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},m(e,n)}function b(e,n,t,r){var o=c(v(e.prototype),n,t);return"function"==typeof o?function(e){return o.apply(t,e)}:o}function E(e){return function(e){if(Array.isArray(e))return t(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 n=function(e,n){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}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,n){if(e){if("string"==typeof e)return t(e,n);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)?t(e,n):void 0}}var L=u((function e(n){i(this,e),this.dnd=n})),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 n(e,t,r,a){var u;return i(this,n),(u=o(this,n)).source=e,u.mirror=t,u.container=r,u.dndEvent=a,u}return d(n,e),u(n)}(S),T=function(e){function n(){return i(this,n),o(this,n,arguments)}return d(n,e),u(n)}(k);l(T,"type","mirror:created");var P=function(e){function n(){return i(this,n),o(this,n,arguments)}return d(n,e),u(n)}(k);l(P,"type","mirror:attached");var M=function(e){function n(){return i(this,n),o(this,n,arguments)}return d(n,e),u(n)}(k);l(M,"type","mirror:move");var A=function(e){function n(){return i(this,n),o(this,n,arguments)}return d(n,e),u(n)}(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,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}},{key:"once",value:function(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this.onceCallbacks.add(n),this}},{key:"off",value:function(e,n){if(!this.callbacks[e])return this;var t=this.callbacks[e],r=t.indexOf(n);return r>=0&&t.splice(r,1),this.onceCallbacks.delete(n),this}},{key:"emit",value:function(e,n){if(!this.callbacks[e])return this;for(var t=E(this.callbacks[e]),r=[],o=0;o<=t.length-1;o++){var i=t[o];try{i(n)}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 n=Object.prototype.toString.call(e);return n.slice(8,n.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 n(e){var t;return i(this,n),l(t=o(this,n,[e]),"scrollOffset",{x:0,y:0}),l(t,"initialScrollOffset",{x:window.scrollX,y:window.scrollY}),l(t,"lastMovedX",0),l(t,"lastMovedY",0),l(t,"mirrorOffset",{top:0,left:0}),l(t,"initialX",0),l(t,"initialY",0),l(t,"mirror",null),l(t,"onDragStart",function(){var e,n=(e=y().mark((function e(n){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",t.onScroll,!0),t.initialScrollOffset={x:window.scrollX,y:window.scrollY},r=n.source,o=n.container,i=t.getAppendableContainer({source:r,event:n})||document.body,a=t.options.create,t.mirror=a({source:r,event:n}),u=new T(r,t.mirror,o,n),t.dnd.emit("mirror:created",u),s=new P(r,t.mirror,o,n),i.appendChild(t.mirror),t.dnd.emit("mirror:attached",s);case 11:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(o,i){var a=e.apply(n,t);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 n.apply(this,arguments)}}()),l(t,"onDragMove",(function(e){if(t.mirror){var n=e.source,r=e.container,o=new M(n,t.mirror,r,e);t.dnd.emit("mirror:move",o)}})),l(t,"onDragEnd",(function(e){if("ontouchstart"in window&&document.removeEventListener("scroll",t.onScroll,!0),t.initialScrollOffset={x:0,y:0},t.scrollOffset={x:0,y:0},t.mirror){var n=e.source,r=e.container,o=new A(n,t.mirror,r,e);t.mirror.remove(),t.dnd.emit("mirror:detached",o)}})),l(t,"onScroll",(function(){t.scrollOffset={x:window.scrollX-t.initialScrollOffset.x,y:window.scrollY-t.initialScrollOffset.y}})),l(t,"onMirrorCreated",(function(e){var n=e.mirror,r=e.source,o=e.dndEvent,i=z(t.options.className||"");"style"in n&&"object"===D(n.style)&&(n.style.display="none");var a={mirror:n,source:r,dragEvent:o,mirrorClasses:i,scrollOffset:t.scrollOffset,options:t.options};Promise.resolve(a).then(G).then(q).then(K).then(V).then(J({initial:!0})).then(W).then((function(e){var n=e.mirrorOffset,r=e.initialX,o=e.initialY,i=g(e,R);return t.mirrorOffset=n,t.initialX=r,t.initialY=o,t.lastMovedX=r,t.lastMovedY=o,h({mirrorOffset:n,initialX:r,initialY:o},i)}))})),l(t,"onMirrorMove",(function(e){var n={mirror:e.mirror,dragEvent:e.dndEvent,mirrorOffset:t.mirrorOffset,options:t.options,initialX:t.initialX,initialY:t.initialY,scrollOffset:t.scrollOffset,lastMovedX:t.lastMovedX,lastMovedY:t.lastMovedY};return Promise.resolve(n).then(J({raf:!0})).then((function(e){var n=e.lastMovedX,r=e.lastMovedY,o=g(e,X);return t.lastMovedX=n,t.lastMovedY=r,h({lastMovedX:n,lastMovedY:r},o)}))})),t.options=h(h({},U),t.getOptions()),t}return d(n,e),u(n,[{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 n=e.source,t=e.event,r=this.options.appendTo;return"string"==typeof r?document.querySelector(r):r instanceof HTMLElement?r:"function"==typeof r?r({source:n,event:t}):n.parentNode}}])}(L);function G(e){var n=e.source,t=g(e,N);return Q((function(e){var r=n.getBoundingClientRect();e(h({source:n,sourceRect:r},t))}))}function q(e){var n=e.dragEvent,t=e.sourceRect,r=e.options,o=g(e,C);return Q((function(e){var i="number"!=typeof r.cursorOffsetY?n.clientY-t.top:r.cursorOffsetY,a="number"!=typeof r.cursorOffsetX?n.clientX-t.left:r.cursorOffsetX;e(h({dragEvent:n,sourceRect:t,mirrorOffset:{top:i,left:a},options:r},o))}))}function K(e){var n=e.mirror,t=e.source,r=e.options,o=g(e,_);return Q((function(e){var i,a;if(r.constrainDimensions){var u=getComputedStyle(t);i=u.getPropertyValue("height"),a=u.getPropertyValue("width")}n.style.display=null,n.style.position="fixed",n.style.pointerEvents="none",n.style.top=0,n.style.left=0,n.style.margin=0,r.constrainDimensions&&(n.style.height=i,n.style.width=a),e(h({mirror:n,source:t,options:r},o))}))}function V(e){var n=e.mirror,t=e.mirrorClasses,r=g(e,F);return Q((function(e){var o;(o=n.classList).add.apply(o,E(t)),e(h({mirror:n,mirrorClasses:t},r))}))}function W(e){var n=e.mirror,t=e.source,r=g(e,$);return Q((function(e){t.getAttribute("id")===n.getAttribute("id")&&(n.removeAttribute("id"),delete n.id),e(h({mirror:n},r))}))}function J(e){var n=e.raf,t=void 0!==n&&n,r=e.initial,o=void 0!==r&&r;return function(e){var n=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 t=h({mirror:n,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);n.style.transform="translate3d(".concat(l,"px, ").concat(c,"px, 0)"),o&&(t.initialX=l,t.initialY=c),t.lastMovedX=l,t.lastMovedY=c}e(t)}),{raf:t})}}function Q(e){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).raf,t=void 0!==n&&n;return new Promise((function(n,r){t?requestAnimationFrame((function(){e(n,r)})):e(n,r)}))}function Z(e,n){if(n instanceof Node)return Z(e,[n]);if(n instanceof NodeList)return Z(e,Array.from(n));function t(e){return function(e){return"string"==typeof e}(n)?e.classList.contains(n):function(e){return"function"==typeof e}(n)?n(e):function(e){return Array.isArray(e)}(n)?n.includes(e):void 0}var r=e;do{var o;if(t(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,n){for(var t,r=n.isHandle,o=n.isSource,i=[],a=0;a<e.children.length;a++)(t=e.children.item(a))instanceof Element&&!o(t)&&(r(t)?i.push(t):i.push.apply(i,E(ee(t,n))));return i}var ne=function(){return u((function e(n,t,r,o,a,u){i(this,e),l(this,"startEvent",null),l(this,"source",null),this.env=n,this.container=t,this.options=r,this.onDragStrat=o,this.onDragMove=a,this.onDragEnd=u}),[{key:"getSource",value:function(e){var n=this;if(!(e.target instanceof Element&&Z(e.target,this.container)))return null;var t=Z(e.target,this.options.source);if(!t)return null;if(this.options.handle){var r=ee(t,{isSource:function(e){return e.classList.contains(n.options.source)},isHandle:function(e){return e.classList.contains(n.options.handle)}});if(r.length>0&&r.every((function(n){return!Z(e.target,n)})))return null}return t}},{key:"dragging",get:function(){return null!==this.source}}])}(),te=function(e){function n(e,t,r,a,u,s){var l;return i(this,n),(l=o(this,n)).target=e,l.source=t,l.container=r,l.clientX=a,l.clientY=u,l.originalEvent=s,l}return d(n,e),u(n)}(S),re=function(e){function n(){return i(this,n),o(this,n,arguments)}return d(n,e),u(n)}(te);l(re,"type","drag:start"),l(re,"cancelable",!0);var oe=function(e){function n(){return i(this,n),o(this,n,arguments)}return d(n,e),u(n)}(te);l(oe,"type","drag:move");var ie=function(e){function n(){return i(this,n),o(this,n,arguments)}return d(n,e),u(n)}(te);l(ie,"type","drag:end");var ae=function(e){function n(){var e;i(this,n);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return l(e=o(this,n,[].concat(r)),"onMouseDown",(function(n){if(0===n.button&&!n.altKey&&!e.dragging){var t=e.getSource(n);t&&(e.source=t,e.startEvent=n,e.env.addEventListener("mouseup",e.onMouseUp),e.env.addEventListener("dragstart",ue),e.env.addEventListener("mousemove",e.onFirstMouseMove))}})),l(e,"onKeyDown",(function(n){var t;if(e.dragging&&n.target&&!n.isComposing&&"escape"===(null===(t=n.code)||void 0===t?void 0:t.toLowerCase())){var r=e,o=r.source,i=r.container;e.cancel(),e.onDragEnd(new ie(n.target,o,i,0,0,n))}})),l(e,"onFirstMouseMove",(function(){e.env.removeEventListener("mousemove",e.onFirstMouseMove),e.startDrag()})),l(e,"onMouseMove",(function(n){if(n.target instanceof Element){var t=new oe(n.target,e.source,e.container,n.clientX,n.clientY,n);e.onDragMove(t)}})),l(e,"onMouseUp",(function(n){if(0===n.button&&n.target instanceof Element){var t=e.source;if(e.cancel(),t){var r=new ie(n.target,t,e.container,n.clientX,n.clientY,n);e.onDragEnd(r)}}})),l(e,"onContextMenuWhileDragging",(function(e){e.preventDefault()})),e}return d(n,e),u(n,[{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)}}])}(ne);function ue(e){e.preventDefault()}function se(e){var n=e.touches,t=e.changedTouches;return n&&n[0]||t&&t[0]}var le=!1;window.addEventListener("touchmove",(function(e){le&&e.preventDefault()}),{passive:!1});var ce=function(e){function n(){var e;i(this,n);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return l(e=o(this,n,[].concat(r)),"onTouchStartAt",0),l(e,"onTouchStart",(function(n){if(!e.dragging&&n.target instanceof Element){var t=e.getSource(n);t&&(e.source=t,e.startEvent=n,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 n=se(e.startEvent),t=new re(e.startEvent.target,e.source,e.container,n.pageX,n.pageY,e.startEvent);e.onDragStrat(t),t.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(n){var t=se(n),r=t.pageX,o=t.pageY,i=document.elementFromPoint(r-window.scrollX,o-window.scrollY);if(i){var a=new oe(i,e.source,e.container,r,o,n);e.onDragMove(a)}})),l(e,"onTouchEnd",(function(n){var t=e.source;if(e.cancel(),t){n.preventDefault();var r=se(n),o=r.pageX,i=r.pageY,a=document.elementFromPoint(o-window.scrollX,i-window.scrollY);if(!a)return;var u=new ie(a,t,e.container,o,i,n);e.onDragEnd(u)}})),e}return d(n,e),u(n,[{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)}}])}(ne);function ve(e){e.preventDefault(),e.stopPropagation()}var de=function(e){function n(e,t){var r;return i(this,n),l(r=o(this,n),"source",null),l(r,"currentOver",null),r.container=e,r.options=t,r}return d(n,e),u(n,[{key:"isDraggable",value:function(e){var n,t,r;return null===(n=null===(t=(r=this.options).isDraggable)||void 0===t?void 0:t.call(r,e))||void 0===n||n}},{key:"isDroppable",value:function(e){var n,t,r;return null===(n=null===(t=(r=this.options).isDroppable)||void 0===t?void 0:t.call(r,e))||void 0===n||n}},{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 n(e,t,r,a){var u;return i(this,n),(u=o(this,n)).source=e,u.over=t,u.container=r,u.originalEvent=a,u}return d(n,e),u(n)}(S);l(fe,"type","drag");var pe=function(e){function n(e,t,r,a,u){var s;return i(this,n),(s=o(this,n)).source=e,s.container=t,s.originalEvent=r,s.clientX=a,s.clientY=u,s}return d(n,e),u(n)}(S);l(pe,"type","drag:start");var he=function(e){function n(e,t,r){var a;return i(this,n),(a=o(this,n)).source=e,a.container=t,a.originalEvent=r,a}return d(n,e),u(n)}(S);l(he,"type","drag:prevent");var ge=function(e){function n(e,t,r,a){var u;return i(this,n),(u=o(this,n)).source=e,u.enter=t,u.container=r,u.originalEvent=a,u}return d(n,e),u(n)}(S);l(ge,"type","drag:enter");var ye=function(e){function n(e,t,r,a,u,s){var l;return i(this,n),(l=o(this,n)).source=e,l.over=t,l.container=r,l.originalEvent=a,l.clientX=u,l.clientY=s,l}return d(n,e),u(n)}(S);l(ye,"type","drag:move");var me=function(e){function n(e,t,r,a){var u;return i(this,n),(u=o(this,n)).source=e,u.over=t,u.container=r,u.originalEvent=a,u}return d(n,e),u(n)}(S);l(me,"type","drag:over");var be=function(e){function n(e,t,r,a){var u;return i(this,n),(u=o(this,n)).source=e,u.leave=t,u.container=r,u.originalEvent=a,u}return d(n,e),u(n)}(S);l(be,"type","drag:leave");var Ee=function(e){function n(e,t,r,a){var u;return i(this,n),(u=o(this,n)).source=e,u.dropzone=t,u.container=r,u.originalEvent=a,u}return d(n,e),u(n)}(S);l(Ee,"type","drop");var we=function(e){function n(e,t,r,a){var u;return i(this,n),(u=o(this,n)).source=e,u.over=t,u.container=r,u.originalEvent=a,u}return d(n,e),u(n)}(S);l(we,"type","drag:end");var De=function(){return u((function e(n,t,r){var o=this;i(this,e),l(this,"destoryed",!1),l(this,"onSignalAborted",(function(){o.destroy()})),this.type=n,this.listener=t,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,n){var t,r=s(e);try{for(r.s();!(t=r.n()).done;){var o=t.value;if(o.is(n))return o}}catch(e){r.e(e)}finally{r.f()}return null}var Le=function(){return u((function e(n,t,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 n,t=s(a.scopeToAliveListeners.values());try{for(t.s();!(n=t.n()).done;){var r,o=n.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){t.e(e)}finally{t.f()}}})),this.type=n,this.behavior=t,this.isEnabled=r,this.isTrustedEvent=o,document.addEventListener(n,this.suppress,{capture:!0})}),[{key:"findAliveListener",value:function(e,n){var t=this.scopeToAliveListeners.get(e);return t?Oe(t.values(),n):null}},{key:"addAliveEventListener",value:function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(this.type===n){var o=new De(n,t,r);o.call=o.call.bind(o),document.addEventListener(n,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,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(this.type===n){var o=this.findAliveListener(e,t);o&&(this.scopeToAliveListeners.get(e).delete(o),document.removeEventListener(n,o.call,r))}}},{key:"clear",value:function(e){var n=this.scopeToAliveListeners.get(e);if(n){var t,r=s(n);try{for(r.s();!(t=r.n()).done;){var o=t.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,n=s(this.scopeToAliveListeners.values());try{for(n.s();!(e=n.n()).done;){var t,r=s(e.value);try{for(r.s();!(t=r.n()).done;){var o=t.value;o.destroy(),document.removeEventListener(o.type,o.call,o.options)}}catch(e){r.e(e)}finally{r.f()}}}catch(e){n.e(e)}finally{n.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(n){var t=this;i(this,e),l(this,"enabled",!1),l(this,"typeToSpecificEventSuppressor",new Map);for(var r=function(){return t.enabled},o=0,a=Object.keys(n);o<a.length;o++){var u=a[o],s=new Le(u,n[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,n=s(this.getAllSpecificEventSuppressors());try{for(n.s();!(e=n.n()).done;){e.value.destroy()}}catch(e){n.e(e)}finally{n.f()}}}])}();l(ke,"isTrustedEvent",(function(e){return e.isTrusted}));var Te=function(){return u((function e(n,t){i(this,e),l(this,"nativeListenerProxys",new Set),this.env=n,this.scope=t}),[{key:"enable",value:function(){this.env.enable()}},{key:"disable",value:function(){this.env.disable()}},{key:"addAliveEventListener",value:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.env.getSpecificEventSuppressor(e);r?r.addAliveEventListener(this.scope,e,n,t):this.addNativeEventListener(e,n,t)}},{key:"removeAliveEventListener",value:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.env.getSpecificEventSuppressor(e);r?r.removeAliveEventListener(this.scope,e,n,t):this.removeNativeEventListener(e,n,t)}},{key:"addNativeEventListener",value:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new De(e,n,t);r.call=r.call.bind(r),document.addEventListener(e,r.call,t),this.nativeListenerProxys.add(r)}},{key:"removeNativeEventListener",value:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Oe(this.nativeListenerProxys.values(),n);r&&(document.removeEventListener(e,r.call,t),this.nativeListenerProxys.delete(r))}},{key:"destroy",value:function(){var e,n=s(this.env.getAllSpecificEventSuppressors());try{for(n.s();!(e=n.n()).done;){e.value.clear(this.scope)}}catch(e){n.e(e)}finally{n.f()}var t,r=s(this.nativeListenerProxys.values());try{for(r.s();!(t=r.n()).done;){var o=t.value;document.removeEventListener(o.type,o.call,o.options)}}catch(e){r.e(e)}finally{r.f()}this.nativeListenerProxys.clear()}}])}();function Pe(e,n){e.dropEffect=n?xe(e.effectAllowed):"none"}function Me(e,n){n?"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 n(e,t){var r;return i(this,n),l(r=o(this,n,[e,t]),"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 n=new fe(r.source,r.currentOver,r.container,e);r.emit("drag",n)}})),l(r,"onDragStart",(function(e){if(!r.dragging&&e.dataTransfer){if(!Z(e.target,r.container))return null;var n=Z(e.target,r.options.source);if(n){var t,o=[];if(r.options.handle&&(o=ee(n,{isSource:function(e){return e.classList.contains(r.options.source)},isHandle:function(e){return e.classList.contains(r.options.handle)}})).length){if(!(t=o.find((function(n){return!!Z(e.target,n)}))))return void e.preventDefault();if(!function(e,n){for(var t=e;t!==n&&!t.draggable&&t.parentElement;)t=t.parentElement;return t!==n}(t,n))return void console.error("[vdnd error]: NativeDnd requires the handle must be draggable, the illegal handle is ",t)}if(r.isDraggable(n)){if(r.source=n,r.trigger=t||n,t&&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(n,r.container,e);r.emit("drag:start",s)}else{e.preventDefault();var l=new he(n,r.container,e);r.emit("drag:prevent",l)}}}})),l(r,"onDragEnter",(function(e){if(r.dragging&&e.target instanceof Element&&e.dataTransfer){var n=Z(e.target,r.container)&&Z(e.target,r.options.dropzone);if(n)if(e.preventDefault(),Pe(e.dataTransfer,r.isDroppable(n)),r.temporaryLeave=null,n!==r.currentOver){r.temporaryPreviousOver=r.currentOver,r.currentOver=n;var t=new ge(r.source,n,r.container,e);r.emit("drag:enter",t),Me(e.dataTransfer,r.isDroppable(n))}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 n=r.temporaryPreviousOver||r.currentOver;r.temporaryPreviousOver=null,null===e.relatedTarget&&(r.temporaryLeave=n),n===r.currentOver&&(r.currentOver=null);var t=new be(r.source,n,r.container,e);r.emit("drag:leave",t)}})),l(r,"onDragOver",(function(e){if(r.dragging&&r.currentOver&&e.target instanceof Element&&e.dataTransfer&&Z(e.target,r.currentOver)){var n=r.isDroppable(r.currentOver);n&&e.preventDefault(),Pe(e.dataTransfer,n);var t=new me(r.source,r.currentOver,r.container,e);r.emit("drag:over",t),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 n=new Ee(r.source,r.currentOver,r.container,e);r.emit("drop",n)}})),l(r,"onDragEnd",(function(e){if(r.dragging&&e.target instanceof Element&&e.dataTransfer&&Z(e.target,r.trigger)){var n=new we(r.source,r.currentOver||r.temporaryLeave,r.container,e);r.emit("drag:end",n),r.trigger=null,r.source=null,r.currentOver=null,r.temporaryPreviousOver=null,r.temporaryLeave=null,r.shouldSkipDragLeaveHandler=!1}})),r.container=e,r.options=t,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(n,e),u(n,[{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(n,"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 n(e,t){var r,a;return i(this,n),l(a=o(this,n,[e,t]),"plugins",[]),l(a,"simulator",null),l(a,"eventSuppressor",null),l(a,"clearIntervalTaskForDrag",j),l(a,"clearIntervalTaskForDragOver",j),a.container=e,a.options=t,(r=a).addPlugin.apply(r,E(n.defaultPlugins)),a.eventSuppressor=t.eventSuppressor||null,a.setSimulator(a.options.simulator),a.initIntervalTasks(),a}return d(n,e),u(n,[{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(n,"destroy",this)([]))}},{key:"addPlugin",value:function(){for(var e=this,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];var o=t.map((function(n){return new n(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,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=this.plugins.filter((function(e){return n.some((function(n){return e instanceof n}))}));return r.forEach((function(e){return e.detach()})),this.plugins=this.plugins.filter((function(e){return n.some((function(n){return e instanceof n}))})),this}},{key:"initIntervalTasks",value:function(){var e=this;this.runIntervalTaskForDrag=function(t){var r=setInterval((function(){if(!t.canceled()&&e.dragging){var n=new fe(e.source,e.currentOver,e.container,null);e.emit("drag",n)}}),n.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 t=setInterval((function(){if(e.dragging&&e.currentOver){var n=new me(e.source,e.currentOver,e.container,null);e.emit("drag:over",n)}}),n.eventTriggeringInterval.dragover);e.clearIntervalTaskForDragOver=function(){clearInterval(t),e.clearIntervalTaskForDragOver=j}},this.on("drag:enter",this.runIntervalTaskForDragOver),this.on("drag:leave",(function(){return e.clearIntervalTaskForDragOver()}))}},{key:"setSimulator",value:function(e){var n;if(!this.dragging){var t;if(!e)return null===(t=this.simulator)||void 0===t||t.detach(),void(this.simulator=null);null===(n=this.simulator)||void 0===n||n.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 n;if(!this.dragging){if(!this.isDraggable(e.source)){var t=new he(e.source,this.container,e.originalEvent);return this.emit("drag:prevent",t),void e.cancel()}this.source=e.source,null===(n=this.eventSuppressor)||void 0===n||n.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 n=Z(e.target,this.container)&&Z(e.target,this.options.dropzone),t=n?!!this.currentOver&&n!==this.currentOver:!!this.currentOver,r=null;if(n&&this.currentOver!==n){r=n;var o=new ge(this.source,n,this.container,e.originalEvent);this.emit("drag:enter",o)}if(t){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 n;if(this.dragging){if(null===(n=this.eventSuppressor)||void 0===n||n.disable(),ze(document.body,""),this.currentOver)if(!(e.originalEvent instanceof KeyboardEvent)&&this.isDroppable(this.currentOver)){var t=new Ee(this.source,this.currentOver,this.container,e.originalEvent);this.emit("drop",t)}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,n){e.style.webkitUserSelect=n,e.style.mozUserSelect=n,e.style.msUserSelect=n,e.style.oUserSelect=n,e.style.userSelect=n}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 t=e.type,r=n.shallowRef();function o(e){var n,t,o,i,a,u,s,l=h({},e);(null!==(n=l.debug)&&void 0!==n||(l.debug=!1),null!==(t=l.strict)&&void 0!==t||(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:t},e.options));var i=!1,a=function(){var r=n.watch(n.toRef(e,"options"),(function(){e.isDragging()?(i=!0,r()):o(h({type:t},e.options))}),{flush:"pre",deep:!0})};return a(),e.on("drag:end",(function(){i&&(i=!1,o(h({type:t},e.options)),a())})),r}function Ce(e,t,r){n.provide(Ye,e.rootDndElement),e.$setRootDndElement(e.rootDndElement),n.onMounted((function(){e.rootDndElement.nativeEl=r.value||null,e.rootDndElement.nativeEl&&e.rootDndElement.nativeEl}));var o,i=(o=new Map,{storeDndElement:function(e,n){return o.set(e,n)},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 t.value},storeDndElement:a,getDndElementByNativeEl:u,deleteDndElementByNativeEl:s,classnamesOf:function(e){return z("source"===e||"dropzone"===e||"handle"===e?n.unref(t)[e]:n.unref(t).classes[e])},isDraggable:function(e){var n,t=u(e);return null!==(n=null==t?void 0:t.draggable)&&void 0!==n&&n},isDroppable:function(n){var r=u(n);return!!r&&(!!r.droppable&&(!t.value.strict||!e.isDragging({id:r.id})))}};return n.provide(Ie,l),l}function _e(e,t){var r=n.shallowRef(null);return n.onMounted((function(){n.watchEffect((function(n){r.value=e(t()),n((function(){var e;null===(e=r.value)||void 0===e||e.destroy(),r.value=null}))}))})),r}function Fe(e,t){var r=e.instance,o=e.getDndElementByNativeEl,i=r.isDragging,a=function(){return e.options.strict},u=function(e){var n=e.over,t=e.container,u=e.originalEvent,s=n&&o(n);r.$emit("drag",{type:"drag",source:r.source,container:t,over:s?a()&&i({id:s.id})?null:s:null,originalEvent:u})},s=function(e){var n=e.container,t=e.originalEvent,i=o(e.source);r.$setSource(i),r.$emit("drag:start",{type:"drag:start",source:i,container:n,originalEvent:t})},l=function(e){var n=e.container,t=e.originalEvent,i=o(e.source);I(i)?r.$emit("drag:prevent",{type:"drag:prevent",source:i,container:n,originalEvent:t}):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 n=o(e.enter);if(I(n)){if(!a()||!i({id:n.id})){r.$setOver(n);var t=e.container,u=e.originalEvent;r.$emit("drag:enter",{type:"drag:enter",source:r.source,enter:n,container:t,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 n=o(e.over);if(I(n)&&(!a()||!i({id:n.id}))){var t=e.container,u=e.originalEvent;r.$emit("drag:over",{type:"drag:over",source:r.source,over:n,container:t,originalEvent:u})}},d=function(e){var n,t=o(e.leave);if(I(t)&&(!a()||!i({id:t.id}))){var u=e.container,s=e.originalEvent;t.id===(null===(n=r.over)||void 0===n?void 0:n.id)&&r.$setOver(null),r.$emit("drag:leave",{type:"drag:leave",source:r.source,leave:t,container:u,originalEvent:s})}},f=j,p=function(e){var n=e.container,t=e.originalEvent,u=o(e.dropzone);if(!a()||!i({id:u.id})){var s={type:"drop",dropzone:u,source:r.source,container:n,originalEvent:t};f=function(){return r.$emit("drop",s)}}},h=function(e){f(),f=j;var t=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),n.nextTick((function(){r.$emit("drag:end",{type:"drag:end",source:s,over:l?a()&&c?null:l:null,container:t,originalEvent:u})}))};n.watchEffect((function(){var e=t.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"}),n.onUpdated((function(){var n,t;if(r.isDragging()){var o=e.getDndElementByNativeEl;if(null!==(n=r.source)&&void 0!==n&&n.nativeEl)o(r.source.nativeEl)||console.error("[vdnd error]: the current source was removed while dragging, this may lead to bugs");if(null!==(t=r.over)&&void 0!==t&&t.nativeEl)o(r.over.nativeEl)||console.error("[vdnd error]: the current drop target was removed while dragging, this may lead to bugs")}}))}var $e=n.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,t){var r=t.emit,o=t.slots,i=e.instance,a=Ne(i),u=n.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)})),n.onMounted((function(){r("initialized")})),n.onBeforeUnmount((function(){i.$destroy()}));return function(){var t;return n