From 20c7964363f31b564df207a6b96777b97a3ffd46 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Fri, 24 Feb 2017 19:18:06 +0800 Subject: [PATCH] v1.3.1 --- dist/react-sortable.js | 2 +- dist/react-sortable.min.js | 2 +- docs/bundle.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/react-sortable.js b/dist/react-sortable.js index 0522494..64b6cc1 100644 --- a/dist/react-sortable.js +++ b/dist/react-sortable.js @@ -1,4 +1,4 @@ -/*! react-sortablejs v1.3.0 | (c) 2017 Cheton Wu | MIT | https://github.com/cheton/react-sortable */ +/*! react-sortablejs v1.3.1 | (c) 2017 Cheton Wu | MIT | https://github.com/cheton/react-sortable */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react"), require("react-dom"), require("sortablejs")); diff --git a/dist/react-sortable.min.js b/dist/react-sortable.min.js index 76a7b26..c3634af 100644 --- a/dist/react-sortable.min.js +++ b/dist/react-sortable.min.js @@ -1,2 +1,2 @@ -/*! react-sortablejs v1.3.0 | (c) 2017 Cheton Wu | MIT | https://github.com/cheton/react-sortable */ +/*! react-sortablejs v1.3.1 | (c) 2017 Cheton Wu | MIT | https://github.com/cheton/react-sortable */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom"),require("sortablejs")):"function"==typeof define&&define.amd?define(["react","react-dom","sortablejs"],t):"object"==typeof exports?exports.ReactSortable=t(require("react"),require("react-dom"),require("sortablejs")):e.ReactSortable=t(e.React,e.ReactDOM,e.Sortable)}(this,function(e,t,o){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,o){t.exports=e},function(e,o){e.exports=t},function(e,t){e.exports=o},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u,l,p="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},s=Object.assign||function(e){for(var t=1;t * @license MIT */ -!function(factory){"use strict";__WEBPACK_AMD_DEFINE_FACTORY__=factory,__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof __WEBPACK_AMD_DEFINE_FACTORY__?__WEBPACK_AMD_DEFINE_FACTORY__.call(exports,__webpack_require__,exports,module):__WEBPACK_AMD_DEFINE_FACTORY__,!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(function(){"use strict";function Sortable(el,options){if(!el||!el.nodeType||1!==el.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(el);this.el=el,this.options=options=_extend({},options),el[expando]=this;var defaults={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(el.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,animation:0,setData:function(dataTransfer,dragEl){dataTransfer.setData("Text",dragEl.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var name in defaults)!(name in options)&&(options[name]=defaults[name]);_prepareGroup(options);for(var fn in this)"_"===fn.charAt(0)&&"function"==typeof this[fn]&&(this[fn]=this[fn].bind(this));this.nativeDraggable=!options.forceFallback&&supportDraggable,_on(el,"mousedown",this._onTapStart),_on(el,"touchstart",this._onTapStart),_on(el,"pointerdown",this._onTapStart),this.nativeDraggable&&(_on(el,"dragover",this),_on(el,"dragenter",this)),touchDragOverListeners.push(this._onDragOver),options.store&&this.sort(options.store.get(this))}function _cloneHide(state){cloneEl&&cloneEl.state!==state&&(_css(cloneEl,"display",state?"none":""),!state&&cloneEl.state&&rootEl.insertBefore(cloneEl,dragEl),cloneEl.state=state)}function _closest(el,selector,ctx){if(el){ctx=ctx||document;do if(">*"===selector&&el.parentNode===ctx||_matches(el,selector))return el;while(el=_getParentOrHost(el))}return null}function _getParentOrHost(el){var parent=el.host;return parent&&parent.nodeType?parent:el.parentNode}function _globalDragOver(evt){evt.dataTransfer&&(evt.dataTransfer.dropEffect="move"),evt.preventDefault()}function _on(el,event,fn){el.addEventListener(event,fn,!1)}function _off(el,event,fn){el.removeEventListener(event,fn,!1)}function _toggleClass(el,name,state){if(el)if(el.classList)el.classList[state?"add":"remove"](name);else{var className=(" "+el.className+" ").replace(RSPACE," ").replace(" "+name+" "," ");el.className=(className+(state?" "+name:"")).replace(RSPACE," ")}}function _css(el,prop,val){var style=el&&el.style;if(style){if(void 0===val)return document.defaultView&&document.defaultView.getComputedStyle?val=document.defaultView.getComputedStyle(el,""):el.currentStyle&&(val=el.currentStyle),void 0===prop?val:val[prop];prop in style||(prop="-webkit-"+prop),style[prop]=val+("string"==typeof val?"":"px")}}function _find(ctx,tagName,iterator){if(ctx){var list=ctx.getElementsByTagName(tagName),i=0,n=list.length;if(iterator)for(;i5||evt.clientX-(rect.right+rect.width)>5)&&lastEl}function _generateId(el){for(var str=el.tagName+el.className+el.src+el.href+el.textContent,i=str.length,sum=0;i--;)sum+=str.charCodeAt(i);return sum.toString(36)}function _index(el,selector){var index=0;if(!el||!el.parentNode)return-1;for(;el&&(el=el.previousElementSibling);)"TEMPLATE"===el.nodeName.toUpperCase()||">*"!==selector&&!_matches(el,selector)||index++;return index}function _matches(el,selector){if(el){selector=selector.split(".");var tag=selector.shift().toUpperCase(),re=new RegExp("\\s("+selector.join("|")+")(?=\\s)","g");return!(""!==tag&&el.nodeName.toUpperCase()!=tag||selector.length&&((" "+el.className+" ").match(re)||[]).length!=selector.length)}return!1}function _throttle(callback,ms){var args,_this;return function(){void 0===args&&(args=arguments,_this=this,setTimeout(function(){1===args.length?callback.call(_this,args[0]):callback.apply(_this,args),args=void 0},ms))}}function _extend(dst,src){if(dst&&src)for(var key in src)src.hasOwnProperty(key)&&(dst[key]=src[key]);return dst}function _clone(el){return $?$(el).clone(!0)[0]:Polymer&&Polymer.dom?Polymer.dom(el).cloneNode(!0):el.cloneNode(!0)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var dragEl,parentEl,ghostEl,cloneEl,rootEl,nextEl,scrollEl,scrollParentEl,scrollCustomFn,lastEl,lastCSS,lastParentCSS,oldIndex,newIndex,activeGroup,putSortable,tapEvt,touchEvt,moved,autoScroll={},RSPACE=/\s+/g,expando="Sortable"+(new Date).getTime(),win=window,document=win.document,parseInt=win.parseInt,$=win.jQuery||win.Zepto,Polymer=win.Polymer,supportDraggable=!!("draggable"in document.createElement("div")),supportCssPointerEvents=function(el){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(el=document.createElement("x"),el.style.cssText="pointer-events:auto","auto"===el.style.pointerEvents)}(),_silent=!1,abs=Math.abs,min=Math.min,touchDragOverListeners=([].slice,[]),_autoScroll=_throttle(function(evt,options,rootEl){if(rootEl&&options.scroll){var el,rect,vx,vy,scrollOffsetX,scrollOffsetY,sens=options.scrollSensitivity,speed=options.scrollSpeed,x=evt.clientX,y=evt.clientY,winWidth=window.innerWidth,winHeight=window.innerHeight;if(scrollParentEl!==rootEl&&(scrollEl=options.scroll,scrollParentEl=rootEl,scrollCustomFn=options.scrollFn,scrollEl===!0)){scrollEl=rootEl;do if(scrollEl.offsetWidth-1:fromGroup==value)}}var group={},originalGroup=options.group;originalGroup&&"object"==typeof originalGroup||(originalGroup={name:originalGroup}),group.name=originalGroup.name,group.checkPull=toFn(originalGroup.pull,!0),group.checkPut=toFn(originalGroup.put),options.group=group};return Sortable.prototype={constructor:Sortable,_onTapStart:function(evt){var startIndex,_this=this,el=this.el,options=this.options,type=evt.type,touch=evt.touches&&evt.touches[0],target=(touch||evt).target,originalTarget=evt.target.shadowRoot&&evt.path[0]||target,filter=options.filter;if(!dragEl&&!("mousedown"===type&&0!==evt.button||options.disabled)&&(!options.handle||_closest(originalTarget,options.handle,el))&&(target=_closest(target,options.draggable,el))){if(startIndex=_index(target,options.draggable),"function"==typeof filter){if(filter.call(this,evt,target,this))return _dispatchEvent(_this,originalTarget,"filter",target,el,startIndex),void evt.preventDefault()}else if(filter&&(filter=filter.split(",").some(function(criteria){if(criteria=_closest(originalTarget,criteria.trim(),el))return _dispatchEvent(_this,criteria,"filter",target,el,startIndex),!0})))return void evt.preventDefault();this._prepareDragStart(evt,touch,target,startIndex)}},_prepareDragStart:function(evt,touch,target,startIndex){var dragStartFn,_this=this,el=_this.el,options=_this.options,ownerDocument=el.ownerDocument;target&&!dragEl&&target.parentNode===el&&(tapEvt=evt,rootEl=el,dragEl=target,parentEl=dragEl.parentNode,nextEl=dragEl.nextSibling,activeGroup=options.group,oldIndex=startIndex,this._lastX=(touch||evt).clientX,this._lastY=(touch||evt).clientY,dragEl.style["will-change"]="transform",dragStartFn=function(){_this._disableDelayedDrag(),dragEl.draggable=_this.nativeDraggable,_toggleClass(dragEl,options.chosenClass,!0),_this._triggerDragStart(evt,touch),_dispatchEvent(_this,rootEl,"choose",dragEl,rootEl,oldIndex)},options.ignore.split(",").forEach(function(criteria){_find(dragEl,criteria.trim(),_disableDraggable)}),_on(ownerDocument,"mouseup",_this._onDrop),_on(ownerDocument,"touchend",_this._onDrop),_on(ownerDocument,"touchcancel",_this._onDrop),_on(ownerDocument,"pointercancel",_this._onDrop),options.delay?(_on(ownerDocument,"mouseup",_this._disableDelayedDrag),_on(ownerDocument,"touchend",_this._disableDelayedDrag),_on(ownerDocument,"touchcancel",_this._disableDelayedDrag),_on(ownerDocument,"mousemove",_this._disableDelayedDrag),_on(ownerDocument,"touchmove",_this._disableDelayedDrag),_on(ownerDocument,"pointermove",_this._disableDelayedDrag),_this._dragStartTimer=setTimeout(dragStartFn,options.delay)):dragStartFn())},_disableDelayedDrag:function(){var ownerDocument=this.el.ownerDocument;clearTimeout(this._dragStartTimer),_off(ownerDocument,"mouseup",this._disableDelayedDrag),_off(ownerDocument,"touchend",this._disableDelayedDrag),_off(ownerDocument,"touchcancel",this._disableDelayedDrag),_off(ownerDocument,"mousemove",this._disableDelayedDrag),_off(ownerDocument,"touchmove",this._disableDelayedDrag),_off(ownerDocument,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(evt,touch){touch=touch||("touch"==evt.pointerType?evt:null),touch?(tapEvt={target:dragEl,clientX:touch.clientX,clientY:touch.clientY},this._onDragStart(tapEvt,"touch")):this.nativeDraggable?(_on(dragEl,"dragend",this),_on(rootEl,"dragstart",this._onDragStart)):this._onDragStart(tapEvt,!0);try{document.selection?setTimeout(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(err){}},_dragStarted:function(){if(rootEl&&dragEl){var options=this.options;_toggleClass(dragEl,options.ghostClass,!0),_toggleClass(dragEl,options.dragClass,!1),Sortable.active=this,_dispatchEvent(this,rootEl,"start",dragEl,rootEl,oldIndex)}},_emulateDragOver:function(){if(touchEvt){if(this._lastX===touchEvt.clientX&&this._lastY===touchEvt.clientY)return;this._lastX=touchEvt.clientX,this._lastY=touchEvt.clientY,supportCssPointerEvents||_css(ghostEl,"display","none");var target=document.elementFromPoint(touchEvt.clientX,touchEvt.clientY),parent=target,i=touchDragOverListeners.length;if(parent)do{if(parent[expando]){for(;i--;)touchDragOverListeners[i]({clientX:touchEvt.clientX,clientY:touchEvt.clientY,target:target,rootEl:parent});break}target=parent}while(parent=parent.parentNode);supportCssPointerEvents||_css(ghostEl,"display","")}},_onTouchMove:function(evt){if(tapEvt){var options=this.options,fallbackTolerance=options.fallbackTolerance,fallbackOffset=options.fallbackOffset,touch=evt.touches?evt.touches[0]:evt,dx=touch.clientX-tapEvt.clientX+fallbackOffset.x,dy=touch.clientY-tapEvt.clientY+fallbackOffset.y,translate3d=evt.touches?"translate3d("+dx+"px,"+dy+"px,0)":"translate("+dx+"px,"+dy+"px)";if(!Sortable.active){if(fallbackTolerance&&min(abs(touch.clientX-this._lastX),abs(touch.clientY-this._lastY))dragEl.offsetWidth,isLong=target.offsetHeight>dragEl.offsetHeight,halfway=(floating?(evt.clientX-targetRect.left)/width:(evt.clientY-targetRect.top)/height)>.5,nextSibling=target.nextElementSibling,moveVector=_onMove(rootEl,el,dragEl,dragRect,target,targetRect,evt);if(moveVector!==!1){if(_silent=!0,setTimeout(_unsilent,30),_cloneHide(isOwner),1===moveVector||moveVector===-1)after=1===moveVector;else if(floating){var elTop=dragEl.offsetTop,tgTop=target.offsetTop;after=elTop===tgTop?target.previousElementSibling===dragEl&&!isWide||halfway&&isWide:target.previousElementSibling===dragEl||dragEl.previousElementSibling===target?(evt.clientY-targetRect.top)/height>.5:tgTop>elTop}else after=nextSibling!==dragEl&&!isLong||halfway&&isLong;dragEl.contains(el)||(after&&!nextSibling?el.appendChild(dragEl):target.parentNode.insertBefore(dragEl,after?nextSibling:target)),parentEl=dragEl.parentNode,this._animate(dragRect,dragEl),this._animate(targetRect,target)}}}},_animate:function(prevRect,target){var ms=this.options.animation;if(ms){var currentRect=target.getBoundingClientRect();_css(target,"transition","none"),_css(target,"transform","translate3d("+(prevRect.left-currentRect.left)+"px,"+(prevRect.top-currentRect.top)+"px,0)"),target.offsetWidth,_css(target,"transition","all "+ms+"ms"),_css(target,"transform","translate3d(0,0,0)"),clearTimeout(target.animated),target.animated=setTimeout(function(){_css(target,"transition",""),_css(target,"transform",""),target.animated=!1},ms)}},_offUpEvents:function(){var ownerDocument=this.el.ownerDocument;_off(document,"touchmove",this._onTouchMove),_off(document,"pointermove",this._onTouchMove),_off(ownerDocument,"mouseup",this._onDrop),_off(ownerDocument,"touchend",this._onDrop),_off(ownerDocument,"pointerup",this._onDrop),_off(ownerDocument,"touchcancel",this._onDrop)},_onDrop:function(evt){var el=this.el,options=this.options;clearInterval(this._loopId),clearInterval(autoScroll.pid),clearTimeout(this._dragStartTimer),_off(document,"mousemove",this._onTouchMove),this.nativeDraggable&&(_off(document,"drop",this),_off(el,"dragstart",this._onDragStart)),this._offUpEvents(),evt&&(moved&&(evt.preventDefault(),!options.dropBubble&&evt.stopPropagation()),ghostEl&&ghostEl.parentNode.removeChild(ghostEl),dragEl&&(this.nativeDraggable&&_off(dragEl,"dragend",this),_disableDraggable(dragEl),dragEl.style["will-change"]="",_toggleClass(dragEl,this.options.ghostClass,!1),_toggleClass(dragEl,this.options.chosenClass,!1),rootEl!==parentEl?(newIndex=_index(dragEl,options.draggable),newIndex>=0&&(_dispatchEvent(null,parentEl,"add",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(this,rootEl,"remove",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(null,parentEl,"sort",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(this,rootEl,"sort",dragEl,rootEl,oldIndex,newIndex))):(cloneEl&&cloneEl.parentNode.removeChild(cloneEl),dragEl.nextSibling!==nextEl&&(newIndex=_index(dragEl,options.draggable),newIndex>=0&&(_dispatchEvent(this,rootEl,"update",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(this,rootEl,"sort",dragEl,rootEl,oldIndex,newIndex)))),Sortable.active&&(null!=newIndex&&newIndex!==-1||(newIndex=oldIndex),_dispatchEvent(this,rootEl,"end",dragEl,rootEl,oldIndex,newIndex),this.save()))),this._nulling()},_nulling:function(){rootEl=dragEl=parentEl=ghostEl=nextEl=cloneEl=scrollEl=scrollParentEl=tapEvt=touchEvt=moved=newIndex=lastEl=lastCSS=putSortable=activeGroup=Sortable.active=null},handleEvent:function(evt){var type=evt.type;"dragover"===type||"dragenter"===type?dragEl&&(this._onDragOver(evt),_globalDragOver(evt)):"drop"!==type&&"dragend"!==type||this._onDrop(evt)},toArray:function(){for(var el,order=[],children=this.el.children,i=0,n=children.length,options=this.options;i*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(dataTransfer,dragEl){dataTransfer.setData("Text",dragEl.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var name in defaults)!(name in options)&&(options[name]=defaults[name]);_prepareGroup(options);for(var fn in this)"_"===fn.charAt(0)&&"function"==typeof this[fn]&&(this[fn]=this[fn].bind(this));this.nativeDraggable=!options.forceFallback&&supportDraggable,_on(el,"mousedown",this._onTapStart),_on(el,"touchstart",this._onTapStart),_on(el,"pointerdown",this._onTapStart),this.nativeDraggable&&(_on(el,"dragover",this),_on(el,"dragenter",this)),touchDragOverListeners.push(this._onDragOver),options.store&&this.sort(options.store.get(this))}function _cloneHide(sortable,state){"clone"!==sortable.lastPullMode&&(state=!0),cloneEl&&cloneEl.state!==state&&(_css(cloneEl,"display",state?"none":""),state||cloneEl.state&&(sortable.options.group.revertClone?(rootEl.insertBefore(cloneEl,nextEl),sortable._animate(dragEl,cloneEl)):rootEl.insertBefore(cloneEl,dragEl)),cloneEl.state=state)}function _closest(el,selector,ctx){if(el){ctx=ctx||document;do if(">*"===selector&&el.parentNode===ctx||_matches(el,selector))return el;while(el=_getParentOrHost(el))}return null}function _getParentOrHost(el){var parent=el.host;return parent&&parent.nodeType?parent:el.parentNode}function _globalDragOver(evt){evt.dataTransfer&&(evt.dataTransfer.dropEffect="move"),evt.preventDefault()}function _on(el,event,fn){el.addEventListener(event,fn,captureMode)}function _off(el,event,fn){el.removeEventListener(event,fn,captureMode)}function _toggleClass(el,name,state){if(el)if(el.classList)el.classList[state?"add":"remove"](name);else{var className=(" "+el.className+" ").replace(R_SPACE," ").replace(" "+name+" "," ");el.className=(className+(state?" "+name:"")).replace(R_SPACE," ")}}function _css(el,prop,val){var style=el&&el.style;if(style){if(void 0===val)return document.defaultView&&document.defaultView.getComputedStyle?val=document.defaultView.getComputedStyle(el,""):el.currentStyle&&(val=el.currentStyle),void 0===prop?val:val[prop];prop in style||(prop="-webkit-"+prop),style[prop]=val+("string"==typeof val?"":"px")}}function _find(ctx,tagName,iterator){if(ctx){var list=ctx.getElementsByTagName(tagName),i=0,n=list.length;if(iterator)for(;i5||evt.clientX-(rect.right+rect.width)>5)&&lastEl}function _generateId(el){for(var str=el.tagName+el.className+el.src+el.href+el.textContent,i=str.length,sum=0;i--;)sum+=str.charCodeAt(i);return sum.toString(36)}function _index(el,selector){var index=0;if(!el||!el.parentNode)return-1;for(;el&&(el=el.previousElementSibling);)"TEMPLATE"===el.nodeName.toUpperCase()||">*"!==selector&&!_matches(el,selector)||index++;return index}function _matches(el,selector){if(el){selector=selector.split(".");var tag=selector.shift().toUpperCase(),re=new RegExp("\\s("+selector.join("|")+")(?=\\s)","g");return!(""!==tag&&el.nodeName.toUpperCase()!=tag||selector.length&&((" "+el.className+" ").match(re)||[]).length!=selector.length)}return!1}function _throttle(callback,ms){var args,_this;return function(){void 0===args&&(args=arguments,_this=this,setTimeout(function(){1===args.length?callback.call(_this,args[0]):callback.apply(_this,args),args=void 0},ms))}}function _extend(dst,src){if(dst&&src)for(var key in src)src.hasOwnProperty(key)&&(dst[key]=src[key]);return dst}function _clone(el){return $?$(el).clone(!0)[0]:Polymer&&Polymer.dom?Polymer.dom(el).cloneNode(!0):el.cloneNode(!0)}function _saveInputCheckedState(root){for(var inputs=root.getElementsByTagName("input"),idx=inputs.length;idx--;){var el=inputs[idx];el.checked&&savedInputChecked.push(el)}}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var dragEl,parentEl,ghostEl,cloneEl,rootEl,nextEl,lastDownEl,scrollEl,scrollParentEl,scrollCustomFn,lastEl,lastCSS,lastParentCSS,oldIndex,newIndex,activeGroup,putSortable,tapEvt,touchEvt,moved,autoScroll={},R_SPACE=/\s+/g,R_FLOAT=/left|right|inline/,expando="Sortable"+(new Date).getTime(),win=window,document=win.document,parseInt=win.parseInt,$=win.jQuery||win.Zepto,Polymer=win.Polymer,captureMode=!1,supportDraggable=!!("draggable"in document.createElement("div")),supportCssPointerEvents=function(el){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(el=document.createElement("x"),el.style.cssText="pointer-events:auto","auto"===el.style.pointerEvents)}(),_silent=!1,abs=Math.abs,min=Math.min,savedInputChecked=[],touchDragOverListeners=[],_autoScroll=_throttle(function(evt,options,rootEl){if(rootEl&&options.scroll){var el,rect,vx,vy,scrollOffsetX,scrollOffsetY,_this=rootEl[expando],sens=options.scrollSensitivity,speed=options.scrollSpeed,x=evt.clientX,y=evt.clientY,winWidth=window.innerWidth,winHeight=window.innerHeight;if(scrollParentEl!==rootEl&&(scrollEl=options.scroll,scrollParentEl=rootEl,scrollCustomFn=options.scrollFn,scrollEl===!0)){scrollEl=rootEl;do if(scrollEl.offsetWidth-1:fromGroup==value)}}var group={},originalGroup=options.group;originalGroup&&"object"==typeof originalGroup||(originalGroup={name:originalGroup}),group.name=originalGroup.name,group.checkPull=toFn(originalGroup.pull,!0),group.checkPut=toFn(originalGroup.put),group.revertClone=originalGroup.revertClone,options.group=group};Sortable.prototype={constructor:Sortable,_onTapStart:function(evt){var startIndex,_this=this,el=this.el,options=this.options,preventOnFilter=options.preventOnFilter,type=evt.type,touch=evt.touches&&evt.touches[0],target=(touch||evt).target,originalTarget=evt.target.shadowRoot&&evt.path[0]||target,filter=options.filter;if(_saveInputCheckedState(el),!dragEl&&!("mousedown"===type&&0!==evt.button||options.disabled)&&(target=_closest(target,options.draggable,el),target&&lastDownEl!==target)){if(startIndex=_index(target,options.draggable),"function"==typeof filter){if(filter.call(this,evt,target,this))return _dispatchEvent(_this,originalTarget,"filter",target,el,startIndex),void(preventOnFilter&&evt.preventDefault())}else if(filter&&(filter=filter.split(",").some(function(criteria){if(criteria=_closest(originalTarget,criteria.trim(),el))return _dispatchEvent(_this,criteria,"filter",target,el,startIndex),!0})))return void(preventOnFilter&&evt.preventDefault());options.handle&&!_closest(originalTarget,options.handle,el)||this._prepareDragStart(evt,touch,target,startIndex)}},_prepareDragStart:function(evt,touch,target,startIndex){var dragStartFn,_this=this,el=_this.el,options=_this.options,ownerDocument=el.ownerDocument;target&&!dragEl&&target.parentNode===el&&(tapEvt=evt,rootEl=el,dragEl=target,parentEl=dragEl.parentNode,nextEl=dragEl.nextSibling,lastDownEl=target,activeGroup=options.group,oldIndex=startIndex,this._lastX=(touch||evt).clientX,this._lastY=(touch||evt).clientY,dragEl.style["will-change"]="transform",dragStartFn=function(){_this._disableDelayedDrag(),dragEl.draggable=_this.nativeDraggable,_toggleClass(dragEl,options.chosenClass,!0),_this._triggerDragStart(evt,touch),_dispatchEvent(_this,rootEl,"choose",dragEl,rootEl,oldIndex)},options.ignore.split(",").forEach(function(criteria){_find(dragEl,criteria.trim(),_disableDraggable)}),_on(ownerDocument,"mouseup",_this._onDrop),_on(ownerDocument,"touchend",_this._onDrop),_on(ownerDocument,"touchcancel",_this._onDrop),_on(ownerDocument,"pointercancel",_this._onDrop),_on(ownerDocument,"selectstart",_this),options.delay?(_on(ownerDocument,"mouseup",_this._disableDelayedDrag),_on(ownerDocument,"touchend",_this._disableDelayedDrag),_on(ownerDocument,"touchcancel",_this._disableDelayedDrag),_on(ownerDocument,"mousemove",_this._disableDelayedDrag),_on(ownerDocument,"touchmove",_this._disableDelayedDrag),_on(ownerDocument,"pointermove",_this._disableDelayedDrag),_this._dragStartTimer=setTimeout(dragStartFn,options.delay)):dragStartFn())},_disableDelayedDrag:function(){var ownerDocument=this.el.ownerDocument;clearTimeout(this._dragStartTimer),_off(ownerDocument,"mouseup",this._disableDelayedDrag),_off(ownerDocument,"touchend",this._disableDelayedDrag),_off(ownerDocument,"touchcancel",this._disableDelayedDrag),_off(ownerDocument,"mousemove",this._disableDelayedDrag),_off(ownerDocument,"touchmove",this._disableDelayedDrag),_off(ownerDocument,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(evt,touch){touch=touch||("touch"==evt.pointerType?evt:null),touch?(tapEvt={target:dragEl,clientX:touch.clientX,clientY:touch.clientY},this._onDragStart(tapEvt,"touch")):this.nativeDraggable?(_on(dragEl,"dragend",this),_on(rootEl,"dragstart",this._onDragStart)):this._onDragStart(tapEvt,!0);try{document.selection?setTimeout(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(err){}},_dragStarted:function(){if(rootEl&&dragEl){var options=this.options;_toggleClass(dragEl,options.ghostClass,!0),_toggleClass(dragEl,options.dragClass,!1),Sortable.active=this,_dispatchEvent(this,rootEl,"start",dragEl,rootEl,oldIndex)}else this._nulling()},_emulateDragOver:function(){if(touchEvt){if(this._lastX===touchEvt.clientX&&this._lastY===touchEvt.clientY)return;this._lastX=touchEvt.clientX,this._lastY=touchEvt.clientY,supportCssPointerEvents||_css(ghostEl,"display","none");var target=document.elementFromPoint(touchEvt.clientX,touchEvt.clientY),parent=target,i=touchDragOverListeners.length;if(parent)do{if(parent[expando]){for(;i--;)touchDragOverListeners[i]({clientX:touchEvt.clientX,clientY:touchEvt.clientY,target:target,rootEl:parent});break}target=parent}while(parent=parent.parentNode);supportCssPointerEvents||_css(ghostEl,"display","")}},_onTouchMove:function(evt){if(tapEvt){var options=this.options,fallbackTolerance=options.fallbackTolerance,fallbackOffset=options.fallbackOffset,touch=evt.touches?evt.touches[0]:evt,dx=touch.clientX-tapEvt.clientX+fallbackOffset.x,dy=touch.clientY-tapEvt.clientY+fallbackOffset.y,translate3d=evt.touches?"translate3d("+dx+"px,"+dy+"px,0)":"translate("+dx+"px,"+dy+"px)";if(!Sortable.active){if(fallbackTolerance&&min(abs(touch.clientX-this._lastX),abs(touch.clientY-this._lastY))dragEl.offsetWidth,isLong=target.offsetHeight>dragEl.offsetHeight,halfway=(floating?(evt.clientX-targetRect.left)/width:(evt.clientY-targetRect.top)/height)>.5,nextSibling=target.nextElementSibling,moveVector=_onMove(rootEl,el,dragEl,dragRect,target,targetRect,evt),after=!1;if(moveVector!==!1){if(_silent=!0,setTimeout(_unsilent,30),_cloneHide(activeSortable,isOwner),1===moveVector||moveVector===-1)after=1===moveVector;else if(floating){var elTop=dragEl.offsetTop,tgTop=target.offsetTop;after=elTop===tgTop?target.previousElementSibling===dragEl&&!isWide||halfway&&isWide:target.previousElementSibling===dragEl||dragEl.previousElementSibling===target?(evt.clientY-targetRect.top)/height>.5:tgTop>elTop}else isMovingBetweenSortable||(after=nextSibling!==dragEl&&!isLong||halfway&&isLong);dragEl.contains(el)||(after&&!nextSibling?el.appendChild(dragEl):target.parentNode.insertBefore(dragEl,after?nextSibling:target)),parentEl=dragEl.parentNode,this._animate(dragRect,dragEl),this._animate(targetRect,target)}}}},_animate:function(prevRect,target){var ms=this.options.animation;if(ms){var currentRect=target.getBoundingClientRect();1===prevRect.nodeType&&(prevRect=prevRect.getBoundingClientRect()),_css(target,"transition","none"),_css(target,"transform","translate3d("+(prevRect.left-currentRect.left)+"px,"+(prevRect.top-currentRect.top)+"px,0)"),target.offsetWidth,_css(target,"transition","all "+ms+"ms"),_css(target,"transform","translate3d(0,0,0)"),clearTimeout(target.animated),target.animated=setTimeout(function(){_css(target,"transition",""),_css(target,"transform",""),target.animated=!1},ms)}},_offUpEvents:function(){var ownerDocument=this.el.ownerDocument;_off(document,"touchmove",this._onTouchMove),_off(document,"pointermove",this._onTouchMove),_off(ownerDocument,"mouseup",this._onDrop),_off(ownerDocument,"touchend",this._onDrop),_off(ownerDocument,"pointerup",this._onDrop),_off(ownerDocument,"touchcancel",this._onDrop),_off(ownerDocument,"selectstart",this)},_onDrop:function(evt){var el=this.el,options=this.options;clearInterval(this._loopId),clearInterval(autoScroll.pid),clearTimeout(this._dragStartTimer),_off(document,"mousemove",this._onTouchMove),this.nativeDraggable&&(_off(document,"drop",this),_off(el,"dragstart",this._onDragStart)),this._offUpEvents(),evt&&(moved&&(evt.preventDefault(),!options.dropBubble&&evt.stopPropagation()),ghostEl&&ghostEl.parentNode.removeChild(ghostEl),rootEl!==parentEl&&"clone"===Sortable.active.lastPullMode||cloneEl&&cloneEl.parentNode.removeChild(cloneEl),dragEl&&(this.nativeDraggable&&_off(dragEl,"dragend",this),_disableDraggable(dragEl),dragEl.style["will-change"]="",_toggleClass(dragEl,this.options.ghostClass,!1),_toggleClass(dragEl,this.options.chosenClass,!1),rootEl!==parentEl?(newIndex=_index(dragEl,options.draggable),newIndex>=0&&(_dispatchEvent(null,parentEl,"add",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(this,rootEl,"remove",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(null,parentEl,"sort",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(this,rootEl,"sort",dragEl,rootEl,oldIndex,newIndex))):dragEl.nextSibling!==nextEl&&(newIndex=_index(dragEl,options.draggable),newIndex>=0&&(_dispatchEvent(this,rootEl,"update",dragEl,rootEl,oldIndex,newIndex),_dispatchEvent(this,rootEl,"sort",dragEl,rootEl,oldIndex,newIndex))),Sortable.active&&(null!=newIndex&&newIndex!==-1||(newIndex=oldIndex),_dispatchEvent(this,rootEl,"end",dragEl,rootEl,oldIndex,newIndex),this.save()))),this._nulling()},_nulling:function(){rootEl=dragEl=parentEl=ghostEl=nextEl=cloneEl=lastDownEl=scrollEl=scrollParentEl=tapEvt=touchEvt=moved=newIndex=lastEl=lastCSS=putSortable=activeGroup=Sortable.active=null,savedInputChecked.forEach(function(el){el.checked=!0}),savedInputChecked.length=0},handleEvent:function(evt){switch(evt.type){case"drop":case"dragend":this._onDrop(evt);break;case"dragover":case"dragenter":dragEl&&(this._onDragOver(evt),_globalDragOver(evt));break;case"selectstart":evt.preventDefault()}},toArray:function(){for(var el,order=[],children=this.el.children,i=0,n=children.length,options=this.options;i