@hello-pangea/dnd
Version:
Beautiful and accessible drag and drop for lists with React
10 lines • 97.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactBeautifulDnd={},e.React,e.ReactDOM)}(this,(function(e,t,r){"use strict";function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=n(t);function i(){}function a(e,t,r){const n=t.map((t=>{const n=(o=r,i=t.options,{...o,...i});var o,i;return e.addEventListener(t.eventName,t.fn,n),function(){e.removeEventListener(t.eventName,t.fn,n)}}));return function(){n.forEach((e=>{e()}))}}const s="Invariant failed";class l extends Error{}function c(e,t){throw new l(s)}l.prototype.toString=function(){return this.message};class d extends t.Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=i,this.onWindowError=e=>{const t=this.getCallbacks();t.isDragging()&&t.tryAbort();e.error instanceof l&&e.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=e=>{this.callbacks=e}}componentDidMount(){this.unbind=a(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(!(e instanceof l))throw e;this.setState({})}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const u=e=>e+1,p=(e,t)=>{const r=e.droppableId===t.droppableId,n=u(e.index),o=u(t.index);return r?`\n You have moved the item from position ${n}\n to position ${o}\n `:`\n You have moved the item from position ${n}\n in list ${e.droppableId}\n to list ${t.droppableId}\n in position ${o}\n `},g=(e,t,r)=>t.droppableId===r.droppableId?`\n The item ${e}\n has been combined with ${r.draggableId}`:`\n The item ${e}\n in list ${t.droppableId}\n has been combined with ${r.draggableId}\n in list ${r.droppableId}\n `,f=e=>`\n The item has returned to its starting position\n of ${u(e.index)}\n`,m={dragHandleUsageInstructions:"\n Press space bar to start a drag.\n When dragging you can use the arrow keys to move the item around and escape to cancel.\n Some screen readers may require you to be in focus mode or to use your pass through key\n",onDragStart:e=>`\n You have lifted an item in position ${u(e.source.index)}\n`,onDragUpdate:e=>{const t=e.destination;if(t)return p(e.source,t);const r=e.combine;return r?g(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},onDragEnd:e=>{if("CANCEL"===e.reason)return`\n Movement cancelled.\n ${f(e.source)}\n `;const t=e.destination,r=e.combine;return t?`\n You have dropped the item.\n ${p(e.source,t)}\n `:r?`\n You have dropped the item.\n ${g(e.draggableId,e.source,r)}\n `:`\n The item has been dropped while not over a drop area.\n ${f(e.source)}\n `}};function b(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var h=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),v=()=>Math.random().toString(36).substring(7).split("").join("."),y={INIT:`@@redux/INIT${v()}`,REPLACE:`@@redux/REPLACE${v()}`};function x(e,t,r){if("function"!=typeof e)throw new Error(b(2));if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(b(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(b(1));return r(x)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,l=!1;function c(){a===i&&(a=new Map,i.forEach(((e,t)=>{a.set(t,e)})))}function d(){if(l)throw new Error(b(3));return o}function u(e){if("function"!=typeof e)throw new Error(b(4));if(l)throw new Error(b(5));let t=!0;c();const r=s++;return a.set(r,e),function(){if(t){if(l)throw new Error(b(6));t=!1,c(),a.delete(r),i=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}(e))throw new Error(b(7));if(void 0===e.type)throw new Error(b(8));if("string"!=typeof e.type)throw new Error(b(17));if(l)throw new Error(b(9));try{l=!0,o=n(o,e)}finally{l=!1}return(i=a).forEach((e=>{e()})),e}p({type:y.INIT});return{dispatch:p,subscribe:u,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw new Error(b(10));n=e,p({type:y.REPLACE})},[h]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(b(11));function r(){const e=t;e.next&&e.next(d())}r();return{unsubscribe:e(r)}},[h](){return this}}}}}function I(e,t){return function(...r){return t(e.apply(this,r))}}function D(e,t){if("function"==typeof e)return I(e,t);if("object"!=typeof e||null===e)throw new Error(b(16));const r={};for(const n in e){const o=e[n];"function"==typeof o&&(r[n]=I(o,t))}return r}function w(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...r)=>e(t(...r))))}var E,S={};
/**
* @license React
* use-sync-external-store-with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/!function(){if(E)return S;E=1;var e=t,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,s=e.useDebugValue;S.useSyncExternalStoreWithSelector=function(e,t,l,c,d){var u=o(null);if(null===u.current){var p={hasValue:!1,value:null};u.current=p}else p=u.current;u=a((function(){function e(e){if(!i){if(i=!0,n=e,e=c(e),void 0!==d&&p.hasValue){var t=p.value;if(d(t,e))return o=t}return o=e}if(t=o,r(n,e))return t;var a=c(e);return void 0!==d&&d(t,a)?(n=e,t):(n=e,o=a)}var n,o,i=!1,a=void 0===l?null:l;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,l,c,d]);var g=n(e,u[0],u[1]);return i((function(){p.hasValue=!0,p.value=g}),[g]),s(g),g}}();var C=o.version.startsWith("19"),A=Symbol.for(C?"react.transitional.element":"react.element"),O=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),T=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),k=L,W=_;function $(e){return function(e){if("object"==typeof e&&null!==e){const{$$typeof:t}=e;switch(t){case A:switch(e=e.type){case P:case B:case R:case M:case G:return e;default:switch(e=e&&e.$$typeof){case T:case L:case F:case _:case N:return e;default:return t}}case O:return t}}}(e)===_}function j(e,t,r,n,{areStatesEqual:o,areOwnPropsEqual:i,areStatePropsEqual:a}){let s,l,c,d,u,p=!1;function g(p,g){const f=!i(g,l),m=!o(p,s,g,l);return s=p,l=g,f&&m?(c=e(s,l),t.dependsOnOwnProps&&(d=t(n,l)),u=r(c,d,l),u):f?(e.dependsOnOwnProps&&(c=e(s,l)),t.dependsOnOwnProps&&(d=t(n,l)),u=r(c,d,l),u):m?function(){const t=e(s,l),n=!a(t,c);return c=t,n&&(u=r(c,d,l)),u}():u}return function(o,i){return p?g(o,i):(s=o,l=i,c=e(s,l),d=t(n,l),u=r(c,d,l),p=!0,u)}}function U(e){return function(t){const r=e(t);function n(){return r}return n.dependsOnOwnProps=!1,n}}function H(e){return e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function V(e,t){return function(t,{displayName:r}){const n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e,void 0)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=H(e);let o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=H(o),o=n(t,r)),o},n}}function q(e,t){return(r,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function z(e,t,r){return{...r,...e,...t}}var Y={notify(){},get:()=>[]};function J(e,t){let r,n=Y,o=0,i=!1;function a(){c.onStateChange&&c.onStateChange()}function s(){o++,r||(r=t?t.addNestedSub(a):e.subscribe(a),n=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let r=e;for(;r;)t.push(r),r=r.next;return t},subscribe(r){let n=!0;const o=t={callback:r,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){n&&null!==e&&(n=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}())}function l(){o--,r&&0===o&&(r(),r=void 0,n.clear(),n=Y)}const c={addNestedSub:function(e){s();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),l())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,s())},tryUnsubscribe:function(){i&&(i=!1,l())},getListeners:()=>n};return c}var X=(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),K=(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),Q=(()=>X||K?o.useLayoutEffect:o.useEffect)();function Z(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function ee(e,t){if(Z(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Z(e[r[n]],t[r[n]]))return!1;return!0}var te={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},re={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},ne={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},oe={[k]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[W]:ne};function ie(e){return $(e)?ne:oe[e.$$typeof]||te}var ae=Object.defineProperty,se=Object.getOwnPropertyNames,le=Object.getOwnPropertySymbols,ce=Object.getOwnPropertyDescriptor,de=Object.getPrototypeOf,ue=Object.prototype;function pe(e,t){if("string"!=typeof t){if(ue){const r=de(t);r&&r!==ue&&pe(e,r)}let r=se(t);le&&(r=r.concat(le(t)));const n=ie(e),o=ie(t);for(let i=0;i<r.length;++i){const a=r[i];if(!(re[a]||o&&o[a]||n&&n[a])){const r=ce(t,a);try{ae(e,a,r)}catch(e){}}}}return e}var ge=Symbol.for("react-redux-context"),fe="undefined"!=typeof globalThis?globalThis:{};function me(){if(!o.createContext)return{};const e=fe[ge]??=new Map;let t=e.get(o.createContext);return t||(t=o.createContext(null),e.set(o.createContext,t)),t}var be=me(),he=[null,null];function ve(e,t,r,n,o,i){e.current=n,r.current=!1,o.current&&(o.current=null,i())}function ye(e,t){return e===t}var xe=function(e,t,r,{pure:n,areStatesEqual:i=ye,areOwnPropsEqual:a=ee,areStatePropsEqual:s=ee,areMergedPropsEqual:l=ee,forwardRef:c=!1,context:d=be}={}){const u=d,p=function(e){return e?"function"==typeof e?V(e):q(e,"mapStateToProps"):U((()=>({})))}(e),g=function(e){return e&&"object"==typeof e?U((t=>function(e,t){const r={};for(const n in e){const o=e[n];"function"==typeof o&&(r[n]=(...e)=>t(o(...e)))}return r}(e,t))):e?"function"==typeof e?V(e):q(e,"mapDispatchToProps"):U((e=>({dispatch:e})))}(t),f=function(e){return e?"function"==typeof e?function(e){return function(t,{displayName:r,areMergedPropsEqual:n}){let o,i=!1;return function(t,r,a){const s=e(t,r,a);return i?n(s,o)||(o=s):(i=!0,o=s),o}}}(e):q(e,"mergeProps"):()=>z}(r),m=Boolean(e);return e=>{const t=e.displayName||e.name||"Component",r=`Connect(${t})`,n={shouldHandleStateChanges:m,displayName:r,wrappedComponentName:t,WrappedComponent:e,initMapStateToProps:p,initMapDispatchToProps:g,initMergeProps:f,areStatesEqual:i,areStatePropsEqual:s,areOwnPropsEqual:a,areMergedPropsEqual:l};function d(t){const[r,i,a]=o.useMemo((()=>{const{reactReduxForwardedRef:e,...r}=t;return[t.context,e,r]}),[t]),s=o.useMemo((()=>u),[r,u]),l=o.useContext(s),c=Boolean(t.store)&&Boolean(t.store.getState)&&Boolean(t.store.dispatch),d=Boolean(l)&&Boolean(l.store),p=c?t.store:l.store,g=d?l.getServerState:p.getState,f=o.useMemo((()=>function(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...o}){return j(t(e,o),r(e,o),n(e,o),e,o)}(p.dispatch,n)),[p]),[b,h]=o.useMemo((()=>{if(!m)return he;const e=J(p,c?void 0:l.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[p,c,l]),v=o.useMemo((()=>c?l:{...l,subscription:b}),[c,l,b]),y=o.useRef(void 0),x=o.useRef(a),I=o.useRef(void 0),D=o.useRef(!1),w=o.useRef(!1),E=o.useRef(void 0);Q((()=>(w.current=!0,()=>{w.current=!1})),[]);const S=o.useMemo((()=>()=>I.current&&a===x.current?I.current:f(p.getState(),a)),[p,a]),C=o.useMemo((()=>e=>b?function(e,t,r,n,o,i,a,s,l,c,d){if(!e)return()=>{};let u=!1,p=null;const g=()=>{if(u||!s.current)return;const e=t.getState();let r,g;try{r=n(e,o.current)}catch(e){g=e,p=e}g||(p=null),r===i.current?a.current||c():(i.current=r,l.current=r,a.current=!0,d())};return r.onStateChange=g,r.trySubscribe(),g(),()=>{if(u=!0,r.tryUnsubscribe(),r.onStateChange=null,p)throw p}}(m,p,b,f,x,y,D,w,I,h,e):()=>{}),[b]);var A,O,P;let R;A=ve,O=[x,y,D,a,I,h],Q((()=>A(...O)),P);try{R=o.useSyncExternalStore(C,S,g?()=>f(g(),a):S)}catch(e){throw E.current&&(e.message+=`\nThe error may be correlated with this previous error:\n${E.current.stack}\n\n`),e}Q((()=>{E.current=void 0,I.current=void 0,y.current=R}));const B=o.useMemo((()=>o.createElement(e,{...R,ref:i})),[i,e,R]);return o.useMemo((()=>m?o.createElement(s.Provider,{value:v},B):B),[s,B,v])}const b=o.memo(d);if(b.WrappedComponent=e,b.displayName=d.displayName=r,c){const t=o.forwardRef((function(e,t){return o.createElement(b,{...e,reactReduxForwardedRef:t})}));return t.displayName=r,t.WrappedComponent=e,pe(t,e)}return pe(b,e)}};var Ie=function(e){const{children:t,context:r,serverState:n,store:i}=e,a=o.useMemo((()=>{const e=J(i);return{store:i,subscription:e,getServerState:n?()=>n:void 0}}),[i,n]),s=o.useMemo((()=>i.getState()),[i]);Q((()=>{const{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),s!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}}),[a,s]);const l=r||be;return o.createElement(l.Provider,{value:a},t)};function De(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(r=e[o],n=t[o],!(r===n||Number.isNaN(r)&&Number.isNaN(n)))return!1;var r,n;return!0}function we(e,r){const n=t.useState((()=>({inputs:r,result:e()})))[0],o=t.useRef(!0),i=t.useRef(n),a=o.current||Boolean(r&&i.current.inputs&&De(r,i.current.inputs))?i.current:{inputs:r,result:e()};return t.useEffect((()=>{o.current=!1,i.current=a}),[a]),a.result}function Ee(e,t){return we((()=>e),t)}const Se={x:0,y:0},Ce=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Ae=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Oe=(e,t)=>e.x===t.x&&e.y===t.y,Pe=e=>({x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}),Re=(e,t,r=0)=>"x"===e?{x:t,y:r}:{x:r,y:t},Be=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Ne=(e,t)=>Math.min(...t.map((t=>Be(e,t)))),Te=e=>t=>({x:e(t.x),y:e(t.y)});var Le=function(e){var t=e.top,r=e.right,n=e.bottom,o=e.left;return{top:t,right:r,bottom:n,left:o,width:r-o,height:n-t,x:o,y:t,center:{x:(r+o)/2,y:(n+t)/2}}},Me=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},Ge=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},_e={top:0,right:0,bottom:0,left:0},Fe=function(e){var t=e.borderBox,r=e.margin,n=void 0===r?_e:r,o=e.border,i=void 0===o?_e:o,a=e.padding,s=void 0===a?_e:a,l=Le(Me(t,n)),c=Le(Ge(t,i)),d=Le(Ge(c,s));return{marginBox:l,borderBox:Le(t),paddingBox:c,contentBox:d,margin:n,border:i,padding:s}},ke=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var r=Number(t);return isNaN(r)&&function(e,t){throw new Error("Invariant failed")}(),r},We=function(e,t){var r,n,o=e.borderBox,i=e.border,a=e.margin,s=e.padding,l=(n=t,{top:(r=o).top+n.y,left:r.left+n.x,bottom:r.bottom+n.y,right:r.right+n.x});return Fe({borderBox:l,border:i,margin:a,padding:s})},$e=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),We(e,t)},je=function(e,t){var r={top:ke(t.marginTop),right:ke(t.marginRight),bottom:ke(t.marginBottom),left:ke(t.marginLeft)},n={top:ke(t.paddingTop),right:ke(t.paddingRight),bottom:ke(t.paddingBottom),left:ke(t.paddingLeft)},o={top:ke(t.borderTopWidth),right:ke(t.borderRightWidth),bottom:ke(t.borderBottomWidth),left:ke(t.borderLeftWidth)};return Fe({borderBox:e,margin:r,padding:n,border:o})},Ue=function(e){var t=e.getBoundingClientRect(),r=window.getComputedStyle(e);return je(t,r)};const He=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Ve=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],qe=(e,t)=>t&&t.shouldClipSubject?((e,t)=>{const r=Le({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return r.width<=0||r.height<=0?null:r})(t.pageMarginBox,e):Le(e);var ze=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const o=((e,t)=>t?He(e,t.scroll.diff.displacement):e)(e.marginBox,n),i=((e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e)(o,r,t);return{page:e,withPlaceholder:t,active:qe(i,n)}},Ye=(e,t)=>{e.frame||c();const r=e.frame,n=Ae(t,r.scroll.initial),o=Pe(n),i={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:o},max:r.scroll.max}},a=ze({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:a}};function Je(e,t=De){let r=null;function n(...n){if(r&&r.lastThis===this&&t(n,r.lastArgs))return r.lastResult;const o=e.apply(this,n);return r={lastResult:o,lastArgs:n,lastThis:this},o}return n.clear=function(){r=null},n}const Xe=Je((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),Ke=Je((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),Qe=Je((e=>Object.values(e))),Ze=Je((e=>Object.values(e)));var et=Je(((e,t)=>{const r=Ze(t).filter((t=>e===t.descriptor.droppableId)).sort(((e,t)=>e.descriptor.index-t.descriptor.index));return r}));function tt(e){return e.at&&"REORDER"===e.at.type?e.at.destination:null}function rt(e){return e.at&&"COMBINE"===e.at.type?e.at.combine:null}var nt=Je(((e,t)=>t.filter((t=>t.descriptor.id!==e.descriptor.id)))),ot=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const it={point:Se,value:0},at={invisible:{},visible:{},all:[]},st={displaced:at,displacedBy:it,at:null};var lt=(e,t)=>r=>e<=r&&r<=t,ct=e=>{const t=lt(e.top,e.bottom),r=lt(e.left,e.right);return n=>{if(t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right))return!0;const o=t(n.top)||t(n.bottom),i=r(n.left)||r(n.right);if(o&&i)return!0;const a=n.top<e.top&&n.bottom>e.bottom,s=n.left<e.left&&n.right>e.right;if(a&&s)return!0;return a&&i||s&&o}},dt=e=>{const t=lt(e.top,e.bottom),r=lt(e.left,e.right);return e=>t(e.top)&&t(e.bottom)&&r(e.left)&&r(e.right)};const ut={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},pt={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};const gt=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:o})=>{const i=n?((e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:Se;return He(e,r)})(e,t):e;return((e,t,r)=>!!t.subject.active&&r(t.subject.active)(e))(i,t,o)&&((e,t,r)=>r(t)(e))(i,r,o)},ft=e=>gt({...e,isVisibleThroughFrameFn:ct}),mt=e=>gt({...e,isVisibleThroughFrameFn:dt}),bt=(e,t,r)=>{if("boolean"==typeof r)return r;if(!t)return!0;const{invisible:n,visible:o}=t;if(n[e])return!1;const i=o[e];return!i||i.shouldAnimate};function ht({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:o,last:i}){return e.reduce((function(e,a){const s=function(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return Le(Me(r,n))}(a,r),l=a.descriptor.id;e.all.push(l);if(!ft({target:s,destination:t,viewport:n,withDroppableDisplacement:!0}))return e.invisible[a.descriptor.id]=!0,e;const c={draggableId:l,shouldAnimate:bt(l,i,o)};return e.visible[l]=c,e}),{all:[],visible:{},invisible:{}})}function vt({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const o=function(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}(e,{inHomeList:t});return{displaced:at,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:o}}}}function yt({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:o,last:i,index:a,forceShouldAnimate:s}){const l=ot(e,r);if(null==a)return vt({insideDestination:t,inHomeList:l,displacedBy:o,destination:r});const c=t.find((e=>e.descriptor.index===a));if(!c)return vt({insideDestination:t,inHomeList:l,displacedBy:o,destination:r});const d=nt(e,t),u=t.indexOf(c);return{displaced:ht({afterDragging:d.slice(u),destination:r,displacedBy:o,last:i,viewport:n.frame,forceShouldAnimate:s}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:a}}}}function xt(e,t){return Boolean(t.effected[e])}var It=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:o,insideDestination:i,previousImpact:a,viewport:s,afterCritical:l})=>{const d=a.at;if(d||c(),"REORDER"===d.type){const n=(({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const o=n.index,i=e?o+1:o-1,a=r[0].descriptor.index,s=r[r.length-1].descriptor.index;return i<a||i>(t?s:s+1)?null:i})({isMovingForward:e,isInHomeList:t,location:d.destination,insideDestination:i});return null==n?null:yt({draggable:r,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:n})}const u=(({isMovingForward:e,destination:t,draggables:r,combine:n,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const i=n.draggableId,a=r[i].descriptor.index;return xt(i,o)?e?a:a-1:e?a+1:a})({isMovingForward:e,destination:o,displaced:a.displaced,draggables:n,combine:d.combine,afterCritical:l});return null==u?null:yt({draggable:r,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:u})},Dt=({afterCritical:e,impact:t,draggables:r})=>{const n=rt(t);n||c();const o=n.draggableId,i=r[o].page.borderBox.center,a=(({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const o=Boolean(e.visible[r]||e.invisible[r]);return xt(r,t)?o?Se:Pe(n.point):o?n.point:Se})({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return Ce(i,a)};const wt=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,Et=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,St=({axis:e,moveRelativeTo:t,isMoving:r})=>Re(e.line,t.marginBox[e.end]+wt(e,r),Et(e,t.marginBox,r)),Ct=({axis:e,moveRelativeTo:t,isMoving:r})=>Re(e.line,t.marginBox[e.start]-((e,t)=>t.margin[e.end]+t.borderBox[e.size]/2)(e,r),Et(e,t.marginBox,r));var At=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o})=>{const i=et(n.descriptor.id,r),a=t.page,s=n.axis;if(!i.length)return(({axis:e,moveInto:t,isMoving:r})=>Re(e.line,t.contentBox[e.start]+wt(e,r),Et(e,t.contentBox,r)))({axis:s,moveInto:n.page,isMoving:a});const{displaced:l,displacedBy:c}=e,d=l.all[0];if(d){const e=r[d];if(xt(d,o))return Ct({axis:s,moveRelativeTo:e.page,isMoving:a});const t=We(e.page,c.point);return Ct({axis:s,moveRelativeTo:t,isMoving:a})}const u=i[i.length-1];if(u.descriptor.id===t.descriptor.id)return a.borderBox.center;if(xt(u.descriptor.id,o)){const e=We(u.page,Pe(o.displacedBy.point));return St({axis:s,moveRelativeTo:e,isMoving:a})}return St({axis:s,moveRelativeTo:u.page,isMoving:a})},Ot=(e,t)=>{const r=e.frame;return r?Ce(t,r.scroll.diff.displacement):t};var Pt=e=>{const t=(({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:o})=>{const i=t.page.borderBox.center,a=e.at;return r&&a?"REORDER"===a.type?At({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o}):Dt({impact:e,draggables:n,afterCritical:o}):i})(e),r=e.droppable;return r?Ot(r,t):t},Rt=(e,t)=>{const r=Ae(t,e.scroll.initial),n=Pe(r);return{frame:Le({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:r,displacement:n}}}};function Bt(e,t){return e.map((e=>t[e]))}var Nt=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=((e,t)=>Ce(e.scroll.diff.displacement,t))(r,e),o=Ae(n,t.page.borderBox.center);return Ce(t.client.borderBox.center,o)},Tt=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const a=Ae(r,e.page.borderBox.center),s={target:He(e.page.borderBox,a),destination:t,withDroppableDisplacement:o,viewport:n};return i?(e=>{return gt({...e,isVisibleThroughFrameFn:(t=e.destination.axis,e=>{const r=lt(e.top,e.bottom),n=lt(e.left,e.right);return e=>t===ut?r(e.top)&&r(e.bottom):n(e.left)&&n(e.right)})});var t})(s):mt(s)},Lt=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:o,viewport:i,previousPageBorderBoxCenter:a,previousClientSelection:s,afterCritical:l})=>{if(!r.isEnabled)return null;const d=et(r.descriptor.id,n),u=ot(t,r),p=(({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:o})=>{if(!r.isCombineEnabled)return null;if(!tt(o))return null;function i(e){const t={type:"COMBINE",combine:{draggableId:e,droppableId:r.descriptor.id}};return{...o,at:t}}const a=o.displaced.all,s=a.length?a[0]:null;if(e)return s?i(s):null;const l=nt(t,n);if(!s)return l.length?i(l[l.length-1].descriptor.id):null;const d=l.findIndex((e=>e.descriptor.id===s));-1===d&&c();const u=d-1;return u<0?null:i(l[u].descriptor.id)})({isMovingForward:e,draggable:t,destination:r,insideDestination:d,previousImpact:o})||It({isMovingForward:e,isInHomeList:u,draggable:t,draggables:n,destination:r,insideDestination:d,previousImpact:o,viewport:i,afterCritical:l});if(!p)return null;const g=Pt({impact:p,draggable:t,droppable:r,draggables:n,afterCritical:l});if(Tt({draggable:t,destination:r,newPageBorderBoxCenter:g,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})){return{clientSelection:Nt({pageBorderBoxCenter:g,draggable:t,viewport:i}),impact:p,scrollJumpRequest:null}}const f=Ae(g,a),m=(({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:o})=>{const i=Rt(t,Ce(t.scroll.current,o)),a=r.frame?Ye(r,Ce(r.frame.scroll.current,o)):r,s=e.displaced,l=ht({afterDragging:Bt(s.all,n),destination:r,displacedBy:e.displacedBy,viewport:i.frame,last:s,forceShouldAnimate:!1}),c=ht({afterDragging:Bt(s.all,n),destination:a,displacedBy:e.displacedBy,viewport:t.frame,last:s,forceShouldAnimate:!1}),d={},u={},p=[s,l,c];return s.all.forEach((e=>{const t=function(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}(e,p);t?u[e]=t:d[e]=!0})),{...e,displaced:{all:s.all,invisible:d,visible:u}}})({impact:p,viewport:i,destination:r,draggables:n,maxScrollChange:f});return{clientSelection:s,impact:m,scrollJumpRequest:f}};const Mt=e=>{const t=e.subject.active;return t||c(),t};const Gt=(e,t)=>{const r=e.page.borderBox.center;return xt(e.descriptor.id,t)?Ae(r,t.displacedBy.point):r},_t=(e,t)=>{const r=e.page.borderBox;return xt(e.descriptor.id,t)?He(r,Pe(t.displacedBy.point)):r};var Ft=Je((function(e,t){const r=t[e.line];return{value:r,point:Re(e.line,r)}}));const kt=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),Wt=(e,t,r)=>{const n=e.frame;ot(t,e)&&c(),e.subject.withPlaceholder&&c();const o=Ft(e.axis,t.displaceBy).point,i=((e,t,r)=>{const n=e.axis;if("virtual"===e.descriptor.mode)return Re(n.line,t[n.line]);const o=e.subject.page.contentBox[n.size],i=et(e.descriptor.id,r).reduce(((e,t)=>e+t.client.marginBox[n.size]),0)+t[n.line]-o;return i<=0?null:Re(n.line,i)})(e,o,r),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const t=ze({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:t}}const s=i?Ce(n.scroll.max,i):n.scroll.max,l=kt(n,s),d=ze({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:l});return{...e,subject:d,frame:l}};var $t=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:o,droppables:i,viewport:a,afterCritical:s})=>{const l=(({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:o})=>{const i=r.subject.active;if(!i)return null;const a=r.axis,s=lt(i[a.start],i[a.end]),l=Qe(n).filter((e=>e!==r)).filter((e=>e.isEnabled)).filter((e=>Boolean(e.subject.active))).filter((e=>ct(o.frame)(Mt(e)))).filter((t=>{const r=Mt(t);return e?i[a.crossAxisEnd]<r[a.crossAxisEnd]:r[a.crossAxisStart]<i[a.crossAxisStart]})).filter((e=>{const t=Mt(e),r=lt(t[a.start],t[a.end]);return s(t[a.start])||s(t[a.end])||r(i[a.start])||r(i[a.end])})).sort(((t,r)=>{const n=Mt(t)[a.crossAxisStart],o=Mt(r)[a.crossAxisStart];return e?n-o:o-n})).filter(((e,t,r)=>Mt(e)[a.crossAxisStart]===Mt(r[0])[a.crossAxisStart]));if(!l.length)return null;if(1===l.length)return l[0];const c=l.filter((e=>lt(Mt(e)[a.start],Mt(e)[a.end])(t[a.line])));return 1===c.length?c[0]:c.length>1?c.sort(((e,t)=>Mt(e)[a.start]-Mt(t)[a.start]))[0]:l.sort(((e,r)=>{const n=Ne(t,Ve(Mt(e))),o=Ne(t,Ve(Mt(r)));return n!==o?n-o:Mt(e)[a.start]-Mt(r)[a.start]}))[0]})({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:i,viewport:a});if(!l)return null;const c=et(l.descriptor.id,o),d=(({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:o})=>{const i=n.filter((e=>mt({target:_t(e,o),destination:r,viewport:t.frame,withDroppableDisplacement:!0}))).sort(((t,n)=>{const i=Be(e,Ot(r,Gt(t,o))),a=Be(e,Ot(r,Gt(n,o)));return i<a?-1:a<i?1:t.descriptor.index-n.descriptor.index}));return i[0]||null})({pageBorderBoxCenter:t,viewport:a,destination:l,insideDestination:c,afterCritical:s}),u=(({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:o,destination:i,viewport:a,afterCritical:s})=>{if(!t){if(r.length)return null;const e={displaced:at,displacedBy:it,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},t=Pt({impact:e,draggable:n,droppable:i,draggables:o,afterCritical:s}),l=ot(n,i)?i:Wt(i,n,o);return Tt({draggable:n,destination:l,newPageBorderBoxCenter:t,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?e:null}const l=Boolean(e[i.axis.line]<=t.page.borderBox.center[i.axis.line]),c=(()=>{const e=t.descriptor.index;return t.descriptor.id===n.descriptor.id||l?e:e+1})(),d=Ft(i.axis,n.displaceBy);return yt({draggable:n,insideDestination:r,destination:i,viewport:a,displacedBy:d,last:at,index:c})})({previousPageBorderBoxCenter:t,destination:l,draggable:r,draggables:o,moveRelativeTo:d,insideDestination:c,viewport:a,afterCritical:s});if(!u)return null;const p=Pt({impact:u,draggable:r,droppable:l,draggables:o,afterCritical:s});return{clientSelection:Nt({pageBorderBoxCenter:p,draggable:r,viewport:a}),impact:u,scrollJumpRequest:null}},jt=e=>{const t=e.at;return t?"REORDER"===t.type?t.destination.droppableId:t.combine.droppableId:null};var Ut=({state:e,type:t})=>{const r=((e,t)=>{const r=jt(e);return r?t[r]:null})(e.impact,e.dimensions.droppables),n=Boolean(r),o=e.dimensions.droppables[e.critical.droppable.id],i=r||o,a=i.axis.direction,s="vertical"===a&&("MOVE_UP"===t||"MOVE_DOWN"===t)||"horizontal"===a&&("MOVE_LEFT"===t||"MOVE_RIGHT"===t);if(s&&!n)return null;const l="MOVE_DOWN"===t||"MOVE_RIGHT"===t,c=e.dimensions.draggables[e.critical.draggable.id],d=e.current.page.borderBoxCenter,{draggables:u,droppables:p}=e.dimensions;return s?Lt({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,destination:i,draggables:u,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):$t({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,isOver:i,draggables:u,droppables:p,viewport:e.viewport,afterCritical:e.afterCritical})};function Ht(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}function Vt(e){const t=lt(e.top,e.bottom),r=lt(e.left,e.right);return function(e){return t(e.y)&&r(e.x)}}function qt({pageBorderBox:e,draggable:t,droppables:r}){const n=Qe(r).filter((t=>{if(!t.isEnabled)return!1;const r=t.subject.active;if(!r)return!1;if(o=r,!((n=e).left<o.right&&n.right>o.left&&n.top<o.bottom&&n.bottom>o.top))return!1;var n,o;if(Vt(r)(e.center))return!0;const i=t.axis,a=r.center[i.crossAxisLine],s=e[i.crossAxisStart],l=e[i.crossAxisEnd],c=lt(r[i.crossAxisStart],r[i.crossAxisEnd]),d=c(s),u=c(l);return!d&&!u||(d?s<a:l>a)}));return n.length?1===n.length?n[0].descriptor.id:function({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,o=r.map((t=>{const r=t.axis,o=Re(t.axis.line,e.center[r.line],t.page.borderBox.center[r.crossAxisLine]);return{id:t.descriptor.id,distance:Be(n,o)}})).sort(((e,t)=>t.distance-e.distance));return o[0]?o[0].id:null}({pageBorderBox:e,draggable:t,candidates:n}):null}const zt=(e,t)=>Le(He(e,t));function Yt({displaced:e,id:t}){return Boolean(e.visible[t]||e.invisible[t])}var Jt=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:o,viewport:i,afterCritical:a})=>{const s=zt(t.page.borderBox,e),l=qt({pageBorderBox:s,draggable:t,droppables:n});if(!l)return st;const c=n[l],d=et(c.descriptor.id,r),u=((e,t)=>{const r=e.frame;return r?zt(t,r.scroll.diff.value):t})(c,s);return(({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:o,afterCritical:i})=>{if(!n.isCombineEnabled)return null;const a=n.axis,s=Ft(n.axis,e.displaceBy),l=s.value,c=t[a.start],d=t[a.end],u=nt(e,o).find((e=>{const t=e.descriptor.id,n=e.page.borderBox,o=n[a.size]/4,s=xt(t,i),u=Yt({displaced:r.displaced,id:t});return s?u?d>n[a.start]+o&&d<n[a.end]-o:c>n[a.start]-l+o&&c<n[a.end]-l-o:u?d>n[a.start]+l+o&&d<n[a.end]+l-o:c>n[a.start]+o&&c<n[a.end]-o}));return u?{displacedBy:s,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:u.descriptor.id,droppableId:n.descriptor.id}}}:null})({pageBorderBoxWithDroppableScroll:u,draggable:t,previousImpact:o,destination:c,insideDestination:d,afterCritical:a})||(({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:o,viewport:i,afterCritical:a})=>{const s=r.axis,l=Ft(r.axis,t.displaceBy),c=l.value,d=e[s.start],u=e[s.end],p=function({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}({draggable:t,closest:nt(t,n).find((e=>{const t=e.descriptor.id,r=e.page.borderBox.center[s.line],n=xt(t,a),i=Yt({displaced:o,id:t});return n?i?u<=r:d<r-c:i?u<=r+c:d<r}))||null,inHomeList:ot(t,r)});return yt({draggable:t,insideDestination:n,destination:r,viewport:i,last:o,displacedBy:l,index:p})})({pageBorderBoxWithDroppableScroll:u,draggable:t,destination:c,insideDestination:d,last:o.displaced,viewport:i,afterCritical:a})},Xt=(e,t)=>({...e,[t.descriptor.id]:t});const Kt=({previousImpact:e,impact:t,droppables:r})=>{const n=jt(e),o=jt(t);if(!n)return r;if(n===o)return r;const i=r[n];if(!i.subject.withPlaceholder)return r;const a=(e=>{const t=e.subject.withPlaceholder;t||c();const r=e.frame;if(!r){const t=ze({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:t}}const n=t.oldFrameMaxScroll;n||c();const o=kt(r,n),i=ze({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}})(i);return Xt(r,a)};var Qt=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:o,scrollJumpRequest:i})=>{const a=n||e.viewport,s=r||e.dimensions,l=t||e.current.client.selection,c=Ae(l,e.initial.client.selection),d={offset:c,selection:l,borderBoxCenter:Ce(e.initial.client.borderBoxCenter,c)},u={selection:Ce(d.selection,a.scroll.current),borderBoxCenter:Ce(d.borderBoxCenter,a.scroll.current),offset:Ce(d.offset,a.scroll.diff.value)},p={client:d,page:u};if("COLLECTING"===e.phase)return{...e,dimensions:s,viewport:a,current:p};const g=s.draggables[e.critical.draggable.id],f=o||Jt({pageOffset:u.offset,draggable:g,draggables:s.draggables,droppables:s.droppables,previousImpact:e.impact,viewport:a,afterCritical:e.afterCritical}),m=(({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:o})=>{const i=Kt({previousImpact:n,impact:o,droppables:r}),a=jt(o);if(!a)return i;const s=r[a];if(ot(e,s))return i;if(s.subject.withPlaceholder)return i;const l=Wt(s,e,t);return Xt(i,l)})({draggable:g,impact:f,previousImpact:e.impact,draggables:s.draggables,droppables:s.droppables});return{...e,current:p,dimensions:{draggables:s.draggables,droppables:m},impact:f,viewport:a,scrollJumpRequest:i||null,forceShouldAnimate:!i&&null}};var Zt=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:o})=>{const i=e.displaced,a=function(e,t){return e.map((e=>t[e]))}(i.all,r),s=ht({afterDragging:a,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:s}},er=({impact:e,draggable:t,droppable:r,draggables:n,viewport:o,afterCritical:i})=>{const a=Pt({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:i});return Nt({pageBorderBoxCenter:a,draggable:t,viewport:o})},tr=({state:e,dimensions:t,viewport:r})=>{"SNAP"!==e.movementMode&&c();const n=e.impact,o=r||e.viewport,i=t||e.dimensions,{draggables:a,droppables:s}=i,l=a[e.critical.draggable.id],d=jt(n);d||c();const u=s[d],p=Zt({impact:n,viewport:o,destination:u,draggables:a}),g=er({impact:p,draggable:l,droppable:u,draggables:a,viewport:o,afterCritical:e.afterCritical});return Qt({impact:p,clientSelection:g,state:e,dimensions:i,viewport:o})},rr=({draggable:e,home:t,draggables:r,viewport:n})=>{const o=Ft(t.axis,e.displaceBy),i=et(t.descriptor.id,r),a=i.indexOf(e);-1===a&&c();const s=i.slice(a+1),l=s.reduce(((e,t)=>(e[t.descriptor.id]=!0,e)),{}),d={inVirtualList:"virtual"===t.descriptor.mode,displacedBy:o,effected:l};var u;return{impact:{displaced:ht({afterDragging:s,destination:t,displacedBy:o,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:(u=e.descriptor,{index:u.index,droppableId:u.droppableId})}},afterCritical:d}},nr=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map((e=>{const o=e.descriptor.droppableId,i=(e=>{const t=e.frame;return t||c(),t})(t[o]),a=i.scroll.diff.value,s=(({draggable:e,offset:t,initialWindowScroll:r})=>{const n=We(e.client,t),o=$e(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:o}})({draggable:e,offset:Ce(n,a),initialWindowScroll:r.scroll.initial});return s}))};const or=e=>"SNAP"===e.movementMode,ir=(e,t,r)=>{const n=((e,t)=>({draggables:e.draggables,droppables:Xt(e.droppables,t)}))(e.dimensions,t);return!or(e)||r?Qt({state:e,dimensions:n}):tr({state:e,dimensions:n})};function ar(e){return e.isDragging&&"SNAP"===e.movementMode?{...e,scrollJumpRequest:null}:e}const sr={phase:"IDLE",completed:null,shouldFlush:!1};var lr=(e=sr,t)=>{if("FLUSH"===t.type)return{...sr,shouldFlush:!0};if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&c();const{critical:r,clientSelection:n,viewport:o,dimensions:i,movementMode:a}=t.payload,s=i.draggables[r.draggable.id],l=i.droppables[r.droppable.id],d={selection:n,borderBoxCenter:s.client.borderBox.center,offset:Se},u={client:d,page:{selection:Ce(d.selection,o.scroll.initial),borderBoxCenter:Ce(d.selection,o.scroll.initial),offset:Ce(d.selection,o.scroll.diff.value)}},p=Qe(i.droppables).every((e=>!e.isFixedOnPage)),{impact:g,afterCritical:f}=rr({draggable:s,home:l,draggables:i.draggables,viewport:o});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:a,dimensions:i,initial:u,current:u,isWindowScrollAllowed:p,impact:g,afterCritical:f,onLiftImpact:g,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if("COLLECTION_STARTING"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&c();return{...e,phase:"COLLECTING"}}if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&c(),(({state:e,published:t})=>{const r=t.modified.map((t=>{const r=e.dimensions.droppables[t.droppableId];return Ye(r,t.scroll)})),n={...e.dimensions.droppables,...Xe(r)},o=Ke(nr({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),i={...e.dimensions.draggables,...o};t.removals.forEach((e=>{delete i[e]}));const a={droppables:n,draggables:i},s=jt(e.impact),l=s?a.droppables[s]:null,c=a.draggables[e.critical.draggable.id],d=a.droppables[e.critical.droppable.id],{impact:u,afterCritical:p}=rr({draggable:c,home:d,draggables:i,viewport:e.viewport}),g=l&&l.isCombineEnabled?e.impact:u,f=Jt({pageOffset:e.current.page.offset,draggable:a.draggables[e.critical.draggable.id],draggables:a.draggables,droppables:a.droppables,previousImpact:g,viewport:e.viewport,afterCritical:p}),m={...e,phase:"DRAGGING",impact:f,onLiftImpact:u,dimensions:a,afterCritical:p,forceShouldAnimate:!1};return"COLLECTING"===e.phase?m:{...m,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}})({state:e,published:t.payload});if("MOVE"===t.type){if("DROP_PENDING"===e.phase)return e;Ht(e)||c();const{client:r}=t.payload;return Oe(r,e.current.client.selection)?e:Qt({state:e,clientSelection:r,impact:or(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return ar(e);if("COLLECTING"===e.phase)return ar(e);Ht(e)||c();const{id:r,newScroll:n}=t.payload,o=e.dimensions.droppables[r];if(!o)return e;const i=Ye(o,n);return ir(e,i,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ht(e)||c();const{id:r,isEnabled:n}=t.payload,o=e.dimensions.droppables[r];o||c(),o.isEnabled===n&&c();const i={...o,isEnabled:n};return ir(e,i,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ht(e)||c();const{id:r,isCombineEnabled:n}=t.payload,o=e.dimensions.droppables[r];o||c(),o.isCombineEnabled===n&&c();const i={...o,isCombineEnabled:n};return ir(e,i,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;Ht(e)||c(),e.isWindowScrollAllowed||c();const r=t.payload.newScroll;if(Oe(e.viewport.scroll.current,r))return ar(e);const n=Rt(e.viewport,r);return or(e)?tr({state:e,viewport:n}):Qt({state:e,viewport:n})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!Ht(e))return e;const r=t.payload.maxScroll;if(Oe(r,e.viewport.scroll.max))return e;const n={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:n}}if("MOVE_UP"===t.type||"MOVE_DOWN"===t.type||"MOVE_LEFT"===t.type||"MOVE_RIGHT"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&c();const r=Ut({state:e,type:t.type});return r?Qt({state:e,impact:r.impact,clientSelection:r.clientSelection,scrollJumpRequest:r.scrollJumpRequest}):e}if("DROP_PENDING"===t.type){const r=t.payload.reason;"COLLECTING"!==e.phase&&c();return{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if("DROP_ANIMATE"===t.type){const{completed:r,dropDuration:n,newHomeClientOffset:o}=t.payload;"DRAGGING"!==e.phase&&"DROP_PENDING"!==e.phase&&c();return{phase:"DROP_ANIMATING",completed:r,dropDuration:n,newHomeClientOffset:o,dimensions:e.dimensions}}if("DROP_COMPLETE"===t.type){const{completed:e}=t.payload;return{phase:"IDLE",completed:e,shouldFlush:!1}}return e};function cr(e,t){return e instanceof Object&&"type"in e&&e.type===t}const dr=e=>({type:"LIFT",payload:e}),ur=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),pr=()=>({type:"COLLECTION_STARTING",payload:null}),gr=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),fr=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),mr=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),br=e=>({type:"MOVE",payload:e}),hr=()=>({type:"MOVE_UP",payload:null}),vr=()=>({type:"MOVE_DOWN",payload:null}),yr=()=>({type:"MOVE_RIGHT",payload:null}),xr=()=>({type:"MOVE_LEFT",payload:null}),Ir=()=>({type:"FLUSH",payload:null}),Dr=e=>({type:"DROP_COMPLETE",payload:e}),wr=e=>({type:"DROP",payload:e}),Er=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});const Sr="cubic-bezier(.2,1,.1,1)",Cr={drop:0,combining:.7},Ar={drop:.75},Or={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Pr=`${Or.outOfTheWay}s ${"cubic-bezier(0.2, 0, 0, 1)"}`,Rr={fluid:`opacity ${Pr}`,snap:`transform ${Pr}, opacity ${Pr}`,drop:e=>{const t=`${e}s ${Sr}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Pr}`,placeholder:`height ${Pr}, width ${Pr}, margin ${Pr}`},Br=e=>Oe(e,Se)?void 0:`translate(${e.x}px, ${e.y}px)`,Nr={moveTo:Br,drop:(e,t)=>{const r=Br(e);if(r)return t?`${r} scale(${Ar.drop})`:r}},{minDropTime:Tr,maxDropTime:Lr}=Or,Mr=Lr-Tr;const Gr=({getState:e,dispatch:t})=>r=>n=>{if(!cr(n,"DROP"))return void r(n);const o=e(),i=n.payload.reason;if("COLLECTING"===o.phase)return void t((e=>({type:"DROP_PENDING",payload:e}))({reason:i}));if("IDLE"===o.phase)return;"DROP_PENDING"===o.phase&&o.isWaiting&&c(),"DRAGGING"!==o.phase&&"DROP_PENDING"!==o.phase&&c();const a=o.critical,s=o.dimensions,l=s.draggables[o.critical.draggable.id],{impact:d,didDropInsideDroppable:u}=(({draggables:e,reason:t,lastImpact:r,home:n,viewport:o,onLiftImpact:i})=>{if(!r.at||"DROP"!==t)return{impact:Zt({draggables:e,impact:i,destination:n,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1};return"REORDER"===r.at.type?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:at},didDropInsideDroppable:!0}})({reason:i,lastImpact:o.impact,afterCritical:o.afterCritical,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),p=u?tt(d):null,g=u?rt(d):null,f={index:a.draggable.index,droppableId:a.droppable.id},m={draggableId:l.descriptor.id,type:l.descriptor.type,source:f,reason:i,mode:o.movementMode,destination:p,combine:g},b=(({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:o})=>{const{draggables:i,droppables:a}=r,s=jt(e),l=s?a[s]:null,c=a[t.descriptor.droppableId],d=er({impact:e,draggable:t,draggables:i,afterCritical:o,droppable:l||c,viewport:n});return Ae(d,t.client.borderBox.center)})({impact:d,draggable:l,dimensions:s,viewport:o.viewport,afterCritical:o.afterCritical}),h={critical:o.critical,afterCritical:o.afterCritical,result:m,impact:d};if(!(!Oe(o.current.client.offset,b)||Boolean(m.combine)))return void t(Dr({completed:h}));const v=(({current:e,destination:t,reason:r})=>{const n=Be(e,t);if(n<=0)return Tr;if(n>=1500)return Lr;const o=Tr+Mr*(n/1500);return Number(("CANCEL"===r?.6*o:o).toFixed(2))})({current:o.current.client.offset,destination:b,reason:i});t((e=>({type:"DROP_ANIMATE",payload:e}))({newHomeClientOffset:b,dropDuration:v,completed:h}))};var _r=function(e){var t=[],r=null,n=function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];t=o,r||(r=requestAnimationFrame((function(){r=null,e.apply(void 0,t)})))};return n.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},n},Fr=()=>({x:window.pageXOffset,y:window.pageYOffset});function kr({onWindowScroll:e}){const t=_r((function(){e(Fr())})),r=function(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}(t);let n=i;function o(){return n!==i}return{start:function(){o()&&c(),n=a(window,[r])},stop:function(){o()||c(),t.cancel(),n(),n=i},isActive:o}}const Wr=e=>{const t=kr({onWindowScroll:t=>{e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return e=>r=>{!t.isActive()&&cr(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&(e=>cr(e,"DROP_COMPLETE")||cr(e,"DROP_ANIMATE")||cr(e,"FLUSH"))(r)&&t.stop(),e(r)}};var $r=()=>{const e=[];return{add:t=>{const r=setTimeout((()=>(t=>{const r=e.findIndex((e=>e.timerId===t));-1===r&&c();const[n]=e.splice(r,1);n.callback()})(r))),n={timerId:r,callback:t};e.push(n)},flush:()=>{if(!e.length)return;const t=[...e];e.length=0,t.forEach((e=>{clearTimeout(e.timerId),e.callback()}))}}};const jr=(e,t)=>{t()},Ur=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function Hr(e,t,r,n){if(!e)return void r(n(t));const o=(e=>{let t=!1,r=!1;const n=setTimeout((()=>{r=!0})),o=o=>{t||r||(t=!0,e(o),clearTimeout(n))};return o.wasCalled=()=>t,o})(r);e(t,{announce:o}),o.wasCalled()||r(n(t))}var Vr=(e,t)=>{const r=((e,t)=>{const r=$r();let n=null;const o=r=>{n||c(),n=null,jr(0,(()=>Hr(e().onDragEnd,r,t,m.onDragEnd)))};return{beforeCapture:(t,r)=>{n&&c(),jr(0,(()=>{const n=e().onBeforeCapture;n&&n({draggableId:t,mode:r})}))},beforeStart:(t,r)=>{n&&c(),jr(0,(()=>{const n=e().onBeforeDragStart;n&&n(Ur(t,r))}))},start:(o,i)=>{n&&c();const a=Ur(o,i);n={mode:i,lastCritical:o,lastLocation:a.source,lastCombine:null},r.add((()=>{jr(0,(()=>Hr(e().onDragStart,a,t,m.onDragStart)))}))},update:(o,i)=>{const a=tt(i),s=rt(i);n||c();const l=!((e,t)=>{if(e===t)return!0;const r=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&n})(o,n.lastCritical);l&&(n.lastCritical=o);const d=(p=a,!(null==(u=n.lastLocation)&&null==p||null!=u&&null!=p&&u.droppableId===p.droppableId&&u.index===p.index));var u,p;d&&(n.lastLocation=a);const g=!((e,t)=>null==e&&null==t||null!=e&&null!=t&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId)(n.lastCombine,s);if(g&&(n.lastCombine=s),!l&&!d&&!g)return;const f={...Ur(o,n.mode),combine:s,destination:a};r.add((()=>