forked from anseki/plain-draggable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plain-draggable-limit.min.js
2 lines (2 loc) · 21.2 KB
/
plain-draggable-limit.min.js
1
2
/*! PlainDraggable v2.5.12 (c) anseki https://anseki.github.io/plain-draggable/ */
var PlainDraggable=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var o=500,r=[],i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return clearTimeout(t)},l=Date.now(),u=void 0;function s(){var t=void 0,e=void 0;u&&(a.call(window,u),u=null),r.forEach(function(e){var n;(n=e.event)&&(e.event=null,e.listener(n),t=!0)}),t?(l=Date.now(),e=!0):Date.now()-l<o&&(e=!0),e&&(u=i.call(window,s))}function c(t){var e=-1;return r.some(function(n,o){return n.listener===t&&(e=o,!0)}),e}var d={add:function(t){var e=void 0;return-1===c(t)?(r.push(e={listener:t}),function(t){e.event=t,u||s()}):null},remove:function(t){var e;(e=c(t))>-1&&(r.splice(e,1),!r.length&&u&&(a.call(window,u),u=null))}},f=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var p=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){p=!0}}))}catch(t){}function h(t,e,n,o){t.addEventListener(e,n,p?o:o.capture)}function m(t,e){if(null!=t&&null!=e)for(var n=0;n<t.length;n++)if(t[n].identifier===e)return t[n];return null}function v(t){return t&&"number"==typeof t.clientX&&"number"==typeof t.clientY}function g(t){t.preventDefault()}var y=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.startHandlers={},this.lastHandlerId=0,this.curPointerClass=null,this.curTouchId=null,this.lastPointerXY={clientX:0,clientY:0},this.lastTouchTime=0,this.options={preventDefault:!0,stopPropagation:!0},e&&["preventDefault","stopPropagation"].forEach(function(t){"boolean"==typeof e[t]&&(n.options[t]=e[t])})}return f(t,[{key:"regStartHandler",value:function(t){var e=this;return e.startHandlers[++e.lastHandlerId]=function(n){var o="mousedown"===n.type?"mouse":"touch",r=Date.now(),i=void 0,a=void 0;if("touch"===o)e.lastTouchTime=r,i=n.changedTouches[0],a=n.changedTouches[0].identifier;else{if(r-e.lastTouchTime<400)return;i=n}if(!v(i))throw new Error("No clientX/clientY");e.curPointerClass&&e.cancel(),t.call(e,i)&&(e.curPointerClass=o,e.curTouchId="touch"===o?a:null,e.lastPointerXY.clientX=i.clientX,e.lastPointerXY.clientY=i.clientY,e.options.preventDefault&&n.preventDefault(),e.options.stopPropagation&&n.stopPropagation())},e.lastHandlerId}},{key:"unregStartHandler",value:function(t){delete this.startHandlers[t]}},{key:"addStartHandler",value:function(t,e){if(!this.startHandlers[e])throw new Error("Invalid handlerId: "+e);return h(t,"mousedown",this.startHandlers[e],{capture:!1,passive:!1}),h(t,"touchstart",this.startHandlers[e],{capture:!1,passive:!1}),h(t,"dragstart",g,{capture:!1,passive:!1}),e}},{key:"removeStartHandler",value:function(t,e){if(!this.startHandlers[e])throw new Error("Invalid handlerId: "+e);return t.removeEventListener("mousedown",this.startHandlers[e],!1),t.removeEventListener("touchstart",this.startHandlers[e],!1),t.removeEventListener("dragstart",g,!1),e}},{key:"addMoveHandler",value:function(t,e){var n=this,o=d.add(function(t){var e="mousemove"===t.type?"mouse":"touch";if("touch"===e&&(n.lastTouchTime=Date.now()),e===n.curPointerClass){var o="touch"===e?m(t.changedTouches,n.curTouchId):t;v(o)&&(o.clientX===n.lastPointerXY.clientX&&o.clientY===n.lastPointerXY.clientY||n.move(o),n.options.preventDefault&&t.preventDefault(),n.options.stopPropagation&&t.stopPropagation())}});h(t,"mousemove",o,{capture:!1,passive:!1}),h(t,"touchmove",o,{capture:!1,passive:!1}),n.curMoveHandler=e}},{key:"move",value:function(t){v(t)&&(this.lastPointerXY.clientX=t.clientX,this.lastPointerXY.clientY=t.clientY),this.curMoveHandler&&this.curMoveHandler(this.lastPointerXY)}},{key:"addEndHandler",value:function(t,e){var n=this;function o(t){var e="mouseup"===t.type?"mouse":"touch";if("touch"===e&&(n.lastTouchTime=Date.now()),e===n.curPointerClass){var o="touch"===e?m(t.changedTouches,n.curTouchId)||(m(t.touches,n.curTouchId)?null:{}):t;o&&(n.end(o),n.options.preventDefault&&t.preventDefault(),n.options.stopPropagation&&t.stopPropagation())}}h(t,"mouseup",o,{capture:!1,passive:!1}),h(t,"touchend",o,{capture:!1,passive:!1}),n.curEndHandler=e}},{key:"end",value:function(t){v(t)&&(this.lastPointerXY.clientX=t.clientX,this.lastPointerXY.clientY=t.clientY),this.curEndHandler&&this.curEndHandler(this.lastPointerXY),this.curPointerClass=this.curTouchId=null}},{key:"addCancelHandler",value:function(t,e){var n=this;h(t,"touchcancel",function(t){n.lastTouchTime=Date.now(),null!=n.curPointerClass&&(m(t.changedTouches,n.curTouchId)||!m(t.touches,n.curTouchId))&&n.cancel()},{capture:!1,passive:!1}),n.curCancelHandler=e}},{key:"cancel",value:function(){this.curCancelHandler&&this.curCancelHandler(),this.curPointerClass=this.curTouchId=null}}],[{key:"addEventListenerWithOptions",get:function(){return h}}]),t}();function w(t){return t.substr(0,1).toUpperCase()+t.substr(1)}var b=["webkit","moz","ms","o"],x=b.reduce(function(t,e){return t.push(e),t.push(w(e)),t},[]),E=b.map(function(t){return"-"+t+"-"}),S=function(){var t=void 0;return function(){return t=t||document.createElement("div").style}}(),C=function(){var t=new RegExp("^(?:"+b.join("|")+")(.)","i"),e=/[A-Z]/;return function(n){return"float"===(n=(n+"").replace(/\s/g,"").replace(/-([\da-z])/gi,function(t,e){return e.toUpperCase()}).replace(t,function(t,n){return e.test(n)?n.toLowerCase():t})).toLowerCase()?"cssFloat":n}}(),T=function(){var t=new RegExp("^(?:"+E.join("|")+")","i");return function(e){return(null!=e?e+"":"").replace(/\s/g,"").replace(t,"")}}(),I=function(t,e){var n=S();return t=t.replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()}),n.setProperty(t,e),null!=n[t]&&n.getPropertyValue(t)===e},k={},O={};function P(t){if((t=C(t))&&null==k[t]){var e=S();if(null!=e[t])k[t]=t;else{var n=w(t);x.some(function(o){var r=o+n;return null!=e[r]&&(k[t]=r,!0)})||(k[t]=!1)}}return k[t]||void 0}var _={getName:P,getValue:function(t,e){var n=void 0;return(t=P(t))?(O[t]=O[t]||{},(Array.isArray(e)?e:[e]).some(function(e){return e=T(e),null!=O[t][e]?!1!==O[t][e]&&(n=O[t][e],!0):I(t,e)?(n=O[t][e]=e,!0):!!E.some(function(o){var r=o+e;return!!I(t,r)&&(n=O[t][e]=r,!0)})||(O[t][e]=!1,!1)}),"string"==typeof n?n:void 0):n}};function B(t){return(t+"").trim()}function D(t,e){e.setAttribute("class",t.join(" "))}function H(t){return!H.ignoreNative&&t.classList||function(){var e=(t.getAttribute("class")||"").trim().split(/\s+/).filter(function(t){return!!t}),n={length:e.length,item:function(t){return e[t]},contains:function(t){return-1!==e.indexOf(B(t))},add:function(){return function(t,e,n){n.filter(function(e){return!(!(e=B(e))||-1!==t.indexOf(e)||(t.push(e),0))}).length&&D(t,e)}(e,t,Array.prototype.slice.call(arguments)),H.methodChain?n:void 0},remove:function(){return function(t,e,n){n.filter(function(e){var n=void 0;return!(!(e=B(e))||-1===(n=t.indexOf(e))||(t.splice(n,1),0))}).length&&D(t,e)}(e,t,Array.prototype.slice.call(arguments)),H.methodChain?n:void 0},toggle:function(n,o){return function(t,e,n,o){var r=t.indexOf(n=B(n));return-1!==r?!!o||(t.splice(r,1),D(t,e),!1):!1!==o&&(t.push(n),D(t,e),!0)}(e,t,n,o)},replace:function(o,r){return function(t,e,n,o){var r=void 0;(n=B(n))&&(o=B(o))&&n!==o&&-1!==(r=t.indexOf(n))&&(t.splice(r,1),-1===t.indexOf(o)&&t.push(o),D(t,e))}(e,t,o,r),H.methodChain?n:void 0}};return n}()}H.methodChain=!0;var j=H,X=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};j.ignoreNative=!0;var M=9e3,A="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style&&!window.navigator.msPointerEnabled,L=!A&&!!document.uniqueID,z="MozAppearance"in document.documentElement.style,N=!(A||z||!window.chrome||!window.CSS),F=!A&&!L&&!z&&!N&&!window.chrome&&"WebkitAppearance"in document.documentElement.style,R=function(){var t={}.toString,e={}.hasOwnProperty.toString,n=e.call(Object);return function(o){var r=void 0,i=void 0;return o&&"[object Object]"===t.call(o)&&(!(r=Object.getPrototypeOf(o))||(i=r.hasOwnProperty("constructor")&&r.constructor)&&"function"==typeof i&&e.call(i)===n)}}(),W=Number.isFinite||function(t){return"number"==typeof t&&window.isFinite(t)},U={},Z={},q=new y,V=0,$=void 0,G=void 0,J=void 0,K=void 0,Q=void 0,tt=void 0,et=void 0,nt=void 0,ot=void 0,rt=void 0,it=F?["all-scroll","move"]:["grab","all-scroll","move"],at=F?"move":["grabbing","move"],lt="plain-draggable",ut="plain-draggable-dragging",st="plain-draggable-moving";function ct(t){return t?R(t)?Object.keys(t).reduce(function(e,n){return e[n]=ct(t[n]),e},{}):Array.isArray(t)?t.map(ct):t:t}function dt(t){return!(!t||t.nodeType!==Node.ELEMENT_NODE||"function"!=typeof t.getBoundingClientRect||t.compareDocumentPosition(document)&Node.DOCUMENT_POSITION_DISCONNECTED)}function ft(t){if(!R(t))return null;var e=void 0;if(!W(e=t.left)&&!W(e=t.x))return null;if(t.left=t.x=e,!W(e=t.top)&&!W(e=t.y))return null;if(t.top=t.y=e,W(t.width)&&t.width>=0)t.right=t.left+t.width;else{if(!(W(t.right)&&t.right>=t.left))return null;t.width=t.right-t.left}if(W(t.height)&&t.height>=0)t.bottom=t.top+t.height;else{if(!(W(t.bottom)&&t.bottom>=t.top))return null;t.height=t.bottom-t.top}return t}function pt(t){return W(t)?{value:t,isRatio:!1}:"string"==typeof t?function(t){var e=/^(.+?)(%)?$/.exec(t),n=void 0,o=void 0;return e&&W(n=parseFloat(e[1]))?{value:(o=!(!e[2]||!n))?n/100:n,isRatio:o}:null}(t.replace(/\s/g,"")):null}function ht(t,e){var n=t.getBoundingClientRect(),o={left:n.left,top:n.top,width:n.width,height:n.height};if(o.left+=window.pageXOffset,o.top+=window.pageYOffset,e){var r=window.getComputedStyle(t,""),i=parseFloat(r.borderTopWidth)||0,a=parseFloat(r.borderRightWidth)||0,l=parseFloat(r.borderBottomWidth)||0,u=parseFloat(r.borderLeftWidth)||0;o.left+=u,o.top+=i,o.width-=u+a,o.height-=i+l}return ft(o)}function mt(t,e){null==K&&(!1!==it&&(K=_.getValue("cursor",it)),null==K&&(K=!1)),t.style.cursor=!1===K?e:K}function vt(t){null==Q&&(!1!==at&&(Q=_.getValue("cursor",at)),null==Q&&(Q=!1)),!1!==Q&&(t.style.cursor=Q)}function gt(t,e){var n=t.elementBBox;if(e.left!==n.left||e.top!==n.top){var o=t.htmlOffset;return t.elementStyle[nt]="translate("+(e.left+o.left)+"px, "+(e.top+o.top)+"px)",!0}return!1}function yt(t,e,n){var o=t.elementBBox;function r(){t.minLeft>=t.maxLeft?e.left=o.left:e.left<t.minLeft?e.left=t.minLeft:e.left>t.maxLeft&&(e.left=t.maxLeft),t.minTop>=t.maxTop?e.top=o.top:e.top<t.minTop?e.top=t.minTop:e.top>t.maxTop&&(e.top=t.maxTop)}if(r(),n){if(!1===n(e))return!1;r()}var i=t.moveElm(t,e);return i&&(t.elementBBox=ft({left:e.left,top:e.top,width:o.width,height:o.height})),i}function wt(t){var e=t.element,n=t.elementStyle,o=ht(e),r=["display","marginTop","marginBottom","width","height"];r.unshift(nt);var i=n[et];n[et]="none";var a=ht(e);t.orgStyle?r.forEach(function(e){null!=t.lastStyle[e]&&n[e]!==t.lastStyle[e]||(n[e]=t.orgStyle[e])}):(t.orgStyle=r.reduce(function(t,e){return t[e]=n[e]||"",t},{}),t.lastStyle={});var l=ht(e),u=window.getComputedStyle(e,"");"inline"===u.display&&(n.display="inline-block",["Top","Bottom"].forEach(function(t){var e=parseFloat(u["padding"+t]);n["margin"+t]=e?"-"+e+"px":"0"})),n[nt]="translate(0, 0)";var s=ht(e),c=t.htmlOffset={left:s.left?-s.left:0,top:s.top?-s.top:0};return n[nt]="translate("+(o.left+c.left)+"px, "+(o.top+c.top)+"px)",["width","height"].forEach(function(o){s[o]!==l[o]&&(n[o]=l[o]+"px",(s=ht(e))[o]!==l[o]&&(n[o]=l[o]-(s[o]-l[o])+"px")),t.lastStyle[o]=n[o]}),e.offsetWidth,n[et]=i,a.left===o.left&&a.top===o.top||(n[nt]="translate("+(a.left+c.left)+"px, "+(a.top+c.top)+"px)"),a}function bt(t,e){var n=ht(document.documentElement),o=t.elementBBox=t.initElm(t),r=t.containmentBBox=t.containmentIsBBox?function(t,e){var n={left:"x",right:"x",x:"x",width:"x",top:"y",bottom:"y",y:"y",height:"y"},o={x:e.left,y:e.top},r={x:e.width,y:e.height};return ft(Object.keys(t).reduce(function(e,i){return e[i]=function(t,e,n){return"number"==typeof t?t:e+t.value*(t.isRatio?n:1)}(t[i],"width"===i||"height"===i?0:o[n[i]],r[n[i]]),e},{}))}(t.options.containment,n)||n:ht(t.options.containment,!0);t.minLeft=r.left,t.maxLeft=r.right-o.width,t.minTop=r.top,t.maxTop=r.bottom-o.height,yt(t,{left:o.left,top:o.top})}function xt(t){mt(t.options.handle,t.orgCursor),J.style.cursor=tt,!1!==t.options.zIndex&&(t.elementStyle.zIndex=t.orgZIndex),ot&&(J.style[ot]=rt);var e=j(t.element);st&&e.remove(st),ut&&e.remove(ut),$=null,q.cancel(),t.onDragEnd&&t.onDragEnd({left:t.elementBBox.left,top:t.elementBBox.top})}function Et(t,e){var n=t.options,o=void 0;if(e.containment){var r=void 0;dt(e.containment)?e.containment!==n.containment&&(n.containment=e.containment,t.containmentIsBBox=!1,o=!0):(r=function(t){if(!R(t))return null;var e=void 0;if(!(e=pt(t.left))&&!(e=pt(t.x)))return null;if(t.left=t.x=e,!(e=pt(t.top))&&!(e=pt(t.y)))return null;if(t.top=t.y=e,(e=pt(t.width))&&e.value>=0)t.width=e,delete t.right;else{if(!(e=pt(t.right)))return null;t.right=e,delete t.width}if((e=pt(t.height))&&e.value>=0)t.height=e,delete t.bottom;else{if(!(e=pt(t.bottom)))return null;t.bottom=e,delete t.height}return t}(ct(e.containment)))&&function t(e,n){var o=void 0,r=void 0;return(void 0===e?"undefined":Y(e))!==(void 0===n?"undefined":Y(n))||(o=R(e)?"obj":Array.isArray(e)?"array":"")!=(R(n)?"obj":Array.isArray(n)?"array":"")||("obj"===o?t(r=Object.keys(e).sort(),Object.keys(n).sort())||r.some(function(o){return t(e[o],n[o])}):"array"===o?e.length!==n.length||e.some(function(e,o){return t(e,n[o])}):e!==n)}(r,n.containment)&&(n.containment=r,t.containmentIsBBox=!0,o=!0)}if(o&&bt(t),dt(e.handle)&&e.handle!==n.handle){n.handle&&(n.handle.style.cursor=t.orgCursor,ot&&(n.handle.style[ot]=t.orgUserSelect),q.removeStartHandler(n.handle,t.pointerEventHandlerId));var i=n.handle=e.handle;t.orgCursor=i.style.cursor,mt(i,t.orgCursor),ot&&(t.orgUserSelect=i.style[ot],i.style[ot]="none"),q.addStartHandler(i,t.pointerEventHandlerId)}(W(e.zIndex)||!1===e.zIndex)&&(n.zIndex=e.zIndex,t===$&&(t.elementStyle.zIndex=!1===n.zIndex?t.orgZIndex:n.zIndex));var a={left:t.elementBBox.left,top:t.elementBBox.top},l=void 0;W(e.left)&&e.left!==a.left&&(a.left=e.left,l=!0),W(e.top)&&e.top!==a.top&&(a.top=e.top,l=!0),l&&yt(t,a),["onDrag","onMove","onDragStart","onMoveStart","onDragEnd"].forEach(function(o){"function"==typeof e[o]?(n[o]=e[o],t[o]=n[o].bind(t.ins)):e.hasOwnProperty(o)&&null==e[o]&&(n[o]=t[o]=void 0)})}var St=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var o={ins:this,options:{zIndex:M},disabled:!1};if(Object.defineProperty(this,"_id",{value:++V}),o._id=this._id,U[this._id]=o,!dt(e)||e===J)throw new Error("This element is not accepted.");if(n){if(!R(n))throw new Error("Invalid options.")}else n={};var r=!0,i=_.getName("willChange");if(i&&(r=!1),n.leftTop||!nt)throw new Error("`transform` is not supported.");if(i&&(e.style[i]="transform"),o.initElm=wt,o.moveElm=gt,o.element=function(t,e){var n=t.style;n.webkitTapHighlightColor="transparent";var o=_.getName("boxShadow"),r=window.getComputedStyle(t,"")[o];return r&&"none"!==r||(n[o]="0 0 1px transparent"),e&&nt&&(n[nt]="translateZ(0)"),t}(e,r),o.elementStyle=e.style,o.orgZIndex=o.elementStyle.zIndex,lt&&j(e).add(lt),o.pointerEventHandlerId=q.regStartHandler(function(t){return function(t,e){return!(t.disabled||t.onDragStart&&!1===t.onDragStart(e)||($&&xt($),vt(t.options.handle),J.style.cursor=Q||window.getComputedStyle(t.options.handle,"").cursor,!1!==t.options.zIndex&&(t.elementStyle.zIndex=t.options.zIndex),ot&&(J.style[ot]="none"),ut&&j(t.element).add(ut),$=t,G=!1,Z.left=t.elementBBox.left-(e.clientX+window.pageXOffset),Z.top=t.elementBBox.top-(e.clientY+window.pageYOffset),0))}(o,t)}),!n.containment){var a;n.containment=(a=e.parentNode)&&dt(a)?a:J}n.handle||(n.handle=e),Et(o,n)}return X(t,[{key:"remove",value:function(){var t=U[this._id];this.disabled=!0,q.unregStartHandler(q.removeStartHandler(t.options.handle,t.pointerEventHandlerId)),delete U[this._id]}},{key:"setOptions",value:function(t){return R(t)&&Et(U[this._id],t),this}},{key:"position",value:function(){return bt(U[this._id]),this}},{key:"disabled",get:function(){return U[this._id].disabled},set:function(t){var e=U[this._id];(t=!!t)!==e.disabled&&(e.disabled=t,e.disabled?(e===$&&xt(e),e.options.handle.style.cursor=e.orgCursor,ot&&(e.options.handle.style[ot]=e.orgUserSelect),lt&&j(e.element).remove(lt)):(mt(e.options.handle,e.orgCursor),ot&&(e.options.handle.style[ot]="none"),lt&&j(e.element).add(lt)))}},{key:"element",get:function(){return U[this._id].element}},{key:"rect",get:function(){return ct(U[this._id].elementBBox)}},{key:"left",get:function(){return U[this._id].elementBBox.left},set:function(t){Et(U[this._id],{left:t})}},{key:"top",get:function(){return U[this._id].elementBBox.top},set:function(t){Et(U[this._id],{top:t})}},{key:"containment",get:function(){var t=U[this._id];return t.containmentIsBBox?function(t){return Object.keys(t).reduce(function(e,n){return e[n]=function(t){return t.isRatio?100*t.value+"%":t.value}(t[n]),e},{})}(t.options.containment):t.options.containment},set:function(t){Et(U[this._id],{containment:t})}},{key:"handle",get:function(){return U[this._id].options.handle},set:function(t){Et(U[this._id],{handle:t})}},{key:"zIndex",get:function(){return U[this._id].options.zIndex},set:function(t){Et(U[this._id],{zIndex:t})}},{key:"onDrag",get:function(){return U[this._id].options.onDrag},set:function(t){Et(U[this._id],{onDrag:t})}},{key:"onMove",get:function(){return U[this._id].options.onMove},set:function(t){Et(U[this._id],{onMove:t})}},{key:"onDragStart",get:function(){return U[this._id].options.onDragStart},set:function(t){Et(U[this._id],{onDragStart:t})}},{key:"onMoveStart",get:function(){return U[this._id].options.onMoveStart},set:function(t){Et(U[this._id],{onMoveStart:t})}},{key:"onDragEnd",get:function(){return U[this._id].options.onDragEnd},set:function(t){Et(U[this._id],{onDragEnd:t})}}],[{key:"draggableCursor",get:function(){return it},set:function(t){it!==t&&(it=t,K=null,Object.keys(U).forEach(function(t){var e=U[t];e.disabled||e===$&&!1!==Q||(mt(e.options.handle,e.orgCursor),e===$&&(J.style.cursor=tt,J.style.cursor=window.getComputedStyle(e.options.handle,"").cursor))}))}},{key:"draggingCursor",get:function(){return at},set:function(t){at!==t&&(at=t,Q=null,$&&(vt($.options.handle),!1===Q&&(mt($.options.handle,$.orgCursor),J.style.cursor=tt),J.style.cursor=Q||window.getComputedStyle($.options.handle,"").cursor))}},{key:"draggableClass",get:function(){return lt},set:function(t){(t=t?t+"":void 0)!==lt&&(Object.keys(U).forEach(function(e){var n=U[e];if(!n.disabled){var o=j(n.element);lt&&o.remove(lt),t&&o.add(t)}}),lt=t)}},{key:"draggingClass",get:function(){return ut},set:function(t){if((t=t?t+"":void 0)!==ut){if($){var e=j($.element);ut&&e.remove(ut),t&&e.add(t)}ut=t}}},{key:"movingClass",get:function(){return st},set:function(t){if((t=t?t+"":void 0)!==st){if($&&G){var e=j($.element);st&&e.remove(st),t&&e.add(t)}st=t}}}]),t}();q.addMoveHandler(document,function(t){if($){var e={left:t.clientX+window.pageXOffset+Z.left,top:t.clientY+window.pageYOffset+Z.top};yt($,e,$.onDrag)&&(G||(G=!0,st&&j($.element).add(st),$.onMoveStart&&$.onMoveStart(e)),$.onMove&&$.onMove(e))}});var Ct=function(){$&&xt($)};q.addEndHandler(document,Ct),q.addCancelHandler(document,Ct);var Tt=function(){et=_.getName("transitionProperty"),nt=_.getName("transform"),tt=J.style.cursor,(ot=_.getName("userSelect"))&&(rt=J.style[ot]);var t={},e=void 0;function n(t,e){t.initElm&&bt(t)}var o=!1,r=d.add(function(r){o||(o=!0,$&&(n($,r.type),q.move(),t[$._id]=!0),clearTimeout(e),e=setTimeout(function(){r.type,clearTimeout(e),Object.keys(U).forEach(function(e){t[e]||n(U[e])}),t={}},200),o=!1)});window.addEventListener("resize",r,!0),window.addEventListener("scroll",r,!0)};(J=document.body)?Tt():document.addEventListener("DOMContentLoaded",function(){J=document.body,Tt()},!0),St.limit=!0;e.default=St}]).default;