@riddix/hamh 2.1.0-alpha.423 → 4.1.0-testing.21

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.
@@ -496,4 +496,4 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
496
496
  To pick up a draggable item, press the space bar.
497
497
  While dragging, use the arrow keys to move the item.
498
498
  Press space again to drop the item in its new position, or press escape to cancel.
499
- `},Wat={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 qat(e){let{announcements:t=Wat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Vat}=e;const{announce:o,announcement:s}=zat(),a=lv("DndLiveRegion"),[l,c]=_.useState(!1);if(_.useEffect(()=>{c(!0)},[]),Hat(_.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=qt.createElement(qt.Fragment,null,qt.createElement(Fat,{id:r,value:i.draggable}),qt.createElement(Bat,{id:a,announcement:s}));return n?Dd.createPortal(u,n):u}var Li;(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"})(Li||(Li={}));function kS(){}function AK(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Gat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const sl=Object.freeze({x:0,y:0});function Cle(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ele(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Kat(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function kK(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 Ale(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function _K(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Yat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=_K(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=Cle(_K(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(Ele)},Xat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=kK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=kK(l),u=i.reduce((h,g,y)=>h+Cle(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(Ele)};function Zat(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),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const Jat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=Zat(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Kat)};function Qat(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function kle(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:sl}function elt(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((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const tlt=elt(1);function nlt(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 rlt(e,t,n){const r=nlt(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const ilt={ignoreTransform:!1};function gg(e,t){t===void 0&&(t=ilt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=fs(e).getComputedStyle(e);c&&(n=rlt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function DK(e){return gg(e,{ignoreTransform:!0})}function olt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function slt(e,t){return t===void 0&&(t=fs(e).getComputedStyle(e)),t.position==="fixed"}function alt(e,t){t===void 0&&(t=fs(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 YC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(xI(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!sv(i)||xle(i)||n.includes(i))return n;const o=fs(e).getComputedStyle(i);return i!==e&&alt(i,o)&&n.push(i),slt(i,o)?n:r(i.parentNode)}return e?r(e):n}function _le(e){const[t]=YC(e,1);return t??null}function QA(e){return!KC||!e?null:pg(e)?e:vI(e)?xI(e)||e===mg(e).scrollingElement?window:sv(e)?e:null:null}function Dle(e){return pg(e)?e.scrollX:e.scrollLeft}function Ole(e){return pg(e)?e.scrollY:e.scrollTop}function tO(e){return{x:Dle(e),y:Ole(e)}}var Xi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xi||(Xi={}));function Tle(e){return!KC||!e?!1:e===document.scrollingElement}function Mle(e){const t={x:0,y:0},n=Tle(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,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const llt={x:.2,y:.2};function clt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=llt);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=Mle(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=Xi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=Xi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&a>=t.right-b.width?(g.x=Xi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Xi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function ult(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}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 Rle(e){return e.reduce((t,n)=>nm(t,tO(n)),sl)}function dlt(e){return e.reduce((t,n)=>t+Dle(n),0)}function flt(e){return e.reduce((t,n)=>t+Ole(n),0)}function hlt(e,t){if(t===void 0&&(t=gg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);_le(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const plt=[["x",["left","right"],dlt],["y",["top","bottom"],flt]];class CI{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=YC(n),i=Rle(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of plt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $y{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 mlt(e){const{EventTarget:t}=fs(e);return e instanceof t?e:mg(e)}function ek(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+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 ta;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ta||(ta={}));function OK(e){e.preventDefault()}function glt(e){e.stopPropagation()}var Ln;(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"})(Ln||(Ln={}));const Ile={start:[Ln.Space,Ln.Enter],cancel:[Ln.Esc],end:[Ln.Space,Ln.Enter,Ln.Tab]},ylt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ln.Right:return{...n,x:n.x+25};case Ln.Left:return{...n,x:n.x-25};case Ln.Down:return{...n,y:n.y+25};case Ln.Up:return{...n,y:n.y-25}}};class EI{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 $y(mg(n)),this.windowListeners=new $y(fs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ta.Resize,this.handleCancel),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ta.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&hlt(r),n(sl)}handleKeyDown(t){if(wI(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Ile,coordinateGetter:s=ylt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:sl;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=ob(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:A,maxScroll:E,minScroll:O}=Mle(b),D=ult(b),T={x:Math.min(v===Ln.Right?D.right-D.width/2:D.right,Math.max(v===Ln.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(v===Ln.Down?D.bottom-D.height/2:D.bottom,Math.max(v===Ln.Down?D.top:D.top+D.height/2,f.y))},I=v===Ln.Right&&!C||v===Ln.Left&&!w,F=v===Ln.Down&&!A||v===Ln.Up&&!S;if(I&&T.x!==f.x){const L=b.scrollLeft+h.x,R=v===Ln.Right&&L<=E.x||v===Ln.Left&&L>=O.x;if(R&&!h.y){b.scrollTo({left:L,behavior:a});return}R?g.x=b.scrollLeft-L:g.x=v===Ln.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(F&&T.y!==f.y){const L=b.scrollTop+h.y,R=v===Ln.Down&&L<=E.y||v===Ln.Up&&L>=O.y;if(R&&!h.x){b.scrollTo({top:L,behavior:a});return}R?g.y=b.scrollTop-L:g.y=v===Ln.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,nm(ob(f,this.referenceCoordinates),g))}}}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()}}EI.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ile,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function TK(e){return!!(e&&"distance"in e)}function MK(e){return!!(e&&"delay"in e)}class AI{constructor(t,n,r){var i;r===void 0&&(r=mlt(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:s}=o;this.props=t,this.events=n,this.document=mg(s),this.documentListeners=new $y(this.document),this.listeners=new $y(r),this.windowListeners=new $y(fs(s)),this.initialCoordinates=(i=eO(o))!=null?i:sl,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(ta.Resize,this.handleCancel),this.windowListeners.add(ta.DragStart,OK),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),this.windowListeners.add(ta.ContextMenu,OK),this.documentListeners.add(ta.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(MK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(TK(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(ta.Click,glt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ta.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=eO(t))!=null?n:sl,c=ob(i,l);if(!r&&a){if(TK(a)){if(a.tolerance!=null&&ek(c,a.tolerance))return this.handleCancel();if(ek(c,a.distance))return this.handleStart()}if(MK(a)&&ek(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}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===Ln.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const blt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kI extends AI{constructor(t){const{event:n}=t,r=mg(n.target);super(t,blt,r)}}kI.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const vlt={move:{name:"mousemove"},end:{name:"mouseup"}};var nO;(function(e){e[e.RightClick=2]="RightClick"})(nO||(nO={}));class xlt extends AI{constructor(t){super(t,vlt,mg(t.event.target))}}xlt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===nO.RightClick?!1:(r?.({event:n}),!0)}}];const tk={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Slt extends AI{constructor(t){super(t,tk)}static setup(){return window.addEventListener(tk.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(tk.move.name,t)};function t(){}}}Slt.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Ly;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ly||(Ly={}));var _S;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(_S||(_S={}));function wlt(e){let{acceleration:t,activator:n=Ly.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=_S.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=Elt({delta:f,disabled:!o}),[y,b]=Pat(),v=_.useRef({x:0,y:0}),S=_.useRef({x:0,y:0}),C=_.useMemo(()=>{switch(n){case Ly.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ly.DraggableRect:return i}},[n,i,l]),w=_.useRef(null),A=_.useCallback(()=>{const O=w.current;if(!O)return;const D=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(D,T)},[]),E=_.useMemo(()=>a===_S.TreeOrder?[...c].reverse():c,[a,c]);_.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const D=c.indexOf(O),T=u[D];if(!T)continue;const{direction:I,speed:F}=clt(O,T,C,t,h);for(const L of["x","y"])g[L][I[L]]||(F[L]=0,I[L]=0);if(F.x>0||F.y>0){b(),w.current=O,y(A,s),v.current=F,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,A,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(h)])}const Clt={x:{[Xi.Backward]:!1,[Xi.Forward]:!1},y:{[Xi.Backward]:!1,[Xi.Forward]:!1}};function Elt(e){let{delta:t,disabled:n}=e;const r=QD(t);return av(i=>{if(n||!r||!i)return Clt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xi.Backward]:i.x[Xi.Backward]||o.x===-1,[Xi.Forward]:i.x[Xi.Forward]||o.x===1},y:{[Xi.Backward]:i.y[Xi.Backward]||o.y===-1,[Xi.Forward]:i.y[Xi.Forward]||o.y===1}}},[n,t,r])}function Alt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return av(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function klt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var ab;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ab||(ab={}));var rO;(function(e){e.Optimized="optimized"})(rO||(rO={}));const RK=new Map;function _lt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=_.useState(null),{frequency:a,measure:l,strategy:c}=i,u=_.useRef(e),f=v(),h=ib(f),g=_.useCallback(function(S){S===void 0&&(S=[]),!h.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[h]),y=_.useRef(null),b=av(S=>{if(f&&!n)return RK;if(!S||S===RK||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const A=w.node.current,E=A?new CI(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return _.useEffect(()=>{u.current=e},[e]),_.useEffect(()=>{f||g()},[n,f]),_.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),_.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case ab.Always:return!1;case ab.BeforeDragging:return n;default:return!n}}}function Ple(e,t){return av(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Dlt(e,t){return Ple(e,t)}function Olt(e){let{callback:t,disabled:n}=e;const r=SI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function XC(e){let{callback:t,disabled:n}=e;const r=SI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function Tlt(e){return new CI(gg(e),e)}function IK(e,t,n){t===void 0&&(t=Tlt);const[r,i]=_.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Olt({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=XC({callback:o});return bc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Mlt(e){const t=Ple(e);return kle(e,t)}const PK=[];function Rlt(e){const t=_.useRef(e),n=av(r=>e?r&&r!==PK&&e&&t.current&&e.parentNode===t.current.parentNode?r:YC(e):PK,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function Ilt(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(o=>{const s=QA(o.target);s&&n(a=>a?(a.set(s,tO(s)),new Map(a)):null)},[]);return _.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=QA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,tO(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=QA(l);c?.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>nm(o,s),sl):Rle(e):sl,[e,t])}function jK(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==sl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ob(e,n.current):sl}function Plt(e){_.useEffect(()=>{if(!KC)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?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function jlt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function jle(e){return _.useMemo(()=>e?olt(e):null,[e])}const $K=[];function $lt(e,t){t===void 0&&(t=gg);const[n]=e,r=jle(n?fs(n):null),[i,o]=_.useState($K);function s(){o(()=>e.length?e.map(l=>Tle(l)?r:new CI(t(l),l)):$K)}const a=XC({callback:s});return bc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Llt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return sv(t)?t:e}function Nlt(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(c=>{for(const{target:u}of c)if(sv(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=XC({callback:i}),s=_.useCallback(c=>{const u=Llt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=AS(s);return _.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Flt=[{sensor:kI,options:{}},{sensor:EI,options:{}}],Blt={current:{}},_4={draggable:{measure:DK},droppable:{measure:DK,strategy:ab.WhileDragging,frequency:rO.Optimized},dragOverlay:{measure:gg}};class Ny 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 zlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ny,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:_4,measureDroppableContainers:kS,windowRect:null,measuringScheduled:!1},Hlt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kS,draggableNodes:new Map,over:null,measureDroppableContainers:kS},ZC=_.createContext(Hlt),$le=_.createContext(zlt);function Ult(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ny}}}function Vlt(e,t){switch(t.type){case Li.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Li.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Li.DragEnd:case Li.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Li.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Ny(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Li.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Ny(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Li.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Ny(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Wlt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(ZC),o=QD(r),s=QD(n?.id);return _.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!wI(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Lat(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function qlt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Glt(e){return _.useMemo(()=>({draggable:{..._4.draggable,...e?.draggable},droppable:{..._4.droppable,...e?.droppable},dragOverlay:{..._4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Klt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=_.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;bc(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=kle(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=_le(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const Lle=_.createContext({...sl,scaleX:1,scaleY:1});var xd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xd||(xd={}));const Ylt=_.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Flt,collisionDetection:f=Jat,measuring:h,modifiers:g,...y}=t;const b=_.useReducer(Vlt,void 0,Ult),[v,S]=b,[C,w]=Uat(),[A,E]=_.useState(xd.Uninitialized),O=A===xd.Initialized,{draggable:{active:D,nodes:T,translate:I},droppable:{containers:F}}=v,L=D!=null?T.get(D):null,R=_.useRef({initial:null,translated:null}),$=_.useMemo(()=>{var Dt;return D!=null?{id:D,data:(Dt=L?.data)!=null?Dt:Blt,rect:R}:null},[D,L]),j=_.useRef(null),[z,N]=_.useState(null),[W,H]=_.useState(null),U=ib(y,Object.values(y)),K=lv("DndDescribedBy",s),B=_.useMemo(()=>F.getEnabled(),[F]),q=Glt(h),{droppableRects:X,measureDroppableContainers:V,measuringScheduled:Y}=_lt(B,{dragging:O,dependencies:[I.x,I.y],config:q.droppable}),J=Alt(T,D),ne=_.useMemo(()=>W?eO(W):null,[W]),ee=yr(),se=Dlt(J,q.draggable.measure);Klt({activeNode:D!=null?T.get(D):null,config:ee.layoutShiftCompensation,initialRect:se,measure:q.draggable.measure});const ue=IK(J,q.draggable.measure,se),te=IK(J?J.parentElement:null),Z=_.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=F.getNodeFor((n=Z.current.over)==null?void 0:n.id),oe=Nlt({measure:q.dragOverlay.measure}),de=(r=oe.nodeRef.current)!=null?r:J,be=O?(i=oe.rect)!=null?i:ue:null,je=!!(oe.nodeRef.current&&oe.rect),De=Mlt(je?null:ue),Ke=jle(de?fs(de):null),xe=Rlt(O?re??J:null),Le=$lt(xe),Te=qlt(g,{transform:{x:I.x-De.x,y:I.y-De.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:ue,containerNodeRect:te,draggingNodeRect:be,over:Z.current.over,overlayNodeRect:oe.rect,scrollableAncestors:xe,scrollableAncestorRects:Le,windowRect:Ke}),ht=ne?nm(ne,I):null,mt=Ilt(xe),ze=jK(mt),Ie=jK(mt,[ue]),He=nm(Te,ze),Je=be?tlt(be,Te):null,rt=$&&Je?f({active:$,collisionRect:Je,droppableRects:X,droppableContainers:B,pointerCoordinates:ht}):null,st=Ale(rt,"id"),[Xe,Lt]=_.useState(null),Nt=je?Te:nm(Te,Ie),Ot=Qat(Nt,(o=Xe?.rect)!=null?o:null,ue),Xn=_.useRef(null),rn=_.useCallback((Dt,Pt)=>{let{sensor:Jt,options:jn}=Pt;if(j.current==null)return;const on=T.get(j.current);if(!on)return;const St=Dt.nativeEvent,mn=new Jt({active:j.current,activeNode:on,event:St,options:jn,context:Z,onAbort(br){if(!T.get(br))return;const{onDragAbort:ce}=U.current,pe={id:br};ce?.(pe),C({type:"onDragAbort",event:pe})},onPending(br,ei,ce,pe){if(!T.get(br))return;const{onDragPending:Fe}=U.current,Ue={id:br,constraint:ei,initialCoordinates:ce,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(br){const ei=j.current;if(ei==null)return;const ce=T.get(ei);if(!ce)return;const{onDragStart:pe}=U.current,Se={activatorEvent:St,active:{id:ei,data:ce.data,rect:R}};Dd.unstable_batchedUpdates(()=>{pe?.(Se),E(xd.Initializing),S({type:Li.DragStart,initialCoordinates:br,active:ei}),C({type:"onDragStart",event:Se}),N(Xn.current),H(St)})},onMove(br){S({type:Li.DragMove,coordinates:br})},onEnd:Qr(Li.DragEnd),onCancel:Qr(Li.DragCancel)});Xn.current=mn;function Qr(br){return async function(){const{active:ce,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=Z.current;let Ue=null;if(ce&&Fe){const{cancelDrop:yt}=U.current;Ue={activatorEvent:St,active:ce,collisions:pe,delta:Fe,over:Se},br===Li.DragEnd&&typeof yt=="function"&&await Promise.resolve(yt(Ue))&&(br=Li.DragCancel)}j.current=null,Dd.unstable_batchedUpdates(()=>{S({type:br}),E(xd.Uninitialized),Lt(null),N(null),H(null),Xn.current=null;const yt=br===Li.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const it=U.current[yt];it?.(Ue),C({type:yt,event:Ue})}})}}},[T]),lt=_.useCallback((Dt,Pt)=>(Jt,jn)=>{const on=Jt.nativeEvent,St=T.get(jn);if(j.current!==null||!St||on.dndKit||on.defaultPrevented)return;const mn={active:St};Dt(Jt,Pt.options,mn)===!0&&(on.dndKit={capturedBy:Pt.sensor},j.current=jn,rn(Jt,Pt))},[T,rn]),Ht=klt(u,lt);Plt(u),bc(()=>{ue&&A===xd.Initializing&&E(xd.Initialized)},[ue,A]),_.useEffect(()=>{const{onDragMove:Dt}=U.current,{active:Pt,activatorEvent:Jt,collisions:jn,over:on}=Z.current;if(!Pt||!Jt)return;const St={active:Pt,activatorEvent:Jt,collisions:jn,delta:{x:He.x,y:He.y},over:on};Dd.unstable_batchedUpdates(()=>{Dt?.(St),C({type:"onDragMove",event:St})})},[He.x,He.y]),_.useEffect(()=>{const{active:Dt,activatorEvent:Pt,collisions:Jt,droppableContainers:jn,scrollAdjustedTranslate:on}=Z.current;if(!Dt||j.current==null||!Pt||!on)return;const{onDragOver:St}=U.current,mn=jn.get(st),Qr=mn&&mn.rect.current?{id:mn.id,rect:mn.rect.current,data:mn.data,disabled:mn.disabled}:null,br={active:Dt,activatorEvent:Pt,collisions:Jt,delta:{x:on.x,y:on.y},over:Qr};Dd.unstable_batchedUpdates(()=>{Lt(Qr),St?.(br),C({type:"onDragOver",event:br})})},[st]),bc(()=>{Z.current={activatorEvent:W,active:$,activeNode:J,collisionRect:Je,collisions:rt,droppableRects:X,draggableNodes:T,draggingNode:de,draggingNodeRect:be,droppableContainers:F,over:Xe,scrollableAncestors:xe,scrollAdjustedTranslate:He},R.current={initial:be,translated:Je}},[$,J,rt,Je,T,de,be,X,F,Xe,xe,He]),wlt({...ee,delta:I,draggingRect:Je,pointerCoordinates:ht,scrollableAncestors:xe,scrollableAncestorRects:Le});const Dn=_.useMemo(()=>({active:$,activeNode:J,activeNodeRect:ue,activatorEvent:W,collisions:rt,containerNodeRect:te,dragOverlay:oe,draggableNodes:T,droppableContainers:F,droppableRects:X,over:Xe,measureDroppableContainers:V,scrollableAncestors:xe,scrollableAncestorRects:Le,measuringConfiguration:q,measuringScheduled:Y,windowRect:Ke}),[$,J,ue,W,rt,te,oe,T,F,X,Xe,V,xe,Le,q,Y,Ke]),Gn=_.useMemo(()=>({activatorEvent:W,activators:Ht,active:$,activeNodeRect:ue,ariaDescribedById:{draggable:K},dispatch:S,draggableNodes:T,over:Xe,measureDroppableContainers:V}),[W,Ht,$,ue,S,K,T,Xe,V]);return qt.createElement(wle.Provider,{value:w},qt.createElement(ZC.Provider,{value:Gn},qt.createElement($le.Provider,{value:Dn},qt.createElement(Lle.Provider,{value:Ot},c)),qt.createElement(Wlt,{disabled:a?.restoreFocus===!1})),qt.createElement(qat,{...a,hiddenTextDescribedById:K}));function yr(){const Dt=z?.autoScrollEnabled===!1,Pt=typeof l=="object"?l.enabled===!1:l===!1,Jt=O&&!Dt&&!Pt;return typeof l=="object"?{...l,enabled:Jt}:{enabled:Jt}}}),Xlt=_.createContext(null),LK="button",Zlt="Draggable";function Jlt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=lv(Zlt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=_.useContext(ZC),{role:g=LK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=_.useContext(v?Lle:Xlt),[C,w]=AS(),[A,E]=AS(),O=jlt(s,t),D=ib(n);bc(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:D}),()=>{const I=f.get(t);I&&I.key===o&&f.delete(t)}),[f,t]);const T=_.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===LK?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:h,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Qlt(){return _.useContext($le)}const ect="Droppable",tct={timeout:25};function nct(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=lv(ect),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=_.useContext(ZC),u=_.useRef({disabled:n}),f=_.useRef(!1),h=_.useRef(null),g=_.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...tct,...i},S=ib(b??r),C=_.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=XC({callback:C,disabled:y||!s}),A=_.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),f.current=!1),T&&w.observe(T))},[w]),[E,O]=AS(A),D=ib(t);return _.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),_.useEffect(()=>(a({type:Li.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:h,data:D}}),()=>a({type:Li.UnregisterDroppable,key:o,id:r})),[r]),_.useEffect(()=>{n!==u.current.disabled&&(a({type:Li.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function _I(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function rct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function k5(e){return e!==null&&e>=0}function ict(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 oct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Nle=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=_I(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},_5={scaleX:1,scaleY:1},sct=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,..._5}:null}const l=act(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,..._5}:i<n&&i>=s?{x:0,y:a.height+l,..._5}:{x:0,y:0,..._5}};function act(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const Fle="Sortable",Ble=qt.createContext({activeIndex:-1,containerId:Fle,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Nle,disabled:{draggable:!1,droppable:!1}});function lct(e){let{children:t,id:n,items:r,strategy:i=Nle,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Qlt(),f=lv(Fle,n),h=a.rect!==null,g=_.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=_.useRef(g),C=!ict(g,S.current),w=v!==-1&&b===-1||C,A=oct(o);bc(()=>{C&&y&&u(g)},[C,g,y,u]),_.useEffect(()=>{S.current=g},[g]);const E=_.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:h,sortedRects:rct(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,h,i]);return qt.createElement(Ble.Provider,{value:E},t)}const cct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return _I(n,r,i).indexOf(t)},uct=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},dct={duration:200,easing:"ease"},zle="transform",fct=sb.Transition.toString({property:zle,duration:0,easing:"linear"}),hct={roleDescription:"sortable"};function pct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=_.useState(null),a=_.useRef(n);return bc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=gg(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),_.useEffect(()=>{o&&s(null)},[o]),o}function mct(e){let{animateLayoutChanges:t=uct,attributes:n,disabled:r,data:i,getNewIndex:o=cct,id:s,strategy:a,resizeObserverConfig:l,transition:c=dct}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=_.useContext(Ble),w=gct(r,g),A=u.indexOf(s),E=_.useMemo(()=>({sortable:{containerId:f,index:A,items:u},...i}),[f,i,A,u]),O=_.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:D,node:T,isOver:I,setNodeRef:F}=nct({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:L,activatorEvent:R,activeNodeRect:$,attributes:j,setNodeRef:z,listeners:N,isDragging:W,over:H,setActivatorNodeRef:U,transform:K}=Jlt({id:s,data:E,attributes:{...hct,...n},disabled:w.draggable}),B=Iat(F,z),q=!!L,X=q&&!y&&k5(h)&&k5(v),V=!S&&W,Y=V&&X?K:null,ne=X?Y??(a??C)({rects:b,activeNodeRect:$,activeIndex:h,overIndex:v,index:A}):null,ee=k5(h)&&k5(v)?o({id:s,items:u,activeIndex:h,overIndex:v}):A,se=L?.id,ue=_.useRef({activeId:se,items:u,newIndex:ee,containerId:f}),te=u!==ue.current.items,Z=t({active:L,containerId:f,isDragging:W,isSorting:q,id:s,index:A,items:u,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:c,wasDragging:ue.current.activeId!=null}),re=pct({disabled:!Z,index:A,node:T,rect:D});return _.useEffect(()=>{q&&ue.current.newIndex!==ee&&(ue.current.newIndex=ee),f!==ue.current.containerId&&(ue.current.containerId=f),u!==ue.current.items&&(ue.current.items=u)},[q,ee,f,u]),_.useEffect(()=>{if(se===ue.current.activeId)return;if(se!=null&&ue.current.activeId==null){ue.current.activeId=se;return}const de=setTimeout(()=>{ue.current.activeId=se},50);return()=>clearTimeout(de)},[se]),{active:L,activeIndex:h,attributes:j,data:E,rect:D,index:A,newIndex:ee,items:u,isOver:I,isSorting:q,isDragging:W,listeners:N,node:T,overIndex:v,over:H,setNodeRef:B,setActivatorNodeRef:U,setDroppableNodeRef:F,setDraggableNodeRef:z,transform:re??ne,transition:oe()};function oe(){if(re||te&&ue.current.newIndex===A)return fct;if(!(V&&!wI(R)||!c)&&(q||Z))return sb.Transition.toString({...c,property:zle})}}function gct(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function DS(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 yct=[Ln.Down,Ln.Right,Ln.Up,Ln.Left],bct=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(yct.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case Ln.Down:r.top<h.top&&l.push(f);break;case Ln.Up:r.top>h.top&&l.push(f);break;case Ln.Left:r.left>h.left&&l.push(f);break;case Ln.Right:r.left<h.left&&l.push(f);break}});const c=Xat({collisionRect:r,droppableRects:i,droppableContainers:l});let u=Ale(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const f=o.get(n.id),h=o.get(u),g=h?i.get(h.id):null,y=h?.node.current;if(y&&g&&f&&h){const v=YC(y).some((O,D)=>a[D]!==O),S=Hle(f,h),C=vct(f,h),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},A={x:g.left,y:g.top};return w.x&&w.y?A:ob(A,w)}}}};function Hle(e,t){return!DS(e)||!DS(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function vct(e,t){return!DS(e)||!DS(t)||!Hle(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const xct=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=mct({id:e.id}),[l,c]=_.useState(!1);_.useEffect(()=>{Tw(e.id).then(c)},[e.id]);const u={transform:sb.Transform.toString(o),transition:s,opacity:a?.5:1};return m.jsx(tr,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:m.jsxs(gr,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[m.jsx(le,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:m.jsx(QCe,{})}),m.jsx(Et,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?m.jsx(le,{component:"img",src:i2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:MT(e),width:40,height:40,boxShadow:2},children:(()=>{const f=TT(e);return m.jsx(f,{sx:{fontSize:24}})})()}),m.jsxs(le,{sx:{flex:1},children:[m.jsx(ie,{variant:"subtitle1",fontWeight:500,children:e.name}),m.jsxs(ie,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Sct=()=>{const e=Tu(),{content:t,isLoading:n}=qm(),r=SCe(),[i,o]=_.useState([]),[s,a]=_.useState(!1);_.useEffect(()=>{if(t){const h=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(h),a(!1)}},[t]);const l=Gat(AK(kI),AK(EI,{coordinateGetter:bct})),c=_.useCallback(h=>{const{active:g,over:y}=h;y&&g.id!==y.id&&(o(b=>{const v=b.findIndex(C=>C.id===g.id),S=b.findIndex(C=>C.id===y.id);return _I(b,v,S)}),a(!0))},[]),u=_.useCallback(async()=>{const h=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(h),e.show({message:"Startup order saved successfully",severity:"success"}),a(!1)}catch(g){e.show({message:g instanceof Error?g.message:"Failed to save startup order",severity:"error"})}},[i,r,e]),f=_.useMemo(()=>i.map(h=>h.id),[i]);return n?m.jsx(ie,{children:"Loading..."}):m.jsxs(zt,{spacing:3,children:[m.jsx(dw,{items:[{name:"Bridges",to:jt.bridges},{name:"Startup Order",to:jt.startup}]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[m.jsx(sm,{color:"primary",fontSize:"large"}),m.jsxs(le,{children:[m.jsx(ie,{variant:"h5",fontWeight:600,children:"Startup Order"}),m.jsx(ie,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&m.jsx(kn,{severity:"info",action:m.jsx(kt,{color:"inherit",size:"small",startIcon:m.jsx(o6,{}),onClick:u,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),m.jsx(Ylt,{sensors:l,collisionDetection:Yat,onDragEnd:c,children:m.jsx(lct,{items:f,strategy:sct,children:m.jsx(zt,{spacing:1,children:i.map((h,g)=>m.jsx(xct,{bridge:h,index:g},h.id))})})}),i.length===0&&m.jsx(ie,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&m.jsx(le,{display:"flex",justifyContent:"flex-end",children:m.jsx(kt,{variant:"contained",startIcon:m.jsx(o6,{}),onClick:u,children:"Save Startup Order"})})]})},nk="https://riddix.github.io/home-assistant-matter-hub",jt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:nk,faq:{multiFabric:`${nk}/connect-multiple-fabrics`,bridgeConfig:`${nk}/bridge-configuration`}},wct=[{path:"",element:m.jsx(_2e,{}),children:[{path:"",element:m.jsx(c9e,{})},{path:jt.bridges,element:m.jsx(s9e,{})},{path:jt.createBridge,element:m.jsx(ZQe,{})},{path:jt.bridge(":bridgeId"),element:m.jsx(ICe,{})},{path:jt.editBridge(":bridgeId"),element:m.jsx(JQe,{})},{path:jt.devices,element:m.jsx(_9e,{})},{path:jt.networkMap,element:m.jsx(Dat,{})},{path:jt.health,element:m.jsx(set,{})},{path:jt.labels,element:m.jsx(det,{})},{path:jt.lockCredentials,element:m.jsx(yet,{})},{path:jt.settings,element:m.jsx(Rat,{})},{path:jt.startup,element:m.jsx(Sct,{})}]}],Cct={items:{isInitialized:!1,isLoading:!1}},Ect=VO(Cct,e=>{e.addCase(Fo.pending,t=>{t.items.isLoading=!0}).addCase(Fo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Fo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(BX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(HX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(UX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(zX.fulfilled,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.meta.arg);r!==-1&&t.items.content.splice(r,1)}}).addCase(VX,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(WX,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.payload.id);r!==-1?t.items.content[r]=n.payload:t.items.content.push(n.payload)}})}),Act={byBridge:{}},kct=VO(Act,e=>{e.addCase(du.pending,(t,n)=>{t.byBridge[n.meta.arg]=rk(t.byBridge[n.meta.arg],n)}).addCase(du.rejected,(t,n)=>{t.byBridge[n.meta.arg]=rk(t.byBridge[n.meta.arg],n)}).addCase(du.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=rk(t.byBridge[n.meta.arg],n)})}),_ct={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},rk=VO(_ct,e=>{e.addCase(du.pending,t=>{t.isLoading=!0}).addCase(du.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(du.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),Dct=l2e({reducer:{bridges:Ect,devices:kct}}),DI=Wme({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ye(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>ot({props:e,name:"MuiContainer"})});function Oct(e){return et("MuiToolbar",e)}nt("MuiToolbar",["root","gutters","regular","dense"]);const Tct=e=>{const{classes:t,disableGutters:n,variant:r}=e;return tt({root:["root",!n&&"gutters",r]},Oct,t)},Mct=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ge(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}))),Ule=_.forwardRef(function(t,n){const r=ot({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=Tct(c);return m.jsx(Mct,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})}),Rct=[{name:"GitHub",url:jt.githubRepository},{name:"Documentation",url:jt.documentation}],Ict=()=>m.jsxs(DI,{sx:{mt:16,mb:4},children:[m.jsx(gi,{sx:{mt:4,mb:4}}),m.jsx(Qe,{container:!0,spacing:2,justifyContent:"center",children:Rct.map((e,t)=>m.jsx(Qe,{size:{xs:12,sm:"auto"},children:m.jsx(kt,{fullWidth:!0,size:"small",variant:"outlined",component:uw,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function Pct(e){return et("MuiAppBar",e)}nt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const jct=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return tt(i,Pct,r)},NK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,$ct=me(Nr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(Ge(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit",color:"var(--AppBar-color)"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Fn(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?NK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?NK(e.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundImage:"none"})}}]}))),Lct=_.forwardRef(function(t,n){const r=ot({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=jct(c);return m.jsx($ct,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function Nct(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=tl(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function Fct(e){return typeof e=="function"?e():e}function D5(e,t,n){const r=Fct(n),i=Nct(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Bct=_.forwardRef(function(t,n){const r=Oa(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:f=i,in:h,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Ta,...O}=t,D=_.useRef(null),T=Tr(mf(l),D,n),I=H=>U=>{H&&(U===void 0?H(D.current):H(D.current,U))},F=I((H,U)=>{D5(u,H,c),NO(H),g&&g(H,U)}),L=I((H,U)=>{const K=Kd({timeout:A,style:w,easing:f},{mode:"enter"});H.style.webkitTransition=r.transitions.create("-webkit-transform",{...K}),H.style.transition=r.transitions.create("transform",{...K}),H.style.webkitTransform="none",H.style.transform="none",b&&b(H,U)}),R=I(y),$=I(C),j=I(H=>{const U=Kd({timeout:A,style:w,easing:f},{mode:"exit"});H.style.webkitTransition=r.transitions.create("-webkit-transform",U),H.style.transition=r.transitions.create("transform",U),D5(u,H,c),v&&v(H)}),z=I(H=>{H.style.webkitTransition="",H.style.transition="",S&&S(H)}),N=H=>{s&&s(D.current,H)},W=_.useCallback(()=>{D.current&&D5(u,D.current,c)},[u,c]);return _.useEffect(()=>{if(h||u==="down"||u==="right")return;const H=PO(()=>{D.current&&D5(u,D.current,c)}),U=tl(D.current);return U.addEventListener("resize",H),()=>{H.clear(),U.removeEventListener("resize",H)}},[u,h,c]),_.useEffect(()=>{h||W()},[h,W]),m.jsx(E,{nodeRef:D,onEnter:F,onEntered:R,onEntering:L,onExit:j,onExited:z,onExiting:$,addEndListener:N,appear:a,in:h,timeout:A,...O,children:(H,{ownerState:U,...K})=>_.cloneElement(l,{ref:T,style:{visibility:H==="exited"&&!h?"hidden":void 0,...w,...l.props.style},...K})})});function zct(e){return et("MuiDrawer",e)}nt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Vle=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},Hct=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ye(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ye(n)}`,r!=="temporary"&&`paperAnchorDocked${ye(n)}`]};return tt(i,zct,t)},Uct=me(tT,{name:"MuiDrawer",slot:"Root",overridesResolver:Vle})(Ge(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Vct=me("div",{shouldForwardProp:ro,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Vle})({flex:"0 0 auto"}),Wct=me(Nr,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ye(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ye(n.anchor)}`]]}})(Ge(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:t})=>t.anchor==="left"&&t.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="top"&&t.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="right"&&t.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="bottom"&&t.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),Wle={left:"right",right:"left",top:"down",bottom:"up"};function qct(e){return["left","right"].includes(e)}function Gct({direction:e},t){return e==="rtl"&&qct(t)?Wle[t]:t}const Kct=_.forwardRef(function(t,n){const r=ot({props:t,name:"MuiDrawer"}),i=Oa(),o=pf(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:f=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:O={},slotProps:D={},...T}=r,I=_.useRef(!1);_.useEffect(()=>{I.current=!0},[]);const F=Gct({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:f,open:v,variant:E,...T},$=Hct(R),j={slots:{transition:w,...O},slotProps:{paper:S,transition:C,...D,backdrop:jO(D.backdrop||{...l,...g},{transitionDuration:A})}},[z,N]=ct("root",{ref:n,elementType:Uct,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...j,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:h,slots:{backdrop:j.slots.backdrop},slotProps:{backdrop:j.slotProps.backdrop}}}),[W,H]=ct("paper",{elementType:Wct,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:R,externalForwardedProps:j,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[U,K]=ct("docked",{elementType:Vct,ref:n,className:Oe($.root,$.docked,u),ownerState:R,externalForwardedProps:j,additionalProps:T}),[B,q]=ct("transition",{elementType:Bct,ownerState:R,externalForwardedProps:j,additionalProps:{in:v,direction:Wle[F],timeout:A,appear:I.current}}),X=m.jsx(W,{...H,children:c});if(E==="permanent")return m.jsx(U,{...K,children:X});const V=m.jsx(B,{...q,children:X});return E==="persistent"?m.jsx(U,{...K,children:V}):m.jsx(z,{...N,children:V})}),Yct=YY({themeId:ua}),ik={error:"#d32f2f",warn:"#ed6c02",info:"#0288d1",debug:"#7b1fa2"},Xct={error:bf,warn:aw,info:QO,debug:Dw},Zct=({open:e,onClose:t})=>{const[n,r]=_.useState([]),[i,o]=_.useState(!0),[s,a]=_.useState("error,warn,info".split(",")),[l,c]=_.useState(""),[u,f]=_.useState(!0),h=_.useCallback(async()=>{try{const S=new URLSearchParams({level:s.join(","),limit:"500",...l&&{search:l}}),C=await fetch(`api/logs?${S}`);if(C.ok){const w=await C.json();r(w.entries)}}catch(S){console.error("Failed to fetch logs:",S)}finally{o(!1)}},[s,l]);_.useEffect(()=>{e&&h()},[e,h]),_.useEffect(()=>{if(!u||!e)return;const S=setInterval(h,5e3);return()=>clearInterval(S)},[u,e,h]);const g=S=>{a(Array.isArray(S.target.value)?S.target.value:[S.target.value])},y=S=>{c(S.target.value)},b=async()=>{try{await fetch("api/logs",{method:"DELETE"}),r([])}catch(S){console.error("Failed to clear logs:",S)}},v=S=>{const C=Xct[S]||QO;return m.jsx(C,{sx:{fontSize:16,color:ik[S]}})};return m.jsxs(vu,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[m.jsxs(Su,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(Dw,{}),"System Logs",m.jsx(le,{sx:{flexGrow:1}}),m.jsx(cn,{title:"Auto Refresh",children:m.jsx(Et,{label:u?"Auto":"Manual",color:u?"success":"default",size:"small",onClick:()=>f(!u),sx:{cursor:"pointer"}})}),m.jsx(_n,{onClick:t,children:m.jsx(qCe,{})})]}),m.jsxs(xu,{children:[m.jsx(zt,{spacing:2,sx:{mb:2},children:m.jsxs(zt,{direction:"row",spacing:2,alignItems:"center",children:[m.jsxs(ha,{size:"small",sx:{minWidth:200},children:[m.jsx(sc,{children:"Log Level"}),m.jsxs(oa,{value:s,label:"Log Level",onChange:g,multiple:!0,renderValue:S=>m.jsx(le,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(S)?S:[S]).map(C=>m.jsx(Et,{label:C.toUpperCase(),size:"small",sx:{backgroundColor:ik[C],color:"white"}},C))}),children:[m.jsx(er,{value:"error",children:"Error"}),m.jsx(er,{value:"warn",children:"Warning"}),m.jsx(er,{value:"info",children:"Info"}),m.jsx(er,{value:"debug",children:"Debug"})]})]}),m.jsx(Lr,{size:"small",placeholder:"Search logs...",value:l,onChange:y,sx:{flexGrow:1}}),m.jsx(kt,{variant:"outlined",onClick:h,children:"Refresh"}),m.jsx(kt,{variant:"outlined",color:"error",onClick:b,children:"Clear"})]})}),m.jsx(le,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:i?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{children:"Loading logs..."})}):n.length===0?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{color:"text.secondary",children:"No logs found"})}):m.jsx(zt,{spacing:1,children:n.map((S,C)=>m.jsxs(le,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[v(S.level),m.jsx(ie,{variant:"caption",color:"text.secondary",children:new Date(S.timestamp).toLocaleString()}),m.jsx(Et,{label:S.level.toUpperCase(),size:"small",sx:{backgroundColor:ik[S.level],color:"white",fontSize:"0.7rem",height:20}})]}),m.jsx(ie,{sx:{ml:3},children:S.message}),S.context&&m.jsx(ie,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(S.context,null,2)})]},`${S.timestamp}-${S.level}-${C}`))})})]}),m.jsx(Xd,{children:m.jsx(kt,{onClick:t,children:"Close"})})]})};function FK(){const{isConnected:e}=A2e(),[t,n]=_.useState(null),[r,i]=_.useState(!1);_.useEffect(()=>{const y=async()=>{try{const v=await fetch("api/health");if(v.ok){const S=await v.json();n(S),i(!1)}else i(!0)}catch{i(!0)}};y();const b=setInterval(y,3e4);return()=>clearInterval(b)},[]);const o=y=>{const b=Math.floor(y/3600),v=Math.floor(y%3600/60);return b>0?`${b}h ${v}m`:`${v}m`},s=t?.status==="healthy"&&!r,a=t?.services?.bridges,l=a&&a.total>0&&a.running===a.total,c=a&&a.total===0,u=t?m.jsxs(le,{sx:{p:.5},children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&m.jsxs("div",{children:[m.jsx("strong",{children:"Bridges:"})," ",t.services.bridges.running??0,"/",t.services.bridges.total??0," running",(t.services.bridges.stopped??0)>0&&` (${t.services.bridges.stopped} stopped)`]}),t.services?.homeAssistant&&m.jsxs("div",{children:[m.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?m.jsx(bf,{fontSize:"small"}):l?m.jsx(Mu,{fontSize:"small"}):m.jsx(pw,{fontSize:"small"}),h=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?c?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return m.jsx(cn,{title:u,arrow:!0,children:m.jsx(Et,{icon:f(),label:g(),color:h(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Jct=e=>_.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},_.createElement("g",{style:{display:"inline"}},_.createElement("path",{style:{fill:"#18bcf2",fillOpacity:1,strokeWidth:.266194},d:"m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z"}),_.createElement("path",{style:{fill:"#ffffff",fillOpacity:1,strokeWidth:.175841},d:"m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z"}))),Qct="home-assistant-matter-hub",eut={name:Qct};function tut(){const[e,t]=_.useState("2.1.0-alpha.423");return _.useEffect(()=>{fetch("api/health").then(n=>n.ok?n.json():null).then(n=>{n?.version&&t(n.version)}).catch(()=>{})},[]),_.useMemo(()=>({name:eut.name,version:e}),[e])}const nut=e=>{const t=tut();return m.jsxs(le,{component:Du,to:jt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[m.jsx(Jct,{style:{height:"40px"}}),m.jsx(ie,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&m.jsx(ie,{variant:"caption",component:"span",children:t.version})]})},rut=()=>{const e=Yct("(min-width:600px)"),{mode:t,setMode:n}=ZS(),[r,i]=_.useState(!1),[o,s]=_.useState(!1),a=Jh(),l=()=>{n(t==="dark"?"light":"dark")},c=[{label:"Dashboard",icon:m.jsx(e_,{}),to:jt.dashboard},{label:"Bridges",icon:m.jsx(py,{}),to:jt.bridges},{label:"All Devices",icon:m.jsx(ss,{}),to:jt.devices},{label:"Network Map",icon:m.jsx(r6,{}),to:jt.networkMap},{label:"Startup Order",icon:m.jsx(sm,{}),to:jt.startup},{label:"Lock Credentials",icon:m.jsx(ac,{}),to:jt.lockCredentials},{label:"Filter Reference",icon:m.jsx(i6,{}),to:jt.labels},{label:"Settings",icon:m.jsx(pm,{}),to:jt.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?m.jsx(a8e,{}):m.jsx(YCe,{}),onClick:l},{label:"System Logs",icon:m.jsx(Dw,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:m.jsx(X4,{}),to:jt.health}],u=f=>{s(!1),f.onClick?f.onClick():f.to&&a(f.to)};return m.jsxs(le,{children:[m.jsx(Lct,{sx:{height:"72px"},children:m.jsx(Ule,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:m.jsxs(DI,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsx(nut,{large:e}),e?m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1},children:[c.map(f=>f.to?m.jsx(cn,{title:f.label,children:m.jsx(_n,{component:Du,to:f.to,sx:{color:"inherit"},children:f.icon})},f.label):m.jsx(cn,{title:f.label,children:m.jsx(_n,{onClick:f.onClick,sx:{color:"inherit"},children:f.icon})},f.label)),m.jsx(FK,{})]}):m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(FK,{}),m.jsx(_n,{onClick:()=>s(!0),sx:{color:"inherit"},children:m.jsx(l8e,{})})]})]})})}),m.jsx(Kct,{anchor:"right",open:o,onClose:()=>s(!1),children:m.jsx(vc,{sx:{width:250},children:c.map(f=>m.jsxs(obe,{onClick:()=>u(f),children:[m.jsx(Ul,{children:f.icon}),m.jsx(Va,{primary:f.label})]},f.label))})}),m.jsx(Zct,{open:r,onClose:()=>i(!1)})]})},iut=()=>m.jsxs(le,{children:[m.jsx(rut,{}),m.jsx(Ule,{}),m.jsx(DI,{sx:{p:2},children:m.jsx(gY,{})}),m.jsx(Ict,{})]}),out=KS({colorSchemes:{light:{palette:{primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2"},background:{default:"#f5f5f5",paper:"#ffffff"}}},dark:{palette:{primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5"},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc"},background:{default:"#121212",paper:"#1e1e1e"}}}},typography:{fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',h1:{fontSize:"2.5rem",fontWeight:500},h2:{fontSize:"2rem",fontWeight:500},h3:{fontSize:"1.75rem",fontWeight:500},h4:{fontSize:"1.5rem",fontWeight:500},h5:{fontSize:"1.25rem",fontWeight:500},h6:{fontSize:"1rem",fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-2px)",boxShadow:"0 4px 20px rgba(0,0,0,0.12)"}}}},MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:"none"}}}}});let D4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");D4?.startsWith("http")&&(D4=new URL(D4).pathname);const sut=Hhe([{path:"/",element:m.jsx(iut,{}),children:wct}],{basename:D4});sde.createRoot(document.getElementById("root")).render(m.jsx(_.StrictMode,{children:m.jsx(Cde,{store:Dct,children:m.jsxs(n1e,{theme:out,children:[m.jsx(Zge,{}),m.jsx(uX,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:"initial !important",flexGrow:1}}}),m.jsx(k2e,{children:m.jsx(yye,{children:m.jsx(epe,{router:sut})})})]})})}));
499
+ `},Wat={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 qat(e){let{announcements:t=Wat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Vat}=e;const{announce:o,announcement:s}=zat(),a=lv("DndLiveRegion"),[l,c]=_.useState(!1);if(_.useEffect(()=>{c(!0)},[]),Hat(_.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=qt.createElement(qt.Fragment,null,qt.createElement(Fat,{id:r,value:i.draggable}),qt.createElement(Bat,{id:a,announcement:s}));return n?Dd.createPortal(u,n):u}var Li;(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"})(Li||(Li={}));function kS(){}function AK(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Gat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const sl=Object.freeze({x:0,y:0});function Cle(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ele(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Kat(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function kK(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 Ale(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function _K(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Yat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=_K(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=Cle(_K(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(Ele)},Xat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=kK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=kK(l),u=i.reduce((h,g,y)=>h+Cle(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(Ele)};function Zat(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),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const Jat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=Zat(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Kat)};function Qat(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function kle(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:sl}function elt(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((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const tlt=elt(1);function nlt(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 rlt(e,t,n){const r=nlt(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const ilt={ignoreTransform:!1};function gg(e,t){t===void 0&&(t=ilt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=fs(e).getComputedStyle(e);c&&(n=rlt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function DK(e){return gg(e,{ignoreTransform:!0})}function olt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function slt(e,t){return t===void 0&&(t=fs(e).getComputedStyle(e)),t.position==="fixed"}function alt(e,t){t===void 0&&(t=fs(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 YC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(xI(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!sv(i)||xle(i)||n.includes(i))return n;const o=fs(e).getComputedStyle(i);return i!==e&&alt(i,o)&&n.push(i),slt(i,o)?n:r(i.parentNode)}return e?r(e):n}function _le(e){const[t]=YC(e,1);return t??null}function QA(e){return!KC||!e?null:pg(e)?e:vI(e)?xI(e)||e===mg(e).scrollingElement?window:sv(e)?e:null:null}function Dle(e){return pg(e)?e.scrollX:e.scrollLeft}function Ole(e){return pg(e)?e.scrollY:e.scrollTop}function tO(e){return{x:Dle(e),y:Ole(e)}}var Xi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xi||(Xi={}));function Tle(e){return!KC||!e?!1:e===document.scrollingElement}function Mle(e){const t={x:0,y:0},n=Tle(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,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const llt={x:.2,y:.2};function clt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=llt);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=Mle(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=Xi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=Xi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&a>=t.right-b.width?(g.x=Xi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Xi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function ult(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}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 Rle(e){return e.reduce((t,n)=>nm(t,tO(n)),sl)}function dlt(e){return e.reduce((t,n)=>t+Dle(n),0)}function flt(e){return e.reduce((t,n)=>t+Ole(n),0)}function hlt(e,t){if(t===void 0&&(t=gg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);_le(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const plt=[["x",["left","right"],dlt],["y",["top","bottom"],flt]];class CI{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=YC(n),i=Rle(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of plt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $y{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 mlt(e){const{EventTarget:t}=fs(e);return e instanceof t?e:mg(e)}function ek(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+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 ta;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ta||(ta={}));function OK(e){e.preventDefault()}function glt(e){e.stopPropagation()}var Ln;(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"})(Ln||(Ln={}));const Ile={start:[Ln.Space,Ln.Enter],cancel:[Ln.Esc],end:[Ln.Space,Ln.Enter,Ln.Tab]},ylt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ln.Right:return{...n,x:n.x+25};case Ln.Left:return{...n,x:n.x-25};case Ln.Down:return{...n,y:n.y+25};case Ln.Up:return{...n,y:n.y-25}}};class EI{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 $y(mg(n)),this.windowListeners=new $y(fs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ta.Resize,this.handleCancel),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ta.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&hlt(r),n(sl)}handleKeyDown(t){if(wI(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Ile,coordinateGetter:s=ylt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:sl;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=ob(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:A,maxScroll:E,minScroll:O}=Mle(b),D=ult(b),T={x:Math.min(v===Ln.Right?D.right-D.width/2:D.right,Math.max(v===Ln.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(v===Ln.Down?D.bottom-D.height/2:D.bottom,Math.max(v===Ln.Down?D.top:D.top+D.height/2,f.y))},I=v===Ln.Right&&!C||v===Ln.Left&&!w,F=v===Ln.Down&&!A||v===Ln.Up&&!S;if(I&&T.x!==f.x){const L=b.scrollLeft+h.x,R=v===Ln.Right&&L<=E.x||v===Ln.Left&&L>=O.x;if(R&&!h.y){b.scrollTo({left:L,behavior:a});return}R?g.x=b.scrollLeft-L:g.x=v===Ln.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(F&&T.y!==f.y){const L=b.scrollTop+h.y,R=v===Ln.Down&&L<=E.y||v===Ln.Up&&L>=O.y;if(R&&!h.x){b.scrollTo({top:L,behavior:a});return}R?g.y=b.scrollTop-L:g.y=v===Ln.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,nm(ob(f,this.referenceCoordinates),g))}}}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()}}EI.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ile,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function TK(e){return!!(e&&"distance"in e)}function MK(e){return!!(e&&"delay"in e)}class AI{constructor(t,n,r){var i;r===void 0&&(r=mlt(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:s}=o;this.props=t,this.events=n,this.document=mg(s),this.documentListeners=new $y(this.document),this.listeners=new $y(r),this.windowListeners=new $y(fs(s)),this.initialCoordinates=(i=eO(o))!=null?i:sl,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(ta.Resize,this.handleCancel),this.windowListeners.add(ta.DragStart,OK),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),this.windowListeners.add(ta.ContextMenu,OK),this.documentListeners.add(ta.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(MK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(TK(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(ta.Click,glt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ta.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=eO(t))!=null?n:sl,c=ob(i,l);if(!r&&a){if(TK(a)){if(a.tolerance!=null&&ek(c,a.tolerance))return this.handleCancel();if(ek(c,a.distance))return this.handleStart()}if(MK(a)&&ek(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}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===Ln.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const blt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kI extends AI{constructor(t){const{event:n}=t,r=mg(n.target);super(t,blt,r)}}kI.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const vlt={move:{name:"mousemove"},end:{name:"mouseup"}};var nO;(function(e){e[e.RightClick=2]="RightClick"})(nO||(nO={}));class xlt extends AI{constructor(t){super(t,vlt,mg(t.event.target))}}xlt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===nO.RightClick?!1:(r?.({event:n}),!0)}}];const tk={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Slt extends AI{constructor(t){super(t,tk)}static setup(){return window.addEventListener(tk.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(tk.move.name,t)};function t(){}}}Slt.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Ly;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ly||(Ly={}));var _S;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(_S||(_S={}));function wlt(e){let{acceleration:t,activator:n=Ly.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=_S.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=Elt({delta:f,disabled:!o}),[y,b]=Pat(),v=_.useRef({x:0,y:0}),S=_.useRef({x:0,y:0}),C=_.useMemo(()=>{switch(n){case Ly.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ly.DraggableRect:return i}},[n,i,l]),w=_.useRef(null),A=_.useCallback(()=>{const O=w.current;if(!O)return;const D=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(D,T)},[]),E=_.useMemo(()=>a===_S.TreeOrder?[...c].reverse():c,[a,c]);_.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const D=c.indexOf(O),T=u[D];if(!T)continue;const{direction:I,speed:F}=clt(O,T,C,t,h);for(const L of["x","y"])g[L][I[L]]||(F[L]=0,I[L]=0);if(F.x>0||F.y>0){b(),w.current=O,y(A,s),v.current=F,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,A,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(h)])}const Clt={x:{[Xi.Backward]:!1,[Xi.Forward]:!1},y:{[Xi.Backward]:!1,[Xi.Forward]:!1}};function Elt(e){let{delta:t,disabled:n}=e;const r=QD(t);return av(i=>{if(n||!r||!i)return Clt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xi.Backward]:i.x[Xi.Backward]||o.x===-1,[Xi.Forward]:i.x[Xi.Forward]||o.x===1},y:{[Xi.Backward]:i.y[Xi.Backward]||o.y===-1,[Xi.Forward]:i.y[Xi.Forward]||o.y===1}}},[n,t,r])}function Alt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return av(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function klt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var ab;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ab||(ab={}));var rO;(function(e){e.Optimized="optimized"})(rO||(rO={}));const RK=new Map;function _lt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=_.useState(null),{frequency:a,measure:l,strategy:c}=i,u=_.useRef(e),f=v(),h=ib(f),g=_.useCallback(function(S){S===void 0&&(S=[]),!h.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[h]),y=_.useRef(null),b=av(S=>{if(f&&!n)return RK;if(!S||S===RK||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const A=w.node.current,E=A?new CI(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return _.useEffect(()=>{u.current=e},[e]),_.useEffect(()=>{f||g()},[n,f]),_.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),_.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case ab.Always:return!1;case ab.BeforeDragging:return n;default:return!n}}}function Ple(e,t){return av(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Dlt(e,t){return Ple(e,t)}function Olt(e){let{callback:t,disabled:n}=e;const r=SI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function XC(e){let{callback:t,disabled:n}=e;const r=SI(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return _.useEffect(()=>()=>i?.disconnect(),[i]),i}function Tlt(e){return new CI(gg(e),e)}function IK(e,t,n){t===void 0&&(t=Tlt);const[r,i]=_.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Olt({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=XC({callback:o});return bc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Mlt(e){const t=Ple(e);return kle(e,t)}const PK=[];function Rlt(e){const t=_.useRef(e),n=av(r=>e?r&&r!==PK&&e&&t.current&&e.parentNode===t.current.parentNode?r:YC(e):PK,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function Ilt(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(o=>{const s=QA(o.target);s&&n(a=>a?(a.set(s,tO(s)),new Map(a)):null)},[]);return _.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=QA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,tO(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=QA(l);c?.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>nm(o,s),sl):Rle(e):sl,[e,t])}function jK(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==sl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ob(e,n.current):sl}function Plt(e){_.useEffect(()=>{if(!KC)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?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function jlt(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function jle(e){return _.useMemo(()=>e?olt(e):null,[e])}const $K=[];function $lt(e,t){t===void 0&&(t=gg);const[n]=e,r=jle(n?fs(n):null),[i,o]=_.useState($K);function s(){o(()=>e.length?e.map(l=>Tle(l)?r:new CI(t(l),l)):$K)}const a=XC({callback:s});return bc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Llt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return sv(t)?t:e}function Nlt(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(c=>{for(const{target:u}of c)if(sv(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=XC({callback:i}),s=_.useCallback(c=>{const u=Llt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=AS(s);return _.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Flt=[{sensor:kI,options:{}},{sensor:EI,options:{}}],Blt={current:{}},_4={draggable:{measure:DK},droppable:{measure:DK,strategy:ab.WhileDragging,frequency:rO.Optimized},dragOverlay:{measure:gg}};class Ny 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 zlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ny,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:_4,measureDroppableContainers:kS,windowRect:null,measuringScheduled:!1},Hlt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kS,draggableNodes:new Map,over:null,measureDroppableContainers:kS},ZC=_.createContext(Hlt),$le=_.createContext(zlt);function Ult(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ny}}}function Vlt(e,t){switch(t.type){case Li.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Li.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Li.DragEnd:case Li.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Li.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Ny(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Li.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Ny(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Li.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Ny(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Wlt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(ZC),o=QD(r),s=QD(n?.id);return _.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!wI(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Lat(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function qlt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Glt(e){return _.useMemo(()=>({draggable:{..._4.draggable,...e?.draggable},droppable:{..._4.droppable,...e?.droppable},dragOverlay:{..._4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Klt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=_.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;bc(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=kle(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=_le(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const Lle=_.createContext({...sl,scaleX:1,scaleY:1});var xd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xd||(xd={}));const Ylt=_.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Flt,collisionDetection:f=Jat,measuring:h,modifiers:g,...y}=t;const b=_.useReducer(Vlt,void 0,Ult),[v,S]=b,[C,w]=Uat(),[A,E]=_.useState(xd.Uninitialized),O=A===xd.Initialized,{draggable:{active:D,nodes:T,translate:I},droppable:{containers:F}}=v,L=D!=null?T.get(D):null,R=_.useRef({initial:null,translated:null}),$=_.useMemo(()=>{var Dt;return D!=null?{id:D,data:(Dt=L?.data)!=null?Dt:Blt,rect:R}:null},[D,L]),j=_.useRef(null),[z,N]=_.useState(null),[W,H]=_.useState(null),U=ib(y,Object.values(y)),K=lv("DndDescribedBy",s),B=_.useMemo(()=>F.getEnabled(),[F]),q=Glt(h),{droppableRects:X,measureDroppableContainers:V,measuringScheduled:Y}=_lt(B,{dragging:O,dependencies:[I.x,I.y],config:q.droppable}),J=Alt(T,D),ne=_.useMemo(()=>W?eO(W):null,[W]),ee=yr(),se=Dlt(J,q.draggable.measure);Klt({activeNode:D!=null?T.get(D):null,config:ee.layoutShiftCompensation,initialRect:se,measure:q.draggable.measure});const ue=IK(J,q.draggable.measure,se),te=IK(J?J.parentElement:null),Z=_.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=F.getNodeFor((n=Z.current.over)==null?void 0:n.id),oe=Nlt({measure:q.dragOverlay.measure}),de=(r=oe.nodeRef.current)!=null?r:J,be=O?(i=oe.rect)!=null?i:ue:null,je=!!(oe.nodeRef.current&&oe.rect),De=Mlt(je?null:ue),Ke=jle(de?fs(de):null),xe=Rlt(O?re??J:null),Le=$lt(xe),Te=qlt(g,{transform:{x:I.x-De.x,y:I.y-De.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:ue,containerNodeRect:te,draggingNodeRect:be,over:Z.current.over,overlayNodeRect:oe.rect,scrollableAncestors:xe,scrollableAncestorRects:Le,windowRect:Ke}),ht=ne?nm(ne,I):null,mt=Ilt(xe),ze=jK(mt),Ie=jK(mt,[ue]),He=nm(Te,ze),Je=be?tlt(be,Te):null,rt=$&&Je?f({active:$,collisionRect:Je,droppableRects:X,droppableContainers:B,pointerCoordinates:ht}):null,st=Ale(rt,"id"),[Xe,Lt]=_.useState(null),Nt=je?Te:nm(Te,Ie),Ot=Qat(Nt,(o=Xe?.rect)!=null?o:null,ue),Xn=_.useRef(null),rn=_.useCallback((Dt,Pt)=>{let{sensor:Jt,options:jn}=Pt;if(j.current==null)return;const on=T.get(j.current);if(!on)return;const St=Dt.nativeEvent,mn=new Jt({active:j.current,activeNode:on,event:St,options:jn,context:Z,onAbort(br){if(!T.get(br))return;const{onDragAbort:ce}=U.current,pe={id:br};ce?.(pe),C({type:"onDragAbort",event:pe})},onPending(br,ei,ce,pe){if(!T.get(br))return;const{onDragPending:Fe}=U.current,Ue={id:br,constraint:ei,initialCoordinates:ce,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(br){const ei=j.current;if(ei==null)return;const ce=T.get(ei);if(!ce)return;const{onDragStart:pe}=U.current,Se={activatorEvent:St,active:{id:ei,data:ce.data,rect:R}};Dd.unstable_batchedUpdates(()=>{pe?.(Se),E(xd.Initializing),S({type:Li.DragStart,initialCoordinates:br,active:ei}),C({type:"onDragStart",event:Se}),N(Xn.current),H(St)})},onMove(br){S({type:Li.DragMove,coordinates:br})},onEnd:Qr(Li.DragEnd),onCancel:Qr(Li.DragCancel)});Xn.current=mn;function Qr(br){return async function(){const{active:ce,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=Z.current;let Ue=null;if(ce&&Fe){const{cancelDrop:yt}=U.current;Ue={activatorEvent:St,active:ce,collisions:pe,delta:Fe,over:Se},br===Li.DragEnd&&typeof yt=="function"&&await Promise.resolve(yt(Ue))&&(br=Li.DragCancel)}j.current=null,Dd.unstable_batchedUpdates(()=>{S({type:br}),E(xd.Uninitialized),Lt(null),N(null),H(null),Xn.current=null;const yt=br===Li.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const it=U.current[yt];it?.(Ue),C({type:yt,event:Ue})}})}}},[T]),lt=_.useCallback((Dt,Pt)=>(Jt,jn)=>{const on=Jt.nativeEvent,St=T.get(jn);if(j.current!==null||!St||on.dndKit||on.defaultPrevented)return;const mn={active:St};Dt(Jt,Pt.options,mn)===!0&&(on.dndKit={capturedBy:Pt.sensor},j.current=jn,rn(Jt,Pt))},[T,rn]),Ht=klt(u,lt);Plt(u),bc(()=>{ue&&A===xd.Initializing&&E(xd.Initialized)},[ue,A]),_.useEffect(()=>{const{onDragMove:Dt}=U.current,{active:Pt,activatorEvent:Jt,collisions:jn,over:on}=Z.current;if(!Pt||!Jt)return;const St={active:Pt,activatorEvent:Jt,collisions:jn,delta:{x:He.x,y:He.y},over:on};Dd.unstable_batchedUpdates(()=>{Dt?.(St),C({type:"onDragMove",event:St})})},[He.x,He.y]),_.useEffect(()=>{const{active:Dt,activatorEvent:Pt,collisions:Jt,droppableContainers:jn,scrollAdjustedTranslate:on}=Z.current;if(!Dt||j.current==null||!Pt||!on)return;const{onDragOver:St}=U.current,mn=jn.get(st),Qr=mn&&mn.rect.current?{id:mn.id,rect:mn.rect.current,data:mn.data,disabled:mn.disabled}:null,br={active:Dt,activatorEvent:Pt,collisions:Jt,delta:{x:on.x,y:on.y},over:Qr};Dd.unstable_batchedUpdates(()=>{Lt(Qr),St?.(br),C({type:"onDragOver",event:br})})},[st]),bc(()=>{Z.current={activatorEvent:W,active:$,activeNode:J,collisionRect:Je,collisions:rt,droppableRects:X,draggableNodes:T,draggingNode:de,draggingNodeRect:be,droppableContainers:F,over:Xe,scrollableAncestors:xe,scrollAdjustedTranslate:He},R.current={initial:be,translated:Je}},[$,J,rt,Je,T,de,be,X,F,Xe,xe,He]),wlt({...ee,delta:I,draggingRect:Je,pointerCoordinates:ht,scrollableAncestors:xe,scrollableAncestorRects:Le});const Dn=_.useMemo(()=>({active:$,activeNode:J,activeNodeRect:ue,activatorEvent:W,collisions:rt,containerNodeRect:te,dragOverlay:oe,draggableNodes:T,droppableContainers:F,droppableRects:X,over:Xe,measureDroppableContainers:V,scrollableAncestors:xe,scrollableAncestorRects:Le,measuringConfiguration:q,measuringScheduled:Y,windowRect:Ke}),[$,J,ue,W,rt,te,oe,T,F,X,Xe,V,xe,Le,q,Y,Ke]),Gn=_.useMemo(()=>({activatorEvent:W,activators:Ht,active:$,activeNodeRect:ue,ariaDescribedById:{draggable:K},dispatch:S,draggableNodes:T,over:Xe,measureDroppableContainers:V}),[W,Ht,$,ue,S,K,T,Xe,V]);return qt.createElement(wle.Provider,{value:w},qt.createElement(ZC.Provider,{value:Gn},qt.createElement($le.Provider,{value:Dn},qt.createElement(Lle.Provider,{value:Ot},c)),qt.createElement(Wlt,{disabled:a?.restoreFocus===!1})),qt.createElement(qat,{...a,hiddenTextDescribedById:K}));function yr(){const Dt=z?.autoScrollEnabled===!1,Pt=typeof l=="object"?l.enabled===!1:l===!1,Jt=O&&!Dt&&!Pt;return typeof l=="object"?{...l,enabled:Jt}:{enabled:Jt}}}),Xlt=_.createContext(null),LK="button",Zlt="Draggable";function Jlt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=lv(Zlt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=_.useContext(ZC),{role:g=LK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=_.useContext(v?Lle:Xlt),[C,w]=AS(),[A,E]=AS(),O=jlt(s,t),D=ib(n);bc(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:D}),()=>{const I=f.get(t);I&&I.key===o&&f.delete(t)}),[f,t]);const T=_.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===LK?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:h,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Qlt(){return _.useContext($le)}const ect="Droppable",tct={timeout:25};function nct(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=lv(ect),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=_.useContext(ZC),u=_.useRef({disabled:n}),f=_.useRef(!1),h=_.useRef(null),g=_.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...tct,...i},S=ib(b??r),C=_.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=XC({callback:C,disabled:y||!s}),A=_.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),f.current=!1),T&&w.observe(T))},[w]),[E,O]=AS(A),D=ib(t);return _.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),_.useEffect(()=>(a({type:Li.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:h,data:D}}),()=>a({type:Li.UnregisterDroppable,key:o,id:r})),[r]),_.useEffect(()=>{n!==u.current.disabled&&(a({type:Li.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function _I(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function rct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function k5(e){return e!==null&&e>=0}function ict(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 oct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Nle=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=_I(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},_5={scaleX:1,scaleY:1},sct=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,..._5}:null}const l=act(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,..._5}:i<n&&i>=s?{x:0,y:a.height+l,..._5}:{x:0,y:0,..._5}};function act(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const Fle="Sortable",Ble=qt.createContext({activeIndex:-1,containerId:Fle,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Nle,disabled:{draggable:!1,droppable:!1}});function lct(e){let{children:t,id:n,items:r,strategy:i=Nle,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Qlt(),f=lv(Fle,n),h=a.rect!==null,g=_.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=_.useRef(g),C=!ict(g,S.current),w=v!==-1&&b===-1||C,A=oct(o);bc(()=>{C&&y&&u(g)},[C,g,y,u]),_.useEffect(()=>{S.current=g},[g]);const E=_.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:h,sortedRects:rct(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,h,i]);return qt.createElement(Ble.Provider,{value:E},t)}const cct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return _I(n,r,i).indexOf(t)},uct=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},dct={duration:200,easing:"ease"},zle="transform",fct=sb.Transition.toString({property:zle,duration:0,easing:"linear"}),hct={roleDescription:"sortable"};function pct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=_.useState(null),a=_.useRef(n);return bc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=gg(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),_.useEffect(()=>{o&&s(null)},[o]),o}function mct(e){let{animateLayoutChanges:t=uct,attributes:n,disabled:r,data:i,getNewIndex:o=cct,id:s,strategy:a,resizeObserverConfig:l,transition:c=dct}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=_.useContext(Ble),w=gct(r,g),A=u.indexOf(s),E=_.useMemo(()=>({sortable:{containerId:f,index:A,items:u},...i}),[f,i,A,u]),O=_.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:D,node:T,isOver:I,setNodeRef:F}=nct({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:L,activatorEvent:R,activeNodeRect:$,attributes:j,setNodeRef:z,listeners:N,isDragging:W,over:H,setActivatorNodeRef:U,transform:K}=Jlt({id:s,data:E,attributes:{...hct,...n},disabled:w.draggable}),B=Iat(F,z),q=!!L,X=q&&!y&&k5(h)&&k5(v),V=!S&&W,Y=V&&X?K:null,ne=X?Y??(a??C)({rects:b,activeNodeRect:$,activeIndex:h,overIndex:v,index:A}):null,ee=k5(h)&&k5(v)?o({id:s,items:u,activeIndex:h,overIndex:v}):A,se=L?.id,ue=_.useRef({activeId:se,items:u,newIndex:ee,containerId:f}),te=u!==ue.current.items,Z=t({active:L,containerId:f,isDragging:W,isSorting:q,id:s,index:A,items:u,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:c,wasDragging:ue.current.activeId!=null}),re=pct({disabled:!Z,index:A,node:T,rect:D});return _.useEffect(()=>{q&&ue.current.newIndex!==ee&&(ue.current.newIndex=ee),f!==ue.current.containerId&&(ue.current.containerId=f),u!==ue.current.items&&(ue.current.items=u)},[q,ee,f,u]),_.useEffect(()=>{if(se===ue.current.activeId)return;if(se!=null&&ue.current.activeId==null){ue.current.activeId=se;return}const de=setTimeout(()=>{ue.current.activeId=se},50);return()=>clearTimeout(de)},[se]),{active:L,activeIndex:h,attributes:j,data:E,rect:D,index:A,newIndex:ee,items:u,isOver:I,isSorting:q,isDragging:W,listeners:N,node:T,overIndex:v,over:H,setNodeRef:B,setActivatorNodeRef:U,setDroppableNodeRef:F,setDraggableNodeRef:z,transform:re??ne,transition:oe()};function oe(){if(re||te&&ue.current.newIndex===A)return fct;if(!(V&&!wI(R)||!c)&&(q||Z))return sb.Transition.toString({...c,property:zle})}}function gct(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function DS(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 yct=[Ln.Down,Ln.Right,Ln.Up,Ln.Left],bct=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(yct.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case Ln.Down:r.top<h.top&&l.push(f);break;case Ln.Up:r.top>h.top&&l.push(f);break;case Ln.Left:r.left>h.left&&l.push(f);break;case Ln.Right:r.left<h.left&&l.push(f);break}});const c=Xat({collisionRect:r,droppableRects:i,droppableContainers:l});let u=Ale(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const f=o.get(n.id),h=o.get(u),g=h?i.get(h.id):null,y=h?.node.current;if(y&&g&&f&&h){const v=YC(y).some((O,D)=>a[D]!==O),S=Hle(f,h),C=vct(f,h),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},A={x:g.left,y:g.top};return w.x&&w.y?A:ob(A,w)}}}};function Hle(e,t){return!DS(e)||!DS(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function vct(e,t){return!DS(e)||!DS(t)||!Hle(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const xct=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=mct({id:e.id}),[l,c]=_.useState(!1);_.useEffect(()=>{Tw(e.id).then(c)},[e.id]);const u={transform:sb.Transform.toString(o),transition:s,opacity:a?.5:1};return m.jsx(tr,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:m.jsxs(gr,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[m.jsx(le,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:m.jsx(QCe,{})}),m.jsx(Et,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?m.jsx(le,{component:"img",src:i2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:MT(e),width:40,height:40,boxShadow:2},children:(()=>{const f=TT(e);return m.jsx(f,{sx:{fontSize:24}})})()}),m.jsxs(le,{sx:{flex:1},children:[m.jsx(ie,{variant:"subtitle1",fontWeight:500,children:e.name}),m.jsxs(ie,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Sct=()=>{const e=Tu(),{content:t,isLoading:n}=qm(),r=SCe(),[i,o]=_.useState([]),[s,a]=_.useState(!1);_.useEffect(()=>{if(t){const h=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(h),a(!1)}},[t]);const l=Gat(AK(kI),AK(EI,{coordinateGetter:bct})),c=_.useCallback(h=>{const{active:g,over:y}=h;y&&g.id!==y.id&&(o(b=>{const v=b.findIndex(C=>C.id===g.id),S=b.findIndex(C=>C.id===y.id);return _I(b,v,S)}),a(!0))},[]),u=_.useCallback(async()=>{const h=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(h),e.show({message:"Startup order saved successfully",severity:"success"}),a(!1)}catch(g){e.show({message:g instanceof Error?g.message:"Failed to save startup order",severity:"error"})}},[i,r,e]),f=_.useMemo(()=>i.map(h=>h.id),[i]);return n?m.jsx(ie,{children:"Loading..."}):m.jsxs(zt,{spacing:3,children:[m.jsx(dw,{items:[{name:"Bridges",to:jt.bridges},{name:"Startup Order",to:jt.startup}]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[m.jsx(sm,{color:"primary",fontSize:"large"}),m.jsxs(le,{children:[m.jsx(ie,{variant:"h5",fontWeight:600,children:"Startup Order"}),m.jsx(ie,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&m.jsx(kn,{severity:"info",action:m.jsx(kt,{color:"inherit",size:"small",startIcon:m.jsx(o6,{}),onClick:u,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),m.jsx(Ylt,{sensors:l,collisionDetection:Yat,onDragEnd:c,children:m.jsx(lct,{items:f,strategy:sct,children:m.jsx(zt,{spacing:1,children:i.map((h,g)=>m.jsx(xct,{bridge:h,index:g},h.id))})})}),i.length===0&&m.jsx(ie,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&m.jsx(le,{display:"flex",justifyContent:"flex-end",children:m.jsx(kt,{variant:"contained",startIcon:m.jsx(o6,{}),onClick:u,children:"Save Startup Order"})})]})},nk="https://riddix.github.io/home-assistant-matter-hub",jt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:nk,faq:{multiFabric:`${nk}/connect-multiple-fabrics`,bridgeConfig:`${nk}/bridge-configuration`}},wct=[{path:"",element:m.jsx(_2e,{}),children:[{path:"",element:m.jsx(c9e,{})},{path:jt.bridges,element:m.jsx(s9e,{})},{path:jt.createBridge,element:m.jsx(ZQe,{})},{path:jt.bridge(":bridgeId"),element:m.jsx(ICe,{})},{path:jt.editBridge(":bridgeId"),element:m.jsx(JQe,{})},{path:jt.devices,element:m.jsx(_9e,{})},{path:jt.networkMap,element:m.jsx(Dat,{})},{path:jt.health,element:m.jsx(set,{})},{path:jt.labels,element:m.jsx(det,{})},{path:jt.lockCredentials,element:m.jsx(yet,{})},{path:jt.settings,element:m.jsx(Rat,{})},{path:jt.startup,element:m.jsx(Sct,{})}]}],Cct={items:{isInitialized:!1,isLoading:!1}},Ect=VO(Cct,e=>{e.addCase(Fo.pending,t=>{t.items.isLoading=!0}).addCase(Fo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Fo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(BX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(HX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(UX.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(zX.fulfilled,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.meta.arg);r!==-1&&t.items.content.splice(r,1)}}).addCase(VX,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(WX,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.payload.id);r!==-1?t.items.content[r]=n.payload:t.items.content.push(n.payload)}})}),Act={byBridge:{}},kct=VO(Act,e=>{e.addCase(du.pending,(t,n)=>{t.byBridge[n.meta.arg]=rk(t.byBridge[n.meta.arg],n)}).addCase(du.rejected,(t,n)=>{t.byBridge[n.meta.arg]=rk(t.byBridge[n.meta.arg],n)}).addCase(du.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=rk(t.byBridge[n.meta.arg],n)})}),_ct={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},rk=VO(_ct,e=>{e.addCase(du.pending,t=>{t.isLoading=!0}).addCase(du.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(du.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),Dct=l2e({reducer:{bridges:Ect,devices:kct}}),DI=Wme({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ye(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>ot({props:e,name:"MuiContainer"})});function Oct(e){return et("MuiToolbar",e)}nt("MuiToolbar",["root","gutters","regular","dense"]);const Tct=e=>{const{classes:t,disableGutters:n,variant:r}=e;return tt({root:["root",!n&&"gutters",r]},Oct,t)},Mct=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ge(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}))),Ule=_.forwardRef(function(t,n){const r=ot({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=Tct(c);return m.jsx(Mct,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})}),Rct=[{name:"GitHub",url:jt.githubRepository},{name:"Documentation",url:jt.documentation}],Ict=()=>m.jsxs(DI,{sx:{mt:16,mb:4},children:[m.jsx(gi,{sx:{mt:4,mb:4}}),m.jsx(Qe,{container:!0,spacing:2,justifyContent:"center",children:Rct.map((e,t)=>m.jsx(Qe,{size:{xs:12,sm:"auto"},children:m.jsx(kt,{fullWidth:!0,size:"small",variant:"outlined",component:uw,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function Pct(e){return et("MuiAppBar",e)}nt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const jct=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return tt(i,Pct,r)},NK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,$ct=me(Nr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(Ge(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit",color:"var(--AppBar-color)"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Fn(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?NK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?NK(e.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundImage:"none"})}}]}))),Lct=_.forwardRef(function(t,n){const r=ot({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=jct(c);return m.jsx($ct,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function Nct(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=tl(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function Fct(e){return typeof e=="function"?e():e}function D5(e,t,n){const r=Fct(n),i=Nct(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Bct=_.forwardRef(function(t,n){const r=Oa(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:f=i,in:h,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Ta,...O}=t,D=_.useRef(null),T=Tr(mf(l),D,n),I=H=>U=>{H&&(U===void 0?H(D.current):H(D.current,U))},F=I((H,U)=>{D5(u,H,c),NO(H),g&&g(H,U)}),L=I((H,U)=>{const K=Kd({timeout:A,style:w,easing:f},{mode:"enter"});H.style.webkitTransition=r.transitions.create("-webkit-transform",{...K}),H.style.transition=r.transitions.create("transform",{...K}),H.style.webkitTransform="none",H.style.transform="none",b&&b(H,U)}),R=I(y),$=I(C),j=I(H=>{const U=Kd({timeout:A,style:w,easing:f},{mode:"exit"});H.style.webkitTransition=r.transitions.create("-webkit-transform",U),H.style.transition=r.transitions.create("transform",U),D5(u,H,c),v&&v(H)}),z=I(H=>{H.style.webkitTransition="",H.style.transition="",S&&S(H)}),N=H=>{s&&s(D.current,H)},W=_.useCallback(()=>{D.current&&D5(u,D.current,c)},[u,c]);return _.useEffect(()=>{if(h||u==="down"||u==="right")return;const H=PO(()=>{D.current&&D5(u,D.current,c)}),U=tl(D.current);return U.addEventListener("resize",H),()=>{H.clear(),U.removeEventListener("resize",H)}},[u,h,c]),_.useEffect(()=>{h||W()},[h,W]),m.jsx(E,{nodeRef:D,onEnter:F,onEntered:R,onEntering:L,onExit:j,onExited:z,onExiting:$,addEndListener:N,appear:a,in:h,timeout:A,...O,children:(H,{ownerState:U,...K})=>_.cloneElement(l,{ref:T,style:{visibility:H==="exited"&&!h?"hidden":void 0,...w,...l.props.style},...K})})});function zct(e){return et("MuiDrawer",e)}nt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Vle=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},Hct=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ye(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ye(n)}`,r!=="temporary"&&`paperAnchorDocked${ye(n)}`]};return tt(i,zct,t)},Uct=me(tT,{name:"MuiDrawer",slot:"Root",overridesResolver:Vle})(Ge(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Vct=me("div",{shouldForwardProp:ro,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Vle})({flex:"0 0 auto"}),Wct=me(Nr,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ye(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ye(n.anchor)}`]]}})(Ge(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:t})=>t.anchor==="left"&&t.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="top"&&t.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="right"&&t.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="bottom"&&t.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),Wle={left:"right",right:"left",top:"down",bottom:"up"};function qct(e){return["left","right"].includes(e)}function Gct({direction:e},t){return e==="rtl"&&qct(t)?Wle[t]:t}const Kct=_.forwardRef(function(t,n){const r=ot({props:t,name:"MuiDrawer"}),i=Oa(),o=pf(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:f=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:O={},slotProps:D={},...T}=r,I=_.useRef(!1);_.useEffect(()=>{I.current=!0},[]);const F=Gct({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:f,open:v,variant:E,...T},$=Hct(R),j={slots:{transition:w,...O},slotProps:{paper:S,transition:C,...D,backdrop:jO(D.backdrop||{...l,...g},{transitionDuration:A})}},[z,N]=ct("root",{ref:n,elementType:Uct,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...j,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:h,slots:{backdrop:j.slots.backdrop},slotProps:{backdrop:j.slotProps.backdrop}}}),[W,H]=ct("paper",{elementType:Wct,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:R,externalForwardedProps:j,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[U,K]=ct("docked",{elementType:Vct,ref:n,className:Oe($.root,$.docked,u),ownerState:R,externalForwardedProps:j,additionalProps:T}),[B,q]=ct("transition",{elementType:Bct,ownerState:R,externalForwardedProps:j,additionalProps:{in:v,direction:Wle[F],timeout:A,appear:I.current}}),X=m.jsx(W,{...H,children:c});if(E==="permanent")return m.jsx(U,{...K,children:X});const V=m.jsx(B,{...q,children:X});return E==="persistent"?m.jsx(U,{...K,children:V}):m.jsx(z,{...N,children:V})}),Yct=YY({themeId:ua}),ik={error:"#d32f2f",warn:"#ed6c02",info:"#0288d1",debug:"#7b1fa2"},Xct={error:bf,warn:aw,info:QO,debug:Dw},Zct=({open:e,onClose:t})=>{const[n,r]=_.useState([]),[i,o]=_.useState(!0),[s,a]=_.useState("error,warn,info".split(",")),[l,c]=_.useState(""),[u,f]=_.useState(!0),h=_.useCallback(async()=>{try{const S=new URLSearchParams({level:s.join(","),limit:"500",...l&&{search:l}}),C=await fetch(`api/logs?${S}`);if(C.ok){const w=await C.json();r(w.entries)}}catch(S){console.error("Failed to fetch logs:",S)}finally{o(!1)}},[s,l]);_.useEffect(()=>{e&&h()},[e,h]),_.useEffect(()=>{if(!u||!e)return;const S=setInterval(h,5e3);return()=>clearInterval(S)},[u,e,h]);const g=S=>{a(Array.isArray(S.target.value)?S.target.value:[S.target.value])},y=S=>{c(S.target.value)},b=async()=>{try{await fetch("api/logs",{method:"DELETE"}),r([])}catch(S){console.error("Failed to clear logs:",S)}},v=S=>{const C=Xct[S]||QO;return m.jsx(C,{sx:{fontSize:16,color:ik[S]}})};return m.jsxs(vu,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[m.jsxs(Su,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(Dw,{}),"System Logs",m.jsx(le,{sx:{flexGrow:1}}),m.jsx(cn,{title:"Auto Refresh",children:m.jsx(Et,{label:u?"Auto":"Manual",color:u?"success":"default",size:"small",onClick:()=>f(!u),sx:{cursor:"pointer"}})}),m.jsx(_n,{onClick:t,children:m.jsx(qCe,{})})]}),m.jsxs(xu,{children:[m.jsx(zt,{spacing:2,sx:{mb:2},children:m.jsxs(zt,{direction:"row",spacing:2,alignItems:"center",children:[m.jsxs(ha,{size:"small",sx:{minWidth:200},children:[m.jsx(sc,{children:"Log Level"}),m.jsxs(oa,{value:s,label:"Log Level",onChange:g,multiple:!0,renderValue:S=>m.jsx(le,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(S)?S:[S]).map(C=>m.jsx(Et,{label:C.toUpperCase(),size:"small",sx:{backgroundColor:ik[C],color:"white"}},C))}),children:[m.jsx(er,{value:"error",children:"Error"}),m.jsx(er,{value:"warn",children:"Warning"}),m.jsx(er,{value:"info",children:"Info"}),m.jsx(er,{value:"debug",children:"Debug"})]})]}),m.jsx(Lr,{size:"small",placeholder:"Search logs...",value:l,onChange:y,sx:{flexGrow:1}}),m.jsx(kt,{variant:"outlined",onClick:h,children:"Refresh"}),m.jsx(kt,{variant:"outlined",color:"error",onClick:b,children:"Clear"})]})}),m.jsx(le,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:i?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{children:"Loading logs..."})}):n.length===0?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(ie,{color:"text.secondary",children:"No logs found"})}):m.jsx(zt,{spacing:1,children:n.map((S,C)=>m.jsxs(le,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[v(S.level),m.jsx(ie,{variant:"caption",color:"text.secondary",children:new Date(S.timestamp).toLocaleString()}),m.jsx(Et,{label:S.level.toUpperCase(),size:"small",sx:{backgroundColor:ik[S.level],color:"white",fontSize:"0.7rem",height:20}})]}),m.jsx(ie,{sx:{ml:3},children:S.message}),S.context&&m.jsx(ie,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(S.context,null,2)})]},`${S.timestamp}-${S.level}-${C}`))})})]}),m.jsx(Xd,{children:m.jsx(kt,{onClick:t,children:"Close"})})]})};function FK(){const{isConnected:e}=A2e(),[t,n]=_.useState(null),[r,i]=_.useState(!1);_.useEffect(()=>{const y=async()=>{try{const v=await fetch("api/health");if(v.ok){const S=await v.json();n(S),i(!1)}else i(!0)}catch{i(!0)}};y();const b=setInterval(y,3e4);return()=>clearInterval(b)},[]);const o=y=>{const b=Math.floor(y/3600),v=Math.floor(y%3600/60);return b>0?`${b}h ${v}m`:`${v}m`},s=t?.status==="healthy"&&!r,a=t?.services?.bridges,l=a&&a.total>0&&a.running===a.total,c=a&&a.total===0,u=t?m.jsxs(le,{sx:{p:.5},children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&m.jsxs("div",{children:[m.jsx("strong",{children:"Bridges:"})," ",t.services.bridges.running??0,"/",t.services.bridges.total??0," running",(t.services.bridges.stopped??0)>0&&` (${t.services.bridges.stopped} stopped)`]}),t.services?.homeAssistant&&m.jsxs("div",{children:[m.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?m.jsx(bf,{fontSize:"small"}):l?m.jsx(Mu,{fontSize:"small"}):m.jsx(pw,{fontSize:"small"}),h=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?c?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return m.jsx(cn,{title:u,arrow:!0,children:m.jsx(Et,{icon:f(),label:g(),color:h(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Jct=e=>_.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},_.createElement("g",{style:{display:"inline"}},_.createElement("path",{style:{fill:"#18bcf2",fillOpacity:1,strokeWidth:.266194},d:"m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z"}),_.createElement("path",{style:{fill:"#ffffff",fillOpacity:1,strokeWidth:.175841},d:"m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z"}))),Qct="home-assistant-matter-hub",eut={name:Qct};function tut(){const[e,t]=_.useState("4.1.0-testing.21");return _.useEffect(()=>{fetch("api/health").then(n=>n.ok?n.json():null).then(n=>{n?.version&&t(n.version)}).catch(()=>{})},[]),_.useMemo(()=>({name:eut.name,version:e}),[e])}const nut=e=>{const t=tut();return m.jsxs(le,{component:Du,to:jt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[m.jsx(Jct,{style:{height:"40px"}}),m.jsx(ie,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&m.jsx(ie,{variant:"caption",component:"span",children:t.version})]})},rut=()=>{const e=Yct("(min-width:600px)"),{mode:t,setMode:n}=ZS(),[r,i]=_.useState(!1),[o,s]=_.useState(!1),a=Jh(),l=()=>{n(t==="dark"?"light":"dark")},c=[{label:"Dashboard",icon:m.jsx(e_,{}),to:jt.dashboard},{label:"Bridges",icon:m.jsx(py,{}),to:jt.bridges},{label:"All Devices",icon:m.jsx(ss,{}),to:jt.devices},{label:"Network Map",icon:m.jsx(r6,{}),to:jt.networkMap},{label:"Startup Order",icon:m.jsx(sm,{}),to:jt.startup},{label:"Lock Credentials",icon:m.jsx(ac,{}),to:jt.lockCredentials},{label:"Filter Reference",icon:m.jsx(i6,{}),to:jt.labels},{label:"Settings",icon:m.jsx(pm,{}),to:jt.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?m.jsx(a8e,{}):m.jsx(YCe,{}),onClick:l},{label:"System Logs",icon:m.jsx(Dw,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:m.jsx(X4,{}),to:jt.health}],u=f=>{s(!1),f.onClick?f.onClick():f.to&&a(f.to)};return m.jsxs(le,{children:[m.jsx(Lct,{sx:{height:"72px"},children:m.jsx(Ule,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:m.jsxs(DI,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsx(nut,{large:e}),e?m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1},children:[c.map(f=>f.to?m.jsx(cn,{title:f.label,children:m.jsx(_n,{component:Du,to:f.to,sx:{color:"inherit"},children:f.icon})},f.label):m.jsx(cn,{title:f.label,children:m.jsx(_n,{onClick:f.onClick,sx:{color:"inherit"},children:f.icon})},f.label)),m.jsx(FK,{})]}):m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(FK,{}),m.jsx(_n,{onClick:()=>s(!0),sx:{color:"inherit"},children:m.jsx(l8e,{})})]})]})})}),m.jsx(Kct,{anchor:"right",open:o,onClose:()=>s(!1),children:m.jsx(vc,{sx:{width:250},children:c.map(f=>m.jsxs(obe,{onClick:()=>u(f),children:[m.jsx(Ul,{children:f.icon}),m.jsx(Va,{primary:f.label})]},f.label))})}),m.jsx(Zct,{open:r,onClose:()=>i(!1)})]})},iut=()=>m.jsxs(le,{children:[m.jsx(rut,{}),m.jsx(Ule,{}),m.jsx(DI,{sx:{p:2},children:m.jsx(gY,{})}),m.jsx(Ict,{})]}),out=KS({colorSchemes:{light:{palette:{primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2"},background:{default:"#f5f5f5",paper:"#ffffff"}}},dark:{palette:{primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5"},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc"},background:{default:"#121212",paper:"#1e1e1e"}}}},typography:{fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',h1:{fontSize:"2.5rem",fontWeight:500},h2:{fontSize:"2rem",fontWeight:500},h3:{fontSize:"1.75rem",fontWeight:500},h4:{fontSize:"1.5rem",fontWeight:500},h5:{fontSize:"1.25rem",fontWeight:500},h6:{fontSize:"1rem",fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-2px)",boxShadow:"0 4px 20px rgba(0,0,0,0.12)"}}}},MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:"none"}}}}});let D4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");D4?.startsWith("http")&&(D4=new URL(D4).pathname);const sut=Hhe([{path:"/",element:m.jsx(iut,{}),children:wct}],{basename:D4});sde.createRoot(document.getElementById("root")).render(m.jsx(_.StrictMode,{children:m.jsx(Cde,{store:Dct,children:m.jsxs(n1e,{theme:out,children:[m.jsx(Zge,{}),m.jsx(uX,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:"initial !important",flexGrow:1}}}),m.jsx(k2e,{children:m.jsx(yye,{children:m.jsx(epe,{router:sut})})})]})})}));
@@ -8,7 +8,7 @@
8
8
  <!-- BASE -->
9
9
  <base href="/" />
10
10
  <!-- /BASE -->
11
- <script type="module" crossorigin src="./assets/index-Dx1lsXdy.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-kSFnPzuV.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="./assets/index-BNdBOwwe.css">
13
13
  </head>
14
14
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riddix/hamh",
3
3
  "description": "",
4
- "version": "2.1.0-alpha.423",
4
+ "version": "4.1.0-testing.21",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "bin": {
@@ -57,9 +57,9 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/lodash-es": "^4.17.12",
60
- "@home-assistant-matter-hub/backend": "2.1.0-alpha.423",
61
- "@home-assistant-matter-hub/common": "2.1.0-alpha.423",
62
- "@home-assistant-matter-hub/frontend": "2.1.0-alpha.423"
60
+ "@home-assistant-matter-hub/backend": "4.1.0-testing.21",
61
+ "@home-assistant-matter-hub/common": "4.1.0-testing.21",
62
+ "@home-assistant-matter-hub/frontend": "4.1.0-testing.21"
63
63
  },
64
64
  "nx": {
65
65
  "targets": {