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