@hello-pangea/dnd
Version:
Beautiful and accessible drag and drop for lists with React
10 lines • 97.8 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=!0,l="Invariant failed";class c extends Error{}function d(e,t){throw new c(s?l:`${l}: `)}c.prototype.toString=function(){return this.message};class u 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 c&&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 c))throw e;this.setState({})}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const p=e=>e+1,g=(e,t)=>{const r=e.droppableId===t.droppableId,n=p(e.index),o=p(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 `},f=(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 `,m=e=>`\n The item has returned to its starting position\n of ${p(e.index)}\n`,b={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 ${p(e.source.index)}\n`,onDragUpdate:e=>{const t=e.destination;if(t)return g(e.source,t);const r=e.combine;return r?f(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 ${m(e.source)}\n `;const t=e.destination,r=e.combine;return t?`\n You have dropped the item.\n ${g(e.source,t)}\n `:r?`\n You have dropped the item.\n ${f(e.draggableId,e.source,r)}\n `:`\n The item has been dropped while not over a drop area.\n ${m(e.source)}\n `}};function h(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 v=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),y=()=>Math.random().toString(36).substring(7).split("").join("."),x={INIT:`@@redux/INIT${y()}`,REPLACE:`@@redux/REPLACE${y()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${y()}`};function I(e,t,r){if("function"!=typeof e)throw new Error(h(2));if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(h(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(h(1));return r(I)(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(h(3));return o}function u(e){if("function"!=typeof e)throw new Error(h(4));if(l)throw new Error(h(5));let t=!0;c();const r=s++;return a.set(r,e),function(){if(t){if(l)throw new Error(h(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(h(7));if(void 0===e.type)throw new Error(h(8));if("string"!=typeof e.type)throw new Error(h(17));if(l)throw new Error(h(9));try{l=!0,o=n(o,e)}finally{l=!1}return(i=a).forEach((e=>{e()})),e}p({type:x.INIT});return{dispatch:p,subscribe:u,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw new Error(h(10));n=e,p({type:x.REPLACE})},[v]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(h(11));function r(){const e=t;e.next&&e.next(d())}r();return{unsubscribe:e(r)}},[v](){return this}}}}}function D(e,t){return function(...r){return t(e.apply(this,r))}}function w(e,t){if("function"==typeof e)return D(e,t);if("object"!=typeof e||null===e)throw new Error(h(16));const r={};for(const n in e){const o=e[n];"function"==typeof o&&(r[n]=D(o,t))}return r}function E(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...r)=>e(t(...r))))}var S,C={};
/**
* @license React
* use-sync-external-store-with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its 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(S)return C;S=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;C.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)?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 A="default"in o?o.default:o,O=Symbol.for("react-redux-context"),P="undefined"!=typeof globalThis?globalThis:{};function N(){if(!A.createContext)return{};const e=P[O]??(P[O]=new Map);let t=e.get(A.createContext);return t||(t=A.createContext(null),e.set(A.createContext,t)),t}var R=N(),B=Symbol.for("react.element"),T=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),F=Symbol.for("react.context"),k=Symbol.for("react.server_context"),W=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),V=W,q=j;function z(e){return function(e){if("object"==typeof e&&null!==e){const t=e.$$typeof;switch(t){case B:{const r=e.type;switch(r){case L:case G:case M:case $:case U:return r;default:{const e=r&&r.$$typeof;switch(e){case k:case F:case W:case H:case j:case _:return e;default:return t}}}}case T:return t}}}(e)===j}function Y(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 J(e){return function(t){const r=e(t);function n(){return r}return n.dependsOnOwnProps=!1,n}}function X(e){return e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function K(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=X(e);let o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=X(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 ee={notify(){},get:()=>[]};function te(e,t){let r,n=ee,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=ee)}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 re=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),ne="undefined"!=typeof navigator&&"ReactNative"===navigator.product,oe=re||ne?A.useLayoutEffect:A.useEffect;function ie(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function ae(e,t){if(ie(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])||!ie(e[r[n]],t[r[n]]))return!1;return!0}var se={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},le={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},ce={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},de={[V]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[q]:ce};function ue(e){return z(e)?ce:de[e.$$typeof]||se}var pe=Object.defineProperty,ge=Object.getOwnPropertyNames,fe=Object.getOwnPropertySymbols,me=Object.getOwnPropertyDescriptor,be=Object.getPrototypeOf,he=Object.prototype;function ve(e,t){if("string"!=typeof t){if(he){const r=be(t);r&&r!==he&&ve(e,r)}let r=ge(t);fe&&(r=r.concat(fe(t)));const n=ue(e),o=ue(t);for(let i=0;i<r.length;++i){const a=r[i];if(!(le[a]||o&&o[a]||n&&n[a])){const r=me(t,a);try{pe(e,a,r)}catch(e){}}}}return e}var ye=()=>{throw new Error("uSES not initialized!")},xe=[null,null];function Ie(e,t,r,n,o,i){e.current=n,r.current=!1,o.current&&(o.current=null,i())}function De(e,t){return e===t}var we=function(e,t,r,{pure:n,areStatesEqual:o=De,areOwnPropsEqual:i=ae,areStatePropsEqual:a=ae,areMergedPropsEqual:s=ae,forwardRef:l=!1,context:c=R}={}){const d=c,u=function(e){return e?"function"==typeof e?K(e):Q(e,"mapStateToProps"):J((()=>({})))}(e),p=function(e){return e&&"object"==typeof e?J((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?K(e):Q(e,"mapDispatchToProps"):J((e=>({dispatch:e})))}(t),g=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),f=Boolean(e);return e=>{const t=e.displayName||e.name||"Component",r=`Connect(${t})`,n={shouldHandleStateChanges:f,displayName:r,wrappedComponentName:t,WrappedComponent:e,initMapStateToProps:u,initMapDispatchToProps:p,initMergeProps:g,areStatesEqual:o,areStatePropsEqual:a,areOwnPropsEqual:i,areMergedPropsEqual:s};function c(t){const[r,o,i]=A.useMemo((()=>{const{reactReduxForwardedRef:e,...r}=t;return[t.context,e,r]}),[t]),a=A.useMemo((()=>d),[r,d]),s=A.useContext(a),l=Boolean(t.store)&&Boolean(t.store.getState)&&Boolean(t.store.dispatch),c=Boolean(s)&&Boolean(s.store),u=l?t.store:s.store,p=c?s.getServerState:u.getState,g=A.useMemo((()=>function(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...o}){return Y(t(e,o),r(e,o),n(e,o),e,o)}(u.dispatch,n)),[u]),[m,b]=A.useMemo((()=>{if(!f)return xe;const e=te(u,l?void 0:s.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[u,l,s]),h=A.useMemo((()=>l?s:{...s,subscription:m}),[l,s,m]),v=A.useRef(void 0),y=A.useRef(i),x=A.useRef(void 0),I=A.useRef(!1),D=A.useRef(!1),w=A.useRef(void 0);oe((()=>(D.current=!0,()=>{D.current=!1})),[]);const E=A.useMemo((()=>()=>x.current&&i===y.current?x.current:g(u.getState(),i)),[u,i]),S=A.useMemo((()=>e=>m?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}}(f,u,m,g,y,v,I,D,x,b,e):()=>{}),[m]);var C,O,P;let N;C=Ie,O=[y,v,I,i,x,b],oe((()=>C(...O)),P);try{N=ye(S,E,p?()=>g(p(),i):E)}catch(e){throw w.current&&(e.message+=`\nThe error may be correlated with this previous error:\n${w.current.stack}\n\n`),e}oe((()=>{w.current=void 0,x.current=void 0,v.current=N}));const R=A.useMemo((()=>A.createElement(e,{...N,ref:o})),[o,e,N]);return A.useMemo((()=>f?A.createElement(a.Provider,{value:h},R):R),[a,R,h])}const m=A.memo(c);if(m.WrappedComponent=e,m.displayName=c.displayName=r,l){const t=A.forwardRef((function(e,t){return A.createElement(m,{...e,reactReduxForwardedRef:t})}));return t.displayName=r,t.WrappedComponent=e,ve(t,e)}return ve(m,e)}};var Ee,Se=function({store:e,context:t,children:r,serverState:n,stabilityCheck:o="once",identityFunctionCheck:i="once"}){const a=A.useMemo((()=>{const t=te(e);return{store:e,subscription:t,getServerState:n?()=>n:void 0,stabilityCheck:o,identityFunctionCheck:i}}),[e,n,o,i]),s=A.useMemo((()=>e.getState()),[e]);oe((()=>{const{subscription:t}=a;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),s!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[a,s]);const l=t||R;return A.createElement(l.Provider,{value:a},r)};function Ce(e,r){var n=t.useState((function(){return{inputs:r,result:e()}}))[0],o=t.useRef(!0),i=t.useRef(n),a=o.current||Boolean(r&&i.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(r,i.current.inputs))?i.current:{inputs:r,result:e()};return t.useEffect((function(){o.current=!1,i.current=a}),[a]),a.result}Ee=o.useSyncExternalStore,ye=Ee;var Ae=Ce,Oe=function(e,t){return Ce((function(){return e}),t)};const Pe={x:0,y:0},Ne=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Re=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Be=(e,t)=>e.x===t.x&&e.y===t.y,Te=e=>({x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}),Le=(e,t,r=0)=>"x"===e?{x:t,y:r}:{x:r,y:t},Me=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Ge=(e,t)=>Math.min(...t.map((t=>Me(e,t)))),_e=e=>t=>({x:e(t.x),y:e(t.y)});var Fe=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}}},ke=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},We=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},Ue=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=Fe(ke(t,n)),c=Fe(We(t,i)),d=Fe(We(c,s));return{marginBox:l,borderBox:Fe(t),paddingBox:c,contentBox:d,margin:n,border:i,padding:s}},je=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},He=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 Ue({borderBox:l,border:i,margin:a,padding:s})},Ve=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),He(e,t)},qe=function(e,t){var r={top:je(t.marginTop),right:je(t.marginRight),bottom:je(t.marginBottom),left:je(t.marginLeft)},n={top:je(t.paddingTop),right:je(t.paddingRight),bottom:je(t.paddingBottom),left:je(t.paddingLeft)},o={top:je(t.borderTopWidth),right:je(t.borderRightWidth),bottom:je(t.borderBottomWidth),left:je(t.borderLeftWidth)};return Ue({borderBox:e,margin:r,padding:n,border:o})},ze=function(e){var t=e.getBoundingClientRect(),r=window.getComputedStyle(e);return qe(t,r)};const Ye=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Je=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}],Xe=(e,t)=>t&&t.shouldClipSubject?((e,t)=>{const r=Fe({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):Fe(e);var Ke=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const o=((e,t)=>t?Ye(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:Xe(i,n)}},Qe=(e,t)=>{e.frame||d();const r=e.frame,n=Re(t,r.scroll.initial),o=Te(n),i={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:o},max:r.scroll.max}},a=Ke({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:a}},Ze=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function et(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(n=e[r],o=t[r],!(n===o||Ze(n)&&Ze(o)))return!1;var n,o;return!0}function tt(e,t){void 0===t&&(t=et);var r=null;function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(r&&r.lastThis===this&&t(n,r.lastArgs))return r.lastResult;var i=e.apply(this,n);return r={lastResult:i,lastArgs:n,lastThis:this},i}return n.clear=function(){r=null},n}const rt=tt((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),nt=tt((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),ot=tt((e=>Object.values(e))),it=tt((e=>Object.values(e)));var at=tt(((e,t)=>{const r=it(t).filter((t=>e===t.descriptor.droppableId)).sort(((e,t)=>e.descriptor.index-t.descriptor.index));return r}));function st(e){return e.at&&"REORDER"===e.at.type?e.at.destination:null}function lt(e){return e.at&&"COMBINE"===e.at.type?e.at.combine:null}var ct=tt(((e,t)=>t.filter((t=>t.descriptor.id!==e.descriptor.id)))),dt=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const ut={point:Pe,value:0},pt={invisible:{},visible:{},all:[]},gt={displaced:pt,displacedBy:ut,at:null};var ft=(e,t)=>r=>e<=r&&r<=t,mt=e=>{const t=ft(e.top,e.bottom),r=ft(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}},bt=e=>{const t=ft(e.top,e.bottom),r=ft(e.left,e.right);return e=>t(e.top)&&t(e.bottom)&&r(e.left)&&r(e.right)};const ht={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},vt={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};const yt=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:o})=>{const i=n?((e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:Pe;return Ye(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)},xt=e=>yt({...e,isVisibleThroughFrameFn:mt}),It=e=>yt({...e,isVisibleThroughFrameFn:bt}),Dt=(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 wt({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 Fe(ke(r,n))}(a,r),l=a.descriptor.id;e.all.push(l);if(!xt({target:s,destination:t,viewport:n,withDroppableDisplacement:!0}))return e.invisible[a.descriptor.id]=!0,e;const c={draggableId:l,shouldAnimate:Dt(l,i,o)};return e.visible[l]=c,e}),{all:[],visible:{},invisible:{}})}function Et({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:pt,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:o}}}}function St({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:o,last:i,index:a,forceShouldAnimate:s}){const l=dt(e,r);if(null==a)return Et({insideDestination:t,inHomeList:l,displacedBy:o,destination:r});const c=t.find((e=>e.descriptor.index===a));if(!c)return Et({insideDestination:t,inHomeList:l,displacedBy:o,destination:r});const d=ct(e,t),u=t.indexOf(c);return{displaced:wt({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 Ct(e,t){return Boolean(t.effected[e])}var At=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:o,insideDestination:i,previousImpact:a,viewport:s,afterCritical:l})=>{const c=a.at;if(c||d(),"REORDER"===c.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:c.destination,insideDestination:i});return null==n?null:St({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 Ct(i,o)?e?a:a-1:e?a+1:a})({isMovingForward:e,destination:o,displaced:a.displaced,draggables:n,combine:c.combine,afterCritical:l});return null==u?null:St({draggable:r,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:u})},Ot=({afterCritical:e,impact:t,draggables:r})=>{const n=lt(t);n||d();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 Ct(r,t)?o?Pe:Te(n.point):o?n.point:Pe})({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return Ne(i,a)};const Pt=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,Nt=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,Rt=({axis:e,moveRelativeTo:t,isMoving:r})=>Le(e.line,t.marginBox[e.end]+Pt(e,r),Nt(e,t.marginBox,r)),Bt=({axis:e,moveRelativeTo:t,isMoving:r})=>Le(e.line,t.marginBox[e.start]-((e,t)=>t.margin[e.end]+t.borderBox[e.size]/2)(e,r),Nt(e,t.marginBox,r));var Tt=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o})=>{const i=at(n.descriptor.id,r),a=t.page,s=n.axis;if(!i.length)return(({axis:e,moveInto:t,isMoving:r})=>Le(e.line,t.contentBox[e.start]+Pt(e,r),Nt(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(Ct(d,o))return Bt({axis:s,moveRelativeTo:e.page,isMoving:a});const t=He(e.page,c.point);return Bt({axis:s,moveRelativeTo:t,isMoving:a})}const u=i[i.length-1];if(u.descriptor.id===t.descriptor.id)return a.borderBox.center;if(Ct(u.descriptor.id,o)){const e=He(u.page,Te(o.displacedBy.point));return Rt({axis:s,moveRelativeTo:e,isMoving:a})}return Rt({axis:s,moveRelativeTo:u.page,isMoving:a})},Lt=(e,t)=>{const r=e.frame;return r?Ne(t,r.scroll.diff.displacement):t};var Mt=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?Tt({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o}):Ot({impact:e,draggables:n,afterCritical:o}):i})(e),r=e.droppable;return r?Lt(r,t):t},Gt=(e,t)=>{const r=Re(t,e.scroll.initial),n=Te(r);return{frame:Fe({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 _t(e,t){return e.map((e=>t[e]))}var Ft=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=((e,t)=>Ne(e.scroll.diff.displacement,t))(r,e),o=Re(n,t.page.borderBox.center);return Ne(t.client.borderBox.center,o)},kt=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const a=Re(r,e.page.borderBox.center),s={target:Ye(e.page.borderBox,a),destination:t,withDroppableDisplacement:o,viewport:n};return i?(e=>{return yt({...e,isVisibleThroughFrameFn:(t=e.destination.axis,e=>{const r=ft(e.top,e.bottom),n=ft(e.left,e.right);return e=>t===ht?r(e.top)&&r(e.bottom):n(e.left)&&n(e.right)})});var t})(s):It(s)},Wt=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:o,viewport:i,previousPageBorderBoxCenter:a,previousClientSelection:s,afterCritical:l})=>{if(!r.isEnabled)return null;const c=at(r.descriptor.id,n),u=dt(t,r),p=(({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:o})=>{if(!r.isCombineEnabled)return null;if(!st(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=ct(t,n);if(!s)return l.length?i(l[l.length-1].descriptor.id):null;const c=l.findIndex((e=>e.descriptor.id===s));-1===c&&d();const u=c-1;return u<0?null:i(l[u].descriptor.id)})({isMovingForward:e,draggable:t,destination:r,insideDestination:c,previousImpact:o})||At({isMovingForward:e,isInHomeList:u,draggable:t,draggables:n,destination:r,insideDestination:c,previousImpact:o,viewport:i,afterCritical:l});if(!p)return null;const g=Mt({impact:p,draggable:t,droppable:r,draggables:n,afterCritical:l});if(kt({draggable:t,destination:r,newPageBorderBoxCenter:g,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})){return{clientSelection:Ft({pageBorderBoxCenter:g,draggable:t,viewport:i}),impact:p,scrollJumpRequest:null}}const f=Re(g,a),m=(({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:o})=>{const i=Gt(t,Ne(t.scroll.current,o)),a=r.frame?Qe(r,Ne(r.frame.scroll.current,o)):r,s=e.displaced,l=wt({afterDragging:_t(s.all,n),destination:r,displacedBy:e.displacedBy,viewport:i.frame,last:s,forceShouldAnimate:!1}),c=wt({afterDragging:_t(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 $t=e=>{const t=e.subject.active;return t||d(),t};const Ut=(e,t)=>{const r=e.page.borderBox.center;return Ct(e.descriptor.id,t)?Re(r,t.displacedBy.point):r},jt=(e,t)=>{const r=e.page.borderBox;return Ct(e.descriptor.id,t)?Ye(r,Te(t.displacedBy.point)):r};var Ht=tt((function(e,t){const r=t[e.line];return{value:r,point:Le(e.line,r)}}));const Vt=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),qt=(e,t,r)=>{const n=e.frame;dt(t,e)&&d(),e.subject.withPlaceholder&&d();const o=Ht(e.axis,t.displaceBy).point,i=((e,t,r)=>{const n=e.axis;if("virtual"===e.descriptor.mode)return Le(n.line,t[n.line]);const o=e.subject.page.contentBox[n.size],i=at(e.descriptor.id,r).reduce(((e,t)=>e+t.client.marginBox[n.size]),0)+t[n.line]-o;return i<=0?null:Le(n.line,i)})(e,o,r),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const t=Ke({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:t}}const s=i?Ne(n.scroll.max,i):n.scroll.max,l=Vt(n,s),c=Ke({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:l});return{...e,subject:c,frame:l}};var zt=({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=ft(i[a.start],i[a.end]),l=ot(n).filter((e=>e!==r)).filter((e=>e.isEnabled)).filter((e=>Boolean(e.subject.active))).filter((e=>mt(o.frame)($t(e)))).filter((t=>{const r=$t(t);return e?i[a.crossAxisEnd]<r[a.crossAxisEnd]:r[a.crossAxisStart]<i[a.crossAxisStart]})).filter((e=>{const t=$t(e),r=ft(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=$t(t)[a.crossAxisStart],o=$t(r)[a.crossAxisStart];return e?n-o:o-n})).filter(((e,t,r)=>$t(e)[a.crossAxisStart]===$t(r[0])[a.crossAxisStart]));if(!l.length)return null;if(1===l.length)return l[0];const c=l.filter((e=>ft($t(e)[a.start],$t(e)[a.end])(t[a.line])));return 1===c.length?c[0]:c.length>1?c.sort(((e,t)=>$t(e)[a.start]-$t(t)[a.start]))[0]:l.sort(((e,r)=>{const n=Ge(t,Je($t(e))),o=Ge(t,Je($t(r)));return n!==o?n-o:$t(e)[a.start]-$t(r)[a.start]}))[0]})({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:i,viewport:a});if(!l)return null;const c=at(l.descriptor.id,o),d=(({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:o})=>{const i=n.filter((e=>It({target:jt(e,o),destination:r,viewport:t.frame,withDroppableDisplacement:!0}))).sort(((t,n)=>{const i=Me(e,Lt(r,Ut(t,o))),a=Me(e,Lt(r,Ut(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:pt,displacedBy:ut,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},t=Mt({impact:e,draggable:n,droppable:i,draggables:o,afterCritical:s}),l=dt(n,i)?i:qt(i,n,o);return kt({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=Ht(i.axis,n.displaceBy);return St({draggable:n,insideDestination:r,destination:i,viewport:a,displacedBy:d,last:pt,index:c})})({previousPageBorderBoxCenter:t,destination:l,draggable:r,draggables:o,moveRelativeTo:d,insideDestination:c,viewport:a,afterCritical:s});if(!u)return null;const p=Mt({impact:u,draggable:r,droppable:l,draggables:o,afterCritical:s});return{clientSelection:Ft({pageBorderBoxCenter:p,draggable:r,viewport:a}),impact:u,scrollJumpRequest:null}},Yt=e=>{const t=e.at;return t?"REORDER"===t.type?t.destination.droppableId:t.combine.droppableId:null};var Jt=({state:e,type:t})=>{const r=((e,t)=>{const r=Yt(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?Wt({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,destination:i,draggables:u,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):zt({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,isOver:i,draggables:u,droppables:p,viewport:e.viewport,afterCritical:e.afterCritical})};function Xt(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}function Kt(e){const t=ft(e.top,e.bottom),r=ft(e.left,e.right);return function(e){return t(e.y)&&r(e.x)}}function Qt({pageBorderBox:e,draggable:t,droppables:r}){const n=ot(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(Kt(r)(e.center))return!0;const i=t.axis,a=r.center[i.crossAxisLine],s=e[i.crossAxisStart],l=e[i.crossAxisEnd],c=ft(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=Le(t.axis.line,e.center[r.line],t.page.borderBox.center[r.crossAxisLine]);return{id:t.descriptor.id,distance:Me(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)=>Fe(Ye(e,t));function er({displaced:e,id:t}){return Boolean(e.visible[t]||e.invisible[t])}var tr=({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 gt;const c=n[l],d=at(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=Ht(n.axis,e.displaceBy),l=s.value,c=t[a.start],d=t[a.end],u=ct(e,o).find((e=>{const t=e.descriptor.id,n=e.page.borderBox,o=n[a.size]/4,s=Ct(t,i),u=er({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=Ht(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:ct(t,n).find((e=>{const t=e.descriptor.id,r=e.page.borderBox.center[s.line],n=Ct(t,a),i=er({displaced:o,id:t});return n?i?u<=r:d<r-c:i?u<=r+c:d<r}))||null,inHomeList:dt(t,r)});return St({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})},rr=(e,t)=>({...e,[t.descriptor.id]:t});const nr=({previousImpact:e,impact:t,droppables:r})=>{const n=Yt(e),o=Yt(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||d();const r=e.frame;if(!r){const t=Ke({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:t}}const n=t.oldFrameMaxScroll;n||d();const o=Vt(r,n),i=Ke({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}})(i);return rr(r,a)};var or=({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=Re(l,e.initial.client.selection),d={offset:c,selection:l,borderBoxCenter:Ne(e.initial.client.borderBoxCenter,c)},u={selection:Ne(d.selection,a.scroll.current),borderBoxCenter:Ne(d.borderBoxCenter,a.scroll.current),offset:Ne(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||tr({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=nr({previousImpact:n,impact:o,droppables:r}),a=Yt(o);if(!a)return i;const s=r[a];if(dt(e,s))return i;if(s.subject.withPlaceholder)return i;const l=qt(s,e,t);return rr(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 ir=({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=wt({afterDragging:a,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:s}},ar=({impact:e,draggable:t,droppable:r,draggables:n,viewport:o,afterCritical:i})=>{const a=Mt({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:i});return Ft({pageBorderBoxCenter:a,draggable:t,viewport:o})},sr=({state:e,dimensions:t,viewport:r})=>{"SNAP"!==e.movementMode&&d();const n=e.impact,o=r||e.viewport,i=t||e.dimensions,{draggables:a,droppables:s}=i,l=a[e.critical.draggable.id],c=Yt(n);c||d();const u=s[c],p=ir({impact:n,viewport:o,destination:u,draggables:a}),g=ar({impact:p,draggable:l,droppable:u,draggables:a,viewport:o,afterCritical:e.afterCritical});return or({impact:p,clientSelection:g,state:e,dimensions:i,viewport:o})},lr=({draggable:e,home:t,draggables:r,viewport:n})=>{const o=Ht(t.axis,e.displaceBy),i=at(t.descriptor.id,r),a=i.indexOf(e);-1===a&&d();const s=i.slice(a+1),l=s.reduce(((e,t)=>(e[t.descriptor.id]=!0,e)),{}),c={inVirtualList:"virtual"===t.descriptor.mode,displacedBy:o,effected:l};var u;return{impact:{displaced:wt({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:c}};var cr=({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||d(),t})(t[o]),a=i.scroll.diff.value,s=(({draggable:e,offset:t,initialWindowScroll:r})=>{const n=He(e.client,t),o=Ve(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:o}})({draggable:e,offset:Ne(n,a),initialWindowScroll:r.scroll.initial});return s}))};const dr=e=>"SNAP"===e.movementMode,ur=(e,t,r)=>{const n=((e,t)=>({draggables:e.draggables,droppables:rr(e.droppables,t)}))(e.dimensions,t);return!dr(e)||r?or({state:e,dimensions:n}):sr({state:e,dimensions:n})};function pr(e){return e.isDragging&&"SNAP"===e.movementMode?{...e,scrollJumpRequest:null}:e}const gr={phase:"IDLE",completed:null,shouldFlush:!1};var fr=(e=gr,t)=>{if("FLUSH"===t.type)return{...gr,shouldFlush:!0};if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&d();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],c={selection:n,borderBoxCenter:s.client.borderBox.center,offset:Pe},u={client:c,page:{selection:Ne(c.selection,o.scroll.initial),borderBoxCenter:Ne(c.selection,o.scroll.initial),offset:Ne(c.selection,o.scroll.diff.value)}},p=ot(i.droppables).every((e=>!e.isFixedOnPage)),{impact:g,afterCritical:f}=lr({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&&d();return{...e,phase:"COLLECTING"}}if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&d(),(({state:e,published:t})=>{const r=t.modified.map((t=>{const r=e.dimensions.droppables[t.droppableId];return Qe(r,t.scroll)})),n={...e.dimensions.droppables,...rt(r)},o=nt(cr({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=Yt(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}=lr({draggable:c,home:d,draggables:i,viewport:e.viewport}),g=l&&l.isCombineEnabled?e.impact:u,f=tr({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;Xt(e)||d();const{client:r}=t.payload;return Be(r,e.current.client.selection)?e:or({state:e,clientSelection:r,impact:dr(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return pr(e);if("COLLECTING"===e.phase)return pr(e);Xt(e)||d();const{id:r,newScroll:n}=t.payload,o=e.dimensions.droppables[r];if(!o)return e;const i=Qe(o,n);return ur(e,i,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Xt(e)||d();const{id:r,isEnabled:n}=t.payload,o=e.dimensions.droppables[r];o||d(),o.isEnabled===n&&d();const i={...o,isEnabled:n};return ur(e,i,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Xt(e)||d();const{id:r,isCombineEnabled:n}=t.payload,o=e.dimensions.droppables[r];o||d(),o.isCombineEnabled===n&&d();const i={...o,isCombineEnabled:n};return ur(e,i,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;Xt(e)||d(),e.isWindowScrollAllowed||d();const r=t.payload.newScroll;if(Be(e.viewport.scroll.current,r))return pr(e);const n=Gt(e.viewport,r);return dr(e)?sr({state:e,viewport:n}):or({state:e,viewport:n})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!Xt(e))return e;const r=t.payload.maxScroll;if(Be(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&&d();const r=Jt({state:e,type:t.type});return r?or({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&&d();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&&d();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 mr(e,t){return e instanceof Object&&"type"in e&&e.type===t}const br=e=>({type:"LIFT",payload:e}),hr=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),vr=()=>({type:"COLLECTION_STARTING",payload:null}),yr=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),xr=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),Ir=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),Dr=e=>({type:"MOVE",payload:e}),wr=()=>({type:"MOVE_UP",payload:null}),Er=()=>({type:"MOVE_DOWN",payload:null}),Sr=()=>({type:"MOVE_RIGHT",payload:null}),Cr=()=>({type:"MOVE_LEFT",payload:null}),Ar=()=>({type:"FLUSH",payload:null}),Or=e=>({type:"DROP_COMPLETE",payload:e}),Pr=e=>({type:"DROP",payload:e}),Nr=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});const Rr="cubic-bezier(.2,1,.1,1)",Br={drop:0,combining:.7},Tr={drop:.75},Lr={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Mr=`${Lr.outOfTheWay}s ${"cubic-bezier(0.2, 0, 0, 1)"}`,Gr={fluid:`opacity ${Mr}`,snap:`transform ${Mr}, opacity ${Mr}`,drop:e=>{const t=`${e}s ${Rr}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Mr}`,placeholder:`height ${Mr}, width ${Mr}, margin ${Mr}`},_r=e=>Be(e,Pe)?void 0:`translate(${e.x}px, ${e.y}px)`,Fr={moveTo:_r,drop:(e,t)=>{const r=_r(e);if(r)return t?`${r} scale(${Tr.drop})`:r}},{minDropTime:kr,maxDropTime:Wr}=Lr,$r=Wr-kr;const Ur=({getState:e,dispatch:t})=>r=>n=>{if(!mr(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&&d(),"DRAGGING"!==o.phase&&"DROP_PENDING"!==o.phase&&d();const a=o.critical,s=o.dimensions,l=s.draggables[o.critical.draggable.id],{impact:c,didDropInsideDroppable:u}=(({draggables:e,reason:t,lastImpact:r,home:n,viewport:o,onLiftImpact:i})=>{if(!r.at||"DROP"!==t)return{impact:ir({draggables:e,impact:i,destination:n,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1};return"REORDER"===r.at.type?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:pt},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?st(c):null,g=u?lt(c):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=Yt(e),l=s?a[s]:null,c=a[t.descriptor.droppableId],d=ar({impact:e,draggable:t,draggables:i,afterCritical:o,droppable:l||c,viewport:n});return Re(d,t.client.borderBox.center)})({impact:c,draggable:l,dimensions:s,viewport:o.viewport,afterCritical:o.afterCritical}),h={critical:o.critical,afterCritical:o.afterCritical,result:m,impact:c};if(!(!Be(o.current.client.offset,b)||Boolean(m.combine)))return void t(Or({completed:h}));const v=(({current:e,destination:t,reason:r})=>{const n=Me(e,t);if(n<=0)return kr;if(n>=1500)return Wr;const o=kr+$r*(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 jr=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},Hr=()=>({x:window.pageXOffset,y:window.pageYOffset});function Vr({onWindowScroll:e}){const t=jr((function(){e(Hr())})),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()&&d(),n=a(window,[r])},stop:function(){o()||d(),t.cancel(),n(),n=i},isActive:o}}const qr=e=>{const t=Vr({onWindowScroll:t=>{e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return e=>r=>{!t.isActive()&&mr(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&(e=>mr(e,"DROP_COMPLETE")||mr(e,"DROP_ANIMATE")||mr(e,"FLUSH"))(r)&&t.stop(),e(r)}};var zr=()=>{const e=[];return{add:t=>{const r=setTimeout((()=>(t=>{const r=e.findIndex((e=>e.timerId===t));-1===r&&d();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 Yr=(e,t)=>{t()},Jr=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function Xr(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 Kr=(e,t)=>{const r=((e,t)=>{const r=zr();let n=null;const o=r=>{n||d(),n=null,Yr(0,(()=>Xr(e().onDragEnd,r,t,b.onDragEnd)))};return{beforeCapture:(t,r)=>{n&&d(),Yr(0,(()=>{const n=e().onBeforeCapture;n&&n({draggableId:t,mode:r})}))},beforeStart:(t,r)=>{n&&d(),Yr(0,(()=>{const n=e().onBeforeDragStart;n&&n(Jr(t,r))}))},start:(o,i)=>{n&&d();const a=Jr(o,i);n={mode:i,lastCritical:o,lastLocation:a.source,lastCombine:null},r.add((()=>{Yr(0,(()=>Xr(e().onDragStart,a,t,b.onDragStart)))}))},update:(o,i)=>{const a=st(i),s=lt(i);n||d();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.draggabl