fluid-dnd 1.0.9-beta.0 → 1.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-8hgMEqsO.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
1
+ "use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-BUdB26zt.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
@@ -1,7 +1,7 @@
1
1
  var d = Object.defineProperty;
2
2
  var e = (a, s, l) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: l }) : a[s] = l;
3
3
  var r = (a, s, l) => e(a, typeof s != "symbol" ? s + "" : s, l);
4
- import { a as h, t as n, G as t } from "./index-yDxrxM5t.js";
4
+ import { a as h, t as n, G as t } from "./index-Cj5Hg1w9.js";
5
5
  class c {
6
6
  constructor() {
7
7
  r(this, "handlers");
@@ -11,6 +11,7 @@ export interface ListCondig<T> {
11
11
  getValue: (index: number) => T;
12
12
  insertToListEmpty: (config: CoreConfig<T>, index: number, value: T) => void;
13
13
  }
14
+ export type MapFrom<T> = (object: T, droppable: Element) => unknown;
14
15
  export interface DragStartEventData<T> {
15
16
  index: number;
16
17
  element: Element;
@@ -84,6 +85,10 @@ export interface Config<T> {
84
85
  * The duration of the animations in milisecond.
85
86
  */
86
87
  animationDuration?: number;
88
+ /**
89
+ * Map value when is passed from the current list to another.
90
+ */
91
+ mapFrom?: MapFrom<T>;
87
92
  }
88
93
  /**
89
94
  * onDrop event function.
@@ -151,4 +156,5 @@ export type CoreConfig<T> = {
151
156
  onInsertEvent: OnInsertEvent<T>;
152
157
  onGetLegth: OnGetLength;
153
158
  onGetValue: OnGetValue<T>;
159
+ mapFrom: MapFrom<T>;
154
160
  };
@@ -1,3 +1,5 @@
1
- import { ListCondig } from "..";
1
+ import { ListCondig, MapFrom } from "..";
2
2
  import { Config, CoreConfig } from "..";
3
+ import { DroppableConfig } from "../configHandler";
3
4
  export declare const getConfig: <T>(listCondig: ListCondig<T>, config?: Config<T>) => CoreConfig<T>;
5
+ export declare const MapConfig: <T>(coreConfig: DroppableConfig<any>, mapFrom: MapFrom<T>) => CoreConfig<any>;
@@ -1,5 +1,6 @@
1
1
  import { DroppableConfig } from "../configHandler";
2
2
  import { DragMouseTouchEvent } from "../../../index";
3
+ import { MapFrom } from "..";
3
4
  export declare class DroppableConfigurator<T> {
4
5
  initial: DroppableConfig<any> | undefined;
5
6
  current: DroppableConfig<T> | undefined;
@@ -8,7 +9,8 @@ export declare class DroppableConfigurator<T> {
8
9
  private groupClass;
9
10
  private dragEvent;
10
11
  private changeDroppable;
11
- constructor(draggableElement: HTMLElement, droppableGroupClass: string | null, parent: HTMLElement, setTransformDragEvent: () => void, changeDroppable: (newdDroppableConfig: DroppableConfig<T> | undefined, oldDroppableConfig: DroppableConfig<T> | undefined) => void);
12
+ private mapFrom;
13
+ constructor(draggableElement: HTMLElement, droppableGroupClass: string | null, parent: HTMLElement, setTransformDragEvent: () => void, changeDroppable: (newdDroppableConfig: DroppableConfig<T> | undefined, oldDroppableConfig: DroppableConfig<T> | undefined) => void, mapFrom: MapFrom<T>);
12
14
  private getDraggableAncestor;
13
15
  private getElementBelow;
14
16
  private getCurrent;
@@ -16,7 +18,16 @@ export declare class DroppableConfigurator<T> {
16
18
  private isNotInsideAnotherDroppable;
17
19
  private onScrollEvent;
18
20
  private setOnScroll;
19
- getCurrentConfig(event: DragMouseTouchEvent): DroppableConfig<any> | DroppableConfig<T> | undefined;
21
+ getConfigFrom(element: Element): {
22
+ config: import("..").CoreConfig<any>;
23
+ droppable: HTMLElement;
24
+ scroll: import("../../../index").ElementScroll;
25
+ } | undefined;
26
+ getCurrentConfig(event: DragMouseTouchEvent): DroppableConfig<T> | {
27
+ config: import("..").CoreConfig<any>;
28
+ droppable: HTMLElement;
29
+ scroll: import("../../../index").ElementScroll;
30
+ } | undefined;
20
31
  updateConfig(event: DragMouseTouchEvent): void;
21
32
  isOutside(event: DragMouseTouchEvent, hiddenDraggable?: boolean): boolean;
22
33
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-8hgMEqsO.cjs");exports.dragAndDrop=e.dragAndDrop;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-BUdB26zt.cjs");exports.dragAndDrop=e.dragAndDrop;
@@ -1,4 +1,4 @@
1
- import { d as o } from "../index-yDxrxM5t.js";
1
+ import { d as o } from "../index-Cj5Hg1w9.js";
2
2
  export {
3
3
  o as dragAndDrop
4
4
  };
@@ -0,0 +1 @@
1
+ "use strict";var De=Object.defineProperty;var ve=(t,e,n)=>e in t?De(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var k=(t,e,n)=>ve(t,typeof e!="symbol"?e+"":e,n);const Q="draggable",It="droppable",Ot="handler-class",Ht="dragging",Yt="dragging-handler-class",Wt="dropping",se="grabbing",oe="grab",Zt="disable-transition",nt=(t,e)=>t.classList.contains(e),dt=(t,e,n=!1)=>{t.classList.toggle(e,n)},U=(t,e)=>{t.classList.add(e)},Ct=(t,e)=>{t.classList.remove(e)},be=(t,e)=>yt(e).every(n=>nt(t,n)),gt=t=>t?`.${yt(t).join(".")}`:"",Te=(t,e)=>{if(!e)return;const n=yt(e);t.classList.add(...n)},yt=t=>t?t.split(" ").filter(e=>e):[],V="horizontal",tt="vertical",Ee=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},qt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),Ce=t=>t?parseInt(t):-1,ye=t=>{const e=getComputedStyle(t),n=new DOMMatrixReadOnly(e.transform);return{x:n.m41,y:n.m42}},re=(t,e)=>t.x1>e.x1?re(e,t):t.x2<e.x1?0:t.x2>=e.x2?t.x2-t.x1:t.x2-e.x1,pt=(t,e)=>!Ae(t,e),Ae=(t,e)=>{const n=Mt(t),s=Mt(e),o=Jt(n,s,tt),r=Jt(n,s,V);return o>=Math.min(n.height,s.height)/2&&r>=Math.min(n.width,s.width)/2},Jt=(t,e,n)=>{const{before:s,distance:o}=w(n);return re({x1:t[s],x2:t[s]+t[o]},{x1:e[s],x2:e[s]+e[o]})},L=(t,e)=>t?qt(getComputedStyle(t)[e]):0,Kt=t=>{const{scrollLeft:e,scrollTop:n}=t;return{scrollLeft:e,scrollTop:n}},Mt=t=>t.getBoundingClientRect(),w=t=>{const e=t==V;return{beforeMargin:e?"marginLeft":"marginTop",afterMargin:e?"marginRight":"marginBottom",borderBeforeWidth:e?"borderLeftWidth":"borderTopWidth",before:e?"left":"top",after:e?"right":"down",gap:e?"columnGap":"rowGap",distance:e?"width":"height",axis:e?"x":"y",offset:e?"offsetX":"offsetY",scroll:e?"scrollX":"scrollY",scrollElement:e?"scrollLeft":"scrollTop",page:e?"pageX":"pageY",inner:e?"innerWidth":"innerHeight",offsetElement:e?"offsetLeft":"offsetTop",scrollDistance:e?"scrollWidth":"scrollHeight",clientDistance:e?"clientWidth":"clientHeight",paddingBefore:e?"paddingLeft":"paddingTop",getRect:Mt}},Rt=(t,e)=>xe(t,e),ie=t=>[...t.children].filter(n=>nt(n,Q)),xe=(t,e)=>{const n=[...e.children].filter(o=>nt(o,Q)&&!o.isEqualNode(t)).toReversed(),s=[...e.children].findLastIndex(o=>o.isEqualNode(t));return[n,s,e]},we=t=>{let e=t.parentElement;for(;e;){if(window.getComputedStyle(e).position==="fixed")return e;e=e.parentElement}return null},ce=(t,e)=>{const{before:n,borderBeforeWidth:s}=w(e),o=we(t);return o?Mt(o)[n]+L(o,s):0},Xt=t=>window.TouchEvent&&t instanceof TouchEvent,it=t=>t instanceof HTMLElement,ae=t=>t instanceof MouseEvent,Be=["onmouseup","onmousedown","onmousemove"],Re=(t,e,n)=>{t&&(t.style.height=`${e}px`,t.style.width=`${n}px`)},Tt=(t,e,n)=>{!t||!it(t)||(n==0&&e==0?t.style.transform="":t.style.transform=`translate(${n}px,${e}px)`)},Le=(t,e,n)=>{t[e]=s=>{if(s.defaultPrevented)return;const o=_t(s);n(o)}},$t=(t,e,n)=>{n&&(Oe(e)?t[e]=n:Le(t,e,n))},Oe=t=>Be.includes(t),Me=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},Fe=(t,e)=>{const n=(s,o)=>Pe(e,window,o,s);if(ae(t)){const{offsetX:s,offsetY:o}=t;return[s,o]}else{const s=t.target;return[n(s,V),n(s,tt)]}},_t=t=>{const e=Ne(t);if(!e)return Me(t);const[n,s]=Fe(t,e),{clientX:o,clientY:r,pageX:c,pageY:l,screenX:u,screenY:d,target:m}=e;return{clientX:o,clientY:r,pageX:c,pageY:l,screenX:u,screenY:d,target:m,offsetX:n,offsetY:s}},Ne=t=>{if(Xt(t))return t.touches[0]??t.changedTouches[0];if(ae(t))return t},Pe=(t,e,n,s)=>{const{page:o,scroll:r,before:c,borderBeforeWidth:l,getRect:u}=w(n),d=u(s);return t[o]-e[r]-d[c]-L(s,l)},Nt=(t,e,n="ease-out",s="transform")=>{it(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},le=(t,e,n)=>{!t||!it(t)||(t[e]=()=>{n()})},$e=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},Ge=(t,e)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=e.match(n)||[];for(const o of t.cssRules){const[r]=o.cssText.match(n)||[];if(s===r)return!0}return!1},Ie=(t,e)=>{e.forEach(n=>{Ye(t,n)})},Ye=(t,e)=>{var s;var n=$e(t);n.sheet&&(Ge(n.sheet,e)||(s=n.sheet)==null||s.insertRule(e,n.sheet.cssRules.length))},ue=(t,e={})=>{for(const n of Object.keys(e)){const s=e[n];s!=null&&We(t,`--${n}`,s)}},We=(t,e,n)=>t&&t.style.setProperty(e,n),fe="startDrag",Ft="drag",zt="startDrop",Xe="drop",at="temp-child",de="cubic-bezier(0.2, 0, 0, 1)",_e=t=>t===Xe||t===zt,Vt=t=>!t||t.length==0?0:qt(t.replace("px","")),Ve=(t,e)=>{const n=getComputedStyle(t)[e];if(n.match("%")){const o=qt(n.replace("%","")),{width:r}=t.getBoundingClientRect();return r*(o/100)}return Vt(n)},jt=(t,e)=>{if(!(t instanceof Element))return[0,!1];const n=Ve(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},He=t=>{const{top:e,left:n}=getComputedStyle(t);return[Vt(e),Vt(n)]},qe=(t,e)=>{const{gap:n}=w(e),[s,o]=jt(t,n);return o?s:0};function Et(t,e,n,s,o=t.previousElementSibling,r=t.nextElementSibling){let{height:c,width:l}=ze(n,t,o,r);return pt(t,s)&&e==Ft&&(c=0,l=0),{height:c,width:l}}const ze=(t,e,n,s)=>{const{afterMargin:o,beforeMargin:r,distance:c,gap:l,getRect:u}=w(t),d=L(e,o),m=L(e,r),v=L(s,r),[B,O]=jt(e.parentElement,l),N=u(e)[c];if(O)return Qt(N,m,d,B,0,t);const[h,S,y]=je(n,v,d,m,o);return Qt(N,S,h,0,y,t)},je=(t,e,n,s,o)=>{const r=Math.max(e,n);let c=s,l=e;if(t){const u=L(t,o);c=Math.max(u,s),l=Math.max(l,u)}return[r,c,l]},Qt=(t,e,n,s,o,r)=>ke(r,t+e+n+s-o),ke=(t,e)=>t==V?{width:e,height:0}:{width:0,height:e},Ut=(t,e)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:r}=w(t),c=L(e,n),l=L(e,s),u=r(e)[o];return c+l+u},Ze=(t,e)=>{const[n,s]=He(e),o=Ut(tt,t);return[Ut(V,t)-s,o-n]};function Je(t,e,n,s,o,r,c,l,u){let d=0,m=0;const v=!!(n<0&&u);if(n===s&&!v)return te({height:d,width:m},t,o,c,v);const[B,O,N,h]=Ue(e,n,s,u);if(v){const[et,ot]=Ze(l,u);d+=ot,m+=et}const{scrollElement:S,beforeMargin:y,afterMargin:R,distance:I,gap:Y}=w(t),[W,P]=jt(l,Y),[st,H,F]=en(y,R,B,O==null?void 0:O.previousElementSibling,h,P,v),[Z,q,z]=tn(y,R,I,N,W,P),X=Qe(q,Z,z,H,st,W),j=v?l[S]:Ke(S,l,r),$=(h?X-F:F-X)-j;return t===tt?d+=$:t===V&&(m+=$),te({height:d,width:m},t,o,c,v)}const Ke=(t,e,n)=>{const s=e[t],o=n[t];return s-o},Qe=(t,e,n,s,o,r)=>{const c=Math.max(e,o);return Math.max(n,s)+t+c+r},Ue=(t,e,n,s)=>{const o=e<n,[r,c]=[e,n].toSorted((m,v)=>m-v),l=t[e]??s,u=t[n];let d=o?t.slice(r+1,c+1):t.slice(r,c);return r<0&&s&&(d=t.slice(r+1,c)),[l,u,d,o]},tn=(t,e,n,s,o,r)=>{if(s.length==0)return[0,0,0];const c=L(s[0],t);let l=0,u=-c;for(const[d,m]of s.entries()){const v=m.getBoundingClientRect()[n],B=L(m,t);r&&(l+=B),r&&d>0?l+=o:l=Math.max(l,B),u+=l+v,l=L(m,e)}return[c,u,l]},te=(t,e,n,s,o)=>{const{scroll:r,distance:c}=w(e),l=window[r],u=n[r],d=o?0:u-2*l+s[r];return t[c]+=d,t},en=(t,e,n,s,o,r,c)=>{const l=o?n.previousElementSibling:s;return nn(t,e,l,n,r,c)},nn=(t,e,n,s,o,r)=>{if(o)return[0,0,0];const c=L(r?null:n,e),l=L(s,t);let u=Math.max(c,l);return[c,l,u]},kt=(t,e,n,s=()=>!0)=>{const o=new MutationObserver(r=>{if(r=r.filter(s),r.length>0){const c=r[0];t(o,c)}});return o.observe(e,n),o},sn=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},on=(t,e,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:r}=w(t);return n[r]/(e[s]-e[o])},rn="startDrag",ge="cubic-bezier(0.2, 0, 0, 1)",pe=50,ee=t=>it(t)?t.classList.contains(at):!1,cn=(t,e,n)=>{let s=Et(e,rn,n,t);const o=qe(t,n),{distance:r}=w(n);s[r]-=o;const[c,l]=an(n,e);return s[l]=c,s},an=(t,e)=>{const n=t==V?tt:V,{distance:s,getRect:o}=w(n);return[o(e)[s],s]},mt=(t,e,n)=>{Re(t,e,n),t.style.minWidth=`${n}px`},ln=(t,e,n)=>s=>{e.contains(t)&&(mt(t,n.height,n.width),s.disconnect())},un=(t,e)=>{if(!e)return;const{droppable:n,config:s,scroll:o}=t,{direction:r}=s,c=on(s.direction,n,o)>.99,{scrollDistance:l,clientDistance:u,scrollElement:d}=w(r);c&&(n[d]=n[l]-n[u])},he=(t,e,n,s)=>{if(!n)return;const{droppable:o,config:r}=n,{direction:c,animationDuration:l}=r;if(un(n,e),o.querySelector(`.${at}`)||!t)return;var u=t.tagName=="LI"?"DIV":t.tagName,d=document.createElement(u);U(d,at),mt(d,0,0);const m=cn(o,t,c);return Nt(d,l,ge,"width, min-width, height"),[d,m,o]},Gt=(t,e,n,s,o)=>{const r=he(t,n,s);if(!r)return;const[c,l,u]=r;e.isSameNode(u)&&mt(c,l.height,l.width),kt(ln(c,u,l),u,{childList:!0,subtree:!0}),u.appendChild(c)},fn=(t,e,n)=>{const s=he(t,e,n);if(!s)return;const[o,r,c]=s;c.appendChild(o),dn(o,r)},dn=(t,e)=>requestAnimationFrame(()=>{mt(t,e.height,e.width),requestAnimationFrame(()=>{Nt(t,0,ge,"width, min-width, height")})}),gn=(t,e,n,s,o=!0)=>{if(n){var r=document.querySelectorAll(`${gt(n)} > .${at}`);r.forEach(c=>{const l=c.parentElement;if(l!=null&&l.isSameNode(e)||!o&&(l!=null&&l.isSameNode(t)))return;mt(c,0,0),setTimeout(()=>{var d;(d=c.parentNode)==null||d.removeChild(c)},s+pe)})}},bt=(t,e,n=!1)=>{var s=t.querySelectorAll(`.${at}`);s.forEach(o=>{const r=o;n?(mt(r,0,0),setTimeout(()=>{t.contains(r)&&t.removeChild(r)},e+pe)):t.removeChild(o)})},pn=50;function hn(t,e,n,s,o,r){let c=e;const{direction:l,handlerSelector:u,onRemoveAtEvent:d,animationDuration:m,delayBeforeInsert:v,draggingClass:B}=t,O=(i,f,g,D,C)=>{if(!D)return;const{droppable:b,config:T}=D,A=Et(i,f,T.direction,b);_e(f)?P(i,f,A,g,D,C):y(i,f,A,D)},N=(i,f,g,D,C)=>{const b=Et(f,"insert",t.direction,g),{onInsertEvent:T}=t,A=ie(g);for(const[M,x]of A.entries())nt(x,Q)&&M>=i&&W(x,b);C(),setTimeout(()=>{T(i,D),bt(n,0,!0),me(i,g,t),et(f),_(f,n)},v)},h=(i,f,g,D)=>{if(!g||!g.droppable||!g.config)return;const{droppable:C,config:b}=g;let[T]=Rt(f,C);T=[f,...T].toReversed();const A=Et(f,"remove",b.direction,C);for(const[M,x]of T.entries())M>=i&&(Y(x,A),setTimeout(()=>{D(x)},m))},S=i=>{bt(n,m,!0),setTimeout(()=>{et(i),_(i,n)},m)},y=(i,f,g,D)=>{const{config:C,droppable:b}=D,[T]=Rt(i,b),A=pt(i,b);T.length==0&&I(g,1,C.direction,T);for(const[M,x]of T.entries()){if(!nt(x,Q))continue;const G=R(C.direction,i,x,g);if(!A&&G)g=G;else if(!A)continue;const J=T.length-M;I(g,J,C.direction,T),f===fe?Y(x,g):f===Ft&&W(x,g)}},R=(i,f,g,D)=>{const{before:C,distance:b,axis:T,getRect:A}=w(i),M=A(f),x=A(g),G=M[C],J=x[C],ut=x[b],St=J+ut/2,Dt=ye(g)[T],ct=St-Dt;return G>ct?{height:0,width:0}:D},I=(i,f,g,D)=>{const C=D.filter(T=>nt(T,Q)).length,{distance:b}=w(g);i[b]==0?c=Math.max(c,f):c=Math.min(c,f-1),c=Math.min(c,C)},Y=(i,f)=>{const{width:g,height:D}=f;Tt(i,D,g)},W=(i,f)=>{const{width:g,height:D}=f;Tt(i,D,g),Nt(i,m,de)},P=(i,f,g,D,C,b)=>{const{droppable:T,scroll:A,config:M}=C,[x,G]=Rt(i,T),J=x.toReversed(),ut=G===-1?J.length:G;J.splice(ut,0,i);const[St,Dt,ct]=st(i,G,J,T);g=Et(i,f,M.direction,n,St,Dt);const Pt=Ee(),At=Je(M.direction,J,G,ct,Pt,A,D,T,i);x.length==0&&H(void 0,g,i,At);for(const[xt,wt]of x.toReversed().entries()){let Bt=g;ct-1>=xt&&(Bt={height:0,width:0}),f===zt&&!nt(wt,at)&&H(wt,Bt,i,At)}F(ct,i,M,T,b)},st=(i,f,g,D)=>{const b=pt(i,D)?f:c,T=()=>f<b?[b,b+1]:f>b?[b-1,b]:[b-1,b+1],[A,M]=T(),x=g[A]??null,G=g[M]??null;return[x,G,b]},H=(i,f,g,D)=>{Tt(i,f.height,f.width),Tt(g,D.height,D.width)},F=(i,f,g,D,C)=>{const{onInsertEvent:b,onDragEnd:T}=g;U(f,Wt),z(f,n,D,()=>{if(Ct(f,Wt),C!=null){const A=d(C);A!=null&&(b(i,A),T({value:A,index:i})),q(f),Z()}})},Z=()=>{if(s){var i=document.querySelectorAll(`${gt(s)} > .${Q}`);for(const f of i)$(f)}},q=i=>{setTimeout(()=>{Ct(i,B)},pn)},z=(i,f,g,D)=>{setTimeout(()=>{D&&D(),X(f,g),j(g),et(i),_(i,f),_(i,g)},m)},X=(i,f)=>{i.isSameNode(f)?bt(i,m):(bt(i,m,!0),bt(f,m))},j=i=>{if(n.isSameNode(i))return;var[f]=n.querySelectorAll(`.${at}`);if(!f)return;const{distance:g}=w(l);it(f)&&(f.style[g]="0px")},_=(i,f)=>{const[g]=Rt(i,f);for(const D of[...g,i])$(D)},$=i=>{it(i)&&(i.style.transition="",i.style.transform="")},et=i=>{r(),lt(i,!1),i.style.transform="",i.style.transition="",i.style.top="",i.style.left="",ue(i,{fixedHeight:"",fixedWidth:""})},ot=(i,f)=>{const g=f.querySelector(u);dt(document.body,se,i),dt(g||f,Yt,i)},lt=(i,f)=>{dt(i,Ht,f),ot(f,i),o.toggleGrabClass(!f)};return[O,h,N,S,lt]}const me=(t,e,n)=>{const{insertingFromClass:s,animationDuration:o}=n,r=kt(()=>{const l=ie(e)[t];U(l,s),U(l,Zt),setTimeout(()=>{Ct(l,Zt),Ct(l,s),r.disconnect()},o)},e,{childList:!0})},mn=(t,e,n,s)=>{if(!e)return;const{onInsertEvent:o,delayBeforeInsert:r}=t;setTimeout(()=>{o(n,s),me(n,e,t)},r)},Sn=(t,e)=>{const n=l=>t.removeAtEvent(l),s=(l,u)=>t.insertEvent(l,u),o=()=>t.getLength(),r=l=>t.getValue(l),c=l=>l;return{direction:(e==null?void 0:e.direction)??tt,handlerSelector:(e==null?void 0:e.handlerSelector)??Q,draggingClass:(e==null?void 0:e.draggingClass)??"dragging",droppableClass:(e==null?void 0:e.droppableClass)??"droppable-hover",isDraggable:(e==null?void 0:e.isDraggable)??(()=>!0),onDragStart:(e==null?void 0:e.onDragStart)??(()=>{}),onDragEnd:(e==null?void 0:e.onDragEnd)??(()=>{}),droppableGroup:e==null?void 0:e.droppableGroup,onRemoveAtEvent:n,onInsertEvent:s,onGetLegth:o,onGetValue:r,animationDuration:(e==null?void 0:e.animationDuration)??200,removingClass:(e==null?void 0:e.removingClass)??"removing",insertingFromClass:(e==null?void 0:e.insertingFromClass)??"from-inserting",delayBeforeRemove:(e==null?void 0:e.delayBeforeRemove)??200,delayBeforeInsert:(e==null?void 0:e.delayBeforeInsert)??200,mapFrom:(e==null?void 0:e.mapFrom)??c}},Dn=(t,e)=>{const{config:n,droppable:s}=t,{onInsertEvent:o,onDragEnd:r}=n;return{...n,onDragEnd:u=>{const{index:d,value:m}=u;r({index:d,value:e(m,s)})},onInsertEvent:(u,d)=>o(u,e(d,s))}},vn=t=>{let e={offsetX:0,offsetY:0},n={top:0,left:0},s={x:0,y:0};const o=u=>{t.style.transform=`translate( ${u.x}px, ${u.y}px)`},r=u=>{t.style.top=`${u.top}px`,t.style.left=`${u.left}px`};return[(u,d,m,v)=>{const B=h=>{const{beforeMargin:S,borderBeforeWidth:y,before:R,offset:I,scroll:Y,page:W,inner:P,distance:st,axis:H,getRect:F}=w(h),Z=m[W],q=window[Y],z=window[P],X=F(u)[st],j=L(u,y),_=L(u,S),$=Z-e[I],et=ce(u,h);if($>=q-X/2&&$<=q+z){const lt=$-n[R]-j-_-q-et;return O(h),lt}return s[H]},O=h=>{if(u&&nt(u,Ht)&&h===v){const{before:S,distance:y,axis:R,getRect:I}=w(v),Y=I(u)[y],W=I(d),P=n[S]-W[S]+s[R],H=W[y]-Y,F=P/H,Z=Y/H,q=.1,z=.2,X=.8;let j=0;const _=pt(u,d);!_&&F<z&&F>-Z?j=F/z-1:!_&&F>X&&F<1+Z&&(j=1/(1-X)*(F-X));const $=q*Y*j;sn(d,v,$)}},N=h=>{const{axis:S}=w(h);s[S]=B(h),o(s)};N(V),N(tt)},(u,d)=>{const[m,v,B,O]=En(u,d,t);n={top:m,left:v},r(n),e={offsetX:B,offsetY:O}}]},Lt=(t,e,n)=>{const{borderBeforeWidth:s,before:o,getRect:r}=w(t);return r(e)[o]-r(n)[o]-L(n,s)},bn=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,r=Tn(o,e);const c=o;return c&&r&&!c.isSameNode(r)&&(n+=Lt(V,c,r),s+=Lt(tt,c,r)),r&&e!=o&&(n+=Lt(V,r,e),s+=Lt(tt,r,e)),[n,s]},Tn=(t,e)=>{const n=t==null?void 0:t.closest(`.${Ot}`);return n&&n.isSameNode(e)?t:n},ne=(t,e,n,s)=>{const{offset:o,beforeMargin:r,page:c,borderBeforeWidth:l,scroll:u}=w(t),d=ce(n,t);return e[c]-s[o]-L(n,r)-L(n,l)-window[u]-d},En=(t,e,n)=>{const[s,o]=bn(t,n);return[ne(tt,t,e,{offsetX:s,offsetY:o}),ne(V,t,e,{offsetX:s,offsetY:o}),s,o]},K=class K{static addConfig(e,n){const s=K.configs.filter(r=>!r.droppable.isSameNode(e)),o=Kt(e);s.push({droppable:e,config:n,scroll:o}),K.configs=s}static updateScrolls(e,n){for(const s of K.configs){const{droppable:o}=s;(n&&be(o,n)||o.isSameNode(e))&&(s.scroll=Kt(o))}}static getConfig(e){return K.configs.find(({droppable:s})=>s.isSameNode(e))}};k(K,"configs",[]),k(K,"removeObsoleteConfigs",()=>{const e=K.configs.filter(({droppable:n})=>document.contains(n));K.configs=e});let ht=K;class Cn{constructor(e,n,s,o,r,c){k(this,"initial");k(this,"current");k(this,"parent");k(this,"draggableElement");k(this,"groupClass");k(this,"dragEvent");k(this,"changeDroppable");k(this,"mapFrom");this.parent=s,this.draggableElement=e,this.groupClass=n,this.dragEvent=o,this.mapFrom=c,this.initial=s?this.getConfigFrom(s):void 0,this.changeDroppable=r}getDraggableAncestor(e,n,s){return document.elementsFromPoint(e,n).filter(o=>!o.isSameNode(s))}getElementBelow(e,n,s=!0){const o=c=>{const[l]=c.getDraggableAncestor(n.clientX,n.clientY,e);return l};let r=null;return s?(e.hidden=!0,r=o(this),e.hidden=!1):r=o(this),r}getCurrent(e,n,s=!0){const o=this.getElementBelow(e,n,s);return!this.groupClass||!o?void 0:o.closest(gt(this.groupClass))}isOutsideOfAllDroppables(e){return(this.groupClass?Array.from(document.querySelectorAll(gt(this.groupClass))):[this.parent]).every(s=>pt(e,s))}isNotInsideAnotherDroppable(e,n){return!pt(e,n)||this.isOutsideOfAllDroppables(e)}onScrollEvent(){this.dragEvent()}setOnScroll(e){le(e,"onscroll",()=>{this.onScrollEvent()})}getConfigFrom(e){const n=ht.getConfig(e);if(n)return{...n,config:Dn(n,this.mapFrom)}}getCurrentConfig(e){var o;const n=this.draggableElement;if(this.current&&this.isNotInsideAnotherDroppable(n,(o=this.current)==null?void 0:o.droppable))return this.current;const s=this.getCurrent(n,e);return s?(it(s)&&!s.onscroll&&this.setOnScroll(s),this.getConfigFrom(s)):this.getConfigFrom(this.parent)}updateConfig(e){const n=this.current;this.current=this.getCurrentConfig(e),this.changeDroppable(this.current,n)}isOutside(e,n=!0){const s=this.draggableElement;return!this.getCurrent(s,e,n)}}function yn(t,e,n,s,o){const{handlerSelector:r,isDraggable:c,droppableGroup:l,animationDuration:u,delayBeforeRemove:d,draggingClass:m,removingClass:v,onRemoveAtEvent:B,droppableClass:O,onDragStart:N}=n,h=yt(l).map(a=>`droppable-group-${a}`).join(" ");let S=0,y={scrollX:0,scrollY:0},R={pageX:0,pageY:0},I;const[Y,W]=vn(t),[P,st,H,F,Z]=hn(n,e,s,h,o,()=>S=0),q=()=>{U(t,Q)},z=a=>{U(a,Ot),o.addSubscriber(a)},X=()=>{if(c(t)){const a=t.querySelector(r);z(a||t)}},j=()=>{Ie(document.body,[`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Ot}{pointer-events:auto!important;}`,`.${oe}{cursor:grab;}`,".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",".droppable{box-sizing:border-box!important;}",`.${Ht}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,`.${Yt}{pointer-events:none!important;}`,`.${Wt}{pointer-events:none!important;}`,`.${se}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"]),X(),q()},_=a=>{const p=a==null?void 0:a.querySelector(`.${Ot}`),E=p==null?void 0:p.parentElement;return p&&E&&nt(E,It)&&!E.isSameNode(s)?null:p},$=a=>{const p=_(a)??a;p&&c(a)&&($t(p,"onmousedown",M("mousemove","mouseup")),$t(p,"ontouchstart",M("touchmove","touchend")),et(p)),a!=null&&a.isSameNode(p)||$t(a,"onmousedown",x),U(s,It)},et=a=>{const p=a.querySelectorAll("img");Array.from(p).forEach(E=>{E.onmousedown=()=>!1})},ot=()=>{if(R.pageX==0&&R.pageY==0||!i.current)return;const{droppable:a,config:p}=i.current;Y(t,a,R,p.direction),P(t,Ft,y,i.current)},lt=(a,p)=>{p&&S==2&&!(a!=null&&a.droppable.isSameNode(p.droppable))&&P(t,Ft,y,p)},i=new Cn(t,h,s,ot,lt,n.mapFrom),f=a=>{if(!i.current)return;const p=h?Array.from(document.querySelectorAll(gt(h))):[s];for(const E of p)E.classList.toggle(O,!a&&E.isSameNode(i.current.droppable))},g=a=>{i.updateConfig(a);const p=i.isOutside(a);f(p),S===1?ut(a):S===2&&(D(p),Dt(a))},D=(a=!0)=>{if(!i.current)return;const{droppable:p}=i.current;gn(p,s,h,u,a),!a&&Gt(t,s,S==1,i.current)},C=a=>{if(Xt(a)&&a.cancelable)a.preventDefault();else if(Xt(a))return;const p=_t(a);g(p)},b=(a,p)=>{a=="touchmove"?I=setTimeout(()=>{p()},200):p()},T=(a,p)=>{const{clientX:E,clientY:ft}=a,rt=document.elementFromPoint(E,ft),vt=rt==null?void 0:rt.closest(`.${Q}`);return rt&&p&&vt&&!p.isSameNode(vt)},A=a=>{const p=n.onGetValue(e);return{index:e,element:a,value:p}},M=(a,p)=>E=>{if(T(E,t))return;ht.updateScrolls(s,h);const{scrollX:ft,scrollY:rt}=window;if(y={scrollX:ft,scrollY:rt},S===0){S=1;const vt=A(t);vt&&N(vt),b(a,()=>{a=="touchmove"&&(i.updateConfig(E),f(i.isOutside(E)),ut(E)),document.addEventListener(a,C,{passive:!1})}),ct(s),document.addEventListener(p,G(a),{once:!0})}},x=a=>i.updateConfig(a),G=a=>p=>{f(!0);const E=_t(p);clearTimeout(I),At(i.isOutside(E,!1)),document.removeEventListener(a,C),i.updateConfig(E);const ft=i.getCurrentConfig(E);if(ft){const{droppable:rt}=ft;J(rt)}s.onscroll=null},J=a=>{if(a.onscroll=null,!h)return;const p=Array.from(document.querySelectorAll(gt(h)));for(const E of p)it(E)&&(E.onscroll=null)},ut=a=>{Gt(t,s,S==1,i.current),St(),P(t,fe,y,i.current),wt(t),W(a,t)},St=()=>{S=2},Dt=a=>{const{pageX:p,pageY:E}=a;R={pageX:p,pageY:E},ot()},ct=a=>le(a,"onscroll",Pt),Pt=()=>ot(),At=a=>{if(S!==2){S=0;return}S=3,xt(t),P(t,zt,y,a?i.initial:i.current,e)},xt=a=>{Nt(a,u,de),Tt(a,0,0)},wt=a=>{const{height:p,width:E}=a.getBoundingClientRect();ue(a,{fixedHeight:`${p}px`,fixedWidth:`${E}px`}),Z(a,!0),dt(a,m,!0),a.style.transition=""},Bt=a=>{if(!i.initial)return;const p=i.initial;a==e&&(U(t,v),setTimeout(()=>{B(e),Ct(t,v),Gt(t,s,S==1,i.initial),st(a,t,p,E=>{xt(E),F(t)})},d))},Se=(a,p)=>{(a===e||a===n.onGetLegth()&&e===a-1)&&H(a,t,s,p,()=>{fn(t,S==1,i.initial)})};return j(),$(t),[Bt,Se]}const An=(t,e)=>{t&&Te(e,t)};function xn(t,e,n,s="index"){const o=s;let r=[],c=[];const{droppableGroup:l}=t;if(!n)return[r,c];const u=yt(l).map(d=>`droppable-group-${d}`).join(" ");An(u,n);for(const d of n.children){const m=d.getAttribute(o),v=Ce(m),B=d;if(B&&v>=0){const[O,N]=yn(B,v,t,n,e);r.push(O),c.push(N)}}return[r,c]}function wn(t,e,n,s="index"){let o=[],r=[];const c=Sn(t,n),l=h=>{for(const S of o)S(h)},u=(h,S)=>{if(c.onGetLegth()===0)t.insertToListEmpty(c,h,S);else for(const R of r)R(h,S)},d=h=>{const[S,y]=xn(c,e,h,s);o=S,r=y},m=h=>{const S=h.addedNodes.values().filter(R=>!ee(R)).toArray(),y=h.removedNodes.values().filter(R=>!ee(R)).toArray();return S.length>0||y.length>0},v=h=>{kt(()=>{d(h)},h,{childList:!0},m)},B=h=>{U(h,It)},O=h=>{ht.addConfig(h,c)};return[l,u,h=>{h&&(B(h),O(h),v(h),d(h),ht.removeObsoleteConfigs())}]}exports.GRAB_CLASS=oe;exports.addClass=U;exports.dragAndDrop=wn;exports.insertToListEmpty=mn;exports.toggleClass=dt;