diff --git a/Build/Gruntfile.js b/Build/Gruntfile.js index 012d21a426f9e5d4f998555c1b08e2b089db9420..75c02f3934ef7ce7aa20e28444e6b97e5f64d989 100644 --- a/Build/Gruntfile.js +++ b/Build/Gruntfile.js @@ -451,6 +451,10 @@ module.exports = function (grunt) { src: '<%= paths.node_modules %>@lezer/lr/dist/index.js', dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/@lezer/lr.js' }, + { + src: '<%= paths.node_modules %>@lezer/common/dist/index.js', + dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/@lezer/common.js' + }, { src: '<%= paths.node_modules %>crelt/index.es.js', dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/crelt.js' @@ -681,7 +685,6 @@ module.exports = function (grunt) { 'jquery.js': 'jquery/dist/jquery.js', 'jquery/minicolors.js': '../node_modules/@claviska/jquery-minicolors/jquery.minicolors.min.js', 'nprogress.js': 'nprogress/nprogress.js', - 'sortablejs.js': 'sortablejs/dist/sortable.umd.js', 'tablesort.js': 'tablesort/dist/tablesort.min.js', 'tablesort.dotsep.js': 'tablesort/dist/sorts/tablesort.dotsep.min.js', 'tablesort.number.js': 'tablesort/dist/sorts/tablesort.number.min.js', @@ -803,6 +806,7 @@ module.exports = function (grunt) { 'es-module-shims.js': 'es-module-shims/dist/es-module-shims.js', 'luxon.js': 'luxon/build/es6/luxon.js', '../../../../../backend/Resources/Public/Images/colorpicker/jquery.minicolors.png': '../node_modules/@claviska/jquery-minicolors/jquery.minicolors.png', + 'sortablejs.js': 'sortablejs/modular/sortable.complete.esm.js', } } }, @@ -822,6 +826,7 @@ module.exports = function (grunt) { '<%= paths.core %>Public/JavaScript/Contrib/luxon.js': ['<%= paths.core %>Public/JavaScript/Contrib/luxon.js'], '<%= paths.core %>Public/JavaScript/Contrib/require.js': ['<%= paths.core %>Public/JavaScript/Contrib/require.js'], '<%= paths.core %>Public/JavaScript/Contrib/nprogress.js': ['<%= paths.core %>Public/JavaScript/Contrib/nprogress.js'], + '<%= paths.core %>Public/JavaScript/Contrib/sortablejs.js': ['<%= paths.core %>Public/JavaScript/Contrib/sortablejs.js'], '<%= paths.core %>Public/JavaScript/Contrib/taboverride.js': ['<%= paths.core %>Public/JavaScript/Contrib/taboverride.js'], '<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/core.js': ['<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/core.js'], '<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/data.js': ['<%= paths.core %>Public/JavaScript/Contrib/jquery-ui/data.js'], @@ -903,7 +908,7 @@ module.exports = function (grunt) { } }, concurrent: { - npmcopy: ['npmcopy:backend', 'npmcopy:umdToEs6', 'npmcopy:jqueryUi', 'npmcopy:install', 'npmcopy:all'], + npmcopy: ['npmcopy:backend', 'npmcopy:umdToEs6', 'npmcopy:jqueryUi', 'npmcopy:install', 'npmcopy:dashboardToEs6', 'npmcopy:all'], lint: ['eslint', 'stylelint', 'exec:lintspaces'], compile_assets: ['scripts', 'css'], compile_flags: ['flags-build'], diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Contrib/sortablejs.js b/typo3/sysext/core/Resources/Public/JavaScript/Contrib/sortablejs.js index fe83a2a80d99a2aef4c1f4ea90927facc272d2a1..cd439c18ae22a385e33b86baaa7c1fb216e9776a 100644 --- a/typo3/sysext/core/Resources/Public/JavaScript/Contrib/sortablejs.js +++ b/typo3/sysext/core/Resources/Public/JavaScript/Contrib/sortablejs.js @@ -1,6 +1,7 @@ -export default (new function() { - const module = { exports: {} }, exports = module.exports, define = null; -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function e(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var n=e(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),o=e(/Edge/i),i=e(/firefox/i),r=e(/safari/i)&&!e(/chrome/i)&&!e(/android/i),a=e(/iP(ad|od|hone)/i),l=e(/chrome/i)&&e(/android/i),s={capture:!1,passive:!1};function c(t,e,o){t.addEventListener(e,o,!n&&s)}function u(t,e,o){t.removeEventListener(e,o,!n&&s)}function d(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function h(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function f(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&d(t,e):d(t,e))||o&&t===n)return t;if(t===n)break}while(t=h(t))}return null}var p,g=/\s+/g;function v(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(g," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(g," ")}}function m(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function b(t,e){var n="";if("string"==typeof t)n=t;else do{var o=m(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function w(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function E(){return document.scrollingElement||document.documentElement}function y(t,e,o,i,r){if(t.getBoundingClientRect||t===window){var a,l,s,c,u,d,h;if(t!==window&&t!==E()?(l=(a=t.getBoundingClientRect()).top,s=a.left,c=a.bottom,u=a.right,d=a.height,h=a.width):(l=0,s=0,c=window.innerHeight,u=window.innerWidth,d=window.innerHeight,h=window.innerWidth),(e||o)&&t!==window&&(r=r||t.parentNode,!n))do{if(r&&r.getBoundingClientRect&&("none"!==m(r,"transform")||o&&"static"!==m(r,"position"))){var f=r.getBoundingClientRect();l-=f.top+parseInt(m(r,"border-top-width")),s-=f.left+parseInt(m(r,"border-left-width")),c=l+a.height,u=s+a.width;break}}while(r=r.parentNode);if(i&&t!==window){var p=b(r||t),g=p&&p.a,v=p&&p.d;p&&(c=(l/=v)+(d/=v),u=(s/=g)+(h/=g))}return{top:l,left:s,bottom:c,right:u,width:h,height:d}}}function D(t,e,n){for(var o=x(t,!0),i=y(t)[e];o;){var r=y(o)[n];if(!("top"===n||"left"===n?i>=r:i<=r))return o;if(o===E())break;o=x(o,!1)}return!1}function _(t,e,n){for(var o=0,i=0,r=t.children;i<r.length;){if("none"!==r[i].style.display&&r[i]!==It.ghost&&r[i]!==It.dragged&&f(r[i],n.draggable,t,!1)){if(o===e)return r[i];o++}i++}return null}function S(t,e){for(var n=t.lastElementChild;n&&(n===It.ghost||"none"===m(n,"display")||e&&!d(n,e));)n=n.previousElementSibling;return n||null}function C(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===It.clone||e&&!d(t,e)||n++;return n}function T(t){var e=0,n=0,o=E();if(t)do{var i=b(t);e+=t.scrollLeft*i.a,n+=t.scrollTop*i.d}while(t!==o&&(t=t.parentNode));return[e,n]}function x(t,e){if(!t||!t.getBoundingClientRect)return E();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=m(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return E();if(o||e)return n;o=!0}}}while(n=n.parentNode);return E()}function M(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function N(t,e){return function(){if(!p){var n=arguments,o=this;1===n.length?t.call(o,n[0]):t.apply(o,n),p=setTimeout(function(){p=void 0},e)}}}function O(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function A(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function I(t,e){m(t,"position","absolute"),m(t,"top",e.top),m(t,"left",e.left),m(t,"width",e.width),m(t,"height",e.height)}function P(t){m(t,"position",""),m(t,"top",""),m(t,"left",""),m(t,"width",""),m(t,"height","")}var k="Sortable"+(new Date).getTime(),R=[],X={initializeByDefault:!0},Y={mount:function(t){for(var e in X)X.hasOwnProperty(e)&&!(e in t)&&(t[e]=X[e]);R.push(t)},pluginEvent:function(e,n,o){var i=this;this.eventCanceled=!1,o.cancel=function(){i.eventCanceled=!0};var r=e+"Global";R.forEach(function(i){n[i.pluginName]&&(n[i.pluginName][r]&&n[i.pluginName][r](t({sortable:n},o)),n.options[i.pluginName]&&n[i.pluginName][e]&&n[i.pluginName][e](t({sortable:n},o)))})},initializePlugins:function(t,e,n,o){for(var i in R.forEach(function(o){var i=o.pluginName;if(t.options[i]||o.initializeByDefault){var r=new o(t,e,t.options);r.sortable=t,r.options=t.options,t[i]=r,Object.assign(n,r.defaults)}}),t.options)if(t.options.hasOwnProperty(i)){var r=this.modifyOption(t,i,t.options[i]);void 0!==r&&(t.options[i]=r)}},getEventProperties:function(t,e){var n={};return R.forEach(function(o){"function"==typeof o.eventProperties&&Object.assign(n,o.eventProperties.call(e[o.pluginName],t))}),n},modifyOption:function(t,e,n){var o;return R.forEach(function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))}),o}};function B(e){var i=e.sortable,r=e.rootEl,a=e.name,l=e.targetEl,s=e.cloneEl,c=e.toEl,u=e.fromEl,d=e.oldIndex,h=e.newIndex,f=e.oldDraggableIndex,p=e.newDraggableIndex,g=e.originalEvent,v=e.putSortable,m=e.extraEventProperties;if(i=i||r&&r[k]){var b,w=i.options,E="on"+a.charAt(0).toUpperCase()+a.substr(1);!window.CustomEvent||n||o?(b=document.createEvent("Event")).initEvent(a,!0,!0):b=new CustomEvent(a,{bubbles:!0,cancelable:!0}),b.to=c||r,b.from=u||r,b.item=l||r,b.clone=s,b.oldIndex=d,b.newIndex=h,b.oldDraggableIndex=f,b.newDraggableIndex=p,b.originalEvent=g,b.pullMode=v?v.lastPutMode:void 0;var y=t({},m,Y.getEventProperties(a,i));for(var D in y)b[D]=y[D];r&&r.dispatchEvent(b),w[E]&&w[E].call(i,b)}}var H=function(e,n,o){var i=void 0===o?{}:o,r=i.evt,a=function(t,e){if(null==t)return{};var n,o,i={},r=Object.keys(t);for(o=0;o<r.length;o++)e.indexOf(n=r[o])>=0||(i[n]=t[n]);return i}(i,["evt"]);Y.pluginEvent.bind(It)(e,n,t({dragEl:L,parentEl:j,ghostEl:K,rootEl:W,nextEl:z,lastDownEl:G,cloneEl:U,cloneHidden:q,dragStarted:lt,putSortable:tt,activeSortable:It.active,originalEvent:r,oldIndex:V,oldDraggableIndex:Q,newIndex:Z,newDraggableIndex:$,hideGhostForTarget:xt,unhideGhostForTarget:Mt,cloneNowHidden:function(){q=!0},cloneNowShown:function(){q=!1},dispatchSortableEvent:function(t){F({sortable:n,name:t,originalEvent:r})}},a))};function F(e){B(t({putSortable:tt,cloneEl:U,targetEl:L,rootEl:W,oldIndex:V,oldDraggableIndex:Q,newIndex:Z,newDraggableIndex:$},e))}var L,j,K,W,z,G,U,q,V,Z,Q,$,J,tt,et,nt,ot,it,rt,at,lt,st,ct,ut,dt,ht=!1,ft=!1,pt=[],gt=!1,vt=!1,mt=[],bt=!1,wt=[],Et="undefined"!=typeof document,yt=a,Dt=o||n?"cssFloat":"float",_t=Et&&!l&&!a&&"draggable"in document.createElement("div"),St=function(){if(Et){if(n)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Ct=function(t,e){var n=m(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=_(t,0,e),r=_(t,1,e),a=i&&m(i),l=r&&m(r),s=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+y(i).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+y(r).width;return"flex"===n.display?"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal":"grid"===n.display?n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal":i&&a.float&&"none"!==a.float?!r||"both"!==l.clear&&l.clear!==("left"===a.float?"left":"right")?"horizontal":"vertical":i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||s>=o&&"none"===n[Dt]||r&&"none"===n[Dt]&&s+c>o)?"vertical":"horizontal"},Tt=function(t){function e(t,n){return function(o,i,r,a){if(null==t&&(n||o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,i,r,a),n)(o,i,r,a);var l=(n?o:i).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==typeof o||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},xt=function(){!St&&K&&m(K,"display","none")},Mt=function(){!St&&K&&m(K,"display","")};Et&&document.addEventListener("click",function(t){if(ft)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ft=!1,!1},!0);var Nt,Ot=function(t){if(L){var e=(i=(t=t.touches?t.touches[0]:t).clientX,r=t.clientY,pt.some(function(t){if(!S(t)){var e=y(t),n=t[k].options.emptyInsertThreshold;return n&&i>=e.left-n&&i<=e.right+n&&r>=e.top-n&&r<=e.bottom+n?a=t:void 0}}),a);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[k]._onDragOver(n)}}var i,r,a},At=function(t){L&&L.parentNode[k]._isOutsideThisEl(t.target)};function It(e,n){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not "+{}.toString.call(e);this.el=e,this.options=n=Object.assign({},n),e[k]=this;var o,i,r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ct(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==It.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var a in Y.initializePlugins(this,e,r),r)!(a in n)&&(n[a]=r[a]);for(var l in Tt(n),this)"_"===l.charAt(0)&&"function"==typeof this[l]&&(this[l]=this[l].bind(this));this.nativeDraggable=!n.forceFallback&&_t,this.nativeDraggable&&(this.options.touchStartThreshold=1),n.supportPointer?c(e,"pointerdown",this._onTapStart):(c(e,"mousedown",this._onTapStart),c(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(c(e,"dragover",this),c(e,"dragenter",this)),pt.push(this.el),n.store&&n.store.get&&this.sort(n.store.get(this)||[]),Object.assign(this,(i=[],{captureAnimationState:function(){i=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(e){if("none"!==m(e,"display")&&void 0!==e){i.push({target:e,rect:y(e)});var n=t({},i[i.length-1].rect);if(e.thisAnimationDuration){var o=b(e,!0);o&&(n.top-=o.f,n.left-=o.e)}e.fromRect=n}})},addAnimationState:function(t){i.push(t)},removeAnimationState:function(t){i.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(i,{target:t}),1)},animateAll:function(t){var e=this;if(!this.options.animation)return clearTimeout(o),void("function"==typeof t&&t());var n=!1,r=0;i.forEach(function(t){var o=0,i=t.target,a=i.fromRect,l=y(i),s=i.prevFromRect,c=i.prevToRect,u=t.rect,d=b(i,!0);d&&(l.top-=d.f,l.left-=d.e),i.toRect=l,i.thisAnimationDuration&&M(s,l)&&!M(a,l)&&(u.top-l.top)/(u.left-l.left)==(a.top-l.top)/(a.left-l.left)&&(o=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(u,s,c,e.options)),M(l,a)||(i.prevFromRect=a,i.prevToRect=l,o||(o=e.options.animation),e.animate(i,u,l,o)),o&&(n=!0,r=Math.max(r,o),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout(function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null},o),i.thisAnimationDuration=o)}),clearTimeout(o),n?o=setTimeout(function(){"function"==typeof t&&t()},r):"function"==typeof t&&t(),i=[]},animate:function(t,e,n,o){if(o){m(t,"transition",""),m(t,"transform","");var i=b(this.el),r=(e.left-n.left)/(i&&i.a||1),a=(e.top-n.top)/(i&&i.d||1);t.animatingX=!!r,t.animatingY=!!a,m(t,"transform","translate3d("+r+"px,"+a+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),m(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),m(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout(function(){m(t,"transition",""),m(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1},o)}}}))}function Pt(t,e,i,r,a,l,s,c){var u,d,h=t[k],f=h.options.onMove;return!window.CustomEvent||n||o?(u=document.createEvent("Event")).initEvent("move",!0,!0):u=new CustomEvent("move",{bubbles:!0,cancelable:!0}),u.to=e,u.from=t,u.dragged=i,u.draggedRect=r,u.related=a||e,u.relatedRect=l||y(e),u.willInsertAfter=c,u.originalEvent=s,t.dispatchEvent(u),f&&(d=f.call(h,u,s)),d}function kt(t){t.draggable=!1}function Rt(){bt=!1}function Xt(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Yt(t){return setTimeout(t,0)}function Bt(t){return clearTimeout(t)}It.prototype={constructor:It,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(st=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,L):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,a=t.type,l=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(l||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,u=o.filter;if(function(t){wt.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&wt.push(o)}}(n),!L&&!(/mousedown|pointerdown/.test(a)&&0!==t.button||o.disabled)&&!c.isContentEditable&&(this.nativeDraggable||!r||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=f(s,o.draggable,n,!1))&&s.animated||G===s)){if(V=C(s),Q=C(s,o.draggable),"function"==typeof u){if(u.call(this,t,s,this))return F({sortable:e,rootEl:c,name:"filter",targetEl:s,toEl:n,fromEl:n}),H("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(u&&(u=u.split(",").some(function(o){if(o=f(c,o.trim(),n,!1))return F({sortable:e,rootEl:o,name:"filter",targetEl:s,fromEl:n,toEl:n}),H("filter",e,{evt:t}),!0})))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!f(c,o.handle,n,!1)||this._prepareDragStart(t,l,s)}}},_prepareDragStart:function(t,e,r){var a,l=this,s=l.el,u=l.options,d=s.ownerDocument;if(r&&!L&&r.parentNode===s){var h=y(r);if(W=s,j=(L=r).parentNode,z=L.nextSibling,G=r,J=u.group,It.dragged=L,rt=(et={target:L,clientX:(e||t).clientX,clientY:(e||t).clientY}).clientX-h.left,at=et.clientY-h.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,L.style["will-change"]="all",a=function(){H("delayEnded",l,{evt:t}),It.eventCanceled?l._onDrop():(l._disableDelayedDragEvents(),!i&&l.nativeDraggable&&(L.draggable=!0),l._triggerDragStart(t,e),F({sortable:l,name:"choose",originalEvent:t}),v(L,u.chosenClass,!0))},u.ignore.split(",").forEach(function(t){w(L,t.trim(),kt)}),c(d,"dragover",Ot),c(d,"mousemove",Ot),c(d,"touchmove",Ot),c(d,"mouseup",l._onDrop),c(d,"touchend",l._onDrop),c(d,"touchcancel",l._onDrop),i&&this.nativeDraggable&&(this.options.touchStartThreshold=4,L.draggable=!0),H("delayStart",this,{evt:t}),!u.delay||u.delayOnTouchOnly&&!e||this.nativeDraggable&&(o||n))a();else{if(It.eventCanceled)return void this._onDrop();c(d,"mouseup",l._disableDelayedDrag),c(d,"touchend",l._disableDelayedDrag),c(d,"touchcancel",l._disableDelayedDrag),c(d,"mousemove",l._delayedDragTouchMoveHandler),c(d,"touchmove",l._delayedDragTouchMoveHandler),u.supportPointer&&c(d,"pointermove",l._delayedDragTouchMoveHandler),l._dragStartTimer=setTimeout(a,u.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){L&&kt(L),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;u(t,"mouseup",this._disableDelayedDrag),u(t,"touchend",this._disableDelayedDrag),u(t,"touchcancel",this._disableDelayedDrag),u(t,"mousemove",this._delayedDragTouchMoveHandler),u(t,"touchmove",this._delayedDragTouchMoveHandler),u(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?c(document,this.options.supportPointer?"pointermove":e?"touchmove":"mousemove",this._onTouchMove):(c(L,"dragend",this),c(W,"dragstart",this._onDragStart));try{document.selection?Yt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(ht=!1,W&&L){H("dragStarted",this,{evt:e}),this.nativeDraggable&&c(document,"dragover",At);var n=this.options;!t&&v(L,n.dragClass,!1),v(L,n.ghostClass,!0),It.active=this,t&&this._appendGhost(),F({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(nt){this._lastX=nt.clientX,this._lastY=nt.clientY,xt();for(var t=document.elementFromPoint(nt.clientX,nt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(nt.clientX,nt.clientY))!==e;)e=t;if(L.parentNode[k]._isOutsideThisEl(t),e)do{if(e[k]&&e[k]._onDragOver({clientX:nt.clientX,clientY:nt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break;t=e}while(e=e.parentNode);Mt()}},_onTouchMove:function(t){if(et){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=K&&b(K,!0),a=K&&r&&r.a,l=K&&r&&r.d,s=yt&&dt&&T(dt),c=(i.clientX-et.clientX+o.x)/(a||1)+(s?s[0]-mt[0]:0)/(a||1),u=(i.clientY-et.clientY+o.y)/(l||1)+(s?s[1]-mt[1]:0)/(l||1);if(!It.active&&!ht){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(K){r?(r.e+=c-(ot||0),r.f+=u-(it||0)):r={a:1,b:0,c:0,d:1,e:c,f:u};var d="matrix("+r.a+","+r.b+","+r.c+","+r.d+","+r.e+","+r.f+")";m(K,"webkitTransform",d),m(K,"mozTransform",d),m(K,"msTransform",d),m(K,"transform",d),ot=c,it=u,nt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!K){var t=this.options.fallbackOnBody?document.body:W,e=y(L,!0,yt,!0,t),n=this.options;if(yt){for(dt=t;"static"===m(dt,"position")&&"none"===m(dt,"transform")&&dt!==document;)dt=dt.parentNode;dt!==document.body&&dt!==document.documentElement?(dt===document&&(dt=E()),e.top+=dt.scrollTop,e.left+=dt.scrollLeft):dt=E(),mt=T(dt)}v(K=L.cloneNode(!0),n.ghostClass,!1),v(K,n.fallbackClass,!0),v(K,n.dragClass,!0),m(K,"transition",""),m(K,"transform",""),m(K,"box-sizing","border-box"),m(K,"margin",0),m(K,"top",e.top),m(K,"left",e.left),m(K,"width",e.width),m(K,"height",e.height),m(K,"opacity","0.8"),m(K,"position",yt?"absolute":"fixed"),m(K,"zIndex","100000"),m(K,"pointerEvents","none"),It.ghost=K,t.appendChild(K),m(K,"transform-origin",rt/parseInt(K.style.width)*100+"% "+at/parseInt(K.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;H("dragStart",this,{evt:t}),It.eventCanceled?this._onDrop():(H("setupClone",this),It.eventCanceled||((U=A(L)).draggable=!1,U.style["will-change"]="",this._hideClone(),v(U,this.options.chosenClass,!1),It.clone=U),n.cloneId=Yt(function(){H("clone",n),It.eventCanceled||(n.options.removeCloneOnHide||W.insertBefore(U,L),n._hideClone(),F({sortable:n,name:"clone"}))}),!e&&v(L,i.dragClass,!0),e?(ft=!0,n._loopId=setInterval(n._emulateDragOver,50)):(u(document,"mouseup",n._onDrop),u(document,"touchend",n._onDrop),u(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,L)),c(document,"drop",n),m(L,"transform","translateZ(0)")),ht=!0,n._dragStartId=Yt(n._dragStarted.bind(n,e,t)),c(document,"selectstart",n),lt=!0,r&&m(document.body,"user-select","none"))},_onDragOver:function(e){var n,o,i,r,a=this.el,l=e.target,s=this.options,c=s.group,u=It.active,d=J===c,h=s.sort,p=tt||u,g=this,b=!1;if(!bt){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),l=f(l,s.draggable,a,!0),B("dragOver"),It.eventCanceled)return b;if(L.contains(e.target)||l.animated&&l.animatingX&&l.animatingY||g._ignoreWhileAnimating===l)return U(!1);if(ft=!1,u&&!s.disabled&&(d?h||(i=!W.contains(L)):tt===this||(this.lastPutMode=J.checkPull(this,u,L,e))&&c.checkPut(this,u,L,e))){if(r="vertical"===this._getDirection(e,l),n=y(L),B("dragOverValid"),It.eventCanceled)return b;if(i)return j=W,G(),this._hideClone(),B("revert"),It.eventCanceled||(z?W.insertBefore(L,z):W.appendChild(L)),U(!0);var w=S(a,s.draggable);if(!w||function(t,e,n){var o=y(S(n.el,n.options.draggable));return e?t.clientX>o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(e,r,this)&&!w.animated){if(w===L)return U(!1);if(w&&a===e.target&&(l=w),l&&(o=y(l)),!1!==Pt(W,a,L,n,l,o,e,!!l))return G(),a.appendChild(L),j=a,q(),U(!0)}else if(l.parentNode===a){o=y(l);var E,_,T,x=L.parentNode!==a,M=!function(t,e,n){var o=n?t.left:t.top,i=n?e.left:e.top;return o===i||(n?t.right:t.bottom)===(n?e.right:e.bottom)||o+(n?t.width:t.height)/2===i+(n?e.width:e.height)/2}(L.animated&&L.toRect||n,l.animated&&l.toRect||o,r),N=r?"top":"left",A=D(l,"top","top")||D(L,"top","top"),I=A?A.scrollTop:void 0;if(st!==l&&(_=o[N],gt=!1,vt=!M&&s.invertSwap||x),0!==(E=function(t,e,n,o,i,r,a,l){var s=o?t.clientY:t.clientX,c=o?n.height:n.width,u=o?n.top:n.left,d=o?n.bottom:n.right,h=!1;if(!a)if(l&&ut<c*i){if(!gt&&(1===ct?s>u+c*r/2:s<d-c*r/2)&&(gt=!0),gt)h=!0;else if(1===ct?s<u+ut:s>d-ut)return-ct}else if(s>u+c*(1-i)/2&&s<d-c*(1-i)/2)return function(t){return C(L)<C(t)?1:-1}(e);return(h=h||a)&&(s<u+c*r/2||s>d-c*r/2)?s>u+c/2?1:-1:0}(e,l,o,r,M?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,vt,st===l))){var P=C(L);do{T=j.children[P-=E]}while(T&&("none"===m(T,"display")||T===K))}if(0===E||T===l)return U(!1);st=l,ct=E;var R=l.nextElementSibling,X=!1,Y=Pt(W,a,L,n,l,o,e,X=1===E);if(!1!==Y)return 1!==Y&&-1!==Y||(X=1===Y),bt=!0,setTimeout(Rt,30),G(),X&&!R?a.appendChild(L):l.parentNode.insertBefore(L,X?R:l),A&&O(A,0,I-A.scrollTop),j=L.parentNode,void 0===_||vt||(ut=Math.abs(_-y(l)[N])),q(),U(!0)}if(a.contains(L))return U(!1)}return!1}function B(s,c){H(s,g,t({evt:e,isOwner:d,axis:r?"vertical":"horizontal",revert:i,dragRect:n,targetRect:o,canSort:h,fromSortable:p,target:l,completed:U,onMove:function(t,o){return Pt(W,a,L,n,t,y(t),e,o)},changed:q},c))}function G(){B("dragOverAnimationCapture"),g.captureAnimationState(),g!==p&&p.captureAnimationState()}function U(t){return B("dragOverCompleted",{insertion:t}),t&&(d?u._hideClone():u._showClone(g),g!==p&&(v(L,tt?tt.options.ghostClass:u.options.ghostClass,!1),v(L,s.ghostClass,!0)),tt!==g&&g!==It.active?tt=g:g===It.active&&tt&&(tt=null),p===g&&(g._ignoreWhileAnimating=l),g.animateAll(function(){B("dragOverAnimationComplete"),g._ignoreWhileAnimating=null}),g!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(l===L&&!L.animated||l===a&&!l.animated)&&(st=null),s.dragoverBubble||e.rootEl||l===document||(L.parentNode[k]._isOutsideThisEl(e.target),!t&&Ot(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),b=!0}function q(){Z=C(L),$=C(L,s.draggable),F({sortable:g,name:"change",toEl:a,newIndex:Z,newDraggableIndex:$,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){u(document,"mousemove",this._onTouchMove),u(document,"touchmove",this._onTouchMove),u(document,"pointermove",this._onTouchMove),u(document,"dragover",Ot),u(document,"mousemove",Ot),u(document,"touchmove",Ot)},_offUpEvents:function(){var t=this.el.ownerDocument;u(t,"mouseup",this._onDrop),u(t,"touchend",this._onDrop),u(t,"pointerup",this._onDrop),u(t,"touchcancel",this._onDrop),u(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Z=C(L),$=C(L,n.draggable),H("drop",this,{evt:t}),j=L&&L.parentNode,Z=C(L),$=C(L,n.draggable),It.eventCanceled||(ht=!1,vt=!1,gt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Bt(this.cloneId),Bt(this._dragStartId),this.nativeDraggable&&(u(document,"drop",this),u(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),r&&m(document.body,"user-select",""),m(L,"transform",""),t&&(lt&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),K&&K.parentNode&&K.parentNode.removeChild(K),(W===j||tt&&"clone"!==tt.lastPutMode)&&U&&U.parentNode&&U.parentNode.removeChild(U),L&&(this.nativeDraggable&&u(L,"dragend",this),kt(L),L.style["will-change"]="",lt&&!ht&&v(L,tt?tt.options.ghostClass:this.options.ghostClass,!1),v(L,this.options.chosenClass,!1),F({sortable:this,name:"unchoose",toEl:j,newIndex:null,newDraggableIndex:null,originalEvent:t}),W!==j?(Z>=0&&(F({rootEl:j,name:"add",toEl:j,fromEl:W,originalEvent:t}),F({sortable:this,name:"remove",toEl:j,originalEvent:t}),F({rootEl:j,name:"sort",toEl:j,fromEl:W,originalEvent:t}),F({sortable:this,name:"sort",toEl:j,originalEvent:t})),tt&&tt.save()):Z!==V&&Z>=0&&(F({sortable:this,name:"update",toEl:j,originalEvent:t}),F({sortable:this,name:"sort",toEl:j,originalEvent:t})),It.active&&(null!=Z&&-1!==Z||(Z=V,$=Q),F({sortable:this,name:"end",toEl:j,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){H("nulling",this),W=L=j=K=z=U=G=q=et=nt=lt=Z=$=V=Q=st=ct=tt=J=It.dragged=It.ghost=It.clone=It.active=null,wt.forEach(function(t){t.checked=!0}),wt.length=ot=it=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":L&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o<i;o++)f(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||Xt(t));return e},sort:function(t){var e={},n=this.el;this.toArray().forEach(function(t,o){var i=n.children[o];f(i,this.options.draggable,n,!1)&&(e[t]=i)},this),t.forEach(function(t){e[t]&&(n.removeChild(e[t]),n.appendChild(e[t]))})},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return f(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];var o=Y.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&Tt(n)},destroy:function(){H("destroy",this);var t=this.el;t[k]=null,u(t,"mousedown",this._onTapStart),u(t,"touchstart",this._onTapStart),u(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(u(t,"dragover",this),u(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),pt.splice(pt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!q){if(H("hideClone",this),It.eventCanceled)return;m(U,"display","none"),this.options.removeCloneOnHide&&U.parentNode&&U.parentNode.removeChild(U),q=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(q){if(H("showClone",this),It.eventCanceled)return;L.parentNode!=W||this.options.group.revertClone?z?W.insertBefore(U,z):W.appendChild(U):W.insertBefore(U,L),this.options.group.revertClone&&this.animate(L,U),m(U,"display",""),q=!1}}else this._hideClone()}},Et&&c(document,"touchmove",function(t){(It.active||ht)&&t.cancelable&&t.preventDefault()}),It.utils={on:c,off:u,css:m,find:w,is:function(t,e){return!!f(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},throttle:N,closest:f,toggleClass:v,clone:A,index:C,nextTick:Yt,cancelNextTick:Bt,detectDirection:Ct,getChild:_},It.get=function(t){return t[k]},It.mount=function(){var e=[].slice.call(arguments);e[0].constructor===Array&&(e=e[0]),e.forEach(function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not "+{}.toString.call(e);e.utils&&(It.utils=t({},It.utils,e.utils)),Y.mount(e)})},It.create=function(t,e){return new It(t,e)},It.version="1.12.0";var Ht,Ft,Lt,jt,Kt,Wt=[],zt=[],Gt=!1,Ut=!1,qt=!1;function Vt(t,e){zt.forEach(function(n,o){var i=e.children[n.sortableIndex+(t?Number(o):0)];i?e.insertBefore(n,i):e.appendChild(n)})}function Zt(){Wt.forEach(function(t){t!==Lt&&t.parentNode&&t.parentNode.removeChild(t)})}var Qt=function(t){var e=t.originalEvent,n=t.putSortable,o=t.dragEl,i=t.dispatchSortableEvent,r=t.unhideGhostForTarget;if(e){var a=n||t.activeSortable;(0,t.hideGhostForTarget)();var l=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,s=document.elementFromPoint(l.clientX,l.clientY);r(),a&&!a.el.contains(s)&&(i("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function $t(){}function Jt(){}$t.prototype={startIndex:null,dragStart:function(t){this.startIndex=t.oldDraggableIndex},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=_(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(e,o):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Qt},Object.assign($t,{pluginName:"revertOnSpill"}),Jt.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Qt},Object.assign(Jt,{pluginName:"removeOnSpill"});var te,ee,ne,oe,ie,re,ae=[],le=!1;function se(){ae.forEach(function(t){clearInterval(t.pid)}),ae=[]}function ce(){clearInterval(re)}var ue=N(function(t,e,n,o){if(e.scroll){var i,r=(t.touches?t.touches[0]:t).clientX,a=(t.touches?t.touches[0]:t).clientY,l=e.scrollSensitivity,s=e.scrollSpeed,c=E(),u=!1;ee!==n&&(ee=n,se(),i=e.scrollFn,!0===(te=e.scroll)&&(te=x(n,!0)));var d=0,h=te;do{var f=h,p=y(f),g=p.top,v=p.bottom,b=p.left,w=p.right,D=p.width,_=p.height,S=void 0,C=void 0,T=f.scrollWidth,M=f.scrollHeight,N=m(f),A=f.scrollLeft,I=f.scrollTop;f===c?(S=D<T&&("auto"===N.overflowX||"scroll"===N.overflowX||"visible"===N.overflowX),C=_<M&&("auto"===N.overflowY||"scroll"===N.overflowY||"visible"===N.overflowY)):(S=D<T&&("auto"===N.overflowX||"scroll"===N.overflowX),C=_<M&&("auto"===N.overflowY||"scroll"===N.overflowY));var P=S&&(Math.abs(w-r)<=l&&A+D<T)-(Math.abs(b-r)<=l&&!!A),R=C&&(Math.abs(v-a)<=l&&I+_<M)-(Math.abs(g-a)<=l&&!!I);if(!ae[d])for(var X=0;X<=d;X++)ae[X]||(ae[X]={});ae[d].vx==P&&ae[d].vy==R&&ae[d].el===f||(ae[d].el=f,ae[d].vx=P,ae[d].vy=R,clearInterval(ae[d].pid),0==P&&0==R||(u=!0,ae[d].pid=setInterval(function(){o&&0===this.layer&&It.active._onTouchMove(ie);var e=ae[this.layer].vy?ae[this.layer].vy*s:0,n=ae[this.layer].vx?ae[this.layer].vx*s:0;"function"==typeof i&&"continue"!==i.call(It.dragged.parentNode[k],n,e,t,ie,ae[this.layer].el)||O(ae[this.layer].el,n,e)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&h!==c&&(h=x(h,!1)));le=u}},30);return It.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?c(document,"dragover",this._handleAutoScroll):c(document,this.options.supportPointer?"pointermove":e.touches?"touchmove":"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?u(document,"dragover",this._handleAutoScroll):(u(document,"pointermove",this._handleFallbackAutoScroll),u(document,"touchmove",this._handleFallbackAutoScroll),u(document,"mousemove",this._handleFallbackAutoScroll)),ce(),se(),clearTimeout(p),p=void 0},nulling:function(){ie=ee=te=le=re=ne=oe=null,ae.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var i=this,a=(t.touches?t.touches[0]:t).clientX,l=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(a,l);if(ie=t,e||o||n||r){ue(t,this.options,s,e);var c=x(s,!0);!le||re&&a===ne&&l===oe||(re&&ce(),re=setInterval(function(){var n=x(document.elementFromPoint(a,l),!0);n!==c&&(c=n,se()),ue(t,i.options,n,e)},10),ne=a,oe=l)}else{if(!this.options.bubbleScroll||x(s,!0)===E())return void se();ue(t,this.options,x(s,!1),!1)}}},Object.assign(t,{pluginName:"scroll",initializeByDefault:!0})}),It.mount(Jt,$t),It.mount(new function(){function t(){this.defaults={swapClass:"sortable-swap-highlight"}}return t.prototype={dragStart:function(t){Nt=t.dragEl},dragOverValid:function(t){var e=t.completed,n=t.target,o=t.changed,i=t.cancel;if(t.activeSortable.options.swap){var r=this.options;if(n&&n!==this.sortable.el){var a=Nt;!1!==(0,t.onMove)(n)?(v(n,r.swapClass,!0),Nt=n):Nt=null,a&&a!==Nt&&v(a,r.swapClass,!1)}o(),e(!0),i()}},drop:function(t){var e,n,o,i,r,a,l=t.activeSortable,s=t.putSortable,c=t.dragEl,u=s||this.sortable,d=this.options;Nt&&v(Nt,d.swapClass,!1),Nt&&(d.swap||s&&s.options.swap)&&c!==Nt&&(u.captureAnimationState(),u!==l&&l.captureAnimationState(),a=(n=Nt).parentNode,(r=(e=c).parentNode)&&a&&!r.isEqualNode(n)&&!a.isEqualNode(e)&&(o=C(e),i=C(n),r.isEqualNode(a)&&o<i&&i++,r.insertBefore(n,r.children[o]),a.insertBefore(e,a.children[i])),u.animateAll(),u!==l&&l.animateAll())},nulling:function(){Nt=null}},Object.assign(t,{pluginName:"swap",eventProperties:function(){return{swapItem:Nt}}})}),It.mount(new function(){function t(t){for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));t.options.supportPointer?c(document,"pointerup",this._deselectMultiDrag):(c(document,"mouseup",this._deselectMultiDrag),c(document,"touchend",this._deselectMultiDrag)),c(document,"keydown",this._checkKeyDown),c(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,setData:function(e,n){var o="";Wt.length&&Ft===t?Wt.forEach(function(t,e){o+=(e?", ":"")+t.textContent}):o=n.textContent,e.setData("Text",o)}}}return t.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal:function(t){Lt=t.dragEl},delayEnded:function(){this.isMultiDrag=~Wt.indexOf(Lt)},setupClone:function(t){var e=t.sortable,n=t.cancel;if(this.isMultiDrag){for(var o=0;o<Wt.length;o++)zt.push(A(Wt[o])),zt[o].sortableIndex=Wt[o].sortableIndex,zt[o].draggable=!1,zt[o].style["will-change"]="",v(zt[o],this.options.selectedClass,!1),Wt[o]===Lt&&v(zt[o],this.options.chosenClass,!1);e._hideClone(),n()}},clone:function(t){var e=t.dispatchSortableEvent,n=t.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||Wt.length&&Ft===t.sortable&&(Vt(!0,t.rootEl),e("clone"),n()))},showClone:function(t){var e=t.cloneNowShown,n=t.cancel;this.isMultiDrag&&(Vt(!1,t.rootEl),zt.forEach(function(t){m(t,"display","")}),e(),Kt=!1,n())},hideClone:function(t){var e=this,n=t.cloneNowHidden,o=t.cancel;this.isMultiDrag&&(zt.forEach(function(t){m(t,"display","none"),e.options.removeCloneOnHide&&t.parentNode&&t.parentNode.removeChild(t)}),n(),Kt=!0,o())},dragStartGlobal:function(t){!this.isMultiDrag&&Ft&&Ft.multiDrag._deselectMultiDrag(),Wt.forEach(function(t){t.sortableIndex=C(t)}),Wt=Wt.sort(function(t,e){return t.sortableIndex-e.sortableIndex}),qt=!0},dragStarted:function(t){var e=this,n=t.sortable;if(this.isMultiDrag){if(this.options.sort&&(n.captureAnimationState(),this.options.animation)){Wt.forEach(function(t){t!==Lt&&m(t,"position","absolute")});var o=y(Lt,!1,!0,!0);Wt.forEach(function(t){t!==Lt&&I(t,o)}),Ut=!0,Gt=!0}n.animateAll(function(){Ut=!1,Gt=!1,e.options.animation&&Wt.forEach(function(t){P(t)}),e.options.sort&&Zt()})}},dragOver:function(t){var e=t.completed,n=t.cancel;Ut&&~Wt.indexOf(t.target)&&(e(!1),n())},revert:function(t){var e=t.fromSortable,n=t.rootEl,o=t.sortable,i=t.dragRect;Wt.length>1&&(Wt.forEach(function(t){o.addAnimationState({target:t,rect:Ut?y(t):i}),P(t),t.fromRect=i,e.removeAnimationState(t)}),Ut=!1,function(t,e){Wt.forEach(function(n,o){var i=e.children[n.sortableIndex+(t?Number(o):0)];i?e.insertBefore(n,i):e.appendChild(n)})}(!this.options.removeCloneOnHide,n))},dragOverCompleted:function(t){var e=t.sortable,n=t.isOwner,o=t.activeSortable,i=t.parentEl,r=t.putSortable,a=this.options;if(t.insertion){if(n&&o._hideClone(),Gt=!1,a.animation&&Wt.length>1&&(Ut||!n&&!o.options.sort&&!r)){var l=y(Lt,!1,!0,!0);Wt.forEach(function(t){t!==Lt&&(I(t,l),i.appendChild(t))}),Ut=!0}if(!n)if(Ut||Zt(),Wt.length>1){var s=Kt;o._showClone(e),o.options.animation&&!Kt&&s&&zt.forEach(function(t){o.addAnimationState({target:t,rect:jt}),t.fromRect=jt,t.thisAnimationDuration=null})}else o._showClone(e)}},dragOverAnimationCapture:function(t){var e=t.dragRect,n=t.isOwner,o=t.activeSortable;if(Wt.forEach(function(t){t.thisAnimationDuration=null}),o.options.animation&&!n&&o.multiDrag.isMultiDrag){jt=Object.assign({},e);var i=b(Lt,!0);jt.top-=i.f,jt.left-=i.e}},dragOverAnimationComplete:function(){Ut&&(Ut=!1,Zt())},drop:function(t){var e=t.originalEvent,n=t.rootEl,o=t.parentEl,i=t.sortable,r=t.dispatchSortableEvent,a=t.oldIndex,l=t.putSortable,s=l||this.sortable;if(e){var c=this.options,u=o.children;if(!qt)if(c.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),v(Lt,c.selectedClass,!~Wt.indexOf(Lt)),~Wt.indexOf(Lt))Wt.splice(Wt.indexOf(Lt),1),Ht=null,B({sortable:i,rootEl:n,name:"deselect",targetEl:Lt,originalEvt:e});else{if(Wt.push(Lt),B({sortable:i,rootEl:n,name:"select",targetEl:Lt,originalEvt:e}),e.shiftKey&&Ht&&i.el.contains(Ht)){var d,h,f=C(Ht),p=C(Lt);if(~f&&~p&&f!==p)for(p>f?(h=f,d=p):(h=p,d=f+1);h<d;h++)~Wt.indexOf(u[h])||(v(u[h],c.selectedClass,!0),Wt.push(u[h]),B({sortable:i,rootEl:n,name:"select",targetEl:u[h],originalEvt:e}))}else Ht=Lt;Ft=s}if(qt&&this.isMultiDrag){if((o[k].options.sort||o!==n)&&Wt.length>1){var g=y(Lt),m=C(Lt,":not(."+this.options.selectedClass+")");if(!Gt&&c.animation&&(Lt.thisAnimationDuration=null),s.captureAnimationState(),!Gt&&(c.animation&&(Lt.fromRect=g,Wt.forEach(function(t){if(t.thisAnimationDuration=null,t!==Lt){var e=Ut?y(t):g;t.fromRect=e,s.addAnimationState({target:t,rect:e})}})),Zt(),Wt.forEach(function(t){u[m]?o.insertBefore(t,u[m]):o.appendChild(t),m++}),a===C(Lt))){var b=!1;Wt.forEach(function(t){t.sortableIndex===C(t)||(b=!0)}),b&&r("update")}Wt.forEach(function(t){P(t)}),s.animateAll()}Ft=s}(n===o||l&&"clone"!==l.lastPutMode)&&zt.forEach(function(t){t.parentNode&&t.parentNode.removeChild(t)})}},nullingGlobal:function(){this.isMultiDrag=qt=!1,zt.length=0},destroyGlobal:function(){this._deselectMultiDrag(),u(document,"pointerup",this._deselectMultiDrag),u(document,"mouseup",this._deselectMultiDrag),u(document,"touchend",this._deselectMultiDrag),u(document,"keydown",this._checkKeyDown),u(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(t){if(!(void 0!==qt&&qt||Ft!==this.sortable||t&&f(t.target,this.options.draggable,this.sortable.el,!1)||t&&0!==t.button))for(;Wt.length;){var e=Wt[0];v(e,this.options.selectedClass,!1),Wt.shift(),B({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:e,originalEvt:t})}},_checkKeyDown:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},Object.assign(t,{pluginName:"multiDrag",utils:{select:function(t){var e=t.parentNode[k];e&&e.options.multiDrag&&!~Wt.indexOf(t)&&(Ft&&Ft!==e&&(Ft.multiDrag._deselectMultiDrag(),Ft=e),v(t,e.options.selectedClass,!0),Wt.push(t))},deselect:function(t){var e=t.parentNode[k],n=Wt.indexOf(t);e&&e.options.multiDrag&&~n&&(v(t,e.options.selectedClass,!1),Wt.splice(n,1))}},eventProperties:function(){var t=this,e=[],n=[];return Wt.forEach(function(o){var i;e.push({multiDragElement:o,index:o.sortableIndex}),i=Ut&&o!==Lt?-1:Ut?C(o,":not(."+t.options.selectedClass+")"):C(o),n.push({multiDragElement:o,index:i})}),{items:[].concat(Wt),clones:[].concat(zt),oldIndicies:e,newIndicies:n}},optionListeners:{multiDragKey:function(t){return"ctrl"===(t=t.toLowerCase())?t="Control":t.length>1&&(t=t.charAt(0).toUpperCase()+t.substr(1)),t}}})}),It}); - - this.__default_export = module.exports; -}).__default_export; \ No newline at end of file +/**! + * Sortable 1.15.0 + * @author RubaXa <trash@rubaxa.org> + * @author owenm <owen23355@gmail.com> + * @license MIT + */ +function ownKeys(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(o),!0).forEach((function(e){_defineProperty(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function _typeof(t){return _typeof="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},_typeof(t)}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _extends(){return _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(t,e){if(null==t)return{};var o,n,r={},l=Object.keys(t);for(n=0;n<l.length;n++)o=l[n],e.indexOf(o)>=0||(r[o]=t[o]);return r}function _objectWithoutProperties(t,e){if(null==t)return{};var o,n,r=_objectWithoutPropertiesLoose(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n<l.length;n++)o=l[n],e.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(r[o]=t[o])}return r}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,n=new Array(e);o<e;o++)n[o]=t[o];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var version="1.15.0";function userAgent(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var IE11OrLess=userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Edge=userAgent(/Edge/i),FireFox=userAgent(/firefox/i),Safari=userAgent(/safari/i)&&!userAgent(/chrome/i)&&!userAgent(/android/i),IOS=userAgent(/iP(ad|od|hone)/i),ChromeForAndroid=userAgent(/chrome/i)&&userAgent(/android/i),captureMode={capture:!1,passive:!1};function on(t,e,o){t.addEventListener(e,o,!IE11OrLess&&captureMode)}function off(t,e,o){t.removeEventListener(e,o,!IE11OrLess&&captureMode)}function matches(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function getParentOrHost(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function closest(t,e,o,n){if(t){o=o||document;do{if(null!=e&&(">"===e[0]?t.parentNode===o&&matches(t,e):matches(t,e))||n&&t===o)return t;if(t===o)break}while(t=getParentOrHost(t))}return null}var _throttleTimeout,R_SPACE=/\s+/g;function toggleClass(t,e,o){if(t&&e)if(t.classList)t.classList[o?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(R_SPACE," ").replace(" "+e+" "," ");t.className=(n+(o?" "+e:"")).replace(R_SPACE," ")}}function css(t,e,o){var n=t&&t.style;if(n){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(o=t.currentStyle),void 0===e?o:o[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=o+("string"==typeof o?"":"px")}}function matrix(t,e){var o="";if("string"==typeof t)o=t;else do{var n=css(t,"transform");n&&"none"!==n&&(o=n+" "+o)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(o)}function find(t,e,o){if(t){var n=t.getElementsByTagName(e),r=0,l=n.length;if(o)for(;r<l;r++)o(n[r],r);return n}return[]}function getWindowScrollingElement(){var t=document.scrollingElement;return t||document.documentElement}function getRect(t,e,o,n,r){if(t.getBoundingClientRect||t===window){var l,a,i,s,c,d,u;if(t!==window&&t.parentNode&&t!==getWindowScrollingElement()?(a=(l=t.getBoundingClientRect()).top,i=l.left,s=l.bottom,c=l.right,d=l.height,u=l.width):(a=0,i=0,s=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(e||o)&&t!==window&&(r=r||t.parentNode,!IE11OrLess))do{if(r&&r.getBoundingClientRect&&("none"!==css(r,"transform")||o&&"static"!==css(r,"position"))){var g=r.getBoundingClientRect();a-=g.top+parseInt(css(r,"border-top-width")),i-=g.left+parseInt(css(r,"border-left-width")),s=a+l.height,c=i+l.width;break}}while(r=r.parentNode);if(n&&t!==window){var h=matrix(r||t),p=h&&h.a,f=h&&h.d;h&&(s=(a/=f)+(d/=f),c=(i/=p)+(u/=p))}return{top:a,left:i,bottom:s,right:c,width:u,height:d}}}function isScrolledPast(t,e,o){for(var n=getParentAutoScrollElement(t,!0),r=getRect(t)[e];n;){var l=getRect(n)[o];if(!("top"===o||"left"===o?r>=l:r<=l))return n;if(n===getWindowScrollingElement())break;n=getParentAutoScrollElement(n,!1)}return!1}function getChild(t,e,o,n){for(var r=0,l=0,a=t.children;l<a.length;){if("none"!==a[l].style.display&&a[l]!==Sortable.ghost&&(n||a[l]!==Sortable.dragged)&&closest(a[l],o.draggable,t,!1)){if(r===e)return a[l];r++}l++}return null}function lastChild(t,e){for(var o=t.lastElementChild;o&&(o===Sortable.ghost||"none"===css(o,"display")||e&&!matches(o,e));)o=o.previousElementSibling;return o||null}function index(t,e){var o=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===Sortable.clone||e&&!matches(t,e)||o++;return o}function getRelativeScrollOffset(t){var e=0,o=0,n=getWindowScrollingElement();if(t)do{var r=matrix(t),l=r.a,a=r.d;e+=t.scrollLeft*l,o+=t.scrollTop*a}while(t!==n&&(t=t.parentNode));return[e,o]}function indexOfObject(t,e){for(var o in t)if(t.hasOwnProperty(o))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[o][n])return Number(o);return-1}function getParentAutoScrollElement(t,e){if(!t||!t.getBoundingClientRect)return getWindowScrollingElement();var o=t,n=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var r=css(o);if(o.clientWidth<o.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!o.getBoundingClientRect||o===document.body)return getWindowScrollingElement();if(n||e)return o;n=!0}}}while(o=o.parentNode);return getWindowScrollingElement()}function extend(t,e){if(t&&e)for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t}function isRectEqual(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function throttle(t,e){return function(){if(!_throttleTimeout){var o=arguments;1===o.length?t.call(this,o[0]):t.apply(this,o),_throttleTimeout=setTimeout((function(){_throttleTimeout=void 0}),e)}}}function cancelThrottle(){clearTimeout(_throttleTimeout),_throttleTimeout=void 0}function scrollBy(t,e,o){t.scrollLeft+=e,t.scrollTop+=o}function clone(t){var e=window.Polymer,o=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):o?o(t).clone(!0)[0]:t.cloneNode(!0)}function setRect(t,e){css(t,"position","absolute"),css(t,"top",e.top),css(t,"left",e.left),css(t,"width",e.width),css(t,"height",e.height)}function unsetRect(t){css(t,"position",""),css(t,"top",""),css(t,"left",""),css(t,"width",""),css(t,"height","")}var expando="Sortable"+(new Date).getTime();function AnimationStateManager(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==css(t,"display")&&t!==Sortable.ghost){e.push({target:t,rect:getRect(t)});var o=_objectSpread2({},e[e.length-1].rect);if(t.thisAnimationDuration){var n=matrix(t,!0);n&&(o.top-=n.f,o.left-=n.e)}t.fromRect=o}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(indexOfObject(e,{target:t}),1)},animateAll:function(o){var n=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof o&&o());var r=!1,l=0;e.forEach((function(t){var e=0,o=t.target,a=o.fromRect,i=getRect(o),s=o.prevFromRect,c=o.prevToRect,d=t.rect,u=matrix(o,!0);u&&(i.top-=u.f,i.left-=u.e),o.toRect=i,o.thisAnimationDuration&&isRectEqual(s,i)&&!isRectEqual(a,i)&&(d.top-i.top)/(d.left-i.left)==(a.top-i.top)/(a.left-i.left)&&(e=calculateRealTime(d,s,c,n.options)),isRectEqual(i,a)||(o.prevFromRect=a,o.prevToRect=i,e||(e=n.options.animation),n.animate(o,d,i,e)),e&&(r=!0,l=Math.max(l,e),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout((function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null}),e),o.thisAnimationDuration=e)})),clearTimeout(t),r?t=setTimeout((function(){"function"==typeof o&&o()}),l):"function"==typeof o&&o(),e=[]},animate:function(t,e,o,n){if(n){css(t,"transition",""),css(t,"transform","");var r=matrix(this.el),l=r&&r.a,a=r&&r.d,i=(e.left-o.left)/(l||1),s=(e.top-o.top)/(a||1);t.animatingX=!!i,t.animatingY=!!s,css(t,"transform","translate3d("+i+"px,"+s+"px,0)"),this.forRepaintDummy=repaint(t),css(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),css(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){css(t,"transition",""),css(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),n)}}}}function repaint(t){return t.offsetWidth}function calculateRealTime(t,e,o,n){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-o.top,2)+Math.pow(e.left-o.left,2))*n.animation}var plugins=[],defaults={initializeByDefault:!0},PluginManager={mount:function(t){for(var e in defaults)defaults.hasOwnProperty(e)&&!(e in t)&&(t[e]=defaults[e]);plugins.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),plugins.push(t)},pluginEvent:function(t,e,o){var n=this;this.eventCanceled=!1,o.cancel=function(){n.eventCanceled=!0};var r=t+"Global";plugins.forEach((function(n){e[n.pluginName]&&(e[n.pluginName][r]&&e[n.pluginName][r](_objectSpread2({sortable:e},o)),e.options[n.pluginName]&&e[n.pluginName][t]&&e[n.pluginName][t](_objectSpread2({sortable:e},o)))}))},initializePlugins:function(t,e,o,n){for(var r in plugins.forEach((function(n){var r=n.pluginName;if(t.options[r]||n.initializeByDefault){var l=new n(t,e,t.options);l.sortable=t,l.options=t.options,t[r]=l,_extends(o,l.defaults)}})),t.options)if(t.options.hasOwnProperty(r)){var l=this.modifyOption(t,r,t.options[r]);void 0!==l&&(t.options[r]=l)}},getEventProperties:function(t,e){var o={};return plugins.forEach((function(n){"function"==typeof n.eventProperties&&_extends(o,n.eventProperties.call(e[n.pluginName],t))})),o},modifyOption:function(t,e,o){var n;return plugins.forEach((function(r){t[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[e]&&(n=r.optionListeners[e].call(t[r.pluginName],o))})),n}};function dispatchEvent(t){var e=t.sortable,o=t.rootEl,n=t.name,r=t.targetEl,l=t.cloneEl,a=t.toEl,i=t.fromEl,s=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,g=t.originalEvent,h=t.putSortable,p=t.extraEventProperties;if(e=e||o&&o[expando]){var f,m=e.options,v="on"+n.charAt(0).toUpperCase()+n.substr(1);!window.CustomEvent||IE11OrLess||Edge?(f=document.createEvent("Event")).initEvent(n,!0,!0):f=new CustomEvent(n,{bubbles:!0,cancelable:!0}),f.to=a||o,f.from=i||o,f.item=r||o,f.clone=l,f.oldIndex=s,f.newIndex=c,f.oldDraggableIndex=d,f.newDraggableIndex=u,f.originalEvent=g,f.pullMode=h?h.lastPutMode:void 0;var E=_objectSpread2(_objectSpread2({},p),PluginManager.getEventProperties(n,e));for(var b in E)f[b]=E[b];o&&o.dispatchEvent(f),m[v]&&m[v].call(e,f)}}var _excluded=["evt"],pluginEvent=function(t,e){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=o.evt,r=_objectWithoutProperties(o,_excluded);PluginManager.pluginEvent.bind(Sortable)(t,e,_objectSpread2({dragEl,parentEl,ghostEl,rootEl,nextEl,lastDownEl,cloneEl,cloneHidden,dragStarted:moved,putSortable,activeSortable:Sortable.active,originalEvent:n,oldIndex,oldDraggableIndex,newIndex,newDraggableIndex,hideGhostForTarget:_hideGhostForTarget,unhideGhostForTarget:_unhideGhostForTarget,cloneNowHidden:function(){cloneHidden=!0},cloneNowShown:function(){cloneHidden=!1},dispatchSortableEvent:function(t){_dispatchEvent({sortable:e,name:t,originalEvent:n})}},r))};function _dispatchEvent(t){dispatchEvent(_objectSpread2({putSortable,cloneEl,targetEl:dragEl,rootEl,oldIndex,oldDraggableIndex,newIndex,newDraggableIndex},t))}var dragEl,parentEl,ghostEl,rootEl,nextEl,lastDownEl,cloneEl,cloneHidden,oldIndex,newIndex,oldDraggableIndex,newDraggableIndex,activeGroup,putSortable,tapEvt,touchEvt,lastDx,lastDy,tapDistanceLeft,tapDistanceTop,moved,lastTarget,lastDirection,targetMoveDistance,ghostRelativeParent,awaitingDragStarted=!1,ignoreNextClick=!1,sortables=[],pastFirstInvertThresh=!1,isCircumstantialInvert=!1,ghostRelativeParentInitialScroll=[],_silent=!1,savedInputChecked=[],documentExists="undefined"!=typeof document,PositionGhostAbsolutely=IOS,CSSFloatProperty=Edge||IE11OrLess?"cssFloat":"float",supportDraggable=documentExists&&!ChromeForAndroid&&!IOS&&"draggable"in document.createElement("div"),supportCssPointerEvents=function(){if(documentExists){if(IE11OrLess)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),_detectDirection=function(t,e){var o=css(t),n=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=getChild(t,0,e),l=getChild(t,1,e),a=r&&css(r),i=l&&css(l),s=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+getRect(r).width,c=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+getRect(l).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&a.float&&"none"!==a.float){var d="left"===a.float?"left":"right";return!l||"both"!==i.clear&&i.clear!==d?"horizontal":"vertical"}return r&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||s>=n&&"none"===o[CSSFloatProperty]||l&&"none"===o[CSSFloatProperty]&&s+c>n)?"vertical":"horizontal"},_dragElInRowColumn=function(t,e,o){var n=o?t.left:t.top,r=o?t.right:t.bottom,l=o?t.width:t.height,a=o?e.left:e.top,i=o?e.right:e.bottom,s=o?e.width:e.height;return n===a||r===i||n+l/2===a+s/2},_detectNearestEmptySortable=function(t,e){var o;return sortables.some((function(n){var r=n[expando].options.emptyInsertThreshold;if(r&&!lastChild(n)){var l=getRect(n),a=t>=l.left-r&&t<=l.right+r,i=e>=l.top-r&&e<=l.bottom+r;return a&&i?o=n:void 0}})),o},_prepareGroup=function(t){function e(t,o){return function(n,r,l,a){var i=n.options.group.name&&r.options.group.name&&n.options.group.name===r.options.group.name;if(null==t&&(o||i))return!0;if(null==t||!1===t)return!1;if(o&&"clone"===t)return t;if("function"==typeof t)return e(t(n,r,l,a),o)(n,r,l,a);var s=(o?n:r).options.group.name;return!0===t||"string"==typeof t&&t===s||t.join&&t.indexOf(s)>-1}}var o={},n=t.group;n&&"object"==_typeof(n)||(n={name:n}),o.name=n.name,o.checkPull=e(n.pull,!0),o.checkPut=e(n.put),o.revertClone=n.revertClone,t.group=o},_hideGhostForTarget=function(){!supportCssPointerEvents&&ghostEl&&css(ghostEl,"display","none")},_unhideGhostForTarget=function(){!supportCssPointerEvents&&ghostEl&&css(ghostEl,"display","")};documentExists&&!ChromeForAndroid&&document.addEventListener("click",(function(t){if(ignoreNextClick)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ignoreNextClick=!1,!1}),!0);var nearestEmptyInsertDetectEvent=function(t){if(dragEl){t=t.touches?t.touches[0]:t;var e=_detectNearestEmptySortable(t.clientX,t.clientY);if(e){var o={};for(var n in t)t.hasOwnProperty(n)&&(o[n]=t[n]);o.target=o.rootEl=e,o.preventDefault=void 0,o.stopPropagation=void 0,e[expando]._onDragOver(o)}}},_checkOutsideTargetEl=function(t){dragEl&&dragEl.parentNode[expando]._isOutsideThisEl(t.target)};function Sortable(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=_extends({},e),t[expando]=this;var o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return _detectDirection(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Sortable.supportPointer&&"PointerEvent"in window&&!Safari,emptyInsertThreshold:5};for(var n in PluginManager.initializePlugins(this,t,o),o)!(n in e)&&(e[n]=o[n]);for(var r in _prepareGroup(e),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!e.forceFallback&&supportDraggable,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?on(t,"pointerdown",this._onTapStart):(on(t,"mousedown",this._onTapStart),on(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(on(t,"dragover",this),on(t,"dragenter",this)),sortables.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),_extends(this,AnimationStateManager())}function _globalDragOver(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function _onMove(t,e,o,n,r,l,a,i){var s,c,d=t[expando],u=d.options.onMove;return!window.CustomEvent||IE11OrLess||Edge?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=o,s.draggedRect=n,s.related=r||e,s.relatedRect=l||getRect(e),s.willInsertAfter=i,s.originalEvent=a,t.dispatchEvent(s),u&&(c=u.call(d,s,a)),c}function _disableDraggable(t){t.draggable=!1}function _unsilent(){_silent=!1}function _ghostIsFirst(t,e,o){var n=getRect(getChild(o.el,0,o.options,!0));return e?t.clientX<n.left-10||t.clientY<n.top&&t.clientX<n.right:t.clientY<n.top-10||t.clientY<n.bottom&&t.clientX<n.left}function _ghostIsLast(t,e,o){var n=getRect(lastChild(o.el,o.options.draggable));return e?t.clientX>n.right+10||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+10}function _getSwapDirection(t,e,o,n,r,l,a,i){var s=n?t.clientY:t.clientX,c=n?o.height:o.width,d=n?o.top:o.left,u=n?o.bottom:o.right,g=!1;if(!a)if(i&&targetMoveDistance<c*r){if(!pastFirstInvertThresh&&(1===lastDirection?s>d+c*l/2:s<u-c*l/2)&&(pastFirstInvertThresh=!0),pastFirstInvertThresh)g=!0;else if(1===lastDirection?s<d+targetMoveDistance:s>u-targetMoveDistance)return-lastDirection}else if(s>d+c*(1-r)/2&&s<u-c*(1-r)/2)return _getInsertDirection(e);return(g=g||a)&&(s<d+c*l/2||s>u-c*l/2)?s>d+c/2?1:-1:0}function _getInsertDirection(t){return index(dragEl)<index(t)?1:-1}function _generateId(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,o=e.length,n=0;o--;)n+=e.charCodeAt(o);return n.toString(36)}function _saveInputCheckedState(t){savedInputChecked.length=0;for(var e=t.getElementsByTagName("input"),o=e.length;o--;){var n=e[o];n.checked&&savedInputChecked.push(n)}}function _nextTick(t){return setTimeout(t,0)}function _cancelNextTick(t){return clearTimeout(t)}Sortable.prototype={constructor:Sortable,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(lastTarget=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,dragEl):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,o=this.el,n=this.options,r=n.preventOnFilter,l=t.type,a=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,i=(a||t).target,s=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||i,c=n.filter;if(_saveInputCheckedState(o),!dragEl&&!(/mousedown|pointerdown/.test(l)&&0!==t.button||n.disabled)&&!s.isContentEditable&&(this.nativeDraggable||!Safari||!i||"SELECT"!==i.tagName.toUpperCase())&&!((i=closest(i,n.draggable,o,!1))&&i.animated||lastDownEl===i)){if(oldIndex=index(i),oldDraggableIndex=index(i,n.draggable),"function"==typeof c){if(c.call(this,t,i,this))return _dispatchEvent({sortable:e,rootEl:s,name:"filter",targetEl:i,toEl:o,fromEl:o}),pluginEvent("filter",e,{evt:t}),void(r&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(n){if(n=closest(s,n.trim(),o,!1))return _dispatchEvent({sortable:e,rootEl:n,name:"filter",targetEl:i,fromEl:o,toEl:o}),pluginEvent("filter",e,{evt:t}),!0}))))return void(r&&t.cancelable&&t.preventDefault());n.handle&&!closest(s,n.handle,o,!1)||this._prepareDragStart(t,a,i)}}},_prepareDragStart:function(t,e,o){var n,r=this,l=r.el,a=r.options,i=l.ownerDocument;if(o&&!dragEl&&o.parentNode===l){var s=getRect(o);if(rootEl=l,parentEl=(dragEl=o).parentNode,nextEl=dragEl.nextSibling,lastDownEl=o,activeGroup=a.group,Sortable.dragged=dragEl,tapEvt={target:dragEl,clientX:(e||t).clientX,clientY:(e||t).clientY},tapDistanceLeft=tapEvt.clientX-s.left,tapDistanceTop=tapEvt.clientY-s.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,dragEl.style["will-change"]="all",n=function(){pluginEvent("delayEnded",r,{evt:t}),Sortable.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!FireFox&&r.nativeDraggable&&(dragEl.draggable=!0),r._triggerDragStart(t,e),_dispatchEvent({sortable:r,name:"choose",originalEvent:t}),toggleClass(dragEl,a.chosenClass,!0))},a.ignore.split(",").forEach((function(t){find(dragEl,t.trim(),_disableDraggable)})),on(i,"dragover",nearestEmptyInsertDetectEvent),on(i,"mousemove",nearestEmptyInsertDetectEvent),on(i,"touchmove",nearestEmptyInsertDetectEvent),on(i,"mouseup",r._onDrop),on(i,"touchend",r._onDrop),on(i,"touchcancel",r._onDrop),FireFox&&this.nativeDraggable&&(this.options.touchStartThreshold=4,dragEl.draggable=!0),pluginEvent("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(Edge||IE11OrLess))n();else{if(Sortable.eventCanceled)return void this._onDrop();on(i,"mouseup",r._disableDelayedDrag),on(i,"touchend",r._disableDelayedDrag),on(i,"touchcancel",r._disableDelayedDrag),on(i,"mousemove",r._delayedDragTouchMoveHandler),on(i,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&on(i,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(n,a.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){dragEl&&_disableDraggable(dragEl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;off(t,"mouseup",this._disableDelayedDrag),off(t,"touchend",this._disableDelayedDrag),off(t,"touchcancel",this._disableDelayedDrag),off(t,"mousemove",this._delayedDragTouchMoveHandler),off(t,"touchmove",this._delayedDragTouchMoveHandler),off(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?on(document,"pointermove",this._onTouchMove):on(document,e?"touchmove":"mousemove",this._onTouchMove):(on(dragEl,"dragend",this),on(rootEl,"dragstart",this._onDragStart));try{document.selection?_nextTick((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(awaitingDragStarted=!1,rootEl&&dragEl){pluginEvent("dragStarted",this,{evt:e}),this.nativeDraggable&&on(document,"dragover",_checkOutsideTargetEl);var o=this.options;!t&&toggleClass(dragEl,o.dragClass,!1),toggleClass(dragEl,o.ghostClass,!0),Sortable.active=this,t&&this._appendGhost(),_dispatchEvent({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(touchEvt){this._lastX=touchEvt.clientX,this._lastY=touchEvt.clientY,_hideGhostForTarget();for(var t=document.elementFromPoint(touchEvt.clientX,touchEvt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(touchEvt.clientX,touchEvt.clientY))!==e;)e=t;if(dragEl.parentNode[expando]._isOutsideThisEl(t),e)do{if(e[expando]){if(e[expando]._onDragOver({clientX:touchEvt.clientX,clientY:touchEvt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);_unhideGhostForTarget()}},_onTouchMove:function(t){if(tapEvt){var e=this.options,o=e.fallbackTolerance,n=e.fallbackOffset,r=t.touches?t.touches[0]:t,l=ghostEl&&matrix(ghostEl,!0),a=ghostEl&&l&&l.a,i=ghostEl&&l&&l.d,s=PositionGhostAbsolutely&&ghostRelativeParent&&getRelativeScrollOffset(ghostRelativeParent),c=(r.clientX-tapEvt.clientX+n.x)/(a||1)+(s?s[0]-ghostRelativeParentInitialScroll[0]:0)/(a||1),d=(r.clientY-tapEvt.clientY+n.y)/(i||1)+(s?s[1]-ghostRelativeParentInitialScroll[1]:0)/(i||1);if(!Sortable.active&&!awaitingDragStarted){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<o)return;this._onDragStart(t,!0)}if(ghostEl){l?(l.e+=c-(lastDx||0),l.f+=d-(lastDy||0)):l={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(l.a,",").concat(l.b,",").concat(l.c,",").concat(l.d,",").concat(l.e,",").concat(l.f,")");css(ghostEl,"webkitTransform",u),css(ghostEl,"mozTransform",u),css(ghostEl,"msTransform",u),css(ghostEl,"transform",u),lastDx=c,lastDy=d,touchEvt=r}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!ghostEl){var t=this.options.fallbackOnBody?document.body:rootEl,e=getRect(dragEl,!0,PositionGhostAbsolutely,!0,t),o=this.options;if(PositionGhostAbsolutely){for(ghostRelativeParent=t;"static"===css(ghostRelativeParent,"position")&&"none"===css(ghostRelativeParent,"transform")&&ghostRelativeParent!==document;)ghostRelativeParent=ghostRelativeParent.parentNode;ghostRelativeParent!==document.body&&ghostRelativeParent!==document.documentElement?(ghostRelativeParent===document&&(ghostRelativeParent=getWindowScrollingElement()),e.top+=ghostRelativeParent.scrollTop,e.left+=ghostRelativeParent.scrollLeft):ghostRelativeParent=getWindowScrollingElement(),ghostRelativeParentInitialScroll=getRelativeScrollOffset(ghostRelativeParent)}toggleClass(ghostEl=dragEl.cloneNode(!0),o.ghostClass,!1),toggleClass(ghostEl,o.fallbackClass,!0),toggleClass(ghostEl,o.dragClass,!0),css(ghostEl,"transition",""),css(ghostEl,"transform",""),css(ghostEl,"box-sizing","border-box"),css(ghostEl,"margin",0),css(ghostEl,"top",e.top),css(ghostEl,"left",e.left),css(ghostEl,"width",e.width),css(ghostEl,"height",e.height),css(ghostEl,"opacity","0.8"),css(ghostEl,"position",PositionGhostAbsolutely?"absolute":"fixed"),css(ghostEl,"zIndex","100000"),css(ghostEl,"pointerEvents","none"),Sortable.ghost=ghostEl,t.appendChild(ghostEl),css(ghostEl,"transform-origin",tapDistanceLeft/parseInt(ghostEl.style.width)*100+"% "+tapDistanceTop/parseInt(ghostEl.style.height)*100+"%")}},_onDragStart:function(t,e){var o=this,n=t.dataTransfer,r=o.options;pluginEvent("dragStart",this,{evt:t}),Sortable.eventCanceled?this._onDrop():(pluginEvent("setupClone",this),Sortable.eventCanceled||((cloneEl=clone(dragEl)).removeAttribute("id"),cloneEl.draggable=!1,cloneEl.style["will-change"]="",this._hideClone(),toggleClass(cloneEl,this.options.chosenClass,!1),Sortable.clone=cloneEl),o.cloneId=_nextTick((function(){pluginEvent("clone",o),Sortable.eventCanceled||(o.options.removeCloneOnHide||rootEl.insertBefore(cloneEl,dragEl),o._hideClone(),_dispatchEvent({sortable:o,name:"clone"}))})),!e&&toggleClass(dragEl,r.dragClass,!0),e?(ignoreNextClick=!0,o._loopId=setInterval(o._emulateDragOver,50)):(off(document,"mouseup",o._onDrop),off(document,"touchend",o._onDrop),off(document,"touchcancel",o._onDrop),n&&(n.effectAllowed="move",r.setData&&r.setData.call(o,n,dragEl)),on(document,"drop",o),css(dragEl,"transform","translateZ(0)")),awaitingDragStarted=!0,o._dragStartId=_nextTick(o._dragStarted.bind(o,e,t)),on(document,"selectstart",o),moved=!0,Safari&&css(document.body,"user-select","none"))},_onDragOver:function(t){var e,o,n,r,l=this.el,a=t.target,i=this.options,s=i.group,c=Sortable.active,d=activeGroup===s,u=i.sort,g=putSortable||c,h=this,p=!1;if(!_silent){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),a=closest(a,i.draggable,l,!0),A("dragOver"),Sortable.eventCanceled)return p;if(dragEl.contains(t.target)||a.animated&&a.animatingX&&a.animatingY||h._ignoreWhileAnimating===a)return M(!1);if(ignoreNextClick=!1,c&&!i.disabled&&(d?u||(n=parentEl!==rootEl):putSortable===this||(this.lastPutMode=activeGroup.checkPull(this,c,dragEl,t))&&s.checkPut(this,c,dragEl,t))){if(r="vertical"===this._getDirection(t,a),e=getRect(dragEl),A("dragOverValid"),Sortable.eventCanceled)return p;if(n)return parentEl=rootEl,P(),this._hideClone(),A("revert"),Sortable.eventCanceled||(nextEl?rootEl.insertBefore(dragEl,nextEl):rootEl.appendChild(dragEl)),M(!0);var f=lastChild(l,i.draggable);if(!f||_ghostIsLast(t,r,this)&&!f.animated){if(f===dragEl)return M(!1);if(f&&l===t.target&&(a=f),a&&(o=getRect(a)),!1!==_onMove(rootEl,l,dragEl,e,a,o,t,!!a))return P(),f&&f.nextSibling?l.insertBefore(dragEl,f.nextSibling):l.appendChild(dragEl),parentEl=l,R(),M(!0)}else if(f&&_ghostIsFirst(t,r,this)){var m=getChild(l,0,i,!0);if(m===dragEl)return M(!1);if(o=getRect(a=m),!1!==_onMove(rootEl,l,dragEl,e,a,o,t,!1))return P(),l.insertBefore(dragEl,m),parentEl=l,R(),M(!0)}else if(a.parentNode===l){o=getRect(a);var v,E,b,S=dragEl.parentNode!==l,D=!_dragElInRowColumn(dragEl.animated&&dragEl.toRect||e,a.animated&&a.toRect||o,r),w=r?"top":"left",_=isScrolledPast(a,"top","top")||isScrolledPast(dragEl,"top","top"),y=_?_.scrollTop:void 0;if(lastTarget!==a&&(E=o[w],pastFirstInvertThresh=!1,isCircumstantialInvert=!D&&i.invertSwap||S),0!==(v=_getSwapDirection(t,a,o,r,D?1:i.swapThreshold,null==i.invertedSwapThreshold?i.swapThreshold:i.invertedSwapThreshold,isCircumstantialInvert,lastTarget===a))){var x=index(dragEl);do{x-=v,b=parentEl.children[x]}while(b&&("none"===css(b,"display")||b===ghostEl))}if(0===v||b===a)return M(!1);lastTarget=a,lastDirection=v;var C=a.nextElementSibling,I=!1,T=_onMove(rootEl,l,dragEl,e,a,o,t,I=1===v);if(!1!==T)return 1!==T&&-1!==T||(I=1===T),_silent=!0,setTimeout(_unsilent,30),P(),I&&!C?l.appendChild(dragEl):a.parentNode.insertBefore(dragEl,I?C:a),_&&scrollBy(_,0,y-_.scrollTop),parentEl=dragEl.parentNode,void 0===E||isCircumstantialInvert||(targetMoveDistance=Math.abs(E-getRect(a)[w])),R(),M(!0)}if(l.contains(dragEl))return M(!1)}return!1}function A(i,s){pluginEvent(i,h,_objectSpread2({evt:t,isOwner:d,axis:r?"vertical":"horizontal",revert:n,dragRect:e,targetRect:o,canSort:u,fromSortable:g,target:a,completed:M,onMove:function(o,n){return _onMove(rootEl,l,dragEl,e,o,getRect(o),t,n)},changed:R},s))}function P(){A("dragOverAnimationCapture"),h.captureAnimationState(),h!==g&&g.captureAnimationState()}function M(e){return A("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(h),h!==g&&(toggleClass(dragEl,putSortable?putSortable.options.ghostClass:c.options.ghostClass,!1),toggleClass(dragEl,i.ghostClass,!0)),putSortable!==h&&h!==Sortable.active?putSortable=h:h===Sortable.active&&putSortable&&(putSortable=null),g===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){A("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==g&&(g.animateAll(),g._ignoreWhileAnimating=null)),(a===dragEl&&!dragEl.animated||a===l&&!a.animated)&&(lastTarget=null),i.dragoverBubble||t.rootEl||a===document||(dragEl.parentNode[expando]._isOutsideThisEl(t.target),!e&&nearestEmptyInsertDetectEvent(t)),!i.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),p=!0}function R(){newIndex=index(dragEl),newDraggableIndex=index(dragEl,i.draggable),_dispatchEvent({sortable:h,name:"change",toEl:l,newIndex,newDraggableIndex,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){off(document,"mousemove",this._onTouchMove),off(document,"touchmove",this._onTouchMove),off(document,"pointermove",this._onTouchMove),off(document,"dragover",nearestEmptyInsertDetectEvent),off(document,"mousemove",nearestEmptyInsertDetectEvent),off(document,"touchmove",nearestEmptyInsertDetectEvent)},_offUpEvents:function(){var t=this.el.ownerDocument;off(t,"mouseup",this._onDrop),off(t,"touchend",this._onDrop),off(t,"pointerup",this._onDrop),off(t,"touchcancel",this._onDrop),off(document,"selectstart",this)},_onDrop:function(t){var e=this.el,o=this.options;newIndex=index(dragEl),newDraggableIndex=index(dragEl,o.draggable),pluginEvent("drop",this,{evt:t}),parentEl=dragEl&&dragEl.parentNode,newIndex=index(dragEl),newDraggableIndex=index(dragEl,o.draggable),Sortable.eventCanceled||(awaitingDragStarted=!1,isCircumstantialInvert=!1,pastFirstInvertThresh=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),_cancelNextTick(this.cloneId),_cancelNextTick(this._dragStartId),this.nativeDraggable&&(off(document,"drop",this),off(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Safari&&css(document.body,"user-select",""),css(dragEl,"transform",""),t&&(moved&&(t.cancelable&&t.preventDefault(),!o.dropBubble&&t.stopPropagation()),ghostEl&&ghostEl.parentNode&&ghostEl.parentNode.removeChild(ghostEl),(rootEl===parentEl||putSortable&&"clone"!==putSortable.lastPutMode)&&cloneEl&&cloneEl.parentNode&&cloneEl.parentNode.removeChild(cloneEl),dragEl&&(this.nativeDraggable&&off(dragEl,"dragend",this),_disableDraggable(dragEl),dragEl.style["will-change"]="",moved&&!awaitingDragStarted&&toggleClass(dragEl,putSortable?putSortable.options.ghostClass:this.options.ghostClass,!1),toggleClass(dragEl,this.options.chosenClass,!1),_dispatchEvent({sortable:this,name:"unchoose",toEl:parentEl,newIndex:null,newDraggableIndex:null,originalEvent:t}),rootEl!==parentEl?(newIndex>=0&&(_dispatchEvent({rootEl:parentEl,name:"add",toEl:parentEl,fromEl:rootEl,originalEvent:t}),_dispatchEvent({sortable:this,name:"remove",toEl:parentEl,originalEvent:t}),_dispatchEvent({rootEl:parentEl,name:"sort",toEl:parentEl,fromEl:rootEl,originalEvent:t}),_dispatchEvent({sortable:this,name:"sort",toEl:parentEl,originalEvent:t})),putSortable&&putSortable.save()):newIndex!==oldIndex&&newIndex>=0&&(_dispatchEvent({sortable:this,name:"update",toEl:parentEl,originalEvent:t}),_dispatchEvent({sortable:this,name:"sort",toEl:parentEl,originalEvent:t})),Sortable.active&&(null!=newIndex&&-1!==newIndex||(newIndex=oldIndex,newDraggableIndex=oldDraggableIndex),_dispatchEvent({sortable:this,name:"end",toEl:parentEl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){pluginEvent("nulling",this),rootEl=dragEl=parentEl=ghostEl=nextEl=cloneEl=lastDownEl=cloneHidden=tapEvt=touchEvt=moved=newIndex=newDraggableIndex=oldIndex=oldDraggableIndex=lastTarget=lastDirection=putSortable=activeGroup=Sortable.dragged=Sortable.ghost=Sortable.clone=Sortable.active=null,savedInputChecked.forEach((function(t){t.checked=!0})),savedInputChecked.length=lastDx=lastDy=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":dragEl&&(this._onDragOver(t),_globalDragOver(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],o=this.el.children,n=0,r=o.length,l=this.options;n<r;n++)closest(t=o[n],l.draggable,this.el,!1)&&e.push(t.getAttribute(l.dataIdAttr)||_generateId(t));return e},sort:function(t,e){var o={},n=this.el;this.toArray().forEach((function(t,e){var r=n.children[e];closest(r,this.options.draggable,n,!1)&&(o[t]=r)}),this),e&&this.captureAnimationState(),t.forEach((function(t){o[t]&&(n.removeChild(o[t]),n.appendChild(o[t]))})),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return closest(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var o=this.options;if(void 0===e)return o[t];var n=PluginManager.modifyOption(this,t,e);o[t]=void 0!==n?n:e,"group"===t&&_prepareGroup(o)},destroy:function(){pluginEvent("destroy",this);var t=this.el;t[expando]=null,off(t,"mousedown",this._onTapStart),off(t,"touchstart",this._onTapStart),off(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(off(t,"dragover",this),off(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),sortables.splice(sortables.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!cloneHidden){if(pluginEvent("hideClone",this),Sortable.eventCanceled)return;css(cloneEl,"display","none"),this.options.removeCloneOnHide&&cloneEl.parentNode&&cloneEl.parentNode.removeChild(cloneEl),cloneHidden=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(cloneHidden){if(pluginEvent("showClone",this),Sortable.eventCanceled)return;dragEl.parentNode!=rootEl||this.options.group.revertClone?nextEl?rootEl.insertBefore(cloneEl,nextEl):rootEl.appendChild(cloneEl):rootEl.insertBefore(cloneEl,dragEl),this.options.group.revertClone&&this.animate(dragEl,cloneEl),css(cloneEl,"display",""),cloneHidden=!1}}else this._hideClone()}},documentExists&&on(document,"touchmove",(function(t){(Sortable.active||awaitingDragStarted)&&t.cancelable&&t.preventDefault()})),Sortable.utils={on,off,css,find,is:function(t,e){return!!closest(t,e,t,!1)},extend,throttle,closest,toggleClass,clone,index,nextTick:_nextTick,cancelNextTick:_cancelNextTick,detectDirection:_detectDirection,getChild},Sortable.get=function(t){return t[expando]},Sortable.mount=function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(Sortable.utils=_objectSpread2(_objectSpread2({},Sortable.utils),t.utils)),PluginManager.mount(t)}))},Sortable.create=function(t,e){return new Sortable(t,e)},Sortable.version=version;var scrollEl,scrollRootEl,lastAutoScrollX,lastAutoScrollY,touchEvt$1,pointerElemChangedInterval,autoScrolls=[],scrolling=!1;function AutoScrollPlugin(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?on(document,"dragover",this._handleAutoScroll):this.options.supportPointer?on(document,"pointermove",this._handleFallbackAutoScroll):e.touches?on(document,"touchmove",this._handleFallbackAutoScroll):on(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?off(document,"dragover",this._handleAutoScroll):(off(document,"pointermove",this._handleFallbackAutoScroll),off(document,"touchmove",this._handleFallbackAutoScroll),off(document,"mousemove",this._handleFallbackAutoScroll)),clearPointerElemChangedInterval(),clearAutoScrolls(),cancelThrottle()},nulling:function(){touchEvt$1=scrollRootEl=scrollEl=scrolling=pointerElemChangedInterval=lastAutoScrollX=lastAutoScrollY=null,autoScrolls.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var o=this,n=(t.touches?t.touches[0]:t).clientX,r=(t.touches?t.touches[0]:t).clientY,l=document.elementFromPoint(n,r);if(touchEvt$1=t,e||this.options.forceAutoScrollFallback||Edge||IE11OrLess||Safari){autoScroll(t,this.options,l,e);var a=getParentAutoScrollElement(l,!0);!scrolling||pointerElemChangedInterval&&n===lastAutoScrollX&&r===lastAutoScrollY||(pointerElemChangedInterval&&clearPointerElemChangedInterval(),pointerElemChangedInterval=setInterval((function(){var l=getParentAutoScrollElement(document.elementFromPoint(n,r),!0);l!==a&&(a=l,clearAutoScrolls()),autoScroll(t,o.options,l,e)}),10),lastAutoScrollX=n,lastAutoScrollY=r)}else{if(!this.options.bubbleScroll||getParentAutoScrollElement(l,!0)===getWindowScrollingElement())return void clearAutoScrolls();autoScroll(t,this.options,getParentAutoScrollElement(l,!1),!1)}}},_extends(t,{pluginName:"scroll",initializeByDefault:!0})}function clearAutoScrolls(){autoScrolls.forEach((function(t){clearInterval(t.pid)})),autoScrolls=[]}function clearPointerElemChangedInterval(){clearInterval(pointerElemChangedInterval)}var lastSwapEl,autoScroll=throttle((function(t,e,o,n){if(e.scroll){var r,l=(t.touches?t.touches[0]:t).clientX,a=(t.touches?t.touches[0]:t).clientY,i=e.scrollSensitivity,s=e.scrollSpeed,c=getWindowScrollingElement(),d=!1;scrollRootEl!==o&&(scrollRootEl=o,clearAutoScrolls(),scrollEl=e.scroll,r=e.scrollFn,!0===scrollEl&&(scrollEl=getParentAutoScrollElement(o,!0)));var u=0,g=scrollEl;do{var h=g,p=getRect(h),f=p.top,m=p.bottom,v=p.left,E=p.right,b=p.width,S=p.height,D=void 0,w=void 0,_=h.scrollWidth,y=h.scrollHeight,x=css(h),C=h.scrollLeft,I=h.scrollTop;h===c?(D=b<_&&("auto"===x.overflowX||"scroll"===x.overflowX||"visible"===x.overflowX),w=S<y&&("auto"===x.overflowY||"scroll"===x.overflowY||"visible"===x.overflowY)):(D=b<_&&("auto"===x.overflowX||"scroll"===x.overflowX),w=S<y&&("auto"===x.overflowY||"scroll"===x.overflowY));var T=D&&(Math.abs(E-l)<=i&&C+b<_)-(Math.abs(v-l)<=i&&!!C),A=w&&(Math.abs(m-a)<=i&&I+S<y)-(Math.abs(f-a)<=i&&!!I);if(!autoScrolls[u])for(var P=0;P<=u;P++)autoScrolls[P]||(autoScrolls[P]={});autoScrolls[u].vx==T&&autoScrolls[u].vy==A&&autoScrolls[u].el===h||(autoScrolls[u].el=h,autoScrolls[u].vx=T,autoScrolls[u].vy=A,clearInterval(autoScrolls[u].pid),0==T&&0==A||(d=!0,autoScrolls[u].pid=setInterval(function(){n&&0===this.layer&&Sortable.active._onTouchMove(touchEvt$1);var e=autoScrolls[this.layer].vy?autoScrolls[this.layer].vy*s:0,o=autoScrolls[this.layer].vx?autoScrolls[this.layer].vx*s:0;"function"==typeof r&&"continue"!==r.call(Sortable.dragged.parentNode[expando],o,e,t,touchEvt$1,autoScrolls[this.layer].el)||scrollBy(autoScrolls[this.layer].el,o,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&g!==c&&(g=getParentAutoScrollElement(g,!1)));scrolling=d}}),30),drop=function(t){var e=t.originalEvent,o=t.putSortable,n=t.dragEl,r=t.activeSortable,l=t.dispatchSortableEvent,a=t.hideGhostForTarget,i=t.unhideGhostForTarget;if(e){var s=o||r;a();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);i(),s&&!s.el.contains(d)&&(l("spill"),this.onSpill({dragEl:n,putSortable:o}))}};function Revert(){}function Remove(){}function SwapPlugin(){function t(){this.defaults={swapClass:"sortable-swap-highlight"}}return t.prototype={dragStart:function(t){var e=t.dragEl;lastSwapEl=e},dragOverValid:function(t){var e=t.completed,o=t.target,n=t.onMove,r=t.activeSortable,l=t.changed,a=t.cancel;if(r.options.swap){var i=this.sortable.el,s=this.options;if(o&&o!==i){var c=lastSwapEl;!1!==n(o)?(toggleClass(o,s.swapClass,!0),lastSwapEl=o):lastSwapEl=null,c&&c!==lastSwapEl&&toggleClass(c,s.swapClass,!1)}l(),e(!0),a()}},drop:function(t){var e=t.activeSortable,o=t.putSortable,n=t.dragEl,r=o||this.sortable,l=this.options;lastSwapEl&&toggleClass(lastSwapEl,l.swapClass,!1),lastSwapEl&&(l.swap||o&&o.options.swap)&&n!==lastSwapEl&&(r.captureAnimationState(),r!==e&&e.captureAnimationState(),swapNodes(n,lastSwapEl),r.animateAll(),r!==e&&e.animateAll())},nulling:function(){lastSwapEl=null}},_extends(t,{pluginName:"swap",eventProperties:function(){return{swapItem:lastSwapEl}}})}function swapNodes(t,e){var o,n,r=t.parentNode,l=e.parentNode;r&&l&&!r.isEqualNode(e)&&!l.isEqualNode(t)&&(o=index(t),n=index(e),r.isEqualNode(l)&&o<n&&n++,r.insertBefore(e,r.children[o]),l.insertBefore(t,l.children[n]))}Revert.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,o=t.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var n=getChild(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(e,n):this.sortable.el.appendChild(e),this.sortable.animateAll(),o&&o.animateAll()},drop},_extends(Revert,{pluginName:"revertOnSpill"}),Remove.prototype={onSpill:function(t){var e=t.dragEl,o=t.putSortable||this.sortable;o.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),o.animateAll()},drop},_extends(Remove,{pluginName:"removeOnSpill"});var lastMultiDragSelect,multiDragSortable,dragEl$1,clonesFromRect,clonesHidden,multiDragElements=[],multiDragClones=[],initialFolding=!1,folding=!1,dragStarted=!1;function MultiDragPlugin(){function t(t){for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));t.options.avoidImplicitDeselect||(t.options.supportPointer?on(document,"pointerup",this._deselectMultiDrag):(on(document,"mouseup",this._deselectMultiDrag),on(document,"touchend",this._deselectMultiDrag))),on(document,"keydown",this._checkKeyDown),on(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:!1,setData:function(e,o){var n="";multiDragElements.length&&multiDragSortable===t?multiDragElements.forEach((function(t,e){n+=(e?", ":"")+t.textContent})):n=o.textContent,e.setData("Text",n)}}}return t.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal:function(t){var e=t.dragEl;dragEl$1=e},delayEnded:function(){this.isMultiDrag=~multiDragElements.indexOf(dragEl$1)},setupClone:function(t){var e=t.sortable,o=t.cancel;if(this.isMultiDrag){for(var n=0;n<multiDragElements.length;n++)multiDragClones.push(clone(multiDragElements[n])),multiDragClones[n].sortableIndex=multiDragElements[n].sortableIndex,multiDragClones[n].draggable=!1,multiDragClones[n].style["will-change"]="",toggleClass(multiDragClones[n],this.options.selectedClass,!1),multiDragElements[n]===dragEl$1&&toggleClass(multiDragClones[n],this.options.chosenClass,!1);e._hideClone(),o()}},clone:function(t){var e=t.sortable,o=t.rootEl,n=t.dispatchSortableEvent,r=t.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||multiDragElements.length&&multiDragSortable===e&&(insertMultiDragClones(!0,o),n("clone"),r()))},showClone:function(t){var e=t.cloneNowShown,o=t.rootEl,n=t.cancel;this.isMultiDrag&&(insertMultiDragClones(!1,o),multiDragClones.forEach((function(t){css(t,"display","")})),e(),clonesHidden=!1,n())},hideClone:function(t){var e=this,o=(t.sortable,t.cloneNowHidden),n=t.cancel;this.isMultiDrag&&(multiDragClones.forEach((function(t){css(t,"display","none"),e.options.removeCloneOnHide&&t.parentNode&&t.parentNode.removeChild(t)})),o(),clonesHidden=!0,n())},dragStartGlobal:function(t){t.sortable;!this.isMultiDrag&&multiDragSortable&&multiDragSortable.multiDrag._deselectMultiDrag(),multiDragElements.forEach((function(t){t.sortableIndex=index(t)})),multiDragElements=multiDragElements.sort((function(t,e){return t.sortableIndex-e.sortableIndex})),dragStarted=!0},dragStarted:function(t){var e=this,o=t.sortable;if(this.isMultiDrag){if(this.options.sort&&(o.captureAnimationState(),this.options.animation)){multiDragElements.forEach((function(t){t!==dragEl$1&&css(t,"position","absolute")}));var n=getRect(dragEl$1,!1,!0,!0);multiDragElements.forEach((function(t){t!==dragEl$1&&setRect(t,n)})),folding=!0,initialFolding=!0}o.animateAll((function(){folding=!1,initialFolding=!1,e.options.animation&&multiDragElements.forEach((function(t){unsetRect(t)})),e.options.sort&&removeMultiDragElements()}))}},dragOver:function(t){var e=t.target,o=t.completed,n=t.cancel;folding&&~multiDragElements.indexOf(e)&&(o(!1),n())},revert:function(t){var e=t.fromSortable,o=t.rootEl,n=t.sortable,r=t.dragRect;multiDragElements.length>1&&(multiDragElements.forEach((function(t){n.addAnimationState({target:t,rect:folding?getRect(t):r}),unsetRect(t),t.fromRect=r,e.removeAnimationState(t)})),folding=!1,insertMultiDragElements(!this.options.removeCloneOnHide,o))},dragOverCompleted:function(t){var e=t.sortable,o=t.isOwner,n=t.insertion,r=t.activeSortable,l=t.parentEl,a=t.putSortable,i=this.options;if(n){if(o&&r._hideClone(),initialFolding=!1,i.animation&&multiDragElements.length>1&&(folding||!o&&!r.options.sort&&!a)){var s=getRect(dragEl$1,!1,!0,!0);multiDragElements.forEach((function(t){t!==dragEl$1&&(setRect(t,s),l.appendChild(t))})),folding=!0}if(!o)if(folding||removeMultiDragElements(),multiDragElements.length>1){var c=clonesHidden;r._showClone(e),r.options.animation&&!clonesHidden&&c&&multiDragClones.forEach((function(t){r.addAnimationState({target:t,rect:clonesFromRect}),t.fromRect=clonesFromRect,t.thisAnimationDuration=null}))}else r._showClone(e)}},dragOverAnimationCapture:function(t){var e=t.dragRect,o=t.isOwner,n=t.activeSortable;if(multiDragElements.forEach((function(t){t.thisAnimationDuration=null})),n.options.animation&&!o&&n.multiDrag.isMultiDrag){clonesFromRect=_extends({},e);var r=matrix(dragEl$1,!0);clonesFromRect.top-=r.f,clonesFromRect.left-=r.e}},dragOverAnimationComplete:function(){folding&&(folding=!1,removeMultiDragElements())},drop:function(t){var e=t.originalEvent,o=t.rootEl,n=t.parentEl,r=t.sortable,l=t.dispatchSortableEvent,a=t.oldIndex,i=t.putSortable,s=i||this.sortable;if(e){var c=this.options,d=n.children;if(!dragStarted)if(c.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),toggleClass(dragEl$1,c.selectedClass,!~multiDragElements.indexOf(dragEl$1)),~multiDragElements.indexOf(dragEl$1))multiDragElements.splice(multiDragElements.indexOf(dragEl$1),1),lastMultiDragSelect=null,dispatchEvent({sortable:r,rootEl:o,name:"deselect",targetEl:dragEl$1,originalEvent:e});else{if(multiDragElements.push(dragEl$1),dispatchEvent({sortable:r,rootEl:o,name:"select",targetEl:dragEl$1,originalEvent:e}),e.shiftKey&&lastMultiDragSelect&&r.el.contains(lastMultiDragSelect)){var u,g,h=index(lastMultiDragSelect),p=index(dragEl$1);if(~h&&~p&&h!==p)for(p>h?(g=h,u=p):(g=p,u=h+1);g<u;g++)~multiDragElements.indexOf(d[g])||(toggleClass(d[g],c.selectedClass,!0),multiDragElements.push(d[g]),dispatchEvent({sortable:r,rootEl:o,name:"select",targetEl:d[g],originalEvent:e}))}else lastMultiDragSelect=dragEl$1;multiDragSortable=s}if(dragStarted&&this.isMultiDrag){if(folding=!1,(n[expando].options.sort||n!==o)&&multiDragElements.length>1){var f=getRect(dragEl$1),m=index(dragEl$1,":not(."+this.options.selectedClass+")");if(!initialFolding&&c.animation&&(dragEl$1.thisAnimationDuration=null),s.captureAnimationState(),!initialFolding&&(c.animation&&(dragEl$1.fromRect=f,multiDragElements.forEach((function(t){if(t.thisAnimationDuration=null,t!==dragEl$1){var e=folding?getRect(t):f;t.fromRect=e,s.addAnimationState({target:t,rect:e})}}))),removeMultiDragElements(),multiDragElements.forEach((function(t){d[m]?n.insertBefore(t,d[m]):n.appendChild(t),m++})),a===index(dragEl$1))){var v=!1;multiDragElements.forEach((function(t){t.sortableIndex===index(t)||(v=!0)})),v&&l("update")}multiDragElements.forEach((function(t){unsetRect(t)})),s.animateAll()}multiDragSortable=s}(o===n||i&&"clone"!==i.lastPutMode)&&multiDragClones.forEach((function(t){t.parentNode&&t.parentNode.removeChild(t)}))}},nullingGlobal:function(){this.isMultiDrag=dragStarted=!1,multiDragClones.length=0},destroyGlobal:function(){this._deselectMultiDrag(),off(document,"pointerup",this._deselectMultiDrag),off(document,"mouseup",this._deselectMultiDrag),off(document,"touchend",this._deselectMultiDrag),off(document,"keydown",this._checkKeyDown),off(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(t){if(!(void 0!==dragStarted&&dragStarted||multiDragSortable!==this.sortable||t&&closest(t.target,this.options.draggable,this.sortable.el,!1)||t&&0!==t.button))for(;multiDragElements.length;){var e=multiDragElements[0];toggleClass(e,this.options.selectedClass,!1),multiDragElements.shift(),dispatchEvent({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:e,originalEvent:t})}},_checkKeyDown:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},_extends(t,{pluginName:"multiDrag",utils:{select:function(t){var e=t.parentNode[expando];e&&e.options.multiDrag&&!~multiDragElements.indexOf(t)&&(multiDragSortable&&multiDragSortable!==e&&(multiDragSortable.multiDrag._deselectMultiDrag(),multiDragSortable=e),toggleClass(t,e.options.selectedClass,!0),multiDragElements.push(t))},deselect:function(t){var e=t.parentNode[expando],o=multiDragElements.indexOf(t);e&&e.options.multiDrag&&~o&&(toggleClass(t,e.options.selectedClass,!1),multiDragElements.splice(o,1))}},eventProperties:function(){var t=this,e=[],o=[];return multiDragElements.forEach((function(n){var r;e.push({multiDragElement:n,index:n.sortableIndex}),r=folding&&n!==dragEl$1?-1:folding?index(n,":not(."+t.options.selectedClass+")"):index(n),o.push({multiDragElement:n,index:r})})),{items:_toConsumableArray(multiDragElements),clones:[].concat(multiDragClones),oldIndicies:e,newIndicies:o}},optionListeners:{multiDragKey:function(t){return"ctrl"===(t=t.toLowerCase())?t="Control":t.length>1&&(t=t.charAt(0).toUpperCase()+t.substr(1)),t}}})}function insertMultiDragElements(t,e){multiDragElements.forEach((function(o,n){var r=e.children[o.sortableIndex+(t?Number(n):0)];r?e.insertBefore(o,r):e.appendChild(o)}))}function insertMultiDragClones(t,e){multiDragClones.forEach((function(o,n){var r=e.children[o.sortableIndex+(t?Number(n):0)];r?e.insertBefore(o,r):e.appendChild(o)}))}function removeMultiDragElements(){multiDragElements.forEach((function(t){t!==dragEl$1&&t.parentNode&&t.parentNode.removeChild(t)}))}Sortable.mount(new AutoScrollPlugin),Sortable.mount(Remove,Revert),Sortable.mount(new SwapPlugin),Sortable.mount(new MultiDragPlugin);export default Sortable; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/Contrib/muuri.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/Contrib/muuri.js index 9897b1f38b50005873714d5d8db85ab1e8c55945..c187d5b09d7035d19899934c0a50769c00e46bf6 100644 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/Contrib/muuri.js +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/Contrib/muuri.js @@ -1,7 +1,7 @@ export default (new function() { const module = { exports: {} }, exports = module.exports, define = null; /** -* Muuri v0.9.3 +* Muuri v0.9.5 * https://muuri.dev/ * Copyright (c) 2015-present, Haltu Oy * Released under the MIT license @@ -20,6 +20,6 @@ export default (new function() { * Copyright (c) 2019-present, Niklas Rämö <inramo@gmail.com> * @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Muuri=e()}(this,(function(){"use strict";var t={},e="function"==typeof Map?new Map:null,i="ontouchstart"in window,s=!!window.PointerEvent,n=!!window.navigator.msPointerEnabled;function r(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}r.prototype.on=function(t,e){if(!this._events||!t||!e)return this;var i=this._events[t];return i||(i=this._events[t]=[]),i.push(e),this},r.prototype.off=function(t,e){if(!this._events||!t||!e)return this;var i,s=this._events[t];if(!s||!s.length)return this;for(;-1!==(i=s.indexOf(e));)s.splice(i,1);return this},r.prototype.clear=function(t){if(!this._events||!t)return this;var e=this._events[t];return e&&(e.length=0,delete this._events[t]),this},r.prototype.emit=function(t){if(!this._events||!t)return this._clearOnEmit=!1,this;var e=this._events[t];if(!e||!e.length)return this._clearOnEmit=!1,this;var i,s=this._queue,n=s.length,r=arguments.length-1;r>3&&((i=[]).push.apply(i,arguments),i.shift()),s.push.apply(s,e),this._clearOnEmit&&(e.length=0,this._clearOnEmit=!1),++this._counter;for(var o=n,h=s.length;o<h;o++)if(0===r?s[o]():1===r?s[o](arguments[1]):2===r?s[o](arguments[1],arguments[2]):3===r?s[o](arguments[1],arguments[2],arguments[3]):s[o].apply(null,i),!this._events)return this;return--this._counter,this._counter||(s.length=0),this},r.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},r.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},r.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var o=s?"pointerout":n?"MSPointerOut":"";function h(t){o&&(this._dragger=t,this._timeout=null,this._outEvent=null,this._isActive=!1,this._addBehaviour=this._addBehaviour.bind(this),this._removeBehaviour=this._removeBehaviour.bind(this),this._onTimeout=this._onTimeout.bind(this),this._resetData=this._resetData.bind(this),this._onStart=this._onStart.bind(this),this._onOut=this._onOut.bind(this),this._dragger.on("start",this._onStart))}h.prototype._addBehaviour=function(){this._isActive||(this._isActive=!0,this._dragger.on("move",this._resetData),this._dragger.on("cancel",this._removeBehaviour),this._dragger.on("end",this._removeBehaviour),window.addEventListener(o,this._onOut))},h.prototype._removeBehaviour=function(){this._isActive&&(this._dragger.off("move",this._resetData),this._dragger.off("cancel",this._removeBehaviour),this._dragger.off("end",this._removeBehaviour),window.removeEventListener(o,this._onOut),this._resetData(),this._isActive=!1)},h.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},h.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},h.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},h.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},h.prototype.destroy=function(){o&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var a=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],l={};function _(t,e){var i=l[e]||"";if(i)return i;for(var s=e[0].toUpperCase()+e.slice(1),n=0;n<a.length;){if((i=a[n]?a[n]+s:e)in t)return l[e]=i,i;++n}return""}function d(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t}var u=window.navigator.userAgent.toLowerCase(),c=u.indexOf("edge")>-1,f=u.indexOf("trident")>-1,p=u.indexOf("firefox")>-1,m=u.indexOf("android")>-1,g=!!d()&&{passive:!0},v=_(document.documentElement.style,"touchAction");function y(t,e){this._element=t,this._emitter=new r,this._isDestroyed=!1,this._cssProps={},this._touchAction="",this._isActive=!1,this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),this._edgeHack=null,(c||f)&&(s||n)&&(this._edgeHack=new h(this)),this.setCssProps(e),this._touchAction||this.setTouchAction("auto"),t.addEventListener("dragstart",y._preventDefault,!1),t.addEventListener(y._inputEvents.start,this._onStart,g)}y._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},y._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},y._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},y._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},y._inputEvents=i?y._touchEvents:s?y._pointerEvents:n?y._msPointerEvents:y._mouseEvents,y._emitter=new r,y._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},y._activeInstances=[],y._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},y._activateInstance=function(t){y._activeInstances.indexOf(t)>-1||(y._activeInstances.push(t),y._emitter.on(y._emitterEvents.move,t._onMove),y._emitter.on(y._emitterEvents.cancel,t._onCancel),y._emitter.on(y._emitterEvents.end,t._onEnd),1===y._activeInstances.length&&y._bindListeners())},y._deactivateInstance=function(t){var e=y._activeInstances.indexOf(t);-1!==e&&(y._activeInstances.splice(e,1),y._emitter.off(y._emitterEvents.move,t._onMove),y._emitter.off(y._emitterEvents.cancel,t._onCancel),y._emitter.off(y._emitterEvents.end,t._onEnd),y._activeInstances.length||y._unbindListeners())},y._bindListeners=function(){window.addEventListener(y._inputEvents.move,y._onMove,g),window.addEventListener(y._inputEvents.end,y._onEnd,g),y._inputEvents.cancel&&window.addEventListener(y._inputEvents.cancel,y._onCancel,g)},y._unbindListeners=function(){window.removeEventListener(y._inputEvents.move,y._onMove,g),window.removeEventListener(y._inputEvents.end,y._onEnd,g),y._inputEvents.cancel&&window.removeEventListener(y._inputEvents.cancel,y._onCancel,g)},y._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},y._getTouchById=function(t,e){if("number"==typeof t.pointerId)return t.pointerId===e?t:null;if(t.changedTouches){for(var i=0;i<t.changedTouches.length;i++)if(t.changedTouches[i].identifier===e)return t.changedTouches[i];return null}return t},y._onMove=function(t){y._emitter.emit(y._emitterEvents.move,t)},y._onCancel=function(t){y._emitter.emit(y._emitterEvents.cancel,t)},y._onEnd=function(t){y._emitter.emit(y._emitterEvents.end,t)},y.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,y._deactivateInstance(this)},y.prototype._createEvent=function(t,e){var i=this._getTrackedTouch(e);return{type:t,srcEvent:e,distance:this.getDistance(),deltaX:this.getDeltaX(),deltaY:this.getDeltaY(),deltaTime:t===y._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===y._emitterEvents.start,isFinal:t===y._emitterEvents.end||t===y._emitterEvents.cancel,pointerType:e.pointerType||(e.touches?"touch":"mouse"),identifier:this._pointerId,screenX:i.screenX,screenY:i.screenY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,target:i.target}},y.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},y.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:y._getTouchById(t,this._pointerId)},y.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=y._getEventPointerId(t),null!==this._pointerId)){var e=this._getTrackedTouch(t);this._startX=this._currentX=e.clientX,this._startY=this._currentY=e.clientY,this._startTime=Date.now(),this._isActive=!0,this._emit(y._emitterEvents.start,t),this._isActive&&y._activateInstance(this)}},y.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(y._emitterEvents.move,t))},y.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(y._emitterEvents.cancel,t),this._reset())},y.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(y._emitterEvents.end,t),this._reset())},y.prototype.isActive=function(){return this._isActive},y.prototype.setTouchAction=function(t){this._touchAction=t,v&&(this._cssProps[v]="",this._element.style[v]=t),i&&(this._element.removeEventListener(y._touchEvents.start,y._preventDefault,!0),(this._element.style[v]!==t||p&&m)&&this._element.addEventListener(y._touchEvents.start,y._preventDefault,!0))},y.prototype.setCssProps=function(t){if(t){var e,i,s=this._cssProps,n=this._element;for(e in s)n.style[e]=s[e],delete s[e];for(e in t)t[e]&&("touchAction"!==e?(i=_(n.style,e))&&(s[i]="",n.style[i]=t[e]):this.setTouchAction(t[e]))}},y.prototype.getDeltaX=function(){return this._currentX-this._startX},y.prototype.getDeltaY=function(){return this._currentY-this._startY},y.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},y.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},y.prototype.on=function(t,e){this._emitter.on(t,e)},y.prototype.off=function(t,e){this._emitter.off(t,e)},y.prototype.destroy=function(){if(!this._isDestroyed){var t=this._element;for(var e in this._edgeHack&&this._edgeHack.destroy(),this._reset(),this._emitter.destroy(),t.removeEventListener(y._inputEvents.start,this._onStart,g),t.removeEventListener("dragstart",y._preventDefault,!1),t.removeEventListener(y._touchEvents.start,y._preventDefault,!0),this._cssProps)t.style[e]=this._cssProps[e],delete this._cssProps[e];this._element=null,this._isDestroyed=!0}};var S=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return this.setTimeout((function(){t(Date.now())}),16.666666666666668)}).bind(window);function w(t){this._nextStep=null,this._lanes=[],this._stepQueue=[],this._stepCallbacks={},this._step=this._step.bind(this);for(var e=0;e<t;e++)this._lanes.push(new D)}function D(){this.queue=[],this.indices={},this.callbacks={}}w.prototype._step=function(t){var e,i,s,n,r,o,h=this._lanes,a=this._stepQueue,l=this._stepCallbacks;for(this._nextStep=null,e=0;e<h.length;e++){for(n=h[e].queue,r=h[e].callbacks,o=h[e].indices,i=0;i<n.length;i++)(s=n[i])&&(a.push(s),l[s]=r[s],delete r[s],delete o[s]);n.length=0}for(e=0;e<a.length;e++)l[s=a[e]]&&l[s](t),delete l[s];a.length=0},w.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=S(this._step))},w.prototype.remove=function(t,e){this._lanes[t].remove(e)},D.prototype.add=function(t,e){var i=this.indices[t];void 0!==i&&(this.queue[i]=void 0),this.queue.push(t),this.callbacks[t]=e,this.indices[t]=this.queue.length-1},D.prototype.remove=function(t){var e=this.indices[t];void 0!==e&&(this.queue[e]=void 0,delete this.callbacks[t],delete this.indices[t])};var b=new w(3);function A(t){b.remove(0,"layoutRead"+t),b.remove(2,"layoutWrite"+t)}function E(t){b.remove(0,"visibilityRead"+t),b.remove(2,"visibilityWrite"+t)}function T(t){b.remove(0,"dragStartRead"+t),b.remove(2,"dragStartWrite"+t)}function x(t){b.remove(0,"dragMoveRead"+t),b.remove(2,"dragMoveWrite"+t)}function R(t){b.remove(0,"dragScrollRead"+t),b.remove(2,"dragScrollWrite"+t)}function k(t,e){b.add(1,"dragSortRead"+t,e)}function L(t){b.remove(0,"placeholderLayoutRead"+t),b.remove(2,"placeholderLayoutWrite"+t)}function I(t,e){b.add(0,"autoScrollRead",t),b.add(2,"autoScrollWrite",e)}function C(t){return"function"==typeof t}var M,X="function"==typeof WeakMap,P=X?new WeakMap:null,Y=!0,q=function(){Y?(M=window.clearInterval(M),P=X?new WeakMap:null):Y=!0};function O(t,e){var i=P&&P.get(t);return i||(i=window.getComputedStyle(t,null),P&&P.set(t,i)),P&&(M?Y=!1:M=window.setInterval(q,3e3)),i.getPropertyValue(e)}function H(t,e){return parseFloat(O(t,e))||0}var G,W=document.documentElement,B=document.body,N={value:0,offset:0};function F(t){return t===window||t===W||t===B?window:t}function z(t){return t===window?t.pageXOffset:t.scrollLeft}function V(t){return t===window?t.pageYOffset:t.scrollTop}function j(t){return t===window?W.scrollWidth-W.clientWidth:t.scrollWidth-t.clientWidth}function Q(t){return t===window?W.scrollHeight-W.clientHeight:t.scrollHeight-t.clientHeight}function U(t,e){if(e=e||{},t===window)e.width=W.clientWidth,e.height=W.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),s=t.clientLeft||H(t,"border-left-width"),n=t.clientTop||H(t,"border-top-width");e.width=t.clientWidth,e.height=t.clientHeight,e.left=i.left+s,e.right=e.left+e.width,e.top=i.top+n,e.bottom=e.top+e.height}return e}function Z(t){return t._drag._getGrid()._settings.dragAutoScroll}function J(t){t._drag&&t._drag._prepareScroll()}function $(t){if(t._drag&&t._isActive){var e=t._drag;e._scrollDiffX=e._scrollDiffY=0,t._setTranslate(e._left,e._top)}}function K(t,e,i,s){return N.value=Math.min(s/2,t),N.offset=Math.max(0,i+2*N.value+s*e-s)/2,N}function tt(){this.reset()}function et(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}function it(t,e){this.pool=[],this.createItem=t,this.releaseItem=e}function st(t,e){var i=function(t,e){return function(t,e){return!(t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top)}(t,e)?(Math.min(t.left+t.width,e.left+e.width)-Math.max(t.left,e.left))*(Math.min(t.top+t.height,e.top+e.height)-Math.max(t.top,e.top)):0}(t,e);return i?i/(Math.min(t.width,e.width)*Math.min(t.height,e.height))*100:0}tt.prototype.reset=function(){this.isActive&&this.onStop(),this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=null,this.value=null,this.maxValue=0,this.threshold=0,this.distance=0,this.speed=0,this.duration=0,this.action=null},tt.prototype.hasReachedEnd=function(){return 4&this.direction?this.value>=this.maxValue:this.value<=0},tt.prototype.computeCurrentScrollValue=function(){return null===this.value?1&this.direction?z(this.element):V(this.element):Math.max(0,Math.min(this.value,this.maxValue))},tt.prototype.computeNextScrollValue=function(t){var e=this.speed*(t/1e3),i=4&this.direction?this.value+e:this.value-e;return Math.max(0,Math.min(i,this.maxValue))},tt.prototype.computeSpeed=(G={direction:null,threshold:0,distance:0,value:0,maxValue:0,deltaTime:0,duration:0,isEnding:!1},function(t){var e=this.item,i=Z(e).speed;return C(i)?(G.direction=this.direction,G.threshold=this.threshold,G.distance=this.distance,G.value=this.value,G.maxValue=this.maxValue,G.duration=this.duration,G.speed=this.speed,G.deltaTime=t,G.isEnding=this.isEnding,i(e,this.element,G)):i}),tt.prototype.tick=function(t){return this.isActive||(this.isActive=!0,this.onStart()),this.value=this.computeCurrentScrollValue(),this.speed=this.computeSpeed(t),this.value=this.computeNextScrollValue(t),this.duration+=t,this.value},tt.prototype.onStart=function(){var t=this.item,e=Z(t).onStart;C(e)&&e(t,this.element,this.direction)},tt.prototype.onStop=function(){var t=this.item,e=Z(t).onStop;C(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},et.prototype.reset=function(){this.requestX&&(this.requestX.action=null),this.requestY&&(this.requestY.action=null),this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0},et.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},et.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},et.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:z(this.element),this.scrollTop=this.requestY?this.requestY.value:V(this.element)},et.prototype.scroll=function(){var t=this.element;t&&(t.scrollTo?t.scrollTo(this.scrollLeft,this.scrollTop):(t.scrollLeft=this.scrollLeft,t.scrollTop=this.scrollTop))},it.prototype.pick=function(){return this.pool.pop()||this.createItem()},it.prototype.release=function(t){this.releaseItem(t),-1===this.pool.indexOf(t)&&this.pool.push(t)},it.prototype.reset=function(){this.pool.length=0};var nt={width:0,height:0,left:0,right:0,top:0,bottom:0},rt={width:0,height:0,left:0,right:0,top:0,bottom:0};function ot(){this._isDestroyed=!1,this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,this._items=[],this._actions=[],this._requests={},this._requests[1]={},this._requests[2]={},this._requestOverlapCheck={},this._dragPositions={},this._dragDirections={},this._overlapCheckInterval=150,this._requestPool=new it((function(){return new tt}),(function(t){t.reset()})),this._actionPool=new it((function(){return new et}),(function(t){t.reset()})),this._readTick=this._readTick.bind(this),this._writeTick=this._writeTick.bind(this)}ot.AXIS_X=1,ot.AXIS_Y=2,ot.FORWARD=4,ot.BACKWARD=8,ot.LEFT=9,ot.RIGHT=5,ot.UP=10,ot.DOWN=6,ot.smoothSpeed=function(t,e,i){return function(s,n,r){var o=0;if(!r.isEnding)if(r.threshold>0){var h=r.threshold-Math.max(0,r.distance);o=t/r.threshold*h}else o=t;var a=r.speed,l=o;return a===o?l:a<o?(l=a+e*(r.deltaTime/1e3),Math.min(o,l)):(l=a-i*(r.deltaTime/1e3),Math.max(o,l))}},ot.pointerHandle=function(t){var e={left:0,top:0,width:0,height:0},i=t||1;return function(t,s,n,r,o,h,a){return e.left=h-.5*i,e.top=a-.5*i,e.width=i,e.height=i,e}},ot.prototype._readTick=function(t){this._isDestroyed||(t&&this._tickTime?(this._tickDeltaTime=t-this._tickTime,this._tickTime=t,this._updateRequests(),this._updateActions()):(this._tickTime=t,this._tickDeltaTime=0))},ot.prototype._writeTick=function(){this._isDestroyed||(this._applyActions(),I(this._readTick,this._writeTick))},ot.prototype._startTicking=function(){this._isTicking=!0,I(this._readTick,this._writeTick)},ot.prototype._stopTicking=function(){this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,b.remove(0,"autoScrollRead"),b.remove(2,"autoScrollWrite")},ot.prototype._getItemHandleRect=function(t,e,i){var s=t._drag;if(e){var n=s._dragMoveEvent||s._dragStartEvent,r=e(t,s._clientX,s._clientY,t._width,t._height,n.clientX,n.clientY);i.left=r.left,i.top=r.top,i.width=r.width,i.height=r.height}else i.left=s._clientX,i.top=s._clientY,i.width=t._width,i.height=t._height;return i.right=i.left+i.width,i.bottom=i.top+i.height,i},ot.prototype._requestItemScroll=function(t,e,i,s,n,r,o){var h=this._requests[e],a=h[t._id];a?a.element===i&&a.direction===s||a.reset():a=this._requestPool.pick(),a.item=t,a.element=i,a.direction=s,a.threshold=n,a.distance=r,a.maxValue=o,h[t._id]=a},ot.prototype._cancelItemScroll=function(t,e){var i=this._requests[e],s=i[t._id];s&&(s.action&&s.action.removeRequest(s),this._requestPool.release(s),delete i[t._id])},ot.prototype._checkItemOverlap=function(t,e,i){var s=Z(t),n=C(s.targets)?s.targets(t):s.targets,r=s.threshold,o=s.safeZone;if(!n||!n.length)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));var h=this._dragDirections[t._id],a=h[0],l=h[1];if(!a&&!l)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var _=this._getItemHandleRect(t,s.handle,nt),d=rt,u=null,c=null,f=!0,p=!0,m=0,g=0,v=null,y=null,S=0,w=0,D=0,b=null,A=-1/0,E=0,T=0,x=null,R=0,k=0,L=null,I=-1/0,M=0,X=0,P=null,Y=0,q=0,O=0;O<n.length;O++)u=n[O],f=e&&a&&2!==u.axis,p=i&&l&&1!==u.axis,g=u.priority||0,(!f||g<A)&&(!p||g<I)||(c=F(u.element||u),w=f?j(c):-1,D=p?Q(c):-1,(w||D)&&((m=st(_,d=U(c,d)))<=0||(f&&g>=A&&w>0&&(g>A||m>T)&&(y=null,v=K("number"==typeof u.threshold?u.threshold:r,o,_.width,d.width),5===a?(S=d.right+v.offset-_.right)<=v.value&&z(c)<w&&(y=5):9===a&&(S=_.left-(d.left-v.offset))<=v.value&&z(c)>0&&(y=9),null!==y&&(b=c,A=g,E=v.value,T=m,x=y,R=S,k=w)),p&&g>=I&&D>0&&(g>I||m>X)&&(y=null,v=K("number"==typeof u.threshold?u.threshold:r,o,_.height,d.height),6===l?(S=d.bottom+v.offset-_.bottom)<=v.value&&V(c)<D&&(y=6):10===l&&(S=_.top-(d.top-v.offset))<=v.value&&V(c)>0&&(y=10),null!==y&&(L=c,I=g,M=v.value,X=m,P=y,Y=S,q=D)))));e&&(b?this._requestItemScroll(t,1,b,x,E,R,k):this._cancelItemScroll(t,1)),i&&(L?this._requestItemScroll(t,2,L,P,M,Y,q):this._cancelItemScroll(t,2))},ot.prototype._updateScrollRequest=function(t){for(var e=t.item,i=Z(e),s=C(i.targets)?i.targets(e):i.targets,n=s&&s.length||0,r=i.threshold,o=i.safeZone,h=this._getItemHandleRect(e,i.handle,nt),a=rt,l=null,_=null,d=!1,u=null,c=null,f=null,p=null,m=null,g=0;g<n;g++)if((_=F((l=s[g]).element||l))===t.element){if(d=!!(1&t.direction)){if(2===l.axis)continue}else if(1===l.axis)continue;if((p=d?j(_):Q(_))<=0)break;if(st(h,a=U(_,a))<=0)break;if(u=K("number"==typeof l.threshold?l.threshold:r,o,d?h.width:h.height,d?a.width:a.height),(c=9===t.direction?h.left-(a.left-u.offset):5===t.direction?a.right+u.offset-h.right:10===t.direction?h.top-(a.top-u.offset):a.bottom+u.offset-h.bottom)>u.value)break;if(f=d?z(_):V(_),m=4&t.direction?f>=p:f<=0)break;return t.maxValue=p,t.threshold=u.value,t.distance=c,t.isEnding=!1,!0}return!0===i.smoothStop&&t.speed>0?(null===m&&(m=t.hasReachedEnd()),t.isEnding=!m):t.isEnding=!1,t.isEnding},ot.prototype._updateRequests=function(){for(var t,e,i,s,n,r,o,h=this._items,a=this._requests[1],l=this._requests[2],_=0;_<h.length;_++)t=h[_],n=(s=this._requestOverlapCheck[t._id])>0&&this._tickTime-s>this._overlapCheckInterval,r=!0,(e=a[t._id])&&e.isActive&&(r=!this._updateScrollRequest(e))&&(n=!0,this._cancelItemScroll(t,1)),o=!0,(i=l[t._id])&&i.isActive&&(o=!this._updateScrollRequest(i))&&(n=!0,this._cancelItemScroll(t,2)),n&&(this._requestOverlapCheck[t._id]=0,this._checkItemOverlap(t,r,o))},ot.prototype._requestAction=function(t,e){for(var i=this._actions,s=1===e,n=null,r=0;r<i.length;r++){if(n=i[r],t.element===n.element){if(s?n.requestX:n.requestY)return void this._cancelItemScroll(t.item,e);break}n=null}n||(n=this._actionPool.pick()),n.element=t.element,n.addRequest(t),t.tick(this._tickDeltaTime),i.push(n)},ot.prototype._updateActions=function(){var t,e,i,s,n=this._items,r=this._requests,o=this._actions;for(s=0;s<n.length;s++)t=n[s]._id,e=r[1][t],i=r[2][t],e&&this._requestAction(e,1),i&&this._requestAction(i,2);for(s=0;s<o.length;s++)o[s].computeScrollValues()},ot.prototype._applyActions=function(){var t,e=this._actions,i=this._items;if(e.length){for(t=0;t<e.length;t++)e[t].scroll(),this._actionPool.release(e[t]);for(e.length=0,t=0;t<i.length;t++)J(i[t]);for(t=0;t<i.length;t++)$(i[t])}},ot.prototype._updateDragDirection=function(t){var e=this._dragPositions[t._id],i=this._dragDirections[t._id],s=t._drag._left,n=t._drag._top;if(e.length){var r=e[0],o=e[1];i[0]=s>r?5:s<r?9:i[0]||0,i[1]=n>o?6:n<o?10:i[1]||0}e[0]=s,e[1]=n},ot.prototype.addItem=function(t){this._isDestroyed||-1===this._items.indexOf(t)&&(this._items.push(t),this._requestOverlapCheck[t._id]=this._tickTime,this._dragDirections[t._id]=[0,0],this._dragPositions[t._id]=[],this._isTicking||this._startTicking())},ot.prototype.updateItem=function(t){this._isDestroyed||this._dragDirections[t._id]&&(this._updateDragDirection(t),this._requestOverlapCheck[t._id]||(this._requestOverlapCheck[t._id]=this._tickTime))},ot.prototype.removeItem=function(t){if(!this._isDestroyed){var e=this._items.indexOf(t);if(-1!==e){var i=t._id;this._requests[1][i]&&(this._cancelItemScroll(t,1),delete this._requests[1][i]),this._requests[2][i]&&(this._cancelItemScroll(t,2),delete this._requests[2][i]),delete this._requestOverlapCheck[i],delete this._dragPositions[i],delete this._dragDirections[i],this._items.splice(e,1),this._isTicking&&!this._items.length&&this._stopTicking()}}},ot.prototype.isItemScrollingX=function(t){var e=this._requests[1][t._id];return!(!e||!e.isActive)},ot.prototype.isItemScrollingY=function(t){var e=this._requests[2][t._id];return!(!e||!e.isActive)},ot.prototype.isItemScrolling=function(t){return this.isItemScrollingX(t)||this.isItemScrollingY(t)},ot.prototype.destroy=function(){if(!this._isDestroyed){for(var t=this._items.slice(0),e=0;e<t.length;e++)this.removeItem(t[e]);this._actions.length=0,this._requestPool.reset(),this._actionPool.reset(),this._isDestroyed=!0}};var ht=window.Element.prototype,at=ht.matches||ht.matchesSelector||ht.webkitMatchesSelector||ht.mozMatchesSelector||ht.msMatchesSelector||ht.oMatchesSelector||function(){return!1};function lt(t,e){return at.call(t,e)}function _t(t,e){e&&(t.classList?t.classList.add(e):lt(t,"."+e)||(t.className+=" "+e))}var dt=[];function ut(t,e,i){var s="number"==typeof i?i:-1;s<0&&(s=t.length-s+1),t.splice.apply(t,dt.concat(s,0,e)),dt.length=0}function ct(t,e,i){var s=Math.max(0,t.length-1+(i||0));return e>s?s:e<0?Math.max(s+e+1,0):e}function ft(t,e,i){if(!(t.length<2)){var s=ct(t,e),n=ct(t,i);s!==n&&t.splice(n,0,t.splice(s,1)[0])}}function pt(t,e,i){if(!(t.length<2)){var s,n=ct(t,e),r=ct(t,i);n!==r&&(s=t[n],t[n]=t[r],t[r]=s)}}var mt=_(document.documentElement.style,"transform")||"transform",gt=/([A-Z])/g,vt=/^(webkit-|moz-|ms-|o-)/,yt=/^(-m-s-)/;function St(t){var e=t.replace(gt,"-$1").toLowerCase();return e=(e=e.replace(vt,"-$1")).replace(yt,"-ms-")}var wt=St(mt);function Dt(t){var e=O(t,wt);if(!e||"none"===e)return!1;var i=O(t,"display");return"inline"!==i&&"none"!==i}function bt(t){for(var e=document,i=t||e;i&&i!==e&&"static"===O(i,"position")&&!Dt(i);)i=i.parentElement||e;return i}var At={},Et={},Tt={};function xt(t,e){var i,s=e||{};return s.left=0,s.top=0,t===document?s:(s.left=window.pageXOffset||0,s.top=window.pageYOffset||0,t.self===window.self||(i=t.getBoundingClientRect(),s.left+=i.left,s.top+=i.top,s.left+=H(t,"border-left-width"),s.top+=H(t,"border-top-width")),s)}function Rt(t,e,i){return Tt.left=0,Tt.top=0,t===e||i&&(t=bt(t))===(e=bt(e))||(xt(t,At),xt(e,Et),Tt.left=Et.left-At.left,Tt.top=Et.top-At.top),Tt}function kt(t){return"auto"===t||"scroll"===t||"overlay"===t}function Lt(t){return kt(O(t,"overflow"))||kt(O(t,"overflow-x"))||kt(O(t,"overflow-y"))}function It(t,e){for(e=e||[];t&&t!==document;)t.getRootNode&&t instanceof DocumentFragment?t=t.getRootNode().host:(Lt(t)&&e.push(t),t=t.parentNode);return e.push(window),e}var Ct={},Mt=/^matrix3d/,Xt=/([^,]*,){4}/,Pt=/([^,]*,){12}/,Yt=/[^,]*,/;function qt(t){Ct.x=0,Ct.y=0;var e=O(t,wt);if(!e||"none"===e)return Ct;var i=Mt.test(e),s=e.replace(i?Pt:Xt,""),n=s.replace(Yt,"");return Ct.x=parseFloat(s)||0,Ct.y=parseFloat(n)||0,Ct}function Ot(t,e){e&&(t.classList?t.classList.remove(e):lt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var Ht,Gt,Wt,Bt,Nt=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,Ft=!!d()&&{passive:!0};function zt(t){var e=t._element,i=t.getGrid(),s=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=C(s.dragStartPredicate)?s.dragStartPredicate:zt.defaultStartPredicate,this._startPredicateState=0,this._startPredicateResult=void 0,this._isSortNeeded=!1,this._sortTimer=void 0,this._blockedSortIndex=null,this._sortX1=0,this._sortX2=0,this._sortY1=0,this._sortY2=0,this._reset(),this._preStartCheck=this._preStartCheck.bind(this),this._preEndCheck=this._preEndCheck.bind(this),this._onScroll=this._onScroll.bind(this),this._prepareStart=this._prepareStart.bind(this),this._applyStart=this._applyStart.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._prepareScroll=this._prepareScroll.bind(this),this._applyScroll=this._applyScroll.bind(this),this._handleSort=this._handleSort.bind(this),this._handleSortDelayed=this._handleSortDelayed.bind(this),this._handle=s.dragHandle&&e.querySelector(s.dragHandle)||e,this._dragger=new y(this._handle,s.dragCssProps),this._dragger.on("start",this._preStartCheck),this._dragger.on("move",this._preStartCheck),this._dragger.on("cancel",this._preEndCheck),this._dragger.on("end",this._preEndCheck)}function Vt(t,e){var i,s,n={};if(Array.isArray(e))for(s=0;s<e.length;s++)n[i=e[s]]=O(t,St(i));else for(i in e)n[i]=O(t,St(i));return n}zt.autoScroller=new ot,zt.defaultStartPredicate=function(t,e,i){var s=t._drag;if(e.isFirst&&e.srcEvent.button)return!1;if(!Nt&&e.isFirst&&!0===e.srcEvent.isTrusted&&!1===e.srcEvent.defaultPrevented&&!1===e.srcEvent.cancelable)return!1;if(!e.isFinal){var n=s._startPredicateData;if(!n){var r=i||s._getGrid()._settings.dragStartPredicate||{};s._startPredicateData=n={distance:Math.max(r.distance,0)||0,delay:Math.max(r.delay,0)||0}}return n.delay&&(n.event=e,n.delayTimer||(n.delayTimer=window.setTimeout((function(){n.delay=0,s._resolveStartPredicate(n.event)&&(s._forceResolveStartPredicate(n.event),s._resetStartPredicate())}),n.delay))),s._resolveStartPredicate(e)}s._finishStartPredicate(e)},zt.defaultSortPredicate=(Ht={},Gt={},Wt={},Bt=[],function(t,e){var i=t._drag,s=i._getGrid(),n=e&&"number"==typeof e.threshold?e.threshold:50,r=e&&"swap"===e.action?"swap":"move",o=e&&"swap"===e.migrateAction?"swap":"move";n=Math.min(Math.max(n,1),100),Ht.width=t._width,Ht.height=t._height,Ht.left=i._clientX,Ht.top=i._clientY;var h=function(t,e,i){var s,n,r,o,h,a,l,_,d,u,c=null,f=e._settings.dragSort,p=-1;if(!0===f?(Bt[0]=e,n=Bt):C(f)&&(n=f.call(e,t)),!n||!Array.isArray(n)||!n.length)return c;for(u=0;u<n.length;u++)if(!(r=n[u])._isDestroyed){for(r._updateBoundingRect(),a=Math.max(0,r._left),l=Math.max(0,r._top),_=Math.min(window.innerWidth,r._right),d=Math.min(window.innerHeight,r._bottom),o=r._element.parentNode;o&&o!==document&&o!==document.documentElement&&o!==document.body;)if(o.getRootNode&&o instanceof DocumentFragment)o=o.getRootNode().host;else{if("visible"!==O(o,"overflow")&&(h=o.getBoundingClientRect(),a=Math.max(a,h.left),l=Math.max(l,h.top),_=Math.min(_,h.right),d=Math.min(d,h.bottom)),"fixed"===O(o,"position"))break;o=o.parentNode}a>=_||l>=d||(Gt.left=a,Gt.top=l,Gt.width=_-a,Gt.height=d-l,(s=st(Ht,Gt))>i&&s>p&&(p=s,c=r))}return Bt.length=0,c}(t,s,n);if(!h)return null;var a,l,_,d=t.getGrid()!==h,u=0,c=0,f=0,p=-1,m=!1;for(h===s?(Ht.left=i._gridX+t._marginLeft,Ht.top=i._gridY+t._marginTop):(h._updateBorders(1,0,1,0),u=h._left+h._borderLeft,c=h._top+h._borderTop),_=0;_<h._items.length;_++)(a=h._items[_])._isActive&&a!==t&&(m=!0,Gt.width=a._width,Gt.height=a._height,Gt.left=a._left+a._marginLeft+u,Gt.top=a._top+a._marginTop+c,(l=st(Ht,Gt))>f&&(p=_,f=l));return d&&f<n&&(p=m?p:0,f=n),f>=n?(Wt.grid=h,Wt.index=p,Wt.action=d?o:r,Wt):null}),zt.prototype.stop=function(){if(this._isActive)if(this._isMigrating)this._finishMigration();else{zt.autoScroller.removeItem(this._item);var t=this._item._id;if(T(t),x(t),R(t),this._cancelSort(),this._isStarted){this._unbindScrollListeners();var e=item._element,i=this._getGrid(),s=i._settings.itemDraggingClass;e.parentNode!==i._element&&(i._element.appendChild(e),item._setTranslate(this._gridX,this._gridY),s&&e.clientWidth),Ot(e,s)}this._reset()}},zt.prototype.sort=function(t){var e=this._item;this._isActive&&e._isActive&&this._dragMoveEvent&&(!0===t?this._handleSort():k(e._id,this._handleSort))},zt.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._dragger.destroy(),zt.autoScroller.removeItem(this._item),this._isDestroyed=!0)},zt.prototype._getGrid=function(){return t[this._gridId]||null},zt.prototype._reset=function(){this._isActive=!1,this._isStarted=!1,this._container=null,this._containingBlock=null,this._dragStartEvent=null,this._dragMoveEvent=null,this._dragPrevMoveEvent=null,this._scrollEvent=null,this._scrollers=[],this._left=0,this._top=0,this._gridX=0,this._gridY=0,this._clientX=0,this._clientY=0,this._scrollDiffX=0,this._scrollDiffY=0,this._moveDiffX=0,this._moveDiffY=0,this._containerDiffX=0,this._containerDiffY=0},zt.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,s=this._container,n=this._scrollers;if(n.length=0,It(this._item._element.parentNode,n),s!==i)for(It(i,t=[]),e=0;e<t.length;e++)n.indexOf(t[e])<0&&n.push(t[e]);for(e=0;e<n.length;e++)n[e].addEventListener("scroll",this._onScroll,Ft)},zt.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,Ft);e.length=0},zt.prototype._resolveStartPredicate=function(t){var e=this._startPredicateData;if(!(t.distance<e.distance||e.delay))return this._resetStartPredicate(),!0},zt.prototype._forceResolveStartPredicate=function(t){this._isDestroyed||1!==this._startPredicateState||(this._startPredicateState=2,this._onStart(t))},zt.prototype._finishStartPredicate=function(t){var e=this._item._element,i=Math.abs(t.deltaX)<2&&Math.abs(t.deltaY)<2&&t.deltaTime<200;this._resetStartPredicate(),i&&function(t){if("a"!==t.tagName.toLowerCase())return;var e=t.getAttribute("href");if(!e)return;var i=t.getAttribute("target");i&&"_self"!==i?window.open(e,i):window.location.href=e}(e)},zt.prototype._resetHeuristics=function(t,e){this._blockedSortIndex=null,this._sortX1=this._sortX2=t,this._sortY1=this._sortY2=e},zt.prototype._checkHeuristics=function(t,e){var i=this._getGrid()._settings.dragSortHeuristics,s=i.minDragDistance;if(s<=0)return this._blockedSortIndex=null,!0;var n=t-this._sortX2,r=e-this._sortY2,o=s>3&&i.minBounceBackAngle>0;if(o||(this._blockedSortIndex=null),Math.abs(n)>s||Math.abs(r)>s){if(o){var h=Math.atan2(n,r),a=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),l=Math.atan2(Math.sin(h-a),Math.cos(h-a));Math.abs(l)>i.minBounceBackAngle&&(this._blockedSortIndex=null)}return this._sortX1=this._sortX2,this._sortY1=this._sortY2,this._sortX2=t,this._sortY2=e,!0}return!1},zt.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},zt.prototype._handleSort=function(){if(this._isActive){var t=this._getGrid()._settings;if(!t.dragSort||!t.dragAutoScroll.sortDuringScroll&&zt.autoScroller.isItemScrolling(this._item))return this._sortX1=this._sortX2=this._gridX,this._sortY1=this._sortY2=this._gridY,this._isSortNeeded=!0,void(void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)));var e=this._checkHeuristics(this._gridX,this._gridY);if(this._isSortNeeded||e){var i=t.dragSortHeuristics.sortInterval;i<=0||this._isSortNeeded?(this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),this._checkOverlap()):void 0===this._sortTimer&&(this._sortTimer=window.setTimeout(this._handleSortDelayed,i))}}},zt.prototype._handleSortDelayed=function(){this._isSortNeeded=!0,this._sortTimer=void 0,k(this._item._id,this._handleSort)},zt.prototype._cancelSort=function(){var t;this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),t=this._item._id,b.remove(1,"dragSortRead"+t)},zt.prototype._finishSort=function(){var t=this._getGrid()._settings.dragSort&&(this._isSortNeeded||void 0!==this._sortTimer);this._cancelSort(),t&&this._checkOverlap()},zt.prototype._checkOverlap=function(){if(this._isActive){var t,e,i,s,n,r,o,h,a=this._item,l=this._getGrid()._settings;(t=C(l.dragSortPredicate)?l.dragSortPredicate(a,this._dragMoveEvent):zt.defaultSortPredicate(a,l.dragSortPredicate))&&"number"==typeof t.index&&(o="swap"===t.action?"swap":"move",h=(e=a.getGrid())!==(s=t.grid||e),i=e._items.indexOf(a),n=ct(s._items,t.index,h&&"move"===o?1:0),(h||n!==this._blockedSortIndex)&&(h?(this._blockedSortIndex=null,r=s._items[n],e._hasListeners("beforeSend")&&e._emit("beforeSend",{item:a,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),s._hasListeners("beforeReceive")&&s._emit("beforeReceive",{item:a,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),a._gridId=s._id,this._isMigrating=a._gridId!==this._gridId,e._items.splice(i,1),ut(s._items,a,n),a._sortData=null,e._hasListeners("send")&&e._emit("send",{item:a,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),s._hasListeners("receive")&&s._emit("receive",{item:a,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),"swap"===o&&r&&r.isActive()&&s._items.indexOf(r)>-1&&s.send(r,e,i,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),s.layout()):i!==n&&(this._blockedSortIndex=i,("swap"===o?pt:ft)(e._items,i,n),e._hasListeners("move")&&e._emit("move",{item:a,fromIndex:i,toIndex:n,action:o}),e.layout())))}},zt.prototype._finishMigration=function(){var t,e,i=this._item,s=i._dragRelease,n=i._element,r=i._isActive,o=i.getGrid(),h=o._element,a=o._settings,l=a.dragContainer||h,_=this._getGrid()._settings,d=n.parentNode,u=r?_.itemVisibleClass:_.itemHiddenClass,c=r?a.itemVisibleClass:a.itemHiddenClass;this._isMigrating=!1,this.destroy(),_.itemClass!==a.itemClass&&(Ot(n,_.itemClass),_t(n,a.itemClass)),u!==c&&(Ot(n,u),_t(n,c)),l!==d&&(l.appendChild(n),e=Rt(d,l,!0),(t=qt(n)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=Rt(l,h,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=a.dragEnabled?new zt(i):null,l!==d&&i._setTranslate(t.x,t.y),i._visibility.setStyles(r?a.visibleStyles:a.hiddenStyles),s.start()},zt.prototype._preStartCheck=function(t){0===this._startPredicateState&&(this._startPredicateState=1),1===this._startPredicateState?(this._startPredicateResult=this._startPredicate(this._item,t),!0===this._startPredicateResult?(this._startPredicateState=2,this._onStart(t)):!1===this._startPredicateResult&&(this._resetStartPredicate(t),this._dragger._reset(),this._startPredicateState=0)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},zt.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=0,e&&this._isActive&&(this._isStarted?this._onEnd(t):this.stop())},zt.prototype._onStart=function(t){var e,i,s,n=this._item;n._isActive&&(this._isActive=!0,this._dragStartEvent=t,zt.autoScroller.addItem(n),e=n._id,i=this._prepareStart,s=this._applyStart,b.add(0,"dragStartRead"+e,i),b.add(2,"dragStartWrite"+e,s))},zt.prototype._prepareStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid(),s=i._settings,n=i._element,r=s.dragContainer||n,o=bt(r),h=qt(e),a=e.getBoundingClientRect(),l=r!==n;if(this._container=r,this._containingBlock=o,this._clientX=a.left,this._clientY=a.top,this._left=this._gridX=h.x,this._top=this._gridY=h.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),l){var _=Rt(o,n);this._containerDiffX=_.left,this._containerDiffY=_.top}}}},zt.prototype._applyStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=this._getGrid(),i=t._element,s=t._dragRelease,n=t._migrate,r=this._container!==e._element;t.isPositioning()&&t._layout.stop(!0,this._left,this._top),n._isActive&&(this._left-=n._containerDiffX,this._top-=n._containerDiffY,this._gridX-=n._containerDiffX,this._gridY-=n._containerDiffY,n.stop(!0,this._left,this._top)),t.isReleasing()&&s._reset(),e._settings.dragPlaceholder.enabled&&t._dragPlaceholder.create(),this._isStarted=!0,e._emit("dragInit",t,this._dragStartEvent),r&&(i.parentNode===this._container?(this._gridX-=this._containerDiffX,this._gridY-=this._containerDiffY):(this._left+=this._containerDiffX,this._top+=this._containerDiffY,this._container.appendChild(i),t._setTranslate(this._left,this._top))),_t(i,e._settings.itemDraggingClass),this._bindScrollListeners(),e._emit("dragStart",t,this._dragStartEvent)}}},zt.prototype._onMove=function(t){var e,i,s,n=this._item;n._isActive?(this._dragMoveEvent=t,e=n._id,i=this._prepareMove,s=this._applyMove,b.add(0,"dragMoveRead"+e,i),b.add(2,"dragMoveWrite"+e,s),k(n._id,this._handleSort)):this.stop()},zt.prototype._prepareMove=function(){if(this._isActive&&this._item._isActive){var t=this._getGrid()._settings.dragAxis,e=this._dragMoveEvent,i=this._dragPrevMoveEvent||this._dragStartEvent||e;if("y"!==t){var s=e.clientX-i.clientX;this._left=this._left-this._moveDiffX+s,this._gridX=this._gridX-this._moveDiffX+s,this._clientX=this._clientX-this._moveDiffX+s,this._moveDiffX=s}if("x"!==t){var n=e.clientY-i.clientY;this._top=this._top-this._moveDiffY+n,this._gridY=this._gridY-this._moveDiffY+n,this._clientY=this._clientY-this._moveDiffY+n,this._moveDiffY=n}this._dragPrevMoveEvent=e}},zt.prototype._applyMove=function(){if(this._isActive){var t=this._item;t._isActive&&(this._moveDiffX=this._moveDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragMove",t,this._dragMoveEvent),zt.autoScroller.updateItem(t))}},zt.prototype._onScroll=function(t){var e,i,s,n=this._item;n._isActive?(this._scrollEvent=t,e=n._id,i=this._prepareScroll,s=this._applyScroll,b.add(0,"dragScrollRead"+e,i),b.add(2,"dragScrollWrite"+e,s),k(n._id,this._handleSort)):this.stop()},zt.prototype._prepareScroll=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid(),s=i._element,n=i._settings.dragAxis,r="y"!==n,o="x"!==n,h=e.getBoundingClientRect();if(this._container!==s){var a=Rt(this._containingBlock,s);this._containerDiffX=a.left,this._containerDiffY=a.top}if(r){var l=this._clientX-this._moveDiffX-this._scrollDiffX-h.left;this._left=this._left-this._scrollDiffX+l,this._scrollDiffX=l}if(o){var _=this._clientY-this._moveDiffY-this._scrollDiffY-h.top;this._top=this._top-this._scrollDiffY+_,this._scrollDiffY=_}this._gridX=this._left-this._containerDiffX,this._gridY=this._top-this._containerDiffY}}},zt.prototype._applyScroll=function(){if(this._isActive){var t=this._item;t._isActive&&(this._scrollDiffX=this._scrollDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragScroll",t,this._scrollEvent))}},zt.prototype._onEnd=function(t){var e=this._item,i=e._element,s=this._getGrid(),n=s._settings,r=e._dragRelease;e._isActive?(T(e._id),x(e._id),R(e._id),this._finishSort(),this._unbindScrollListeners(),r._containerDiffX=this._containerDiffX,r._containerDiffY=this._containerDiffY,this._reset(),Ot(i,n.itemDraggingClass),zt.autoScroller.removeItem(e),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():r.start()):this.stop()};var jt=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,Qt={};function Ut(t){var e=Qt[t];return e||((e=t.replace(jt,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),Qt[t]=e,e)}function Zt(t,e){for(var i in e)t.style[i]=e[i]}var Jt,$t,Kt=!(!Element||!C(Element.prototype.animate)),te=!!(Element&&(Jt=Element.prototype.animate,$t=window.Symbol,Jt&&C($t)&&C($t.toString)&&$t(Jt).toString().indexOf("[native code]")>-1));function ee(t){this._element=t,this._animation=null,this._duration=0,this._easing="",this._callback=null,this._props=[],this._values=[],this._isDestroyed=!1,this._onFinish=this._onFinish.bind(this)}function ie(t,e){var i={};for(var s in t)i[e?s:Ut(s)]=t[s];return i}function se(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function ne(t){this._item=t,this._animation=new ee,this._element=null,this._className="",this._didMigrate=!1,this._resetAfterLayout=!1,this._left=0,this._top=0,this._transX=0,this._transY=0,this._nextTransX=0,this._nextTransY=0,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this),this._updateDimensions=this._updateDimensions.bind(this),this._onLayoutStart=this._onLayoutStart.bind(this),this._onLayoutEnd=this._onLayoutEnd.bind(this),this._onReleaseEnd=this._onReleaseEnd.bind(this),this._onMigrate=this._onMigrate.bind(this),this._onHide=this._onHide.bind(this)}function re(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}ee.prototype.start=function(t,e,i){if(!this._isDestroyed){var s=this._element,n=i||{};if(!Kt)return Zt(s,e),this._callback=C(n.onFinish)?n.onFinish:null,void this._onFinish();var r,o,h,a=this._animation,l=this._props,_=this._values,d=n.duration||300,u=n.easing||"ease",c=!1;if(a&&(o=0,d===this._duration&&u===this._easing||(c=!0),!c)){for(r in e)if(++o,-1===(h=l.indexOf(r))||e[r]!==_[h]){c=!0;break}o!==l.length&&(c=!0)}if(c&&a.cancel(),this._callback=C(n.onFinish)?n.onFinish:null,!a||c){for(r in l.length=_.length=0,e)l.push(r),_.push(e[r]);this._duration=d,this._easing=u,this._animation=s.animate([ie(t,te),ie(e,te)],{duration:d,easing:u}),this._animation.onfinish=this._onFinish,Zt(s,e)}}},ee.prototype.stop=function(){!this._isDestroyed&&this._animation&&(this._animation.cancel(),this._animation=this._callback=null,this._props.length=this._values.length=0)},ee.prototype.getCurrentStyles=function(){return Vt(element,currentProps)},ee.prototype.isAnimating=function(){return!!this._animation},ee.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=null,this._isDestroyed=!0)},ee.prototype._onFinish=function(){var t=this._callback;this._animation=this._callback=null,this._props.length=this._values.length=0,t&&t()},ne.prototype._updateDimensions=function(){this.isActive()&&Zt(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},ne.prototype._onLayoutStart=function(t,e){var i=this._item;if(-1!==t.indexOf(i)){var s=i._left,n=i._top,r=this._left,o=this._top;if(this._left=s,this._top=n,e||this._didMigrate||r!==s||o!==n){var h,a,l,_=s+i._marginLeft,d=n+i._marginTop,u=i.getGrid();if(!(!e&&u._settings.layoutDuration>0)||this._didMigrate)return L(i._id),this._element.style[mt]=se(_,d),this._animation.stop(),void(this._didMigrate&&(u.getElement().appendChild(this._element),this._didMigrate=!1));this._nextTransX=_,this._nextTransY=d,h=i._id,a=this._setupAnimation,l=this._startAnimation,b.add(0,"placeholderLayoutRead"+h,a),b.add(2,"placeholderLayoutWrite"+h,l)}}else this.reset()},ne.prototype._setupAnimation=function(){if(this.isActive()){var t=qt(this._element);this._transX=t.x,this._transY=t.y}},ne.prototype._startAnimation=function(){if(this.isActive()){var t=this._animation,e=this._transX,i=this._transY,s=this._nextTransX,n=this._nextTransY;if(e!==s||i!==n){var r=this._item.getGrid()._settings,o={},h={};o[mt]=se(e,i),h[mt]=se(s,n),t.start(o,h,{duration:r.layoutDuration,easing:r.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[mt]=se(s,n),t.stop())}},ne.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},ne.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},ne.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off("dragReleaseEnd",this._onReleaseEnd),e.off("layoutStart",this._onLayoutStart),e.off("beforeSend",this._onMigrate),e.off("hideStart",this._onHide),i.on("dragReleaseEnd",this._onReleaseEnd),i.on("layoutStart",this._onLayoutStart),i.on("beforeSend",this._onMigrate),i.on("hideStart",this._onHide),this._didMigrate=!0}},ne.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},ne.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),s=i._settings,n=this._animation;this._left=e._left,this._top=e._top,t=C(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,n._element=t,this._className=s.itemPlaceholderClass||"",this._className&&_t(t,this._className),Zt(t,{position:"absolute",left:"0px",top:"0px",width:e._width+"px",height:e._height+"px"}),t.style[mt]=se(e._left+e._marginLeft,e._top+e._marginTop),i.on("layoutStart",this._onLayoutStart),i.on("dragReleaseEnd",this._onReleaseEnd),i.on("beforeSend",this._onMigrate),i.on("hideStart",this._onHide),C(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},ne.prototype.reset=function(){if(this.isActive()){var t,e=this._element,i=this._item,s=i.getGrid(),n=s._settings,r=this._animation;this._resetAfterLayout=!1,L(i._id),t=i._id,b.remove(2,"placeholderResizeWrite"+t),r.stop(),r._element=null,s.off("dragReleaseEnd",this._onReleaseEnd),s.off("layoutStart",this._onLayoutStart),s.off("beforeSend",this._onMigrate),s.off("hideStart",this._onHide),this._className&&(Ot(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,C(n.dragPlaceholder.onRemove)&&n.dragPlaceholder.onRemove(i,e)}},ne.prototype.isActive=function(){return!!this._element},ne.prototype.getElement=function(){return this._element},ne.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,b.add(2,"placeholderResizeWrite"+t,e))},ne.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},re.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,_t(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},re.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item,n=s.getGrid();t||void 0!==e&&void 0!==i||(e=s._left,i=s._top);var r=this._placeToGrid(e,i);this._reset(r),t||n._emit("dragReleaseEnd",s)}},re.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},re.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},re.prototype._placeToGrid=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=i.getGrid()._element,r=!1;if(s.parentNode!==n){if(void 0===t||void 0===e){var o=qt(s);t=o.x-this._containerDiffX,e=o.y-this._containerDiffY}n.appendChild(s),i._setTranslate(t,e),r=!0}return this._containerDiffX=0,this._containerDiffY=0,r}},re.prototype._reset=function(t){if(!this._isDestroyed){var e=this._item,i=e.getGrid()._settings.itemReleasingClass;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,i&&(t&&e._element.clientWidth,Ot(e._element,i))}};function oe(t){var e=t._element,i=e.style;this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isInterrupted=!1,this._currentStyles={},this._targetStyles={},this._nextLeft=0,this._nextTop=0,this._offsetLeft=0,this._offsetTop=0,this._skipNextAnimation=!1,this._animOptions={onFinish:this._finish.bind(this),duration:0,easing:0},i.left="0px",i.top="0px",t._setTranslate(0,0),this._animation=new ee(e),this._queue="layout-"+t._id,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}function he(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function ae(t){var e=t._isActive,i=t._element,s=i.children[0],n=t.getGrid()._settings;if(!s)throw new Error("No valid child element found within item element.");this._item=t,this._isDestroyed=!1,this._isHidden=!e,this._isHiding=!1,this._isShowing=!1,this._childElement=s,this._currentStyleProps=[],this._animation=new ee(s),this._queue="visibility-"+t._id,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"":"none",_t(i,e?n.itemVisibleClass:n.itemHiddenClass),this.setStyles(e?n.visibleStyles:n.hiddenStyles)}oe.prototype.start=function(t,e){if(!this._isDestroyed){var i,s,n,r=this._item,o=r._dragRelease,h=r.getGrid()._settings,a=this._isActive,l=o.isJustReleased(),_=l?h.dragRelease.duration:h.layoutDuration,d=l?h.dragRelease.easing:h.layoutEasing,u=!t&&!this._skipNextAnimation&&_>0;if(a&&(A(r._id),r._emitter.burst(this._queue,!0,r)),l&&(o._isPositioningStarted=!0),C(e)&&r._emitter.on(this._queue,e),this._skipNextAnimation=!1,!u)return this._updateOffsets(),r._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._animation.isAnimating()&&(this._animation._animation.onfinish=null),this._isActive=!0,this._animOptions.easing=d,this._animOptions.duration=_,this._isInterrupted=a,i=r._id,s=this._setupAnimation,n=this._startAnimation,b.add(0,"layoutRead"+i,s),b.add(2,"layoutWrite"+i,n)}},oe.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item;if(A(s._id),this._animation.isAnimating()){if(void 0===e||void 0===i){var n=qt(s._element);e=n.x,i=n.y}s._setTranslate(e,i),this._animation.stop()}Ot(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&s._emitter.burst(this._queue,!0,s)}},oe.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item._element.style;this.stop(!0,0,0),this._item._emitter.clear(this._queue),this._animation.destroy(),t[mt]="",t.left="",t.top="",this._item=null,this._currentStyles=null,this._targetStyles=null,this._animOptions=null,this._isDestroyed=!0}},oe.prototype._updateOffsets=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;this._offsetLeft=i._isActive?i._containerDiffX:e._isActive?e._containerDiffX:0,this._offsetTop=i._isActive?i._containerDiffY:e._isActive?e._containerDiffY:0,this._nextLeft=this._item._left+this._offsetLeft,this._nextTop=this._item._top+this._offsetTop}},oe.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;t._tX=this._nextLeft,t._tY=this._nextTop,this._isActive&&(this._isActive=!1,Ot(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},oe.prototype._setupAnimation=function(){var t=this._item;if(void 0===t._tX||void 0===t._tY){var e=qt(t._element);t._tX=e.x,t._tY=e.y}},oe.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings,i=this._animOptions.duration<=0;this._updateOffsets();var s=Math.abs(t._left-(t._tX-this._offsetLeft)),n=Math.abs(t._top-(t._tY-this._offsetTop));if(i||s<2&&n<2)return(s||n||this._isInterrupted)&&t._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._isInterrupted||_t(t._element,e.itemPositioningClass),this._currentStyles[mt]=se(t._tX,t._tY),this._targetStyles[mt]=se(this._nextLeft,this._nextTop),t._tX=t._tY=void 0,this._animation.start(this._currentStyles,this._targetStyles,this._animOptions)},he.prototype.start=function(t,e,i){if(!this._isDestroyed){var s,n,r,o,h,a,l,_,d,u,c=this._item,f=c._element,p=c.isActive(),m=c.isVisible(),g=c.getGrid(),v=g._settings,y=t._settings,S=t._element,w=t._items,D=g._items.indexOf(c),b=i||document.body;if("number"==typeof e)s=ct(w,e,1);else{if(!(n=t.getItem(e)))return;s=w.indexOf(n)}(c.isPositioning()||this._isActive||c.isReleasing())&&(l=(a=qt(f)).x,_=a.y),c.isPositioning()&&c._layout.stop(!0,l,_),this._isActive&&(l-=this._containerDiffX,_-=this._containerDiffY,this.stop(!0,l,_)),c.isReleasing()&&(l-=c._dragRelease._containerDiffX,_-=c._dragRelease._containerDiffY,c._dragRelease.stop(!0,l,_)),c._visibility.stop(!0),c._drag&&c._drag.destroy(),g._hasListeners("beforeSend")&&g._emit("beforeSend",{item:c,fromGrid:g,fromIndex:D,toGrid:t,toIndex:s}),t._hasListeners("beforeReceive")&&t._emit("beforeReceive",{item:c,fromGrid:g,fromIndex:D,toGrid:t,toIndex:s}),v.itemClass!==y.itemClass&&(Ot(f,v.itemClass),_t(f,y.itemClass)),(d=m?v.itemVisibleClass:v.itemHiddenClass)!==(u=m?y.itemVisibleClass:y.itemHiddenClass)&&(Ot(f,d),_t(f,u)),g._items.splice(D,1),ut(w,c,s),c._gridId=t._id,p?b!==(r=f.parentNode)&&(b.appendChild(f),o=Rt(b,r,!0),a||(l=(a=qt(f)).x,_=a.y),c._setTranslate(l+o.left,_+o.top)):S.appendChild(f),c._visibility.setStyles(m?y.visibleStyles:y.hiddenStyles),p&&(h=Rt(b,S,!0)),c._refreshDimensions(),c._sortData=null,c._drag=y.dragEnabled?new zt(c):null,p?(this._isActive=!0,this._container=b,this._containerDiffX=h.left,this._containerDiffY=h.top):(this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0),g._hasListeners("send")&&g._emit("send",{item:c,fromGrid:g,fromIndex:D,toGrid:t,toIndex:s}),t._hasListeners("receive")&&t._emit("receive",{item:c,fromGrid:g,fromIndex:D,toGrid:t,toIndex:s})}},he.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s,n=this._item,r=n._element,o=n.getGrid()._element;this._container!==o&&(void 0!==e&&void 0!==i||(t?(e=(s=qt(r)).x-this._containerDiffX,i=s.y-this._containerDiffY):(e=n._left,i=n._top)),o.appendChild(r),n._setTranslate(e,i)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0}},he.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},ae.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=C(e)?e:null,r=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),Ot(s,r.itemHiddenClass),_t(s,r.itemVisibleClass),this._isHiding||(s.style.display="")),n&&i._emitter.on(this._queue,n),this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},ae.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=C(e)?e:null,r=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),_t(s,r.itemHiddenClass),Ot(s,r.itemVisibleClass)),n&&i._emitter.on(this._queue,n),this._isHidden=this._isHiding=!0,this._isShowing=!1,this._startAnimation(!1,t,this._finishHide)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},ae.prototype.stop=function(t){if(!this._isDestroyed&&(this._isHiding||this._isShowing)){var e=this._item;E(e._id),this._animation.stop(),t&&e._emitter.burst(this._queue,!0,e)}},ae.prototype.setStyles=function(t){var e=this._childElement,i=this._currentStyleProps;for(var s in this._removeCurrentStyles(),t)i.push(s),e.style[s]=t[s]},ae.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item,e=t._element,i=t.getGrid()._settings;this.stop(!0),t._emitter.clear(this._queue),this._animation.destroy(),this._removeCurrentStyles(),Ot(e,i.itemVisibleClass),Ot(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},ae.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,r=this._animation,o=this._childElement,h=n.getGrid()._settings,a=t?h.visibleStyles:h.hiddenStyles,l=t?h.showDuration:h.hideDuration,_=t?h.showEasing:h.hideEasing,d=e||l<=0;if(a){if(E(n._id),d)return Zt(o,a),r.stop(),void(i&&i());var u,c,f;r.isAnimating()&&(r._animation.onfinish=null),u=n._id,c=function(){s=Vt(o,a)},f=function(){r.start(s,a,{duration:l,easing:_,onFinish:i})},b.add(0,"visibilityRead"+u,c),b.add(2,"visibilityWrite"+u,f)}else i&&i()}},ae.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},ae.prototype._finishHide=function(){if(this._isHidden){var t=this._item;this._isHiding=!1,t._layout.stop(!0,0,0),t._element.style.display="none",t._emitter.burst(this._queue,!1,t)}},ae.prototype._removeCurrentStyles=function(){for(var t=this._childElement,e=this._currentStyleProps,i=0;i<e.length;i++)t.style[e[i]]="";e.length=0};var le=0;function _e(){return++le}function de(t,i,s){var n=t._settings;if(e){if(e.has(i))throw new Error("You can only create one Muuri Item per element!");e.set(i,this)}this._id=_e(),this._gridId=t._id,this._element=i,this._isDestroyed=!1,this._left=0,this._top=0,this._width=0,this._height=0,this._marginLeft=0,this._marginRight=0,this._marginTop=0,this._marginBottom=0,this._tX=void 0,this._tY=void 0,this._sortData=null,this._emitter=new r,i.parentNode!==t._element&&t._element.appendChild(i),_t(i,n.itemClass),"boolean"!=typeof s&&(s="none"!==O(i,"display")),this._isActive=s,this._visibility=new ae(this),this._layout=new oe(this),this._migrate=new he(this),this._drag=n.dragEnabled?new zt(this):null,this._dragRelease=new re(this),this._dragPlaceholder=new ne(this)}function ue(t){var e,i,s,n,r,o=.001;function h(t){return((1e3*t+.5<<0)/10<<0)/100}function a(){this.currentRects=[],this.nextRects=[],this.rectTarget={},this.rectStore=[],this.slotSizes=[],this.rectId=0,this.slotIndex=-1,this.slotData={left:0,top:0,width:0,height:0},this.sortRectsLeftTop=this.sortRectsLeftTop.bind(this),this.sortRectsTopLeft=this.sortRectsTopLeft.bind(this)}if(a.prototype.computeLayout=function(t,e){var i,s,n,r,o,a,l=t.items,_=t.slots,d=!!(1&e),u=!!(2&e),c=!!(4&e),f=!!(8&e),p=!!(16&e),m="number"==typeof l[0];if(!l.length)return t;for(s=m?2:1,i=0;i<l.length;i+=s)m?(r=l[i],o=l[i+1]):(r=(n=l[i])._width+n._marginLeft+n._marginRight,o=n._height+n._marginTop+n._marginBottom),p&&(r=h(r),o=h(o)),a=this.computeNextSlot(t,r,o,d,u),u?a.left+a.width>t.width&&(t.width=a.left+a.width):a.top+a.height>t.height&&(t.height=a.top+a.height),_[++this.slotIndex]=a.left,_[++this.slotIndex]=a.top,(c||f)&&this.slotSizes.push(a.width,a.height);if(c)for(i=0;i<_.length;i+=2)_[i]=t.width-(_[i]+this.slotSizes[i]);if(f)for(i=1;i<_.length;i+=2)_[i]=t.height-(_[i]+this.slotSizes[i]);return this.slotSizes.length=0,this.currentRects.length=0,this.nextRects.length=0,this.rectId=0,this.slotIndex=-1,t},a.prototype.computeNextSlot=function(t,e,i,s,n){var r,h,a,l,_,d=this.slotData,u=this.currentRects,c=this.nextRects,f=!1;for(c.length=0,d.left=null,d.top=null,d.width=e,d.height=i,l=0;l<u.length;l++)if((h=u[l])&&(r=this.getRect(h),d.width<=r.width+o&&d.height<=r.height+o)){d.left=r.left,d.top=r.top;break}if(null===d.left&&(n?(d.left=t.width,d.top=0):(d.left=0,d.top=t.height),s||(f=!0)),!n&&d.top+d.height>t.height+o&&(d.left>.5&&c.push(this.addRect(0,t.height,d.left,1/0)),d.left+d.width<t.width-.5&&c.push(this.addRect(d.left+d.width,t.height,t.width-d.left-d.width,1/0)),t.height=d.top+d.height),n&&d.left+d.width>t.width+o&&(d.top>.5&&c.push(this.addRect(t.width,0,1/0,d.top)),d.top+d.height<t.height-.5&&c.push(this.addRect(t.width,d.top+d.height,1/0,t.height-d.top-d.height)),t.width=d.left+d.width),!f)for(s&&(l=0);l<u.length;l++)if(h=u[l])for(r=this.getRect(h),a=this.splitRect(r,d),_=0;_<a.length;_++)h=a[_],r=this.getRect(h),(n?r.left+o<t.width-o:r.top+o<t.height-o)&&c.push(h);return c.length>1&&this.purgeRects(c).sort(n?this.sortRectsLeftTop:this.sortRectsTopLeft),this.currentRects=c,this.nextRects=u,d},a.prototype.addRect=function(t,e,i,s){var n=++this.rectId;return this.rectStore[n]=t||0,this.rectStore[++this.rectId]=e||0,this.rectStore[++this.rectId]=i||0,this.rectStore[++this.rectId]=s||0,n},a.prototype.getRect=function(t,e){return e||(e=this.rectTarget),e.left=this.rectStore[t]||0,e.top=this.rectStore[++t]||0,e.width=this.rectStore[++t]||0,e.height=this.rectStore[++t]||0,e},a.prototype.splitRect=(e=[],i=0,s=0,function(t,n){return e.length=0,t.left+t.width<=n.left+o||n.left+n.width<=t.left+o||t.top+t.height<=n.top+o||n.top+n.height<=t.top+o?(e.push(this.addRect(t.left,t.top,t.width,t.height)),e):((i=n.left-t.left)>=.5&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(n.left+n.width))>=.5&&e.push(this.addRect(n.left+n.width,t.top,i,t.height)),(s=n.top-t.top)>=.5&&e.push(this.addRect(t.left,t.top,t.width,s)),(s=t.top+t.height-(n.top+n.height))>=.5&&e.push(this.addRect(t.left,n.top+n.height,t.width,s)),e)}),a.prototype.isRectAWithinRectB=function(t,e){return t.left+o>=e.left&&t.top+o>=e.top&&t.left+t.width-o<=e.left+e.width&&t.top+t.height-o<=e.top+e.height},a.prototype.purgeRects=(n={},r={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this.getRect(t[i],n);e--;)if(t[e]&&i!==e&&(this.getRect(t[e],r),this.isRectAWithinRectB(n,r))){t[i]=0;break}return t}),a.prototype.sortRectsTopLeft=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.top<e.top&&t.top+o<e.top?-1:t.top>e.top&&t.top-o>e.top?1:t.left<e.left&&t.left+o<e.left?-1:t.left>e.left&&t.left-o>e.left?1:0}}(),a.prototype.sortRectsLeftTop=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.left<e.left&&t.left+o<e.left?-1:t.left>e.left&&t.left-o<e.left?1:t.top<e.top&&t.top+o<e.top?-1:t.top>e.top&&t.top-o>e.top?1:0}}(),t){var l=new a;self.onmessage=function(t){var e=new Float32Array(t.data),i=e.subarray(4,e.length),s=new Float32Array(i.length),n=e[3],r={items:i,slots:s,width:e[1],height:e[2]};l.computeLayout(r,n),e[1]=r.width,e[2]=r.height,e.set(r.slots,4),postMessage(e.buffer,[e.buffer])}}return a}de.prototype.getGrid=function(){return t[this._gridId]},de.prototype.getElement=function(){return this._element},de.prototype.getWidth=function(){return this._width},de.prototype.getHeight=function(){return this._height},de.prototype.getMargin=function(){return{left:this._marginLeft,right:this._marginRight,top:this._marginTop,bottom:this._marginBottom}},de.prototype.getPosition=function(){return{left:this._left,top:this._top}},de.prototype.isActive=function(){return this._isActive},de.prototype.isVisible=function(){return!!this._visibility&&!this._visibility._isHidden},de.prototype.isShowing=function(){return!(!this._visibility||!this._visibility._isShowing)},de.prototype.isHiding=function(){return!(!this._visibility||!this._visibility._isHiding)},de.prototype.isPositioning=function(){return!(!this._layout||!this._layout._isActive)},de.prototype.isDragging=function(){return!(!this._drag||!this._drag._isActive)},de.prototype.isReleasing=function(){return!(!this._dragRelease||!this._dragRelease._isActive)},de.prototype.isDestroyed=function(){return this._isDestroyed},de.prototype._refreshDimensions=function(t){if(!(this._isDestroyed||!0!==t&&this._visibility._isHidden)){var e=this._element,i=this._dragPlaceholder,s=e.getBoundingClientRect();this._width=s.width,this._height=s.height,this._marginLeft=Math.max(0,H(e,"margin-left")),this._marginRight=Math.max(0,H(e,"margin-right")),this._marginTop=Math.max(0,H(e,"margin-top")),this._marginBottom=Math.max(0,H(e,"margin-bottom")),i&&i.updateDimensions()}},de.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},de.prototype._addToLayout=function(t,e){!0!==this._isActive&&(this._isActive=!0,this._left=t||0,this._top=e||0)},de.prototype._removeFromLayout=function(){!1!==this._isActive&&(this._isActive=!1,this._left=0,this._top=0)},de.prototype._canSkipLayout=function(t,e){return this._left===t&&this._top===e&&!this._migrate._isActive&&!this._layout._skipNextAnimation&&!this._dragRelease.isJustReleased()},de.prototype._setTranslate=function(t,e){return(this._tX!==t||this._tY!==e)&&(this._tX=t,this._tY=e,this._element.style[mt]=se(t,e),!0)},de.prototype._destroy=function(t){if(!this._isDestroyed){var i=this._element,s=this.getGrid()._settings;this._dragPlaceholder.destroy(),this._dragRelease.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._drag&&this._drag.destroy(),this._emitter.destroy(),Ot(i,s.itemClass),t&&i.parentNode.removeChild(i),e&&e.delete(i),this._isActive=!1,this._isDestroyed=!0}};var ce=ue(),fe=null,pe=[];function me(t,e){if(this._options=0,this._processor=null,this._layoutQueue=[],this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={},this._workers=[],this._onWorkerMessage=this._onWorkerMessage.bind(this),this.setOptions(e),(t="number"==typeof t?Math.max(0,t):0)&&window.Worker&&window.URL&&window.Blob)try{this._workers=function(t,e){var i=[];if(t>0){fe||(fe=URL.createObjectURL(new Blob(["("+ue.toString()+")(true)"],{type:"application/javascript"})));for(var s,n=0;n<t;n++)s=new Worker(fe),e&&(s.onmessage=e),i.push(s),pe.push(s)}return i}(t,this._onWorkerMessage)}catch(t){this._processor=new ce}else this._processor=new ce}me.prototype._sendToWorker=function(){if(this._layoutQueue.length&&this._workers.length){var t=this._layoutQueue.shift(),e=this._workers.pop(),i=this._layoutWorkerData[t];delete this._layoutWorkerData[t],this._layoutWorkers[t]=e,e.postMessage(i.buffer,[i.buffer])}},me.prototype._onWorkerMessage=function(t){var e=new Float32Array(t.data),i=e[0],s=this._layouts[i],n=this._layoutCallbacks[i],r=this._layoutWorkers[i];s&&delete this._layoutCallbacks[i],n&&delete this._layoutCallbacks[i],r&&delete this._layoutWorkers[i],s&&n&&(s.width=e[1],s.height=e[2],s.slots=e.subarray(4,e.length),this._finalizeLayout(s),n(s)),r&&(this._workers.push(r),this._sendToWorker())},me.prototype._finalizeLayout=function(t){var e=t._grid,i=2&t._settings,s="border-box"===e._boxSizing;return delete t._grid,delete t._settings,t.styles={},i?t.styles.width=(s?t.width+e._borderLeft+e._borderRight:t.width)+"px":t.styles.height=(s?t.height+e._borderTop+e._borderBottom:t.height)+"px",t},me.prototype.setOptions=function(t){var e,i,s,n,r;t&&(e="boolean"==typeof t.fillGaps?t.fillGaps?1:0:1&this._options,i="boolean"==typeof t.horizontal?t.horizontal?2:0:2&this._options,s="boolean"==typeof t.alignRight?t.alignRight?4:0:4&this._options,n="boolean"==typeof t.alignBottom?t.alignBottom?8:0:8&this._options,r="boolean"==typeof t.rounding?t.rounding?16:0:16&this._options,this._options=e|i|s|n|r)},me.prototype.createLayout=function(t,e,i,s,n,r){if(this._layouts[e])throw new Error("A layout with the provided id is currently being processed.");var o=2&this._options,h={id:e,items:i,slots:null,width:o?0:s,height:o?n:0,_grid:t,_settings:this._options};if(!i.length)return h.slots=[],this._finalizeLayout(h),void r(h);if(this._processor)return h.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(h,h._settings),this._finalizeLayout(h),void r(h);var a,l,_,d=new Float32Array(4+2*i.length);for(d[0]=e,d[1]=h.width,d[2]=h.height,d[3]=h._settings,a=0,l=3;a<i.length;a++)_=i[a],d[++l]=_._width+_._marginLeft+_._marginRight,d[++l]=_._height+_._marginTop+_._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=h,this._layoutCallbacks[e]=r,this._layoutWorkerData[e]=d,this._sendToWorker(),this.cancelLayout.bind(this,e)},me.prototype.cancelLayout=function(t){if(this._layouts[t]&&(delete this._layouts[t],delete this._layoutCallbacks[t],this._layoutWorkerData[t])){delete this._layoutWorkerData[t];var e=this._layoutQueue.indexOf(t);e>-1&&this._layoutQueue.splice(e,1)}},me.prototype.destroy=function(){for(var t in this._layoutWorkers)this._workers.push(this._layoutWorkers[t]);!function(t){for(var e,i,s=0;s<t.length;s++)(e=t[s]).onmessage=null,e.onerror=null,e.onmessageerror=null,e.terminate(),(i=pe.indexOf(e))>-1&&pe.splice(i,1);fe&&!pe.length&&(URL.revokeObjectURL(fe),fe=null)}(this._workers),this._workers.length=0,this._layoutQueue.length=0,this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={}};var ge=0;function ve(t,e){var i=++ge,s=0,n=0,r=!1,o=function(e){r||(n&&(s-=e-n),n=e,s>0?function(t,e){b.add(0,"debounceRead"+t,e)}(i,o):(s=n=0,t()))};return function(h){if(!r){if(!(e<=0))return!0===h?(r=!0,s=n=0,o=void 0,void function(t){b.remove(0,"debounceRead"+t)}(i)):void(s<=0?(s=e,o(0)):s=e);!0!==h&&t()}}}function ye(t){var e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e}var Se=Object.prototype.toString;function we(t){return"object"==typeof t&&"[object Object]"===Se.call(t)}function De(){}var be,Ae=0;function Ee(e,i){if("string"==typeof e&&(e=document.querySelector(e)),!(e.getRootNode?e.getRootNode({composed:!0})===document:document.body.contains(e))||e===document.documentElement)throw new Error("Container element must be an existing DOM element.");var s=function(t,e){var i=Te({},t);e&&(i=Te(i,e));e&&e.visibleStyles?i.visibleStyles=e.visibleStyles:t&&t.visibleStyles&&(i.visibleStyles=t.visibleStyles);e&&e.hiddenStyles?i.hiddenStyles=e.hiddenStyles:t&&t.hiddenStyles&&(i.hiddenStyles=t.hiddenStyles);return i}(Ee.defaultOptions,i);s.visibleStyles=xe(s.visibleStyles),s.hiddenStyles=xe(s.hiddenStyles),C(s.dragSort)||(s.dragSort=!!s.dragSort),this._id=_e(),this._element=e,this._settings=s,this._isDestroyed=!1,this._items=[],this._layout={id:0,items:[],slots:[]},this._isLayoutFinished=!0,this._nextLayoutData=null,this._emitter=new r,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),t[this._id]=this,_t(e,s.containerClass),function(t,e){"number"!=typeof e&&(e=!0===e?0:-1);e>=0&&(t._resizeHandler=ve((function(){t.refreshItems().layout()}),e),window.addEventListener("resize",t._resizeHandler))}(this,s.layoutOnResize),this.add(function(t,e){if("*"===e)return t.children;if("string"==typeof e){for(var i=[],s=t.children,n=0;n<s.length;n++)lt(s[n],e)&&i.push(s[n]);return i}if(Array.isArray(e)||ye(e))return e;return[]}(e,s.items),{layout:!1}),s.layoutOnInit&&this.layout(!0)}function Te(t,e){var i,s,n,r=Object.keys(e),o=r.length;for(n=0;n<o;n++)i=we(e[s=r[n]]),we(t[s])&&i?t[s]=Te(Te({},t[s]),e[s]):i?t[s]=Te({},e[s]):Array.isArray(e[s])?t[s]=e[s].slice(0):t[s]=e[s];return t}function xe(t){var e,i,s={},n=document.documentElement.style;for(e in t)t[e]&&(i=_(n,e))&&(s[i]=t[e]);return s}function Re(t){for(var e={},i=0;i<t.length;i++)e[t[i]._id]=i;return e}function ke(t,e,i){return t[e._id]-t[i._id]}return Ee.Item=de,Ee.ItemLayout=oe,Ee.ItemVisibility=ae,Ee.ItemMigrate=he,Ee.ItemDrag=zt,Ee.ItemDragRelease=re,Ee.ItemDragPlaceholder=ne,Ee.Emitter=r,Ee.Animator=ee,Ee.Dragger=y,Ee.Packer=me,Ee.AutoScroller=ot,Ee.defaultPacker=new me(2),Ee.defaultOptions={items:"*",showDuration:300,showEasing:"ease",hideDuration:300,hideEasing:"ease",visibleStyles:{opacity:"1",transform:"scale(1)"},hiddenStyles:{opacity:"0",transform:"scale(0.5)"},layout:{fillGaps:!1,horizontal:!1,alignRight:!1,alignBottom:!1,rounding:!1},layoutOnResize:150,layoutOnInit:!0,layoutDuration:300,layoutEasing:"ease",sortData:null,dragEnabled:!1,dragContainer:null,dragHandle:null,dragStartPredicate:{distance:0,delay:0},dragAxis:"xy",dragSort:!0,dragSortHeuristics:{sortInterval:100,minDragDistance:10,minBounceBackAngle:1},dragSortPredicate:{threshold:50,action:"move",migrateAction:"move"},dragRelease:{duration:300,easing:"ease",useDragContainer:!0},dragCssProps:{touchAction:"none",userSelect:"none",userDrag:"none",tapHighlightColor:"rgba(0, 0, 0, 0)",touchCallout:"none",contentZooming:"none"},dragPlaceholder:{enabled:!1,createElement:null,onCreate:null,onRemove:null},dragAutoScroll:{targets:[],handle:null,threshold:50,safeZone:.2,speed:ot.smoothSpeed(1e3,2e3,2500),sortDuringScroll:!0,smoothStop:!1,onStart:null,onStop:null},containerClass:"muuri",itemClass:"muuri-item",itemVisibleClass:"muuri-item-shown",itemHiddenClass:"muuri-item-hidden",itemPositioningClass:"muuri-item-positioning",itemDraggingClass:"muuri-item-dragging",itemReleasingClass:"muuri-item-releasing",itemPlaceholderClass:"muuri-item-placeholder"},Ee.prototype.on=function(t,e){return this._emitter.on(t,e),this},Ee.prototype.off=function(t,e){return this._emitter.off(t,e),this},Ee.prototype.getElement=function(){return this._element},Ee.prototype.getItem=function(t){if(this._isDestroyed||!t&&0!==t)return null;if("number"==typeof t)return this._items[t>-1?t:this._items.length+t]||null;if(t instanceof de)return t._gridId===this._id?t:null;if(e){var i=e.get(t);return i&&i._gridId===this._id?i:null}for(var s=0;s<this._items.length;s++)if(this._items[s]._element===t)return this._items[s];return null},Ee.prototype.getItems=function(t){if(this._isDestroyed||void 0===t)return this._items.slice(0);var e,i,s=[];if(Array.isArray(t)||ye(t))for(e=0;e<t.length;e++)(i=this.getItem(t[e]))&&s.push(i);else(i=this.getItem(t))&&s.push(i);return s},Ee.prototype.refreshItems=function(t,e){if(this._isDestroyed)return this;var i,s,n,r,o=t||this._items;if(!0===e)for(r=[],i=0;i<o.length;i++)(s=o[i]).isVisible()||s.isHiding()||((n=s.getElement().style).visibility="hidden",n.display="",r.push(n));for(i=0;i<o.length;i++)o[i]._refreshDimensions(e);if(!0===e){for(i=0;i<r.length;i++)(n=r[i]).visibility="",n.display="none";r.length=0}return this},Ee.prototype.refreshSortData=function(t){if(this._isDestroyed)return this;for(var e=t||this._items,i=0;i<e.length;i++)e[i]._refreshSortData();return this},Ee.prototype.synchronize=function(){if(this._isDestroyed)return this;var t,e,i=this._items;if(!i.length)return this;for(var s=0;s<i.length;s++)(e=i[s]._element).parentNode===this._element&&(t=t||document.createDocumentFragment()).appendChild(e);return t?(this._element.appendChild(t),this._emit("synchronize"),this):this},Ee.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&C(i.cancel)&&i.cancel();var s=Ae=Ae%16777216+1;this._nextLayoutData={id:s,instant:t,onFinish:e,cancel:null};for(var n=this._items,r=[],o=0;o<n.length;o++)n[o]._isActive&&r.push(n[o]);this._refreshDimensions();var h,a=this._width-this._borderLeft-this._borderRight,l=this._height-this._borderTop-this._borderBottom,_=this._settings.layout;return C(_)?h=_(this,s,r,a,l,this._onLayoutDataReceived):(Ee.defaultPacker.setOptions(_),h=Ee.defaultPacker.createLayout(this,s,r,a,l,this._onLayoutDataReceived)),C(h)&&this._nextLayoutData&&this._nextLayoutData.id===s&&(this._nextLayoutData.cancel=h),this},Ee.prototype.add=function(t,e){if(this._isDestroyed||!t)return[];var i,s=ye(i=t)?Array.prototype.slice.call(i):Array.prototype.concat(i);if(!s.length)return s;var n,r,o,h,a=e||{},l=a.layout?a.layout:void 0===a.layout,_=this._items,d=!1;for(h=0;h<s.length;h++)(r=s[h]).parentNode!==this._element&&(n=n||document.createDocumentFragment()).appendChild(r);for(n&&this._element.appendChild(n),h=0;h<s.length;h++)r=s[h],(o=s[h]=new de(this,r,a.active))._isActive&&(d=!0,o._layout._skipNextAnimation=!0);for(h=0;h<s.length;h++)(o=s[h])._refreshDimensions(),o._refreshSortData();return ut(_,s,a.index),this._hasListeners("add")&&this._emit("add",s.slice(0)),d&&l&&this.layout("instant"===l,C(l)?l:void 0),s},Ee.prototype.remove=function(t,e){if(this._isDestroyed||!t.length)return[];var i,s,n,r=e||{},o=r.layout?r.layout:void 0===r.layout,h=!1,a=this.getItems(),l=[],_=[];for(n=0;n<t.length;n++)(s=t[n])._isDestroyed||-1!==(i=this._items.indexOf(s))&&(s._isActive&&(h=!0),l.push(s),_.push(a.indexOf(s)),s._destroy(r.removeElements),this._items.splice(i,1));return this._hasListeners("remove")&&this._emit("remove",l.slice(0),_),h&&o&&this.layout("instant"===o,C(o)?o:void 0),l},Ee.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},Ee.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},Ee.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,s,n=[],r=[],o="string"==typeof t,h=C(t),a=e||{},l=!0===a.instant,_=a.syncWithLayout,d=a.layout?a.layout:void 0===a.layout,u=C(a.onFinish)?a.onFinish:null,c=-1,f=De;if(u&&(f=function(){++c&&u(n.slice(0),r.slice(0))}),h||o)for(s=0;s<this._items.length;s++)i=this._items[s],(h?t(i):lt(i._element,t))?n.push(i):r.push(i);return n.length?this.show(n,{instant:l,syncWithLayout:_,onFinish:f,layout:!1}):f(),r.length?this.hide(r,{instant:l,syncWithLayout:_,onFinish:f,layout:!1}):f(),(n.length||r.length)&&(this._hasListeners("filter")&&this._emit("filter",n.slice(0),r.slice(0)),d&&this.layout("instant"===d,C(d)?d:void 0)),this},Ee.prototype.sort=function(){var t,e,i,s;function n(n,r){for(var o,h,a,l,_=0,d=0;d<t.length;d++)if(o=t[d][0],h=t[d][1],a=(n._sortData?n:n._refreshSortData())._sortData[o],l=(r._sortData?r:r._refreshSortData())._sortData[o],_="desc"===h||!h&&e?l<a?-1:l>a?1:0:a<l?-1:a>l?1:0)return _;return _||(s||(s=Re(i)),_=e?ke(s,r,n):ke(s,n,r)),_}function r(n,r){var o=e?-t(n,r):t(n,r);return o||(s||(s=Re(i)),o=e?ke(s,r,n):ke(s,n,r)),o}return function(o,h){if(this._isDestroyed||this._items.length<2)return this;var a=this._items,l=h||{},_=l.layout?l.layout:void 0===l.layout;if(e=!!l.descending,i=a.slice(0),s=null,C(o))t=o,a.sort(r);else if("string"==typeof o)t=o.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),a.sort(n);else{if(!Array.isArray(o))throw t=e=i=s=null,new Error("Invalid comparer argument provided.");a.length=0,a.push.apply(a,o)}return this._hasListeners("sort")&&this._emit("sort",a.slice(0),i),_&&this.layout("instant"===_,C(_)?_:void 0),t=e=i=s=null,this}}(),Ee.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var s,n,r=this._items,o=i||{},h=o.layout?o.layout:void 0===o.layout,a="swap"===o.action,l=a?"swap":"move",_=this.getItem(t),d=this.getItem(e);return _&&d&&_!==d&&(s=r.indexOf(_),n=r.indexOf(d),a?pt(r,s,n):ft(r,s,n),this._hasListeners("move")&&this._emit("move",{item:_,fromIndex:s,toIndex:n,action:l}),h&&this.layout("instant"===h,C(h)?h:void 0)),this},Ee.prototype.send=function(t,e,i,s){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this.getItem(t)))return this;var n=s||{},r=n.appendTo||document.body,o=n.layoutSender?n.layoutSender:void 0===n.layoutSender,h=n.layoutReceiver?n.layoutReceiver:void 0===n.layoutReceiver;return t._migrate.start(e,i,r),t._migrate._isActive&&t._isActive&&(o&&this.layout("instant"===o,C(o)?o:void 0),h&&e.layout("instant"===h,C(h)?h:void 0)),this},Ee.prototype.destroy=function(e){if(this._isDestroyed)return this;var i,s,n,r=this._element,o=this._items.slice(0),h=this._layout&&this._layout.styles||{};for((n=this)._resizeHandler&&(n._resizeHandler(!0),window.removeEventListener("resize",n._resizeHandler),n._resizeHandler=null),i=0;i<o.length;i++)o[i]._destroy(e);for(s in this._items.length=0,Ot(r,this._settings.containerClass),h)r.style[s]="";return this._emit("destroy"),this._emitter.destroy(),delete t[this._id],this._isDestroyed=!0,this},Ee.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},Ee.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},Ee.prototype._updateBoundingRect=function(){var t=this._element.getBoundingClientRect();this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top,this._right=t.right,this._bottom=t.bottom},Ee.prototype._updateBorders=function(t,e,i,s){var n=this._element;t&&(this._borderLeft=H(n,"border-left-width")),e&&(this._borderRight=H(n,"border-right-width")),i&&(this._borderTop=H(n,"border-top-width")),s&&(this._borderBottom=H(n,"border-bottom-width"))},Ee.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=O(this._element,"box-sizing")},Ee.prototype._onLayoutDataReceived=(be=[],function(t){if(!this._isDestroyed&&this._nextLayoutData&&this._nextLayoutData.id===t.id){var e,i,s,n,r=this,o=this._nextLayoutData.instant,h=this._nextLayoutData.onFinish,a=t.items.length,l=a;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners("layoutAbort")&&this._emit("layoutAbort",this._layout.items.slice(0)),this._layout=t,be.length=0,n=0;n<a;n++)(e=t.items[n])?(i=t.slots[2*n],s=t.slots[2*n+1],e._canSkipLayout(i,s)?--l:(e._left=i,e._top=s,e.isActive()&&!e.isDragging()?be.push(e):--l)):--l;if(t.styles&&Zt(this._element,t.styles),!this._hasListeners("layoutStart")||(this._emit("layoutStart",t.items.slice(0),!0===o),this._layout.id===t.id)){var _=function(){if(!(--l>0)){var e=r._layout.id!==t.id,i=C(o)?o:h;e||(r._isLayoutFinished=!0),C(i)&&i(t.items.slice(0),e),!e&&r._hasListeners("layoutEnd")&&r._emit("layoutEnd",t.items.slice(0))}};if(!be.length)return _(),this;for(this._isLayoutFinished=!1,n=0;n<be.length&&this._layout.id===t.id;n++)be[n]._layout.start(!0===o,_);return this._layout.id===t.id&&(be.length=0),this}}}),Ee.prototype._setItemsVisibility=function(t,e,i){var s,n,r=this,o=t.slice(0),h=i||{},a=!0===h.instant,l=h.onFinish,_=h.layout?h.layout:void 0===h.layout,d=o.length,u=e?"showStart":"hideStart",c=e?"showEnd":"hideEnd",f=e?"show":"hide",p=!1,m=[],g=[];if(d){for(n=0;n<o.length;n++)s=o[n],(e&&!s._isActive||!e&&s._isActive)&&(p=!0),s._layout._skipNextAnimation=!(!e||s._isActive),e&&s._visibility._isHidden&&g.push(s),e?s._addToLayout():s._removeFromLayout();g.length&&(this.refreshItems(g,!0),g.length=0),p&&!1!==h.syncWithLayout?this.on("layoutStart",v):v(),p&&_&&this.layout("instant"===_,C(_)?_:void 0)}else C(l)&&l(o);function v(){for(p&&!1!==h.syncWithLayout&&r.off("layoutStart",v),r._hasListeners(u)&&r._emit(u,o.slice(0)),n=0;n<o.length;n++)o[n]._gridId===r._id?o[n]._visibility[f](a,(function(t,e){t||m.push(e),--d<1&&(C(l)&&l(m.slice(0)),r._hasListeners(c)&&r._emit(c,m.slice(0)))})):--d<1&&(C(l)&&l(m.slice(0)),r._hasListeners(c)&&r._emit(c,m.slice(0)))}},Ee})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Muuri=e()}(this,(function(){"use strict";var t={},e="function"==typeof Map?new Map:null,i="swap",s="move",n="layoutStart",o="layoutEnd",r="layoutAbort",h="remove",a="hideStart",_="filter",l="sort",d="move",u="send",c="beforeSend",f="receive",p="beforeReceive",m="dragReleaseEnd",g="ontouchstart"in window,v=!!window.PointerEvent,y=!!window.navigator.msPointerEnabled;function S(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}S.prototype.on=function(t,e){if(!this._events||!t||!e)return this;var i=this._events[t];return i||(i=this._events[t]=[]),i.push(e),this},S.prototype.off=function(t,e){if(!this._events||!t||!e)return this;var i,s=this._events[t];if(!s||!s.length)return this;for(;-1!==(i=s.indexOf(e));)s.splice(i,1);return this},S.prototype.clear=function(t){if(!this._events||!t)return this;var e=this._events[t];return e&&(e.length=0,delete this._events[t]),this},S.prototype.emit=function(t){if(!this._events||!t)return this._clearOnEmit=!1,this;var e=this._events[t];if(!e||!e.length)return this._clearOnEmit=!1,this;var i,s=this._queue,n=s.length,o=arguments.length-1;o>3&&((i=[]).push.apply(i,arguments),i.shift()),s.push.apply(s,e),this._clearOnEmit&&(e.length=0,this._clearOnEmit=!1),++this._counter;for(var r=n,h=s.length;r<h;r++)if(0===o?s[r]():1===o?s[r](arguments[1]):2===o?s[r](arguments[1],arguments[2]):3===o?s[r](arguments[1],arguments[2],arguments[3]):s[r].apply(null,i),!this._events)return this;return--this._counter,this._counter||(s.length=0),this},S.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},S.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},S.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var w=v?"pointerout":y?"MSPointerOut":"";function D(t){w&&(this._dragger=t,this._timeout=null,this._outEvent=null,this._isActive=!1,this._addBehaviour=this._addBehaviour.bind(this),this._removeBehaviour=this._removeBehaviour.bind(this),this._onTimeout=this._onTimeout.bind(this),this._resetData=this._resetData.bind(this),this._onStart=this._onStart.bind(this),this._onOut=this._onOut.bind(this),this._dragger.on("start",this._onStart))}D.prototype._addBehaviour=function(){this._isActive||(this._isActive=!0,this._dragger.on("move",this._resetData),this._dragger.on("cancel",this._removeBehaviour),this._dragger.on("end",this._removeBehaviour),window.addEventListener(w,this._onOut))},D.prototype._removeBehaviour=function(){this._isActive&&(this._dragger.off("move",this._resetData),this._dragger.off("cancel",this._removeBehaviour),this._dragger.off("end",this._removeBehaviour),window.removeEventListener(w,this._onOut),this._resetData(),this._isActive=!1)},D.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},D.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},D.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},D.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},D.prototype.destroy=function(){w&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var b=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],A={};function E(t,e){var i=A[e]||"";if(i)return i;for(var s=e[0].toUpperCase()+e.slice(1),n=0;n<b.length;){if((i=b[n]?b[n]+s:e)in t)return A[e]=i,i;++n}return""}function T(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t}var x=window.navigator.userAgent.toLowerCase(),k=x.indexOf("edge")>-1,L=x.indexOf("trident")>-1,R=x.indexOf("firefox")>-1,I=x.indexOf("android")>-1,C=!!T()&&{passive:!0},M="touchAction",P=E(document.documentElement.style,M);function X(t,e){this._element=t,this._emitter=new S,this._isDestroyed=!1,this._cssProps={},this._touchAction="",this._isActive=!1,this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),this._edgeHack=null,(k||L)&&(v||y)&&(this._edgeHack=new D(this)),this.setCssProps(e),this._touchAction||this.setTouchAction("auto"),t.addEventListener("dragstart",X._preventDefault,!1),t.addEventListener(X._inputEvents.start,this._onStart,C)}X._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},X._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},X._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},X._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},X._inputEvents=g?X._touchEvents:v?X._pointerEvents:y?X._msPointerEvents:X._mouseEvents,X._emitter=new S,X._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},X._activeInstances=[],X._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},X._activateInstance=function(t){X._activeInstances.indexOf(t)>-1||(X._activeInstances.push(t),X._emitter.on(X._emitterEvents.move,t._onMove),X._emitter.on(X._emitterEvents.cancel,t._onCancel),X._emitter.on(X._emitterEvents.end,t._onEnd),1===X._activeInstances.length&&X._bindListeners())},X._deactivateInstance=function(t){var e=X._activeInstances.indexOf(t);-1!==e&&(X._activeInstances.splice(e,1),X._emitter.off(X._emitterEvents.move,t._onMove),X._emitter.off(X._emitterEvents.cancel,t._onCancel),X._emitter.off(X._emitterEvents.end,t._onEnd),X._activeInstances.length||X._unbindListeners())},X._bindListeners=function(){window.addEventListener(X._inputEvents.move,X._onMove,C),window.addEventListener(X._inputEvents.end,X._onEnd,C),X._inputEvents.cancel&&window.addEventListener(X._inputEvents.cancel,X._onCancel,C)},X._unbindListeners=function(){window.removeEventListener(X._inputEvents.move,X._onMove,C),window.removeEventListener(X._inputEvents.end,X._onEnd,C),X._inputEvents.cancel&&window.removeEventListener(X._inputEvents.cancel,X._onCancel,C)},X._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},X._getTouchById=function(t,e){if("number"==typeof t.pointerId)return t.pointerId===e?t:null;if(t.changedTouches){for(var i=0;i<t.changedTouches.length;i++)if(t.changedTouches[i].identifier===e)return t.changedTouches[i];return null}return t},X._onMove=function(t){X._emitter.emit(X._emitterEvents.move,t)},X._onCancel=function(t){X._emitter.emit(X._emitterEvents.cancel,t)},X._onEnd=function(t){X._emitter.emit(X._emitterEvents.end,t)},X.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,X._deactivateInstance(this)},X.prototype._createEvent=function(t,e){var i=this._getTrackedTouch(e);return{type:t,srcEvent:e,distance:this.getDistance(),deltaX:this.getDeltaX(),deltaY:this.getDeltaY(),deltaTime:t===X._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===X._emitterEvents.start,isFinal:t===X._emitterEvents.end||t===X._emitterEvents.cancel,pointerType:e.pointerType||(e.touches?"touch":"mouse"),identifier:this._pointerId,screenX:i.screenX,screenY:i.screenY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,target:i.target}},X.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},X.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:X._getTouchById(t,this._pointerId)},X.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=X._getEventPointerId(t),null!==this._pointerId)){var e=this._getTrackedTouch(t);this._startX=this._currentX=e.clientX,this._startY=this._currentY=e.clientY,this._startTime=Date.now(),this._isActive=!0,this._emit(X._emitterEvents.start,t),this._isActive&&X._activateInstance(this)}},X.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(X._emitterEvents.move,t))},X.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(X._emitterEvents.cancel,t),this._reset())},X.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(X._emitterEvents.end,t),this._reset())},X.prototype.isActive=function(){return this._isActive},X.prototype.setTouchAction=function(t){this._touchAction=t,P&&(this._cssProps[P]="",this._element.style[P]=t),g&&(this._element.removeEventListener(X._touchEvents.start,X._preventDefault,!0),(this._element.style[P]!==t||R&&I)&&this._element.addEventListener(X._touchEvents.start,X._preventDefault,!0))},X.prototype.setCssProps=function(t){if(t){var e,i,s=this._cssProps,n=this._element;for(e in s)n.style[e]=s[e],delete s[e];for(e in t)t[e]&&(e!==M?(i=E(n.style,e))&&(s[i]="",n.style[i]=t[e]):this.setTouchAction(t[e]))}},X.prototype.getDeltaX=function(){return this._currentX-this._startX},X.prototype.getDeltaY=function(){return this._currentY-this._startY},X.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},X.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},X.prototype.on=function(t,e){this._emitter.on(t,e)},X.prototype.off=function(t,e){this._emitter.off(t,e)},X.prototype.destroy=function(){if(!this._isDestroyed){var t=this._element;for(var e in this._edgeHack&&this._edgeHack.destroy(),this._reset(),this._emitter.destroy(),t.removeEventListener(X._inputEvents.start,this._onStart,C),t.removeEventListener("dragstart",X._preventDefault,!1),t.removeEventListener(X._touchEvents.start,X._preventDefault,!0),this._cssProps)t.style[e]=this._cssProps[e],delete this._cssProps[e];this._element=null,this._isDestroyed=!0}};var Y=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return this.setTimeout((function(){t(Date.now())}),16.666666666666668)}).bind(window);function q(t){this._nextStep=null,this._lanes=[],this._stepQueue=[],this._stepCallbacks={},this._step=this._step.bind(this);for(var e=0;e<t;e++)this._lanes.push(new O)}function O(){this.queue=[],this.indices={},this.callbacks={}}q.prototype._step=function(t){var e,i,s,n,o,r,h=this._lanes,a=this._stepQueue,_=this._stepCallbacks;for(this._nextStep=null,e=0;e<h.length;e++){for(n=h[e].queue,o=h[e].callbacks,r=h[e].indices,i=0;i<n.length;i++)(s=n[i])&&(a.push(s),_[s]=o[s],delete o[s],delete r[s]);n.length=0}for(e=0;e<a.length;e++)_[s=a[e]]&&_[s](t),delete _[s];a.length=0},q.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=Y(this._step))},q.prototype.remove=function(t,e){this._lanes[t].remove(e)},O.prototype.add=function(t,e){var i=this.indices[t];void 0!==i&&(this.queue[i]=void 0),this.queue.push(t),this.callbacks[t]=e,this.indices[t]=this.queue.length-1},O.prototype.remove=function(t){var e=this.indices[t];void 0!==e&&(this.queue[e]=void 0,delete this.callbacks[t],delete this.indices[t])};var H="layoutRead",G="layoutWrite",W="visibilityRead",B="visibilityWrite",N="dragStartRead",F="dragStartWrite",z="dragMoveRead",V="dragMoveWrite",j="dragScrollRead",Q="dragScrollWrite",U="dragSortRead",Z="placeholderLayoutRead",J="placeholderLayoutWrite",$="placeholderResizeWrite",K="autoScrollRead",tt="autoScrollWrite",et="debounceRead",it=new q(3);function st(t){it.remove(0,H+t),it.remove(2,G+t)}function nt(t){it.remove(0,W+t),it.remove(2,B+t)}function ot(t){it.remove(0,N+t),it.remove(2,F+t)}function rt(t){it.remove(0,z+t),it.remove(2,V+t)}function ht(t){it.remove(0,j+t),it.remove(2,Q+t)}function at(t,e){it.add(1,U+t,e)}function _t(t){it.remove(0,Z+t),it.remove(2,J+t)}function lt(t,e){it.add(0,K,t),it.add(2,tt,e)}function dt(t){return"function"==typeof t}var ut="function"==typeof WeakMap?new WeakMap:null;function ct(t,e){var i=ut&&ut.get(t);return i||(i=window.getComputedStyle(t,null),ut&&ut.set(t,i)),i.getPropertyValue(e)}function ft(t,e){return parseFloat(ct(t,e))||0}var pt,mt=document.documentElement,gt=document.body,vt={value:0,offset:0};function yt(t){return t===window||t===mt||t===gt?window:t}function St(t){return t===window?t.pageXOffset:t.scrollLeft}function wt(t){return t===window?t.pageYOffset:t.scrollTop}function Dt(t){return t===window?mt.scrollWidth-mt.clientWidth:t.scrollWidth-t.clientWidth}function bt(t){return t===window?mt.scrollHeight-mt.clientHeight:t.scrollHeight-t.clientHeight}function At(t,e){if(e=e||{},t===window)e.width=mt.clientWidth,e.height=mt.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),s=t.clientLeft||ft(t,"border-left-width"),n=t.clientTop||ft(t,"border-top-width");e.width=t.clientWidth,e.height=t.clientHeight,e.left=i.left+s,e.right=e.left+e.width,e.top=i.top+n,e.bottom=e.top+e.height}return e}function Et(t){return t._drag._getGrid()._settings.dragAutoScroll}function Tt(t){if(t._drag&&t._isActive){var e=t._drag;e._scrollDiffX=e._scrollDiffY=0,t._setTranslate(e._left,e._top)}}function xt(t,e,i,s){return vt.value=Math.min(s/2,t),vt.offset=Math.max(0,i+2*vt.value+s*e-s)/2,vt}function kt(){this.reset()}function Lt(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}function Rt(t,e){this.pool=[],this.createItem=t,this.releaseItem=e}function It(t,e){var i=function(t,e){return function(t,e){return!(t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top)}(t,e)?(Math.min(t.left+t.width,e.left+e.width)-Math.max(t.left,e.left))*(Math.min(t.top+t.height,e.top+e.height)-Math.max(t.top,e.top)):0}(t,e);return i?i/(Math.min(t.width,e.width)*Math.min(t.height,e.height))*100:0}kt.prototype.reset=function(){this.isActive&&this.onStop(),this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=null,this.value=null,this.maxValue=0,this.threshold=0,this.distance=0,this.speed=0,this.duration=0,this.action=null},kt.prototype.hasReachedEnd=function(){return 4&this.direction?this.value>=this.maxValue:this.value<=0},kt.prototype.computeCurrentScrollValue=function(){return null===this.value?1&this.direction?St(this.element):wt(this.element):Math.max(0,Math.min(this.value,this.maxValue))},kt.prototype.computeNextScrollValue=function(t){var e=this.speed*(t/1e3),i=4&this.direction?this.value+e:this.value-e;return Math.max(0,Math.min(i,this.maxValue))},kt.prototype.computeSpeed=(pt={direction:null,threshold:0,distance:0,value:0,maxValue:0,deltaTime:0,duration:0,isEnding:!1},function(t){var e=this.item,i=Et(e).speed;return dt(i)?(pt.direction=this.direction,pt.threshold=this.threshold,pt.distance=this.distance,pt.value=this.value,pt.maxValue=this.maxValue,pt.duration=this.duration,pt.speed=this.speed,pt.deltaTime=t,pt.isEnding=this.isEnding,i(e,this.element,pt)):i}),kt.prototype.tick=function(t){return this.isActive||(this.isActive=!0,this.onStart()),this.value=this.computeCurrentScrollValue(),this.speed=this.computeSpeed(t),this.value=this.computeNextScrollValue(t),this.duration+=t,this.value},kt.prototype.onStart=function(){var t=this.item,e=Et(t).onStart;dt(e)&&e(t,this.element,this.direction)},kt.prototype.onStop=function(){var t=this.item,e=Et(t).onStop;dt(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},Lt.prototype.reset=function(){this.requestX&&(this.requestX.action=null),this.requestY&&(this.requestY.action=null),this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0},Lt.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},Lt.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},Lt.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:St(this.element),this.scrollTop=this.requestY?this.requestY.value:wt(this.element)},Lt.prototype.scroll=function(){var t=this.element;t&&(t.scrollTo?t.scrollTo(this.scrollLeft,this.scrollTop):(t.scrollLeft=this.scrollLeft,t.scrollTop=this.scrollTop))},Rt.prototype.pick=function(){return this.pool.pop()||this.createItem()},Rt.prototype.release=function(t){this.releaseItem(t),-1===this.pool.indexOf(t)&&this.pool.push(t)},Rt.prototype.reset=function(){this.pool.length=0};var Ct={width:0,height:0,left:0,right:0,top:0,bottom:0},Mt={width:0,height:0,left:0,right:0,top:0,bottom:0};function Pt(){this._isDestroyed=!1,this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,this._items=[],this._actions=[],this._requests={},this._requests[1]={},this._requests[2]={},this._requestOverlapCheck={},this._dragPositions={},this._dragDirections={},this._overlapCheckInterval=150,this._requestPool=new Rt((function(){return new kt}),(function(t){t.reset()})),this._actionPool=new Rt((function(){return new Lt}),(function(t){t.reset()})),this._readTick=this._readTick.bind(this),this._writeTick=this._writeTick.bind(this)}Pt.AXIS_X=1,Pt.AXIS_Y=2,Pt.FORWARD=4,Pt.BACKWARD=8,Pt.LEFT=9,Pt.RIGHT=5,Pt.UP=10,Pt.DOWN=6,Pt.smoothSpeed=function(t,e,i){return function(s,n,o){var r=0;if(!o.isEnding)if(o.threshold>0){var h=o.threshold-Math.max(0,o.distance);r=t/o.threshold*h}else r=t;var a=o.speed,_=r;return a===r?_:a<r?(_=a+e*(o.deltaTime/1e3),Math.min(r,_)):(_=a-i*(o.deltaTime/1e3),Math.max(r,_))}},Pt.pointerHandle=function(t){var e={left:0,top:0,width:0,height:0},i=t||1;return function(t,s,n,o,r,h,a){return e.left=h-.5*i,e.top=a-.5*i,e.width=i,e.height=i,e}},Pt.prototype._readTick=function(t){this._isDestroyed||(t&&this._tickTime?(this._tickDeltaTime=t-this._tickTime,this._tickTime=t,this._updateRequests(),this._updateActions()):(this._tickTime=t,this._tickDeltaTime=0))},Pt.prototype._writeTick=function(){this._isDestroyed||(this._applyActions(),lt(this._readTick,this._writeTick))},Pt.prototype._startTicking=function(){this._isTicking=!0,lt(this._readTick,this._writeTick)},Pt.prototype._stopTicking=function(){this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,it.remove(0,K),it.remove(2,tt)},Pt.prototype._getItemHandleRect=function(t,e,i){var s=t._drag;if(e){var n=s._dragMoveEvent||s._dragStartEvent,o=e(t,s._clientX,s._clientY,t._width,t._height,n.clientX,n.clientY);i.left=o.left,i.top=o.top,i.width=o.width,i.height=o.height}else i.left=s._clientX,i.top=s._clientY,i.width=t._width,i.height=t._height;return i.right=i.left+i.width,i.bottom=i.top+i.height,i},Pt.prototype._requestItemScroll=function(t,e,i,s,n,o,r){var h=this._requests[e],a=h[t._id];a?a.element===i&&a.direction===s||a.reset():a=this._requestPool.pick(),a.item=t,a.element=i,a.direction=s,a.threshold=n,a.distance=o,a.maxValue=r,h[t._id]=a},Pt.prototype._cancelItemScroll=function(t,e){var i=this._requests[e],s=i[t._id];s&&(s.action&&s.action.removeRequest(s),this._requestPool.release(s),delete i[t._id])},Pt.prototype._checkItemOverlap=function(t,e,i){var s=Et(t),n=dt(s.targets)?s.targets(t):s.targets,o=s.threshold,r=s.safeZone;if(!n||!n.length)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));var h=this._dragDirections[t._id],a=h[0],_=h[1];if(!a&&!_)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var l=this._getItemHandleRect(t,s.handle,Ct),d=Mt,u=null,c=null,f=!0,p=!0,m=0,g=0,v=null,y=null,S=0,w=0,D=0,b=null,A=-1/0,E=0,T=0,x=null,k=0,L=0,R=null,I=-1/0,C=0,M=0,P=null,X=0,Y=0,q=0;q<n.length;q++)u=n[q],f=e&&a&&2!==u.axis,p=i&&_&&1!==u.axis,g=u.priority||0,(!f||g<A)&&(!p||g<I)||(c=yt(u.element||u),w=f?Dt(c):-1,D=p?bt(c):-1,(w||D)&&((m=It(l,d=At(c,d)))<=0||(f&&g>=A&&w>0&&(g>A||m>T)&&(y=null,v=xt("number"==typeof u.threshold?u.threshold:o,r,l.width,d.width),5===a?(S=d.right+v.offset-l.right)<=v.value&&St(c)<w&&(y=5):9===a&&(S=l.left-(d.left-v.offset))<=v.value&&St(c)>0&&(y=9),null!==y&&(b=c,A=g,E=v.value,T=m,x=y,k=S,L=w)),p&&g>=I&&D>0&&(g>I||m>M)&&(y=null,v=xt("number"==typeof u.threshold?u.threshold:o,r,l.height,d.height),6===_?(S=d.bottom+v.offset-l.bottom)<=v.value&&wt(c)<D&&(y=6):10===_&&(S=l.top-(d.top-v.offset))<=v.value&&wt(c)>0&&(y=10),null!==y&&(R=c,I=g,C=v.value,M=m,P=y,X=S,Y=D)))));e&&(b?this._requestItemScroll(t,1,b,x,E,k,L):this._cancelItemScroll(t,1)),i&&(R?this._requestItemScroll(t,2,R,P,C,X,Y):this._cancelItemScroll(t,2))},Pt.prototype._updateScrollRequest=function(t){for(var e=t.item,i=Et(e),s=dt(i.targets)?i.targets(e):i.targets,n=s&&s.length||0,o=i.threshold,r=i.safeZone,h=this._getItemHandleRect(e,i.handle,Ct),a=Mt,_=null,l=null,d=!1,u=null,c=null,f=null,p=null,m=null,g=0;g<n;g++)if((l=yt((_=s[g]).element||_))===t.element){if(d=!!(1&t.direction)){if(2===_.axis)continue}else if(1===_.axis)continue;if((p=d?Dt(l):bt(l))<=0)break;if(It(h,a=At(l,a))<=0)break;if(u=xt("number"==typeof _.threshold?_.threshold:o,r,d?h.width:h.height,d?a.width:a.height),(c=9===t.direction?h.left-(a.left-u.offset):5===t.direction?a.right+u.offset-h.right:10===t.direction?h.top-(a.top-u.offset):a.bottom+u.offset-h.bottom)>u.value)break;if(f=d?St(l):wt(l),m=4&t.direction?f>=p:f<=0)break;return t.maxValue=p,t.threshold=u.value,t.distance=c,t.isEnding=!1,!0}return!0===i.smoothStop&&t.speed>0?(null===m&&(m=t.hasReachedEnd()),t.isEnding=!m):t.isEnding=!1,t.isEnding},Pt.prototype._updateRequests=function(){for(var t,e,i,s,n,o,r,h=this._items,a=this._requests[1],_=this._requests[2],l=0;l<h.length;l++)t=h[l],n=(s=this._requestOverlapCheck[t._id])>0&&this._tickTime-s>this._overlapCheckInterval,o=!0,(e=a[t._id])&&e.isActive&&(o=!this._updateScrollRequest(e))&&(n=!0,this._cancelItemScroll(t,1)),r=!0,(i=_[t._id])&&i.isActive&&(r=!this._updateScrollRequest(i))&&(n=!0,this._cancelItemScroll(t,2)),n&&(this._requestOverlapCheck[t._id]=0,this._checkItemOverlap(t,o,r))},Pt.prototype._requestAction=function(t,e){for(var i=this._actions,s=1===e,n=null,o=0;o<i.length;o++){if(n=i[o],t.element===n.element){if(s?n.requestX:n.requestY)return void this._cancelItemScroll(t.item,e);break}n=null}n||(n=this._actionPool.pick()),n.element=t.element,n.addRequest(t),t.tick(this._tickDeltaTime),i.push(n)},Pt.prototype._updateActions=function(){var t,e,i,s,n=this._items,o=this._requests,r=this._actions;for(s=0;s<n.length;s++)t=n[s]._id,e=o[1][t],i=o[2][t],e&&this._requestAction(e,1),i&&this._requestAction(i,2);for(s=0;s<r.length;s++)r[s].computeScrollValues()},Pt.prototype._applyActions=function(){var t,e=this._actions,i=this._items;if(e.length){for(t=0;t<e.length;t++)e[t].scroll(),this._actionPool.release(e[t]);for(e.length=0,t=0;t<i.length;t++)(s=i[t])._drag&&s._drag._prepareScroll();var s;for(t=0;t<i.length;t++)Tt(i[t])}},Pt.prototype._updateDragDirection=function(t){var e=this._dragPositions[t._id],i=this._dragDirections[t._id],s=t._drag._left,n=t._drag._top;if(e.length){var o=e[0],r=e[1];i[0]=s>o?5:s<o?9:i[0]||0,i[1]=n>r?6:n<r?10:i[1]||0}e[0]=s,e[1]=n},Pt.prototype.addItem=function(t){this._isDestroyed||-1===this._items.indexOf(t)&&(this._items.push(t),this._requestOverlapCheck[t._id]=this._tickTime,this._dragDirections[t._id]=[0,0],this._dragPositions[t._id]=[],this._isTicking||this._startTicking())},Pt.prototype.updateItem=function(t){this._isDestroyed||this._dragDirections[t._id]&&(this._updateDragDirection(t),this._requestOverlapCheck[t._id]||(this._requestOverlapCheck[t._id]=this._tickTime))},Pt.prototype.removeItem=function(t){if(!this._isDestroyed){var e=this._items.indexOf(t);if(-1!==e){var i=t._id;this._requests[1][i]&&(this._cancelItemScroll(t,1),delete this._requests[1][i]),this._requests[2][i]&&(this._cancelItemScroll(t,2),delete this._requests[2][i]),delete this._requestOverlapCheck[i],delete this._dragPositions[i],delete this._dragDirections[i],this._items.splice(e,1),this._isTicking&&!this._items.length&&this._stopTicking()}}},Pt.prototype.isItemScrollingX=function(t){var e=this._requests[1][t._id];return!(!e||!e.isActive)},Pt.prototype.isItemScrollingY=function(t){var e=this._requests[2][t._id];return!(!e||!e.isActive)},Pt.prototype.isItemScrolling=function(t){return this.isItemScrollingX(t)||this.isItemScrollingY(t)},Pt.prototype.destroy=function(){if(!this._isDestroyed){for(var t=this._items.slice(0),e=0;e<t.length;e++)this.removeItem(t[e]);this._actions.length=0,this._requestPool.reset(),this._actionPool.reset(),this._isDestroyed=!0}};var Xt=window.Element.prototype,Yt=Xt.matches||Xt.matchesSelector||Xt.webkitMatchesSelector||Xt.mozMatchesSelector||Xt.msMatchesSelector||Xt.oMatchesSelector||function(){return!1};function qt(t,e){return Yt.call(t,e)}function Ot(t,e){e&&(t.classList?t.classList.add(e):qt(t,"."+e)||(t.className+=" "+e))}var Ht=[];function Gt(t,e,i){var s="number"==typeof i?i:-1;s<0&&(s=t.length-s+1),t.splice.apply(t,Ht.concat(s,0,e)),Ht.length=0}function Wt(t,e,i){var s=Math.max(0,t.length-1+(i||0));return e>s?s:e<0?Math.max(s+e+1,0):e}function Bt(t,e,i){if(!(t.length<2)){var s=Wt(t,e),n=Wt(t,i);s!==n&&t.splice(n,0,t.splice(s,1)[0])}}function Nt(t,e,i){if(!(t.length<2)){var s,n=Wt(t,e),o=Wt(t,i);n!==o&&(s=t[n],t[n]=t[o],t[o]=s)}}var Ft=E(document.documentElement.style,"transform")||"transform",zt=/([A-Z])/g,Vt=/^(webkit-|moz-|ms-|o-)/,jt=/^(-m-s-)/;function Qt(t){var e=t.replace(zt,"-$1").toLowerCase();return e=(e=e.replace(Vt,"-$1")).replace(jt,"-ms-")}var Ut=Qt(Ft);function Zt(t){var e=ct(t,Ut);if(!e||"none"===e)return!1;var i=ct(t,"display");return"inline"!==i&&"none"!==i}function Jt(t){for(var e=document,i=t||e;i&&i!==e&&"static"===ct(i,"position")&&!Zt(i);)i=i.parentElement||e;return i}var $t={},Kt={},te={};function ee(t,e){var i,s=e||{};return s.left=0,s.top=0,t===document?s:(s.left=window.pageXOffset||0,s.top=window.pageYOffset||0,t.self===window.self||(i=t.getBoundingClientRect(),s.left+=i.left,s.top+=i.top,s.left+=ft(t,"border-left-width"),s.top+=ft(t,"border-top-width")),s)}function ie(t,e,i){return te.left=0,te.top=0,t===e||i&&(t=Jt(t))===(e=Jt(e))||(ee(t,$t),ee(e,Kt),te.left=Kt.left-$t.left,te.top=Kt.top-$t.top),te}function se(t){return"auto"===t||"scroll"===t||"overlay"===t}function ne(t){return se(ct(t,"overflow"))||se(ct(t,"overflow-x"))||se(ct(t,"overflow-y"))}function oe(t,e){for(e=e||[];t&&t!==document;)t.getRootNode&&t instanceof DocumentFragment?t=t.getRootNode().host:(ne(t)&&e.push(t),t=t.parentNode);return e.push(window),e}var re={},he=/^matrix3d/,ae=/([^,]*,){4}/,_e=/([^,]*,){12}/,le=/[^,]*,/;function de(t){re.x=0,re.y=0;var e=ct(t,Ut);if(!e||"none"===e)return re;var i=he.test(e),s=e.replace(i?_e:ae,""),n=s.replace(le,"");return re.x=parseFloat(s)||0,re.y=parseFloat(n)||0,re}function ue(t,e){e&&(t.classList?t.classList.remove(e):qt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var ce,fe,pe,me,ge=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,ve=!!T()&&{passive:!0};function ye(t){var e=t._element,i=t.getGrid(),s=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=dt(s.dragStartPredicate)?s.dragStartPredicate:ye.defaultStartPredicate,this._startPredicateState=0,this._startPredicateResult=void 0,this._isSortNeeded=!1,this._sortTimer=void 0,this._blockedSortIndex=null,this._sortX1=0,this._sortX2=0,this._sortY1=0,this._sortY2=0,this._reset(),this._preStartCheck=this._preStartCheck.bind(this),this._preEndCheck=this._preEndCheck.bind(this),this._onScroll=this._onScroll.bind(this),this._prepareStart=this._prepareStart.bind(this),this._applyStart=this._applyStart.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._prepareScroll=this._prepareScroll.bind(this),this._applyScroll=this._applyScroll.bind(this),this._handleSort=this._handleSort.bind(this),this._handleSortDelayed=this._handleSortDelayed.bind(this),this._handle=s.dragHandle&&e.querySelector(s.dragHandle)||e,this._dragger=new X(this._handle,s.dragCssProps),this._dragger.on("start",this._preStartCheck),this._dragger.on("move",this._preStartCheck),this._dragger.on("cancel",this._preEndCheck),this._dragger.on("end",this._preEndCheck)}function Se(t,e){var i,s,n={};if(Array.isArray(e))for(s=0;s<e.length;s++)n[i=e[s]]=ct(t,Qt(i));else for(i in e)n[i]=ct(t,Qt(i));return n}ye.autoScroller=new Pt,ye.defaultStartPredicate=function(t,e,i){var s=t._drag;if(e.isFirst&&e.srcEvent.button)return!1;if(!ge&&e.isFirst&&!0===e.srcEvent.isTrusted&&!1===e.srcEvent.defaultPrevented&&!1===e.srcEvent.cancelable)return!1;if(!e.isFinal){var n=s._startPredicateData;if(!n){var o=i||s._getGrid()._settings.dragStartPredicate||{};s._startPredicateData=n={distance:Math.max(o.distance,0)||0,delay:Math.max(o.delay,0)||0}}return n.delay&&(n.event=e,n.delayTimer||(n.delayTimer=window.setTimeout((function(){n.delay=0,s._resolveStartPredicate(n.event)&&(s._forceResolveStartPredicate(n.event),s._resetStartPredicate())}),n.delay))),s._resolveStartPredicate(e)}s._finishStartPredicate(e)},ye.defaultSortPredicate=(ce={},fe={},pe={},me=[],function(t,e){var n=t._drag,o=n._getGrid(),r=e&&"number"==typeof e.threshold?e.threshold:50,h=e&&e.action===i?i:s,a=e&&e.migrateAction===i?i:s;r=Math.min(Math.max(r,1),100),ce.width=t._width,ce.height=t._height,ce.left=n._clientX,ce.top=n._clientY;var _=function(t,e,i){var s,n,o,r,h,a,_,l,d,u,c=null,f=e._settings.dragSort,p=-1;if(!0===f?(me[0]=e,n=me):dt(f)&&(n=f.call(e,t)),!n||!Array.isArray(n)||!n.length)return c;for(u=0;u<n.length;u++)if(!(o=n[u])._isDestroyed){for(o._updateBoundingRect(),a=Math.max(0,o._left),_=Math.max(0,o._top),l=Math.min(window.innerWidth,o._right),d=Math.min(window.innerHeight,o._bottom),r=o._element.parentNode;r&&r!==document&&r!==document.documentElement&&r!==document.body;)if(r.getRootNode&&r instanceof DocumentFragment)r=r.getRootNode().host;else{if("visible"!==ct(r,"overflow")&&(h=r.getBoundingClientRect(),a=Math.max(a,h.left),_=Math.max(_,h.top),l=Math.min(l,h.right),d=Math.min(d,h.bottom)),"fixed"===ct(r,"position"))break;r=r.parentNode}a>=l||_>=d||(fe.left=a,fe.top=_,fe.width=l-a,fe.height=d-_,(s=It(ce,fe))>i&&s>p&&(p=s,c=o))}return me.length=0,c}(t,o,r);if(!_)return null;var l,d,u,c=t.getGrid()!==_,f=0,p=0,m=0,g=-1,v=!1;for(_===o?(ce.left=n._gridX+t._marginLeft,ce.top=n._gridY+t._marginTop):(_._updateBorders(1,0,1,0),f=_._left+_._borderLeft,p=_._top+_._borderTop),u=0;u<_._items.length;u++)(l=_._items[u])._isActive&&l!==t&&(v=!0,fe.width=l._width,fe.height=l._height,fe.left=l._left+l._marginLeft+f,fe.top=l._top+l._marginTop+p,(d=It(ce,fe))>m&&(g=u,m=d));return c&&m<r&&(g=v?g:0,m=r),m>=r?(pe.grid=_,pe.index=g,pe.action=c?a:h,pe):null}),ye.prototype.stop=function(){if(this._isActive)if(this._isMigrating)this._finishMigration();else{var t=this._item,e=t._id;if(ye.autoScroller.removeItem(t),ot(e),rt(e),ht(e),this._cancelSort(),this._isStarted){this._unbindScrollListeners();var i=t._element,s=this._getGrid(),n=s._settings.itemDraggingClass;i.parentNode!==s._element&&(s._element.appendChild(i),t._setTranslate(this._gridX,this._gridY),n&&i.clientWidth),ue(i,n)}this._reset()}},ye.prototype.sort=function(t){var e=this._item;this._isActive&&e._isActive&&this._dragMoveEvent&&(!0===t?this._handleSort():at(e._id,this._handleSort))},ye.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._dragger.destroy(),ye.autoScroller.removeItem(this._item),this._isDestroyed=!0)},ye.prototype._getGrid=function(){return t[this._gridId]||null},ye.prototype._reset=function(){this._isActive=!1,this._isStarted=!1,this._container=null,this._containingBlock=null,this._dragStartEvent=null,this._dragMoveEvent=null,this._dragPrevMoveEvent=null,this._scrollEvent=null,this._scrollers=[],this._left=0,this._top=0,this._gridX=0,this._gridY=0,this._clientX=0,this._clientY=0,this._scrollDiffX=0,this._scrollDiffY=0,this._moveDiffX=0,this._moveDiffY=0,this._containerDiffX=0,this._containerDiffY=0},ye.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,s=this._container,n=this._scrollers;if(n.length=0,oe(this._item._element.parentNode,n),s!==i)for(oe(i,t=[]),e=0;e<t.length;e++)n.indexOf(t[e])<0&&n.push(t[e]);for(e=0;e<n.length;e++)n[e].addEventListener("scroll",this._onScroll,ve)},ye.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,ve);e.length=0},ye.prototype._resolveStartPredicate=function(t){var e=this._startPredicateData;if(!(t.distance<e.distance||e.delay))return this._resetStartPredicate(),!0},ye.prototype._forceResolveStartPredicate=function(t){this._isDestroyed||1!==this._startPredicateState||(this._startPredicateState=2,this._onStart(t))},ye.prototype._finishStartPredicate=function(t){var e=this._item._element,i=Math.abs(t.deltaX)<2&&Math.abs(t.deltaY)<2&&t.deltaTime<200;this._resetStartPredicate(),i&&function(t){if("a"!==t.tagName.toLowerCase())return;var e=t.getAttribute("href");if(!e)return;var i=t.getAttribute("target");i&&"_self"!==i?window.open(e,i):window.location.href=e}(e)},ye.prototype._resetHeuristics=function(t,e){this._blockedSortIndex=null,this._sortX1=this._sortX2=t,this._sortY1=this._sortY2=e},ye.prototype._checkHeuristics=function(t,e){var i=this._getGrid()._settings.dragSortHeuristics,s=i.minDragDistance;if(s<=0)return this._blockedSortIndex=null,!0;var n=t-this._sortX2,o=e-this._sortY2,r=s>3&&i.minBounceBackAngle>0;if(r||(this._blockedSortIndex=null),Math.abs(n)>s||Math.abs(o)>s){if(r){var h=Math.atan2(n,o),a=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),_=Math.atan2(Math.sin(h-a),Math.cos(h-a));Math.abs(_)>i.minBounceBackAngle&&(this._blockedSortIndex=null)}return this._sortX1=this._sortX2,this._sortY1=this._sortY2,this._sortX2=t,this._sortY2=e,!0}return!1},ye.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},ye.prototype._handleSort=function(){if(this._isActive){var t=this._getGrid()._settings;if(!t.dragSort||!t.dragAutoScroll.sortDuringScroll&&ye.autoScroller.isItemScrolling(this._item))return this._sortX1=this._sortX2=this._gridX,this._sortY1=this._sortY2=this._gridY,this._isSortNeeded=!0,void(void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)));var e=this._checkHeuristics(this._gridX,this._gridY);if(this._isSortNeeded||e){var i=t.dragSortHeuristics.sortInterval;i<=0||this._isSortNeeded?(this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),this._checkOverlap()):void 0===this._sortTimer&&(this._sortTimer=window.setTimeout(this._handleSortDelayed,i))}}},ye.prototype._handleSortDelayed=function(){this._isSortNeeded=!0,this._sortTimer=void 0,at(this._item._id,this._handleSort)},ye.prototype._cancelSort=function(){var t;this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),t=this._item._id,it.remove(1,U+t)},ye.prototype._finishSort=function(){var t=this._getGrid()._settings.dragSort&&(this._isSortNeeded||void 0!==this._sortTimer);this._cancelSort(),t&&this._checkOverlap()},ye.prototype._checkOverlap=function(){if(this._isActive){var t,e,n,o,r,h,a,_,l=this._item,m=this._getGrid()._settings;(t=dt(m.dragSortPredicate)?m.dragSortPredicate(l,this._dragMoveEvent):ye.defaultSortPredicate(l,m.dragSortPredicate))&&"number"==typeof t.index&&(a=t.action===i?i:s,_=(e=l.getGrid())!==(o=t.grid||e),n=e._items.indexOf(l),r=Wt(o._items,t.index,_&&a===s?1:0),(_||r!==this._blockedSortIndex)&&(_?(this._blockedSortIndex=null,h=o._items[r],e._hasListeners(c)&&e._emit(c,{item:l,fromGrid:e,fromIndex:n,toGrid:o,toIndex:r}),o._hasListeners(p)&&o._emit(p,{item:l,fromGrid:e,fromIndex:n,toGrid:o,toIndex:r}),l._gridId=o._id,this._isMigrating=l._gridId!==this._gridId,e._items.splice(n,1),Gt(o._items,l,r),l._sortData=null,e._hasListeners(u)&&e._emit(u,{item:l,fromGrid:e,fromIndex:n,toGrid:o,toIndex:r}),o._hasListeners(f)&&o._emit(f,{item:l,fromGrid:e,fromIndex:n,toGrid:o,toIndex:r}),a===i&&h&&h.isActive()&&o._items.indexOf(h)>-1&&o.send(h,e,n,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),o.layout()):n!==r&&(this._blockedSortIndex=n,(a===i?Nt:Bt)(e._items,n,r),e._hasListeners(d)&&e._emit(d,{item:l,fromIndex:n,toIndex:r,action:a}),e.layout())))}},ye.prototype._finishMigration=function(){var t,e,i=this._item,s=i._dragRelease,n=i._element,o=i._isActive,r=i.getGrid(),h=r._element,a=r._settings,_=a.dragContainer||h,l=this._getGrid()._settings,d=n.parentNode,u=o?l.itemVisibleClass:l.itemHiddenClass,c=o?a.itemVisibleClass:a.itemHiddenClass;this._isMigrating=!1,this.destroy(),l.itemClass!==a.itemClass&&(ue(n,l.itemClass),Ot(n,a.itemClass)),u!==c&&(ue(n,u),Ot(n,c)),_!==d&&(_.appendChild(n),e=ie(d,_,!0),(t=de(n)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=ie(_,h,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=a.dragEnabled?new ye(i):null,_!==d&&i._setTranslate(t.x,t.y),i._visibility.setStyles(o?a.visibleStyles:a.hiddenStyles),s.start()},ye.prototype._preStartCheck=function(t){0===this._startPredicateState&&(this._startPredicateState=1),1===this._startPredicateState?(this._startPredicateResult=this._startPredicate(this._item,t),!0===this._startPredicateResult?(this._startPredicateState=2,this._onStart(t)):!1===this._startPredicateResult&&(this._resetStartPredicate(t),this._dragger._reset(),this._startPredicateState=0)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},ye.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=0,e&&this._isActive&&(this._isStarted?this._onEnd(t):this.stop())},ye.prototype._onStart=function(t){var e,i,s,n=this._item;n._isActive&&(this._isActive=!0,this._dragStartEvent=t,ye.autoScroller.addItem(n),e=n._id,i=this._prepareStart,s=this._applyStart,it.add(0,N+e,i),it.add(2,F+e,s))},ye.prototype._prepareStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid(),s=i._settings,n=i._element,o=s.dragContainer||n,r=Jt(o),h=de(e),a=e.getBoundingClientRect(),_=o!==n;if(this._container=o,this._containingBlock=r,this._clientX=a.left,this._clientY=a.top,this._left=this._gridX=h.x,this._top=this._gridY=h.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),_){var l=ie(r,n);this._containerDiffX=l.left,this._containerDiffY=l.top}}}},ye.prototype._applyStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=this._getGrid(),i=t._element,s=t._dragRelease,n=t._migrate,o=this._container!==e._element;t.isPositioning()&&t._layout.stop(!0,this._left,this._top),n._isActive&&(this._left-=n._containerDiffX,this._top-=n._containerDiffY,this._gridX-=n._containerDiffX,this._gridY-=n._containerDiffY,n.stop(!0,this._left,this._top)),t.isReleasing()&&s._reset(),e._settings.dragPlaceholder.enabled&&t._dragPlaceholder.create(),this._isStarted=!0,e._emit("dragInit",t,this._dragStartEvent),o&&(i.parentNode===this._container?(this._gridX-=this._containerDiffX,this._gridY-=this._containerDiffY):(this._left+=this._containerDiffX,this._top+=this._containerDiffY,this._container.appendChild(i),t._setTranslate(this._left,this._top))),Ot(i,e._settings.itemDraggingClass),this._bindScrollListeners(),e._emit("dragStart",t,this._dragStartEvent)}}},ye.prototype._onMove=function(t){var e,i,s,n=this._item;n._isActive?(this._dragMoveEvent=t,e=n._id,i=this._prepareMove,s=this._applyMove,it.add(0,z+e,i),it.add(2,V+e,s),at(n._id,this._handleSort)):this.stop()},ye.prototype._prepareMove=function(){if(this._isActive&&this._item._isActive){var t=this._getGrid()._settings.dragAxis,e=this._dragMoveEvent,i=this._dragPrevMoveEvent||this._dragStartEvent||e;if("y"!==t){var s=e.clientX-i.clientX;this._left=this._left-this._moveDiffX+s,this._gridX=this._gridX-this._moveDiffX+s,this._clientX=this._clientX-this._moveDiffX+s,this._moveDiffX=s}if("x"!==t){var n=e.clientY-i.clientY;this._top=this._top-this._moveDiffY+n,this._gridY=this._gridY-this._moveDiffY+n,this._clientY=this._clientY-this._moveDiffY+n,this._moveDiffY=n}this._dragPrevMoveEvent=e}},ye.prototype._applyMove=function(){if(this._isActive){var t=this._item;t._isActive&&(this._moveDiffX=this._moveDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragMove",t,this._dragMoveEvent),ye.autoScroller.updateItem(t))}},ye.prototype._onScroll=function(t){var e,i,s,n=this._item;n._isActive?(this._scrollEvent=t,e=n._id,i=this._prepareScroll,s=this._applyScroll,it.add(0,j+e,i),it.add(2,Q+e,s),at(n._id,this._handleSort)):this.stop()},ye.prototype._prepareScroll=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid()._element,s=e.getBoundingClientRect();if(this._container!==i){var n=ie(this._containingBlock,i);this._containerDiffX=n.left,this._containerDiffY=n.top}var o=this._clientX-this._moveDiffX-s.left;this._left=this._left-this._scrollDiffX+o,this._scrollDiffX=o;var r=this._clientY-this._moveDiffY-s.top;this._top=this._top-this._scrollDiffY+r,this._scrollDiffY=r,this._gridX=this._left-this._containerDiffX,this._gridY=this._top-this._containerDiffY}}},ye.prototype._applyScroll=function(){if(this._isActive){var t=this._item;t._isActive&&(this._scrollDiffX=this._scrollDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragScroll",t,this._scrollEvent))}},ye.prototype._onEnd=function(t){var e=this._item,i=e._element,s=this._getGrid(),n=s._settings,o=e._dragRelease;e._isActive?(ot(e._id),rt(e._id),ht(e._id),this._finishSort(),this._unbindScrollListeners(),o._containerDiffX=this._containerDiffX,o._containerDiffY=this._containerDiffY,this._reset(),ue(i,n.itemDraggingClass),ye.autoScroller.removeItem(e),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():o.start()):this.stop()};var we=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,De={};function be(t){var e=De[t];return e||((e=t.replace(we,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),De[t]=e,e)}function Ae(t,e){for(var i in e)t.style[i]=e[i]}var Ee,Te,xe=!(!Element||!dt(Element.prototype.animate)),ke=!!(Element&&(Ee=Element.prototype.animate,Te=window.Symbol,Ee&&dt(Te)&&dt(Te.toString)&&Te(Ee).toString().indexOf("[native code]")>-1));function Le(t){this._element=t,this._animation=null,this._duration=0,this._easing="",this._callback=null,this._props=[],this._values=[],this._isDestroyed=!1,this._onFinish=this._onFinish.bind(this)}function Re(t,e){var i={};for(var s in t)i[e?s:be(s)]=t[s];return i}function Ie(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function Ce(t){this._item=t,this._animation=new Le,this._element=null,this._className="",this._didMigrate=!1,this._resetAfterLayout=!1,this._left=0,this._top=0,this._transX=0,this._transY=0,this._nextTransX=0,this._nextTransY=0,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this),this._updateDimensions=this._updateDimensions.bind(this),this._onLayoutStart=this._onLayoutStart.bind(this),this._onLayoutEnd=this._onLayoutEnd.bind(this),this._onReleaseEnd=this._onReleaseEnd.bind(this),this._onMigrate=this._onMigrate.bind(this),this._onHide=this._onHide.bind(this)}function Me(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}Le.prototype.start=function(t,e,i){if(!this._isDestroyed){var s=this._element,n=i||{};if(!xe)return Ae(s,e),this._callback=dt(n.onFinish)?n.onFinish:null,void this._onFinish();var o,r,h,a=this._animation,_=this._props,l=this._values,d=n.duration||300,u=n.easing||"ease",c=!1;if(a&&(r=0,d===this._duration&&u===this._easing||(c=!0),!c)){for(o in e)if(++r,-1===(h=_.indexOf(o))||e[o]!==l[h]){c=!0;break}r!==_.length&&(c=!0)}if(c&&a.cancel(),this._callback=dt(n.onFinish)?n.onFinish:null,!a||c){for(o in _.length=l.length=0,e)_.push(o),l.push(e[o]);this._duration=d,this._easing=u,this._animation=s.animate([Re(t,ke),Re(e,ke)],{duration:d,easing:u}),this._animation.onfinish=this._onFinish,Ae(s,e)}}},Le.prototype.stop=function(){!this._isDestroyed&&this._animation&&(this._animation.cancel(),this._animation=this._callback=null,this._props.length=this._values.length=0)},Le.prototype.getCurrentStyles=function(){return Se(element,currentProps)},Le.prototype.isAnimating=function(){return!!this._animation},Le.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=null,this._isDestroyed=!0)},Le.prototype._onFinish=function(){var t=this._callback;this._animation=this._callback=null,this._props.length=this._values.length=0,t&&t()},Ce.prototype._updateDimensions=function(){this.isActive()&&Ae(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},Ce.prototype._onLayoutStart=function(t,e){var i=this._item;if(-1!==t.indexOf(i)){var s=i._left,n=i._top,o=this._left,r=this._top;if(this._left=s,this._top=n,e||this._didMigrate||o!==s||r!==n){var h,a,_,l=s+i._marginLeft,d=n+i._marginTop,u=i.getGrid();if(!(!e&&u._settings.layoutDuration>0)||this._didMigrate)return _t(i._id),this._element.style[Ft]=Ie(l,d),this._animation.stop(),void(this._didMigrate&&(u.getElement().appendChild(this._element),this._didMigrate=!1));this._nextTransX=l,this._nextTransY=d,h=i._id,a=this._setupAnimation,_=this._startAnimation,it.add(0,Z+h,a),it.add(2,J+h,_)}}else this.reset()},Ce.prototype._setupAnimation=function(){if(this.isActive()){var t=de(this._element);this._transX=t.x,this._transY=t.y}},Ce.prototype._startAnimation=function(){if(this.isActive()){var t=this._animation,e=this._transX,i=this._transY,s=this._nextTransX,n=this._nextTransY;if(e!==s||i!==n){var o=this._item.getGrid()._settings,r={},h={};r[Ft]=Ie(e,i),h[Ft]=Ie(s,n),t.start(r,h,{duration:o.layoutDuration,easing:o.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[Ft]=Ie(s,n),t.stop())}},Ce.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},Ce.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},Ce.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off(m,this._onReleaseEnd),e.off(n,this._onLayoutStart),e.off(c,this._onMigrate),e.off(a,this._onHide),i.on(m,this._onReleaseEnd),i.on(n,this._onLayoutStart),i.on(c,this._onMigrate),i.on(a,this._onHide),this._didMigrate=!0}},Ce.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},Ce.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),s=i._settings,o=this._animation;this._left=e._left,this._top=e._top,t=dt(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,o._element=t,this._className=s.itemPlaceholderClass||"",this._className&&Ot(t,this._className),Ae(t,{position:"absolute",left:"0px",top:"0px",width:e._width+"px",height:e._height+"px"}),t.style[Ft]=Ie(e._left+e._marginLeft,e._top+e._marginTop),i.on(n,this._onLayoutStart),i.on(m,this._onReleaseEnd),i.on(c,this._onMigrate),i.on(a,this._onHide),dt(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},Ce.prototype.reset=function(){if(this.isActive()){var t,e=this._element,i=this._item,s=i.getGrid(),o=s._settings,r=this._animation;this._resetAfterLayout=!1,_t(i._id),t=i._id,it.remove(2,$+t),r.stop(),r._element=null,s.off(m,this._onReleaseEnd),s.off(n,this._onLayoutStart),s.off(c,this._onMigrate),s.off(a,this._onHide),this._className&&(ue(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,dt(o.dragPlaceholder.onRemove)&&o.dragPlaceholder.onRemove(i,e)}},Ce.prototype.isActive=function(){return!!this._element},Ce.prototype.getElement=function(){return this._element},Ce.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,it.add(2,$+t,e))},Ce.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},Me.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,Ot(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},Me.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item,n=s.getGrid();t||void 0!==e&&void 0!==i||(e=s._left,i=s._top);var o=this._placeToGrid(e,i);this._reset(o),t||n._emit(m,s)}},Me.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},Me.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Me.prototype._placeToGrid=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=i.getGrid()._element,o=!1;if(s.parentNode!==n){if(void 0===t||void 0===e){var r=de(s);t=r.x-this._containerDiffX,e=r.y-this._containerDiffY}n.appendChild(s),i._setTranslate(t,e),o=!0}return this._containerDiffX=0,this._containerDiffY=0,o}},Me.prototype._reset=function(t){if(!this._isDestroyed){var e=this._item,i=e.getGrid()._settings.itemReleasingClass;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,i&&(t&&e._element.clientWidth,ue(e._element,i))}};function Pe(t){var e=t._element,i=e.style;this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isInterrupted=!1,this._currentStyles={},this._targetStyles={},this._nextLeft=0,this._nextTop=0,this._offsetLeft=0,this._offsetTop=0,this._skipNextAnimation=!1,this._animOptions={onFinish:this._finish.bind(this),duration:0,easing:0},i.left="0px",i.top="0px",t._setTranslate(0,0),this._animation=new Le(e),this._queue="layout-"+t._id,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}function Xe(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function Ye(t){var e=t._isActive,i=t._element,s=i.children[0],n=t.getGrid()._settings;if(!s)throw new Error("No valid child element found within item element.");this._item=t,this._isDestroyed=!1,this._isHidden=!e,this._isHiding=!1,this._isShowing=!1,this._childElement=s,this._currentStyleProps=[],this._animation=new Le(s),this._queue="visibility-"+t._id,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"":"none",Ot(i,e?n.itemVisibleClass:n.itemHiddenClass),this.setStyles(e?n.visibleStyles:n.hiddenStyles)}Pe.prototype.start=function(t,e){if(!this._isDestroyed){var i,s,n,o=this._item,r=o._dragRelease,h=o.getGrid()._settings,a=this._isActive,_=r.isJustReleased(),l=_?h.dragRelease.duration:h.layoutDuration,d=_?h.dragRelease.easing:h.layoutEasing,u=!t&&!this._skipNextAnimation&&l>0;if(a&&(st(o._id),o._emitter.burst(this._queue,!0,o)),_&&(r._isPositioningStarted=!0),dt(e)&&o._emitter.on(this._queue,e),this._skipNextAnimation=!1,!u)return this._updateOffsets(),o._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._animation.isAnimating()&&(this._animation._animation.onfinish=null),this._isActive=!0,this._animOptions.easing=d,this._animOptions.duration=l,this._isInterrupted=a,i=o._id,s=this._setupAnimation,n=this._startAnimation,it.add(0,H+i,s),it.add(2,G+i,n)}},Pe.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item;if(st(s._id),this._animation.isAnimating()){if(void 0===e||void 0===i){var n=de(s._element);e=n.x,i=n.y}s._setTranslate(e,i),this._animation.stop()}ue(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&s._emitter.burst(this._queue,!0,s)}},Pe.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item._element.style;this.stop(!0,0,0),this._item._emitter.clear(this._queue),this._animation.destroy(),t[Ft]="",t.left="",t.top="",this._item=null,this._currentStyles=null,this._targetStyles=null,this._animOptions=null,this._isDestroyed=!0}},Pe.prototype._updateOffsets=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;this._offsetLeft=i._isActive?i._containerDiffX:e._isActive?e._containerDiffX:0,this._offsetTop=i._isActive?i._containerDiffY:e._isActive?e._containerDiffY:0,this._nextLeft=this._item._left+this._offsetLeft,this._nextTop=this._item._top+this._offsetTop}},Pe.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;t._tX=this._nextLeft,t._tY=this._nextTop,this._isActive&&(this._isActive=!1,ue(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},Pe.prototype._setupAnimation=function(){var t=this._item;if(void 0===t._tX||void 0===t._tY){var e=de(t._element);t._tX=e.x,t._tY=e.y}},Pe.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings,i=this._animOptions.duration<=0;this._updateOffsets();var s=Math.abs(t._left-(t._tX-this._offsetLeft)),n=Math.abs(t._top-(t._tY-this._offsetTop));if(i||s<2&&n<2)return(s||n||this._isInterrupted)&&t._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._isInterrupted||Ot(t._element,e.itemPositioningClass),this._currentStyles[Ft]=Ie(t._tX,t._tY),this._targetStyles[Ft]=Ie(this._nextLeft,this._nextTop),t._tX=t._tY=void 0,this._animation.start(this._currentStyles,this._targetStyles,this._animOptions)},Xe.prototype.start=function(t,e,i){if(!this._isDestroyed){var s,n,o,r,h,a,_,l,d,m,g=this._item,v=g._element,y=g.isActive(),S=g.isVisible(),w=g.getGrid(),D=w._settings,b=t._settings,A=t._element,E=t._items,T=w._items.indexOf(g),x=i||document.body;if("number"==typeof e)s=Wt(E,e,1);else{if(!(n=t.getItem(e)))return;s=E.indexOf(n)}(g.isPositioning()||this._isActive||g.isReleasing())&&(_=(a=de(v)).x,l=a.y),g.isPositioning()&&g._layout.stop(!0,_,l),this._isActive&&(_-=this._containerDiffX,l-=this._containerDiffY,this.stop(!0,_,l)),g.isReleasing()&&(_-=g._dragRelease._containerDiffX,l-=g._dragRelease._containerDiffY,g._dragRelease.stop(!0,_,l)),g._visibility.stop(!0),g._drag&&g._drag.destroy(),w._hasListeners(c)&&w._emit(c,{item:g,fromGrid:w,fromIndex:T,toGrid:t,toIndex:s}),t._hasListeners(p)&&t._emit(p,{item:g,fromGrid:w,fromIndex:T,toGrid:t,toIndex:s}),D.itemClass!==b.itemClass&&(ue(v,D.itemClass),Ot(v,b.itemClass)),(d=S?D.itemVisibleClass:D.itemHiddenClass)!==(m=S?b.itemVisibleClass:b.itemHiddenClass)&&(ue(v,d),Ot(v,m)),w._items.splice(T,1),Gt(E,g,s),g._gridId=t._id,y?x!==(o=v.parentNode)&&(x.appendChild(v),r=ie(x,o,!0),a||(_=(a=de(v)).x,l=a.y),g._setTranslate(_+r.left,l+r.top)):A.appendChild(v),g._visibility.setStyles(S?b.visibleStyles:b.hiddenStyles),y&&(h=ie(x,A,!0)),g._refreshDimensions(),g._sortData=null,g._drag=b.dragEnabled?new ye(g):null,y?(this._isActive=!0,this._container=x,this._containerDiffX=h.left,this._containerDiffY=h.top):(this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0),w._hasListeners(u)&&w._emit(u,{item:g,fromGrid:w,fromIndex:T,toGrid:t,toIndex:s}),t._hasListeners(f)&&t._emit(f,{item:g,fromGrid:w,fromIndex:T,toGrid:t,toIndex:s})}},Xe.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s,n=this._item,o=n._element,r=n.getGrid()._element;this._container!==r&&(void 0!==e&&void 0!==i||(t?(e=(s=de(o)).x-this._containerDiffX,i=s.y-this._containerDiffY):(e=n._left,i=n._top)),r.appendChild(o),n._setTranslate(e,i)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0}},Xe.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Ye.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=dt(e)?e:null,o=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),ue(s,o.itemHiddenClass),Ot(s,o.itemVisibleClass),this._isHiding||(s.style.display="")),n&&i._emitter.on(this._queue,n),this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},Ye.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=dt(e)?e:null,o=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),Ot(s,o.itemHiddenClass),ue(s,o.itemVisibleClass)),n&&i._emitter.on(this._queue,n),this._isHidden=this._isHiding=!0,this._isShowing=!1,this._startAnimation(!1,t,this._finishHide)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},Ye.prototype.stop=function(t){if(!this._isDestroyed&&(this._isHiding||this._isShowing)){var e=this._item;nt(e._id),this._animation.stop(),t&&e._emitter.burst(this._queue,!0,e)}},Ye.prototype.setStyles=function(t){var e=this._childElement,i=this._currentStyleProps;for(var s in this._removeCurrentStyles(),t)i.push(s),e.style[s]=t[s]},Ye.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item,e=t._element,i=t.getGrid()._settings;this.stop(!0),t._emitter.clear(this._queue),this._animation.destroy(),this._removeCurrentStyles(),ue(e,i.itemVisibleClass),ue(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},Ye.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,o=this._animation,r=this._childElement,h=n.getGrid()._settings,a=t?h.visibleStyles:h.hiddenStyles,_=t?h.showDuration:h.hideDuration,l=t?h.showEasing:h.hideEasing,d=e||_<=0;if(a){if(nt(n._id),d)return Ae(r,a),o.stop(),void(i&&i());var u,c,f;o.isAnimating()&&(o._animation.onfinish=null),u=n._id,c=function(){s=Se(r,a)},f=function(){o.start(s,a,{duration:_,easing:l,onFinish:i})},it.add(0,W+u,c),it.add(2,B+u,f)}else i&&i()}},Ye.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},Ye.prototype._finishHide=function(){if(this._isHidden){var t=this._item;this._isHiding=!1,t._layout.stop(!0,0,0),t._element.style.display="none",t._emitter.burst(this._queue,!1,t)}},Ye.prototype._removeCurrentStyles=function(){for(var t=this._childElement,e=this._currentStyleProps,i=0;i<e.length;i++)t.style[e[i]]="";e.length=0};var qe=0;function Oe(){return++qe}function He(t,i,s){var n=t._settings;if(e){if(e.has(i))throw new Error("You can only create one Muuri Item per element!");e.set(i,this)}this._id=Oe(),this._gridId=t._id,this._element=i,this._isDestroyed=!1,this._left=0,this._top=0,this._width=0,this._height=0,this._marginLeft=0,this._marginRight=0,this._marginTop=0,this._marginBottom=0,this._tX=void 0,this._tY=void 0,this._sortData=null,this._emitter=new S,i.parentNode!==t._element&&t._element.appendChild(i),Ot(i,n.itemClass),"boolean"!=typeof s&&(s="none"!==ct(i,"display")),this._isActive=s,this._visibility=new Ye(this),this._layout=new Pe(this),this._migrate=new Xe(this),this._drag=n.dragEnabled?new ye(this):null,this._dragRelease=new Me(this),this._dragPlaceholder=new Ce(this)}function Ge(t){var e,i,s,n,o,r=.001,h=.5;function a(t){return((1e3*t+.5<<0)/10<<0)/100}function _(){this.currentRects=[],this.nextRects=[],this.rectTarget={},this.rectStore=[],this.slotSizes=[],this.rectId=0,this.slotIndex=-1,this.slotData={left:0,top:0,width:0,height:0},this.sortRectsLeftTop=this.sortRectsLeftTop.bind(this),this.sortRectsTopLeft=this.sortRectsTopLeft.bind(this)}if(_.prototype.computeLayout=function(t,e){var i,s,n,o,r,h,_=t.items,l=t.slots,d=!!(1&e),u=!!(2&e),c=!!(4&e),f=!!(8&e),p=!!(16&e),m="number"==typeof _[0];if(!_.length)return t;for(s=m?2:1,i=0;i<_.length;i+=s)m?(o=_[i],r=_[i+1]):(o=(n=_[i])._width+n._marginLeft+n._marginRight,r=n._height+n._marginTop+n._marginBottom),p&&(o=a(o),r=a(r)),h=this.computeNextSlot(t,o,r,d,u),u?h.left+h.width>t.width&&(t.width=h.left+h.width):h.top+h.height>t.height&&(t.height=h.top+h.height),l[++this.slotIndex]=h.left,l[++this.slotIndex]=h.top,(c||f)&&this.slotSizes.push(h.width,h.height);if(c)for(i=0;i<l.length;i+=2)l[i]=t.width-(l[i]+this.slotSizes[i]);if(f)for(i=1;i<l.length;i+=2)l[i]=t.height-(l[i]+this.slotSizes[i]);return this.slotSizes.length=0,this.currentRects.length=0,this.nextRects.length=0,this.rectStore.length=0,this.rectId=0,this.slotIndex=-1,t},_.prototype.computeNextSlot=function(t,e,i,s,n){var o,a,_,l,d,u=this.slotData,c=this.currentRects,f=this.nextRects,p=!1;for(f.length=0,u.left=null,u.top=null,u.width=e,u.height=i,l=0;l<c.length;l++)if((a=c[l])&&(o=this.getRect(a),u.width<=o.width+r&&u.height<=o.height+r)){u.left=o.left,u.top=o.top;break}if(null===u.left&&(n?(u.left=t.width,u.top=0):(u.left=0,u.top=t.height),s||(p=!0)),!n&&u.top+u.height>t.height+r&&(u.left>h&&f.push(this.addRect(0,t.height,u.left,1/0)),u.left+u.width<t.width-h&&f.push(this.addRect(u.left+u.width,t.height,t.width-u.left-u.width,1/0)),t.height=u.top+u.height),n&&u.left+u.width>t.width+r&&(u.top>h&&f.push(this.addRect(t.width,0,1/0,u.top)),u.top+u.height<t.height-h&&f.push(this.addRect(t.width,u.top+u.height,1/0,t.height-u.top-u.height)),t.width=u.left+u.width),!p)for(s&&(l=0);l<c.length;l++)if(a=c[l])for(o=this.getRect(a),_=this.splitRect(o,u),d=0;d<_.length;d++)a=_[d],o=this.getRect(a),(n?o.left+r<t.width-r:o.top+r<t.height-r)&&f.push(a);return f.length>1&&this.purgeRects(f).sort(n?this.sortRectsLeftTop:this.sortRectsTopLeft),this.currentRects=f,this.nextRects=c,u},_.prototype.addRect=function(t,e,i,s){var n=++this.rectId;return this.rectStore[n]=t||0,this.rectStore[++this.rectId]=e||0,this.rectStore[++this.rectId]=i||0,this.rectStore[++this.rectId]=s||0,n},_.prototype.getRect=function(t,e){return e||(e=this.rectTarget),e.left=this.rectStore[t]||0,e.top=this.rectStore[++t]||0,e.width=this.rectStore[++t]||0,e.height=this.rectStore[++t]||0,e},_.prototype.splitRect=(e=[],i=0,s=0,function(t,n){return e.length=0,t.left+t.width<=n.left+r||n.left+n.width<=t.left+r||t.top+t.height<=n.top+r||n.top+n.height<=t.top+r?(e.push(this.addRect(t.left,t.top,t.width,t.height)),e):((i=n.left-t.left)>=h&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(n.left+n.width))>=h&&e.push(this.addRect(n.left+n.width,t.top,i,t.height)),(s=n.top-t.top)>=h&&e.push(this.addRect(t.left,t.top,t.width,s)),(s=t.top+t.height-(n.top+n.height))>=h&&e.push(this.addRect(t.left,n.top+n.height,t.width,s)),e)}),_.prototype.isRectAWithinRectB=function(t,e){return t.left+r>=e.left&&t.top+r>=e.top&&t.left+t.width-r<=e.left+e.width&&t.top+t.height-r<=e.top+e.height},_.prototype.purgeRects=(n={},o={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this.getRect(t[i],n);e--;)if(t[e]&&i!==e&&(this.getRect(t[e],o),this.isRectAWithinRectB(n,o))){t[i]=0;break}return t}),_.prototype.sortRectsTopLeft=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.top<e.top&&t.top+r<e.top?-1:t.top>e.top&&t.top-r>e.top?1:t.left<e.left&&t.left+r<e.left?-1:t.left>e.left&&t.left-r>e.left?1:0}}(),_.prototype.sortRectsLeftTop=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.left<e.left&&t.left+r<e.left?-1:t.left>e.left&&t.left-r<e.left?1:t.top<e.top&&t.top+r<e.top?-1:t.top>e.top&&t.top-r>e.top?1:0}}(),t){var l=new _;self.onmessage=function(t){var e=new Float32Array(t.data),i=e.subarray(4,e.length),s=new Float32Array(i.length),n=e[3],o={items:i,slots:s,width:e[1],height:e[2]};l.computeLayout(o,n),e[1]=o.width,e[2]=o.height,e.set(o.slots,4),postMessage(e.buffer,[e.buffer])}}return _}He.prototype.getGrid=function(){return t[this._gridId]},He.prototype.getElement=function(){return this._element},He.prototype.getWidth=function(){return this._width},He.prototype.getHeight=function(){return this._height},He.prototype.getMargin=function(){return{left:this._marginLeft,right:this._marginRight,top:this._marginTop,bottom:this._marginBottom}},He.prototype.getPosition=function(){return{left:this._left,top:this._top}},He.prototype.isActive=function(){return this._isActive},He.prototype.isVisible=function(){return!!this._visibility&&!this._visibility._isHidden},He.prototype.isShowing=function(){return!(!this._visibility||!this._visibility._isShowing)},He.prototype.isHiding=function(){return!(!this._visibility||!this._visibility._isHiding)},He.prototype.isPositioning=function(){return!(!this._layout||!this._layout._isActive)},He.prototype.isDragging=function(){return!(!this._drag||!this._drag._isActive)},He.prototype.isReleasing=function(){return!(!this._dragRelease||!this._dragRelease._isActive)},He.prototype.isDestroyed=function(){return this._isDestroyed},He.prototype._refreshDimensions=function(t){if(!(this._isDestroyed||!0!==t&&this._visibility._isHidden)){var e=this._element,i=this._dragPlaceholder,s=e.getBoundingClientRect();this._width=s.width,this._height=s.height,this._marginLeft=Math.max(0,ft(e,"margin-left")),this._marginRight=Math.max(0,ft(e,"margin-right")),this._marginTop=Math.max(0,ft(e,"margin-top")),this._marginBottom=Math.max(0,ft(e,"margin-bottom")),i&&i.updateDimensions()}},He.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},He.prototype._addToLayout=function(t,e){!0!==this._isActive&&(this._isActive=!0,this._left=t||0,this._top=e||0)},He.prototype._removeFromLayout=function(){!1!==this._isActive&&(this._isActive=!1,this._left=0,this._top=0)},He.prototype._canSkipLayout=function(t,e){return this._left===t&&this._top===e&&!this._migrate._isActive&&!this._layout._skipNextAnimation&&!this._dragRelease.isJustReleased()},He.prototype._setTranslate=function(t,e){return(this._tX!==t||this._tY!==e)&&(this._tX=t,this._tY=e,this._element.style[Ft]=Ie(t,e),!0)},He.prototype._destroy=function(t){if(!this._isDestroyed){var i=this._element,s=this.getGrid()._settings;this._dragPlaceholder.destroy(),this._dragRelease.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._drag&&this._drag.destroy(),this._emitter.destroy(),ue(i,s.itemClass),t&&i.parentNode.removeChild(i),e&&e.delete(i),this._isActive=!1,this._isDestroyed=!0}};var We=Ge(),Be=null,Ne=[];function Fe(t,e){if(this._options=0,this._processor=null,this._layoutQueue=[],this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={},this._workers=[],this._onWorkerMessage=this._onWorkerMessage.bind(this),this.setOptions(e),(t="number"==typeof t?Math.max(0,t):0)&&window.Worker&&window.URL&&window.Blob)try{this._workers=function(t,e){var i=[];if(t>0){Be||(Be=URL.createObjectURL(new Blob(["("+Ge.toString()+")(true)"],{type:"application/javascript"})));for(var s,n=0;n<t;n++)s=new Worker(Be),e&&(s.onmessage=e),i.push(s),Ne.push(s)}return i}(t,this._onWorkerMessage)}catch(t){this._processor=new We}else this._processor=new We}Fe.prototype._sendToWorker=function(){if(this._layoutQueue.length&&this._workers.length){var t=this._layoutQueue.shift(),e=this._workers.pop(),i=this._layoutWorkerData[t];delete this._layoutWorkerData[t],this._layoutWorkers[t]=e,e.postMessage(i.buffer,[i.buffer])}},Fe.prototype._onWorkerMessage=function(t){var e=new Float32Array(t.data),i=e[0],s=this._layouts[i],n=this._layoutCallbacks[i],o=this._layoutWorkers[i];s&&delete this._layouts[i],n&&delete this._layoutCallbacks[i],o&&delete this._layoutWorkers[i],s&&n&&(s.width=e[1],s.height=e[2],s.slots=e.subarray(4,e.length),this._finalizeLayout(s),n(s)),o&&(this._workers.push(o),this._sendToWorker())},Fe.prototype._finalizeLayout=function(t){var e=t._grid,i=2&t._settings,s="border-box"===e._boxSizing;return delete t._grid,delete t._settings,t.styles={},i?t.styles.width=(s?t.width+e._borderLeft+e._borderRight:t.width)+"px":t.styles.height=(s?t.height+e._borderTop+e._borderBottom:t.height)+"px",t},Fe.prototype.setOptions=function(t){var e,i,s,n,o;t&&(e="boolean"==typeof t.fillGaps?t.fillGaps?1:0:1&this._options,i="boolean"==typeof t.horizontal?t.horizontal?2:0:2&this._options,s="boolean"==typeof t.alignRight?t.alignRight?4:0:4&this._options,n="boolean"==typeof t.alignBottom?t.alignBottom?8:0:8&this._options,o="boolean"==typeof t.rounding?t.rounding?16:0:16&this._options,this._options=e|i|s|n|o)},Fe.prototype.createLayout=function(t,e,i,s,n,o){if(this._layouts[e])throw new Error("A layout with the provided id is currently being processed.");var r=2&this._options,h={id:e,items:i,slots:null,width:r?0:s,height:r?n:0,_grid:t,_settings:this._options};if(!i.length)return h.slots=[],this._finalizeLayout(h),void o(h);if(this._processor)return h.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(h,h._settings),this._finalizeLayout(h),void o(h);var a,_,l,d=new Float32Array(4+2*i.length);for(d[0]=e,d[1]=h.width,d[2]=h.height,d[3]=h._settings,a=0,_=3;a<i.length;a++)l=i[a],d[++_]=l._width+l._marginLeft+l._marginRight,d[++_]=l._height+l._marginTop+l._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=h,this._layoutCallbacks[e]=o,this._layoutWorkerData[e]=d,this._sendToWorker(),this.cancelLayout.bind(this,e)},Fe.prototype.cancelLayout=function(t){if(this._layouts[t]&&(delete this._layouts[t],delete this._layoutCallbacks[t],this._layoutWorkerData[t])){delete this._layoutWorkerData[t];var e=this._layoutQueue.indexOf(t);e>-1&&this._layoutQueue.splice(e,1)}},Fe.prototype.destroy=function(){for(var t in this._layoutWorkers)this._workers.push(this._layoutWorkers[t]);!function(t){for(var e,i,s=0;s<t.length;s++)(e=t[s]).onmessage=null,e.onerror=null,e.onmessageerror=null,e.terminate(),(i=Ne.indexOf(e))>-1&&Ne.splice(i,1);Be&&!Ne.length&&(URL.revokeObjectURL(Be),Be=null)}(this._workers),this._workers.length=0,this._layoutQueue.length=0,this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={}};var ze=0;function Ve(t,e){var i=++ze,s=0,n=0,o=!1,r=function(e){o||(n&&(s-=e-n),n=e,s>0?function(t,e){it.add(0,et+t,e)}(i,r):(s=n=0,t()))};return function(h){if(!o){if(!(e<=0))return!0===h?(o=!0,s=n=0,r=void 0,void function(t){it.remove(0,et+t)}(i)):void(s<=0?(s=e,r(0)):s=e);!0!==h&&t()}}}function je(t){var e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e}var Qe=Object.prototype.toString;function Ue(t){return"object"==typeof t&&"[object Object]"===Qe.call(t)}function Ze(){}var Je,$e="number",Ke="string",ti="instant",ei=0;function ii(e,i){if(typeof e===Ke&&(e=document.querySelector(e)),!(e.getRootNode?e.getRootNode({composed:!0})===document:document.body.contains(e))||e===document.documentElement)throw new Error("Container element must be an existing DOM element.");var s=function(t,e){var i=si({},t);e&&(i=si(i,e));e&&e.visibleStyles?i.visibleStyles=e.visibleStyles:t&&t.visibleStyles&&(i.visibleStyles=t.visibleStyles);e&&e.hiddenStyles?i.hiddenStyles=e.hiddenStyles:t&&t.hiddenStyles&&(i.hiddenStyles=t.hiddenStyles);return i}(ii.defaultOptions,i);s.visibleStyles=ni(s.visibleStyles),s.hiddenStyles=ni(s.hiddenStyles),dt(s.dragSort)||(s.dragSort=!!s.dragSort),this._id=Oe(),this._element=e,this._settings=s,this._isDestroyed=!1,this._items=[],this._layout={id:0,items:[],slots:[]},this._isLayoutFinished=!0,this._nextLayoutData=null,this._emitter=new S,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),t[this._id]=this,Ot(e,s.containerClass),function(t,e){typeof e!==$e&&(e=!0===e?0:-1);e>=0&&(t._resizeHandler=Ve((function(){t.refreshItems().layout()}),e),window.addEventListener("resize",t._resizeHandler))}(this,s.layoutOnResize),this.add(function(t,e){if("*"===e)return t.children;if(typeof e===Ke){for(var i=[],s=t.children,n=0;n<s.length;n++)qt(s[n],e)&&i.push(s[n]);return i}if(Array.isArray(e)||je(e))return e;return[]}(e,s.items),{layout:!1}),s.layoutOnInit&&this.layout(!0)}function si(t,e){var i,s,n,o=Object.keys(e),r=o.length;for(n=0;n<r;n++)i=Ue(e[s=o[n]]),Ue(t[s])&&i?t[s]=si(si({},t[s]),e[s]):i?t[s]=si({},e[s]):Array.isArray(e[s])?t[s]=e[s].slice(0):t[s]=e[s];return t}function ni(t){var e,i,s={},n=document.documentElement.style;for(e in t)t[e]&&(i=E(n,e))&&(s[i]=t[e]);return s}function oi(t){for(var e={},i=0;i<t.length;i++)e[t[i]._id]=i;return e}function ri(t,e,i){return t[e._id]-t[i._id]}return ii.Item=He,ii.ItemLayout=Pe,ii.ItemVisibility=Ye,ii.ItemMigrate=Xe,ii.ItemDrag=ye,ii.ItemDragRelease=Me,ii.ItemDragPlaceholder=Ce,ii.Emitter=S,ii.Animator=Le,ii.Dragger=X,ii.Packer=Fe,ii.AutoScroller=Pt,ii.defaultPacker=new Fe(2),ii.defaultOptions={items:"*",showDuration:300,showEasing:"ease",hideDuration:300,hideEasing:"ease",visibleStyles:{opacity:"1",transform:"scale(1)"},hiddenStyles:{opacity:"0",transform:"scale(0.5)"},layout:{fillGaps:!1,horizontal:!1,alignRight:!1,alignBottom:!1,rounding:!1},layoutOnResize:150,layoutOnInit:!0,layoutDuration:300,layoutEasing:"ease",sortData:null,dragEnabled:!1,dragContainer:null,dragHandle:null,dragStartPredicate:{distance:0,delay:0},dragAxis:"xy",dragSort:!0,dragSortHeuristics:{sortInterval:100,minDragDistance:10,minBounceBackAngle:1},dragSortPredicate:{threshold:50,action:s,migrateAction:s},dragRelease:{duration:300,easing:"ease",useDragContainer:!0},dragCssProps:{touchAction:"none",userSelect:"none",userDrag:"none",tapHighlightColor:"rgba(0, 0, 0, 0)",touchCallout:"none",contentZooming:"none"},dragPlaceholder:{enabled:!1,createElement:null,onCreate:null,onRemove:null},dragAutoScroll:{targets:[],handle:null,threshold:50,safeZone:.2,speed:Pt.smoothSpeed(1e3,2e3,2500),sortDuringScroll:!0,smoothStop:!1,onStart:null,onStop:null},containerClass:"muuri",itemClass:"muuri-item",itemVisibleClass:"muuri-item-shown",itemHiddenClass:"muuri-item-hidden",itemPositioningClass:"muuri-item-positioning",itemDraggingClass:"muuri-item-dragging",itemReleasingClass:"muuri-item-releasing",itemPlaceholderClass:"muuri-item-placeholder"},ii.prototype.on=function(t,e){return this._emitter.on(t,e),this},ii.prototype.off=function(t,e){return this._emitter.off(t,e),this},ii.prototype.getElement=function(){return this._element},ii.prototype.getItem=function(t){if(this._isDestroyed||!t&&0!==t)return null;if(typeof t===$e)return this._items[t>-1?t:this._items.length+t]||null;if(t instanceof He)return t._gridId===this._id?t:null;if(e){var i=e.get(t);return i&&i._gridId===this._id?i:null}for(var s=0;s<this._items.length;s++)if(this._items[s]._element===t)return this._items[s];return null},ii.prototype.getItems=function(t){if(this._isDestroyed||void 0===t)return this._items.slice(0);var e,i,s=[];if(Array.isArray(t)||je(t))for(e=0;e<t.length;e++)(i=this.getItem(t[e]))&&s.push(i);else(i=this.getItem(t))&&s.push(i);return s},ii.prototype.refreshItems=function(t,e){if(this._isDestroyed)return this;var i,s,n,o,r=t||this._items;if(!0===e)for(o=[],i=0;i<r.length;i++)(s=r[i]).isVisible()||s.isHiding()||((n=s.getElement().style).visibility="hidden",n.display="",o.push(n));for(i=0;i<r.length;i++)r[i]._refreshDimensions(e);if(!0===e){for(i=0;i<o.length;i++)(n=o[i]).visibility="",n.display="none";o.length=0}return this},ii.prototype.refreshSortData=function(t){if(this._isDestroyed)return this;for(var e=t||this._items,i=0;i<e.length;i++)e[i]._refreshSortData();return this},ii.prototype.synchronize=function(){if(this._isDestroyed)return this;var t,e,i=this._items;if(!i.length)return this;for(var s=0;s<i.length;s++)(e=i[s]._element).parentNode===this._element&&(t=t||document.createDocumentFragment()).appendChild(e);return t?(this._element.appendChild(t),this._emit("synchronize"),this):this},ii.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&dt(i.cancel)&&i.cancel();var s=ei=ei%16777216+1;this._nextLayoutData={id:s,instant:t,onFinish:e,cancel:null};for(var n=this._items,o=[],r=0;r<n.length;r++)n[r]._isActive&&o.push(n[r]);this._refreshDimensions();var h,a=this._width-this._borderLeft-this._borderRight,_=this._height-this._borderTop-this._borderBottom,l=this._settings.layout;return dt(l)?h=l(this,s,o,a,_,this._onLayoutDataReceived):(ii.defaultPacker.setOptions(l),h=ii.defaultPacker.createLayout(this,s,o,a,_,this._onLayoutDataReceived)),dt(h)&&this._nextLayoutData&&this._nextLayoutData.id===s&&(this._nextLayoutData.cancel=h),this},ii.prototype.add=function(t,e){if(this._isDestroyed||!t)return[];var i,s=je(i=t)?Array.prototype.slice.call(i):Array.prototype.concat(i);if(!s.length)return s;var n,o,r,h,a=e||{},_=a.layout?a.layout:void 0===a.layout,l=this._items,d=!1;for(h=0;h<s.length;h++)(o=s[h]).parentNode!==this._element&&(n=n||document.createDocumentFragment()).appendChild(o);for(n&&this._element.appendChild(n),h=0;h<s.length;h++)o=s[h],(r=s[h]=new He(this,o,a.active))._isActive&&(d=!0,r._layout._skipNextAnimation=!0);for(h=0;h<s.length;h++)(r=s[h])._refreshDimensions(),r._refreshSortData();return Gt(l,s,a.index),this._hasListeners("add")&&this._emit("add",s.slice(0)),d&&_&&this.layout(_===ti,dt(_)?_:void 0),s},ii.prototype.remove=function(t,e){if(this._isDestroyed||!t.length)return[];var i,s,n,o=e||{},r=o.layout?o.layout:void 0===o.layout,a=!1,_=this.getItems(),l=[],d=[];for(n=0;n<t.length;n++)(s=t[n])._isDestroyed||-1!==(i=this._items.indexOf(s))&&(s._isActive&&(a=!0),l.push(s),d.push(_.indexOf(s)),s._destroy(o.removeElements),this._items.splice(i,1));return this._hasListeners(h)&&this._emit(h,l.slice(0),d),a&&r&&this.layout(r===ti,dt(r)?r:void 0),l},ii.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},ii.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},ii.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,s,n=[],o=[],r=typeof t===Ke,h=dt(t),a=e||{},l=!0===a.instant,d=a.syncWithLayout,u=a.layout?a.layout:void 0===a.layout,c=dt(a.onFinish)?a.onFinish:null,f=-1,p=Ze;if(c&&(p=function(){++f&&c(n.slice(0),o.slice(0))}),h||r)for(s=0;s<this._items.length;s++)i=this._items[s],(h?t(i):qt(i._element,t))?n.push(i):o.push(i);return n.length?this.show(n,{instant:l,syncWithLayout:d,onFinish:p,layout:!1}):p(),o.length?this.hide(o,{instant:l,syncWithLayout:d,onFinish:p,layout:!1}):p(),(n.length||o.length)&&(this._hasListeners(_)&&this._emit(_,n.slice(0),o.slice(0)),u&&this.layout(u===ti,dt(u)?u:void 0)),this},ii.prototype.sort=function(){var t,e,i,s;function n(n,o){for(var r,h,a,_,l=0,d=0;d<t.length;d++)if(r=t[d][0],h=t[d][1],a=(n._sortData?n:n._refreshSortData())._sortData[r],_=(o._sortData?o:o._refreshSortData())._sortData[r],l="desc"===h||!h&&e?_<a?-1:_>a?1:0:a<_?-1:a>_?1:0)return l;return l||(s||(s=oi(i)),l=e?ri(s,o,n):ri(s,n,o)),l}function o(n,o){var r=e?-t(n,o):t(n,o);return r||(s||(s=oi(i)),r=e?ri(s,o,n):ri(s,n,o)),r}return function(r,h){if(this._isDestroyed||this._items.length<2)return this;var a=this._items,_=h||{},d=_.layout?_.layout:void 0===_.layout;if(e=!!_.descending,i=a.slice(0),s=null,dt(r))t=r,a.sort(o);else if(typeof r===Ke)t=r.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),a.sort(n);else{if(!Array.isArray(r))throw t=e=i=s=null,new Error("Invalid comparer argument provided.");a.length=0,a.push.apply(a,r)}return this._hasListeners(l)&&this._emit(l,a.slice(0),i),d&&this.layout(d===ti,dt(d)?d:void 0),t=e=i=s=null,this}}(),ii.prototype.move=function(t,e,n){if(this._isDestroyed||this._items.length<2)return this;var o,r,h=this._items,a=n||{},_=a.layout?a.layout:void 0===a.layout,l=a.action===i,u=l?i:s,c=this.getItem(t),f=this.getItem(e);return c&&f&&c!==f&&(o=h.indexOf(c),r=h.indexOf(f),l?Nt(h,o,r):Bt(h,o,r),this._hasListeners(d)&&this._emit(d,{item:c,fromIndex:o,toIndex:r,action:u}),_&&this.layout(_===ti,dt(_)?_:void 0)),this},ii.prototype.send=function(t,e,i,s){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this.getItem(t)))return this;var n=s||{},o=n.appendTo||document.body,r=n.layoutSender?n.layoutSender:void 0===n.layoutSender,h=n.layoutReceiver?n.layoutReceiver:void 0===n.layoutReceiver;return t._migrate.start(e,i,o),t._migrate._isActive&&t._isActive&&(r&&this.layout(r===ti,dt(r)?r:void 0),h&&e.layout(h===ti,dt(h)?h:void 0)),this},ii.prototype.destroy=function(e){if(this._isDestroyed)return this;var i,s,n,o=this._element,r=this._items.slice(0),h=this._layout&&this._layout.styles||{};for((n=this)._resizeHandler&&(n._resizeHandler(!0),window.removeEventListener("resize",n._resizeHandler),n._resizeHandler=null),i=0;i<r.length;i++)r[i]._destroy(e);for(s in this._items.length=0,ue(o,this._settings.containerClass),h)o.style[s]="";return this._emit("destroy"),this._emitter.destroy(),delete t[this._id],this._isDestroyed=!0,this},ii.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},ii.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},ii.prototype._updateBoundingRect=function(){var t=this._element.getBoundingClientRect();this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top,this._right=t.right,this._bottom=t.bottom},ii.prototype._updateBorders=function(t,e,i,s){var n=this._element;t&&(this._borderLeft=ft(n,"border-left-width")),e&&(this._borderRight=ft(n,"border-right-width")),i&&(this._borderTop=ft(n,"border-top-width")),s&&(this._borderBottom=ft(n,"border-bottom-width"))},ii.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=ct(this._element,"box-sizing")},ii.prototype._onLayoutDataReceived=(Je=[],function(t){if(!this._isDestroyed&&this._nextLayoutData&&this._nextLayoutData.id===t.id){var e,i,s,h,a=this,_=this._nextLayoutData.instant,l=this._nextLayoutData.onFinish,d=t.items.length,u=d;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners(r)&&this._emit(r,this._layout.items.slice(0)),this._layout=t,Je.length=0,h=0;h<d;h++)(e=t.items[h])?(i=t.slots[2*h],s=t.slots[2*h+1],e._canSkipLayout(i,s)?--u:(e._left=i,e._top=s,e.isActive()&&!e.isDragging()?Je.push(e):--u)):--u;if(t.styles&&Ae(this._element,t.styles),!this._hasListeners(n)||(this._emit(n,t.items.slice(0),!0===_),this._layout.id===t.id)){var c=function(){if(!(--u>0)){var e=a._layout.id!==t.id,i=dt(_)?_:l;e||(a._isLayoutFinished=!0),dt(i)&&i(t.items.slice(0),e),!e&&a._hasListeners(o)&&a._emit(o,t.items.slice(0))}};if(!Je.length)return c(),this;for(this._isLayoutFinished=!1,h=0;h<Je.length&&this._layout.id===t.id;h++)Je[h]._layout.start(!0===_,c);return this._layout.id===t.id&&(Je.length=0),this}}}),ii.prototype._setItemsVisibility=function(t,e,i){var s,o,r=this,h=t.slice(0),_=i||{},l=!0===_.instant,d=_.onFinish,u=_.layout?_.layout:void 0===_.layout,c=h.length,f=e?"showStart":a,p=e?"showEnd":"hideEnd",m=e?"show":"hide",g=!1,v=[],y=[];if(c){for(o=0;o<h.length;o++)s=h[o],(e&&!s._isActive||!e&&s._isActive)&&(g=!0),s._layout._skipNextAnimation=!(!e||s._isActive),e&&s._visibility._isHidden&&y.push(s),e?s._addToLayout():s._removeFromLayout();y.length&&(this.refreshItems(y,!0),y.length=0),g&&!1!==_.syncWithLayout?this.on(n,S):S(),g&&u&&this.layout(u===ti,dt(u)?u:void 0)}else dt(d)&&d(h);function S(){for(g&&!1!==_.syncWithLayout&&r.off(n,S),r._hasListeners(f)&&r._emit(f,h.slice(0)),o=0;o<h.length;o++)h[o]._gridId===r._id?h[o]._visibility[m](l,(function(t,e){t||v.push(e),--c<1&&(dt(d)&&d(v.slice(0)),r._hasListeners(p)&&r._emit(p,v.slice(0)))})):--c<1&&(dt(d)&&d(v.slice(0)),r._hasListeners(p)&&r._emit(p,v.slice(0)))}},ii})); this.__default_export = module.exports; }).__default_export; \ No newline at end of file diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/@lezer/common.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/@lezer/common.js index 993b1d3c52c19f15c3f3b2f81f97000093afd01c..733aa35c0cffd7ea835dd2e8ce7f8a8111554699 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/@lezer/common.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/@lezer/common.js @@ -1 +1 @@ -const DefaultBufferLength=1024;let nextPropID=0;class Range{constructor(e,t){this.from=e,this.to=t}}class NodeProp{constructor(e={}){this.id=nextPropID++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=NodeType.match(e)),t=>{let r=e(t);return void 0===r?null:[this,r]}}}NodeProp.closedBy=new NodeProp({deserialize:e=>e.split(" ")}),NodeProp.openedBy=new NodeProp({deserialize:e=>e.split(" ")}),NodeProp.group=new NodeProp({deserialize:e=>e.split(" ")}),NodeProp.contextHash=new NodeProp({perNode:!0}),NodeProp.lookAhead=new NodeProp({perNode:!0}),NodeProp.mounted=new NodeProp({perNode:!0});class MountedTree{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}}const noProps=Object.create(null);class NodeType{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):noProps,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new NodeType(e.name||"",t,e.id,r);if(e.props)for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(NodeProp.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return e=>{for(let r=e.prop(NodeProp.group),n=-1;n<(r?r.length:0);n++){let i=t[n<0?e.name:r[n]];if(i)return i}}}}NodeType.none=new NodeType("",Object.create(null),0,8);class NodeSet{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let t of e){let e=t(r);e&&(n||(n=Object.assign({},r.props)),n[e[0].id]=e[1])}t.push(n?new NodeType(r.name,n,r.id,r.flags):r)}return new NodeSet(t)}}const CachedNode=new WeakMap,CachedInnerNode=new WeakMap;var IterMode;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(IterMode||(IterMode={}));class Tree{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=this.prop(NodeProp.mounted);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let r=e.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new TreeCursor(this.topNode,e)}cursorAt(e,t=0,r=0){let n=CachedNode.get(this)||this.topNode,i=new TreeCursor(n);return i.moveTo(e,t),CachedNode.set(this,i._tree),i}get topNode(){return new TreeNode(this,0,0,null)}resolve(e,t=0){let r=resolveNode(CachedNode.get(this)||this.topNode,e,t,!1);return CachedNode.set(this,r),r}resolveInner(e,t=0){let r=resolveNode(CachedInnerNode.get(this)||this.topNode,e,t,!0);return CachedInnerNode.set(this,r),r}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e;for(let s=this.cursor((e.mode||0)|IterMode.IncludeAnonymous);;){let e=!1;if(s.from<=i&&s.to>=n&&(s.type.isAnonymous||!1!==t(s))){if(s.firstChild())continue;e=!0}for(;e&&r&&!s.type.isAnonymous&&r(s),!s.nextSibling();){if(!s.parent())return;e=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:balanceRange(NodeType.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,r)=>new Tree(this.type,e,t,r,this.propValues)),e.makeTree||((e,t,r)=>new Tree(NodeType.none,e,t,r)))}static build(e){return buildTree(e)}}Tree.empty=new Tree(NodeType.none,[],[],0);class FlatBufferCursor{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new FlatBufferCursor(this.buffer,this.index)}}class TreeBuffer{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return NodeType.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),r==(e+=4))return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,t,r,n,i){let{buffer:s}=this,o=-1;for(let h=e;h!=t&&!(checkSide(i,n,s[h+1],s[h+2])&&(o=h,r>0));h=s[h+3]);return o}slice(e,t,r,n){let i=this.buffer,s=new Uint16Array(t-e);for(let n=e,o=0;n<t;)s[o++]=i[n++],s[o++]=i[n++]-r,s[o++]=i[n++]-r,s[o++]=i[n++]-e;return new TreeBuffer(s,n-r,this.set)}}function checkSide(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function enterUnfinishedNodesBefore(e,t){let r=e.childBefore(t);for(;r;){let t=r.lastChild;if(!t||t.to!=r.to)break;t.type.isError&&t.from==t.to?(e=r,r=t.prevSibling):r=t}return e}function resolveNode(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof TreeNode&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=n?0:IterMode.IgnoreOverlays;if(n)for(let n=e,o=n.parent;o;n=o,o=n.parent)n instanceof TreeNode&&n.index<0&&(null===(i=o.enter(t,r,s))||void 0===i?void 0:i.from)!=n.from&&(e=o);for(;;){let n=e.enter(t,r,s);if(!n)return e;e=n}}class TreeNode{constructor(e,t,r,n){this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,i=0){for(let s=this;;){for(let{children:o,positions:h}=s._tree,f=t>0?o.length:-1;e!=f;e+=t){let f=o[e],l=h[e]+s.from;if(checkSide(n,r,l,l+f.length))if(f instanceof TreeBuffer){if(i&IterMode.ExcludeBuffers)continue;let o=f.findChild(0,f.buffer.length,t,r-l,n);if(o>-1)return new BufferNode(new BufferContext(s,f,e,l),null,o)}else if(i&IterMode.IncludeAnonymous||!f.type.isAnonymous||hasChild(f)){let o;if(!(i&IterMode.IgnoreMounts)&&f.props&&(o=f.prop(NodeProp.mounted))&&!o.overlay)return new TreeNode(o.tree,l,e,s);let h=new TreeNode(f,l,e,s);return i&IterMode.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(t<0?f.children.length-1:0,t,r,n)}}if(i&IterMode.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let n;if(!(r&IterMode.IgnoreOverlays)&&(n=this._tree.prop(NodeProp.mounted))&&n.overlay){let r=e-this.from;for(let{from:e,to:i}of n.overlay)if((t>0?e<=r:e<r)&&(t<0?i>=r:i>r))return new TreeNode(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new TreeCursor(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return resolveNode(this,e,t,!1)}resolveInner(e,t=0){return resolveNode(this,e,t,!0)}enterUnfinishedNodesBefore(e){return enterUnfinishedNodesBefore(this,e)}getChild(e,t=null,r=null){let n=getChildren(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return getChildren(this,e,t,r)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return matchNodeContext(this,e)}}function getChildren(e,t,r,n){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=r)for(;!i.type.is(r);)if(!i.nextSibling())return s;for(;;){if(null!=n&&i.type.is(n))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==n?s:[]}}function matchNodeContext(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class BufferContext{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class BufferNode{constructor(e,t,r){this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new BufferNode(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&IterMode.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new BufferNode(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new BufferNode(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new BufferNode(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new TreeCursor(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let s=r.buffer[this.index+1],o=r.buffer[this.index+2];e.push(r.slice(n,i,s,o)),t.push(0)}return new Tree(this.type,e,t,this.to-this.from)}resolve(e,t=0){return resolveNode(this,e,t,!1)}resolveInner(e,t=0){return resolveNode(this,e,t,!0)}enterUnfinishedNodesBefore(e){return enterUnfinishedNodesBefore(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,r=null){let n=getChildren(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return getChildren(this,e,t,r)}get node(){return this}matchContext(e){return matchNodeContext(this,e)}}class TreeCursor{constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof TreeNode)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}get name(){return this.type.name}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return!!e&&(e instanceof TreeNode?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?!(r&IterMode.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let e=r<0?0:this.stack[r]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(e)}return r<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;({index:t,_parent:r}=r))if(t>-1)for(let n=t+e,i=e<0?-1:r._tree.children.length;n!=i;n+=e){let e=r._tree.children[n];if(this.mode&IterMode.IncludeAnonymous||e instanceof TreeBuffer||!e.type.isAnonymous||hasChild(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=i+1;break e}n=this.stack[--i]}for(let e=r;e<this.stack.length;e++)t=new BufferNode(this.buffer,t,this.stack[e]);return this.bufferNode=new BufferNode(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;n&&t&&t(this),n=this.type.isAnonymous,!this.nextSibling();){if(!r)return;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return matchNodeContext(this.node,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return matchNodeContext(this.node,e,n);let s=r[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function hasChild(e){return e.children.some((e=>e instanceof TreeBuffer||!e.type.isAnonymous||hasChild(e)))}function buildTree(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=DefaultBufferLength,reused:s=[],minRepeatType:o=n.types.length}=e,h=Array.isArray(r)?new FlatBufferCursor(r,r.length):r,f=n.types,l=0,u=0;function a(e,t,r,g,m){let{id:x,start:b,end:y,size:N}=h,C=u;for(;N<0;){if(h.next(),-1==N){let t=s[x];return r.push(t),void g.push(b-e)}if(-3==N)return void(l=x);if(-4==N)return void(u=x);throw new RangeError("Unrecognized record size: "+N)}let v,w,T=f[x],I=b-e;if(y-b<=i&&(w=function(e,t){let r=h.fork(),n=0,s=0,f=0,l=r.end-i,u={size:0,start:0,skip:0};e:for(let i=r.pos-e;r.pos>i;){let e=r.size;if(r.id==t&&e>=0){u.size=n,u.start=s,u.skip=f,f+=4,n+=4,r.next();continue}let h=r.pos-e;if(e<0||h<i||r.start<l)break;let a=r.id>=o?4:0,d=r.start;for(r.next();r.pos>h;){if(r.size<0){if(-3!=r.size)break e;a+=4}else r.id>=o&&(a+=4);r.next()}s=d,n+=e,f+=a}return(t<0||n==e)&&(u.size=n,u.start=s,u.skip=f),u.size>4?u:void 0}(h.pos-t,m))){let t=new Uint16Array(w.size-w.skip),r=h.pos-w.size,i=t.length;for(;h.pos>r;)i=c(w.start,t,i);v=new TreeBuffer(t,y-w.start,n),I=w.start-e}else{let e=h.pos-N;h.next();let t=[],r=[],n=x>=o?x:-1,s=0,f=y;for(;h.pos>e;)n>=0&&h.id==n&&h.size>=0?(h.end<=f-i&&(d(t,r,b,s,h.end,f,n,C),s=t.length,f=h.end),h.next()):a(b,e,t,r,n);if(n>=0&&s>0&&s<t.length&&d(t,r,b,s,b,f,n,C),t.reverse(),r.reverse(),n>-1&&s>0){let e=function(e){return(t,r,n)=>{let i,s,o=0,h=t.length-1;if(h>=0&&(i=t[h])instanceof Tree){if(!h&&i.type==e&&i.length==n)return i;(s=i.prop(NodeProp.lookAhead))&&(o=r[h]+i.length+s)}return p(e,t,r,n,o)}}(T);v=balanceRange(T,t,r,0,t.length,0,y-b,e,e)}else v=p(T,t,r,y-b,C-y)}r.push(v),g.push(I)}function d(e,t,r,i,s,o,h,f){let l=[],u=[];for(;e.length>i;)l.push(e.pop()),u.push(t.pop()+r-s);e.push(p(n.types[h],l,u,o-s,f-o)),t.push(s-r)}function p(e,t,r,n,i=0,s){if(l){let e=[NodeProp.contextHash,l];s=s?[e].concat(s):[e]}if(i>25){let e=[NodeProp.lookAhead,i];s=s?[e].concat(s):[e]}return new Tree(e,t,r,n,s)}function c(e,t,r){let{id:n,start:i,end:s,size:f}=h;if(h.next(),f>=0&&n<o){let o=r;if(f>4){let n=h.pos-(f-4);for(;h.pos>n;)r=c(e,t,r)}t[--r]=o,t[--r]=s-e,t[--r]=i-e,t[--r]=n}else-3==f?l=n:-4==f&&(u=n);return r}let g=[],m=[];for(;h.pos>0;)a(e.start||0,e.bufferStart||0,g,m,-1);let x=null!==(t=e.length)&&void 0!==t?t:g.length?m[0]+g[0].length:0;return new Tree(f[e.topID],g.reverse(),m.reverse(),x)}const nodeSizeCache=new WeakMap;function nodeSize(e,t){if(!e.isAnonymous||t instanceof TreeBuffer||t.type!=e)return 1;let r=nodeSizeCache.get(t);if(null==r){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Tree)){r=1;break}r+=nodeSize(e,n)}nodeSizeCache.set(t,r)}return r}function balanceRange(e,t,r,n,i,s,o,h,f){let l=0;for(let r=n;r<i;r++)l+=nodeSize(e,t[r]);let u=Math.ceil(1.5*l/8),a=[],d=[];return function t(r,n,i,o,h){for(let l=i;l<o;){let i=l,p=n[l],c=nodeSize(e,r[l]);for(l++;l<o;l++){let t=nodeSize(e,r[l]);if(c+t>=u)break;c+=t}if(l==i+1){if(c>u){let e=r[i];t(e.children,e.positions,0,e.children.length,n[i]+h);continue}a.push(r[i])}else{let t=n[l-1]+r[l-1].length-p;a.push(balanceRange(e,r,n,i,l,p,t,null,f))}d.push(p+h-s)}}(t,r,n,i,0),(h||f)(a,d,o)}class NodeWeakMap{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof BufferNode?this.setBuffer(e.context.buffer,e.index,t):e instanceof TreeNode&&this.map.set(e.tree,t)}get(e){return e instanceof BufferNode?this.getBuffer(e.context.buffer,e.index):e instanceof TreeNode?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class TreeFragment{constructor(e,t,r,n,i=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(i?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],r=!1){let n=[new TreeFragment(0,e.length,e,0,!1,r)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],i=1,s=e.length?e[0]:null;for(let o=0,h=0,f=0;;o++){let l=o<t.length?t[o]:null,u=l?l.fromA:1e9;if(u-h>=r)for(;s&&s.from<u;){let t=s;if(h>=t.from||u<=t.to||f){let e=Math.max(t.from,h)-f,r=Math.min(t.to,u)-f;t=e>=r?null:new TreeFragment(e,r,t.tree,t.offset+f,o>0,!!l)}if(t&&n.push(t),s.to>u)break;s=i<e.length?e[i++]:null}if(!l)break;h=l.toA,f=l.toA-l.toB}return n}}class Parser{startParse(e,t,r){return"string"==typeof e&&(e=new StringInput(e)),r=r?r.length?r.map((e=>new Range(e.from,e.to))):[new Range(0,0)]:[new Range(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let e=n.advance();if(e)return e}}}class StringInput{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function parseMixed(e){return(t,r,n,i)=>new MixedParse(t,e,r,n,i)}class InnerParse{constructor(e,t,r,n,i){this.parser=e,this.parse=t,this.overlay=r,this.target=n,this.ranges=i}}class ActiveOverlay{constructor(e,t,r,n,i,s,o){this.parser=e,this.predicate=t,this.mounts=r,this.index=n,this.start=i,this.target=s,this.prev=o,this.depth=0,this.ranges=[]}}const stoppedInner=new NodeProp({perNode:!0});class MixedParse{constructor(e,t,r,n,i){this.nest=t,this.input=r,this.fragments=n,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new Tree(e.type,e.children,e.positions,e.length,e.propValues.concat([[stoppedInner,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[NodeProp.mounted.id]=new MountedTree(t,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].ranges[0].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new FragmentCursor(this.fragments),t=null,r=null,n=new TreeCursor(new TreeNode(this.baseTree,this.ranges[0].from,0,null),IterMode.IncludeAnonymous|IterMode.IgnoreMounts);e:for(let i,s;null==this.stoppedAt||n.from<this.stoppedAt;){let o,h=!0;if(e.hasNode(n)){if(t){let e=t.mounts.find((e=>e.frag.from<=n.from&&e.frag.to>=n.to&&e.mount.overlay));if(e)for(let r of e.mount.overlay){let i=r.from+e.pos,s=r.to+e.pos;i>=n.from&&s<=n.to&&!t.ranges.some((e=>e.from<s&&e.to>i))&&t.ranges.push({from:i,to:s})}}h=!1}else if(r&&(s=checkCover(r.ranges,n.from,n.to)))h=2!=s;else if(!n.type.isAnonymous&&n.from<n.to&&(i=this.nest(n,this.input))){n.tree||materialize(n);let s=e.findMounts(n.from,i.parser);if("function"==typeof i.overlay)t=new ActiveOverlay(i.parser,i.overlay,s,this.inner.length,n.from,n.tree,t);else{let e=punchRanges(this.ranges,i.overlay||[new Range(n.from,n.to)]);e.length&&this.inner.push(new InnerParse(i.parser,i.parser.startParse(this.input,enterFragments(s,e),e),i.overlay?i.overlay.map((e=>new Range(e.from-n.from,e.to-n.from))):null,n.tree,e)),i.overlay?e.length&&(r={ranges:e,depth:0,prev:r}):h=!1}}else t&&(o=t.predicate(n))&&(!0===o&&(o=new Range(n.from,n.to)),o.from<o.to&&t.ranges.push(o));if(h&&n.firstChild())t&&t.depth++,r&&r.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let e=punchRanges(this.ranges,t.ranges);e.length&&this.inner.splice(t.index,0,new InnerParse(t.parser,t.parser.startParse(this.input,enterFragments(t.mounts,e),e),t.ranges.map((e=>new Range(e.from-t.start,e.to-t.start))),t.target,e)),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function checkCover(e,t,r){for(let n of e){if(n.from>=r)break;if(n.to>t)return n.from<=t&&n.to>=r?2:1}return 0}function sliceBuf(e,t,r,n,i,s){if(t<r){let o=e.buffer[t+1],h=e.buffer[r-2];n.push(e.slice(t,r,o,h)),i.push(o-s)}}function materialize(e){let{node:t}=e,r=0;do{e.parent(),r++}while(!e.tree);let n=0,i=e.tree,s=0;for(;s=i.positions[n]+e.from,!(s<=t.from&&s+i.children[n].length>=t.to);n++);let o=i.children[n],h=o.buffer;i.children[n]=function e(r,n,i,f,l){let u=r;for(;h[u+2]+s<=t.from;)u=h[u+3];let a=[],d=[];sliceBuf(o,r,u,a,d,f);let p=h[u+1],c=h[u+2],g=p+s==t.from&&c+s==t.to&&h[u]==t.type.id;return a.push(g?t.toTree():e(u+4,h[u+3],o.set.types[h[u]],p,c-p)),d.push(p-f),sliceBuf(o,h[u+3],n,a,d,f),new Tree(i,a,d,l)}(0,h.length,NodeType.none,0,o.length);for(let n=0;n<=r;n++)e.childAfter(t.from)}class StructureCursor{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(IterMode.IncludeAnonymous|IterMode.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)t.to>=e&&t.enter(r,1,IterMode.IgnoreOverlays|IterMode.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof Tree))break;t=t.children[0]}return!1}}class FragmentCursor{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=null!==(t=r.tree.prop(stoppedInner))&&void 0!==t?t:r.to,this.inner=new StructureCursor(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(stoppedInner))&&void 0!==e?e:t.to,this.inner=new StructureCursor(t.tree,-t.offset)}}findMounts(e,t){var r;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let i=null===(r=e.tree)||void 0===r?void 0:r.prop(NodeProp.mounted);if(i&&i.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let r=this.fragments[t];if(r.from>=e.to)break;r.tree==this.curFrag.tree&&n.push({frag:r,pos:e.from-r.offset,mount:i})}}}return n}}function punchRanges(e,t){let r=null,n=t;for(let i=1,s=0;i<e.length;i++){let o=e[i-1].to,h=e[i].from;for(;s<n.length;s++){let e=n[s];if(e.from>=h)break;e.to<=o||(r||(n=r=t.slice()),e.from<o?(r[s]=new Range(e.from,o),e.to>h&&r.splice(s+1,0,new Range(h,e.to))):e.to>h?r[s--]=new Range(h,e.to):r.splice(s--,1))}}return n}function findCoverChanges(e,t,r,n){let i=0,s=0,o=!1,h=!1,f=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,a=s==t.length?1e9:h?t[s].to:t[s].from;if(o!=h){let e=Math.max(f,r),t=Math.min(u,a,n);e<t&&l.push(new Range(e,t))}if(f=Math.min(u,a),1e9==f)break;u==f&&(o?(o=!1,i++):o=!0),a==f&&(h?(h=!1,s++):h=!0)}return l}function enterFragments(e,t){let r=[];for(let{pos:n,mount:i,frag:s}of e){let e=n+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,h=Math.max(s.from,e),f=Math.min(s.to,o);if(i.overlay){let o=findCoverChanges(t,i.overlay.map((e=>new Range(e.from+n,e.to+n))),h,f);for(let t=0,n=h;;t++){let h=t==o.length,l=h?f:o[t].from;if(l>n&&r.push(new TreeFragment(n,l,i.tree,-e,s.from>=n,s.to<=l)),h)break;n=o[t].to}}else r.push(new TreeFragment(h,f,i.tree,-e,s.from>=e,s.to<=o))}return r}export{DefaultBufferLength,IterMode,MountedTree,NodeProp,NodeSet,NodeType,NodeWeakMap,Parser,Tree,TreeBuffer,TreeCursor,TreeFragment,parseMixed}; \ No newline at end of file +const DefaultBufferLength=1024;let nextPropID=0;class Range{constructor(e,t){this.from=e,this.to=t}}class NodeProp{constructor(e={}){this.id=nextPropID++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=NodeType.match(e)),t=>{let r=e(t);return void 0===r?null:[this,r]}}}NodeProp.closedBy=new NodeProp({deserialize:e=>e.split(" ")}),NodeProp.openedBy=new NodeProp({deserialize:e=>e.split(" ")}),NodeProp.group=new NodeProp({deserialize:e=>e.split(" ")}),NodeProp.contextHash=new NodeProp({perNode:!0}),NodeProp.lookAhead=new NodeProp({perNode:!0}),NodeProp.mounted=new NodeProp({perNode:!0});class MountedTree{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}}const noProps=Object.create(null);class NodeType{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):noProps,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new NodeType(e.name||"",t,e.id,r);if(e.props)for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(NodeProp.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return e=>{for(let r=e.prop(NodeProp.group),n=-1;n<(r?r.length:0);n++){let i=t[n<0?e.name:r[n]];if(i)return i}}}}NodeType.none=new NodeType("",Object.create(null),0,8);class NodeSet{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let t of e){let e=t(r);e&&(n||(n=Object.assign({},r.props)),n[e[0].id]=e[1])}t.push(n?new NodeType(r.name,n,r.id,r.flags):r)}return new NodeSet(t)}}const CachedNode=new WeakMap,CachedInnerNode=new WeakMap;var IterMode;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(IterMode||(IterMode={}));class Tree{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=this.prop(NodeProp.mounted);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let r=e.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new TreeCursor(this.topNode,e)}cursorAt(e,t=0,r=0){let n=CachedNode.get(this)||this.topNode,i=new TreeCursor(n);return i.moveTo(e,t),CachedNode.set(this,i._tree),i}get topNode(){return new TreeNode(this,0,0,null)}resolve(e,t=0){let r=resolveNode(CachedNode.get(this)||this.topNode,e,t,!1);return CachedNode.set(this,r),r}resolveInner(e,t=0){let r=resolveNode(CachedInnerNode.get(this)||this.topNode,e,t,!0);return CachedInnerNode.set(this,r),r}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e;for(let s=this.cursor((e.mode||0)|IterMode.IncludeAnonymous);;){let e=!1;if(s.from<=i&&s.to>=n&&(s.type.isAnonymous||!1!==t(s))){if(s.firstChild())continue;e=!0}for(;e&&r&&!s.type.isAnonymous&&r(s),!s.nextSibling();){if(!s.parent())return;e=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:balanceRange(NodeType.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,r)=>new Tree(this.type,e,t,r,this.propValues)),e.makeTree||((e,t,r)=>new Tree(NodeType.none,e,t,r)))}static build(e){return buildTree(e)}}Tree.empty=new Tree(NodeType.none,[],[],0);class FlatBufferCursor{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new FlatBufferCursor(this.buffer,this.index)}}class TreeBuffer{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return NodeType.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),r==(e+=4))return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,t,r,n,i){let{buffer:s}=this,o=-1;for(let h=e;h!=t&&!(checkSide(i,n,s[h+1],s[h+2])&&(o=h,r>0));h=s[h+3]);return o}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),s=0;for(let o=e,h=0;o<t;){i[h++]=n[o++],i[h++]=n[o++]-r;let t=i[h++]=n[o++]-r;i[h++]=n[o++]-e,s=Math.max(s,t)}return new TreeBuffer(i,s,this.set)}}function checkSide(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function enterUnfinishedNodesBefore(e,t){let r=e.childBefore(t);for(;r;){let t=r.lastChild;if(!t||t.to!=r.to)break;t.type.isError&&t.from==t.to?(e=r,r=t.prevSibling):r=t}return e}function resolveNode(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof TreeNode&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=n?0:IterMode.IgnoreOverlays;if(n)for(let n=e,o=n.parent;o;n=o,o=n.parent)n instanceof TreeNode&&n.index<0&&(null===(i=o.enter(t,r,s))||void 0===i?void 0:i.from)!=n.from&&(e=o);for(;;){let n=e.enter(t,r,s);if(!n)return e;e=n}}class TreeNode{constructor(e,t,r,n){this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,i=0){for(let s=this;;){for(let{children:o,positions:h}=s._tree,f=t>0?o.length:-1;e!=f;e+=t){let f=o[e],l=h[e]+s.from;if(checkSide(n,r,l,l+f.length))if(f instanceof TreeBuffer){if(i&IterMode.ExcludeBuffers)continue;let o=f.findChild(0,f.buffer.length,t,r-l,n);if(o>-1)return new BufferNode(new BufferContext(s,f,e,l),null,o)}else if(i&IterMode.IncludeAnonymous||!f.type.isAnonymous||hasChild(f)){let o;if(!(i&IterMode.IgnoreMounts)&&f.props&&(o=f.prop(NodeProp.mounted))&&!o.overlay)return new TreeNode(o.tree,l,e,s);let h=new TreeNode(f,l,e,s);return i&IterMode.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(t<0?f.children.length-1:0,t,r,n)}}if(i&IterMode.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let n;if(!(r&IterMode.IgnoreOverlays)&&(n=this._tree.prop(NodeProp.mounted))&&n.overlay){let r=e-this.from;for(let{from:e,to:i}of n.overlay)if((t>0?e<=r:e<r)&&(t<0?i>=r:i>r))return new TreeNode(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new TreeCursor(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return resolveNode(this,e,t,!1)}resolveInner(e,t=0){return resolveNode(this,e,t,!0)}enterUnfinishedNodesBefore(e){return enterUnfinishedNodesBefore(this,e)}getChild(e,t=null,r=null){let n=getChildren(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return getChildren(this,e,t,r)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return matchNodeContext(this,e)}}function getChildren(e,t,r,n){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=r)for(;!i.type.is(r);)if(!i.nextSibling())return s;for(;;){if(null!=n&&i.type.is(n))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==n?s:[]}}function matchNodeContext(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class BufferContext{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class BufferNode{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new BufferNode(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&IterMode.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new BufferNode(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new BufferNode(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new BufferNode(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new TreeCursor(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let s=r.buffer[this.index+1];e.push(r.slice(n,i,s)),t.push(0)}return new Tree(this.type,e,t,this.to-this.from)}resolve(e,t=0){return resolveNode(this,e,t,!1)}resolveInner(e,t=0){return resolveNode(this,e,t,!0)}enterUnfinishedNodesBefore(e){return enterUnfinishedNodesBefore(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,r=null){let n=getChildren(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return getChildren(this,e,t,r)}get node(){return this}matchContext(e){return matchNodeContext(this,e)}}class TreeCursor{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof TreeNode)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return!!e&&(e instanceof TreeNode?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?!(r&IterMode.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let e=r<0?0:this.stack[r]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(e)}return r<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;({index:t,_parent:r}=r))if(t>-1)for(let n=t+e,i=e<0?-1:r._tree.children.length;n!=i;n+=e){let e=r._tree.children[n];if(this.mode&IterMode.IncludeAnonymous||e instanceof TreeBuffer||!e.type.isAnonymous||hasChild(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=i+1;break e}n=this.stack[--i]}for(let e=r;e<this.stack.length;e++)t=new BufferNode(this.buffer,t,this.stack[e]);return this.bufferNode=new BufferNode(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;n&&t&&t(this),n=this.type.isAnonymous,!this.nextSibling();){if(!r)return;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return matchNodeContext(this.node,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return matchNodeContext(this.node,e,n);let s=r[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function hasChild(e){return e.children.some((e=>e instanceof TreeBuffer||!e.type.isAnonymous||hasChild(e)))}function buildTree(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=DefaultBufferLength,reused:s=[],minRepeatType:o=n.types.length}=e,h=Array.isArray(r)?new FlatBufferCursor(r,r.length):r,f=n.types,l=0,u=0;function a(e,t,r,g,m){let{id:x,start:b,end:y,size:N}=h,C=u;for(;N<0;){if(h.next(),-1==N){let t=s[x];return r.push(t),void g.push(b-e)}if(-3==N)return void(l=x);if(-4==N)return void(u=x);throw new RangeError(`Unrecognized record size: ${N}`)}let v,w,T=f[x],I=b-e;if(y-b<=i&&(w=function(e,t){let r=h.fork(),n=0,s=0,f=0,l=r.end-i,u={size:0,start:0,skip:0};e:for(let i=r.pos-e;r.pos>i;){let e=r.size;if(r.id==t&&e>=0){u.size=n,u.start=s,u.skip=f,f+=4,n+=4,r.next();continue}let h=r.pos-e;if(e<0||h<i||r.start<l)break;let a=r.id>=o?4:0,d=r.start;for(r.next();r.pos>h;){if(r.size<0){if(-3!=r.size)break e;a+=4}else r.id>=o&&(a+=4);r.next()}s=d,n+=e,f+=a}(t<0||n==e)&&(u.size=n,u.start=s,u.skip=f);return u.size>4?u:void 0}(h.pos-t,m))){let t=new Uint16Array(w.size-w.skip),r=h.pos-w.size,i=t.length;for(;h.pos>r;)i=c(w.start,t,i);v=new TreeBuffer(t,y-w.start,n),I=w.start-e}else{let e=h.pos-N;h.next();let t=[],r=[],n=x>=o?x:-1,s=0,f=y;for(;h.pos>e;)n>=0&&h.id==n&&h.size>=0?(h.end<=f-i&&(d(t,r,b,s,h.end,f,n,C),s=t.length,f=h.end),h.next()):a(b,e,t,r,n);if(n>=0&&s>0&&s<t.length&&d(t,r,b,s,b,f,n,C),t.reverse(),r.reverse(),n>-1&&s>0){let e=function(e){return(t,r,n)=>{let i,s,o=0,h=t.length-1;if(h>=0&&(i=t[h])instanceof Tree){if(!h&&i.type==e&&i.length==n)return i;(s=i.prop(NodeProp.lookAhead))&&(o=r[h]+i.length+s)}return p(e,t,r,n,o)}}(T);v=balanceRange(T,t,r,0,t.length,0,y-b,e,e)}else v=p(T,t,r,y-b,C-y)}r.push(v),g.push(I)}function d(e,t,r,i,s,o,h,f){let l=[],u=[];for(;e.length>i;)l.push(e.pop()),u.push(t.pop()+r-s);e.push(p(n.types[h],l,u,o-s,f-o)),t.push(s-r)}function p(e,t,r,n,i=0,s){if(l){let e=[NodeProp.contextHash,l];s=s?[e].concat(s):[e]}if(i>25){let e=[NodeProp.lookAhead,i];s=s?[e].concat(s):[e]}return new Tree(e,t,r,n,s)}function c(e,t,r){let{id:n,start:i,end:s,size:f}=h;if(h.next(),f>=0&&n<o){let o=r;if(f>4){let n=h.pos-(f-4);for(;h.pos>n;)r=c(e,t,r)}t[--r]=o,t[--r]=s-e,t[--r]=i-e,t[--r]=n}else-3==f?l=n:-4==f&&(u=n);return r}let g=[],m=[];for(;h.pos>0;)a(e.start||0,e.bufferStart||0,g,m,-1);let x=null!==(t=e.length)&&void 0!==t?t:g.length?m[0]+g[0].length:0;return new Tree(f[e.topID],g.reverse(),m.reverse(),x)}const nodeSizeCache=new WeakMap;function nodeSize(e,t){if(!e.isAnonymous||t instanceof TreeBuffer||t.type!=e)return 1;let r=nodeSizeCache.get(t);if(null==r){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Tree)){r=1;break}r+=nodeSize(e,n)}nodeSizeCache.set(t,r)}return r}function balanceRange(e,t,r,n,i,s,o,h,f){let l=0;for(let r=n;r<i;r++)l+=nodeSize(e,t[r]);let u=Math.ceil(1.5*l/8),a=[],d=[];return function t(r,n,i,o,h){for(let l=i;l<o;){let i=l,p=n[l],c=nodeSize(e,r[l]);for(l++;l<o;l++){let t=nodeSize(e,r[l]);if(c+t>=u)break;c+=t}if(l==i+1){if(c>u){let e=r[i];t(e.children,e.positions,0,e.children.length,n[i]+h);continue}a.push(r[i])}else{let t=n[l-1]+r[l-1].length-p;a.push(balanceRange(e,r,n,i,l,p,t,null,f))}d.push(p+h-s)}}(t,r,n,i,0),(h||f)(a,d,o)}class NodeWeakMap{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof BufferNode?this.setBuffer(e.context.buffer,e.index,t):e instanceof TreeNode&&this.map.set(e.tree,t)}get(e){return e instanceof BufferNode?this.getBuffer(e.context.buffer,e.index):e instanceof TreeNode?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class TreeFragment{constructor(e,t,r,n,i=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(i?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],r=!1){let n=[new TreeFragment(0,e.length,e,0,!1,r)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],i=1,s=e.length?e[0]:null;for(let o=0,h=0,f=0;;o++){let l=o<t.length?t[o]:null,u=l?l.fromA:1e9;if(u-h>=r)for(;s&&s.from<u;){let t=s;if(h>=t.from||u<=t.to||f){let e=Math.max(t.from,h)-f,r=Math.min(t.to,u)-f;t=e>=r?null:new TreeFragment(e,r,t.tree,t.offset+f,o>0,!!l)}if(t&&n.push(t),s.to>u)break;s=i<e.length?e[i++]:null}if(!l)break;h=l.toA,f=l.toA-l.toB}return n}}class Parser{startParse(e,t,r){return"string"==typeof e&&(e=new StringInput(e)),r=r?r.length?r.map((e=>new Range(e.from,e.to))):[new Range(0,0)]:[new Range(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let e=n.advance();if(e)return e}}}class StringInput{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function parseMixed(e){return(t,r,n,i)=>new MixedParse(t,e,r,n,i)}class InnerParse{constructor(e,t,r,n,i){this.parser=e,this.parse=t,this.overlay=r,this.target=n,this.ranges=i}}class ActiveOverlay{constructor(e,t,r,n,i,s,o){this.parser=e,this.predicate=t,this.mounts=r,this.index=n,this.start=i,this.target=s,this.prev=o,this.depth=0,this.ranges=[]}}const stoppedInner=new NodeProp({perNode:!0});class MixedParse{constructor(e,t,r,n,i){this.nest=t,this.input=r,this.fragments=n,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new Tree(e.type,e.children,e.positions,e.length,e.propValues.concat([[stoppedInner,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[NodeProp.mounted.id]=new MountedTree(t,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].ranges[0].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new FragmentCursor(this.fragments),t=null,r=null,n=new TreeCursor(new TreeNode(this.baseTree,this.ranges[0].from,0,null),IterMode.IncludeAnonymous|IterMode.IgnoreMounts);e:for(let i,s;null==this.stoppedAt||n.from<this.stoppedAt;){let o,h=!0;if(e.hasNode(n)){if(t){let e=t.mounts.find((e=>e.frag.from<=n.from&&e.frag.to>=n.to&&e.mount.overlay));if(e)for(let r of e.mount.overlay){let i=r.from+e.pos,s=r.to+e.pos;i>=n.from&&s<=n.to&&!t.ranges.some((e=>e.from<s&&e.to>i))&&t.ranges.push({from:i,to:s})}}h=!1}else if(r&&(s=checkCover(r.ranges,n.from,n.to)))h=2!=s;else if(!n.type.isAnonymous&&n.from<n.to&&(i=this.nest(n,this.input))){n.tree||materialize(n);let s=e.findMounts(n.from,i.parser);if("function"==typeof i.overlay)t=new ActiveOverlay(i.parser,i.overlay,s,this.inner.length,n.from,n.tree,t);else{let e=punchRanges(this.ranges,i.overlay||[new Range(n.from,n.to)]);e.length&&this.inner.push(new InnerParse(i.parser,i.parser.startParse(this.input,enterFragments(s,e),e),i.overlay?i.overlay.map((e=>new Range(e.from-n.from,e.to-n.from))):null,n.tree,e)),i.overlay?e.length&&(r={ranges:e,depth:0,prev:r}):h=!1}}else t&&(o=t.predicate(n))&&(!0===o&&(o=new Range(n.from,n.to)),o.from<o.to&&t.ranges.push(o));if(h&&n.firstChild())t&&t.depth++,r&&r.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let e=punchRanges(this.ranges,t.ranges);e.length&&this.inner.splice(t.index,0,new InnerParse(t.parser,t.parser.startParse(this.input,enterFragments(t.mounts,e),e),t.ranges.map((e=>new Range(e.from-t.start,e.to-t.start))),t.target,e)),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function checkCover(e,t,r){for(let n of e){if(n.from>=r)break;if(n.to>t)return n.from<=t&&n.to>=r?2:1}return 0}function sliceBuf(e,t,r,n,i,s){if(t<r){let o=e.buffer[t+1];n.push(e.slice(t,r,o)),i.push(o-s)}}function materialize(e){let{node:t}=e,r=0;do{e.parent(),r++}while(!e.tree);let n=0,i=e.tree,s=0;for(;s=i.positions[n]+e.from,!(s<=t.from&&s+i.children[n].length>=t.to);n++);let o=i.children[n],h=o.buffer;i.children[n]=function e(r,n,i,f,l){let u=r;for(;h[u+2]+s<=t.from;)u=h[u+3];let a=[],d=[];sliceBuf(o,r,u,a,d,f);let p=h[u+1],c=h[u+2],g=p+s==t.from&&c+s==t.to&&h[u]==t.type.id;return a.push(g?t.toTree():e(u+4,h[u+3],o.set.types[h[u]],p,c-p)),d.push(p-f),sliceBuf(o,h[u+3],n,a,d,f),new Tree(i,a,d,l)}(0,h.length,NodeType.none,0,o.length);for(let n=0;n<=r;n++)e.childAfter(t.from)}class StructureCursor{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(IterMode.IncludeAnonymous|IterMode.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)t.to>=e&&t.enter(r,1,IterMode.IgnoreOverlays|IterMode.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof Tree))break;t=t.children[0]}return!1}}class FragmentCursor{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=null!==(t=r.tree.prop(stoppedInner))&&void 0!==t?t:r.to,this.inner=new StructureCursor(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(stoppedInner))&&void 0!==e?e:t.to,this.inner=new StructureCursor(t.tree,-t.offset)}}findMounts(e,t){var r;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let i=null===(r=e.tree)||void 0===r?void 0:r.prop(NodeProp.mounted);if(i&&i.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let r=this.fragments[t];if(r.from>=e.to)break;r.tree==this.curFrag.tree&&n.push({frag:r,pos:e.from-r.offset,mount:i})}}}return n}}function punchRanges(e,t){let r=null,n=t;for(let i=1,s=0;i<e.length;i++){let o=e[i-1].to,h=e[i].from;for(;s<n.length;s++){let e=n[s];if(e.from>=h)break;e.to<=o||(r||(n=r=t.slice()),e.from<o?(r[s]=new Range(e.from,o),e.to>h&&r.splice(s+1,0,new Range(h,e.to))):e.to>h?r[s--]=new Range(h,e.to):r.splice(s--,1))}}return n}function findCoverChanges(e,t,r,n){let i=0,s=0,o=!1,h=!1,f=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,a=s==t.length?1e9:h?t[s].to:t[s].from;if(o!=h){let e=Math.max(f,r),t=Math.min(u,a,n);e<t&&l.push(new Range(e,t))}if(f=Math.min(u,a),1e9==f)break;u==f&&(o?(o=!1,i++):o=!0),a==f&&(h?(h=!1,s++):h=!0)}return l}function enterFragments(e,t){let r=[];for(let{pos:n,mount:i,frag:s}of e){let e=n+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,h=Math.max(s.from,e),f=Math.min(s.to,o);if(i.overlay){let o=findCoverChanges(t,i.overlay.map((e=>new Range(e.from+n,e.to+n))),h,f);for(let t=0,n=h;;t++){let h=t==o.length,l=h?f:o[t].from;if(l>n&&r.push(new TreeFragment(n,l,i.tree,-e,s.from>=n||s.openStart,s.to<=l||s.openEnd)),h)break;n=o[t].to}}else r.push(new TreeFragment(h,f,i.tree,-e,s.from>=e||s.openStart,s.to<=o||s.openEnd))}return r}export{DefaultBufferLength,IterMode,MountedTree,NodeProp,NodeSet,NodeType,NodeWeakMap,Parser,Tree,TreeBuffer,TreeCursor,TreeFragment,parseMixed}; \ No newline at end of file