fansunited-management-components 1.29.0-RC1 → 1.29.0-RC2
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.
- package/index.es.js +0 -1
- package/index.umd.js +1 -1
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -35257,7 +35257,6 @@ const DF = Qe(/* @__PURE__ */ u.jsx("path", {
|
|
|
35257
35257
|
display: "flex",
|
|
35258
35258
|
flexDirection: "column",
|
|
35259
35259
|
width: "100%",
|
|
35260
|
-
mt: r && r.length ? 2 : 0,
|
|
35261
35260
|
gap: 1
|
|
35262
35261
|
},
|
|
35263
35262
|
children: [
|
package/index.umd.js
CHANGED
|
@@ -2472,4 +2472,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2472
2472
|
To pick up a draggable item, press the space bar.
|
|
2473
2473
|
While dragging, use the arrow keys to move the item.
|
|
2474
2474
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
2475
|
-
`},a$={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function s$(e){let{announcements:t=a$,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=o$}=e;const{announce:o,announcement:a}=n$(),l=go("DndLiveRegion"),[s,c]=C.useState(!1);if(C.useEffect(()=>{c(!0)},[]),r$(C.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&o(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(t.onDragCancel({active:h,over:p}))}}),[o,t])),!s)return null;const d=C.createElement(C.Fragment,null,C.createElement(e$,{id:r,value:i.draggable}),C.createElement(t$,{id:l,announcement:a}));return n?Oe.createPortal(d,n):d}var mt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(mt||(mt={}));function bs(){}function mv(e,t){return C.useMemo(()=>({sensor:e,options:t!=null?t:{}}),[e,t])}function l$(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const cn=Object.freeze({x:0,y:0});function c$(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function u$(e,t){const n=vs(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function d$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function f$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function vv(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function bv(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const h$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=vv(t),o=[];for(const a of r){const{id:l}=a,s=n.get(l);if(s){const c=vv(s),d=i.reduce((h,p,m)=>h+c$(c[m],p),0),f=Number((d/4).toFixed(4));o.push({id:l,data:{droppableContainer:a,value:f}})}}return o.sort(d$)};function p$(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,l=o-n;if(r<i&&n<o){const s=t.width*t.height,c=e.width*e.height,d=a*l,f=d/(s+c-d);return Number(f.toFixed(4))}return 0}const g$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const s=p$(l,t);s>0&&i.push({id:a,data:{droppableContainer:o,value:s}})}}return i.sort(f$)};function m$(e,t,n){return X(U({},e),{scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1})}function yv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cn}function v$(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((a,l)=>X(U({},a),{top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),U({},n))}}const b$=v$(1);function xv(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function y$(e,t,n){const r=xv(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:l}=r,s=e.left-a-(1-i)*parseFloat(n),c=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:c,right:s+d,bottom:c+f,left:s}}const x$={ignoreTransform:!1};function hi(e,t){t===void 0&&(t=x$);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=Rt(e).getComputedStyle(e);c&&(n=y$(n,c,d))}const{top:r,left:i,width:o,height:a,bottom:l,right:s}=n;return{top:r,left:i,width:o,height:a,bottom:l,right:s}}function Cv(e){return hi(e,{ignoreTransform:!0})}function C$(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function w$(e,t){return t===void 0&&(t=Rt(e).getComputedStyle(e)),t.position==="fixed"}function I$(e,t){t===void 0&&(t=Rt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function ys(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(pu(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!fo(i)||fv(i)||n.includes(i))return n;const o=Rt(e).getComputedStyle(i);return i!==e&&I$(i,o)&&n.push(i),w$(i,o)?n:r(i.parentNode)}return e?r(e):n}function wv(e){const[t]=ys(e,1);return t!=null?t:null}function mu(e){return!fs||!e?null:ui(e)?e:hu(e)?pu(e)||e===di(e).scrollingElement?window:fo(e)?e:null:null}function Iv(e){return ui(e)?e.scrollX:e.scrollLeft}function Sv(e){return ui(e)?e.scrollY:e.scrollTop}function vu(e){return{x:Iv(e),y:Sv(e)}}var xt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(xt||(xt={}));function Av(e){return!fs||!e?!1:e===document.scrollingElement}function Tv(e){const t={x:0,y:0},n=Av(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const S$={x:.2,y:.2};function A$(e,t,n,r,i){let{top:o,left:a,right:l,bottom:s}=n;r===void 0&&(r=10),i===void 0&&(i=S$);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=Tv(e),p={x:0,y:0},m={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+g.height?(p.y=xt.Backward,m.y=r*Math.abs((t.top+g.height-o)/g.height)):!d&&s>=t.bottom-g.height&&(p.y=xt.Forward,m.y=r*Math.abs((t.bottom-g.height-s)/g.height)),!h&&l>=t.right-g.width?(p.x=xt.Forward,m.x=r*Math.abs((t.right-g.width-l)/g.width)):!f&&a<=t.left+g.width&&(p.x=xt.Backward,m.x=r*Math.abs((t.left+g.width-a)/g.width)),{direction:p,speed:m}}function T$(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ev(e){return e.reduce((t,n)=>fi(t,vu(n)),cn)}function E$(e){return e.reduce((t,n)=>t+Iv(n),0)}function _$(e){return e.reduce((t,n)=>t+Sv(n),0)}function _v(e,t){if(t===void 0&&(t=hi),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);wv(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const k$=[["x",["left","right"],E$],["y",["top","bottom"],_$]];class bu{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ys(n),i=Ev(r);this.rect=U({},t),this.width=t.width,this.height=t.height;for(const[o,a,l]of k$)for(const s of a)Object.defineProperty(this,s,{get:()=>{const c=l(r),d=i[o]-c;return this.rect[s]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vo{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function P$(e){const{EventTarget:t}=Rt(e);return e instanceof t?e:di(e)}function yu(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(mi(n,2)+mi(r,2))>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var on;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(on||(on={}));function kv(e){e.preventDefault()}function D$(e){e.stopPropagation()}var _e;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(_e||(_e={}));const Pv={start:[_e.Space,_e.Enter],cancel:[_e.Esc],end:[_e.Space,_e.Enter,_e.Tab]},O$=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _e.Right:return X(U({},n),{x:n.x+25});case _e.Left:return X(U({},n),{x:n.x-25});case _e.Down:return X(U({},n),{y:n.y+25});case _e.Up:return X(U({},n),{y:n.y-25})}};class xu{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new vo(di(n)),this.windowListeners=new vo(Rt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(on.Resize,this.handleCancel),this.windowListeners.add(on.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(on.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&_v(r),n(cn)}handleKeyDown(t){if(ms(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Pv,coordinateGetter:a=O$,scrollBehavior:l="smooth"}=i,{code:s}=t;if(o.end.includes(s)){this.handleEnd(t);return}if(o.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:cn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=mo(f,d),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const v=t.code,{isTop:S,isRight:w,isLeft:y,isBottom:x,maxScroll:b,minScroll:T}=Tv(g),E=T$(g),P={x:Math.min(v===_e.Right?E.right-E.width/2:E.right,Math.max(v===_e.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(v===_e.Down?E.bottom-E.height/2:E.bottom,Math.max(v===_e.Down?E.top:E.top+E.height/2,f.y))},O=v===_e.Right&&!w||v===_e.Left&&!y,G=v===_e.Down&&!x||v===_e.Up&&!S;if(O&&P.x!==f.x){const z=g.scrollLeft+h.x,A=v===_e.Right&&z<=b.x||v===_e.Left&&z>=T.x;if(A&&!h.y){g.scrollTo({left:z,behavior:l});return}A?p.x=g.scrollLeft-z:p.x=v===_e.Right?g.scrollLeft-b.x:g.scrollLeft-T.x,p.x&&g.scrollBy({left:-p.x,behavior:l});break}else if(G&&P.y!==f.y){const z=g.scrollTop+h.y,A=v===_e.Down&&z<=b.y||v===_e.Up&&z>=T.y;if(A&&!h.x){g.scrollTo({top:z,behavior:l});return}A?p.y=g.scrollTop-z:p.y=v===_e.Down?g.scrollTop-b.y:g.scrollTop-T.y,p.y&&g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,fi(mo(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xu.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Pv,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function Dv(e){return!!(e&&"distance"in e)}function Ov(e){return!!(e&&"delay"in e)}class Cu{constructor(t,n,r){var i;r===void 0&&(r=P$(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=di(a),this.documentListeners=new vo(this.document),this.listeners=new vo(r),this.windowListeners=new vo(Rt(a)),this.initialCoordinates=(i=vs(o))!=null?i:cn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(on.Resize,this.handleCancel),this.windowListeners.add(on.DragStart,kv),this.windowListeners.add(on.VisibilityChange,this.handleCancel),this.windowListeners.add(on.ContextMenu,kv),this.documentListeners.add(on.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ov(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Dv(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(on.Click,D$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(on.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:l}}=o;if(!i)return;const s=(n=vs(t))!=null?n:cn,c=mo(i,s);if(!r&&l){if(Dv(l)){if(l.tolerance!=null&&yu(c,l.tolerance))return this.handleCancel();if(yu(c,l.distance))return this.handleStart()}if(Ov(l)&&yu(c,l.tolerance))return this.handleCancel();this.handlePending(l,c);return}t.cancelable&&t.preventDefault(),a(s)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===_e.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const R$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class wu extends Cu{constructor(t){const{event:n}=t,r=di(n.target);super(t,R$,r)}}wu.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const M$={move:{name:"mousemove"},end:{name:"mouseup"}};var Iu;(function(e){e[e.RightClick=2]="RightClick"})(Iu||(Iu={}));class L$ extends Cu{constructor(t){super(t,M$,di(t.event.target))}}L$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Iu.RightClick?!1:(r==null||r({event:n}),!0)}}];const Su={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class B$ extends Cu{constructor(t){super(t,Su)}static setup(){return window.addEventListener(Su.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Su.move.name,t)};function t(){}}}B$.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var bo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bo||(bo={}));var xs;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xs||(xs={}));function $$(e){let{acceleration:t,activator:n=bo.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:l=xs.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=F$({delta:f,disabled:!o}),[m,g]=qB(),v=C.useRef({x:0,y:0}),S=C.useRef({x:0,y:0}),w=C.useMemo(()=>{switch(n){case bo.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case bo.DraggableRect:return i}},[n,i,s]),y=C.useRef(null),x=C.useCallback(()=>{const T=y.current;if(!T)return;const E=v.current.x*S.current.x,P=v.current.y*S.current.y;T.scrollBy(E,P)},[]),b=C.useMemo(()=>l===xs.TreeOrder?[...c].reverse():c,[l,c]);C.useEffect(()=>{if(!o||!c.length||!w){g();return}for(const T of b){if((r==null?void 0:r(T))===!1)continue;const E=c.indexOf(T),P=d[E];if(!P)continue;const{direction:O,speed:G}=A$(T,P,w,t,h);for(const z of["x","y"])p[z][O[z]]||(G[z]=0,O[z]=0);if(G.x>0||G.y>0){g(),y.current=T,m(x,a),v.current=G,S.current=O;return}}v.current={x:0,y:0},S.current={x:0,y:0},g()},[t,x,r,g,o,a,JSON.stringify(w),JSON.stringify(p),m,c,b,d,JSON.stringify(h)])}const N$={x:{[xt.Backward]:!1,[xt.Forward]:!1},y:{[xt.Backward]:!1,[xt.Forward]:!1}};function F$(e){let{delta:t,disabled:n}=e;const r=gs(t);return po(i=>{if(n||!r||!i)return N$;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[xt.Backward]:i.x[xt.Backward]||o.x===-1,[xt.Forward]:i.x[xt.Forward]||o.x===1},y:{[xt.Backward]:i.y[xt.Backward]||o.y===-1,[xt.Forward]:i.y[xt.Forward]||o.y===1}}},[n,t,r])}function z$(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return po(i=>{var o;return t==null?null:(o=r!=null?r:i)!=null?o:null},[r,t])}function j$(e,t){return C.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var yo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(yo||(yo={}));var Au;(function(e){e.Optimized="optimized"})(Au||(Au={}));const Rv=new Map;function V$(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=C.useState(null),{frequency:l,measure:s,strategy:c}=i,d=C.useRef(e),f=v(),h=ho(f),p=C.useCallback(function(S){S===void 0&&(S=[]),!h.current&&a(w=>w===null?S:w.concat(S.filter(y=>!w.includes(y))))},[h]),m=C.useRef(null),g=po(S=>{if(f&&!n)return Rv;if(!S||S===Rv||d.current!==e||o!=null){const w=new Map;for(let y of e){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){w.set(y.id,y.rect.current);continue}const x=y.node.current,b=x?new bu(s(x),x):null;y.rect.current=b,b&&w.set(y.id,b)}return w}return S},[e,o,n,f,s]);return C.useEffect(()=>{d.current=e},[e]),C.useEffect(()=>{f||p()},[n,f]),C.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),C.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,f,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:o!=null};function v(){switch(c){case yo.Always:return!1;case yo.BeforeDragging:return n;default:return!n}}}function Tu(e,t){return po(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function U$(e,t){return Tu(e,t)}function H$(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.MutationObserver=="undefined")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Cs(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.ResizeObserver=="undefined")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function W$(e){return new bu(hi(e),e)}function Mv(e,t,n){t===void 0&&(t=W$);const[r,i]=C.useState(null);function o(){i(s=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=s!=null?s:n)!=null?c:null}const d=t(e);return JSON.stringify(s)===JSON.stringify(d)?s:d})}const a=H$({callback(s){if(e)for(const c of s){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),l=Cs({callback:o});return ln(()=>{o(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function G$(e){const t=Tu(e);return yv(e,t)}const Lv=[];function Y$(e){const t=C.useRef(e),n=po(r=>e?r&&r!==Lv&&e&&t.current&&e.parentNode===t.current.parentNode?r:ys(e):Lv,[e]);return C.useEffect(()=>{t.current=e},[e]),n}function K$(e){const[t,n]=C.useState(null),r=C.useRef(e),i=C.useCallback(o=>{const a=mu(o.target);a&&n(l=>l?(l.set(a,vu(a)),new Map(l)):null)},[]);return C.useEffect(()=>{const o=r.current;if(e!==o){a(o);const l=e.map(s=>{const c=mu(s);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,vu(c)]):null}).filter(s=>s!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(o)};function a(l){l.forEach(s=>{const c=mu(s);c==null||c.removeEventListener("scroll",i)})}},[i,e]),C.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>fi(o,a),cn):Ev(e):cn,[e,t])}function Bv(e,t){t===void 0&&(t=[]);const n=C.useRef(null);return C.useEffect(()=>{n.current=null},t),C.useEffect(()=>{const r=e!==cn;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?mo(e,n.current):cn}function q$(e){C.useEffect(()=>{if(!fs)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Q$(e,t){return C.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function $v(e){return C.useMemo(()=>e?C$(e):null,[e])}const Nv=[];function J$(e,t){t===void 0&&(t=hi);const[n]=e,r=$v(n?Rt(n):null),[i,o]=C.useState(Nv);function a(){o(()=>e.length?e.map(s=>Av(s)?r:new bu(t(s),s)):Nv)}const l=Cs({callback:a});return ln(()=>{l==null||l.disconnect(),a(),e.forEach(s=>l==null?void 0:l.observe(s))},[e]),i}function Fv(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return fo(t)?t:e}function X$(e){let{measure:t}=e;const[n,r]=C.useState(null),i=C.useCallback(c=>{for(const{target:d}of c)if(fo(d)){r(f=>{const h=t(d);return f?X(U({},f),{width:h.width,height:h.height}):h});break}},[t]),o=Cs({callback:i}),a=C.useCallback(c=>{const d=Fv(c);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?t(d):null)},[t,o]),[l,s]=ps(a);return C.useMemo(()=>({nodeRef:l,rect:n,setRef:s}),[n,l,s])}const Z$=[{sensor:wu,options:{}},{sensor:xu,options:{}}],eN={current:{}},ws={draggable:{measure:Cv},droppable:{measure:Cv,strategy:yo.WhileDragging,frequency:Au.Optimized},dragOverlay:{measure:hi}};class xo extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const tN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ws,measureDroppableContainers:bs,windowRect:null,measuringScheduled:!1},zv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bs,draggableNodes:new Map,over:null,measureDroppableContainers:bs},Co=C.createContext(zv),jv=C.createContext(tN);function nN(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xo}}}function rN(e,t){switch(t.type){case mt.DragStart:return X(U({},e),{draggable:X(U({},e.draggable),{initialCoordinates:t.initialCoordinates,active:t.active})});case mt.DragMove:return e.draggable.active==null?e:X(U({},e),{draggable:X(U({},e.draggable),{translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}})});case mt.DragEnd:case mt.DragCancel:return X(U({},e),{draggable:X(U({},e.draggable),{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}})});case mt.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new xo(e.droppable.containers);return i.set(r,n),X(U({},e),{droppable:X(U({},e.droppable),{containers:i})})}case mt.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new xo(e.droppable.containers);return a.set(n,X(U({},o),{disabled:i})),X(U({},e),{droppable:X(U({},e.droppable),{containers:a})})}case mt.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new xo(e.droppable.containers);return o.delete(n),X(U({},e),{droppable:X(U({},e.droppable),{containers:o})})}default:return e}}function iN(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=C.useContext(Co),o=gs(r),a=gs(n==null?void 0:n.id);return C.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!ms(o)||document.activeElement===o.target)return;const l=i.get(a);if(!l)return;const{activatorNode:s,node:c}=l;if(!s.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[s.current,c.current]){if(!d)continue;const f=XB(d);if(f){f.focus();break}}})}},[r,t,i,a,o]),null}function Vv(e,t){let i=t,{transform:n}=i,r=We(i,["transform"]);return e!=null&&e.length?e.reduce((o,a)=>a(U({transform:o},r)),n):n}function oN(e){return C.useMemo(()=>({draggable:U(U({},ws.draggable),e==null?void 0:e.draggable),droppable:U(U({},ws.droppable),e==null?void 0:e.droppable),dragOverlay:U(U({},ws.dragOverlay),e==null?void 0:e.dragOverlay)}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function aN(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=C.useRef(!1),{x:a,y:l}=typeof i=="boolean"?{x:i,y:i}:i;ln(()=>{if(!a&&!l||!t){o.current=!1;return}if(o.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const d=n(c),f=yv(d,r);if(a||(f.x=0),l||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=wv(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,a,l,r,n])}const Is=C.createContext(X(U({},cn),{scaleX:1,scaleY:1}));var ir;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ir||(ir={}));const sN=C.memo(function(t){var n,r,i,o;let _s=t,{id:a,accessibility:l,autoScroll:s=!0,children:c,sensors:d=Z$,collisionDetection:f=g$,measuring:h,modifiers:p}=_s,m=We(_s,["id","accessibility","autoScroll","children","sensors","collisionDetection","measuring","modifiers"]);const g=C.useReducer(rN,void 0,nN),[v,S]=g,[w,y]=i$(),[x,b]=C.useState(ir.Uninitialized),T=x===ir.Initialized,{draggable:{active:E,nodes:P,translate:O},droppable:{containers:G}}=v,z=E!=null?P.get(E):null,A=C.useRef({initial:null,translated:null}),W=C.useMemo(()=>{var Ct;return E!=null?{id:E,data:(Ct=z==null?void 0:z.data)!=null?Ct:eN,rect:A}:null},[E,z]),Y=C.useRef(null),[N,$]=C.useState(null),[B,H]=C.useState(null),q=ho(m,Object.values(m)),ee=go("DndDescribedBy",a),R=C.useMemo(()=>G.getEnabled(),[G]),L=oN(h),{droppableRects:F,measureDroppableContainers:V,measuringScheduled:te}=V$(R,{dragging:T,dependencies:[O.x,O.y],config:L.droppable}),se=z$(P,E),ae=C.useMemo(()=>B?vs(B):null,[B]),J=un(),le=U$(se,L.draggable.measure);aN({activeNode:E!=null?P.get(E):null,config:J.layoutShiftCompensation,initialRect:le,measure:L.draggable.measure});const ne=Mv(se,L.draggable.measure,le),ge=Mv(se?se.parentElement:null),Se=C.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:G,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ue=G.getNodeFor((n=Se.current.over)==null?void 0:n.id),wt=X$({measure:L.dragOverlay.measure}),at=(r=wt.nodeRef.current)!=null?r:se,kt=T?(i=wt.rect)!=null?i:ne:null,de=!!(wt.nodeRef.current&&wt.rect),he=G$(de?null:ne),xe=$v(at?Rt(at):null),Te=Y$(T?Ue!=null?Ue:se:null),He=J$(Te),Pe=Vv(p,{transform:{x:O.x-he.x,y:O.y-he.y,scaleX:1,scaleY:1},activatorEvent:B,active:W,activeNodeRect:ne,containerNodeRect:ge,draggingNodeRect:kt,over:Se.current.over,overlayNodeRect:wt.rect,scrollableAncestors:Te,scrollableAncestorRects:He,windowRect:xe}),Ee=ae?fi(ae,O):null,It=K$(Te),St=Bv(It),jt=Bv(It,[ne]),Mt=fi(Pe,St),qt=kt?b$(kt,Pe):null,or=W&&qt?f({active:W,collisionRect:qt,droppableRects:F,droppableContainers:R,pointerCoordinates:Ee}):null,Ts=bv(or,"id"),[wn,wo]=C.useState(null),_u=de?Pe:fi(Pe,jt),ku=m$(_u,(o=wn==null?void 0:wn.rect)!=null?o:null,ne),ze=C.useRef(null),pi=C.useCallback((Ct,_)=>{let{sensor:M,options:K}=_;if(Y.current==null)return;const Q=P.get(Y.current);if(!Q)return;const re=Ct.nativeEvent,ce=new M({active:Y.current,activeNode:Q,event:re,options:K,context:Se,onAbort(ue){if(!P.get(ue))return;const{onDragAbort:fe}=q.current,me={id:ue};fe==null||fe(me),w({type:"onDragAbort",event:me})},onPending(ue,we,fe,me){if(!P.get(ue))return;const{onDragPending:Pt}=q.current,nt={id:ue,constraint:we,initialCoordinates:fe,offset:me};Pt==null||Pt(nt),w({type:"onDragPending",event:nt})},onStart(ue){const we=Y.current;if(we==null)return;const fe=P.get(we);if(!fe)return;const{onDragStart:me}=q.current,De={activatorEvent:re,active:{id:we,data:fe.data,rect:A}};Oe.unstable_batchedUpdates(()=>{me==null||me(De),b(ir.Initializing),S({type:mt.DragStart,initialCoordinates:ue,active:we}),w({type:"onDragStart",event:De}),$(ze.current),H(re)})},onMove(ue){S({type:mt.DragMove,coordinates:ue})},onEnd:Ce(mt.DragEnd),onCancel:Ce(mt.DragCancel)});ze.current=ce;function Ce(ue){return function(){return k(this,null,function*(){const{active:fe,collisions:me,over:De,scrollAdjustedTranslate:Pt}=Se.current;let nt=null;if(fe&&Pt){const{cancelDrop:dn}=q.current;nt={activatorEvent:re,active:fe,collisions:me,delta:Pt,over:De},ue===mt.DragEnd&&typeof dn=="function"&&(yield Promise.resolve(dn(nt)))&&(ue=mt.DragCancel)}Y.current=null,Oe.unstable_batchedUpdates(()=>{S({type:ue}),b(ir.Uninitialized),wo(null),$(null),H(null),ze.current=null;const dn=ue===mt.DragEnd?"onDragEnd":"onDragCancel";if(nt){const In=q.current[dn];In==null||In(nt),w({type:dn,event:nt})}})})}}},[P]),Io=C.useCallback((Ct,_)=>(M,K)=>{const Q=M.nativeEvent,re=P.get(K);if(Y.current!==null||!re||Q.dndKit||Q.defaultPrevented)return;const ce={active:re};Ct(M,_.options,ce)===!0&&(Q.dndKit={capturedBy:_.sensor},Y.current=K,pi(M,_))},[P,pi]),Es=j$(d,Io);q$(d),ln(()=>{ne&&x===ir.Initializing&&b(ir.Initialized)},[ne,x]),C.useEffect(()=>{const{onDragMove:Ct}=q.current,{active:_,activatorEvent:M,collisions:K,over:Q}=Se.current;if(!_||!M)return;const re={active:_,activatorEvent:M,collisions:K,delta:{x:Mt.x,y:Mt.y},over:Q};Oe.unstable_batchedUpdates(()=>{Ct==null||Ct(re),w({type:"onDragMove",event:re})})},[Mt.x,Mt.y]),C.useEffect(()=>{const{active:Ct,activatorEvent:_,collisions:M,droppableContainers:K,scrollAdjustedTranslate:Q}=Se.current;if(!Ct||Y.current==null||!_||!Q)return;const{onDragOver:re}=q.current,ce=K.get(Ts),Ce=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,ue={active:Ct,activatorEvent:_,collisions:M,delta:{x:Q.x,y:Q.y},over:Ce};Oe.unstable_batchedUpdates(()=>{wo(Ce),re==null||re(ue),w({type:"onDragOver",event:ue})})},[Ts]),ln(()=>{Se.current={activatorEvent:B,active:W,activeNode:se,collisionRect:qt,collisions:or,droppableRects:F,draggableNodes:P,draggingNode:at,draggingNodeRect:kt,droppableContainers:G,over:wn,scrollableAncestors:Te,scrollAdjustedTranslate:Mt},A.current={initial:kt,translated:qt}},[W,se,or,qt,P,at,kt,F,G,wn,Te,Mt]),$$(X(U({},J),{delta:O,draggingRect:qt,pointerCoordinates:Ee,scrollableAncestors:Te,scrollableAncestorRects:He}));const gi=C.useMemo(()=>({active:W,activeNode:se,activeNodeRect:ne,activatorEvent:B,collisions:or,containerNodeRect:ge,dragOverlay:wt,draggableNodes:P,droppableContainers:G,droppableRects:F,over:wn,measureDroppableContainers:V,scrollableAncestors:Te,scrollableAncestorRects:He,measuringConfiguration:L,measuringScheduled:te,windowRect:xe}),[W,se,ne,B,or,ge,wt,P,G,F,wn,V,Te,He,L,te,xe]),So=C.useMemo(()=>({activatorEvent:B,activators:Es,active:W,activeNodeRect:ne,ariaDescribedById:{draggable:ee},dispatch:S,draggableNodes:P,over:wn,measureDroppableContainers:V}),[B,Es,W,ne,S,ee,P,wn,V]);return C.createElement(gv.Provider,{value:y},C.createElement(Co.Provider,{value:So},C.createElement(jv.Provider,{value:gi},C.createElement(Is.Provider,{value:ku},c)),C.createElement(iN,{disabled:(l==null?void 0:l.restoreFocus)===!1})),C.createElement(s$,X(U({},l),{hiddenTextDescribedById:ee})));function un(){const Ct=(N==null?void 0:N.autoScrollEnabled)===!1,_=typeof s=="object"?s.enabled===!1:s===!1,M=T&&!Ct&&!_;return typeof s=="object"?X(U({},s),{enabled:M}):{enabled:M}}}),lN=C.createContext(null),Uv="button",cN="Draggable";function uN(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=go(cN),{activators:a,activatorEvent:l,active:s,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=C.useContext(Co),{role:p=Uv,roleDescription:m="draggable",tabIndex:g=0}=i!=null?i:{},v=(s==null?void 0:s.id)===t,S=C.useContext(v?Is:lN),[w,y]=ps(),[x,b]=ps(),T=Q$(a,t),E=ho(n);ln(()=>(f.set(t,{id:t,key:o,node:w,activatorNode:x,data:E}),()=>{const O=f.get(t);O&&O.key===o&&f.delete(t)}),[f,t]);const P=C.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":v&&p===Uv?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,p,g,v,m,d.draggable]);return{active:s,activatorEvent:l,activeNodeRect:c,attributes:P,isDragging:v,listeners:r?void 0:T,node:w,over:h,setNodeRef:y,setActivatorNodeRef:b,transform:S}}function Hv(){return C.useContext(jv)}const dN="Droppable",fN={timeout:25};function hN(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=go(dN),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=C.useContext(Co),d=C.useRef({disabled:n}),f=C.useRef(!1),h=C.useRef(null),p=C.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}=U(U({},fN),i),S=ho(g!=null?g:r),w=C.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),p.current=null},v)},[v]),y=Cs({callback:w,disabled:m||!a}),x=C.useCallback((P,O)=>{y&&(O&&(y.unobserve(O),f.current=!1),P&&y.observe(P))},[y]),[b,T]=ps(x),E=ho(t);return C.useEffect(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),C.useEffect(()=>(l({type:mt.RegisterDroppable,element:{id:r,key:o,disabled:n,node:b,rect:h,data:E}}),()=>l({type:mt.UnregisterDroppable,key:o,id:r})),[r]),C.useEffect(()=>{n!==d.current.disabled&&(l({type:mt.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,l]),{active:a,rect:h,isOver:(s==null?void 0:s.id)===r,node:b,over:s,setNodeRef:T}}function pN(e){let{animation:t,children:n}=e;const[r,i]=C.useState(null),[o,a]=C.useState(null),l=gs(n);return!n&&!r&&l&&i(l),ln(()=>{if(!o)return;const s=r==null?void 0:r.key,c=r==null?void 0:r.props.id;if(s==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),C.createElement(C.Fragment,null,n,r?C.cloneElement(r,{ref:a}):null)}const gN={x:0,y:0,scaleX:1,scaleY:1};function mN(e){let{children:t}=e;return C.createElement(Co.Provider,{value:zv},C.createElement(Is.Provider,{value:gN},t))}const vN={position:"fixed",touchAction:"none"},bN=e=>ms(e)?"transform 250ms ease":void 0,yN=C.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:l,style:s,transform:c,transition:d=bN}=e;if(!l)return null;const f=i?c:X(U({},c),{scaleX:1,scaleY:1}),h=U(X(U({},vN),{width:l.width,height:l.height,top:l.top,left:l.left,transform:rr.Transform.toString(f),transformOrigin:i&&r?u$(r,l):void 0,transition:typeof d=="function"?d(r):d}),s);return C.createElement(n,{className:a,style:h,ref:t},o)}),Wv=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[l,s]of Object.entries(o.active))s!==void 0&&(i[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,s));if(o!=null&&o.dragOverlay)for(const[l,s]of Object.entries(o.dragOverlay))s!==void 0&&r.node.style.setProperty(l,s);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[s,c]of Object.entries(i))n.node.style.setProperty(s,c);a!=null&&a.active&&n.node.classList.remove(a.active)}},xN={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:rr.Transform.toString(t)},{transform:rr.Transform.toString(n)}]},sideEffects:Wv({styles:{active:{opacity:"0"}}})};function CN(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return hs((o,a)=>{if(t===null)return;const l=n.get(o);if(!l)return;const s=l.node.current;if(!s)return;const c=Fv(a);if(!c)return;const{transform:d}=Rt(a).getComputedStyle(a),f=xv(d);if(!f)return;const h=typeof t=="function"?t:wN(t);return _v(s,i.draggable.measure),h({active:{id:o,data:l.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function wN(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}=U(U({},xN),e);return o=>{let w=o,{active:a,dragOverlay:l,transform:s}=w,c=We(w,["active","dragOverlay","transform"]);if(!t)return;const d={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},f={scaleX:s.scaleX!==1?a.rect.width*s.scaleX/l.rect.width:1,scaleY:s.scaleY!==1?a.rect.height*s.scaleY/l.rect.height:1},h=U({x:s.x-d.x,y:s.y-d.y},f),p=i(X(U({},c),{active:a,dragOverlay:l,transform:{initial:s,final:h}})),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const v=r==null?void 0:r(U({active:a,dragOverlay:l},c)),S=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{S.onfinish=()=>{v==null||v(),y()}})}}let Gv=0;function IN(e){return C.useMemo(()=>{if(e!=null)return Gv++,Gv},[e])}const SN=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:l="div",className:s,zIndex:c=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:S,measuringConfiguration:w,scrollableAncestors:y,scrollableAncestorRects:x,windowRect:b}=Hv(),T=C.useContext(Is),E=IN(f==null?void 0:f.id),P=Vv(a,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:v.rect,over:S,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:x,transform:T,windowRect:b}),O=Tu(h),G=CN({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:w}),z=O?v.setRef:void 0;return C.createElement(mN,null,C.createElement(pN,{animation:G},f&&E?C.createElement(yN,{key:E,id:f.id,ref:z,as:l,activatorEvent:d,adjustScale:t,className:s,transition:o,rect:O,style:U({zIndex:c},i),transform:P},n):null))});function Eu(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function AN(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function Ss(e){return e!==null&&e>=0}function TN(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function EN(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Yv=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=Eu(t,r,n),a=t[i],l=o[i];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},Kv="Sortable",qv=C.createContext({activeIndex:-1,containerId:Kv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Yv,disabled:{draggable:!1,droppable:!1}});function _N(e){let{children:t,id:n,items:r,strategy:i=Yv,disabled:o=!1}=e;const{active:a,dragOverlay:l,droppableRects:s,over:c,measureDroppableContainers:d}=Hv(),f=go(Kv,n),h=l.rect!==null,p=C.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),m=a!=null,g=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,S=C.useRef(p),w=!TN(p,S.current),y=v!==-1&&g===-1||w,x=EN(o);ln(()=>{w&&m&&d(p)},[w,p,m,d]),C.useEffect(()=>{S.current=p},[p]);const b=C.useMemo(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:y,items:p,overIndex:v,useDragOverlay:h,sortedRects:AN(p,s),strategy:i}),[g,f,x.draggable,x.droppable,y,p,v,s,h,i]);return C.createElement(qv.Provider,{value:b},t)}const kN=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Eu(n,r,i).indexOf(t)},PN=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!c||!r||l!==o&&i===a?!1:n?!0:a!==i&&t===s},DN={duration:200,easing:"ease"},Qv="transform",ON=rr.Transition.toString({property:Qv,duration:0,easing:"linear"}),RN={roleDescription:"sortable"};function MN(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,a]=C.useState(null),l=C.useRef(n);return ln(()=>{if(!t&&n!==l.current&&r.current){const s=i.current;if(s){const c=hi(r.current,{ignoreTransform:!0}),d={x:s.left-c.left,y:s.top-c.top,scaleX:s.width/c.width,scaleY:s.height/c.height};(d.x||d.y)&&a(d)}}n!==l.current&&(l.current=n)},[t,n,r,i]),C.useEffect(()=>{o&&a(null)},[o]),o}function LN(e){let{animateLayoutChanges:t=PN,attributes:n,disabled:r,data:i,getNewIndex:o=kN,id:a,strategy:l,resizeObserverConfig:s,transition:c=DN}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:S,strategy:w}=C.useContext(qv),y=BN(r,p),x=d.indexOf(a),b=C.useMemo(()=>U({sortable:{containerId:f,index:x,items:d}},i),[f,i,x,d]),T=C.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:E,node:P,isOver:O,setNodeRef:G}=hN({id:a,data:b,disabled:y.droppable,resizeObserverConfig:U({updateMeasurementsFor:T},s)}),{active:z,activatorEvent:A,activeNodeRect:W,attributes:Y,setNodeRef:N,listeners:$,isDragging:B,over:H,setActivatorNodeRef:q,transform:ee}=uN({id:a,data:b,attributes:U(U({},RN),n),disabled:y.draggable}),R=KB(G,N),L=!!z,F=L&&!m&&Ss(h)&&Ss(v),V=!S&&B,te=V&&F?ee:null,se=l!=null?l:w,ae=F?te!=null?te:se({rects:g,activeNodeRect:W,activeIndex:h,overIndex:v,index:x}):null,J=Ss(h)&&Ss(v)?o({id:a,items:d,activeIndex:h,overIndex:v}):x,le=z==null?void 0:z.id,ne=C.useRef({activeId:le,items:d,newIndex:J,containerId:f}),ge=d!==ne.current.items,Se=t({active:z,containerId:f,isDragging:B,isSorting:L,id:a,index:x,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),Ue=MN({disabled:!Se,index:x,node:P,rect:E});return C.useEffect(()=>{L&&ne.current.newIndex!==J&&(ne.current.newIndex=J),f!==ne.current.containerId&&(ne.current.containerId=f),d!==ne.current.items&&(ne.current.items=d)},[L,J,f,d]),C.useEffect(()=>{if(le===ne.current.activeId)return;if(le!=null&&ne.current.activeId==null){ne.current.activeId=le;return}const at=setTimeout(()=>{ne.current.activeId=le},50);return()=>clearTimeout(at)},[le]),{active:z,activeIndex:h,attributes:Y,data:b,rect:E,index:x,newIndex:J,items:d,isOver:O,isSorting:L,isDragging:B,listeners:$,node:P,overIndex:v,over:H,setNodeRef:R,setActivatorNodeRef:q,setDroppableNodeRef:G,setDraggableNodeRef:N,transform:Ue!=null?Ue:ae,transition:wt()};function wt(){if(Ue||ge&&ne.current.newIndex===x)return ON;if(!(V&&!ms(A)||!c)&&(L||Se))return rr.Transition.toString(X(U({},c),{property:Qv}))}}function BN(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function As(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const $N=[_e.Down,_e.Right,_e.Up,_e.Left],NN=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:a,scrollableAncestors:l}}=t;if($N.includes(e.code)){if(e.preventDefault(),!n||!r)return;const s=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case _e.Down:r.top<h.top&&s.push(f);break;case _e.Up:r.top>h.top&&s.push(f);break;case _e.Left:r.left>h.left&&s.push(f);break;case _e.Right:r.left<h.left&&s.push(f);break}});const c=h$({active:n,collisionRect:r,droppableRects:i,droppableContainers:s,pointerCoordinates:null});let d=bv(c,"id");if(d===(a==null?void 0:a.id)&&c.length>1&&(d=c[1].id),d!=null){const f=o.get(n.id),h=o.get(d),p=h?i.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&f&&h){const v=ys(m).some((T,E)=>l[E]!==T),S=Jv(f,h),w=FN(f,h),y=v||!S?{x:0,y:0}:{x:w?r.width-p.width:0,y:w?r.height-p.height:0},x={x:p.left,y:p.top};return y.x&&y.y?x:mo(x,y)}}}};function Jv(e,t){return!As(e)||!As(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function FN(e,t){return!As(e)||!As(t)||!Jv(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const zN=Ve(u.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator"),Xv=C.createContext({attributes:{},listeners:void 0,ref(){}}),jN=()=>{const{attributes:e,listeners:t,ref:n}=C.useContext(Xv);return u.jsx(I.Button,X(U(U({sx:{backgroundColor:"transparent",color:"#919eab",width:"10px",":hover":{backgroundColor:"transparent"},":active":{backgroundColor:"transparent"}}},e),t),{ref:n,children:u.jsx(zN,{})}))},Zv=({children:e,id:t,tooltipTitle:n,removeItem:r,useDraggable:i=!0,variant:o="plain"})=>{const{attributes:a,isDragging:l,listeners:s,setNodeRef:c,setActivatorNodeRef:d,transform:f,transition:h}=LN({id:t}),p=C.useMemo(()=>({attributes:a,listeners:s,ref:d}),[a,s,d]),m={opacity:l?.6:void 0,transform:rr.Translate.toString(f),transition:h};return u.jsx(Xv.Provider,{value:p,children:u.jsx(I.ListItem,{variant:o,ref:c,style:m,startAction:i?u.jsx(jN,{}):u.jsx(u.Fragment,{}),endAction:i?u.jsx(I.Tooltip,{title:n,children:u.jsx(I.Button,{variant:"outlined",color:"danger",onClick:r,sx:{ml:"auto",p:.5},size:"sm",children:u.jsx(Le.Remove,{})})}):u.jsx(u.Fragment,{}),sx:{p:2,borderRadius:"sm"},children:e})})},VN={sideEffects:Wv({styles:{active:{opacity:"0.6"}}})},UN=({children:e})=>u.jsx(SN,{dropAnimation:VN,children:e}),HN=({entities:e=[],labels:t,setEntities:n,removeItem:r})=>{const[i,o]=C.useState(null),a=C.useMemo(()=>e.find(s=>s.id===(i==null?void 0:i.id)),[i,e]),l=l$(mv(wu),mv(xu,{coordinateGetter:NN}));return u.jsxs(sN,{sensors:l,onDragStart:({active:s})=>{o(s)},onDragEnd:({active:s,over:c})=>{if(c&&s.id!==(c==null?void 0:c.id)){const d=e.findIndex(({id:h})=>h===s.id),f=e.findIndex(({id:h})=>h===c.id);n(Eu(e,d,f))}o(null)},onDragCancel:()=>{o(null)},children:[u.jsx(_N,{items:e,children:u.jsx(I.List,{sx:{gap:"10px"},children:e.map(s=>u.jsxs(Zv,{id:s.id,variant:"outlined",removeItem:()=>r(s.id),tooltipTitle:t.removeEntity,children:[u.jsx(I.Typography,{ml:2,children:s.title||s.name}),s.type&&u.jsx(I.Chip,{color:eB(s.type),sx:{marginLeft:2},children:tB(s.type)})]},`sortable-item-${s.id}`))})}),u.jsx(UN,{children:a?u.jsx(u.Fragment,{children:e.map(s=>u.jsx(Zv,{id:s.id,useDraggable:!1,removeItem:()=>{},tooltipTitle:t.removeEntity},`sortable-overlay-item-${s.id}`))}):u.jsx(u.Fragment,{})})]})},WN=e=>u.jsxs(I.FormControl,{size:"sm",children:[u.jsx(I.FormLabel,{children:e.labels.itemsPerPage}),u.jsx(I.Select,{value:e.value,size:"sm",onChange:e.onChange,sx:{minHeight:"37px"},children:e.options.map((t,n)=>u.jsx(I.Option,{value:t,children:t},`items-per-page-${t}-${n}`))})]}),GN=(e,t)=>{const[n,r]=C.useState(null),{sdk:i}=pt(),o=()=>k(this,null,function*(){let a=[];if(!e){r(a);return}try{switch(e){case"top_x":a=(yield i.topX.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"match_quiz":a=(yield i.matchQuiz.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"template":a=(yield i.loyalty.getTemplates()).data.map(g=>({id:g.id,name:g.name,status:g.status,type:e,relationship:"relatedTo"}));break;case"classic_quiz":a=(yield i.miniGames.getClassicQuizzes({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"either_or":a=(yield i.miniGames.getEitherOrs({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"poll":a=(yield i.voting.getPolls({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"bracket":a=(yield i.bracketGame.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"standing":a=(yield i.standingGame.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break}}catch(l){console.error(l),r(a),t();return}r(a)});return C.useEffect(()=>(o(),()=>r(null)),[e]),n},YN=({status:e})=>{let t="neutral";switch(e){case"DYNAMIC":t="primary";break;case"CUSTOM":t="success";break;case"OPEN":t="primary";break;case"LIVE":t="primary";break;case"CANCELED":t="warning";break;case"SETTLED":t="success";break;case"INACTIVE":t="danger";break;case"ACTIVE":t="success";break;case"EXPIRED":t="neutral";break}return u.jsx(I.Chip,{color:t,variant:"solid",size:"sm",children:e})},KN=Ve(u.jsx("path",{d:"M12.16 3h-.32L9.21 8.25h5.58zm4.3 5.25h5.16L19 3h-5.16zm4.92 1.5h-8.63V20.1zM11.25 20.1V9.75H2.62zM7.54 8.25 10.16 3H5L2.38 8.25z"}),"Diamond"),qN=Ve(u.jsx("path",{d:"m21.58 16.09-1.09-7.66C20.21 6.46 18.52 5 16.53 5H7.47C5.48 5 3.79 6.46 3.51 8.43l-1.09 7.66C2.2 17.63 3.39 19 4.94 19c.68 0 1.32-.27 1.8-.75L9 16h6l2.25 2.25c.48.48 1.13.75 1.8.75 1.56 0 2.75-1.37 2.53-2.91M11 11H9v2H8v-2H6v-1h2V8h1v2h2zm4-1c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m2 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"}),"SportsEsports"),QN=Ve(u.jsx("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}),"QuestionMark"),JN=Ve(u.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows"),XN=Ve(u.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M9 17H7v-7h2zm4 0h-2V7h2zm4 0h-2v-4h2z"}),"Poll"),ZN=e=>{switch(e.entityType){case"top_x":return u.jsx(I.Tooltip,{title:"Top X",children:u.jsx(KN,{})});case"match_quiz":return u.jsx(I.Tooltip,{title:"Match Quiz",children:u.jsx(qN,{})});case"template":return u.jsx(I.Tooltip,{title:"Leaderboard Templates",children:u.jsx(Le.EmojiEvents,{})});case"classic_quiz":return u.jsx(I.Tooltip,{title:"Classic Quiz",children:u.jsx(QN,{})});case"either_or":return u.jsx(I.Tooltip,{title:"Either/Or",children:u.jsx(JN,{})});case"poll":return u.jsx(I.Tooltip,{title:"Poll",children:u.jsx(XN,{})});case"bracket":return u.jsx(I.Tooltip,{title:"Custom Bracket Game",children:u.jsx(Le.EmojiEvents,{})});case"standing":return u.jsx(I.Tooltip,{title:"Custom Standings Game",children:u.jsx(Le.EmojiEvents,{})});default:return null}},eF=({entity:e,deleteLabel:t,onDelete:n})=>u.jsx(u.Fragment,{children:u.jsx(I.Card,{sx:{p:2,mb:2},children:u.jsx(I.CardContent,{children:u.jsxs(I.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",justifyContent:"space-between"},children:[u.jsx(I.Typography,{fontSize:"sm",startDecorator:u.jsx(ZN,{entityType:e.type}),children:e.name}),u.jsx(I.Box,{display:{xs:"none",md:"block"},children:u.jsx(YN,{status:e.status})}),u.jsx(I.Box,{children:u.jsx(I.Tooltip,{title:t,children:u.jsx(I.IconButton,{onClick:()=>n(e.id,e.relationship),color:"danger",size:"sm",children:u.jsx(Le.Delete,{})})})})]})})})}),tF=(e,t,n,r)=>k(this,null,function*(){let o=[];const a=new Map;t.forEach(l=>{if(a.has(l.entity_type)){const s=a.get(l.entity_type);a.set(l.entity_type,[...s,[l.entity_id,l.entity_relationship]])}else a.set(l.entity_type,[[l.entity_id,l.entity_relationship]])});try{for(const[l,s]of a)switch(l){case"top_x":const c=s.map(([O])=>O),d=yield e.topX.getGames({limit:c.length,gameIds:c},!0);o=[...o,...d.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"match_quiz":const f=s.map(([O])=>O),h=yield e.matchQuiz.getGames({limit:f.length,gameIds:f},!0);o=[...o,...h.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"template":const p=s.map(([O])=>O),m=yield e.loyalty.getTemplates(void 0,!0);o=[...o,...m.data.filter(O=>p.includes(O.id)).map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"classic_quiz":const g=s.map(([O])=>O),v=yield e.miniGames.getClassicQuizzes({limit:g.length,classicQuizIds:g},!1,!0);o=[...o,...v.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"either_or":const S=s.map(([O])=>O),w=yield e.miniGames.getEitherOrs({limit:S.length,eitherOrIds:S},!1,!0);o=[...o,...w.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"poll":const y=s.map(([O])=>O),x=yield e.voting.getPolls({limit:y.length,pollIds:y},!0);o=[...o,...x.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"bracket":const b=s.map(([O])=>O),T=yield e.bracketGame.getGames({limit:b.length,gameIds:b},!0);o=[...o,...T.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"standing":const E=s.map(([O])=>O),P=yield e.standingGame.getGames({limit:E.length,gameIds:E},!0);o=[...o,...P.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;default:}}catch(l){console.error("Error loading related entities",l),n(o),r()}n(o)}),nF=["top_x","match_quiz","template","classic_quiz","poll","either_or","bracket","standing"],rF=["relatedTo","blocks","blockedBy","bonusPointsGame","nextInSeries","previousInSeries"],iF=new Map().set("template","Leaderboard Templates").set("classic_quiz","Classic Quiz").set("either_or","Either/Or").set("match_quiz","Match Quiz").set("top_x","Top X").set("bracket","Custom Bracket Game").set("standing","Custom Standing Game").set("poll","Poll"),eb=new Map().set("relatedTo","Related to").set("blocks","Blocks").set("blockedBy","Blocked by").set("nextInSeries","Next in series").set("previousInSeries","Previous in series").set("bonusPointsGame","Bonus points game"),oF={Login:NR,InformationInput:eo,RichText:ic,HeaderButtons:hP,MarketSelection:ZR,Accordion:eT,DynamicFields:PP,BasicSelect:nT,BooleanSwitch:wL,Branding:fP,ProfileSearchSelect:xL,RangeCalendar:_P,CompetitionSearchSelect:bL,Related:rM,Images:pR,Duration:EP,DatePickerComponent:to,Flags:uR,Spinner:us,Tags:km,Toast:ut,AdContent:tT,Match:eM,Winners:cB,CompetitionsSearchSelect:yL,TeamsSearchSelect:CL,CustomSelect:yM,Schedule:fM,NoPermissionCard:kP,CustomFlatpickrCalendar:Vc,ContextSelectFilter:dB,NumberInput:$B,EntityContext:HB,MiniGamesImages:GB,AuthRequirement:YB,SortableList:HN,ItemsPerPageFilter:WN,ImageCard:so,RelatedRelationship:({defaultValue:e=[],onChange:t,labels:n})=>{const[r,i]=C.useState([]),[o,a]=C.useState(""),[l,s]=C.useState(null),[c,d]=C.useState("relatedTo"),[f,h]=C.useState(!1),p=()=>h(!f),m=GN(l,p),{sdk:g}=pt();C.useEffect(()=>(e.length>0&&tF(g,e,i,p),()=>{i([]),a(""),s(null),d("relatedTo")}),[]);const v=()=>{if(e.some(E=>E.entity_id===o&&E.entity_relationship===c)){a("");return}const b=[...e,{entity_id:o,entity_type:l,entity_relationship:c}],T=(m==null?void 0:m.filter(E=>E.id===o).map(E=>({id:E.id,name:E.name,type:l,status:E.status,relationship:c})))||[];i([...r,...T]),t(b),a("")},S=(x,b)=>{const T=e.filter(P=>!(P.entity_id===x&&P.entity_relationship===b)),E=r.filter(P=>!(P.id===x&&P.relationship===b));i(E),t(T)},w=r.reduce((x,b)=>{const T=b.relationship;return x[T]||(x[T]=[]),x[T].push(b),x},{}),y=Object.keys(w).sort();return u.jsxs(u.Fragment,{children:[y.map(x=>u.jsxs(I.Box,{sx:{mb:2},children:[u.jsx(I.Typography,{level:"title-md",sx:{fontWeight:"bold",mb:1},children:u.jsx(I.Chip,{variant:"outlined",size:"md",sx:{bgcolor:"background.surface"},children:eb.get(x)||"Unknown relationship"})}),w[x].map((b,T)=>u.jsx(eF,{entity:b,deleteLabel:n.delete,onDelete:S},`related-entity-relationship-${b.id}-${T}`))]},`relationship-group-${x}`)),u.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",width:"100%",mt:r&&r.length?2:0,gap:1},children:[u.jsxs(I.FormControl,{children:[u.jsx(I.FormLabel,{required:!0,color:"primary",children:n.type}),u.jsx(I.Select,{value:l,size:"sm",name:"entity_type",onChange:(x,b)=>s(b),sx:{minHeight:"37px"},children:nF.map(x=>u.jsx(I.Option,{value:x,children:iF.get(x)},`entity-type-option-${x}`))})]}),u.jsxs(I.FormControl,{children:[u.jsx(I.FormLabel,{required:!0,color:"primary",children:n.relationship}),u.jsx(I.Select,{value:c,size:"sm",name:"entity_relationship",onChange:(x,b)=>d(b),sx:{minHeight:"37px"},children:rF.map(x=>u.jsx(I.Option,{value:x,children:eb.get(x)},`entity-relationship-option-${x}`))})]}),u.jsxs(I.FormControl,{children:[u.jsx(I.FormLabel,{required:!0,color:"primary",children:n.entity}),u.jsx(I.Select,{value:o,size:"sm",name:"entity_id",onChange:(x,b)=>a(b),sx:{width:"100%",mr:{xs:0,md:1},mb:{xs:1,md:0},minHeight:"37px"},endDecorator:!m&&u.jsx(I.CircularProgress,{size:"sm"}),children:m&&m.map(x=>u.jsx(I.Option,{value:x.id,children:x.name},`entity--${x.id}`))})]}),u.jsx(I.Button,{startDecorator:u.jsx(Le.Add,{}),disabled:!o||!l,onClick:v,sx:{mb:1},children:n.add})]}),u.jsx(ut,{showToast:f,message:n.relatedEntitiesErrorMessage,color:"danger",hideToast:p})]})},ExportUsersLeads:e=>{const[t,n]=C.useState(!1),[r,i]=C.useState(!1),[o,a]=C.useState("success"),[l,s]=C.useState(""),c=C.useContext(Xo),d=(h,p)=>{a(h),s(p),i(!0)},f=()=>k(this,null,function*(){n(!0);const h=yield c==null?void 0:c.https.exportLeadsPerEntity(e.entityId);if(h!=null&&h.ok){const p=yield h.blob(),m=URL.createObjectURL(p),g=document.createElement("a");g.href=m,g.download=`${e.entityType}_${e.entityName}_exported_users_leads.csv`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(m),n(!1),d("success",e.labels.usersLeadsExportMessage)}else console.error("Failed to export all users leads: ",yield h==null?void 0:h.json()),n(!1),d("danger",e.labels.usersLeadsExportErrorMessage)});return u.jsxs(u.Fragment,{children:[u.jsxs(I.Box,{mb:2,children:[u.jsx(I.Box,{display:"flex",alignItems:"center",mb:1,children:u.jsx(I.Typography,{level:"body-lg",sx:{mx:"auto"},children:e.labels.exportUsersLeads})}),u.jsx(I.Sheet,{sx:{overflowX:"auto",minWidth:"700px"},children:u.jsxs(I.Table,{variant:"outlined",hoverRow:!1,borderAxis:"bothBetween",size:"sm",sx:{backgroundColor:"#fff","& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left",width:"50%"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:e.labels.category}),u.jsx("th",{children:e.labels.action})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsxs("td",{children:[u.jsx(I.Typography,{level:"body-sm",fontWeight:"600",children:e.labels.exportAllUsersLeads}),u.jsx(I.Typography,{level:"body-xs",color:"neutral",children:e.labels.exportAllUsersLeadsDescription})]}),u.jsx("td",{children:u.jsx(I.Button,{loading:t,onClick:f,children:e.labels.exportAllUsersLeads})})]})})]})})]}),u.jsx(ut,{showToast:r,color:o,message:l,hideToast:()=>i(!1)})]})},SignOutButton:ng},tb=C.createContext(null),aF=({children:e})=>u.jsx(tb.Provider,{value:oF,children:e}),sF=()=>{const e=C.useContext(tb);if(!e)throw new Error("useComponentContext must be used within a ComponentProvider");return e},nb=425,rb=1024;return{APIProvider:hI,AuthProvider:pI,AuthContext:Bf,ComponentProvider:aF,useComponentContext:sF,useAPIContext:pt,useIsMobile:()=>{const[e,t]=C.useState(window.innerWidth<=rb),[n,r]=C.useState(window.innerWidth<=nb);return C.useLayoutEffect(()=>{const i=()=>{t(window.innerWidth<=rb),r(window.innerWidth<=nb)};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),{isMobile:e,isPhone:n}}}});
|
|
2475
|
+
`},a$={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function s$(e){let{announcements:t=a$,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=o$}=e;const{announce:o,announcement:a}=n$(),l=go("DndLiveRegion"),[s,c]=C.useState(!1);if(C.useEffect(()=>{c(!0)},[]),r$(C.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&o(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(t.onDragCancel({active:h,over:p}))}}),[o,t])),!s)return null;const d=C.createElement(C.Fragment,null,C.createElement(e$,{id:r,value:i.draggable}),C.createElement(t$,{id:l,announcement:a}));return n?Oe.createPortal(d,n):d}var mt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(mt||(mt={}));function bs(){}function mv(e,t){return C.useMemo(()=>({sensor:e,options:t!=null?t:{}}),[e,t])}function l$(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const cn=Object.freeze({x:0,y:0});function c$(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function u$(e,t){const n=vs(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function d$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function f$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function vv(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function bv(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const h$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=vv(t),o=[];for(const a of r){const{id:l}=a,s=n.get(l);if(s){const c=vv(s),d=i.reduce((h,p,m)=>h+c$(c[m],p),0),f=Number((d/4).toFixed(4));o.push({id:l,data:{droppableContainer:a,value:f}})}}return o.sort(d$)};function p$(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,l=o-n;if(r<i&&n<o){const s=t.width*t.height,c=e.width*e.height,d=a*l,f=d/(s+c-d);return Number(f.toFixed(4))}return 0}const g$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const s=p$(l,t);s>0&&i.push({id:a,data:{droppableContainer:o,value:s}})}}return i.sort(f$)};function m$(e,t,n){return X(U({},e),{scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1})}function yv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cn}function v$(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((a,l)=>X(U({},a),{top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),U({},n))}}const b$=v$(1);function xv(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function y$(e,t,n){const r=xv(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:l}=r,s=e.left-a-(1-i)*parseFloat(n),c=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:c,right:s+d,bottom:c+f,left:s}}const x$={ignoreTransform:!1};function hi(e,t){t===void 0&&(t=x$);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=Rt(e).getComputedStyle(e);c&&(n=y$(n,c,d))}const{top:r,left:i,width:o,height:a,bottom:l,right:s}=n;return{top:r,left:i,width:o,height:a,bottom:l,right:s}}function Cv(e){return hi(e,{ignoreTransform:!0})}function C$(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function w$(e,t){return t===void 0&&(t=Rt(e).getComputedStyle(e)),t.position==="fixed"}function I$(e,t){t===void 0&&(t=Rt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function ys(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(pu(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!fo(i)||fv(i)||n.includes(i))return n;const o=Rt(e).getComputedStyle(i);return i!==e&&I$(i,o)&&n.push(i),w$(i,o)?n:r(i.parentNode)}return e?r(e):n}function wv(e){const[t]=ys(e,1);return t!=null?t:null}function mu(e){return!fs||!e?null:ui(e)?e:hu(e)?pu(e)||e===di(e).scrollingElement?window:fo(e)?e:null:null}function Iv(e){return ui(e)?e.scrollX:e.scrollLeft}function Sv(e){return ui(e)?e.scrollY:e.scrollTop}function vu(e){return{x:Iv(e),y:Sv(e)}}var xt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(xt||(xt={}));function Av(e){return!fs||!e?!1:e===document.scrollingElement}function Tv(e){const t={x:0,y:0},n=Av(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const S$={x:.2,y:.2};function A$(e,t,n,r,i){let{top:o,left:a,right:l,bottom:s}=n;r===void 0&&(r=10),i===void 0&&(i=S$);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=Tv(e),p={x:0,y:0},m={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+g.height?(p.y=xt.Backward,m.y=r*Math.abs((t.top+g.height-o)/g.height)):!d&&s>=t.bottom-g.height&&(p.y=xt.Forward,m.y=r*Math.abs((t.bottom-g.height-s)/g.height)),!h&&l>=t.right-g.width?(p.x=xt.Forward,m.x=r*Math.abs((t.right-g.width-l)/g.width)):!f&&a<=t.left+g.width&&(p.x=xt.Backward,m.x=r*Math.abs((t.left+g.width-a)/g.width)),{direction:p,speed:m}}function T$(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ev(e){return e.reduce((t,n)=>fi(t,vu(n)),cn)}function E$(e){return e.reduce((t,n)=>t+Iv(n),0)}function _$(e){return e.reduce((t,n)=>t+Sv(n),0)}function _v(e,t){if(t===void 0&&(t=hi),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);wv(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const k$=[["x",["left","right"],E$],["y",["top","bottom"],_$]];class bu{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ys(n),i=Ev(r);this.rect=U({},t),this.width=t.width,this.height=t.height;for(const[o,a,l]of k$)for(const s of a)Object.defineProperty(this,s,{get:()=>{const c=l(r),d=i[o]-c;return this.rect[s]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vo{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function P$(e){const{EventTarget:t}=Rt(e);return e instanceof t?e:di(e)}function yu(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(mi(n,2)+mi(r,2))>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var on;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(on||(on={}));function kv(e){e.preventDefault()}function D$(e){e.stopPropagation()}var _e;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(_e||(_e={}));const Pv={start:[_e.Space,_e.Enter],cancel:[_e.Esc],end:[_e.Space,_e.Enter,_e.Tab]},O$=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _e.Right:return X(U({},n),{x:n.x+25});case _e.Left:return X(U({},n),{x:n.x-25});case _e.Down:return X(U({},n),{y:n.y+25});case _e.Up:return X(U({},n),{y:n.y-25})}};class xu{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new vo(di(n)),this.windowListeners=new vo(Rt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(on.Resize,this.handleCancel),this.windowListeners.add(on.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(on.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&_v(r),n(cn)}handleKeyDown(t){if(ms(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Pv,coordinateGetter:a=O$,scrollBehavior:l="smooth"}=i,{code:s}=t;if(o.end.includes(s)){this.handleEnd(t);return}if(o.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:cn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=mo(f,d),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const v=t.code,{isTop:S,isRight:w,isLeft:y,isBottom:x,maxScroll:b,minScroll:T}=Tv(g),E=T$(g),P={x:Math.min(v===_e.Right?E.right-E.width/2:E.right,Math.max(v===_e.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(v===_e.Down?E.bottom-E.height/2:E.bottom,Math.max(v===_e.Down?E.top:E.top+E.height/2,f.y))},O=v===_e.Right&&!w||v===_e.Left&&!y,G=v===_e.Down&&!x||v===_e.Up&&!S;if(O&&P.x!==f.x){const z=g.scrollLeft+h.x,A=v===_e.Right&&z<=b.x||v===_e.Left&&z>=T.x;if(A&&!h.y){g.scrollTo({left:z,behavior:l});return}A?p.x=g.scrollLeft-z:p.x=v===_e.Right?g.scrollLeft-b.x:g.scrollLeft-T.x,p.x&&g.scrollBy({left:-p.x,behavior:l});break}else if(G&&P.y!==f.y){const z=g.scrollTop+h.y,A=v===_e.Down&&z<=b.y||v===_e.Up&&z>=T.y;if(A&&!h.x){g.scrollTo({top:z,behavior:l});return}A?p.y=g.scrollTop-z:p.y=v===_e.Down?g.scrollTop-b.y:g.scrollTop-T.y,p.y&&g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,fi(mo(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xu.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Pv,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function Dv(e){return!!(e&&"distance"in e)}function Ov(e){return!!(e&&"delay"in e)}class Cu{constructor(t,n,r){var i;r===void 0&&(r=P$(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=di(a),this.documentListeners=new vo(this.document),this.listeners=new vo(r),this.windowListeners=new vo(Rt(a)),this.initialCoordinates=(i=vs(o))!=null?i:cn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(on.Resize,this.handleCancel),this.windowListeners.add(on.DragStart,kv),this.windowListeners.add(on.VisibilityChange,this.handleCancel),this.windowListeners.add(on.ContextMenu,kv),this.documentListeners.add(on.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ov(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Dv(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(on.Click,D$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(on.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:l}}=o;if(!i)return;const s=(n=vs(t))!=null?n:cn,c=mo(i,s);if(!r&&l){if(Dv(l)){if(l.tolerance!=null&&yu(c,l.tolerance))return this.handleCancel();if(yu(c,l.distance))return this.handleStart()}if(Ov(l)&&yu(c,l.tolerance))return this.handleCancel();this.handlePending(l,c);return}t.cancelable&&t.preventDefault(),a(s)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===_e.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const R$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class wu extends Cu{constructor(t){const{event:n}=t,r=di(n.target);super(t,R$,r)}}wu.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const M$={move:{name:"mousemove"},end:{name:"mouseup"}};var Iu;(function(e){e[e.RightClick=2]="RightClick"})(Iu||(Iu={}));class L$ extends Cu{constructor(t){super(t,M$,di(t.event.target))}}L$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Iu.RightClick?!1:(r==null||r({event:n}),!0)}}];const Su={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class B$ extends Cu{constructor(t){super(t,Su)}static setup(){return window.addEventListener(Su.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Su.move.name,t)};function t(){}}}B$.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var bo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bo||(bo={}));var xs;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xs||(xs={}));function $$(e){let{acceleration:t,activator:n=bo.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:l=xs.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=F$({delta:f,disabled:!o}),[m,g]=qB(),v=C.useRef({x:0,y:0}),S=C.useRef({x:0,y:0}),w=C.useMemo(()=>{switch(n){case bo.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case bo.DraggableRect:return i}},[n,i,s]),y=C.useRef(null),x=C.useCallback(()=>{const T=y.current;if(!T)return;const E=v.current.x*S.current.x,P=v.current.y*S.current.y;T.scrollBy(E,P)},[]),b=C.useMemo(()=>l===xs.TreeOrder?[...c].reverse():c,[l,c]);C.useEffect(()=>{if(!o||!c.length||!w){g();return}for(const T of b){if((r==null?void 0:r(T))===!1)continue;const E=c.indexOf(T),P=d[E];if(!P)continue;const{direction:O,speed:G}=A$(T,P,w,t,h);for(const z of["x","y"])p[z][O[z]]||(G[z]=0,O[z]=0);if(G.x>0||G.y>0){g(),y.current=T,m(x,a),v.current=G,S.current=O;return}}v.current={x:0,y:0},S.current={x:0,y:0},g()},[t,x,r,g,o,a,JSON.stringify(w),JSON.stringify(p),m,c,b,d,JSON.stringify(h)])}const N$={x:{[xt.Backward]:!1,[xt.Forward]:!1},y:{[xt.Backward]:!1,[xt.Forward]:!1}};function F$(e){let{delta:t,disabled:n}=e;const r=gs(t);return po(i=>{if(n||!r||!i)return N$;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[xt.Backward]:i.x[xt.Backward]||o.x===-1,[xt.Forward]:i.x[xt.Forward]||o.x===1},y:{[xt.Backward]:i.y[xt.Backward]||o.y===-1,[xt.Forward]:i.y[xt.Forward]||o.y===1}}},[n,t,r])}function z$(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return po(i=>{var o;return t==null?null:(o=r!=null?r:i)!=null?o:null},[r,t])}function j$(e,t){return C.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var yo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(yo||(yo={}));var Au;(function(e){e.Optimized="optimized"})(Au||(Au={}));const Rv=new Map;function V$(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=C.useState(null),{frequency:l,measure:s,strategy:c}=i,d=C.useRef(e),f=v(),h=ho(f),p=C.useCallback(function(S){S===void 0&&(S=[]),!h.current&&a(w=>w===null?S:w.concat(S.filter(y=>!w.includes(y))))},[h]),m=C.useRef(null),g=po(S=>{if(f&&!n)return Rv;if(!S||S===Rv||d.current!==e||o!=null){const w=new Map;for(let y of e){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){w.set(y.id,y.rect.current);continue}const x=y.node.current,b=x?new bu(s(x),x):null;y.rect.current=b,b&&w.set(y.id,b)}return w}return S},[e,o,n,f,s]);return C.useEffect(()=>{d.current=e},[e]),C.useEffect(()=>{f||p()},[n,f]),C.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),C.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,f,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:o!=null};function v(){switch(c){case yo.Always:return!1;case yo.BeforeDragging:return n;default:return!n}}}function Tu(e,t){return po(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function U$(e,t){return Tu(e,t)}function H$(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.MutationObserver=="undefined")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Cs(e){let{callback:t,disabled:n}=e;const r=hs(t),i=C.useMemo(()=>{if(n||typeof window=="undefined"||typeof window.ResizeObserver=="undefined")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return C.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function W$(e){return new bu(hi(e),e)}function Mv(e,t,n){t===void 0&&(t=W$);const[r,i]=C.useState(null);function o(){i(s=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=s!=null?s:n)!=null?c:null}const d=t(e);return JSON.stringify(s)===JSON.stringify(d)?s:d})}const a=H$({callback(s){if(e)for(const c of s){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),l=Cs({callback:o});return ln(()=>{o(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function G$(e){const t=Tu(e);return yv(e,t)}const Lv=[];function Y$(e){const t=C.useRef(e),n=po(r=>e?r&&r!==Lv&&e&&t.current&&e.parentNode===t.current.parentNode?r:ys(e):Lv,[e]);return C.useEffect(()=>{t.current=e},[e]),n}function K$(e){const[t,n]=C.useState(null),r=C.useRef(e),i=C.useCallback(o=>{const a=mu(o.target);a&&n(l=>l?(l.set(a,vu(a)),new Map(l)):null)},[]);return C.useEffect(()=>{const o=r.current;if(e!==o){a(o);const l=e.map(s=>{const c=mu(s);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,vu(c)]):null}).filter(s=>s!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(o)};function a(l){l.forEach(s=>{const c=mu(s);c==null||c.removeEventListener("scroll",i)})}},[i,e]),C.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>fi(o,a),cn):Ev(e):cn,[e,t])}function Bv(e,t){t===void 0&&(t=[]);const n=C.useRef(null);return C.useEffect(()=>{n.current=null},t),C.useEffect(()=>{const r=e!==cn;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?mo(e,n.current):cn}function q$(e){C.useEffect(()=>{if(!fs)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Q$(e,t){return C.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function $v(e){return C.useMemo(()=>e?C$(e):null,[e])}const Nv=[];function J$(e,t){t===void 0&&(t=hi);const[n]=e,r=$v(n?Rt(n):null),[i,o]=C.useState(Nv);function a(){o(()=>e.length?e.map(s=>Av(s)?r:new bu(t(s),s)):Nv)}const l=Cs({callback:a});return ln(()=>{l==null||l.disconnect(),a(),e.forEach(s=>l==null?void 0:l.observe(s))},[e]),i}function Fv(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return fo(t)?t:e}function X$(e){let{measure:t}=e;const[n,r]=C.useState(null),i=C.useCallback(c=>{for(const{target:d}of c)if(fo(d)){r(f=>{const h=t(d);return f?X(U({},f),{width:h.width,height:h.height}):h});break}},[t]),o=Cs({callback:i}),a=C.useCallback(c=>{const d=Fv(c);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?t(d):null)},[t,o]),[l,s]=ps(a);return C.useMemo(()=>({nodeRef:l,rect:n,setRef:s}),[n,l,s])}const Z$=[{sensor:wu,options:{}},{sensor:xu,options:{}}],eN={current:{}},ws={draggable:{measure:Cv},droppable:{measure:Cv,strategy:yo.WhileDragging,frequency:Au.Optimized},dragOverlay:{measure:hi}};class xo extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const tN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ws,measureDroppableContainers:bs,windowRect:null,measuringScheduled:!1},zv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bs,draggableNodes:new Map,over:null,measureDroppableContainers:bs},Co=C.createContext(zv),jv=C.createContext(tN);function nN(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xo}}}function rN(e,t){switch(t.type){case mt.DragStart:return X(U({},e),{draggable:X(U({},e.draggable),{initialCoordinates:t.initialCoordinates,active:t.active})});case mt.DragMove:return e.draggable.active==null?e:X(U({},e),{draggable:X(U({},e.draggable),{translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}})});case mt.DragEnd:case mt.DragCancel:return X(U({},e),{draggable:X(U({},e.draggable),{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}})});case mt.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new xo(e.droppable.containers);return i.set(r,n),X(U({},e),{droppable:X(U({},e.droppable),{containers:i})})}case mt.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new xo(e.droppable.containers);return a.set(n,X(U({},o),{disabled:i})),X(U({},e),{droppable:X(U({},e.droppable),{containers:a})})}case mt.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new xo(e.droppable.containers);return o.delete(n),X(U({},e),{droppable:X(U({},e.droppable),{containers:o})})}default:return e}}function iN(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=C.useContext(Co),o=gs(r),a=gs(n==null?void 0:n.id);return C.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!ms(o)||document.activeElement===o.target)return;const l=i.get(a);if(!l)return;const{activatorNode:s,node:c}=l;if(!s.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[s.current,c.current]){if(!d)continue;const f=XB(d);if(f){f.focus();break}}})}},[r,t,i,a,o]),null}function Vv(e,t){let i=t,{transform:n}=i,r=We(i,["transform"]);return e!=null&&e.length?e.reduce((o,a)=>a(U({transform:o},r)),n):n}function oN(e){return C.useMemo(()=>({draggable:U(U({},ws.draggable),e==null?void 0:e.draggable),droppable:U(U({},ws.droppable),e==null?void 0:e.droppable),dragOverlay:U(U({},ws.dragOverlay),e==null?void 0:e.dragOverlay)}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function aN(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=C.useRef(!1),{x:a,y:l}=typeof i=="boolean"?{x:i,y:i}:i;ln(()=>{if(!a&&!l||!t){o.current=!1;return}if(o.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const d=n(c),f=yv(d,r);if(a||(f.x=0),l||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=wv(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,a,l,r,n])}const Is=C.createContext(X(U({},cn),{scaleX:1,scaleY:1}));var ir;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ir||(ir={}));const sN=C.memo(function(t){var n,r,i,o;let _s=t,{id:a,accessibility:l,autoScroll:s=!0,children:c,sensors:d=Z$,collisionDetection:f=g$,measuring:h,modifiers:p}=_s,m=We(_s,["id","accessibility","autoScroll","children","sensors","collisionDetection","measuring","modifiers"]);const g=C.useReducer(rN,void 0,nN),[v,S]=g,[w,y]=i$(),[x,b]=C.useState(ir.Uninitialized),T=x===ir.Initialized,{draggable:{active:E,nodes:P,translate:O},droppable:{containers:G}}=v,z=E!=null?P.get(E):null,A=C.useRef({initial:null,translated:null}),W=C.useMemo(()=>{var Ct;return E!=null?{id:E,data:(Ct=z==null?void 0:z.data)!=null?Ct:eN,rect:A}:null},[E,z]),Y=C.useRef(null),[N,$]=C.useState(null),[B,H]=C.useState(null),q=ho(m,Object.values(m)),ee=go("DndDescribedBy",a),R=C.useMemo(()=>G.getEnabled(),[G]),L=oN(h),{droppableRects:F,measureDroppableContainers:V,measuringScheduled:te}=V$(R,{dragging:T,dependencies:[O.x,O.y],config:L.droppable}),se=z$(P,E),ae=C.useMemo(()=>B?vs(B):null,[B]),J=un(),le=U$(se,L.draggable.measure);aN({activeNode:E!=null?P.get(E):null,config:J.layoutShiftCompensation,initialRect:le,measure:L.draggable.measure});const ne=Mv(se,L.draggable.measure,le),ge=Mv(se?se.parentElement:null),Se=C.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:G,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ue=G.getNodeFor((n=Se.current.over)==null?void 0:n.id),wt=X$({measure:L.dragOverlay.measure}),at=(r=wt.nodeRef.current)!=null?r:se,kt=T?(i=wt.rect)!=null?i:ne:null,de=!!(wt.nodeRef.current&&wt.rect),he=G$(de?null:ne),xe=$v(at?Rt(at):null),Te=Y$(T?Ue!=null?Ue:se:null),He=J$(Te),Pe=Vv(p,{transform:{x:O.x-he.x,y:O.y-he.y,scaleX:1,scaleY:1},activatorEvent:B,active:W,activeNodeRect:ne,containerNodeRect:ge,draggingNodeRect:kt,over:Se.current.over,overlayNodeRect:wt.rect,scrollableAncestors:Te,scrollableAncestorRects:He,windowRect:xe}),Ee=ae?fi(ae,O):null,It=K$(Te),St=Bv(It),jt=Bv(It,[ne]),Mt=fi(Pe,St),qt=kt?b$(kt,Pe):null,or=W&&qt?f({active:W,collisionRect:qt,droppableRects:F,droppableContainers:R,pointerCoordinates:Ee}):null,Ts=bv(or,"id"),[wn,wo]=C.useState(null),_u=de?Pe:fi(Pe,jt),ku=m$(_u,(o=wn==null?void 0:wn.rect)!=null?o:null,ne),ze=C.useRef(null),pi=C.useCallback((Ct,_)=>{let{sensor:M,options:K}=_;if(Y.current==null)return;const Q=P.get(Y.current);if(!Q)return;const re=Ct.nativeEvent,ce=new M({active:Y.current,activeNode:Q,event:re,options:K,context:Se,onAbort(ue){if(!P.get(ue))return;const{onDragAbort:fe}=q.current,me={id:ue};fe==null||fe(me),w({type:"onDragAbort",event:me})},onPending(ue,we,fe,me){if(!P.get(ue))return;const{onDragPending:Pt}=q.current,nt={id:ue,constraint:we,initialCoordinates:fe,offset:me};Pt==null||Pt(nt),w({type:"onDragPending",event:nt})},onStart(ue){const we=Y.current;if(we==null)return;const fe=P.get(we);if(!fe)return;const{onDragStart:me}=q.current,De={activatorEvent:re,active:{id:we,data:fe.data,rect:A}};Oe.unstable_batchedUpdates(()=>{me==null||me(De),b(ir.Initializing),S({type:mt.DragStart,initialCoordinates:ue,active:we}),w({type:"onDragStart",event:De}),$(ze.current),H(re)})},onMove(ue){S({type:mt.DragMove,coordinates:ue})},onEnd:Ce(mt.DragEnd),onCancel:Ce(mt.DragCancel)});ze.current=ce;function Ce(ue){return function(){return k(this,null,function*(){const{active:fe,collisions:me,over:De,scrollAdjustedTranslate:Pt}=Se.current;let nt=null;if(fe&&Pt){const{cancelDrop:dn}=q.current;nt={activatorEvent:re,active:fe,collisions:me,delta:Pt,over:De},ue===mt.DragEnd&&typeof dn=="function"&&(yield Promise.resolve(dn(nt)))&&(ue=mt.DragCancel)}Y.current=null,Oe.unstable_batchedUpdates(()=>{S({type:ue}),b(ir.Uninitialized),wo(null),$(null),H(null),ze.current=null;const dn=ue===mt.DragEnd?"onDragEnd":"onDragCancel";if(nt){const In=q.current[dn];In==null||In(nt),w({type:dn,event:nt})}})})}}},[P]),Io=C.useCallback((Ct,_)=>(M,K)=>{const Q=M.nativeEvent,re=P.get(K);if(Y.current!==null||!re||Q.dndKit||Q.defaultPrevented)return;const ce={active:re};Ct(M,_.options,ce)===!0&&(Q.dndKit={capturedBy:_.sensor},Y.current=K,pi(M,_))},[P,pi]),Es=j$(d,Io);q$(d),ln(()=>{ne&&x===ir.Initializing&&b(ir.Initialized)},[ne,x]),C.useEffect(()=>{const{onDragMove:Ct}=q.current,{active:_,activatorEvent:M,collisions:K,over:Q}=Se.current;if(!_||!M)return;const re={active:_,activatorEvent:M,collisions:K,delta:{x:Mt.x,y:Mt.y},over:Q};Oe.unstable_batchedUpdates(()=>{Ct==null||Ct(re),w({type:"onDragMove",event:re})})},[Mt.x,Mt.y]),C.useEffect(()=>{const{active:Ct,activatorEvent:_,collisions:M,droppableContainers:K,scrollAdjustedTranslate:Q}=Se.current;if(!Ct||Y.current==null||!_||!Q)return;const{onDragOver:re}=q.current,ce=K.get(Ts),Ce=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,ue={active:Ct,activatorEvent:_,collisions:M,delta:{x:Q.x,y:Q.y},over:Ce};Oe.unstable_batchedUpdates(()=>{wo(Ce),re==null||re(ue),w({type:"onDragOver",event:ue})})},[Ts]),ln(()=>{Se.current={activatorEvent:B,active:W,activeNode:se,collisionRect:qt,collisions:or,droppableRects:F,draggableNodes:P,draggingNode:at,draggingNodeRect:kt,droppableContainers:G,over:wn,scrollableAncestors:Te,scrollAdjustedTranslate:Mt},A.current={initial:kt,translated:qt}},[W,se,or,qt,P,at,kt,F,G,wn,Te,Mt]),$$(X(U({},J),{delta:O,draggingRect:qt,pointerCoordinates:Ee,scrollableAncestors:Te,scrollableAncestorRects:He}));const gi=C.useMemo(()=>({active:W,activeNode:se,activeNodeRect:ne,activatorEvent:B,collisions:or,containerNodeRect:ge,dragOverlay:wt,draggableNodes:P,droppableContainers:G,droppableRects:F,over:wn,measureDroppableContainers:V,scrollableAncestors:Te,scrollableAncestorRects:He,measuringConfiguration:L,measuringScheduled:te,windowRect:xe}),[W,se,ne,B,or,ge,wt,P,G,F,wn,V,Te,He,L,te,xe]),So=C.useMemo(()=>({activatorEvent:B,activators:Es,active:W,activeNodeRect:ne,ariaDescribedById:{draggable:ee},dispatch:S,draggableNodes:P,over:wn,measureDroppableContainers:V}),[B,Es,W,ne,S,ee,P,wn,V]);return C.createElement(gv.Provider,{value:y},C.createElement(Co.Provider,{value:So},C.createElement(jv.Provider,{value:gi},C.createElement(Is.Provider,{value:ku},c)),C.createElement(iN,{disabled:(l==null?void 0:l.restoreFocus)===!1})),C.createElement(s$,X(U({},l),{hiddenTextDescribedById:ee})));function un(){const Ct=(N==null?void 0:N.autoScrollEnabled)===!1,_=typeof s=="object"?s.enabled===!1:s===!1,M=T&&!Ct&&!_;return typeof s=="object"?X(U({},s),{enabled:M}):{enabled:M}}}),lN=C.createContext(null),Uv="button",cN="Draggable";function uN(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=go(cN),{activators:a,activatorEvent:l,active:s,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=C.useContext(Co),{role:p=Uv,roleDescription:m="draggable",tabIndex:g=0}=i!=null?i:{},v=(s==null?void 0:s.id)===t,S=C.useContext(v?Is:lN),[w,y]=ps(),[x,b]=ps(),T=Q$(a,t),E=ho(n);ln(()=>(f.set(t,{id:t,key:o,node:w,activatorNode:x,data:E}),()=>{const O=f.get(t);O&&O.key===o&&f.delete(t)}),[f,t]);const P=C.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":v&&p===Uv?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,p,g,v,m,d.draggable]);return{active:s,activatorEvent:l,activeNodeRect:c,attributes:P,isDragging:v,listeners:r?void 0:T,node:w,over:h,setNodeRef:y,setActivatorNodeRef:b,transform:S}}function Hv(){return C.useContext(jv)}const dN="Droppable",fN={timeout:25};function hN(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=go(dN),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=C.useContext(Co),d=C.useRef({disabled:n}),f=C.useRef(!1),h=C.useRef(null),p=C.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}=U(U({},fN),i),S=ho(g!=null?g:r),w=C.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),p.current=null},v)},[v]),y=Cs({callback:w,disabled:m||!a}),x=C.useCallback((P,O)=>{y&&(O&&(y.unobserve(O),f.current=!1),P&&y.observe(P))},[y]),[b,T]=ps(x),E=ho(t);return C.useEffect(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),C.useEffect(()=>(l({type:mt.RegisterDroppable,element:{id:r,key:o,disabled:n,node:b,rect:h,data:E}}),()=>l({type:mt.UnregisterDroppable,key:o,id:r})),[r]),C.useEffect(()=>{n!==d.current.disabled&&(l({type:mt.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,l]),{active:a,rect:h,isOver:(s==null?void 0:s.id)===r,node:b,over:s,setNodeRef:T}}function pN(e){let{animation:t,children:n}=e;const[r,i]=C.useState(null),[o,a]=C.useState(null),l=gs(n);return!n&&!r&&l&&i(l),ln(()=>{if(!o)return;const s=r==null?void 0:r.key,c=r==null?void 0:r.props.id;if(s==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),C.createElement(C.Fragment,null,n,r?C.cloneElement(r,{ref:a}):null)}const gN={x:0,y:0,scaleX:1,scaleY:1};function mN(e){let{children:t}=e;return C.createElement(Co.Provider,{value:zv},C.createElement(Is.Provider,{value:gN},t))}const vN={position:"fixed",touchAction:"none"},bN=e=>ms(e)?"transform 250ms ease":void 0,yN=C.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:l,style:s,transform:c,transition:d=bN}=e;if(!l)return null;const f=i?c:X(U({},c),{scaleX:1,scaleY:1}),h=U(X(U({},vN),{width:l.width,height:l.height,top:l.top,left:l.left,transform:rr.Transform.toString(f),transformOrigin:i&&r?u$(r,l):void 0,transition:typeof d=="function"?d(r):d}),s);return C.createElement(n,{className:a,style:h,ref:t},o)}),Wv=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[l,s]of Object.entries(o.active))s!==void 0&&(i[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,s));if(o!=null&&o.dragOverlay)for(const[l,s]of Object.entries(o.dragOverlay))s!==void 0&&r.node.style.setProperty(l,s);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[s,c]of Object.entries(i))n.node.style.setProperty(s,c);a!=null&&a.active&&n.node.classList.remove(a.active)}},xN={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:rr.Transform.toString(t)},{transform:rr.Transform.toString(n)}]},sideEffects:Wv({styles:{active:{opacity:"0"}}})};function CN(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return hs((o,a)=>{if(t===null)return;const l=n.get(o);if(!l)return;const s=l.node.current;if(!s)return;const c=Fv(a);if(!c)return;const{transform:d}=Rt(a).getComputedStyle(a),f=xv(d);if(!f)return;const h=typeof t=="function"?t:wN(t);return _v(s,i.draggable.measure),h({active:{id:o,data:l.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function wN(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}=U(U({},xN),e);return o=>{let w=o,{active:a,dragOverlay:l,transform:s}=w,c=We(w,["active","dragOverlay","transform"]);if(!t)return;const d={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},f={scaleX:s.scaleX!==1?a.rect.width*s.scaleX/l.rect.width:1,scaleY:s.scaleY!==1?a.rect.height*s.scaleY/l.rect.height:1},h=U({x:s.x-d.x,y:s.y-d.y},f),p=i(X(U({},c),{active:a,dragOverlay:l,transform:{initial:s,final:h}})),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const v=r==null?void 0:r(U({active:a,dragOverlay:l},c)),S=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{S.onfinish=()=>{v==null||v(),y()}})}}let Gv=0;function IN(e){return C.useMemo(()=>{if(e!=null)return Gv++,Gv},[e])}const SN=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:l="div",className:s,zIndex:c=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:S,measuringConfiguration:w,scrollableAncestors:y,scrollableAncestorRects:x,windowRect:b}=Hv(),T=C.useContext(Is),E=IN(f==null?void 0:f.id),P=Vv(a,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:v.rect,over:S,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:x,transform:T,windowRect:b}),O=Tu(h),G=CN({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:w}),z=O?v.setRef:void 0;return C.createElement(mN,null,C.createElement(pN,{animation:G},f&&E?C.createElement(yN,{key:E,id:f.id,ref:z,as:l,activatorEvent:d,adjustScale:t,className:s,transition:o,rect:O,style:U({zIndex:c},i),transform:P},n):null))});function Eu(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function AN(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function Ss(e){return e!==null&&e>=0}function TN(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function EN(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Yv=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=Eu(t,r,n),a=t[i],l=o[i];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},Kv="Sortable",qv=C.createContext({activeIndex:-1,containerId:Kv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Yv,disabled:{draggable:!1,droppable:!1}});function _N(e){let{children:t,id:n,items:r,strategy:i=Yv,disabled:o=!1}=e;const{active:a,dragOverlay:l,droppableRects:s,over:c,measureDroppableContainers:d}=Hv(),f=go(Kv,n),h=l.rect!==null,p=C.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),m=a!=null,g=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,S=C.useRef(p),w=!TN(p,S.current),y=v!==-1&&g===-1||w,x=EN(o);ln(()=>{w&&m&&d(p)},[w,p,m,d]),C.useEffect(()=>{S.current=p},[p]);const b=C.useMemo(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:y,items:p,overIndex:v,useDragOverlay:h,sortedRects:AN(p,s),strategy:i}),[g,f,x.draggable,x.droppable,y,p,v,s,h,i]);return C.createElement(qv.Provider,{value:b},t)}const kN=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Eu(n,r,i).indexOf(t)},PN=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!c||!r||l!==o&&i===a?!1:n?!0:a!==i&&t===s},DN={duration:200,easing:"ease"},Qv="transform",ON=rr.Transition.toString({property:Qv,duration:0,easing:"linear"}),RN={roleDescription:"sortable"};function MN(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,a]=C.useState(null),l=C.useRef(n);return ln(()=>{if(!t&&n!==l.current&&r.current){const s=i.current;if(s){const c=hi(r.current,{ignoreTransform:!0}),d={x:s.left-c.left,y:s.top-c.top,scaleX:s.width/c.width,scaleY:s.height/c.height};(d.x||d.y)&&a(d)}}n!==l.current&&(l.current=n)},[t,n,r,i]),C.useEffect(()=>{o&&a(null)},[o]),o}function LN(e){let{animateLayoutChanges:t=PN,attributes:n,disabled:r,data:i,getNewIndex:o=kN,id:a,strategy:l,resizeObserverConfig:s,transition:c=DN}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:S,strategy:w}=C.useContext(qv),y=BN(r,p),x=d.indexOf(a),b=C.useMemo(()=>U({sortable:{containerId:f,index:x,items:d}},i),[f,i,x,d]),T=C.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:E,node:P,isOver:O,setNodeRef:G}=hN({id:a,data:b,disabled:y.droppable,resizeObserverConfig:U({updateMeasurementsFor:T},s)}),{active:z,activatorEvent:A,activeNodeRect:W,attributes:Y,setNodeRef:N,listeners:$,isDragging:B,over:H,setActivatorNodeRef:q,transform:ee}=uN({id:a,data:b,attributes:U(U({},RN),n),disabled:y.draggable}),R=KB(G,N),L=!!z,F=L&&!m&&Ss(h)&&Ss(v),V=!S&&B,te=V&&F?ee:null,se=l!=null?l:w,ae=F?te!=null?te:se({rects:g,activeNodeRect:W,activeIndex:h,overIndex:v,index:x}):null,J=Ss(h)&&Ss(v)?o({id:a,items:d,activeIndex:h,overIndex:v}):x,le=z==null?void 0:z.id,ne=C.useRef({activeId:le,items:d,newIndex:J,containerId:f}),ge=d!==ne.current.items,Se=t({active:z,containerId:f,isDragging:B,isSorting:L,id:a,index:x,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),Ue=MN({disabled:!Se,index:x,node:P,rect:E});return C.useEffect(()=>{L&&ne.current.newIndex!==J&&(ne.current.newIndex=J),f!==ne.current.containerId&&(ne.current.containerId=f),d!==ne.current.items&&(ne.current.items=d)},[L,J,f,d]),C.useEffect(()=>{if(le===ne.current.activeId)return;if(le!=null&&ne.current.activeId==null){ne.current.activeId=le;return}const at=setTimeout(()=>{ne.current.activeId=le},50);return()=>clearTimeout(at)},[le]),{active:z,activeIndex:h,attributes:Y,data:b,rect:E,index:x,newIndex:J,items:d,isOver:O,isSorting:L,isDragging:B,listeners:$,node:P,overIndex:v,over:H,setNodeRef:R,setActivatorNodeRef:q,setDroppableNodeRef:G,setDraggableNodeRef:N,transform:Ue!=null?Ue:ae,transition:wt()};function wt(){if(Ue||ge&&ne.current.newIndex===x)return ON;if(!(V&&!ms(A)||!c)&&(L||Se))return rr.Transition.toString(X(U({},c),{property:Qv}))}}function BN(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function As(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const $N=[_e.Down,_e.Right,_e.Up,_e.Left],NN=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:a,scrollableAncestors:l}}=t;if($N.includes(e.code)){if(e.preventDefault(),!n||!r)return;const s=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case _e.Down:r.top<h.top&&s.push(f);break;case _e.Up:r.top>h.top&&s.push(f);break;case _e.Left:r.left>h.left&&s.push(f);break;case _e.Right:r.left<h.left&&s.push(f);break}});const c=h$({active:n,collisionRect:r,droppableRects:i,droppableContainers:s,pointerCoordinates:null});let d=bv(c,"id");if(d===(a==null?void 0:a.id)&&c.length>1&&(d=c[1].id),d!=null){const f=o.get(n.id),h=o.get(d),p=h?i.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&f&&h){const v=ys(m).some((T,E)=>l[E]!==T),S=Jv(f,h),w=FN(f,h),y=v||!S?{x:0,y:0}:{x:w?r.width-p.width:0,y:w?r.height-p.height:0},x={x:p.left,y:p.top};return y.x&&y.y?x:mo(x,y)}}}};function Jv(e,t){return!As(e)||!As(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function FN(e,t){return!As(e)||!As(t)||!Jv(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const zN=Ve(u.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator"),Xv=C.createContext({attributes:{},listeners:void 0,ref(){}}),jN=()=>{const{attributes:e,listeners:t,ref:n}=C.useContext(Xv);return u.jsx(I.Button,X(U(U({sx:{backgroundColor:"transparent",color:"#919eab",width:"10px",":hover":{backgroundColor:"transparent"},":active":{backgroundColor:"transparent"}}},e),t),{ref:n,children:u.jsx(zN,{})}))},Zv=({children:e,id:t,tooltipTitle:n,removeItem:r,useDraggable:i=!0,variant:o="plain"})=>{const{attributes:a,isDragging:l,listeners:s,setNodeRef:c,setActivatorNodeRef:d,transform:f,transition:h}=LN({id:t}),p=C.useMemo(()=>({attributes:a,listeners:s,ref:d}),[a,s,d]),m={opacity:l?.6:void 0,transform:rr.Translate.toString(f),transition:h};return u.jsx(Xv.Provider,{value:p,children:u.jsx(I.ListItem,{variant:o,ref:c,style:m,startAction:i?u.jsx(jN,{}):u.jsx(u.Fragment,{}),endAction:i?u.jsx(I.Tooltip,{title:n,children:u.jsx(I.Button,{variant:"outlined",color:"danger",onClick:r,sx:{ml:"auto",p:.5},size:"sm",children:u.jsx(Le.Remove,{})})}):u.jsx(u.Fragment,{}),sx:{p:2,borderRadius:"sm"},children:e})})},VN={sideEffects:Wv({styles:{active:{opacity:"0.6"}}})},UN=({children:e})=>u.jsx(SN,{dropAnimation:VN,children:e}),HN=({entities:e=[],labels:t,setEntities:n,removeItem:r})=>{const[i,o]=C.useState(null),a=C.useMemo(()=>e.find(s=>s.id===(i==null?void 0:i.id)),[i,e]),l=l$(mv(wu),mv(xu,{coordinateGetter:NN}));return u.jsxs(sN,{sensors:l,onDragStart:({active:s})=>{o(s)},onDragEnd:({active:s,over:c})=>{if(c&&s.id!==(c==null?void 0:c.id)){const d=e.findIndex(({id:h})=>h===s.id),f=e.findIndex(({id:h})=>h===c.id);n(Eu(e,d,f))}o(null)},onDragCancel:()=>{o(null)},children:[u.jsx(_N,{items:e,children:u.jsx(I.List,{sx:{gap:"10px"},children:e.map(s=>u.jsxs(Zv,{id:s.id,variant:"outlined",removeItem:()=>r(s.id),tooltipTitle:t.removeEntity,children:[u.jsx(I.Typography,{ml:2,children:s.title||s.name}),s.type&&u.jsx(I.Chip,{color:eB(s.type),sx:{marginLeft:2},children:tB(s.type)})]},`sortable-item-${s.id}`))})}),u.jsx(UN,{children:a?u.jsx(u.Fragment,{children:e.map(s=>u.jsx(Zv,{id:s.id,useDraggable:!1,removeItem:()=>{},tooltipTitle:t.removeEntity},`sortable-overlay-item-${s.id}`))}):u.jsx(u.Fragment,{})})]})},WN=e=>u.jsxs(I.FormControl,{size:"sm",children:[u.jsx(I.FormLabel,{children:e.labels.itemsPerPage}),u.jsx(I.Select,{value:e.value,size:"sm",onChange:e.onChange,sx:{minHeight:"37px"},children:e.options.map((t,n)=>u.jsx(I.Option,{value:t,children:t},`items-per-page-${t}-${n}`))})]}),GN=(e,t)=>{const[n,r]=C.useState(null),{sdk:i}=pt(),o=()=>k(this,null,function*(){let a=[];if(!e){r(a);return}try{switch(e){case"top_x":a=(yield i.topX.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"match_quiz":a=(yield i.matchQuiz.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"template":a=(yield i.loyalty.getTemplates()).data.map(g=>({id:g.id,name:g.name,status:g.status,type:e,relationship:"relatedTo"}));break;case"classic_quiz":a=(yield i.miniGames.getClassicQuizzes({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"either_or":a=(yield i.miniGames.getEitherOrs({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"poll":a=(yield i.voting.getPolls({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"bracket":a=(yield i.bracketGame.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break;case"standing":a=(yield i.standingGame.getGames({limit:50})).data.map(g=>({id:g.id,name:g.title,status:g.status,type:e,relationship:"relatedTo"}));break}}catch(l){console.error(l),r(a),t();return}r(a)});return C.useEffect(()=>(o(),()=>r(null)),[e]),n},YN=({status:e})=>{let t="neutral";switch(e){case"DYNAMIC":t="primary";break;case"CUSTOM":t="success";break;case"OPEN":t="primary";break;case"LIVE":t="primary";break;case"CANCELED":t="warning";break;case"SETTLED":t="success";break;case"INACTIVE":t="danger";break;case"ACTIVE":t="success";break;case"EXPIRED":t="neutral";break}return u.jsx(I.Chip,{color:t,variant:"solid",size:"sm",children:e})},KN=Ve(u.jsx("path",{d:"M12.16 3h-.32L9.21 8.25h5.58zm4.3 5.25h5.16L19 3h-5.16zm4.92 1.5h-8.63V20.1zM11.25 20.1V9.75H2.62zM7.54 8.25 10.16 3H5L2.38 8.25z"}),"Diamond"),qN=Ve(u.jsx("path",{d:"m21.58 16.09-1.09-7.66C20.21 6.46 18.52 5 16.53 5H7.47C5.48 5 3.79 6.46 3.51 8.43l-1.09 7.66C2.2 17.63 3.39 19 4.94 19c.68 0 1.32-.27 1.8-.75L9 16h6l2.25 2.25c.48.48 1.13.75 1.8.75 1.56 0 2.75-1.37 2.53-2.91M11 11H9v2H8v-2H6v-1h2V8h1v2h2zm4-1c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m2 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"}),"SportsEsports"),QN=Ve(u.jsx("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}),"QuestionMark"),JN=Ve(u.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows"),XN=Ve(u.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M9 17H7v-7h2zm4 0h-2V7h2zm4 0h-2v-4h2z"}),"Poll"),ZN=e=>{switch(e.entityType){case"top_x":return u.jsx(I.Tooltip,{title:"Top X",children:u.jsx(KN,{})});case"match_quiz":return u.jsx(I.Tooltip,{title:"Match Quiz",children:u.jsx(qN,{})});case"template":return u.jsx(I.Tooltip,{title:"Leaderboard Templates",children:u.jsx(Le.EmojiEvents,{})});case"classic_quiz":return u.jsx(I.Tooltip,{title:"Classic Quiz",children:u.jsx(QN,{})});case"either_or":return u.jsx(I.Tooltip,{title:"Either/Or",children:u.jsx(JN,{})});case"poll":return u.jsx(I.Tooltip,{title:"Poll",children:u.jsx(XN,{})});case"bracket":return u.jsx(I.Tooltip,{title:"Custom Bracket Game",children:u.jsx(Le.EmojiEvents,{})});case"standing":return u.jsx(I.Tooltip,{title:"Custom Standings Game",children:u.jsx(Le.EmojiEvents,{})});default:return null}},eF=({entity:e,deleteLabel:t,onDelete:n})=>u.jsx(u.Fragment,{children:u.jsx(I.Card,{sx:{p:2,mb:2},children:u.jsx(I.CardContent,{children:u.jsxs(I.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",justifyContent:"space-between"},children:[u.jsx(I.Typography,{fontSize:"sm",startDecorator:u.jsx(ZN,{entityType:e.type}),children:e.name}),u.jsx(I.Box,{display:{xs:"none",md:"block"},children:u.jsx(YN,{status:e.status})}),u.jsx(I.Box,{children:u.jsx(I.Tooltip,{title:t,children:u.jsx(I.IconButton,{onClick:()=>n(e.id,e.relationship),color:"danger",size:"sm",children:u.jsx(Le.Delete,{})})})})]})})})}),tF=(e,t,n,r)=>k(this,null,function*(){let o=[];const a=new Map;t.forEach(l=>{if(a.has(l.entity_type)){const s=a.get(l.entity_type);a.set(l.entity_type,[...s,[l.entity_id,l.entity_relationship]])}else a.set(l.entity_type,[[l.entity_id,l.entity_relationship]])});try{for(const[l,s]of a)switch(l){case"top_x":const c=s.map(([O])=>O),d=yield e.topX.getGames({limit:c.length,gameIds:c},!0);o=[...o,...d.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"match_quiz":const f=s.map(([O])=>O),h=yield e.matchQuiz.getGames({limit:f.length,gameIds:f},!0);o=[...o,...h.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"template":const p=s.map(([O])=>O),m=yield e.loyalty.getTemplates(void 0,!0);o=[...o,...m.data.filter(O=>p.includes(O.id)).map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"classic_quiz":const g=s.map(([O])=>O),v=yield e.miniGames.getClassicQuizzes({limit:g.length,classicQuizIds:g},!1,!0);o=[...o,...v.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"either_or":const S=s.map(([O])=>O),w=yield e.miniGames.getEitherOrs({limit:S.length,eitherOrIds:S},!1,!0);o=[...o,...w.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"poll":const y=s.map(([O])=>O),x=yield e.voting.getPolls({limit:y.length,pollIds:y},!0);o=[...o,...x.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"bracket":const b=s.map(([O])=>O),T=yield e.bracketGame.getGames({limit:b.length,gameIds:b},!0);o=[...o,...T.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;case"standing":const E=s.map(([O])=>O),P=yield e.standingGame.getGames({limit:E.length,gameIds:E},!0);o=[...o,...P.data.map(O=>{var z;const G=((z=s.find(([A])=>A===O.id))==null?void 0:z[1])||"relatedTo";return{id:O.id,name:O.title,status:O.status,type:l,relationship:G}})];break;default:}}catch(l){console.error("Error loading related entities",l),n(o),r()}n(o)}),nF=["top_x","match_quiz","template","classic_quiz","poll","either_or","bracket","standing"],rF=["relatedTo","blocks","blockedBy","bonusPointsGame","nextInSeries","previousInSeries"],iF=new Map().set("template","Leaderboard Templates").set("classic_quiz","Classic Quiz").set("either_or","Either/Or").set("match_quiz","Match Quiz").set("top_x","Top X").set("bracket","Custom Bracket Game").set("standing","Custom Standing Game").set("poll","Poll"),eb=new Map().set("relatedTo","Related to").set("blocks","Blocks").set("blockedBy","Blocked by").set("nextInSeries","Next in series").set("previousInSeries","Previous in series").set("bonusPointsGame","Bonus points game"),oF={Login:NR,InformationInput:eo,RichText:ic,HeaderButtons:hP,MarketSelection:ZR,Accordion:eT,DynamicFields:PP,BasicSelect:nT,BooleanSwitch:wL,Branding:fP,ProfileSearchSelect:xL,RangeCalendar:_P,CompetitionSearchSelect:bL,Related:rM,Images:pR,Duration:EP,DatePickerComponent:to,Flags:uR,Spinner:us,Tags:km,Toast:ut,AdContent:tT,Match:eM,Winners:cB,CompetitionsSearchSelect:yL,TeamsSearchSelect:CL,CustomSelect:yM,Schedule:fM,NoPermissionCard:kP,CustomFlatpickrCalendar:Vc,ContextSelectFilter:dB,NumberInput:$B,EntityContext:HB,MiniGamesImages:GB,AuthRequirement:YB,SortableList:HN,ItemsPerPageFilter:WN,ImageCard:so,RelatedRelationship:({defaultValue:e=[],onChange:t,labels:n})=>{const[r,i]=C.useState([]),[o,a]=C.useState(""),[l,s]=C.useState(null),[c,d]=C.useState("relatedTo"),[f,h]=C.useState(!1),p=()=>h(!f),m=GN(l,p),{sdk:g}=pt();C.useEffect(()=>(e.length>0&&tF(g,e,i,p),()=>{i([]),a(""),s(null),d("relatedTo")}),[]);const v=()=>{if(e.some(E=>E.entity_id===o&&E.entity_relationship===c)){a("");return}const b=[...e,{entity_id:o,entity_type:l,entity_relationship:c}],T=(m==null?void 0:m.filter(E=>E.id===o).map(E=>({id:E.id,name:E.name,type:l,status:E.status,relationship:c})))||[];i([...r,...T]),t(b),a("")},S=(x,b)=>{const T=e.filter(P=>!(P.entity_id===x&&P.entity_relationship===b)),E=r.filter(P=>!(P.id===x&&P.relationship===b));i(E),t(T)},w=r.reduce((x,b)=>{const T=b.relationship;return x[T]||(x[T]=[]),x[T].push(b),x},{}),y=Object.keys(w).sort();return u.jsxs(u.Fragment,{children:[y.map(x=>u.jsxs(I.Box,{sx:{mb:2},children:[u.jsx(I.Typography,{level:"title-md",sx:{fontWeight:"bold",mb:1},children:u.jsx(I.Chip,{variant:"outlined",size:"md",sx:{bgcolor:"background.surface"},children:eb.get(x)||"Unknown relationship"})}),w[x].map((b,T)=>u.jsx(eF,{entity:b,deleteLabel:n.delete,onDelete:S},`related-entity-relationship-${b.id}-${T}`))]},`relationship-group-${x}`)),u.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",width:"100%",gap:1},children:[u.jsxs(I.FormControl,{children:[u.jsx(I.FormLabel,{required:!0,color:"primary",children:n.type}),u.jsx(I.Select,{value:l,size:"sm",name:"entity_type",onChange:(x,b)=>s(b),sx:{minHeight:"37px"},children:nF.map(x=>u.jsx(I.Option,{value:x,children:iF.get(x)},`entity-type-option-${x}`))})]}),u.jsxs(I.FormControl,{children:[u.jsx(I.FormLabel,{required:!0,color:"primary",children:n.relationship}),u.jsx(I.Select,{value:c,size:"sm",name:"entity_relationship",onChange:(x,b)=>d(b),sx:{minHeight:"37px"},children:rF.map(x=>u.jsx(I.Option,{value:x,children:eb.get(x)},`entity-relationship-option-${x}`))})]}),u.jsxs(I.FormControl,{children:[u.jsx(I.FormLabel,{required:!0,color:"primary",children:n.entity}),u.jsx(I.Select,{value:o,size:"sm",name:"entity_id",onChange:(x,b)=>a(b),sx:{width:"100%",mr:{xs:0,md:1},mb:{xs:1,md:0},minHeight:"37px"},endDecorator:!m&&u.jsx(I.CircularProgress,{size:"sm"}),children:m&&m.map(x=>u.jsx(I.Option,{value:x.id,children:x.name},`entity--${x.id}`))})]}),u.jsx(I.Button,{startDecorator:u.jsx(Le.Add,{}),disabled:!o||!l,onClick:v,sx:{mb:1},children:n.add})]}),u.jsx(ut,{showToast:f,message:n.relatedEntitiesErrorMessage,color:"danger",hideToast:p})]})},ExportUsersLeads:e=>{const[t,n]=C.useState(!1),[r,i]=C.useState(!1),[o,a]=C.useState("success"),[l,s]=C.useState(""),c=C.useContext(Xo),d=(h,p)=>{a(h),s(p),i(!0)},f=()=>k(this,null,function*(){n(!0);const h=yield c==null?void 0:c.https.exportLeadsPerEntity(e.entityId);if(h!=null&&h.ok){const p=yield h.blob(),m=URL.createObjectURL(p),g=document.createElement("a");g.href=m,g.download=`${e.entityType}_${e.entityName}_exported_users_leads.csv`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(m),n(!1),d("success",e.labels.usersLeadsExportMessage)}else console.error("Failed to export all users leads: ",yield h==null?void 0:h.json()),n(!1),d("danger",e.labels.usersLeadsExportErrorMessage)});return u.jsxs(u.Fragment,{children:[u.jsxs(I.Box,{mb:2,children:[u.jsx(I.Box,{display:"flex",alignItems:"center",mb:1,children:u.jsx(I.Typography,{level:"body-lg",sx:{mx:"auto"},children:e.labels.exportUsersLeads})}),u.jsx(I.Sheet,{sx:{overflowX:"auto",minWidth:"700px"},children:u.jsxs(I.Table,{variant:"outlined",hoverRow:!1,borderAxis:"bothBetween",size:"sm",sx:{backgroundColor:"#fff","& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left",width:"50%"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:e.labels.category}),u.jsx("th",{children:e.labels.action})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsxs("td",{children:[u.jsx(I.Typography,{level:"body-sm",fontWeight:"600",children:e.labels.exportAllUsersLeads}),u.jsx(I.Typography,{level:"body-xs",color:"neutral",children:e.labels.exportAllUsersLeadsDescription})]}),u.jsx("td",{children:u.jsx(I.Button,{loading:t,onClick:f,children:e.labels.exportAllUsersLeads})})]})})]})})]}),u.jsx(ut,{showToast:r,color:o,message:l,hideToast:()=>i(!1)})]})},SignOutButton:ng},tb=C.createContext(null),aF=({children:e})=>u.jsx(tb.Provider,{value:oF,children:e}),sF=()=>{const e=C.useContext(tb);if(!e)throw new Error("useComponentContext must be used within a ComponentProvider");return e},nb=425,rb=1024;return{APIProvider:hI,AuthProvider:pI,AuthContext:Bf,ComponentProvider:aF,useComponentContext:sF,useAPIContext:pt,useIsMobile:()=>{const[e,t]=C.useState(window.innerWidth<=rb),[n,r]=C.useState(window.innerWidth<=nb);return C.useLayoutEffect(()=>{const i=()=>{t(window.innerWidth<=rb),r(window.innerWidth<=nb)};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),{isMobile:e,isPhone:n}}}});
|