@riddix/hamh 2.1.0-alpha.700 → 2.1.0-alpha.701
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.
|
@@ -145,7 +145,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
145
145
|
animation: ${Ih} 1.4s linear infinite;
|
|
146
146
|
`,Ate=typeof Lh==`string`?null:ed`
|
|
147
147
|
animation: ${Lh} 1.4s ease-in-out infinite;
|
|
148
|
-
`,jte=e=>{let{classes:t,variant:n,color:r,disableShrink:i}=e;return fp({root:[`root`,n,`color${Y(r)}`],svg:[`svg`],track:[`track`],circle:[`circle`,`circle${Y(n)}`,i&&`circleDisableShrink`]},Ote,t)},Mte=J(`span`,{name:`MuiCircularProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`color${Y(n.color)}`]]}})(Pm(({theme:e})=>({display:`inline-block`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`transform`)}},{props:{variant:`indeterminate`},style:kte||{animation:`${Ih} 1.4s linear infinite`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))]}))),Nte=J(`svg`,{name:`MuiCircularProgress`,slot:`Svg`})({display:`block`}),Pte=J(`circle`,{name:`MuiCircularProgress`,slot:`Circle`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.circle,t[`circle${Y(n.variant)}`],n.disableShrink&&t.circleDisableShrink]}})(Pm(({theme:e})=>({stroke:`currentColor`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`stroke-dashoffset`)}},{props:{variant:`indeterminate`},style:{strokeDasharray:`80px, 200px`,strokeDashoffset:0}},{props:({ownerState:e})=>e.variant===`indeterminate`&&!e.disableShrink,style:Ate||{animation:`${Lh} 1.4s ease-in-out infinite`}}]}))),Fte=J(`circle`,{name:`MuiCircularProgress`,slot:`Track`})(Pm(({theme:e})=>({stroke:`currentColor`,opacity:(e.vars||e).palette.action.activatedOpacity}))),Rh=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCircularProgress`}),{className:r,color:i=`primary`,disableShrink:a=!1,enableTrackSlot:o=!1,size:s=40,style:c,thickness:l=3.6,value:u=0,variant:d=`indeterminate`,...f}=n,p={...n,color:i,disableShrink:a,size:s,thickness:l,value:u,variant:d,enableTrackSlot:o},m=jte(p),h={},g={},_={};if(d===`determinate`){let e=2*Math.PI*((Fh-l)/2);h.strokeDasharray=e.toFixed(3),_[`aria-valuenow`]=Math.round(u),h.strokeDashoffset=`${((100-u)/100*e).toFixed(3)}px`,g.transform=`rotate(-90deg)`}return(0,G.jsx)(Mte,{className:K(m.root,r),style:{width:s,height:s,...g,...c},ownerState:p,ref:t,role:`progressbar`,..._,...f,children:(0,G.jsxs)(Nte,{className:m.svg,ownerState:p,viewBox:`${Fh/2} ${Fh/2} ${Fh} ${Fh}`,children:[o?(0,G.jsx)(Fte,{className:m.track,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l,"aria-hidden":`true`}):null,(0,G.jsx)(Pte,{className:m.circle,style:h,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l})]})})});function Ite(e){return Id(`MuiIconButton`,e)}var zh=Ld(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),Lte=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return fp({root:[`root`,o&&`loading`,n&&`disabled`,r!==`default`&&`color${Y(r)}`,i&&`edge${Y(i)}`,`size${Y(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},Ite,t)},Rte=J(Nh,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!==`default`&&t[`color${Y(n.color)}`],n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})(Pm(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),Pm(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${zh.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${zh.loading}`]:{color:`transparent`}}))),zte=J(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),Bh=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=rh(u),h=f??(0,G.jsx)(Rh,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=Lte(g);return(0,G.jsxs)(Rte,{id:d?m:u,className:K(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,G.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,G.jsx)(zte,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),Bte=X((0,G.jsx)(`path`,{d:`M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z`}),`SuccessOutlined`),Vte=X((0,G.jsx)(`path`,{d:`M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z`}),`ReportProblemOutlined`),Hte=X((0,G.jsx)(`path`,{d:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z`}),`ErrorOutline`),Ute=X((0,G.jsx)(`path`,{d:`M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z`}),`InfoOutlined`),Vh=X((0,G.jsx)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),Wte=e=>{let{variant:t,color:n,severity:r,classes:i}=e;return fp({root:[`root`,`color${Y(n||r)}`,`${t}${Y(n||r)}`,`${t}`],icon:[`icon`],message:[`message`],action:[`action`]},$ee,i)},Gte=J(Wm,{name:`MuiAlert`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color||n.severity)}`]]}})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?e.darken:e.lighten,n=e.palette.mode===`light`?e.lighten:e.darken;return{...e.typography.body2,backgroundColor:`transparent`,display:`flex`,padding:`6px 16px`,variants:[...Object.entries(e.palette).filter(Um([`light`])).map(([r])=>({props:{colorSeverity:r,variant:`standard`},style:{color:e.vars?e.vars.palette.Alert[`${r}Color`]:t(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:n(e.palette[r].light,.9),[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}}})),...Object.entries(e.palette).filter(Um([`light`])).map(([n])=>({props:{colorSeverity:n,variant:`outlined`},style:{color:e.vars?e.vars.palette.Alert[`${n}Color`]:t(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}}})),...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{colorSeverity:t,variant:`filled`},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:e.palette.mode===`dark`?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}}))]}})),Kte=J(`div`,{name:`MuiAlert`,slot:`Icon`})({marginRight:12,padding:`7px 0`,display:`flex`,fontSize:22,opacity:.9}),qte=J(`div`,{name:`MuiAlert`,slot:`Message`})({padding:`8px 0`,minWidth:0,overflow:`auto`}),Jte=J(`div`,{name:`MuiAlert`,slot:`Action`})({display:`flex`,alignItems:`flex-start`,padding:`4px 0 0 16px`,marginLeft:`auto`,marginRight:-8}),Hh={success:(0,G.jsx)(Bte,{fontSize:`inherit`}),warning:(0,G.jsx)(Vte,{fontSize:`inherit`}),error:(0,G.jsx)(Hte,{fontSize:`inherit`}),info:(0,G.jsx)(Ute,{fontSize:`inherit`})},Uh=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiAlert`}),{action:r,children:i,className:a,closeText:o=`Close`,color:s,components:c={},componentsProps:l={},icon:u,iconMapping:d=Hh,onClose:f,role:p=`alert`,severity:m=`success`,slotProps:h={},slots:g={},variant:_=`standard`,...v}=n,y={...n,color:s,severity:m,variant:_,colorSeverity:s||m},b=Wte(y),x={slots:{closeButton:c.CloseButton,closeIcon:c.CloseIcon,...g},slotProps:{...l,...h}},[S,C]=Hm(`root`,{ref:t,shouldForwardComponentProp:!0,className:K(b.root,a),elementType:Gte,externalForwardedProps:{...x,...v},ownerState:y,additionalProps:{role:p,elevation:0}}),[w,T]=Hm(`icon`,{className:b.icon,elementType:Kte,externalForwardedProps:x,ownerState:y}),[E,D]=Hm(`message`,{className:b.message,elementType:qte,externalForwardedProps:x,ownerState:y}),[O,k]=Hm(`action`,{className:b.action,elementType:Jte,externalForwardedProps:x,ownerState:y}),[A,j]=Hm(`closeButton`,{elementType:Bh,externalForwardedProps:x,ownerState:y}),[M,N]=Hm(`closeIcon`,{elementType:Vh,externalForwardedProps:x,ownerState:y});return(0,G.jsxs)(S,{...C,children:[u===!1?null:(0,G.jsx)(w,{...T,children:u||d[m]||Hh[m]}),(0,G.jsx)(E,{...D,children:i}),r==null?null:(0,G.jsx)(O,{...k,children:r}),r==null&&f?(0,G.jsx)(O,{...k,children:(0,G.jsx)(A,{size:`small`,"aria-label":o,title:o,color:`inherit`,onClick:f,...j,children:(0,G.jsx)(M,{fontSize:`small`,...N})})}):null]})});function Yte(e={}){let{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:i,resumeHideDuration:a}=e,o=Ah();C.useEffect(()=>{if(!i)return;function e(e){e.defaultPrevented||e.key===`Escape`&&r?.(e,`escapeKeyDown`)}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[i,r]);let s=oh((e,t)=>{r?.(e,t)}),c=oh(e=>{!r||e==null||o.start(e,()=>{s(null,`timeout`)})});C.useEffect(()=>(i&&c(t),o.clear),[i,t,c,o]);let l=e=>{r?.(e,`clickaway`)},u=o.clear,d=C.useCallback(()=>{t!=null&&c(a??t*.5)},[t,a,c]),f=e=>t=>{let n=e.onBlur;n?.(t),d()},p=e=>t=>{let n=e.onFocus;n?.(t),u()},m=e=>t=>{let n=e.onMouseEnter;n?.(t),u()},h=e=>t=>{let n=e.onMouseLeave;n?.(t),d()};return C.useEffect(()=>{if(!n&&i)return window.addEventListener(`focus`,d),window.addEventListener(`blur`,u),()=>{window.removeEventListener(`focus`,d),window.removeEventListener(`blur`,u)}},[n,i,d,u]),{getRootProps:(t={})=>{let n={...zm(e),...zm(t)};return{role:`presentation`,...t,...n,onBlur:f(n),onFocus:p(n),onMouseEnter:m(n),onMouseLeave:h(n)}},onClickAway:l}}function Wh(e){return e?.props?.ref||null}function Gh(e){return e.substring(2).toLowerCase()}function Xte(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function Kh(e){let{children:t,disableReactTree:n=!1,mouseEvent:r=`onClick`,onClickAway:i,touchEvent:a=`onTouchEnd`}=e,o=C.useRef(!1),s=C.useRef(null),c=C.useRef(!1),l=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{c.current=!0},0),()=>{c.current=!1}),[]);let u=Fm(Wh(t),s),d=oh(e=>{let t=l.current;l.current=!1;let r=Zm(s.current);if(!c.current||!s.current||`clientX`in e&&Xte(e,r))return;if(o.current){o.current=!1;return}let a;a=e.composedPath?e.composedPath().includes(s.current):!r.documentElement.contains(e.target)||s.current.contains(e.target),!a&&(n||!t)&&i(e)}),f=e=>n=>{l.current=!0;let r=t.props[e];r&&r(n)},p={ref:u};return a!==!1&&(p[a]=f(a)),C.useEffect(()=>{if(a!==!1){let e=Gh(a),t=Zm(s.current),n=()=>{o.current=!0};return t.addEventListener(e,d),t.addEventListener(`touchmove`,n),()=>{t.removeEventListener(e,d),t.removeEventListener(`touchmove`,n)}}},[d,a]),r!==!1&&(p[r]=f(r)),C.useEffect(()=>{if(r!==!1){let e=Gh(r),t=Zm(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}},[d,r]),C.cloneElement(t,p)}var qh=e=>e.scrollTop;function Jh(e,t){return n=>{if(t){let r=e.current;n===void 0?t(r):t(r,n)}}}function Yh(e,t,n,r,i,a){let o=e===`exited`&&!t?r:n[e]||n.exited;return i||a?{...o,...i,...a}:o}function Xh(e,t){let{timeout:n,easing:r,style:i={}}=e;return{duration:i.transitionDuration??(typeof n==`number`?n:n[t.mode]||0),easing:i.transitionTimingFunction??(typeof r==`object`?r[t.mode]:r),delay:i.transitionDelay}}function Zh(e){return`scale(${e}, ${e**2})`}var Zte={entering:{opacity:1,transform:Zh(1)},entered:{opacity:1,transform:`none`},exiting:{opacity:0,transform:Zh(.75)},exited:{opacity:0,transform:Zh(.75)}},Qte={opacity:0,transform:Zh(.75),visibility:`hidden`},Qh=C.forwardRef(function(e,t){let{addEndListener:n,appear:r=!0,children:i,easing:a,in:o,onEnter:s,onEntered:c,onEntering:l,onExit:u,onExited:d,onExiting:f,style:p,timeout:m=`auto`,...h}=e,g=Ah(),_=C.useRef(),v=Cm(),y=C.useRef(null),b=ch(y,Wh(i),t),x=Jh(y,l),S=Jh(y,(e,t)=>{qh(e);let{duration:n,delay:r,easing:i}=Xh({style:p,timeout:m,easing:a},{mode:`enter`}),o;m===`auto`?(o=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=o):o=n,e.style.transition=[v.transitions.create(`opacity`,{duration:o,delay:r}),v.transitions.create(`transform`,{duration:o*.666,delay:r,easing:i})].join(`,`),s&&s(e,t)}),w=Jh(y,c),T=Jh(y,f),E=Jh(y,e=>{let{duration:t,delay:n,easing:r}=Xh({style:p,timeout:m,easing:a},{mode:`exit`}),i;m===`auto`?(i=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=i):i=t,e.style.transition=[v.transitions.create(`opacity`,{duration:i,delay:n}),v.transitions.create(`transform`,{duration:i*.666,delay:n||i*.333,easing:r})].join(`,`),e.style.opacity=0,e.style.transform=Zh(.75),u&&u(e)}),D=Jh(y,e=>{e.style.transition=``,d&&d(e)});return(0,G.jsx)(wh,{appear:r,in:o,nodeRef:y,onEnter:S,onEntered:w,onEntering:x,onExit:E,onExited:D,onExiting:T,addEndListener:e=>{m===`auto`&&g.start(_.current||0,e),n&&n(y.current,e)},timeout:m===`auto`?null:m,...h,children:(e,{ownerState:t,...n})=>{let r=Yh(e,o,Zte,Qte,p,i.props.style);return C.cloneElement(i,{style:r,ref:b,...n})}})});Qh&&(Qh.muiSupportAuto=!0);function $te(e){return Id(`MuiSnackbarContent`,e)}Ld(`MuiSnackbarContent`,[`root`,`message`,`action`]);var ene=e=>{let{classes:t}=e;return fp({root:[`root`],action:[`action`],message:[`message`]},$te,t)},tne=J(Wm,{name:`MuiSnackbarContent`,slot:`Root`})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Sf(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Sf(e.palette.background.default,t),display:`flex`,alignItems:`center`,flexWrap:`wrap`,padding:`6px 16px`,flexGrow:1,[e.breakpoints.up(`sm`)]:{flexGrow:`initial`,minWidth:288}}})),nne=J(`div`,{name:`MuiSnackbarContent`,slot:`Message`})({padding:`8px 0`}),rne=J(`div`,{name:`MuiSnackbarContent`,slot:`Action`})({display:`flex`,alignItems:`center`,marginLeft:`auto`,paddingLeft:16,marginRight:-8}),ine=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiSnackbarContent`}),{action:r,className:i,message:a,role:o=`alert`,...s}=n,c=n,l=ene(c);return(0,G.jsxs)(tne,{role:o,elevation:6,className:K(l.root,i),ownerState:c,ref:t,...s,children:[(0,G.jsx)(nne,{className:l.message,ownerState:c,children:a}),r?(0,G.jsx)(rne,{className:l.action,ownerState:c,children:r}):null]})});function ane(e){return Id(`MuiSnackbar`,e)}Ld(`MuiSnackbar`,[`root`,`anchorOriginTopCenter`,`anchorOriginBottomCenter`,`anchorOriginTopRight`,`anchorOriginBottomRight`,`anchorOriginTopLeft`,`anchorOriginBottomLeft`]);var one=e=>{let{classes:t,anchorOrigin:n}=e;return fp({root:[`root`,`anchorOrigin${Y(n.vertical)}${Y(n.horizontal)}`]},ane,t)},sne=J(`div`,{name:`MuiSnackbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`anchorOrigin${Y(n.anchorOrigin.vertical)}${Y(n.anchorOrigin.horizontal)}`]]}})(Pm(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:`fixed`,display:`flex`,left:8,right:8,justifyContent:`center`,alignItems:`center`,variants:[{props:({ownerState:e})=>e.anchorOrigin.vertical===`top`,style:{top:8,[e.breakpoints.up(`sm`)]:{top:24}}},{props:({ownerState:e})=>e.anchorOrigin.vertical!==`top`,style:{bottom:8,[e.breakpoints.up(`sm`)]:{bottom:24}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`left`,style:{justifyContent:`flex-start`,[e.breakpoints.up(`sm`)]:{left:24,right:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`right`,style:{justifyContent:`flex-end`,[e.breakpoints.up(`sm`)]:{right:24,left:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`center`,style:{[e.breakpoints.up(`sm`)]:{left:`50%`,right:`auto`,transform:`translateX(-50%)`}}}]}))),$h=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiSnackbar`}),r=Cm(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:o,horizontal:s}={vertical:`bottom`,horizontal:`left`},autoHideDuration:c=null,children:l,className:u,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:p=!1,message:m,onBlur:h,onClose:g,onFocus:_,onMouseEnter:v,onMouseLeave:y,open:b,resumeHideDuration:x,slots:S={},slotProps:w={},TransitionComponent:T,transitionDuration:E=i,TransitionProps:{onEnter:D,onExited:O,...k}={},...A}=n,j={...n,anchorOrigin:{vertical:o,horizontal:s},autoHideDuration:c,disableWindowBlurListener:p,TransitionComponent:T,transitionDuration:E},M=one(j),{getRootProps:N,onClickAway:P}=Yte(j),[F,I]=C.useState(!0),L=e=>{I(!0),O&&O(e)},R=(e,t)=>{I(!1),D&&D(e,t)},ee={slots:{transition:T,...S},slotProps:{content:f,clickAwayListener:d,transition:k,...w}},[z,te]=Hm(`root`,{ref:t,className:[M.root,u],elementType:sne,getSlotProps:N,externalForwardedProps:{...ee,...A},ownerState:j}),[B,{ownerState:V,...ne}]=Hm(`clickAwayListener`,{elementType:Kh,externalForwardedProps:ee,getSlotProps:e=>({onClickAway:(...t)=>{let n=t[0];e.onClickAway?.(...t),!n?.defaultMuiPrevented&&P(...t)}}),ownerState:j}),[re,ie]=Hm(`content`,{elementType:ine,shouldForwardComponentProp:!0,externalForwardedProps:ee,additionalProps:{message:m,action:a},ownerState:j}),[ae,oe]=Hm(`transition`,{elementType:Qh,externalForwardedProps:ee,getSlotProps:e=>({onEnter:(...t)=>{e.onEnter?.(...t),R(...t)},onExited:(...t)=>{e.onExited?.(...t),L(...t)}}),additionalProps:{appear:!0,in:b,timeout:E,direction:o===`top`?`down`:`up`},ownerState:j});return!b&&F?null:(0,G.jsx)(B,{...ne,...S.clickAwayListener&&{ownerState:V},children:(0,G.jsx)(z,{...te,children:(0,G.jsx)(ae,{...oe,children:l||(0,G.jsx)(re,{...ie})})})})}),eg=(0,C.createContext)({show:()=>{}}),cne=0,lne=e=>{let[t,n]=(0,C.useState)([]),r=(0,C.useCallback)(e=>{n(t=>[...t,{...e,autoHideDuration:e.autoHideDuration??6e3,notificationId:cne++}])},[]),i=e=>{n(t=>t.filter(t=>t.notificationId!==e))};return(0,G.jsxs)(eg.Provider,{value:{show:r},children:[e.children,t.map(e=>(0,G.jsx)($h,{open:!0,autoHideDuration:e.autoHideDuration,onClose:()=>i(e.notificationId),children:(0,G.jsx)(Uh,{severity:e.severity,variant:`filled`,sx:{minWidth:`300px`},children:e.message})},e.notificationId))]})};function tg(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ng=typeof Symbol==`function`&&Symbol.observable||`@@observable`,rg=()=>Math.random().toString(36).substring(7).split(``).join(`.`),ig={INIT:`@@redux/INIT${rg()}`,REPLACE:`@@redux/REPLACE${rg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${rg()}`};function ag(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function og(e,t,n){if(typeof e!=`function`)throw Error(tg(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(tg(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(tg(1));return n(og)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(tg(3));return i}function d(e){if(typeof e!=`function`)throw Error(tg(4));if(c)throw Error(tg(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(tg(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!ag(e))throw Error(tg(7));if(e.type===void 0)throw Error(tg(8));if(typeof e.type!=`string`)throw Error(tg(17));if(c)throw Error(tg(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(tg(10));r=e,f({type:ig.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(tg(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[ng](){return this}}}return f({type:ig.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[ng]:m}}function une(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:ig.INIT})===void 0)throw Error(tg(12));if(n(void 0,{type:ig.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(tg(13))})}function dne(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{une(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(tg(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function sg(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function fne(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(tg(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=sg(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function pne(e){return ag(e)&&`type`in e&&typeof e.type==`string`}var cg=Symbol.for(`immer-nothing`),lg=Symbol.for(`immer-draftable`),ug=Symbol.for(`immer-state`);function dg(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fg=Object,pg=fg.getPrototypeOf,mg=`constructor`,hg=`prototype`,gg=`configurable`,_g=`enumerable`,vg=`writable`,yg=`value`,bg=e=>!!e&&!!e[ug];function xg(e){return e?Cg(e)||kg(e)||!!e[lg]||!!e[mg]?.[lg]||Ag(e)||jg(e):!1}var mne=fg[hg][mg].toString(),Sg=new WeakMap;function Cg(e){if(!e||!Mg(e))return!1;let t=pg(e);if(t===null||t===fg[hg])return!0;let n=fg.hasOwnProperty.call(t,mg)&&t[mg];if(n===Object)return!0;if(!Ng(n))return!1;let r=Sg.get(n);return r===void 0&&(r=Function.toString.call(n),Sg.set(n,r)),r===mne}function wg(e,t,n=!0){Tg(e)===0?(n?Reflect.ownKeys(e):fg.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Tg(e){let t=e[ug];return t?t.type_:kg(e)?1:Ag(e)?2:jg(e)?3:0}var Eg=(e,t,n=Tg(e))=>n===2?e.has(t):fg[hg].hasOwnProperty.call(e,t),Dg=(e,t,n=Tg(e))=>n===2?e.get(t):e[t],Og=(e,t,n,r=Tg(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function hne(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var kg=Array.isArray,Ag=e=>e instanceof Map,jg=e=>e instanceof Set,Mg=e=>typeof e==`object`,Ng=e=>typeof e==`function`,Pg=e=>typeof e==`boolean`;function gne(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Fg=e=>e.copy_||e.base_,Ig=e=>e.modified_?e.copy_:e.base_;function Lg(e,t){if(Ag(e))return new Map(e);if(jg(e))return new Set(e);if(kg(e))return Array[hg].slice.call(e);let n=Cg(e);if(t===!0||t===`class_only`&&!n){let t=fg.getOwnPropertyDescriptors(e);delete t[ug];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[vg]===!1&&(a[vg]=!0,a[gg]=!0),(a.get||a.set)&&(t[i]={[gg]:!0,[vg]:!0,[_g]:a[_g],[yg]:e[i]})}return fg.create(pg(e),t)}else{let t=pg(e);if(t!==null&&n)return{...e};let r=fg.create(t);return fg.assign(r,e)}}function Rg(e,t=!1){return Bg(e)||bg(e)||!xg(e)?e:(Tg(e)>1&&fg.defineProperties(e,{set:zg,add:zg,clear:zg,delete:zg}),fg.freeze(e),t&&wg(e,(e,t)=>{Rg(t,!0)},!1),e)}function _ne(){dg(2)}var zg={[yg]:_ne};function Bg(e){return e===null||!Mg(e)?!0:fg.isFrozen(e)}var Vg=`MapSet`,Hg=`Patches`,Ug=`ArrayMethods`,Wg={};function Gg(e){let t=Wg[e];return t||dg(0,e),t}var Kg=e=>!!Wg[e],qg,Jg=()=>qg,vne=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kg(Vg)?Gg(Vg):void 0,arrayMethodsPlugin_:Kg(Ug)?Gg(Ug):void 0});function Yg(e,t){t&&(e.patchPlugin_=Gg(Hg),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xg(e){Zg(e),e.drafts_.forEach(yne),e.drafts_=null}function Zg(e){e===qg&&(qg=e.parent_)}var Qg=e=>qg=vne(qg,e);function yne(e){let t=e[ug];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $g(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[ug].modified_&&(Xg(t),dg(4)),xg(e)&&(e=e_(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ug].base_,e,t)}else e=e_(t,n);return bne(t,e,!0),Xg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===cg?void 0:e}function e_(e,t){if(Bg(t))return t;let n=t[ug];if(!n)return a_(t,e.handledSet_,e);if(!n_(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);i_(n,e)}return n.copy_}function bne(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rg(t,n)}function t_(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var n_=(e,t)=>e.scope_===t,xne=[];function r_(e,t,n,r){let i=Fg(e),a=e.type_;if(r!==void 0&&Dg(i,r,a)===t){Og(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;wg(i,(e,n)=>{if(bg(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??xne;for(let e of o)Og(i,e,n,a)}function Sne(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!n_(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Ig(i);r_(e,i.draft_??i,a,n),i_(i,r)})}function i_(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}t_(e)}}function Cne(e,t,n){let{scope_:r}=e;if(bg(n)){let i=n[ug];n_(i,r)&&i.callbacks_.push(function(){d_(e),r_(e,n,Ig(i),t)})}else xg(n)&&e.callbacks_.push(function(){let i=Fg(e);e.type_===3?i.has(n)&&a_(n,r.handledSet_,r):Dg(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&a_(Dg(e.copy_,t,e.type_),r.handledSet_,r)})}function a_(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||bg(e)||t.has(e)||!xg(e)||Bg(e)?e:(t.add(e),wg(e,(r,i)=>{if(bg(i)){let t=i[ug];n_(t,n)&&(Og(e,r,Ig(t),e.type_),t_(t))}else xg(i)&&a_(i,t,n)}),e)}function wne(e,t){let n=kg(e),r={type_:+!!n,scope_:t?t.scope_:Jg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=o_;n&&(i=[r],a=s_);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var o_={get(e,t){if(t===ug)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Fg(e);if(!Eg(i,t,e.type_))return Tne(e,i,t);let a=i[t];if(e.finalized_||!xg(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&gne(t))return a;if(a===c_(e.base_,t)){d_(e);let n=e.type_===1?+t:t,r=f_(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Fg(e)},ownKeys(e){return Reflect.ownKeys(Fg(e))},set(e,t,n){let r=l_(Fg(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=c_(Fg(e),t),i=r?.[ug];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(hne(n,r)&&(n!==void 0||Eg(e.base_,t,e.type_)))return!0;d_(e),u_(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Cne(e,t,n),!0)},deleteProperty(e,t){return d_(e),c_(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),u_(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Fg(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[vg]:!0,[gg]:e.type_!==1||t!==`length`,[_g]:r[_g],[yg]:n[t]}},defineProperty(){dg(11)},getPrototypeOf(e){return pg(e.base_)},setPrototypeOf(){dg(12)}},s_={};for(let e in o_){let t=o_[e];s_[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}s_.deleteProperty=function(e,t){return s_.set.call(this,e,t,void 0)},s_.set=function(e,t,n){return o_.set.call(this,e[0],t,n,e[0])};function c_(e,t){let n=e[ug];return(n?Fg(n):e)[t]}function Tne(e,t,n){let r=l_(t,n);return r?yg in r?r[yg]:r.get?.call(e.draft_):void 0}function l_(e,t){if(!(t in e))return;let n=pg(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pg(n)}}function u_(e){e.modified_||(e.modified_=!0,e.parent_&&u_(e.parent_))}function d_(e){e.copy_||=(e.assigned_=new Map,Lg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ene=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ng(e)&&!Ng(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ng(t)||dg(6),n!==void 0&&!Ng(n)&&dg(7);let r;if(xg(e)){let i=Qg(this),a=f_(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Xg(i):Zg(i)}return Yg(i,n),$g(r,i)}else if(!e||!Mg(e)){if(r=t(e),r===void 0&&(r=e),r===cg&&(r=void 0),this.autoFreeze_&&Rg(r,!0),n){let t=[],i=[];Gg(Hg).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else dg(1,e)},this.produceWithPatches=(e,t)=>{if(Ng(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Pg(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Pg(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Pg(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xg(e)||dg(8),bg(e)&&(e=Dne(e));let t=Qg(this),n=f_(t,e,void 0);return n[ug].isManual_=!0,Zg(t),n}finishDraft(e,t){let n=e&&e[ug];(!n||!n.isManual_)&&dg(9);let{scope_:r}=n;return Yg(r,t),$g(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Gg(Hg).applyPatches_;return bg(e)?r(e,t):this.produce(e,e=>r(e,t))}};function f_(e,t,n,r){let[i,a]=Ag(t)?Gg(Vg).proxyMap_(t,n):jg(t)?Gg(Vg).proxySet_(t,n):wne(t,n);return(n?.scope_??Jg()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Sne(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function Dne(e){return bg(e)||dg(10,e),p_(e)}function p_(e){if(!xg(e)||Bg(e))return e;let t=e[ug],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Lg(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Lg(e,!0);return wg(n,(e,t)=>{Og(n,e,p_(t))},r),t&&(t.finalized_=!1),n}var m_=new Ene().produce,h_=Symbol(`NOT_FOUND`);function One(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function kne(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Ane(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var g_=e=>Array.isArray(e)?e:[e];function jne(e){let t=Array.isArray(e[0])?e[0]:e;return Ane(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Mne(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function Nne(e){let t;return{get(n){return t&&e(t.key,n)?t.value:h_},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Pne(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return h_}function i(t,i){r(t)===h_&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var Fne=(e,t)=>e===t;function Ine(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function Lne(e,t){let{equalityCheck:n=Fne,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Ine(n),o=0,s=r<=1?Nne(a):Pne(r,a);function c(){let t=s.get(arguments);if(t===h_){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Rne=class{constructor(e){this.value=e}deref(){return this.value}},zne=typeof WeakRef<`u`?WeakRef:Rne,Bne=0,__=1;function v_(){return{s:Bne,v:void 0,o:null,p:null}}function y_(e,t={}){let n=v_(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}}let s=t,c;if(t.s===__)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new zne(c):c}return s.s=__,s.v=c,c}return o.clearCache=()=>{n=v_(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function b_(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),One(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=y_,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=g_(c),p=g_(u),m=jne(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Mne(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var x_=b_(y_),Vne=Object.assign((e,t=x_)=>{kne(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Vne});function S_(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Hne=S_(),Une=S_,Wne=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?sg:sg.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Gne=e=>e&&typeof e.match==`function`;function C_(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(P_(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>pne(t)&&t.type===e,n}var w_=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function T_(e){return xg(e)?m_(e,()=>{}):e}function Kne(e){return typeof e==`boolean`}var qne=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new w_;return t&&(Kne(t)?a.push(Hne):a.push(Une(t.extraArgument))),a},Jne=`RTK_autoBatch`,E_=e=>t=>{setTimeout(t,e)},Yne=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?window.requestAnimationFrame:E_(10):e.type===`callback`?e.queueNotification:E_(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Jne],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},Xne=e=>function(t){let{autoBatch:n=!0}=t??{},r=new w_(e);return n&&r.push(Yne(typeof n==`object`?n:void 0)),r};function Zne(e){let t=qne(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(ag(n))c=dne(n);else throw Error(P_(1));let l;l=typeof r==`function`?r(t):t();let u=sg;i&&(u=Wne({trace:!1,...typeof i==`object`&&i}));let d=Xne(fne(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return og(c,o,p)}function Qne(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(P_(28));if(r in t)throw Error(P_(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function $ne(e){return typeof e==`function`}function D_(e,t){let[n,r,i]=Qne(t),a;if($ne(e))a=()=>T_(e());else{let t=T_(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n)if(bg(e)){let r=n(e,t);return r===void 0?e:r}else if(xg(e))return m_(e,e=>n(e,t));else{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}return e},e)}return o.getInitialState=a,o}var ere=(e,t)=>Gne(e)?e.match(t):e(t);function tre(...e){return t=>e.some(e=>ere(e,t))}var nre=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,rre=(e=21)=>{let t=``,n=e;for(;n--;)t+=nre[Math.random()*64|0];return t},ire=[`name`,`message`,`stack`,`code`],O_=class{constructor(e,t){this.payload=e,this.meta=t}_type},k_=class{constructor(e,t){this.payload=e,this.meta=t}_type},are=e=>{if(typeof e==`object`&&e){let t={};for(let n of ire)typeof e[n]==`string`&&(t[n]=e[n]);return t}return{message:String(e)}},A_=`External signal was aborted`,ore=(()=>{function e(e,t,n){let r=C_(e+`/fulfilled`,(e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:`fulfilled`}})),i=C_(e+`/pending`,(e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:`pending`}})),a=C_(e+`/rejected`,(e,t,r,i,a)=>({payload:i,error:(n&&n.serializeError||are)(e||`Rejected`),meta:{...a||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:`rejected`,aborted:e?.name===`AbortError`,condition:e?.name===`ConditionError`}}));function o(e,{signal:o}={}){return(s,c,l)=>{let u=n?.idGenerator?n.idGenerator(e):rre(),d=new AbortController,f,p;function m(e){p=e,d.abort()}o&&(o.aborted?m(A_):o.addEventListener(`abort`,()=>m(A_),{once:!0}));let h=async function(){let o;try{let a=n?.condition?.(e,{getState:c,extra:l});if(cre(a)&&(a=await a),a===!1||d.signal.aborted)throw{name:`ConditionError`,message:`Aborted due to condition callback returning false.`};let h=new Promise((e,t)=>{f=()=>{t({name:`AbortError`,message:p||`Aborted`})},d.signal.addEventListener(`abort`,f,{once:!0})});s(i(u,e,n?.getPendingMeta?.({requestId:u,arg:e},{getState:c,extra:l}))),o=await Promise.race([h,Promise.resolve(t(e,{dispatch:s,getState:c,extra:l,requestId:u,signal:d.signal,abort:m,rejectWithValue:(e,t)=>new O_(e,t),fulfillWithValue:(e,t)=>new k_(e,t)})).then(t=>{if(t instanceof O_)throw t;return t instanceof k_?r(t.payload,u,e,t.meta):r(t,u,e)})])}catch(t){o=t instanceof O_?a(null,u,e,t.payload,t.meta):a(t,u,e)}finally{f&&d.signal.removeEventListener(`abort`,f)}return n&&!n.dispatchConditionRejection&&a.match(o)&&o.meta.condition||s(o),o}();return Object.assign(h,{abort:m,requestId:u,arg:e,unwrap(){return h.then(sre)}})}}return Object.assign(o,{pending:i,rejected:a,fulfilled:r,settled:tre(a,r),typePrefix:e})}return e.withTypes=()=>e,e})();function sre(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function cre(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}var j_=`listener`,M_=`completed`,lre=`cancelled`;`${lre}`,`${M_}`,`${j_}${lre}`,`${j_}${M_}`;var{assign:ure}=Object,N_=`listenerMiddleware`,dre=ure(C_(`${N_}/add`),{withTypes:()=>dre});`${N_}`;var fre=ure(C_(`${N_}/remove`),{withTypes:()=>fre});function P_(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var pre=class extends Error{constructor(e,t,n){super(e),this.status=t,this.body=n,this.name=`ApiError`}};async function F_(e){let t=await e.text();try{return JSON.parse(t)}catch{throw new pre(`Invalid JSON response (HTTP ${e.status}): ${t.slice(0,120)}`,e.status,t)}}async function I_(e,t){if(!e.ok){let n=await e.text().catch(()=>``),r=t;try{let e=JSON.parse(n);e?.error&&(r=e.error)}catch{r=n?`${t} (HTTP ${e.status}: ${n.slice(0,120)})`:`${t} (HTTP ${e.status})`}throw Error(r)}}async function mre(){let e=await fetch(`api/matter/bridges?_s=${Date.now()}`);return await I_(e,`Failed to fetch bridges`),F_(e)}async function L_(e){let t=await fetch(`api/matter/bridges`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await I_(t,`Failed to create bridge`),F_(t)}async function R_(e){let t=await fetch(`api/matter/bridges/${e.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await I_(t,`Failed to update bridge`),F_(t)}async function hre(e){await fetch(`api/matter/bridges/${e}`,{method:`DELETE`})}async function gre(e){let t=await fetch(`api/matter/bridges/${e}/actions/factory-reset`,{method:`POST`});return await I_(t,`Factory reset failed`),F_(t)}async function z_(e){let t=await fetch(`api/matter/bridges/${e}/actions/force-sync`,{method:`POST`});return await I_(t,`Force sync failed`),F_(t)}async function _re(e){let t=await fetch(`api/matter/bridges/${e}/actions/open-commissioning-window`,{method:`POST`});return await I_(t,`Failed to open commissioning window`),F_(t)}async function vre(e){if(!(await fetch(`api/matter/bridges/priorities`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({updates:e})})).ok)throw Error(`Failed to update priorities`)}async function B_(){let e=await fetch(`api/matter/bridges/actions/start-all`,{method:`POST`});return await I_(e,`Failed to start all bridges`),F_(e)}async function V_(){let e=await fetch(`api/matter/bridges/actions/stop-all`,{method:`POST`});return await I_(e,`Failed to stop all bridges`),F_(e)}async function H_(){let e=await fetch(`api/matter/bridges/actions/restart-all`,{method:`POST`});return await I_(e,`Failed to restart all bridges`),F_(e)}var U_=ore.withTypes(),W_=x_.withTypes(),G_=U_(`bridges/load`,mre),K_=U_(`bridges/create`,L_),q_=U_(`bridges/delete`,hre),J_=U_(`bridges/update`,R_),Y_=U_(`bridges/reset`,gre),X_=C_(`bridges/setFromWebSocket`),Z_=C_(`bridges/updateFromWebSocket`),Q_=V.withTypes(),$_=ie.withTypes(),ev=(0,C.createContext)({isConnected:!1,error:null});function tv(){return(0,C.useContext)(ev)}function yre({children:e}){let t=Q_(),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(e=>{switch(e.type){case`bridges_update`:t(X_(e.data));break;case`bridge_update`:t(Z_(e.data));break;case`ping`:o.current?.send(JSON.stringify({type:`pong`}));break}},[t]),l=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=document.querySelector(`base`)?.href||window.location.origin,n=new URL(t),i=`${e}//${n.host}${n.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`);try{let e=new WebSocket(i);o.current=e,e.onopen=()=>{r(!0),a(null)},e.onmessage=e=>{try{c(JSON.parse(e.data))}catch{console.warn(`Invalid WebSocket message`)}},e.onclose=()=>{r(!1),o.current=null,s.current=setTimeout(l,3e3)},e.onerror=()=>{a(Error(`WebSocket connection error`)),e.close()}}catch(e){a(e instanceof Error?e:Error(`Failed to connect`))}},[c]);return(0,C.useEffect)(()=>(l(),()=>{s.current&&clearTimeout(s.current),o.current?.close()}),[l]),(0,G.jsx)(ev.Provider,{value:{isConnected:n,error:i},children:e})}var bre=()=>{let e=Q_();return(0,C.useEffect)(()=>{e(G_())},[e]),(0,G.jsx)(oi,{})},nv;(function(e){e.Starting=`starting`,e.Running=`running`,e.Stopped=`stopped`,e.Failed=`failed`})(nv||={});var rv;(function(e){e.Pattern=`pattern`,e.Regex=`regex`,e.Domain=`domain`,e.Platform=`platform`,e.Label=`label`,e.EntityLabel=`entity_label`,e.DeviceLabel=`device_label`,e.EntityLabelRegex=`entity_label_regex`,e.DeviceLabelRegex=`device_label_regex`,e.AnyFieldRegex=`any_field_regex`,e.Area=`area`,e.EntityCategory=`entity_category`,e.DeviceName=`device_name`,e.ProductName=`product_name`,e.DeviceClass=`device_class`})(rv||={});var iv=[{id:`all_lights`,name:`All Lights`,description:`Expose all light entities. Ideal for controlling lights via Apple Home, Google Home, or Alexa.`,icon:`light`,filter:{include:[{type:rv.Domain,value:`light`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`lights`,`popular`]},{id:`all_switches`,name:`All Switches & Plugs`,description:`Expose all switch entities including smart plugs. Includes power and energy monitoring.`,icon:`switch`,filter:{include:[{type:rv.Domain,value:`switch`}],exclude:[]},featureFlags:{},tags:[`switches`,`plugs`]},{id:`sensors_only`,name:`All Sensors`,description:`Expose temperature, humidity, pressure, and other sensors. Auto-combines related sensors from the same device.`,icon:`sensor`,filter:{include:[{type:rv.Domain,value:`sensor`},{type:rv.Domain,value:`binary_sensor`}],exclude:[]},featureFlags:{autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`sensors`,`temperature`,`humidity`]},{id:`climate_control`,name:`Climate & Covers`,description:`Expose thermostats, fans, covers, and humidifiers for climate control.`,icon:`climate`,filter:{include:[{type:rv.Domain,value:`climate`},{type:rv.Domain,value:`fan`},{type:rv.Domain,value:`cover`},{type:rv.Domain,value:`humidifier`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`climate`,`thermostat`,`covers`]},{id:`security`,name:`Security & Locks`,description:`Expose locks, alarm panels, and security-related binary sensors (motion, door, window).`,icon:`lock`,filter:{include:[{type:rv.Domain,value:`lock`},{type:rv.Domain,value:`alarm_control_panel`},{type:rv.DeviceClass,value:`motion`},{type:rv.DeviceClass,value:`door`},{type:rv.DeviceClass,value:`window`}],exclude:[],includeMode:`any`},featureFlags:{autoBatteryMapping:!0},tags:[`security`,`locks`,`alarm`]},{id:`robot_vacuum`,name:`Robot Vacuum (Server Mode)`,description:`Single vacuum bridge with Server Mode enabled. Required for Apple Home Siri commands and proper Alexa discovery. Add only ONE vacuum to this bridge.`,icon:`vacuum`,filter:{include:[{type:rv.Domain,value:`vacuum`}],exclude:[]},featureFlags:{serverMode:!0},tags:[`vacuum`,`server-mode`,`apple-home`]},{id:`media_players`,name:`Media Players & Speakers`,description:`Expose media players, speakers, and TVs for volume and playback control.`,icon:`media_player`,filter:{include:[{type:rv.Domain,value:`media_player`}],exclude:[]},featureFlags:{},tags:[`media`,`speakers`,`tv`]},{id:`google_home_optimized`,name:`Google Home Optimized`,description:`All devices with Auto Force Sync enabled. Prevents Google Home from showing devices as offline after a few hours.`,icon:`default`,filter:{include:[{type:rv.Pattern,value:`*`}],exclude:[]},featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`google-home`,`all-devices`]},{id:`alexa_covers`,name:`Alexa-Optimized Covers`,description:`Covers with Alexa-friendly percentage display. Displayed percentage matches Home Assistant values.`,icon:`cover`,filter:{include:[{type:rv.Domain,value:`cover`}],exclude:[]},featureFlags:{coverUseHomeAssistantPercentage:!0,autoBatteryMapping:!0},tags:[`alexa`,`covers`]},{id:`automations_scripts`,name:`Automations & Scripts`,description:`Expose Home Assistant automations, scripts, and scenes as Matter switches.`,icon:`remote`,filter:{include:[{type:rv.Domain,value:`automation`},{type:rv.Domain,value:`script`},{type:rv.Domain,value:`scene`}],exclude:[]},featureFlags:{},tags:[`automations`,`scripts`,`scenes`]}],xre;(function(e){e[e.locked=1]=`locked`,e[e.unlocked=2]=`unlocked`})(xre||={});var Sre;(function(e){e[e.Off=0]=`Off`,e[e.Low=1]=`Low`,e[e.Medium=2]=`Medium`,e[e.High=3]=`High`,e[e.On=4]=`On`,e[e.Auto=5]=`Auto`,e[e.Smart=6]=`Smart`})(Sre||={});var Cre;(function(e){e[e.Forward=0]=`Forward`,e[e.Reverse=1]=`Reverse`})(Cre||={});var wre;(function(e){e[e.OffLowMedHigh=0]=`OffLowMedHigh`,e[e.OffLowHigh=1]=`OffLowHigh`,e[e.OffLowMedHighAuto=2]=`OffLowMedHighAuto`,e[e.OffLowHighAuto=3]=`OffLowHighAuto`,e[e.OffHighAuto=4]=`OffHighAuto`,e[e.OffHigh=5]=`OffHigh`})(wre||={});var Tre;(function(e){e[e.Stopped=0]=`Stopped`,e[e.Running=1]=`Running`,e[e.Paused=2]=`Paused`,e[e.Error=3]=`Error`,e[e.SeekingCharger=64]=`SeekingCharger`,e[e.Charging=65]=`Charging`,e[e.Docked=66]=`Docked`})(Tre||={});var Ere;(function(e){e[e.Off=0]=`Off`,e[e.Auto=1]=`Auto`,e[e.Cool=3]=`Cool`,e[e.Heat=4]=`Heat`,e[e.EmergencyHeat=5]=`EmergencyHeat`,e[e.Precooling=6]=`Precooling`,e[e.FanOnly=7]=`FanOnly`,e[e.Dry=8]=`Dry`,e[e.Sleep=9]=`Sleep`})(Ere||={});var av;(function(e){e.homeAssistantEntity=`homeAssistantEntity`,e.identify=`identify`,e.groups=`groups`,e.scenesManagement=`scenesManagement`,e.bridgedDeviceBasicInformation=`bridgedDeviceBasicInformation`,e.airQuality=`airQuality`,e.booleanState=`booleanState`,e.booleanStateConfiguration=`booleanStateConfiguration`,e.carbonDioxideConcentrationMeasurement=`carbonDioxideConcentrationMeasurement`,e.carbonMonoxideConcentrationMeasurement=`carbonMonoxideConcentrationMeasurement`,e.colorControl=`colorControl`,e.doorLock=`doorLock`,e.electricalEnergyMeasurement=`electricalEnergyMeasurement`,e.electricalPowerMeasurement=`electricalPowerMeasurement`,e.flowMeasurement=`flowMeasurement`,e.levelControl=`levelControl`,e.fanControl=`fanControl`,e.illuminanceMeasurement=`illuminanceMeasurement`,e.nitrogenDioxideConcentrationMeasurement=`nitrogenDioxideConcentrationMeasurement`,e.occupancySensing=`occupancySensing`,e.onOff=`onOff`,e.ozoneConcentrationMeasurement=`ozoneConcentrationMeasurement`,e.pm1ConcentrationMeasurement=`pm1ConcentrationMeasurement`,e.pm10ConcentrationMeasurement=`pm10ConcentrationMeasurement`,e.pm25ConcentrationMeasurement=`pm25ConcentrationMeasurement`,e.powerSource=`powerSource`,e.powerTopology=`powerTopology`,e.pressureMeasurement=`pressureMeasurement`,e.relativeHumidityMeasurement=`relativeHumidityMeasurement`,e.smokeCoAlarm=`smokeCoAlarm`,e.temperatureMeasurement=`temperatureMeasurement`,e.thermostat=`thermostat`,e.thermostatUserInterfaceConfiguration=`thermostatUserInterfaceConfiguration`,e.totalVolatileOrganicCompoundsConcentrationMeasurement=`totalVolatileOrganicCompoundsConcentrationMeasurement`,e.valveConfigurationAndControl=`valveConfigurationAndControl`,e.windowCovering=`windowCovering`,e.mediaInput=`mediaInput`,e.rvcCleanMode=`rvcCleanMode`,e.rvcRunMode=`rvcRunMode`,e.rvcOperationalState=`rvcOperationalState`,e.serviceArea=`serviceArea`,e.switch=`switch`,e.modeSelect=`modeSelect`})(av||={});var ov=[{id:`apple_home`,name:`Apple Home`,description:`Optimized for Apple Home and Siri. Enables composed devices for clean sensor grouping. Covers use standard Matter percentage (inverted from HA).`,icon:`default`,featureFlags:{autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`google_home`,name:`Google Home`,description:`Optimized for Google Home. Enables Auto Force Sync to prevent devices from going offline. Composed devices enabled for proper sensor grouping.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`alexa`,name:`Amazon Alexa`,description:`Optimized for Alexa. Enables Auto Force Sync and Alexa-friendly cover percentages. Battery mapping included for sensor devices.`,icon:`default`,featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0,coverUseHomeAssistantPercentage:!0}},{id:`multi_controller`,name:`Multi-Controller`,description:`Balanced settings for use with multiple controllers at once (e.g. Apple Home + Alexa). Force Sync enabled. Standard cover behavior.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}}],Dre;(function(e){e.Battery=`battery`,e.BatteryCharging=`battery_charging`,e.CarbonMonoxide=`carbon_monoxide`,e.Cold=`cold`,e.Connectivity=`connectivity`,e.Door=`door`,e.GarageDoor=`garage_door`,e.Gas=`gas`,e.Heat=`heat`,e.Light=`light`,e.Lock=`lock`,e.Moisture=`moisture`,e.Motion=`motion`,e.Moving=`moving`,e.Occupancy=`occupancy`,e.Opening=`opening`,e.Plug=`plug`,e.Power=`power`,e.Presence=`presence`,e.Problem=`problem`,e.Rain=`rain`,e.Running=`running`,e.Safety=`safety`,e.Smoke=`smoke`,e.Sound=`sound`,e.Tamper=`tamper`,e.Update=`update`,e.Vibration=`vibration`,e.Window=`window`})(Dre||={});var Ore;(function(e){e.off=`off`,e.heat=`heat`,e.cool=`cool`,e.heat_cool=`heat_cool`,e.auto=`auto`,e.dry=`dry`,e.fan_only=`fan_only`})(Ore||={});var kre;(function(e){e.off=`off`,e.preheating=`preheating`,e.heating=`heating`,e.cooling=`cooling`,e.drying=`drying`,e.fan=`fan`,e.idle=`idle`,e.defrosting=`defrosting`})(kre||={});var Are;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.TARGET_TEMPERATURE_RANGE=2]=`TARGET_TEMPERATURE_RANGE`,e[e.TARGET_HUMIDITY=4]=`TARGET_HUMIDITY`,e[e.FAN_MODE=8]=`FAN_MODE`,e[e.PRESET_MODE=16]=`PRESET_MODE`,e[e.SWING_MODE=32]=`SWING_MODE`,e[e.AUX_HEAT=64]=`AUX_HEAT`,e[e.TURN_OFF=128]=`TURN_OFF`,e[e.TURN_ON=256]=`TURN_ON`,e[e.SWING_HORIZONTAL_MODE=512]=`SWING_HORIZONTAL_MODE`})(Are||={});var jre;(function(e){e.closed=`closed`,e.open=`open`,e.closing=`closing`,e.opening=`opening`})(jre||={});var Mre;(function(e){e.button=`button`,e.doorbell=`doorbell`,e.motion=`motion`})(Mre||={});var Nre;(function(e){e.FORWARD=`forward`,e.REVERSE=`reverse`})(Nre||={});var Pre;(function(e){e[e.SET_SPEED=1]=`SET_SPEED`,e[e.OSCILLATE=2]=`OSCILLATE`,e[e.DIRECTION=4]=`DIRECTION`,e[e.PRESET_MODE=8]=`PRESET_MODE`,e[e.TURN_ON=16]=`TURN_ON`,e[e.TURN_OFF=32]=`TURN_OFF`})(Pre||={});var Fre;(function(e){e.UNKNOWN=`unknown`,e.ONOFF=`onoff`,e.BRIGHTNESS=`brightness`,e.COLOR_TEMP=`color_temp`,e.HS=`hs`,e.XY=`xy`,e.RGB=`rgb`,e.RGBW=`rgbw`,e.RGBWW=`rgbww`,e.WHITE=`white`})(Fre||={});var Ire;(function(e){e.Tv=`tv`,e.Speaker=`speaker`,e.Receiver=`receiver`})(Ire||={});var Lre;(function(e){e[e.PAUSE=1]=`PAUSE`,e[e.SEEK=2]=`SEEK`,e[e.VOLUME_SET=4]=`VOLUME_SET`,e[e.VOLUME_MUTE=8]=`VOLUME_MUTE`,e[e.PREVIOUS_TRACK=16]=`PREVIOUS_TRACK`,e[e.NEXT_TRACK=32]=`NEXT_TRACK`,e[e.TURN_ON=128]=`TURN_ON`,e[e.TURN_OFF=256]=`TURN_OFF`,e[e.PLAY_MEDIA=512]=`PLAY_MEDIA`,e[e.VOLUME_STEP=1024]=`VOLUME_STEP`,e[e.SELECT_SOURCE=2048]=`SELECT_SOURCE`,e[e.STOP=4096]=`STOP`,e[e.CLEAR_PLAYLIST=8192]=`CLEAR_PLAYLIST`,e[e.PLAY=16384]=`PLAY`,e[e.SHUFFLE_SET=32768]=`SHUFFLE_SET`,e[e.SELECT_SOUND_MODE=65536]=`SELECT_SOUND_MODE`,e[e.BROWSE_MEDIA=131072]=`BROWSE_MEDIA`,e[e.REPEAT_SET=262144]=`REPEAT_SET`,e[e.GROUPING=524288]=`GROUPING`,e[e.MEDIA_ANNOUNCE=1048576]=`MEDIA_ANNOUNCE`,e[e.MEDIA_ENQUEUE=2097152]=`MEDIA_ENQUEUE`})(Lre||={});var Rre;(function(e){e.None=`None`,e.apparent_power=`apparent_power`,e.aqi=`aqi`,e.atmospheric_pressure=`atmospheric_pressure`,e.battery=`battery`,e.carbon_dioxide=`carbon_dioxide`,e.carbon_monoxide=`carbon_monoxide`,e.current=`current`,e.data_rate=`data_rate`,e.data_size=`data_size`,e.date=`date`,e.distance=`distance`,e.duration=`duration`,e.energy=`energy`,e.energy_storage=`energy_storage`,e.enum=`enum`,e.frequency=`frequency`,e.gas=`gas`,e.humidity=`humidity`,e.illuminance=`illuminance`,e.irradiance=`irradiance`,e.moisture=`moisture`,e.monetary=`monetary`,e.nitrogen_dioxide=`nitrogen_dioxide`,e.nitrogen_monoxide=`nitrogen_monoxide`,e.nitrous_oxide=`nitrous_oxide`,e.ozone=`ozone`,e.ph=`ph`,e.pm1=`pm1`,e.pm25=`pm25`,e.pm10=`pm10`,e.power_factor=`power_factor`,e.power=`power`,e.precipitation=`precipitation`,e.precipitation_intensity=`precipitation_intensity`,e.pressure=`pressure`,e.radon=`radon`,e.reactive_power=`reactive_power`,e.signal_strength=`signal_strength`,e.sound_pressure=`sound_pressure`,e.speed=`speed`,e.sulphur_dioxide=`sulphur_dioxide`,e.temperature=`temperature`,e.timestamp=`timestamp`,e.volatile_organic_compounds=`volatile_organic_compounds`,e.volatile_organic_compounds_parts=`volatile_organic_compounds_parts`,e.voltage=`voltage`,e.volume=`volume`,e.volume_flow_rate=`volume_flow_rate`,e.volume_storage=`volume_storage`,e.water=`water`,e.weight=`weight`,e.wind_speed=`wind_speed`})(Rre||={});var zre;(function(e){e.cleaning=`cleaning`,e.docked=`docked`,e.returning=`returning`,e.error=`error`,e.idle=`idle`,e.paused=`paused`,e.segment_cleaning=`segment_cleaning`,e.zone_cleaning=`zone_cleaning`,e.spot_cleaning=`spot_cleaning`,e.mop_cleaning=`mop_cleaning`})(zre||={});var Bre;(function(e){e[e.TURN_ON=1]=`TURN_ON`,e[e.TURN_OFF=2]=`TURN_OFF`,e[e.PAUSE=4]=`PAUSE`,e[e.STOP=8]=`STOP`,e[e.RETURN_HOME=16]=`RETURN_HOME`,e[e.FAN_SPEED=32]=`FAN_SPEED`,e[e.BATTERY=64]=`BATTERY`,e[e.STATUS=128]=`STATUS`,e[e.SEND_COMMAND=256]=`SEND_COMMAND`,e[e.LOCATE=512]=`LOCATE`,e[e.CLEAN_SPOT=1024]=`CLEAN_SPOT`,e[e.MAP=2048]=`MAP`,e[e.STATE=4096]=`STATE`,e[e.START=8192]=`START`,e[e.CLEAN_AREA=16384]=`CLEAN_AREA`})(Bre||={});var Vre;(function(e){e.off=`off`,e.low=`low`,e.medium=`medium`,e.high=`high`,e.turbo=`turbo`,e.auto=`auto`,e.max=`max`})(Vre||={});var Hre;(function(e){e.off=`off`,e.eco=`eco`,e.electric=`electric`,e.gas=`gas`,e.heat_pump=`heat_pump`,e.high_demand=`high_demand`,e.performance=`performance`})(Hre||={});var Ure;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.OPERATION_MODE=2]=`OPERATION_MODE`,e[e.AWAY_MODE=4]=`AWAY_MODE`,e[e.ON_OFF=8]=`ON_OFF`})(Ure||={});var sv={air_purifier:`Air Purifier`,air_quality_sensor:`Air Quality Sensor`,basic_video_player:`Basic Video Player (TV)`,battery_storage:`Battery Sensor`,carbon_monoxide_sensor:`Carbon Monoxide (CO) Sensor`,color_temperature_light:`Color Temperature Light`,contact_sensor:`Contact Sensor`,dishwasher:`Dishwasher`,dimmable_light:`Dimmable Light`,dimmable_plugin_unit:`Dimmable Plug-in Unit`,door_lock:`Door Lock`,electrical_sensor:`Electrical Sensor (Power/Energy/Voltage/Current)`,extended_color_light:`Extended Color Light`,fan:`Fan`,flow_sensor:`Flow Sensor`,formaldehyde_sensor:`Formaldehyde (HCHO) Sensor`,generic_switch:`Generic Switch (Button)`,humidifier_dehumidifier:`Humidifier/Dehumidifier`,humidity_sensor:`Humidity Sensor`,light_sensor:`Light Sensor`,mode_select:`Mode Select`,motion_sensor:`Motion Sensor (PIR)`,nitrogen_dioxide_sensor:`Nitrogen Dioxide (NO₂) Sensor`,occupancy_sensor:`Occupancy Sensor`,on_off_light:`On/Off Light`,on_off_plugin_unit:`On/Off Plug-in Unit`,on_off_switch:`On/Off Switch`,ozone_sensor:`Ozone (O₃) Sensor`,pm1_sensor:`PM1 Sensor`,pressure_sensor:`Pressure Sensor`,pump:`Pump`,rain_sensor:`Rain Sensor`,radon_sensor:`Radon Sensor`,robot_vacuum_cleaner:`Robot Vacuum Cleaner`,smoke_co_alarm:`Smoke/CO Alarm`,speaker:`Speaker`,temperature_sensor:`Temperature Sensor`,thermostat:`Thermostat`,tvoc_sensor:`TVOC / VOC Index Sensor`,water_heater:`Water Heater`,water_freeze_detector:`Water Freeze Detector`,water_leak_detector:`Water Leak Detector`,water_valve:`Water Valve`,window_covering:`Window Covering`},cv={Auto:0,Quick:1,Quiet:2,LowNoise:3,LowEnergy:4,Vacation:5,Min:6,Max:7,Night:8,Day:9,DeepClean:16384,Vacuum:16385,Mop:16386,VacuumThenMop:16387},Wre={alarm_control_panel:[`mode_select`,`on_off_plugin_unit`],automation:[`on_off_switch`],binary_sensor:[`contact_sensor`,`motion_sensor`,`occupancy_sensor`,`rain_sensor`,`smoke_co_alarm`,`water_freeze_detector`,`water_leak_detector`],button:[`generic_switch`],climate:[`thermostat`],cover:[`window_covering`],event:[`generic_switch`],fan:[`air_purifier`,`fan`],humidifier:[`humidifier_dehumidifier`],input_boolean:[`on_off_plugin_unit`,`on_off_switch`],input_select:[`mode_select`],input_button:[`generic_switch`],light:[`color_temperature_light`,`dimmable_light`,`extended_color_light`,`on_off_light`],lock:[`door_lock`],media_player:[`basic_video_player`,`on_off_switch`,`speaker`],scene:[`on_off_switch`],script:[`on_off_switch`],sensor:[`air_quality_sensor`,`battery_storage`,`carbon_monoxide_sensor`,`electrical_sensor`,`formaldehyde_sensor`,`humidity_sensor`,`light_sensor`,`nitrogen_dioxide_sensor`,`ozone_sensor`,`pm1_sensor`,`pressure_sensor`,`radon_sensor`,`temperature_sensor`,`tvoc_sensor`],select:[`mode_select`],siren:[`on_off_plugin_unit`],switch:[`dishwasher`,`on_off_plugin_unit`,`on_off_switch`,`pump`,`water_valve`],vacuum:[`robot_vacuum_cleaner`],valve:[`water_valve`,`on_off_plugin_unit`],water_heater:[`water_heater`,`thermostat`]},Gre;(function(e){e.alarm_control_panel=`alarm_control_panel`,e.automation=`automation`,e.button=`button`,e.binary_sensor=`binary_sensor`,e.climate=`climate`,e.cover=`cover`,e.event=`event`,e.fan=`fan`,e.humidifier=`humidifier`,e.input_boolean=`input_boolean`,e.input_button=`input_button`,e.input_select=`input_select`,e.light=`light`,e.lock=`lock`,e.media_player=`media_player`,e.remote=`remote`,e.scene=`scene`,e.select=`select`,e.script=`script`,e.sensor=`sensor`,e.siren=`siren`,e.switch=`switch`,e.vacuum=`vacuum`,e.valve=`valve`,e.water_heater=`water_heater`})(Gre||={});var lv={type:`object`,default:{type:``,value:``},properties:{type:{title:`Type`,type:`string`,oneOf:[{const:`pattern`,title:`pattern`,description:`Wildcard pattern matching entity IDs. Use * as wildcard. Example: 'light.living_room_*' matches all lights in the living room.`},{const:`regex`,title:`regex`,description:`Regex tested against the entity_id only (e.g. 'light.kitchen_lamp'). For labels use entity_label_regex or device_label_regex. Example: '^(light|switch)\\.kitchen_.*'.`},{const:`domain`,title:`domain`,description:`Match entities by their domain (the part before the dot). Example: 'light', 'switch', 'sensor'.`},{const:`platform`,title:`platform`,description:`Match entities by their integration/platform. Example: 'hue', 'zwave', 'mqtt'.`},{const:`label`,title:`label (deprecated)`,description:`Deprecated: use entity_label or device_label instead. Behaves like entity_label.`},{const:`entity_label`,title:`entity_label`,description:`Matches only entities that have this label assigned directly. Other entities of the same device are NOT included.`},{const:`device_label`,title:`device_label`,description:`Matches ALL entities of a device if the device has this label. Use this to include a complete device with all its entities.`},{const:`entity_label_regex`,title:`entity_label_regex`,description:`Regex tested against entity-label slugs and display names. Matches if any label assigned to the entity matches. Example: '^(matter|voice).*'.`},{const:`device_label_regex`,title:`device_label_regex`,description:`Regex tested against device-label slugs and display names. Matches ALL entities of a device whose label matches. Example: '^(matter|voice).*'.`},{const:`any_field_regex`,title:`any_field_regex`,description:`Regex tested against a single-line key=value haystack covering entity_id, domain, platform, area, entity_category, device_class, entity_labels, entity_label_names, device_labels, device_label_names, device_name, product_name. Use lookaheads for AND, alternation for OR. Example: '(?=.*domain=light)(?=.*area=living_room)|(?=.*domain=switch)(?=.*entity_labels=.*\\bvoice\\b)'.`},{const:`area`,title:`area`,description:`Match entities by their area slug. Example: 'living_room', 'bedroom'.`},{const:`entity_category`,title:`entity_category`,description:`Match entities by their category. Example: 'config', 'diagnostic' to exclude configuration entities.`},{const:`device_name`,title:`device_name`,description:`Match entities by their device name. Supports wildcards. Example: '*Philips*' matches all Philips devices.`},{const:`product_name`,title:`product_name`,description:`Match entities by their product/model name. Supports wildcards. Example: 'Hue*Bulb'.`},{const:`device_class`,title:`device_class`,description:`Match entities by their device class attribute. Example: 'temperature', 'motion', 'door', 'window'.`}]},value:{title:`Value`,description:`For labels, use the display name or the label_id (slug). You can look up both on the Labels page in the sidebar.`,type:`string`,minLength:1}},required:[`type`,`value`],additionalProperties:!1},uv={type:`object`,title:`Bridge Config`,properties:{name:{title:`Name`,type:`string`,minLength:1,maxLength:32},port:{title:`Port`,type:`number`,minimum:1},icon:{title:`Icon`,type:`string`,description:`Icon to display for this bridge in the UI`,enum:[`light`,`switch`,`climate`,`cover`,`fan`,`lock`,`sensor`,`media_player`,`vacuum`,`remote`,`humidifier`,`speaker`,`garage`,`door`,`window`,`motion`,`battery`,`power`,`camera`,`default`]},countryCode:{title:`Country Code`,type:`string`,description:`An ISO 3166-1 alpha-2 code to represent the country in which the Node is located. Only needed if the commissioning fails due to missing country code.`,minLength:2,maxLength:3},priority:{title:`Startup Priority`,type:`number`,description:`Startup order priority. Lower values start first. Default is 100.`,default:100,minimum:1,maximum:999},serialNumberSuffix:{title:`Serial Number Suffix`,type:`string`,description:`Append a suffix to every entity serial number on this bridge. Useful for forcing controllers like Aqara to treat devices as new and bypass cached device data. Leave empty for default behavior.`,maxLength:16},sessionMaxAgeHours:{title:`Session Rotation Max Age (hours)`,type:`number`,description:`Server Mode only. Rotate matter sessions older than this many hours so iPhone clients re-subscribe and Apple Home unsticks 'Updating' tiles. Set 0 to disable rotation. Range 0-168, default 4. (#287)`,default:4,minimum:0,maximum:168},filter:{title:`Include or exclude entities`,type:`object`,properties:{include:{title:`Include`,type:`array`,items:lv},exclude:{title:`Exclude`,type:`array`,items:lv},includeMode:{title:`Include Mode`,type:`string`,description:`How to combine include rules: 'any' matches if ANY rule matches (OR), 'all' matches only if ALL rules match (AND). Default: 'any'`,enum:[`any`,`all`],default:`any`}},required:[`include`,`exclude`],additionalProperties:!1},featureFlags:{title:`Feature Flags`,type:`object`,properties:{coverDoNotInvertPercentage:{title:`Do not invert Percentages for Covers`,description:`Do not invert the percentage of covers to match Home Assistant (not Matter compliant)`,type:`boolean`,default:!1},coverUseHomeAssistantPercentage:{title:`Use Home Assistant Percentage for Covers (Alexa-friendly)`,description:`Display cover percentages matching Home Assistant values in Matter controllers like Alexa. This makes the displayed percentage match what you see in Home Assistant, but the semantic meaning differs: in HA, higher percentage = more open; in Alexa, higher percentage is typically interpreted as more closed. Open/Close commands will still work correctly.`,type:`boolean`,default:!1},coverSwapOpenClose:{title:`Swap Open/Close for Covers`,description:`Swap open/close commands and invert position reporting for covers. Enable this if Alexa voice commands are reversed (saying 'close' opens the blinds and vice versa).`,type:`boolean`,default:!1},includeHiddenEntities:{title:`Include Hidden Entities`,description:`Include entities that are marked as hidden in Home Assistant`,type:`boolean`,default:!1},serverMode:{title:`Server Mode (for Robot Vacuums)`,description:`Expose the device as a standalone Matter device instead of a bridged device. This is required for Apple Home to properly support Siri voice commands for Robot Vacuums. IMPORTANT: Only ONE device should be in this bridge when server mode is enabled.`,type:`boolean`,default:!1},autoBatteryMapping:{title:`Auto Battery Mapping`,description:`Automatically assign battery sensors from the same Home Assistant device to the main entity. When enabled, battery sensors will be merged into their parent devices instead of appearing as separate devices.`,type:`boolean`,default:!1},autoHumidityMapping:{title:`Auto Humidity Mapping`,description:`Automatically combine humidity sensors with temperature sensors from the same Home Assistant device. When enabled, humidity sensors will be merged into temperature sensors to create combined TemperatureHumiditySensor devices.`,type:`boolean`,default:!0},autoPressureMapping:{title:`Auto Pressure Mapping`,description:`Automatically combine pressure sensors with temperature sensors from the same Home Assistant device. When enabled, pressure sensors will be merged into temperature sensors to create combined sensor devices.`,type:`boolean`,default:!0},autoComposedDevices:{title:`Auto Composed Devices`,description:`Master toggle: combine related entities from the same Home Assistant device into a single Matter endpoint. Turns on battery, humidity, pressure, power, and energy auto-mapping at once, a Shelly Plug shows up as one device with power monitoring instead of several siblings.`,type:`boolean`,default:!1},autoForceSync:{title:`Auto Force Sync`,description:`Periodically compare and push all device states to connected controllers every 90 seconds. Enable this if devices get out of sync after extended periods. Health checks for dead sessions always run regardless of this setting.`,type:`boolean`,default:!1},productNameFromNodeLabel:{title:`Product Name from Node Label`,description:`Report the entity's node label (custom name / friendly name / entity id) as the Matter productName. Useful for controllers like Aqara that display productName as the device name instead of nodeLabel. A per-entity customProductName still takes precedence.`,type:`boolean`,default:!1},preferEntityRegistryName:{title:`Prefer Entity Registry Name (HA 2026.4 workaround)`,description:`Use the entity registry name (or original_name) as nodeLabel instead of the composed friendly_name. Since Home Assistant 2026.4, friendly_name is prefixed with the device name, which breaks voice commands that relied on the short entity name. Resolution order: customName → registry name → registry original_name → friendly_name → entity_id. Matter has no alias concept, this only changes which single name is reported.`,type:`boolean`,default:!1},vacuumOnOff:{title:`Vacuum: Include OnOff Cluster (Alexa)`,description:`Add an OnOff cluster to robot vacuum endpoints. Alexa REQUIRES this (PowerController) to show robotic vacuums in the app. Without it, Alexa commissions the device but never displays it. In Server Mode this is enabled automatically, only check this for bridge mode. WARNING: OnOff is NOT part of the Matter RVC device type specification. Enabling this may break Apple Home (shows 'Updating') and Google Home.`,type:`boolean`},alexaPreserveBrightnessOnTurnOn:{title:`Alexa: Preserve Brightness on Turn-On`,description:`Workaround for Alexa resetting light brightness to 100% after subscription renewal. When enabled, the bridge ignores brightness commands that set lights to 100% within 200ms of a turn-on command for the same light. WARNING: breaks Apple Home's 'set room to 100%' Siri commands, which use the same on() + moveToLevel(254) pattern. Only enable on Alexa-only bridges.`,type:`boolean`,default:!1},useHaRegistrySerial:{title:`Use HA Registry Serial Number`,description:`Fall back to the Home Assistant device registry serial_number when no per-entity customSerialNumber is configured. Default off because changing serialNumber after commissioning can confuse controllers. A per-entity customSerialNumber still takes precedence.`,type:`boolean`,default:!1},coverSliderDebounceMs:{title:`Cover Slider Debounce (ms)`,description:`Override the cover position-update debounce window for this bridge. Some controllers (Apple Home) stream slider updates while the user is still dragging, causing covers to start moving toward an intermediate target. Set to the time the bridge should wait after the last update before sending the final value to Home Assistant. 0 keeps the built-in two-phase debounce (400 ms initial / 150 ms subsequent), which fits most controllers. Try 800–1500 ms for slow blinds. A per-entity override on a single cover wins over this flag.`,type:`number`,minimum:0,maximum:5e3,default:0}}}},required:[`name`,`port`,`filter`],additionalProperties:!1};({...uv}),{...uv.properties},[...uv?.required??[]];var dv=X((0,G.jsx)(`path`,{d:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z`}),`ArrowBack`),fv=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z`}),`CheckCircle`),pv=X((0,G.jsx)(`path`,{d:`M9.19 6.35c-2.04 2.29-3.44 5.58-3.57 5.89L2 10.69l4.05-4.05c.47-.47 1.15-.68 1.81-.55zM11.17 17s3.74-1.55 5.89-3.7c5.4-5.4 4.5-9.62 4.21-10.57-.95-.3-5.17-1.19-10.57 4.21C8.55 9.09 7 12.83 7 12.83zm6.48-2.19c-2.29 2.04-5.58 3.44-5.89 3.57L13.31 22l4.05-4.05c.47-.47.68-1.15.55-1.81zM9 18c0 .83-.34 1.58-.88 2.12C6.94 21.3 2 22 2 22s.7-4.94 1.88-6.12C4.42 15.34 5.17 15 6 15c1.66 0 3 1.34 3 3m4-9c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2`}),`RocketLaunch`),Kre=Ld(`MuiBox`,[`root`]),Z=Fd({themeId:Sm,defaultTheme:bm(),defaultClassName:Kre.root,generateClassName:Nd.generate});function qre(e){return Id(`MuiButton`,e)}var mv=Ld(`MuiButton`,`root.text.textInherit.textPrimary.textSecondary.textSuccess.textError.textInfo.textWarning.outlined.outlinedInherit.outlinedPrimary.outlinedSecondary.outlinedSuccess.outlinedError.outlinedInfo.outlinedWarning.contained.containedInherit.containedPrimary.containedSecondary.containedSuccess.containedError.containedInfo.containedWarning.disableElevation.focusVisible.disabled.colorInherit.colorPrimary.colorSecondary.colorSuccess.colorError.colorInfo.colorWarning.textSizeSmall.textSizeMedium.textSizeLarge.outlinedSizeSmall.outlinedSizeMedium.outlinedSizeLarge.containedSizeSmall.containedSizeMedium.containedSizeLarge.sizeMedium.sizeSmall.sizeLarge.fullWidth.startIcon.endIcon.icon.iconSizeSmall.iconSizeMedium.iconSizeLarge.loading.loadingWrapper.loadingIconPlaceholder.loadingIndicator.loadingPositionCenter.loadingPositionStart.loadingPositionEnd`.split(`.`)),Jre=C.createContext({}),Yre=C.createContext(void 0),Xre=e=>{let{color:t,disableElevation:n,fullWidth:r,size:i,variant:a,loading:o,loadingPosition:s,classes:c}=e,l=fp({root:[`root`,o&&`loading`,a,`${a}${Y(t)}`,`size${Y(i)}`,`${a}Size${Y(i)}`,`color${Y(t)}`,n&&`disableElevation`,r&&`fullWidth`,o&&`loadingPosition${Y(s)}`],startIcon:[`icon`,`startIcon`,`iconSize${Y(i)}`],endIcon:[`icon`,`endIcon`,`iconSize${Y(i)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},qre,c);return{...c,...l}},hv=[{props:{size:`small`},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:`medium`},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:`large`},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],Zre=J(Nh,{shouldForwardProp:e=>Em(e)||e===`classes`,name:`MuiButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color)}`],t[`size${Y(n.size)}`],t[`${n.variant}Size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,n.loading&&t.loading]}})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[300]:e.palette.grey[800],n=e.palette.mode===`light`?e.palette.grey.A100:e.palette.grey[700];return{...e.typography.button,minWidth:64,padding:`6px 16px`,border:0,borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`,`color`],{duration:e.transitions.duration.short}),"&:hover":{textDecoration:`none`},[`&.${mv.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:{variant:`contained`},style:{color:`var(--variant-containedColor)`,backgroundColor:`var(--variant-containedBg)`,boxShadow:(e.vars||e).shadows[2],"&:hover":{boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2]}},"&:active":{boxShadow:(e.vars||e).shadows[8]},[`&.${mv.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},[`&.${mv.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}},{props:{variant:`outlined`},style:{padding:`5px 15px`,border:`1px solid currentColor`,borderColor:`var(--variant-outlinedBorder, currentColor)`,backgroundColor:`var(--variant-outlinedBg)`,color:`var(--variant-outlinedColor)`,[`&.${mv.disabled}`]:{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`}}},{props:{variant:`text`},style:{padding:`6px 8px`,color:`var(--variant-textColor)`,backgroundColor:`var(--variant-textBg)`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--variant-textColor":(e.vars||e).palette[t].main,"--variant-outlinedColor":(e.vars||e).palette[t].main,"--variant-outlinedBorder":e.alpha((e.vars||e).palette[t].main,.5),"--variant-containedColor":(e.vars||e).palette[t].contrastText,"--variant-containedBg":(e.vars||e).palette[t].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(e.vars||e).palette[t].dark,"--variant-textBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBorder":(e.vars||e).palette[t].main,"--variant-outlinedBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}}})),{props:{color:`inherit`},style:{color:`inherit`,borderColor:`currentColor`,"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedBg:t,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedHoverBg:n,"--variant-textBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity)}}}},{props:{size:`small`,variant:`text`},style:{padding:`4px 5px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`text`},style:{padding:`8px 11px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`outlined`},style:{padding:`3px 9px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`outlined`},style:{padding:`7px 21px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`contained`},style:{padding:`4px 10px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`contained`},style:{padding:`8px 22px`,fontSize:e.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:`none`,"&:hover":{boxShadow:`none`},[`&.${mv.focusVisible}`]:{boxShadow:`none`},"&:active":{boxShadow:`none`},[`&.${mv.disabled}`]:{boxShadow:`none`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{loadingPosition:`center`},style:{transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),[`&.${mv.loading}`]:{color:`transparent`}}}]}})),Qre=J(`span`,{name:`MuiButton`,slot:`StartIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.startIcon,n.loading&&t.startIconLoadingStart,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:8,marginLeft:-4,variants:[{props:{size:`small`},style:{marginLeft:-2}},{props:{loadingPosition:`start`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`start`,loading:!0,fullWidth:!0},style:{marginRight:-8}},...hv]})),$re=J(`span`,{name:`MuiButton`,slot:`EndIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.endIcon,n.loading&&t.endIconLoadingEnd,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:-4,marginLeft:8,variants:[{props:{size:`small`},style:{marginRight:-2}},{props:{loadingPosition:`end`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`end`,loading:!0,fullWidth:!0},style:{marginLeft:-8}},...hv]})),eie=J(`span`,{name:`MuiButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,variants:[{props:{loading:!0},style:{display:`flex`}},{props:{loadingPosition:`start`},style:{left:14}},{props:{loadingPosition:`start`,size:`small`},style:{left:10}},{props:{variant:`text`,loadingPosition:`start`},style:{left:6}},{props:{loadingPosition:`center`},style:{left:`50%`,transform:`translate(-50%)`,color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:`end`},style:{right:14}},{props:{loadingPosition:`end`,size:`small`},style:{right:10}},{props:{variant:`text`,loadingPosition:`end`},style:{right:6}},{props:{loadingPosition:`start`,fullWidth:!0},style:{position:`relative`,left:-10}},{props:{loadingPosition:`end`,fullWidth:!0},style:{position:`relative`,right:-10}}]})),gv=J(`span`,{name:`MuiButton`,slot:`LoadingIconPlaceholder`})({display:`inline-block`,width:`1em`,height:`1em`}),_v=C.forwardRef(function(e,t){let n=C.useContext(Jre),r=C.useContext(Yre),i=Om({props:Zd(n,e),name:`MuiButton`}),{children:a,color:o=`primary`,component:s=`button`,className:c,disabled:l=!1,disableElevation:u=!1,disableFocusRipple:d=!1,endIcon:f,focusVisibleClassName:p,fullWidth:m=!1,id:h,loading:g=null,loadingIndicator:_,loadingPosition:v=`center`,size:y=`medium`,startIcon:b,type:x,variant:S=`text`,...w}=i,T=rh(h),E=_??(0,G.jsx)(Rh,{"aria-labelledby":T,color:`inherit`,size:16}),D={...i,color:o,component:s,disabled:l,disableElevation:u,disableFocusRipple:d,fullWidth:m,loading:g,loadingIndicator:E,loadingPosition:v,size:y,type:x,variant:S},O=Xre(D),k=(b||g&&v===`start`)&&(0,G.jsx)(Qre,{className:O.startIcon,ownerState:D,children:b||(0,G.jsx)(gv,{className:O.loadingIconPlaceholder,ownerState:D})}),A=(f||g&&v===`end`)&&(0,G.jsx)($re,{className:O.endIcon,ownerState:D,children:f||(0,G.jsx)(gv,{className:O.loadingIconPlaceholder,ownerState:D})}),j=r||``,M=typeof g==`boolean`?(0,G.jsx)(`span`,{className:O.loadingWrapper,style:{display:`contents`},children:g&&(0,G.jsx)(eie,{className:O.loadingIndicator,ownerState:D,children:E})}):null;return(0,G.jsxs)(Zre,{ownerState:D,className:K(n.className,O.root,c,j),component:s,disabled:l||g,focusRipple:!d,focusVisibleClassName:K(O.focusVisible,p),ref:t,type:x,id:g?T:h,...w,classes:O,children:[k,v!==`end`&&M,a,v===`end`&&M,A]})});function tie(e){return Id(`MuiCard`,e)}Ld(`MuiCard`,[`root`]);var nie=e=>{let{classes:t}=e;return fp({root:[`root`]},tie,t)},rie=J(Wm,{name:`MuiCard`,slot:`Root`})({overflow:`hidden`}),vv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCard`}),{className:r,raised:i=!1,...a}=n,o={...n,raised:i};return(0,G.jsx)(rie,{className:K(nie(o).root,r),elevation:i?8:void 0,ref:t,ownerState:o,...a})});function iie(e){return Id(`MuiCardActionArea`,e)}var yv=Ld(`MuiCardActionArea`,[`root`,`focusVisible`,`focusHighlight`]),aie=e=>{let{classes:t}=e;return fp({root:[`root`],focusHighlight:[`focusHighlight`]},iie,t)},oie=J(Nh,{name:`MuiCardActionArea`,slot:`Root`})(Pm(({theme:e})=>({display:`block`,textAlign:`inherit`,borderRadius:`inherit`,width:`100%`,[`&:hover .${yv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${yv.focusVisible} .${yv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),sie=J(`span`,{name:`MuiCardActionArea`,slot:`FocusHighlight`})(Pm(({theme:e})=>({overflow:`hidden`,pointerEvents:`none`,position:`absolute`,top:0,right:0,bottom:0,left:0,borderRadius:`inherit`,opacity:0,backgroundColor:`currentcolor`,transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.short})}))),bv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCardActionArea`}),{children:r,className:i,focusVisibleClassName:a,slots:o={},slotProps:s={},...c}=n,l=n,u=aie(l),d={slots:o,slotProps:s},[f,p]=Hm(`root`,{elementType:oie,externalForwardedProps:{...d,...c},shouldForwardComponentProp:!0,ownerState:l,ref:t,className:K(u.root,i),additionalProps:{focusVisibleClassName:K(a,u.focusVisible)}}),[m,h]=Hm(`focusHighlight`,{elementType:sie,externalForwardedProps:d,ownerState:l,className:u.focusHighlight});return(0,G.jsxs)(f,{...p,children:[r,(0,G.jsx)(m,{...h})]})});function cie(e){return Id(`MuiCardContent`,e)}Ld(`MuiCardContent`,[`root`]);var lie=e=>{let{classes:t}=e;return fp({root:[`root`]},cie,t)},uie=J(`div`,{name:`MuiCardContent`,slot:`Root`})({padding:16,"&:last-child":{paddingBottom:24}}),xv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCardContent`}),{className:r,component:i=`div`,...a}=n,o={...n,component:i};return(0,G.jsx)(uie,{as:i,className:K(lie(o).root,r),ownerState:o,ref:t,...a})}),Sv=C.createContext(void 0);function Cv(){return C.useContext(Sv)}function die(e){return Id(`PrivateSwitchBase`,e)}Ld(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var fie=e=>{let{classes:t,checked:n,disabled:r,edge:i}=e;return fp({root:[`root`,n&&`checked`,r&&`disabled`,i&&`edge${Y(i)}`],input:[`input`]},die,t)},pie=J(Nh,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),mie=J(`input`,{name:`MuiSwitchBase`,shouldForwardProp:Em})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),wv=C.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:u,inputProps:d,inputRef:f,name:p,onBlur:m,onChange:h,onFocus:g,readOnly:_,required:v=!1,tabIndex:y,type:b,value:x,slots:S={},slotProps:C={},...w}=e,[T,E]=ah({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),D=Cv(),O=e=>{g&&g(e),D&&D.onFocus&&D.onFocus(e)},k=e=>{m&&m(e),D&&D.onBlur&&D.onBlur(e)},A=e=>{if(e.nativeEvent.defaultPrevented||_)return;let t=e.target.checked;E(t),h&&h(e,t)},j=o;D&&j===void 0&&(j=D.disabled);let M=b===`checkbox`||b===`radio`,N={...e,checked:T,disabled:j,disableFocusRipple:s,edge:c},P=fie(N),F={slots:S,slotProps:{input:d,...C}},[I,L]=Hm(`root`,{ref:t,elementType:pie,className:P.root,shouldForwardComponentProp:!0,externalForwardedProps:{...F,component:`span`,...w},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),O(t)},onBlur:t=>{e.onBlur?.(t),k(t)}}),ownerState:N,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null}}),[R,ee]=Hm(`input`,{ref:f,elementType:mie,className:P.input,externalForwardedProps:F,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),A(t)}}),ownerState:N,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:j,id:M?u:void 0,name:p,readOnly:_,required:v,tabIndex:y,type:b,...b===`checkbox`&&x===void 0?{}:{value:x}}});return(0,G.jsxs)(I,{...L,children:[(0,G.jsx)(R,{...ee}),T?i:l]})}),hie=X((0,G.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z`}),`CheckBoxOutlineBlank`),gie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z`}),`CheckBox`),_ie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z`}),`IndeterminateCheckBox`);function vie(e){return Id(`MuiCheckbox`,e)}var Tv=Ld(`MuiCheckbox`,[`root`,`checked`,`disabled`,`indeterminate`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`]),yie=e=>{let{classes:t,indeterminate:n,color:r,size:i}=e,a=fp({root:[`root`,n&&`indeterminate`,`color${Y(r)}`,`size${Y(i)}`]},vie,t);return{...t,...a}},bie=J(wv,{shouldForwardProp:e=>Em(e)||e===`classes`,name:`MuiCheckbox`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Y(n.size)}`],n.color!==`default`&&t[`color${Y(n.color)}`]]}})(Pm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:`default`,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${Tv.checked}, &.${Tv.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${Tv.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:`transparent`}}}}]}))),xie=(0,G.jsx)(gie,{}),Sie=(0,G.jsx)(hie,{}),Cie=(0,G.jsx)(_ie,{}),Ev=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCheckbox`}),{checkedIcon:r=xie,color:i=`primary`,icon:a=Sie,indeterminate:o=!1,indeterminateIcon:s=Cie,inputProps:c,size:l=`medium`,disableRipple:u=!1,className:d,slots:f={},slotProps:p={},...m}=n,h=o?s:a,g=o?s:r,_={...n,disableRipple:u,color:i,indeterminate:o,size:l},v=yie(_),y=p.input??c,[b,x]=Hm(`root`,{ref:t,elementType:bie,className:K(v.root,d),shouldForwardComponentProp:!0,externalForwardedProps:{slots:f,slotProps:p,...m},ownerState:_,additionalProps:{type:`checkbox`,icon:C.cloneElement(h,{fontSize:h.props.fontSize??l}),checkedIcon:C.cloneElement(g,{fontSize:g.props.fontSize??l}),disableRipple:u,slots:f,slotProps:{input:lh(typeof y==`function`?y(_):y,{"data-indeterminate":o})}}});return(0,G.jsx)(b,{...x,classes:v})}),wie=X((0,G.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z`}),`Cancel`);function Tie(e){return Id(`MuiChip`,e)}var Dv=Ld(`MuiChip`,`root.sizeSmall.sizeMedium.colorDefault.colorError.colorInfo.colorPrimary.colorSecondary.colorSuccess.colorWarning.disabled.clickable.clickableColorPrimary.clickableColorSecondary.deletable.deletableColorPrimary.deletableColorSecondary.outlined.filled.outlinedPrimary.outlinedSecondary.filledPrimary.filledSecondary.avatar.avatarSmall.avatarMedium.avatarColorPrimary.avatarColorSecondary.icon.iconSmall.iconMedium.iconColorPrimary.iconColorSecondary.label.labelSmall.labelMedium.deleteIcon.deleteIconSmall.deleteIconMedium.deleteIconColorPrimary.deleteIconColorSecondary.deleteIconOutlinedColorPrimary.deleteIconOutlinedColorSecondary.deleteIconFilledColorPrimary.deleteIconFilledColorSecondary.focusVisible`.split(`.`)),Eie=e=>{let{classes:t,disabled:n,size:r,color:i,iconColor:a,onDelete:o,clickable:s,variant:c}=e;return fp({root:[`root`,c,n&&`disabled`,`size${Y(r)}`,`color${Y(i)}`,s&&`clickable`,s&&`clickableColor${Y(i)}`,o&&`deletable`,o&&`deletableColor${Y(i)}`,`${c}${Y(i)}`],label:[`label`,`label${Y(r)}`],avatar:[`avatar`,`avatar${Y(r)}`,`avatarColor${Y(i)}`],icon:[`icon`,`icon${Y(r)}`,`iconColor${Y(a)}`],deleteIcon:[`deleteIcon`,`deleteIcon${Y(r)}`,`deleteIconColor${Y(i)}`,`deleteIcon${Y(c)}Color${Y(i)}`]},Tie,t)},Die=J(`div`,{name:`MuiChip`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{color:r,iconColor:i,clickable:a,onDelete:o,size:s,variant:c}=n;return[{[`& .${Dv.avatar}`]:t.avatar},{[`& .${Dv.avatar}`]:t[`avatar${Y(s)}`]},{[`& .${Dv.avatar}`]:t[`avatarColor${Y(r)}`]},{[`& .${Dv.icon}`]:t.icon},{[`& .${Dv.icon}`]:t[`icon${Y(s)}`]},{[`& .${Dv.icon}`]:t[`iconColor${Y(i)}`]},{[`& .${Dv.deleteIcon}`]:t.deleteIcon},{[`& .${Dv.deleteIcon}`]:t[`deleteIcon${Y(s)}`]},{[`& .${Dv.deleteIcon}`]:t[`deleteIconColor${Y(r)}`]},{[`& .${Dv.deleteIcon}`]:t[`deleteIcon${Y(c)}Color${Y(r)}`]},t.root,t[`size${Y(s)}`],t[`color${Y(r)}`],a&&t.clickable,a&&r!==`default`&&t[`clickableColor${Y(r)}`],o&&t.deletable,o&&r!==`default`&&t[`deletableColor${Y(r)}`],t[c],t[`${c}${Y(r)}`]]}})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[700]:e.palette.grey[300];return{maxWidth:`100%`,fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:`inline-flex`,alignItems:`center`,justifyContent:`center`,height:32,lineHeight:1.5,color:(e.vars||e).palette.text.primary,backgroundColor:(e.vars||e).palette.action.selected,borderRadius:32/2,whiteSpace:`nowrap`,transition:e.transitions.create([`background-color`,`box-shadow`]),cursor:`unset`,outline:0,textDecoration:`none`,border:0,padding:0,verticalAlign:`middle`,boxSizing:`border-box`,[`&.${Dv.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:`none`},[`& .${Dv.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:e.vars?e.vars.palette.Chip.defaultAvatarColor:t,fontSize:e.typography.pxToRem(12)},[`& .${Dv.avatarColorPrimary}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.dark},[`& .${Dv.avatarColorSecondary}`]:{color:(e.vars||e).palette.secondary.contrastText,backgroundColor:(e.vars||e).palette.secondary.dark},[`& .${Dv.avatarSmall}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)},[`& .${Dv.icon}`]:{marginLeft:5,marginRight:-6},[`& .${Dv.deleteIcon}`]:{WebkitTapHighlightColor:`transparent`,color:e.alpha((e.vars||e).palette.text.primary,.26),fontSize:22,cursor:`pointer`,margin:`0 5px 0 -6px`,"&:hover":{color:e.alpha((e.vars||e).palette.text.primary,.4)}},variants:[{props:{size:`small`},style:{height:24,[`& .${Dv.icon}`]:{fontSize:18,marginLeft:4,marginRight:-4},[`& .${Dv.deleteIcon}`]:{fontSize:16,marginRight:4,marginLeft:-4}}},...Object.entries(e.palette).filter(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText,[`& .${Dv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].contrastText,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].contrastText}}}})),{props:e=>e.iconColor===e.color,style:{[`& .${Dv.icon}`]:{color:e.vars?e.vars.palette.Chip.defaultIconColor:t}}},{props:e=>e.iconColor===e.color&&e.color!==`default`,style:{[`& .${Dv.icon}`]:{color:`inherit`}}},{props:{onDelete:!0},style:{[`&.${Dv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,onDelete:!0},style:{[`&.${Dv.focusVisible}`]:{background:(e.vars||e).palette[t].dark}}})),{props:{clickable:!0},style:{userSelect:`none`,WebkitTapHighlightColor:`transparent`,cursor:`pointer`,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)},[`&.${Dv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},"&:active":{boxShadow:(e.vars||e).shadows[1]}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,clickable:!0},style:{[`&:hover, &.${Dv.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark}}})),{props:{variant:`outlined`},style:{backgroundColor:`transparent`,border:e.vars?`1px solid ${e.vars.palette.Chip.defaultBorder}`:`1px solid ${e.palette.mode===`light`?e.palette.grey[400]:e.palette.grey[700]}`,[`&.${Dv.clickable}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${Dv.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`& .${Dv.avatar}`]:{marginLeft:4},[`& .${Dv.avatarSmall}`]:{marginLeft:2},[`& .${Dv.icon}`]:{marginLeft:4},[`& .${Dv.iconSmall}`]:{marginLeft:2},[`& .${Dv.deleteIcon}`]:{marginRight:5},[`& .${Dv.deleteIconSmall}`]:{marginRight:3}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{variant:`outlined`,color:t},style:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.7)}`,[`&.${Dv.clickable}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)},[`&.${Dv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.focusOpacity)},[`& .${Dv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].main,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].main}}}}))]}})),Oie=J(`span`,{name:`MuiChip`,slot:`Label`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{size:r}=n;return[t.label,t[`label${Y(r)}`]]}})({overflow:`hidden`,textOverflow:`ellipsis`,paddingLeft:12,paddingRight:12,whiteSpace:`nowrap`,variants:[{props:{variant:`outlined`},style:{paddingLeft:11,paddingRight:11}},{props:{size:`small`},style:{paddingLeft:8,paddingRight:8}},{props:{size:`small`,variant:`outlined`},style:{paddingLeft:7,paddingRight:7}}]});function Ov(e){return e.key===`Backspace`||e.key===`Delete`}var kv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiChip`}),{avatar:r,className:i,clickable:a,color:o=`default`,component:s,deleteIcon:c,disabled:l=!1,icon:u,label:d,onClick:f,onDelete:p,onKeyDown:m,onKeyUp:h,size:g=`medium`,variant:_=`filled`,tabIndex:v,skipFocusWhenDisabled:y=!1,slots:b={},slotProps:x={},...S}=n,w=ch(C.useRef(null),t),T=e=>{e.stopPropagation(),p(e)},E=e=>{e.currentTarget===e.target&&Ov(e)&&e.preventDefault(),m&&m(e)},D=e=>{e.currentTarget===e.target&&p&&Ov(e)&&p(e),h&&h(e)},O=a!==!1&&f?!0:a,k=O||p?Nh:s||`div`,A={...n,component:k,disabled:l,size:g,color:o,iconColor:C.isValidElement(u)&&u.props.color||o,onDelete:!!p,clickable:O,variant:_},j=Eie(A),M=k===Nh?{component:s||`div`,focusVisibleClassName:j.focusVisible,...p&&{disableRipple:!0}}:{},N=null;p&&(N=c&&C.isValidElement(c)?C.cloneElement(c,{className:K(c.props.className,j.deleteIcon),onClick:T}):(0,G.jsx)(wie,{className:j.deleteIcon,onClick:T}));let P=null;r&&C.isValidElement(r)&&(P=C.cloneElement(r,{className:K(j.avatar,r.props.className)}));let F=null;u&&C.isValidElement(u)&&(F=C.cloneElement(u,{className:K(j.icon,u.props.className)}));let I={slots:b,slotProps:x},[L,R]=Hm(`root`,{elementType:Die,externalForwardedProps:{...I,...S},ownerState:A,shouldForwardComponentProp:!0,ref:w,className:K(j.root,i),additionalProps:{disabled:O&&l?!0:void 0,tabIndex:y&&l?-1:v,...M},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),f?.(t)},onKeyDown:t=>{e.onKeyDown?.(t),E(t)},onKeyUp:t=>{e.onKeyUp?.(t),D(t)}})}),[ee,z]=Hm(`label`,{elementType:Oie,externalForwardedProps:I,ownerState:A,className:j.label});return(0,G.jsxs)(L,{as:k,...R,children:[P||F,(0,G.jsx)(ee,{...z,children:d}),N]})});function Av(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function jv(e,t=!1){return e&&(Av(e.value)&&e.value!==``||t&&Av(e.defaultValue)&&e.defaultValue!==``)}function kie(e){return e.startAdornment}function Aie(e){return Id(`MuiFormControl`,e)}Ld(`MuiFormControl`,[`root`,`marginNone`,`marginNormal`,`marginDense`,`fullWidth`,`disabled`]);var jie=e=>{let{classes:t,margin:n,fullWidth:r}=e;return fp({root:[`root`,n!==`none`&&`margin${Y(n)}`,r&&`fullWidth`]},Aie,t)},Mie=J(`div`,{name:`MuiFormControl`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`margin${Y(n.margin)}`],n.fullWidth&&t.fullWidth]}})({display:`inline-flex`,flexDirection:`column`,position:`relative`,minWidth:0,padding:0,margin:0,border:0,verticalAlign:`top`,variants:[{props:{margin:`normal`},style:{marginTop:16,marginBottom:8}},{props:{margin:`dense`},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:`100%`}}]}),Mv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiFormControl`}),{children:r,className:i,color:a=`primary`,component:o=`div`,disabled:s=!1,error:c=!1,focused:l,fullWidth:u=!1,hiddenLabel:d=!1,margin:f=`none`,required:p=!1,size:m=`medium`,variant:h=`outlined`,...g}=n,_={...n,color:a,component:o,disabled:s,error:c,fullWidth:u,hiddenLabel:d,margin:f,required:p,size:m,variant:h},v=jie(_),[y,b]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{if(!Xm(t,[`Input`,`Select`]))return;let n=Xm(t,[`Select`])?t.props.input:t;n&&kie(n.props)&&(e=!0)}),e}),[x,S]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{Xm(t,[`Input`,`Select`])&&(jv(t.props,!0)||jv(t.props.inputProps,!0))&&(e=!0)}),e}),[w,T]=C.useState(!1);s&&w&&T(!1);let E=l!==void 0&&!s?l:w;C.useRef(!1);let D=C.useCallback(()=>{S(!0)},[]),O=C.useCallback(()=>{S(!1)},[]),k=C.useMemo(()=>({adornedStart:y,setAdornedStart:b,color:a,disabled:s,error:c,filled:x,focused:E,fullWidth:u,hiddenLabel:d,size:m,onBlur:()=>{T(!1)},onFocus:()=>{T(!0)},onEmpty:O,onFilled:D,registerEffect:void 0,required:p,variant:h}),[y,a,s,c,x,E,u,d,void 0,O,D,p,m,h]);return(0,G.jsx)(Sv.Provider,{value:k,children:(0,G.jsx)(Mie,{as:o,ownerState:_,className:K(v.root,i),ref:t,...g,children:r})})});function Nie(e){return Id(`MuiTypography`,e)}var Nv=Ld(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]),Pie={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Fie=Iee(),Iie=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return fp({root:[`root`,a,e.align!==`inherit`&&`align${Y(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},Nie,o)},Lie=J(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${Y(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(Pm(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${Y(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),Pv={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},Q=C.forwardRef(function(e,t){let{color:n,...r}=Om({props:e,name:`MuiTypography`}),i=!Pie[n],a=Fie({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=Pv,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p};return(0,G.jsx)(Lie,{as:c||(d?`p`:p[f]||Pv[f])||`span`,ref:t,className:K(Iie(h).root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})});function Rie(e){return Id(`MuiFormControlLabel`,e)}var Fv=Ld(`MuiFormControlLabel`,[`root`,`labelPlacementStart`,`labelPlacementTop`,`labelPlacementBottom`,`disabled`,`label`,`error`,`required`,`asterisk`]);function Iv({props:e,states:t,muiFormControl:n}){return t.reduce((t,r)=>(t[r]=e[r],n&&e[r]===void 0&&(t[r]=n[r]),t),{})}var zie=e=>{let{classes:t,disabled:n,labelPlacement:r,error:i,required:a}=e;return fp({root:[`root`,n&&`disabled`,`labelPlacement${Y(r)}`,i&&`error`,a&&`required`],label:[`label`,n&&`disabled`],asterisk:[`asterisk`,i&&`error`]},Rie,t)},Bie=J(`label`,{name:`MuiFormControlLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${Fv.label}`]:t.label},t.root,t[`labelPlacement${Y(n.labelPlacement)}`]]}})(Pm(({theme:e})=>({display:`inline-flex`,alignItems:`center`,cursor:`pointer`,verticalAlign:`middle`,WebkitTapHighlightColor:`transparent`,marginLeft:-11,marginRight:16,[`&.${Fv.disabled}`]:{cursor:`default`},[`& .${Fv.label}`]:{[`&.${Fv.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:`start`},style:{flexDirection:`row-reverse`,marginRight:-11}},{props:{labelPlacement:`top`},style:{flexDirection:`column-reverse`}},{props:{labelPlacement:`bottom`},style:{flexDirection:`column`}},{props:({labelPlacement:e})=>e===`start`||e===`top`||e===`bottom`,style:{marginLeft:16}}]}))),Vie=J(`span`,{name:`MuiFormControlLabel`,slot:`Asterisk`})(Pm(({theme:e})=>({[`&.${Fv.error}`]:{color:(e.vars||e).palette.error.main}}))),Lv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiFormControlLabel`}),{checked:r,className:i,componentsProps:a={},control:o,disabled:s,disableTypography:c,inputRef:l,label:u,labelPlacement:d=`end`,name:f,onChange:p,required:m,slots:h={},slotProps:g={},value:_,...v}=n,y=Cv(),b=s??o.props.disabled??y?.disabled,x=m??o.props.required,S={disabled:b,required:x};[`checked`,`name`,`onChange`,`value`,`inputRef`].forEach(e=>{o.props[e]===void 0&&n[e]!==void 0&&(S[e]=n[e])});let w=Iv({props:n,muiFormControl:y,states:[`error`]}),T={...n,disabled:b,labelPlacement:d,required:x,error:w.error},E=zie(T),[D,O]=Hm(`typography`,{elementType:Q,externalForwardedProps:{slots:h,slotProps:{...a,...g}},ownerState:T}),k=u;return k!=null&&k.type!==Q&&!c&&(k=(0,G.jsx)(D,{component:`span`,...O,className:K(E.label,O?.className),children:k})),(0,G.jsxs)(Bie,{className:K(E.root,i),ownerState:T,ref:t,...v,children:[C.cloneElement(o,S),x?(0,G.jsxs)(`div`,{children:[k,(0,G.jsxs)(Vie,{ownerState:T,"aria-hidden":!0,className:E.asterisk,children:[` `,`*`]})]}):k]})}),Rv=zp({createStyledComponent:J(`div`,{name:`MuiGrid`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.container&&t.container]}}),componentName:`MuiGrid`,useThemeProps:e=>Om({props:e,name:`MuiGrid`}),useTheme:Cm});function Hie(e){return Id(`MuiLinearProgress`,e)}Ld(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var zv=4,Bv=td`
|
|
148
|
+
`,jte=e=>{let{classes:t,variant:n,color:r,disableShrink:i}=e;return fp({root:[`root`,n,`color${Y(r)}`],svg:[`svg`],track:[`track`],circle:[`circle`,`circle${Y(n)}`,i&&`circleDisableShrink`]},Ote,t)},Mte=J(`span`,{name:`MuiCircularProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`color${Y(n.color)}`]]}})(Pm(({theme:e})=>({display:`inline-block`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`transform`)}},{props:{variant:`indeterminate`},style:kte||{animation:`${Ih} 1.4s linear infinite`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))]}))),Nte=J(`svg`,{name:`MuiCircularProgress`,slot:`Svg`})({display:`block`}),Pte=J(`circle`,{name:`MuiCircularProgress`,slot:`Circle`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.circle,t[`circle${Y(n.variant)}`],n.disableShrink&&t.circleDisableShrink]}})(Pm(({theme:e})=>({stroke:`currentColor`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`stroke-dashoffset`)}},{props:{variant:`indeterminate`},style:{strokeDasharray:`80px, 200px`,strokeDashoffset:0}},{props:({ownerState:e})=>e.variant===`indeterminate`&&!e.disableShrink,style:Ate||{animation:`${Lh} 1.4s ease-in-out infinite`}}]}))),Fte=J(`circle`,{name:`MuiCircularProgress`,slot:`Track`})(Pm(({theme:e})=>({stroke:`currentColor`,opacity:(e.vars||e).palette.action.activatedOpacity}))),Rh=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCircularProgress`}),{className:r,color:i=`primary`,disableShrink:a=!1,enableTrackSlot:o=!1,size:s=40,style:c,thickness:l=3.6,value:u=0,variant:d=`indeterminate`,...f}=n,p={...n,color:i,disableShrink:a,size:s,thickness:l,value:u,variant:d,enableTrackSlot:o},m=jte(p),h={},g={},_={};if(d===`determinate`){let e=2*Math.PI*((Fh-l)/2);h.strokeDasharray=e.toFixed(3),_[`aria-valuenow`]=Math.round(u),h.strokeDashoffset=`${((100-u)/100*e).toFixed(3)}px`,g.transform=`rotate(-90deg)`}return(0,G.jsx)(Mte,{className:K(m.root,r),style:{width:s,height:s,...g,...c},ownerState:p,ref:t,role:`progressbar`,..._,...f,children:(0,G.jsxs)(Nte,{className:m.svg,ownerState:p,viewBox:`${Fh/2} ${Fh/2} ${Fh} ${Fh}`,children:[o?(0,G.jsx)(Fte,{className:m.track,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l,"aria-hidden":`true`}):null,(0,G.jsx)(Pte,{className:m.circle,style:h,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l})]})})});function Ite(e){return Id(`MuiIconButton`,e)}var zh=Ld(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),Lte=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return fp({root:[`root`,o&&`loading`,n&&`disabled`,r!==`default`&&`color${Y(r)}`,i&&`edge${Y(i)}`,`size${Y(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},Ite,t)},Rte=J(Nh,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!==`default`&&t[`color${Y(n.color)}`],n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})(Pm(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),Pm(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${zh.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${zh.loading}`]:{color:`transparent`}}))),zte=J(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),Bh=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=rh(u),h=f??(0,G.jsx)(Rh,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=Lte(g);return(0,G.jsxs)(Rte,{id:d?m:u,className:K(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,G.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,G.jsx)(zte,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),Bte=X((0,G.jsx)(`path`,{d:`M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z`}),`SuccessOutlined`),Vte=X((0,G.jsx)(`path`,{d:`M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z`}),`ReportProblemOutlined`),Hte=X((0,G.jsx)(`path`,{d:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z`}),`ErrorOutline`),Ute=X((0,G.jsx)(`path`,{d:`M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z`}),`InfoOutlined`),Vh=X((0,G.jsx)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),Wte=e=>{let{variant:t,color:n,severity:r,classes:i}=e;return fp({root:[`root`,`color${Y(n||r)}`,`${t}${Y(n||r)}`,`${t}`],icon:[`icon`],message:[`message`],action:[`action`]},$ee,i)},Gte=J(Wm,{name:`MuiAlert`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color||n.severity)}`]]}})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?e.darken:e.lighten,n=e.palette.mode===`light`?e.lighten:e.darken;return{...e.typography.body2,backgroundColor:`transparent`,display:`flex`,padding:`6px 16px`,variants:[...Object.entries(e.palette).filter(Um([`light`])).map(([r])=>({props:{colorSeverity:r,variant:`standard`},style:{color:e.vars?e.vars.palette.Alert[`${r}Color`]:t(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:n(e.palette[r].light,.9),[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}}})),...Object.entries(e.palette).filter(Um([`light`])).map(([n])=>({props:{colorSeverity:n,variant:`outlined`},style:{color:e.vars?e.vars.palette.Alert[`${n}Color`]:t(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}}})),...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{colorSeverity:t,variant:`filled`},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:e.palette.mode===`dark`?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}}))]}})),Kte=J(`div`,{name:`MuiAlert`,slot:`Icon`})({marginRight:12,padding:`7px 0`,display:`flex`,fontSize:22,opacity:.9}),qte=J(`div`,{name:`MuiAlert`,slot:`Message`})({padding:`8px 0`,minWidth:0,overflow:`auto`}),Jte=J(`div`,{name:`MuiAlert`,slot:`Action`})({display:`flex`,alignItems:`flex-start`,padding:`4px 0 0 16px`,marginLeft:`auto`,marginRight:-8}),Hh={success:(0,G.jsx)(Bte,{fontSize:`inherit`}),warning:(0,G.jsx)(Vte,{fontSize:`inherit`}),error:(0,G.jsx)(Hte,{fontSize:`inherit`}),info:(0,G.jsx)(Ute,{fontSize:`inherit`})},Uh=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiAlert`}),{action:r,children:i,className:a,closeText:o=`Close`,color:s,components:c={},componentsProps:l={},icon:u,iconMapping:d=Hh,onClose:f,role:p=`alert`,severity:m=`success`,slotProps:h={},slots:g={},variant:_=`standard`,...v}=n,y={...n,color:s,severity:m,variant:_,colorSeverity:s||m},b=Wte(y),x={slots:{closeButton:c.CloseButton,closeIcon:c.CloseIcon,...g},slotProps:{...l,...h}},[S,C]=Hm(`root`,{ref:t,shouldForwardComponentProp:!0,className:K(b.root,a),elementType:Gte,externalForwardedProps:{...x,...v},ownerState:y,additionalProps:{role:p,elevation:0}}),[w,T]=Hm(`icon`,{className:b.icon,elementType:Kte,externalForwardedProps:x,ownerState:y}),[E,D]=Hm(`message`,{className:b.message,elementType:qte,externalForwardedProps:x,ownerState:y}),[O,k]=Hm(`action`,{className:b.action,elementType:Jte,externalForwardedProps:x,ownerState:y}),[A,j]=Hm(`closeButton`,{elementType:Bh,externalForwardedProps:x,ownerState:y}),[M,N]=Hm(`closeIcon`,{elementType:Vh,externalForwardedProps:x,ownerState:y});return(0,G.jsxs)(S,{...C,children:[u===!1?null:(0,G.jsx)(w,{...T,children:u||d[m]||Hh[m]}),(0,G.jsx)(E,{...D,children:i}),r==null?null:(0,G.jsx)(O,{...k,children:r}),r==null&&f?(0,G.jsx)(O,{...k,children:(0,G.jsx)(A,{size:`small`,"aria-label":o,title:o,color:`inherit`,onClick:f,...j,children:(0,G.jsx)(M,{fontSize:`small`,...N})})}):null]})});function Yte(e={}){let{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:i,resumeHideDuration:a}=e,o=Ah();C.useEffect(()=>{if(!i)return;function e(e){e.defaultPrevented||e.key===`Escape`&&r?.(e,`escapeKeyDown`)}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[i,r]);let s=oh((e,t)=>{r?.(e,t)}),c=oh(e=>{!r||e==null||o.start(e,()=>{s(null,`timeout`)})});C.useEffect(()=>(i&&c(t),o.clear),[i,t,c,o]);let l=e=>{r?.(e,`clickaway`)},u=o.clear,d=C.useCallback(()=>{t!=null&&c(a??t*.5)},[t,a,c]),f=e=>t=>{let n=e.onBlur;n?.(t),d()},p=e=>t=>{let n=e.onFocus;n?.(t),u()},m=e=>t=>{let n=e.onMouseEnter;n?.(t),u()},h=e=>t=>{let n=e.onMouseLeave;n?.(t),d()};return C.useEffect(()=>{if(!n&&i)return window.addEventListener(`focus`,d),window.addEventListener(`blur`,u),()=>{window.removeEventListener(`focus`,d),window.removeEventListener(`blur`,u)}},[n,i,d,u]),{getRootProps:(t={})=>{let n={...zm(e),...zm(t)};return{role:`presentation`,...t,...n,onBlur:f(n),onFocus:p(n),onMouseEnter:m(n),onMouseLeave:h(n)}},onClickAway:l}}function Wh(e){return e?.props?.ref||null}function Gh(e){return e.substring(2).toLowerCase()}function Xte(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function Kh(e){let{children:t,disableReactTree:n=!1,mouseEvent:r=`onClick`,onClickAway:i,touchEvent:a=`onTouchEnd`}=e,o=C.useRef(!1),s=C.useRef(null),c=C.useRef(!1),l=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{c.current=!0},0),()=>{c.current=!1}),[]);let u=Fm(Wh(t),s),d=oh(e=>{let t=l.current;l.current=!1;let r=Zm(s.current);if(!c.current||!s.current||`clientX`in e&&Xte(e,r))return;if(o.current){o.current=!1;return}let a;a=e.composedPath?e.composedPath().includes(s.current):!r.documentElement.contains(e.target)||s.current.contains(e.target),!a&&(n||!t)&&i(e)}),f=e=>n=>{l.current=!0;let r=t.props[e];r&&r(n)},p={ref:u};return a!==!1&&(p[a]=f(a)),C.useEffect(()=>{if(a!==!1){let e=Gh(a),t=Zm(s.current),n=()=>{o.current=!0};return t.addEventListener(e,d),t.addEventListener(`touchmove`,n),()=>{t.removeEventListener(e,d),t.removeEventListener(`touchmove`,n)}}},[d,a]),r!==!1&&(p[r]=f(r)),C.useEffect(()=>{if(r!==!1){let e=Gh(r),t=Zm(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}},[d,r]),C.cloneElement(t,p)}var qh=e=>e.scrollTop;function Jh(e,t){return n=>{if(t){let r=e.current;n===void 0?t(r):t(r,n)}}}function Yh(e,t,n,r,i,a){let o=e===`exited`&&!t?r:n[e]||n.exited;return i||a?{...o,...i,...a}:o}function Xh(e,t){let{timeout:n,easing:r,style:i={}}=e;return{duration:i.transitionDuration??(typeof n==`number`?n:n[t.mode]||0),easing:i.transitionTimingFunction??(typeof r==`object`?r[t.mode]:r),delay:i.transitionDelay}}function Zh(e){return`scale(${e}, ${e**2})`}var Zte={entering:{opacity:1,transform:Zh(1)},entered:{opacity:1,transform:`none`},exiting:{opacity:0,transform:Zh(.75)},exited:{opacity:0,transform:Zh(.75)}},Qte={opacity:0,transform:Zh(.75),visibility:`hidden`},Qh=C.forwardRef(function(e,t){let{addEndListener:n,appear:r=!0,children:i,easing:a,in:o,onEnter:s,onEntered:c,onEntering:l,onExit:u,onExited:d,onExiting:f,style:p,timeout:m=`auto`,...h}=e,g=Ah(),_=C.useRef(),v=Cm(),y=C.useRef(null),b=ch(y,Wh(i),t),x=Jh(y,l),S=Jh(y,(e,t)=>{qh(e);let{duration:n,delay:r,easing:i}=Xh({style:p,timeout:m,easing:a},{mode:`enter`}),o;m===`auto`?(o=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=o):o=n,e.style.transition=[v.transitions.create(`opacity`,{duration:o,delay:r}),v.transitions.create(`transform`,{duration:o*.666,delay:r,easing:i})].join(`,`),s&&s(e,t)}),w=Jh(y,c),T=Jh(y,f),E=Jh(y,e=>{let{duration:t,delay:n,easing:r}=Xh({style:p,timeout:m,easing:a},{mode:`exit`}),i;m===`auto`?(i=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=i):i=t,e.style.transition=[v.transitions.create(`opacity`,{duration:i,delay:n}),v.transitions.create(`transform`,{duration:i*.666,delay:n||i*.333,easing:r})].join(`,`),e.style.opacity=0,e.style.transform=Zh(.75),u&&u(e)}),D=Jh(y,e=>{e.style.transition=``,d&&d(e)});return(0,G.jsx)(wh,{appear:r,in:o,nodeRef:y,onEnter:S,onEntered:w,onEntering:x,onExit:E,onExited:D,onExiting:T,addEndListener:e=>{m===`auto`&&g.start(_.current||0,e),n&&n(y.current,e)},timeout:m===`auto`?null:m,...h,children:(e,{ownerState:t,...n})=>{let r=Yh(e,o,Zte,Qte,p,i.props.style);return C.cloneElement(i,{style:r,ref:b,...n})}})});Qh&&(Qh.muiSupportAuto=!0);function $te(e){return Id(`MuiSnackbarContent`,e)}Ld(`MuiSnackbarContent`,[`root`,`message`,`action`]);var ene=e=>{let{classes:t}=e;return fp({root:[`root`],action:[`action`],message:[`message`]},$te,t)},tne=J(Wm,{name:`MuiSnackbarContent`,slot:`Root`})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Sf(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Sf(e.palette.background.default,t),display:`flex`,alignItems:`center`,flexWrap:`wrap`,padding:`6px 16px`,flexGrow:1,[e.breakpoints.up(`sm`)]:{flexGrow:`initial`,minWidth:288}}})),nne=J(`div`,{name:`MuiSnackbarContent`,slot:`Message`})({padding:`8px 0`}),rne=J(`div`,{name:`MuiSnackbarContent`,slot:`Action`})({display:`flex`,alignItems:`center`,marginLeft:`auto`,paddingLeft:16,marginRight:-8}),ine=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiSnackbarContent`}),{action:r,className:i,message:a,role:o=`alert`,...s}=n,c=n,l=ene(c);return(0,G.jsxs)(tne,{role:o,elevation:6,className:K(l.root,i),ownerState:c,ref:t,...s,children:[(0,G.jsx)(nne,{className:l.message,ownerState:c,children:a}),r?(0,G.jsx)(rne,{className:l.action,ownerState:c,children:r}):null]})});function ane(e){return Id(`MuiSnackbar`,e)}Ld(`MuiSnackbar`,[`root`,`anchorOriginTopCenter`,`anchorOriginBottomCenter`,`anchorOriginTopRight`,`anchorOriginBottomRight`,`anchorOriginTopLeft`,`anchorOriginBottomLeft`]);var one=e=>{let{classes:t,anchorOrigin:n}=e;return fp({root:[`root`,`anchorOrigin${Y(n.vertical)}${Y(n.horizontal)}`]},ane,t)},sne=J(`div`,{name:`MuiSnackbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`anchorOrigin${Y(n.anchorOrigin.vertical)}${Y(n.anchorOrigin.horizontal)}`]]}})(Pm(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:`fixed`,display:`flex`,left:8,right:8,justifyContent:`center`,alignItems:`center`,variants:[{props:({ownerState:e})=>e.anchorOrigin.vertical===`top`,style:{top:8,[e.breakpoints.up(`sm`)]:{top:24}}},{props:({ownerState:e})=>e.anchorOrigin.vertical!==`top`,style:{bottom:8,[e.breakpoints.up(`sm`)]:{bottom:24}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`left`,style:{justifyContent:`flex-start`,[e.breakpoints.up(`sm`)]:{left:24,right:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`right`,style:{justifyContent:`flex-end`,[e.breakpoints.up(`sm`)]:{right:24,left:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`center`,style:{[e.breakpoints.up(`sm`)]:{left:`50%`,right:`auto`,transform:`translateX(-50%)`}}}]}))),$h=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiSnackbar`}),r=Cm(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:o,horizontal:s}={vertical:`bottom`,horizontal:`left`},autoHideDuration:c=null,children:l,className:u,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:p=!1,message:m,onBlur:h,onClose:g,onFocus:_,onMouseEnter:v,onMouseLeave:y,open:b,resumeHideDuration:x,slots:S={},slotProps:w={},TransitionComponent:T,transitionDuration:E=i,TransitionProps:{onEnter:D,onExited:O,...k}={},...A}=n,j={...n,anchorOrigin:{vertical:o,horizontal:s},autoHideDuration:c,disableWindowBlurListener:p,TransitionComponent:T,transitionDuration:E},M=one(j),{getRootProps:N,onClickAway:P}=Yte(j),[F,I]=C.useState(!0),L=e=>{I(!0),O&&O(e)},R=(e,t)=>{I(!1),D&&D(e,t)},ee={slots:{transition:T,...S},slotProps:{content:f,clickAwayListener:d,transition:k,...w}},[z,te]=Hm(`root`,{ref:t,className:[M.root,u],elementType:sne,getSlotProps:N,externalForwardedProps:{...ee,...A},ownerState:j}),[B,{ownerState:V,...ne}]=Hm(`clickAwayListener`,{elementType:Kh,externalForwardedProps:ee,getSlotProps:e=>({onClickAway:(...t)=>{let n=t[0];e.onClickAway?.(...t),!n?.defaultMuiPrevented&&P(...t)}}),ownerState:j}),[re,ie]=Hm(`content`,{elementType:ine,shouldForwardComponentProp:!0,externalForwardedProps:ee,additionalProps:{message:m,action:a},ownerState:j}),[ae,oe]=Hm(`transition`,{elementType:Qh,externalForwardedProps:ee,getSlotProps:e=>({onEnter:(...t)=>{e.onEnter?.(...t),R(...t)},onExited:(...t)=>{e.onExited?.(...t),L(...t)}}),additionalProps:{appear:!0,in:b,timeout:E,direction:o===`top`?`down`:`up`},ownerState:j});return!b&&F?null:(0,G.jsx)(B,{...ne,...S.clickAwayListener&&{ownerState:V},children:(0,G.jsx)(z,{...te,children:(0,G.jsx)(ae,{...oe,children:l||(0,G.jsx)(re,{...ie})})})})}),eg=(0,C.createContext)({show:()=>{}}),cne=0,lne=e=>{let[t,n]=(0,C.useState)([]),r=(0,C.useCallback)(e=>{n(t=>[...t,{...e,autoHideDuration:e.autoHideDuration??6e3,notificationId:cne++}])},[]),i=e=>{n(t=>t.filter(t=>t.notificationId!==e))};return(0,G.jsxs)(eg.Provider,{value:{show:r},children:[e.children,t.map(e=>(0,G.jsx)($h,{open:!0,autoHideDuration:e.autoHideDuration,onClose:()=>i(e.notificationId),children:(0,G.jsx)(Uh,{severity:e.severity,variant:`filled`,sx:{minWidth:`300px`},children:e.message})},e.notificationId))]})};function tg(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ng=typeof Symbol==`function`&&Symbol.observable||`@@observable`,rg=()=>Math.random().toString(36).substring(7).split(``).join(`.`),ig={INIT:`@@redux/INIT${rg()}`,REPLACE:`@@redux/REPLACE${rg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${rg()}`};function ag(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function og(e,t,n){if(typeof e!=`function`)throw Error(tg(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(tg(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(tg(1));return n(og)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(tg(3));return i}function d(e){if(typeof e!=`function`)throw Error(tg(4));if(c)throw Error(tg(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(tg(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!ag(e))throw Error(tg(7));if(e.type===void 0)throw Error(tg(8));if(typeof e.type!=`string`)throw Error(tg(17));if(c)throw Error(tg(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(tg(10));r=e,f({type:ig.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(tg(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[ng](){return this}}}return f({type:ig.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[ng]:m}}function une(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:ig.INIT})===void 0)throw Error(tg(12));if(n(void 0,{type:ig.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(tg(13))})}function dne(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{une(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(tg(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function sg(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function fne(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(tg(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=sg(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function pne(e){return ag(e)&&`type`in e&&typeof e.type==`string`}var cg=Symbol.for(`immer-nothing`),lg=Symbol.for(`immer-draftable`),ug=Symbol.for(`immer-state`);function dg(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fg=Object,pg=fg.getPrototypeOf,mg=`constructor`,hg=`prototype`,gg=`configurable`,_g=`enumerable`,vg=`writable`,yg=`value`,bg=e=>!!e&&!!e[ug];function xg(e){return e?Cg(e)||kg(e)||!!e[lg]||!!e[mg]?.[lg]||Ag(e)||jg(e):!1}var mne=fg[hg][mg].toString(),Sg=new WeakMap;function Cg(e){if(!e||!Mg(e))return!1;let t=pg(e);if(t===null||t===fg[hg])return!0;let n=fg.hasOwnProperty.call(t,mg)&&t[mg];if(n===Object)return!0;if(!Ng(n))return!1;let r=Sg.get(n);return r===void 0&&(r=Function.toString.call(n),Sg.set(n,r)),r===mne}function wg(e,t,n=!0){Tg(e)===0?(n?Reflect.ownKeys(e):fg.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Tg(e){let t=e[ug];return t?t.type_:kg(e)?1:Ag(e)?2:jg(e)?3:0}var Eg=(e,t,n=Tg(e))=>n===2?e.has(t):fg[hg].hasOwnProperty.call(e,t),Dg=(e,t,n=Tg(e))=>n===2?e.get(t):e[t],Og=(e,t,n,r=Tg(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function hne(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var kg=Array.isArray,Ag=e=>e instanceof Map,jg=e=>e instanceof Set,Mg=e=>typeof e==`object`,Ng=e=>typeof e==`function`,Pg=e=>typeof e==`boolean`;function gne(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Fg=e=>e.copy_||e.base_,Ig=e=>e.modified_?e.copy_:e.base_;function Lg(e,t){if(Ag(e))return new Map(e);if(jg(e))return new Set(e);if(kg(e))return Array[hg].slice.call(e);let n=Cg(e);if(t===!0||t===`class_only`&&!n){let t=fg.getOwnPropertyDescriptors(e);delete t[ug];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[vg]===!1&&(a[vg]=!0,a[gg]=!0),(a.get||a.set)&&(t[i]={[gg]:!0,[vg]:!0,[_g]:a[_g],[yg]:e[i]})}return fg.create(pg(e),t)}else{let t=pg(e);if(t!==null&&n)return{...e};let r=fg.create(t);return fg.assign(r,e)}}function Rg(e,t=!1){return Bg(e)||bg(e)||!xg(e)?e:(Tg(e)>1&&fg.defineProperties(e,{set:zg,add:zg,clear:zg,delete:zg}),fg.freeze(e),t&&wg(e,(e,t)=>{Rg(t,!0)},!1),e)}function _ne(){dg(2)}var zg={[yg]:_ne};function Bg(e){return e===null||!Mg(e)?!0:fg.isFrozen(e)}var Vg=`MapSet`,Hg=`Patches`,Ug=`ArrayMethods`,Wg={};function Gg(e){let t=Wg[e];return t||dg(0,e),t}var Kg=e=>!!Wg[e],qg,Jg=()=>qg,vne=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kg(Vg)?Gg(Vg):void 0,arrayMethodsPlugin_:Kg(Ug)?Gg(Ug):void 0});function Yg(e,t){t&&(e.patchPlugin_=Gg(Hg),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xg(e){Zg(e),e.drafts_.forEach(yne),e.drafts_=null}function Zg(e){e===qg&&(qg=e.parent_)}var Qg=e=>qg=vne(qg,e);function yne(e){let t=e[ug];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $g(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[ug].modified_&&(Xg(t),dg(4)),xg(e)&&(e=e_(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ug].base_,e,t)}else e=e_(t,n);return bne(t,e,!0),Xg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===cg?void 0:e}function e_(e,t){if(Bg(t))return t;let n=t[ug];if(!n)return a_(t,e.handledSet_,e);if(!n_(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);i_(n,e)}return n.copy_}function bne(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rg(t,n)}function t_(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var n_=(e,t)=>e.scope_===t,xne=[];function r_(e,t,n,r){let i=Fg(e),a=e.type_;if(r!==void 0&&Dg(i,r,a)===t){Og(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;wg(i,(e,n)=>{if(bg(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??xne;for(let e of o)Og(i,e,n,a)}function Sne(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!n_(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Ig(i);r_(e,i.draft_??i,a,n),i_(i,r)})}function i_(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}t_(e)}}function Cne(e,t,n){let{scope_:r}=e;if(bg(n)){let i=n[ug];n_(i,r)&&i.callbacks_.push(function(){d_(e),r_(e,n,Ig(i),t)})}else xg(n)&&e.callbacks_.push(function(){let i=Fg(e);e.type_===3?i.has(n)&&a_(n,r.handledSet_,r):Dg(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&a_(Dg(e.copy_,t,e.type_),r.handledSet_,r)})}function a_(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||bg(e)||t.has(e)||!xg(e)||Bg(e)?e:(t.add(e),wg(e,(r,i)=>{if(bg(i)){let t=i[ug];n_(t,n)&&(Og(e,r,Ig(t),e.type_),t_(t))}else xg(i)&&a_(i,t,n)}),e)}function wne(e,t){let n=kg(e),r={type_:+!!n,scope_:t?t.scope_:Jg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=o_;n&&(i=[r],a=s_);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var o_={get(e,t){if(t===ug)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Fg(e);if(!Eg(i,t,e.type_))return Tne(e,i,t);let a=i[t];if(e.finalized_||!xg(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&gne(t))return a;if(a===c_(e.base_,t)){d_(e);let n=e.type_===1?+t:t,r=f_(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Fg(e)},ownKeys(e){return Reflect.ownKeys(Fg(e))},set(e,t,n){let r=l_(Fg(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=c_(Fg(e),t),i=r?.[ug];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(hne(n,r)&&(n!==void 0||Eg(e.base_,t,e.type_)))return!0;d_(e),u_(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Cne(e,t,n),!0)},deleteProperty(e,t){return d_(e),c_(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),u_(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Fg(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[vg]:!0,[gg]:e.type_!==1||t!==`length`,[_g]:r[_g],[yg]:n[t]}},defineProperty(){dg(11)},getPrototypeOf(e){return pg(e.base_)},setPrototypeOf(){dg(12)}},s_={};for(let e in o_){let t=o_[e];s_[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}s_.deleteProperty=function(e,t){return s_.set.call(this,e,t,void 0)},s_.set=function(e,t,n){return o_.set.call(this,e[0],t,n,e[0])};function c_(e,t){let n=e[ug];return(n?Fg(n):e)[t]}function Tne(e,t,n){let r=l_(t,n);return r?yg in r?r[yg]:r.get?.call(e.draft_):void 0}function l_(e,t){if(!(t in e))return;let n=pg(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pg(n)}}function u_(e){e.modified_||(e.modified_=!0,e.parent_&&u_(e.parent_))}function d_(e){e.copy_||=(e.assigned_=new Map,Lg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ene=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ng(e)&&!Ng(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ng(t)||dg(6),n!==void 0&&!Ng(n)&&dg(7);let r;if(xg(e)){let i=Qg(this),a=f_(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Xg(i):Zg(i)}return Yg(i,n),$g(r,i)}else if(!e||!Mg(e)){if(r=t(e),r===void 0&&(r=e),r===cg&&(r=void 0),this.autoFreeze_&&Rg(r,!0),n){let t=[],i=[];Gg(Hg).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else dg(1,e)},this.produceWithPatches=(e,t)=>{if(Ng(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Pg(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Pg(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Pg(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xg(e)||dg(8),bg(e)&&(e=Dne(e));let t=Qg(this),n=f_(t,e,void 0);return n[ug].isManual_=!0,Zg(t),n}finishDraft(e,t){let n=e&&e[ug];(!n||!n.isManual_)&&dg(9);let{scope_:r}=n;return Yg(r,t),$g(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Gg(Hg).applyPatches_;return bg(e)?r(e,t):this.produce(e,e=>r(e,t))}};function f_(e,t,n,r){let[i,a]=Ag(t)?Gg(Vg).proxyMap_(t,n):jg(t)?Gg(Vg).proxySet_(t,n):wne(t,n);return(n?.scope_??Jg()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Sne(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function Dne(e){return bg(e)||dg(10,e),p_(e)}function p_(e){if(!xg(e)||Bg(e))return e;let t=e[ug],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Lg(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Lg(e,!0);return wg(n,(e,t)=>{Og(n,e,p_(t))},r),t&&(t.finalized_=!1),n}var m_=new Ene().produce,h_=Symbol(`NOT_FOUND`);function One(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function kne(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Ane(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var g_=e=>Array.isArray(e)?e:[e];function jne(e){let t=Array.isArray(e[0])?e[0]:e;return Ane(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Mne(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function Nne(e){let t;return{get(n){return t&&e(t.key,n)?t.value:h_},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Pne(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return h_}function i(t,i){r(t)===h_&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var Fne=(e,t)=>e===t;function Ine(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function Lne(e,t){let{equalityCheck:n=Fne,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Ine(n),o=0,s=r<=1?Nne(a):Pne(r,a);function c(){let t=s.get(arguments);if(t===h_){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Rne=class{constructor(e){this.value=e}deref(){return this.value}},zne=typeof WeakRef<`u`?WeakRef:Rne,Bne=0,__=1;function v_(){return{s:Bne,v:void 0,o:null,p:null}}function y_(e,t={}){let n=v_(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}}let s=t,c;if(t.s===__)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new zne(c):c}return s.s=__,s.v=c,c}return o.clearCache=()=>{n=v_(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function b_(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),One(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=y_,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=g_(c),p=g_(u),m=jne(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Mne(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var x_=b_(y_),Vne=Object.assign((e,t=x_)=>{kne(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Vne});function S_(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Hne=S_(),Une=S_,Wne=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?sg:sg.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Gne=e=>e&&typeof e.match==`function`;function C_(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(P_(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>pne(t)&&t.type===e,n}var w_=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function T_(e){return xg(e)?m_(e,()=>{}):e}function Kne(e){return typeof e==`boolean`}var qne=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new w_;return t&&(Kne(t)?a.push(Hne):a.push(Une(t.extraArgument))),a},Jne=`RTK_autoBatch`,E_=e=>t=>{setTimeout(t,e)},Yne=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?window.requestAnimationFrame:E_(10):e.type===`callback`?e.queueNotification:E_(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Jne],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},Xne=e=>function(t){let{autoBatch:n=!0}=t??{},r=new w_(e);return n&&r.push(Yne(typeof n==`object`?n:void 0)),r};function Zne(e){let t=qne(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(ag(n))c=dne(n);else throw Error(P_(1));let l;l=typeof r==`function`?r(t):t();let u=sg;i&&(u=Wne({trace:!1,...typeof i==`object`&&i}));let d=Xne(fne(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return og(c,o,p)}function Qne(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(P_(28));if(r in t)throw Error(P_(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function $ne(e){return typeof e==`function`}function D_(e,t){let[n,r,i]=Qne(t),a;if($ne(e))a=()=>T_(e());else{let t=T_(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n)if(bg(e)){let r=n(e,t);return r===void 0?e:r}else if(xg(e))return m_(e,e=>n(e,t));else{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}return e},e)}return o.getInitialState=a,o}var ere=(e,t)=>Gne(e)?e.match(t):e(t);function tre(...e){return t=>e.some(e=>ere(e,t))}var nre=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,rre=(e=21)=>{let t=``,n=e;for(;n--;)t+=nre[Math.random()*64|0];return t},ire=[`name`,`message`,`stack`,`code`],O_=class{constructor(e,t){this.payload=e,this.meta=t}_type},k_=class{constructor(e,t){this.payload=e,this.meta=t}_type},are=e=>{if(typeof e==`object`&&e){let t={};for(let n of ire)typeof e[n]==`string`&&(t[n]=e[n]);return t}return{message:String(e)}},A_=`External signal was aborted`,ore=(()=>{function e(e,t,n){let r=C_(e+`/fulfilled`,(e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:`fulfilled`}})),i=C_(e+`/pending`,(e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:`pending`}})),a=C_(e+`/rejected`,(e,t,r,i,a)=>({payload:i,error:(n&&n.serializeError||are)(e||`Rejected`),meta:{...a||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:`rejected`,aborted:e?.name===`AbortError`,condition:e?.name===`ConditionError`}}));function o(e,{signal:o}={}){return(s,c,l)=>{let u=n?.idGenerator?n.idGenerator(e):rre(),d=new AbortController,f,p;function m(e){p=e,d.abort()}o&&(o.aborted?m(A_):o.addEventListener(`abort`,()=>m(A_),{once:!0}));let h=async function(){let o;try{let a=n?.condition?.(e,{getState:c,extra:l});if(cre(a)&&(a=await a),a===!1||d.signal.aborted)throw{name:`ConditionError`,message:`Aborted due to condition callback returning false.`};let h=new Promise((e,t)=>{f=()=>{t({name:`AbortError`,message:p||`Aborted`})},d.signal.addEventListener(`abort`,f,{once:!0})});s(i(u,e,n?.getPendingMeta?.({requestId:u,arg:e},{getState:c,extra:l}))),o=await Promise.race([h,Promise.resolve(t(e,{dispatch:s,getState:c,extra:l,requestId:u,signal:d.signal,abort:m,rejectWithValue:(e,t)=>new O_(e,t),fulfillWithValue:(e,t)=>new k_(e,t)})).then(t=>{if(t instanceof O_)throw t;return t instanceof k_?r(t.payload,u,e,t.meta):r(t,u,e)})])}catch(t){o=t instanceof O_?a(null,u,e,t.payload,t.meta):a(t,u,e)}finally{f&&d.signal.removeEventListener(`abort`,f)}return n&&!n.dispatchConditionRejection&&a.match(o)&&o.meta.condition||s(o),o}();return Object.assign(h,{abort:m,requestId:u,arg:e,unwrap(){return h.then(sre)}})}}return Object.assign(o,{pending:i,rejected:a,fulfilled:r,settled:tre(a,r),typePrefix:e})}return e.withTypes=()=>e,e})();function sre(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function cre(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}var j_=`listener`,M_=`completed`,lre=`cancelled`;`${lre}`,`${M_}`,`${j_}${lre}`,`${j_}${M_}`;var{assign:ure}=Object,N_=`listenerMiddleware`,dre=ure(C_(`${N_}/add`),{withTypes:()=>dre});`${N_}`;var fre=ure(C_(`${N_}/remove`),{withTypes:()=>fre});function P_(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var pre=class extends Error{constructor(e,t,n){super(e),this.status=t,this.body=n,this.name=`ApiError`}};async function F_(e){let t=await e.text();try{return JSON.parse(t)}catch{throw new pre(`Invalid JSON response (HTTP ${e.status}): ${t.slice(0,120)}`,e.status,t)}}async function I_(e,t){if(!e.ok){let n=await e.text().catch(()=>``),r=t;try{let e=JSON.parse(n);e?.error&&(r=e.error)}catch{r=n?`${t} (HTTP ${e.status}: ${n.slice(0,120)})`:`${t} (HTTP ${e.status})`}throw Error(r)}}async function mre(){let e=await fetch(`api/matter/bridges?_s=${Date.now()}`);return await I_(e,`Failed to fetch bridges`),F_(e)}async function L_(e){let t=await fetch(`api/matter/bridges`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await I_(t,`Failed to create bridge`),F_(t)}async function R_(e){let t=await fetch(`api/matter/bridges/${e.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await I_(t,`Failed to update bridge`),F_(t)}async function hre(e){await fetch(`api/matter/bridges/${e}`,{method:`DELETE`})}async function gre(e){let t=await fetch(`api/matter/bridges/${e}/actions/factory-reset`,{method:`POST`});return await I_(t,`Factory reset failed`),F_(t)}async function z_(e){let t=await fetch(`api/matter/bridges/${e}/actions/force-sync`,{method:`POST`});return await I_(t,`Force sync failed`),F_(t)}async function _re(e){let t=await fetch(`api/matter/bridges/${e}/actions/open-commissioning-window`,{method:`POST`});return await I_(t,`Failed to open commissioning window`),F_(t)}async function vre(e){if(!(await fetch(`api/matter/bridges/priorities`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({updates:e})})).ok)throw Error(`Failed to update priorities`)}async function B_(){let e=await fetch(`api/matter/bridges/actions/start-all`,{method:`POST`});return await I_(e,`Failed to start all bridges`),F_(e)}async function V_(){let e=await fetch(`api/matter/bridges/actions/stop-all`,{method:`POST`});return await I_(e,`Failed to stop all bridges`),F_(e)}async function H_(){let e=await fetch(`api/matter/bridges/actions/restart-all`,{method:`POST`});return await I_(e,`Failed to restart all bridges`),F_(e)}var U_=ore.withTypes(),W_=x_.withTypes(),G_=U_(`bridges/load`,mre),K_=U_(`bridges/create`,L_),q_=U_(`bridges/delete`,hre),J_=U_(`bridges/update`,R_),Y_=U_(`bridges/reset`,gre),X_=C_(`bridges/setFromWebSocket`),Z_=C_(`bridges/updateFromWebSocket`),Q_=V.withTypes(),$_=ie.withTypes(),ev=(0,C.createContext)({isConnected:!1,error:null});function tv(){return(0,C.useContext)(ev)}function yre({children:e}){let t=Q_(),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(e=>{switch(e.type){case`bridges_update`:t(X_(e.data));break;case`bridge_update`:t(Z_(e.data));break;case`ping`:o.current?.send(JSON.stringify({type:`pong`}));break}},[t]),l=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=document.querySelector(`base`)?.href||window.location.origin,n=new URL(t),i=`${e}//${n.host}${n.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`);try{let e=new WebSocket(i);o.current=e,e.onopen=()=>{r(!0),a(null)},e.onmessage=e=>{try{c(JSON.parse(e.data))}catch{console.warn(`Invalid WebSocket message`)}},e.onclose=()=>{r(!1),o.current=null,s.current=setTimeout(l,3e3)},e.onerror=()=>{a(Error(`WebSocket connection error`)),e.close()}}catch(e){a(e instanceof Error?e:Error(`Failed to connect`))}},[c]);return(0,C.useEffect)(()=>(l(),()=>{s.current&&clearTimeout(s.current),o.current?.close()}),[l]),(0,G.jsx)(ev.Provider,{value:{isConnected:n,error:i},children:e})}var bre=()=>{let e=Q_();return(0,C.useEffect)(()=>{e(G_())},[e]),(0,G.jsx)(oi,{})},nv;(function(e){e.Starting=`starting`,e.Running=`running`,e.Stopped=`stopped`,e.Failed=`failed`})(nv||={});var rv;(function(e){e.Pattern=`pattern`,e.Regex=`regex`,e.Domain=`domain`,e.Platform=`platform`,e.Label=`label`,e.EntityLabel=`entity_label`,e.DeviceLabel=`device_label`,e.EntityLabelRegex=`entity_label_regex`,e.DeviceLabelRegex=`device_label_regex`,e.AnyFieldRegex=`any_field_regex`,e.Area=`area`,e.EntityCategory=`entity_category`,e.DeviceName=`device_name`,e.ProductName=`product_name`,e.DeviceClass=`device_class`})(rv||={});var iv=[{id:`all_lights`,name:`All Lights`,description:`Expose all light entities. Ideal for controlling lights via Apple Home, Google Home, or Alexa.`,icon:`light`,filter:{include:[{type:rv.Domain,value:`light`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`lights`,`popular`]},{id:`all_switches`,name:`All Switches & Plugs`,description:`Expose all switch entities including smart plugs. Includes power and energy monitoring.`,icon:`switch`,filter:{include:[{type:rv.Domain,value:`switch`}],exclude:[]},featureFlags:{},tags:[`switches`,`plugs`]},{id:`sensors_only`,name:`All Sensors`,description:`Expose temperature, humidity, pressure, and other sensors. Auto-combines related sensors from the same device.`,icon:`sensor`,filter:{include:[{type:rv.Domain,value:`sensor`},{type:rv.Domain,value:`binary_sensor`}],exclude:[]},featureFlags:{autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`sensors`,`temperature`,`humidity`]},{id:`climate_control`,name:`Climate & Covers`,description:`Expose thermostats, fans, covers, and humidifiers for climate control.`,icon:`climate`,filter:{include:[{type:rv.Domain,value:`climate`},{type:rv.Domain,value:`fan`},{type:rv.Domain,value:`cover`},{type:rv.Domain,value:`humidifier`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`climate`,`thermostat`,`covers`]},{id:`security`,name:`Security & Locks`,description:`Expose locks, alarm panels, and security-related binary sensors (motion, door, window).`,icon:`lock`,filter:{include:[{type:rv.Domain,value:`lock`},{type:rv.Domain,value:`alarm_control_panel`},{type:rv.DeviceClass,value:`motion`},{type:rv.DeviceClass,value:`door`},{type:rv.DeviceClass,value:`window`}],exclude:[],includeMode:`any`},featureFlags:{autoBatteryMapping:!0},tags:[`security`,`locks`,`alarm`]},{id:`robot_vacuum`,name:`Robot Vacuum (Server Mode)`,description:`Single vacuum bridge with Server Mode enabled. Required for Apple Home Siri commands and proper Alexa discovery. Add only ONE vacuum to this bridge.`,icon:`vacuum`,filter:{include:[{type:rv.Domain,value:`vacuum`}],exclude:[]},featureFlags:{serverMode:!0},tags:[`vacuum`,`server-mode`,`apple-home`]},{id:`media_players`,name:`Media Players & Speakers`,description:`Expose media players, speakers, and TVs for volume and playback control.`,icon:`media_player`,filter:{include:[{type:rv.Domain,value:`media_player`}],exclude:[]},featureFlags:{},tags:[`media`,`speakers`,`tv`]},{id:`google_home_optimized`,name:`Google Home Optimized`,description:`All devices with Auto Force Sync enabled. Prevents Google Home from showing devices as offline after a few hours.`,icon:`default`,filter:{include:[{type:rv.Pattern,value:`*`}],exclude:[]},featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`google-home`,`all-devices`]},{id:`alexa_covers`,name:`Alexa-Optimized Covers`,description:`Covers with Alexa-friendly percentage display. Displayed percentage matches Home Assistant values.`,icon:`cover`,filter:{include:[{type:rv.Domain,value:`cover`}],exclude:[]},featureFlags:{coverUseHomeAssistantPercentage:!0,autoBatteryMapping:!0},tags:[`alexa`,`covers`]},{id:`automations_scripts`,name:`Automations & Scripts`,description:`Expose Home Assistant automations, scripts, and scenes as Matter switches.`,icon:`remote`,filter:{include:[{type:rv.Domain,value:`automation`},{type:rv.Domain,value:`script`},{type:rv.Domain,value:`scene`}],exclude:[]},featureFlags:{},tags:[`automations`,`scripts`,`scenes`]}],xre;(function(e){e[e.locked=1]=`locked`,e[e.unlocked=2]=`unlocked`})(xre||={});var Sre;(function(e){e[e.Off=0]=`Off`,e[e.Low=1]=`Low`,e[e.Medium=2]=`Medium`,e[e.High=3]=`High`,e[e.On=4]=`On`,e[e.Auto=5]=`Auto`,e[e.Smart=6]=`Smart`})(Sre||={});var Cre;(function(e){e[e.Forward=0]=`Forward`,e[e.Reverse=1]=`Reverse`})(Cre||={});var wre;(function(e){e[e.OffLowMedHigh=0]=`OffLowMedHigh`,e[e.OffLowHigh=1]=`OffLowHigh`,e[e.OffLowMedHighAuto=2]=`OffLowMedHighAuto`,e[e.OffLowHighAuto=3]=`OffLowHighAuto`,e[e.OffHighAuto=4]=`OffHighAuto`,e[e.OffHigh=5]=`OffHigh`})(wre||={});var Tre;(function(e){e[e.Stopped=0]=`Stopped`,e[e.Running=1]=`Running`,e[e.Paused=2]=`Paused`,e[e.Error=3]=`Error`,e[e.SeekingCharger=64]=`SeekingCharger`,e[e.Charging=65]=`Charging`,e[e.Docked=66]=`Docked`})(Tre||={});var Ere;(function(e){e[e.Off=0]=`Off`,e[e.Auto=1]=`Auto`,e[e.Cool=3]=`Cool`,e[e.Heat=4]=`Heat`,e[e.EmergencyHeat=5]=`EmergencyHeat`,e[e.Precooling=6]=`Precooling`,e[e.FanOnly=7]=`FanOnly`,e[e.Dry=8]=`Dry`,e[e.Sleep=9]=`Sleep`})(Ere||={});var av;(function(e){e.homeAssistantEntity=`homeAssistantEntity`,e.identify=`identify`,e.groups=`groups`,e.scenesManagement=`scenesManagement`,e.bridgedDeviceBasicInformation=`bridgedDeviceBasicInformation`,e.airQuality=`airQuality`,e.booleanState=`booleanState`,e.booleanStateConfiguration=`booleanStateConfiguration`,e.carbonDioxideConcentrationMeasurement=`carbonDioxideConcentrationMeasurement`,e.carbonMonoxideConcentrationMeasurement=`carbonMonoxideConcentrationMeasurement`,e.colorControl=`colorControl`,e.doorLock=`doorLock`,e.electricalEnergyMeasurement=`electricalEnergyMeasurement`,e.electricalPowerMeasurement=`electricalPowerMeasurement`,e.flowMeasurement=`flowMeasurement`,e.levelControl=`levelControl`,e.fanControl=`fanControl`,e.illuminanceMeasurement=`illuminanceMeasurement`,e.nitrogenDioxideConcentrationMeasurement=`nitrogenDioxideConcentrationMeasurement`,e.occupancySensing=`occupancySensing`,e.onOff=`onOff`,e.ozoneConcentrationMeasurement=`ozoneConcentrationMeasurement`,e.pm1ConcentrationMeasurement=`pm1ConcentrationMeasurement`,e.pm10ConcentrationMeasurement=`pm10ConcentrationMeasurement`,e.pm25ConcentrationMeasurement=`pm25ConcentrationMeasurement`,e.powerSource=`powerSource`,e.powerTopology=`powerTopology`,e.pressureMeasurement=`pressureMeasurement`,e.relativeHumidityMeasurement=`relativeHumidityMeasurement`,e.smokeCoAlarm=`smokeCoAlarm`,e.temperatureMeasurement=`temperatureMeasurement`,e.thermostat=`thermostat`,e.thermostatUserInterfaceConfiguration=`thermostatUserInterfaceConfiguration`,e.totalVolatileOrganicCompoundsConcentrationMeasurement=`totalVolatileOrganicCompoundsConcentrationMeasurement`,e.valveConfigurationAndControl=`valveConfigurationAndControl`,e.windowCovering=`windowCovering`,e.mediaInput=`mediaInput`,e.rvcCleanMode=`rvcCleanMode`,e.rvcRunMode=`rvcRunMode`,e.rvcOperationalState=`rvcOperationalState`,e.serviceArea=`serviceArea`,e.switch=`switch`,e.modeSelect=`modeSelect`})(av||={});var ov=[{id:`apple_home`,name:`Apple Home`,description:`Optimized for Apple Home and Siri. Enables composed devices for clean sensor grouping. Covers use standard Matter percentage (inverted from HA).`,icon:`default`,featureFlags:{autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`google_home`,name:`Google Home`,description:`Optimized for Google Home. Enables Auto Force Sync to prevent devices from going offline. Composed devices enabled for proper sensor grouping.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`alexa`,name:`Amazon Alexa`,description:`Optimized for Alexa. Enables Auto Force Sync and Alexa-friendly cover percentages. Battery mapping included for sensor devices.`,icon:`default`,featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0,coverUseHomeAssistantPercentage:!0}},{id:`multi_controller`,name:`Multi-Controller`,description:`Balanced settings for use with multiple controllers at once (e.g. Apple Home + Alexa). Force Sync enabled. Standard cover behavior.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}}],Dre;(function(e){e.Battery=`battery`,e.BatteryCharging=`battery_charging`,e.CarbonMonoxide=`carbon_monoxide`,e.Cold=`cold`,e.Connectivity=`connectivity`,e.Door=`door`,e.GarageDoor=`garage_door`,e.Gas=`gas`,e.Heat=`heat`,e.Light=`light`,e.Lock=`lock`,e.Moisture=`moisture`,e.Motion=`motion`,e.Moving=`moving`,e.Occupancy=`occupancy`,e.Opening=`opening`,e.Plug=`plug`,e.Power=`power`,e.Presence=`presence`,e.Problem=`problem`,e.Rain=`rain`,e.Running=`running`,e.Safety=`safety`,e.Smoke=`smoke`,e.Sound=`sound`,e.Tamper=`tamper`,e.Update=`update`,e.Vibration=`vibration`,e.Window=`window`})(Dre||={});var Ore;(function(e){e.off=`off`,e.heat=`heat`,e.cool=`cool`,e.heat_cool=`heat_cool`,e.auto=`auto`,e.dry=`dry`,e.fan_only=`fan_only`})(Ore||={});var kre;(function(e){e.off=`off`,e.preheating=`preheating`,e.heating=`heating`,e.cooling=`cooling`,e.drying=`drying`,e.fan=`fan`,e.idle=`idle`,e.defrosting=`defrosting`})(kre||={});var Are;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.TARGET_TEMPERATURE_RANGE=2]=`TARGET_TEMPERATURE_RANGE`,e[e.TARGET_HUMIDITY=4]=`TARGET_HUMIDITY`,e[e.FAN_MODE=8]=`FAN_MODE`,e[e.PRESET_MODE=16]=`PRESET_MODE`,e[e.SWING_MODE=32]=`SWING_MODE`,e[e.AUX_HEAT=64]=`AUX_HEAT`,e[e.TURN_OFF=128]=`TURN_OFF`,e[e.TURN_ON=256]=`TURN_ON`,e[e.SWING_HORIZONTAL_MODE=512]=`SWING_HORIZONTAL_MODE`})(Are||={});var jre;(function(e){e.closed=`closed`,e.open=`open`,e.closing=`closing`,e.opening=`opening`})(jre||={});var Mre;(function(e){e.button=`button`,e.doorbell=`doorbell`,e.motion=`motion`})(Mre||={});var Nre;(function(e){e.FORWARD=`forward`,e.REVERSE=`reverse`})(Nre||={});var Pre;(function(e){e[e.SET_SPEED=1]=`SET_SPEED`,e[e.OSCILLATE=2]=`OSCILLATE`,e[e.DIRECTION=4]=`DIRECTION`,e[e.PRESET_MODE=8]=`PRESET_MODE`,e[e.TURN_ON=16]=`TURN_ON`,e[e.TURN_OFF=32]=`TURN_OFF`})(Pre||={});var Fre;(function(e){e.UNKNOWN=`unknown`,e.ONOFF=`onoff`,e.BRIGHTNESS=`brightness`,e.COLOR_TEMP=`color_temp`,e.HS=`hs`,e.XY=`xy`,e.RGB=`rgb`,e.RGBW=`rgbw`,e.RGBWW=`rgbww`,e.WHITE=`white`})(Fre||={});var Ire;(function(e){e.Tv=`tv`,e.Speaker=`speaker`,e.Receiver=`receiver`})(Ire||={});var Lre;(function(e){e[e.PAUSE=1]=`PAUSE`,e[e.SEEK=2]=`SEEK`,e[e.VOLUME_SET=4]=`VOLUME_SET`,e[e.VOLUME_MUTE=8]=`VOLUME_MUTE`,e[e.PREVIOUS_TRACK=16]=`PREVIOUS_TRACK`,e[e.NEXT_TRACK=32]=`NEXT_TRACK`,e[e.TURN_ON=128]=`TURN_ON`,e[e.TURN_OFF=256]=`TURN_OFF`,e[e.PLAY_MEDIA=512]=`PLAY_MEDIA`,e[e.VOLUME_STEP=1024]=`VOLUME_STEP`,e[e.SELECT_SOURCE=2048]=`SELECT_SOURCE`,e[e.STOP=4096]=`STOP`,e[e.CLEAR_PLAYLIST=8192]=`CLEAR_PLAYLIST`,e[e.PLAY=16384]=`PLAY`,e[e.SHUFFLE_SET=32768]=`SHUFFLE_SET`,e[e.SELECT_SOUND_MODE=65536]=`SELECT_SOUND_MODE`,e[e.BROWSE_MEDIA=131072]=`BROWSE_MEDIA`,e[e.REPEAT_SET=262144]=`REPEAT_SET`,e[e.GROUPING=524288]=`GROUPING`,e[e.MEDIA_ANNOUNCE=1048576]=`MEDIA_ANNOUNCE`,e[e.MEDIA_ENQUEUE=2097152]=`MEDIA_ENQUEUE`})(Lre||={});var Rre;(function(e){e.None=`None`,e.apparent_power=`apparent_power`,e.aqi=`aqi`,e.atmospheric_pressure=`atmospheric_pressure`,e.battery=`battery`,e.carbon_dioxide=`carbon_dioxide`,e.carbon_monoxide=`carbon_monoxide`,e.current=`current`,e.data_rate=`data_rate`,e.data_size=`data_size`,e.date=`date`,e.distance=`distance`,e.duration=`duration`,e.energy=`energy`,e.energy_storage=`energy_storage`,e.enum=`enum`,e.frequency=`frequency`,e.gas=`gas`,e.humidity=`humidity`,e.illuminance=`illuminance`,e.irradiance=`irradiance`,e.moisture=`moisture`,e.monetary=`monetary`,e.nitrogen_dioxide=`nitrogen_dioxide`,e.nitrogen_monoxide=`nitrogen_monoxide`,e.nitrous_oxide=`nitrous_oxide`,e.ozone=`ozone`,e.ph=`ph`,e.pm1=`pm1`,e.pm25=`pm25`,e.pm10=`pm10`,e.power_factor=`power_factor`,e.power=`power`,e.precipitation=`precipitation`,e.precipitation_intensity=`precipitation_intensity`,e.pressure=`pressure`,e.radon=`radon`,e.reactive_power=`reactive_power`,e.signal_strength=`signal_strength`,e.sound_pressure=`sound_pressure`,e.speed=`speed`,e.sulphur_dioxide=`sulphur_dioxide`,e.temperature=`temperature`,e.timestamp=`timestamp`,e.volatile_organic_compounds=`volatile_organic_compounds`,e.volatile_organic_compounds_parts=`volatile_organic_compounds_parts`,e.voltage=`voltage`,e.volume=`volume`,e.volume_flow_rate=`volume_flow_rate`,e.volume_storage=`volume_storage`,e.water=`water`,e.weight=`weight`,e.wind_speed=`wind_speed`})(Rre||={});var zre;(function(e){e.cleaning=`cleaning`,e.docked=`docked`,e.returning=`returning`,e.error=`error`,e.idle=`idle`,e.paused=`paused`,e.segment_cleaning=`segment_cleaning`,e.zone_cleaning=`zone_cleaning`,e.spot_cleaning=`spot_cleaning`,e.mop_cleaning=`mop_cleaning`})(zre||={});var Bre;(function(e){e[e.TURN_ON=1]=`TURN_ON`,e[e.TURN_OFF=2]=`TURN_OFF`,e[e.PAUSE=4]=`PAUSE`,e[e.STOP=8]=`STOP`,e[e.RETURN_HOME=16]=`RETURN_HOME`,e[e.FAN_SPEED=32]=`FAN_SPEED`,e[e.BATTERY=64]=`BATTERY`,e[e.STATUS=128]=`STATUS`,e[e.SEND_COMMAND=256]=`SEND_COMMAND`,e[e.LOCATE=512]=`LOCATE`,e[e.CLEAN_SPOT=1024]=`CLEAN_SPOT`,e[e.MAP=2048]=`MAP`,e[e.STATE=4096]=`STATE`,e[e.START=8192]=`START`,e[e.CLEAN_AREA=16384]=`CLEAN_AREA`})(Bre||={});var Vre;(function(e){e.off=`off`,e.low=`low`,e.medium=`medium`,e.high=`high`,e.turbo=`turbo`,e.auto=`auto`,e.max=`max`})(Vre||={});var Hre;(function(e){e.off=`off`,e.eco=`eco`,e.electric=`electric`,e.gas=`gas`,e.heat_pump=`heat_pump`,e.high_demand=`high_demand`,e.performance=`performance`})(Hre||={});var Ure;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.OPERATION_MODE=2]=`OPERATION_MODE`,e[e.AWAY_MODE=4]=`AWAY_MODE`,e[e.ON_OFF=8]=`ON_OFF`})(Ure||={});var sv={air_purifier:`Air Purifier`,air_quality_sensor:`Air Quality Sensor`,basic_video_player:`Basic Video Player (TV)`,battery_storage:`Battery Sensor`,carbon_monoxide_sensor:`Carbon Monoxide (CO) Sensor`,color_temperature_light:`Color Temperature Light`,contact_sensor:`Contact Sensor`,dishwasher:`Dishwasher`,dimmable_light:`Dimmable Light`,dimmable_plugin_unit:`Dimmable Plug-in Unit`,door_lock:`Door Lock`,electrical_sensor:`Electrical Sensor (Power/Energy/Voltage/Current)`,extended_color_light:`Extended Color Light`,fan:`Fan`,flow_sensor:`Flow Sensor`,formaldehyde_sensor:`Formaldehyde (HCHO) Sensor`,generic_switch:`Generic Switch (Button)`,humidifier_dehumidifier:`Humidifier/Dehumidifier`,humidity_sensor:`Humidity Sensor`,light_sensor:`Light Sensor`,mode_select:`Mode Select`,motion_sensor:`Motion Sensor (PIR)`,nitrogen_dioxide_sensor:`Nitrogen Dioxide (NO₂) Sensor`,occupancy_sensor:`Occupancy Sensor`,on_off_light:`On/Off Light`,on_off_plugin_unit:`On/Off Plug-in Unit`,on_off_switch:`On/Off Switch`,ozone_sensor:`Ozone (O₃) Sensor`,pm1_sensor:`PM1 Sensor`,pressure_sensor:`Pressure Sensor`,pump:`Pump`,rain_sensor:`Rain Sensor`,radon_sensor:`Radon Sensor`,robot_vacuum_cleaner:`Robot Vacuum Cleaner`,smoke_co_alarm:`Smoke/CO Alarm`,speaker:`Speaker`,temperature_sensor:`Temperature Sensor`,thermostat:`Thermostat`,tvoc_sensor:`TVOC / VOC Index Sensor`,water_heater:`Water Heater`,water_freeze_detector:`Water Freeze Detector`,water_leak_detector:`Water Leak Detector`,water_valve:`Water Valve`,window_covering:`Window Covering`},cv={Auto:0,Quick:1,Quiet:2,LowNoise:3,LowEnergy:4,Vacation:5,Min:6,Max:7,Night:8,Day:9,DeepClean:16384,Vacuum:16385,Mop:16386,VacuumThenMop:16387},Wre={alarm_control_panel:[`mode_select`,`on_off_plugin_unit`],automation:[`on_off_switch`],binary_sensor:[`contact_sensor`,`motion_sensor`,`occupancy_sensor`,`rain_sensor`,`smoke_co_alarm`,`water_freeze_detector`,`water_leak_detector`],button:[`generic_switch`],climate:[`thermostat`],cover:[`window_covering`],event:[`generic_switch`],fan:[`air_purifier`,`fan`],humidifier:[`humidifier_dehumidifier`],input_boolean:[`on_off_plugin_unit`,`on_off_switch`],input_select:[`mode_select`],input_button:[`generic_switch`],light:[`color_temperature_light`,`dimmable_light`,`extended_color_light`,`on_off_light`],lock:[`door_lock`],media_player:[`basic_video_player`,`on_off_switch`,`speaker`],scene:[`on_off_switch`],script:[`on_off_switch`],sensor:[`air_quality_sensor`,`battery_storage`,`carbon_monoxide_sensor`,`electrical_sensor`,`formaldehyde_sensor`,`humidity_sensor`,`light_sensor`,`nitrogen_dioxide_sensor`,`ozone_sensor`,`pm1_sensor`,`pressure_sensor`,`radon_sensor`,`temperature_sensor`,`tvoc_sensor`],select:[`mode_select`],siren:[`on_off_plugin_unit`],switch:[`dishwasher`,`on_off_plugin_unit`,`on_off_switch`,`pump`,`water_valve`],vacuum:[`robot_vacuum_cleaner`],valve:[`water_valve`,`on_off_plugin_unit`],water_heater:[`water_heater`,`thermostat`]},Gre;(function(e){e.alarm_control_panel=`alarm_control_panel`,e.automation=`automation`,e.button=`button`,e.binary_sensor=`binary_sensor`,e.climate=`climate`,e.cover=`cover`,e.event=`event`,e.fan=`fan`,e.humidifier=`humidifier`,e.input_boolean=`input_boolean`,e.input_button=`input_button`,e.input_select=`input_select`,e.light=`light`,e.lock=`lock`,e.media_player=`media_player`,e.remote=`remote`,e.scene=`scene`,e.select=`select`,e.script=`script`,e.sensor=`sensor`,e.siren=`siren`,e.switch=`switch`,e.vacuum=`vacuum`,e.valve=`valve`,e.water_heater=`water_heater`,e.weather=`weather`})(Gre||={});var lv={type:`object`,default:{type:``,value:``},properties:{type:{title:`Type`,type:`string`,oneOf:[{const:`pattern`,title:`pattern`,description:`Wildcard pattern matching entity IDs. Use * as wildcard. Example: 'light.living_room_*' matches all lights in the living room.`},{const:`regex`,title:`regex`,description:`Regex tested against the entity_id only (e.g. 'light.kitchen_lamp'). For labels use entity_label_regex or device_label_regex. Example: '^(light|switch)\\.kitchen_.*'.`},{const:`domain`,title:`domain`,description:`Match entities by their domain (the part before the dot). Example: 'light', 'switch', 'sensor'.`},{const:`platform`,title:`platform`,description:`Match entities by their integration/platform. Example: 'hue', 'zwave', 'mqtt'.`},{const:`label`,title:`label (deprecated)`,description:`Deprecated: use entity_label or device_label instead. Behaves like entity_label.`},{const:`entity_label`,title:`entity_label`,description:`Matches only entities that have this label assigned directly. Other entities of the same device are NOT included.`},{const:`device_label`,title:`device_label`,description:`Matches ALL entities of a device if the device has this label. Use this to include a complete device with all its entities.`},{const:`entity_label_regex`,title:`entity_label_regex`,description:`Regex tested against entity-label slugs and display names. Matches if any label assigned to the entity matches. Example: '^(matter|voice).*'.`},{const:`device_label_regex`,title:`device_label_regex`,description:`Regex tested against device-label slugs and display names. Matches ALL entities of a device whose label matches. Example: '^(matter|voice).*'.`},{const:`any_field_regex`,title:`any_field_regex`,description:`Regex tested against a single-line key=value haystack covering entity_id, domain, platform, area, entity_category, device_class, entity_labels, entity_label_names, device_labels, device_label_names, device_name, product_name. Use lookaheads for AND, alternation for OR. Example: '(?=.*domain=light)(?=.*area=living_room)|(?=.*domain=switch)(?=.*entity_labels=.*\\bvoice\\b)'.`},{const:`area`,title:`area`,description:`Match entities by their area slug. Example: 'living_room', 'bedroom'.`},{const:`entity_category`,title:`entity_category`,description:`Match entities by their category. Example: 'config', 'diagnostic' to exclude configuration entities.`},{const:`device_name`,title:`device_name`,description:`Match entities by their device name. Supports wildcards. Example: '*Philips*' matches all Philips devices.`},{const:`product_name`,title:`product_name`,description:`Match entities by their product/model name. Supports wildcards. Example: 'Hue*Bulb'.`},{const:`device_class`,title:`device_class`,description:`Match entities by their device class attribute. Example: 'temperature', 'motion', 'door', 'window'.`}]},value:{title:`Value`,description:`For labels, use the display name or the label_id (slug). You can look up both on the Labels page in the sidebar.`,type:`string`,minLength:1}},required:[`type`,`value`],additionalProperties:!1},uv={type:`object`,title:`Bridge Config`,properties:{name:{title:`Name`,type:`string`,minLength:1,maxLength:32},port:{title:`Port`,type:`number`,minimum:1},icon:{title:`Icon`,type:`string`,description:`Icon to display for this bridge in the UI`,enum:[`light`,`switch`,`climate`,`cover`,`fan`,`lock`,`sensor`,`media_player`,`vacuum`,`remote`,`humidifier`,`speaker`,`garage`,`door`,`window`,`motion`,`battery`,`power`,`camera`,`default`]},countryCode:{title:`Country Code`,type:`string`,description:`An ISO 3166-1 alpha-2 code to represent the country in which the Node is located. Only needed if the commissioning fails due to missing country code.`,minLength:2,maxLength:3},priority:{title:`Startup Priority`,type:`number`,description:`Startup order priority. Lower values start first. Default is 100.`,default:100,minimum:1,maximum:999},serialNumberSuffix:{title:`Serial Number Suffix`,type:`string`,description:`Append a suffix to every entity serial number on this bridge. Useful for forcing controllers like Aqara to treat devices as new and bypass cached device data. Leave empty for default behavior.`,maxLength:16},sessionMaxAgeHours:{title:`Session Rotation Max Age (hours)`,type:`number`,description:`Server Mode only. Rotate matter sessions older than this many hours so iPhone clients re-subscribe and Apple Home unsticks 'Updating' tiles. Set 0 to disable rotation. Range 0-168, default 4. (#287)`,default:4,minimum:0,maximum:168},filter:{title:`Include or exclude entities`,type:`object`,properties:{include:{title:`Include`,type:`array`,items:lv},exclude:{title:`Exclude`,type:`array`,items:lv},includeMode:{title:`Include Mode`,type:`string`,description:`How to combine include rules: 'any' matches if ANY rule matches (OR), 'all' matches only if ALL rules match (AND). Default: 'any'`,enum:[`any`,`all`],default:`any`}},required:[`include`,`exclude`],additionalProperties:!1},featureFlags:{title:`Feature Flags`,type:`object`,properties:{coverDoNotInvertPercentage:{title:`Do not invert Percentages for Covers`,description:`Do not invert the percentage of covers to match Home Assistant (not Matter compliant)`,type:`boolean`,default:!1},coverUseHomeAssistantPercentage:{title:`Use Home Assistant Percentage for Covers (Alexa-friendly)`,description:`Display cover percentages matching Home Assistant values in Matter controllers like Alexa. This makes the displayed percentage match what you see in Home Assistant, but the semantic meaning differs: in HA, higher percentage = more open; in Alexa, higher percentage is typically interpreted as more closed. Open/Close commands will still work correctly.`,type:`boolean`,default:!1},coverSwapOpenClose:{title:`Swap Open/Close for Covers`,description:`Swap open/close commands and invert position reporting for covers. Enable this if Alexa voice commands are reversed (saying 'close' opens the blinds and vice versa).`,type:`boolean`,default:!1},includeHiddenEntities:{title:`Include Hidden Entities`,description:`Include entities that are marked as hidden in Home Assistant`,type:`boolean`,default:!1},serverMode:{title:`Server Mode (for Robot Vacuums)`,description:`Expose the device as a standalone Matter device instead of a bridged device. This is required for Apple Home to properly support Siri voice commands for Robot Vacuums. IMPORTANT: Only ONE device should be in this bridge when server mode is enabled.`,type:`boolean`,default:!1},autoBatteryMapping:{title:`Auto Battery Mapping`,description:`Automatically assign battery sensors from the same Home Assistant device to the main entity. When enabled, battery sensors will be merged into their parent devices instead of appearing as separate devices.`,type:`boolean`,default:!1},autoHumidityMapping:{title:`Auto Humidity Mapping`,description:`Automatically combine humidity sensors with temperature sensors from the same Home Assistant device. When enabled, humidity sensors will be merged into temperature sensors to create combined TemperatureHumiditySensor devices.`,type:`boolean`,default:!0},autoPressureMapping:{title:`Auto Pressure Mapping`,description:`Automatically combine pressure sensors with temperature sensors from the same Home Assistant device. When enabled, pressure sensors will be merged into temperature sensors to create combined sensor devices.`,type:`boolean`,default:!0},autoComposedDevices:{title:`Auto Composed Devices`,description:`Master toggle: combine related entities from the same Home Assistant device into a single Matter endpoint. Turns on battery, humidity, pressure, power, and energy auto-mapping at once, a Shelly Plug shows up as one device with power monitoring instead of several siblings.`,type:`boolean`,default:!1},autoForceSync:{title:`Auto Force Sync`,description:`Periodically compare and push all device states to connected controllers every 90 seconds. Enable this if devices get out of sync after extended periods. Health checks for dead sessions always run regardless of this setting.`,type:`boolean`,default:!1},productNameFromNodeLabel:{title:`Product Name from Node Label`,description:`Report the entity's node label (custom name / friendly name / entity id) as the Matter productName. Useful for controllers like Aqara that display productName as the device name instead of nodeLabel. A per-entity customProductName still takes precedence.`,type:`boolean`,default:!1},preferEntityRegistryName:{title:`Prefer Entity Registry Name (HA 2026.4 workaround)`,description:`Use the entity registry name (or original_name) as nodeLabel instead of the composed friendly_name. Since Home Assistant 2026.4, friendly_name is prefixed with the device name, which breaks voice commands that relied on the short entity name. Resolution order: customName → registry name → registry original_name → friendly_name → entity_id. Matter has no alias concept, this only changes which single name is reported.`,type:`boolean`,default:!1},vacuumOnOff:{title:`Vacuum: Include OnOff Cluster (Alexa)`,description:`Add an OnOff cluster to robot vacuum endpoints. Alexa REQUIRES this (PowerController) to show robotic vacuums in the app. Without it, Alexa commissions the device but never displays it. In Server Mode this is enabled automatically, only check this for bridge mode. WARNING: OnOff is NOT part of the Matter RVC device type specification. Enabling this may break Apple Home (shows 'Updating') and Google Home.`,type:`boolean`},alexaPreserveBrightnessOnTurnOn:{title:`Alexa: Preserve Brightness on Turn-On`,description:`Workaround for Alexa resetting light brightness to 100% after subscription renewal. When enabled, the bridge ignores brightness commands that set lights to 100% within 200ms of a turn-on command for the same light. WARNING: breaks Apple Home's 'set room to 100%' Siri commands, which use the same on() + moveToLevel(254) pattern. Only enable on Alexa-only bridges.`,type:`boolean`,default:!1},useHaRegistrySerial:{title:`Use HA Registry Serial Number`,description:`Fall back to the Home Assistant device registry serial_number when no per-entity customSerialNumber is configured. Default off because changing serialNumber after commissioning can confuse controllers. A per-entity customSerialNumber still takes precedence.`,type:`boolean`,default:!1},coverSliderDebounceMs:{title:`Cover Slider Debounce (ms)`,description:`Override the cover position-update debounce window for this bridge. Some controllers (Apple Home) stream slider updates while the user is still dragging, causing covers to start moving toward an intermediate target. Set to the time the bridge should wait after the last update before sending the final value to Home Assistant. 0 keeps the built-in two-phase debounce (400 ms initial / 150 ms subsequent), which fits most controllers. Try 800–1500 ms for slow blinds. A per-entity override on a single cover wins over this flag.`,type:`number`,minimum:0,maximum:5e3,default:0}}}},required:[`name`,`port`,`filter`],additionalProperties:!1};({...uv}),{...uv.properties},[...uv?.required??[]];var dv=X((0,G.jsx)(`path`,{d:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z`}),`ArrowBack`),fv=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z`}),`CheckCircle`),pv=X((0,G.jsx)(`path`,{d:`M9.19 6.35c-2.04 2.29-3.44 5.58-3.57 5.89L2 10.69l4.05-4.05c.47-.47 1.15-.68 1.81-.55zM11.17 17s3.74-1.55 5.89-3.7c5.4-5.4 4.5-9.62 4.21-10.57-.95-.3-5.17-1.19-10.57 4.21C8.55 9.09 7 12.83 7 12.83zm6.48-2.19c-2.29 2.04-5.58 3.44-5.89 3.57L13.31 22l4.05-4.05c.47-.47.68-1.15.55-1.81zM9 18c0 .83-.34 1.58-.88 2.12C6.94 21.3 2 22 2 22s.7-4.94 1.88-6.12C4.42 15.34 5.17 15 6 15c1.66 0 3 1.34 3 3m4-9c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2`}),`RocketLaunch`),Kre=Ld(`MuiBox`,[`root`]),Z=Fd({themeId:Sm,defaultTheme:bm(),defaultClassName:Kre.root,generateClassName:Nd.generate});function qre(e){return Id(`MuiButton`,e)}var mv=Ld(`MuiButton`,`root.text.textInherit.textPrimary.textSecondary.textSuccess.textError.textInfo.textWarning.outlined.outlinedInherit.outlinedPrimary.outlinedSecondary.outlinedSuccess.outlinedError.outlinedInfo.outlinedWarning.contained.containedInherit.containedPrimary.containedSecondary.containedSuccess.containedError.containedInfo.containedWarning.disableElevation.focusVisible.disabled.colorInherit.colorPrimary.colorSecondary.colorSuccess.colorError.colorInfo.colorWarning.textSizeSmall.textSizeMedium.textSizeLarge.outlinedSizeSmall.outlinedSizeMedium.outlinedSizeLarge.containedSizeSmall.containedSizeMedium.containedSizeLarge.sizeMedium.sizeSmall.sizeLarge.fullWidth.startIcon.endIcon.icon.iconSizeSmall.iconSizeMedium.iconSizeLarge.loading.loadingWrapper.loadingIconPlaceholder.loadingIndicator.loadingPositionCenter.loadingPositionStart.loadingPositionEnd`.split(`.`)),Jre=C.createContext({}),Yre=C.createContext(void 0),Xre=e=>{let{color:t,disableElevation:n,fullWidth:r,size:i,variant:a,loading:o,loadingPosition:s,classes:c}=e,l=fp({root:[`root`,o&&`loading`,a,`${a}${Y(t)}`,`size${Y(i)}`,`${a}Size${Y(i)}`,`color${Y(t)}`,n&&`disableElevation`,r&&`fullWidth`,o&&`loadingPosition${Y(s)}`],startIcon:[`icon`,`startIcon`,`iconSize${Y(i)}`],endIcon:[`icon`,`endIcon`,`iconSize${Y(i)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},qre,c);return{...c,...l}},hv=[{props:{size:`small`},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:`medium`},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:`large`},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],Zre=J(Nh,{shouldForwardProp:e=>Em(e)||e===`classes`,name:`MuiButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color)}`],t[`size${Y(n.size)}`],t[`${n.variant}Size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,n.loading&&t.loading]}})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[300]:e.palette.grey[800],n=e.palette.mode===`light`?e.palette.grey.A100:e.palette.grey[700];return{...e.typography.button,minWidth:64,padding:`6px 16px`,border:0,borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`,`color`],{duration:e.transitions.duration.short}),"&:hover":{textDecoration:`none`},[`&.${mv.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:{variant:`contained`},style:{color:`var(--variant-containedColor)`,backgroundColor:`var(--variant-containedBg)`,boxShadow:(e.vars||e).shadows[2],"&:hover":{boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2]}},"&:active":{boxShadow:(e.vars||e).shadows[8]},[`&.${mv.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},[`&.${mv.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}},{props:{variant:`outlined`},style:{padding:`5px 15px`,border:`1px solid currentColor`,borderColor:`var(--variant-outlinedBorder, currentColor)`,backgroundColor:`var(--variant-outlinedBg)`,color:`var(--variant-outlinedColor)`,[`&.${mv.disabled}`]:{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`}}},{props:{variant:`text`},style:{padding:`6px 8px`,color:`var(--variant-textColor)`,backgroundColor:`var(--variant-textBg)`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--variant-textColor":(e.vars||e).palette[t].main,"--variant-outlinedColor":(e.vars||e).palette[t].main,"--variant-outlinedBorder":e.alpha((e.vars||e).palette[t].main,.5),"--variant-containedColor":(e.vars||e).palette[t].contrastText,"--variant-containedBg":(e.vars||e).palette[t].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(e.vars||e).palette[t].dark,"--variant-textBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBorder":(e.vars||e).palette[t].main,"--variant-outlinedBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}}})),{props:{color:`inherit`},style:{color:`inherit`,borderColor:`currentColor`,"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedBg:t,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedHoverBg:n,"--variant-textBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity)}}}},{props:{size:`small`,variant:`text`},style:{padding:`4px 5px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`text`},style:{padding:`8px 11px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`outlined`},style:{padding:`3px 9px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`outlined`},style:{padding:`7px 21px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`contained`},style:{padding:`4px 10px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`contained`},style:{padding:`8px 22px`,fontSize:e.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:`none`,"&:hover":{boxShadow:`none`},[`&.${mv.focusVisible}`]:{boxShadow:`none`},"&:active":{boxShadow:`none`},[`&.${mv.disabled}`]:{boxShadow:`none`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{loadingPosition:`center`},style:{transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),[`&.${mv.loading}`]:{color:`transparent`}}}]}})),Qre=J(`span`,{name:`MuiButton`,slot:`StartIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.startIcon,n.loading&&t.startIconLoadingStart,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:8,marginLeft:-4,variants:[{props:{size:`small`},style:{marginLeft:-2}},{props:{loadingPosition:`start`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`start`,loading:!0,fullWidth:!0},style:{marginRight:-8}},...hv]})),$re=J(`span`,{name:`MuiButton`,slot:`EndIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.endIcon,n.loading&&t.endIconLoadingEnd,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:-4,marginLeft:8,variants:[{props:{size:`small`},style:{marginRight:-2}},{props:{loadingPosition:`end`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`end`,loading:!0,fullWidth:!0},style:{marginLeft:-8}},...hv]})),eie=J(`span`,{name:`MuiButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,variants:[{props:{loading:!0},style:{display:`flex`}},{props:{loadingPosition:`start`},style:{left:14}},{props:{loadingPosition:`start`,size:`small`},style:{left:10}},{props:{variant:`text`,loadingPosition:`start`},style:{left:6}},{props:{loadingPosition:`center`},style:{left:`50%`,transform:`translate(-50%)`,color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:`end`},style:{right:14}},{props:{loadingPosition:`end`,size:`small`},style:{right:10}},{props:{variant:`text`,loadingPosition:`end`},style:{right:6}},{props:{loadingPosition:`start`,fullWidth:!0},style:{position:`relative`,left:-10}},{props:{loadingPosition:`end`,fullWidth:!0},style:{position:`relative`,right:-10}}]})),gv=J(`span`,{name:`MuiButton`,slot:`LoadingIconPlaceholder`})({display:`inline-block`,width:`1em`,height:`1em`}),_v=C.forwardRef(function(e,t){let n=C.useContext(Jre),r=C.useContext(Yre),i=Om({props:Zd(n,e),name:`MuiButton`}),{children:a,color:o=`primary`,component:s=`button`,className:c,disabled:l=!1,disableElevation:u=!1,disableFocusRipple:d=!1,endIcon:f,focusVisibleClassName:p,fullWidth:m=!1,id:h,loading:g=null,loadingIndicator:_,loadingPosition:v=`center`,size:y=`medium`,startIcon:b,type:x,variant:S=`text`,...w}=i,T=rh(h),E=_??(0,G.jsx)(Rh,{"aria-labelledby":T,color:`inherit`,size:16}),D={...i,color:o,component:s,disabled:l,disableElevation:u,disableFocusRipple:d,fullWidth:m,loading:g,loadingIndicator:E,loadingPosition:v,size:y,type:x,variant:S},O=Xre(D),k=(b||g&&v===`start`)&&(0,G.jsx)(Qre,{className:O.startIcon,ownerState:D,children:b||(0,G.jsx)(gv,{className:O.loadingIconPlaceholder,ownerState:D})}),A=(f||g&&v===`end`)&&(0,G.jsx)($re,{className:O.endIcon,ownerState:D,children:f||(0,G.jsx)(gv,{className:O.loadingIconPlaceholder,ownerState:D})}),j=r||``,M=typeof g==`boolean`?(0,G.jsx)(`span`,{className:O.loadingWrapper,style:{display:`contents`},children:g&&(0,G.jsx)(eie,{className:O.loadingIndicator,ownerState:D,children:E})}):null;return(0,G.jsxs)(Zre,{ownerState:D,className:K(n.className,O.root,c,j),component:s,disabled:l||g,focusRipple:!d,focusVisibleClassName:K(O.focusVisible,p),ref:t,type:x,id:g?T:h,...w,classes:O,children:[k,v!==`end`&&M,a,v===`end`&&M,A]})});function tie(e){return Id(`MuiCard`,e)}Ld(`MuiCard`,[`root`]);var nie=e=>{let{classes:t}=e;return fp({root:[`root`]},tie,t)},rie=J(Wm,{name:`MuiCard`,slot:`Root`})({overflow:`hidden`}),vv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCard`}),{className:r,raised:i=!1,...a}=n,o={...n,raised:i};return(0,G.jsx)(rie,{className:K(nie(o).root,r),elevation:i?8:void 0,ref:t,ownerState:o,...a})});function iie(e){return Id(`MuiCardActionArea`,e)}var yv=Ld(`MuiCardActionArea`,[`root`,`focusVisible`,`focusHighlight`]),aie=e=>{let{classes:t}=e;return fp({root:[`root`],focusHighlight:[`focusHighlight`]},iie,t)},oie=J(Nh,{name:`MuiCardActionArea`,slot:`Root`})(Pm(({theme:e})=>({display:`block`,textAlign:`inherit`,borderRadius:`inherit`,width:`100%`,[`&:hover .${yv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${yv.focusVisible} .${yv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),sie=J(`span`,{name:`MuiCardActionArea`,slot:`FocusHighlight`})(Pm(({theme:e})=>({overflow:`hidden`,pointerEvents:`none`,position:`absolute`,top:0,right:0,bottom:0,left:0,borderRadius:`inherit`,opacity:0,backgroundColor:`currentcolor`,transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.short})}))),bv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCardActionArea`}),{children:r,className:i,focusVisibleClassName:a,slots:o={},slotProps:s={},...c}=n,l=n,u=aie(l),d={slots:o,slotProps:s},[f,p]=Hm(`root`,{elementType:oie,externalForwardedProps:{...d,...c},shouldForwardComponentProp:!0,ownerState:l,ref:t,className:K(u.root,i),additionalProps:{focusVisibleClassName:K(a,u.focusVisible)}}),[m,h]=Hm(`focusHighlight`,{elementType:sie,externalForwardedProps:d,ownerState:l,className:u.focusHighlight});return(0,G.jsxs)(f,{...p,children:[r,(0,G.jsx)(m,{...h})]})});function cie(e){return Id(`MuiCardContent`,e)}Ld(`MuiCardContent`,[`root`]);var lie=e=>{let{classes:t}=e;return fp({root:[`root`]},cie,t)},uie=J(`div`,{name:`MuiCardContent`,slot:`Root`})({padding:16,"&:last-child":{paddingBottom:24}}),xv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCardContent`}),{className:r,component:i=`div`,...a}=n,o={...n,component:i};return(0,G.jsx)(uie,{as:i,className:K(lie(o).root,r),ownerState:o,ref:t,...a})}),Sv=C.createContext(void 0);function Cv(){return C.useContext(Sv)}function die(e){return Id(`PrivateSwitchBase`,e)}Ld(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var fie=e=>{let{classes:t,checked:n,disabled:r,edge:i}=e;return fp({root:[`root`,n&&`checked`,r&&`disabled`,i&&`edge${Y(i)}`],input:[`input`]},die,t)},pie=J(Nh,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),mie=J(`input`,{name:`MuiSwitchBase`,shouldForwardProp:Em})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),wv=C.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:u,inputProps:d,inputRef:f,name:p,onBlur:m,onChange:h,onFocus:g,readOnly:_,required:v=!1,tabIndex:y,type:b,value:x,slots:S={},slotProps:C={},...w}=e,[T,E]=ah({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),D=Cv(),O=e=>{g&&g(e),D&&D.onFocus&&D.onFocus(e)},k=e=>{m&&m(e),D&&D.onBlur&&D.onBlur(e)},A=e=>{if(e.nativeEvent.defaultPrevented||_)return;let t=e.target.checked;E(t),h&&h(e,t)},j=o;D&&j===void 0&&(j=D.disabled);let M=b===`checkbox`||b===`radio`,N={...e,checked:T,disabled:j,disableFocusRipple:s,edge:c},P=fie(N),F={slots:S,slotProps:{input:d,...C}},[I,L]=Hm(`root`,{ref:t,elementType:pie,className:P.root,shouldForwardComponentProp:!0,externalForwardedProps:{...F,component:`span`,...w},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),O(t)},onBlur:t=>{e.onBlur?.(t),k(t)}}),ownerState:N,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null}}),[R,ee]=Hm(`input`,{ref:f,elementType:mie,className:P.input,externalForwardedProps:F,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),A(t)}}),ownerState:N,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:j,id:M?u:void 0,name:p,readOnly:_,required:v,tabIndex:y,type:b,...b===`checkbox`&&x===void 0?{}:{value:x}}});return(0,G.jsxs)(I,{...L,children:[(0,G.jsx)(R,{...ee}),T?i:l]})}),hie=X((0,G.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z`}),`CheckBoxOutlineBlank`),gie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z`}),`CheckBox`),_ie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z`}),`IndeterminateCheckBox`);function vie(e){return Id(`MuiCheckbox`,e)}var Tv=Ld(`MuiCheckbox`,[`root`,`checked`,`disabled`,`indeterminate`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`]),yie=e=>{let{classes:t,indeterminate:n,color:r,size:i}=e,a=fp({root:[`root`,n&&`indeterminate`,`color${Y(r)}`,`size${Y(i)}`]},vie,t);return{...t,...a}},bie=J(wv,{shouldForwardProp:e=>Em(e)||e===`classes`,name:`MuiCheckbox`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Y(n.size)}`],n.color!==`default`&&t[`color${Y(n.color)}`]]}})(Pm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:`default`,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${Tv.checked}, &.${Tv.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${Tv.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:`transparent`}}}}]}))),xie=(0,G.jsx)(gie,{}),Sie=(0,G.jsx)(hie,{}),Cie=(0,G.jsx)(_ie,{}),Ev=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiCheckbox`}),{checkedIcon:r=xie,color:i=`primary`,icon:a=Sie,indeterminate:o=!1,indeterminateIcon:s=Cie,inputProps:c,size:l=`medium`,disableRipple:u=!1,className:d,slots:f={},slotProps:p={},...m}=n,h=o?s:a,g=o?s:r,_={...n,disableRipple:u,color:i,indeterminate:o,size:l},v=yie(_),y=p.input??c,[b,x]=Hm(`root`,{ref:t,elementType:bie,className:K(v.root,d),shouldForwardComponentProp:!0,externalForwardedProps:{slots:f,slotProps:p,...m},ownerState:_,additionalProps:{type:`checkbox`,icon:C.cloneElement(h,{fontSize:h.props.fontSize??l}),checkedIcon:C.cloneElement(g,{fontSize:g.props.fontSize??l}),disableRipple:u,slots:f,slotProps:{input:lh(typeof y==`function`?y(_):y,{"data-indeterminate":o})}}});return(0,G.jsx)(b,{...x,classes:v})}),wie=X((0,G.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z`}),`Cancel`);function Tie(e){return Id(`MuiChip`,e)}var Dv=Ld(`MuiChip`,`root.sizeSmall.sizeMedium.colorDefault.colorError.colorInfo.colorPrimary.colorSecondary.colorSuccess.colorWarning.disabled.clickable.clickableColorPrimary.clickableColorSecondary.deletable.deletableColorPrimary.deletableColorSecondary.outlined.filled.outlinedPrimary.outlinedSecondary.filledPrimary.filledSecondary.avatar.avatarSmall.avatarMedium.avatarColorPrimary.avatarColorSecondary.icon.iconSmall.iconMedium.iconColorPrimary.iconColorSecondary.label.labelSmall.labelMedium.deleteIcon.deleteIconSmall.deleteIconMedium.deleteIconColorPrimary.deleteIconColorSecondary.deleteIconOutlinedColorPrimary.deleteIconOutlinedColorSecondary.deleteIconFilledColorPrimary.deleteIconFilledColorSecondary.focusVisible`.split(`.`)),Eie=e=>{let{classes:t,disabled:n,size:r,color:i,iconColor:a,onDelete:o,clickable:s,variant:c}=e;return fp({root:[`root`,c,n&&`disabled`,`size${Y(r)}`,`color${Y(i)}`,s&&`clickable`,s&&`clickableColor${Y(i)}`,o&&`deletable`,o&&`deletableColor${Y(i)}`,`${c}${Y(i)}`],label:[`label`,`label${Y(r)}`],avatar:[`avatar`,`avatar${Y(r)}`,`avatarColor${Y(i)}`],icon:[`icon`,`icon${Y(r)}`,`iconColor${Y(a)}`],deleteIcon:[`deleteIcon`,`deleteIcon${Y(r)}`,`deleteIconColor${Y(i)}`,`deleteIcon${Y(c)}Color${Y(i)}`]},Tie,t)},Die=J(`div`,{name:`MuiChip`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{color:r,iconColor:i,clickable:a,onDelete:o,size:s,variant:c}=n;return[{[`& .${Dv.avatar}`]:t.avatar},{[`& .${Dv.avatar}`]:t[`avatar${Y(s)}`]},{[`& .${Dv.avatar}`]:t[`avatarColor${Y(r)}`]},{[`& .${Dv.icon}`]:t.icon},{[`& .${Dv.icon}`]:t[`icon${Y(s)}`]},{[`& .${Dv.icon}`]:t[`iconColor${Y(i)}`]},{[`& .${Dv.deleteIcon}`]:t.deleteIcon},{[`& .${Dv.deleteIcon}`]:t[`deleteIcon${Y(s)}`]},{[`& .${Dv.deleteIcon}`]:t[`deleteIconColor${Y(r)}`]},{[`& .${Dv.deleteIcon}`]:t[`deleteIcon${Y(c)}Color${Y(r)}`]},t.root,t[`size${Y(s)}`],t[`color${Y(r)}`],a&&t.clickable,a&&r!==`default`&&t[`clickableColor${Y(r)}`],o&&t.deletable,o&&r!==`default`&&t[`deletableColor${Y(r)}`],t[c],t[`${c}${Y(r)}`]]}})(Pm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[700]:e.palette.grey[300];return{maxWidth:`100%`,fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:`inline-flex`,alignItems:`center`,justifyContent:`center`,height:32,lineHeight:1.5,color:(e.vars||e).palette.text.primary,backgroundColor:(e.vars||e).palette.action.selected,borderRadius:32/2,whiteSpace:`nowrap`,transition:e.transitions.create([`background-color`,`box-shadow`]),cursor:`unset`,outline:0,textDecoration:`none`,border:0,padding:0,verticalAlign:`middle`,boxSizing:`border-box`,[`&.${Dv.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:`none`},[`& .${Dv.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:e.vars?e.vars.palette.Chip.defaultAvatarColor:t,fontSize:e.typography.pxToRem(12)},[`& .${Dv.avatarColorPrimary}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.dark},[`& .${Dv.avatarColorSecondary}`]:{color:(e.vars||e).palette.secondary.contrastText,backgroundColor:(e.vars||e).palette.secondary.dark},[`& .${Dv.avatarSmall}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)},[`& .${Dv.icon}`]:{marginLeft:5,marginRight:-6},[`& .${Dv.deleteIcon}`]:{WebkitTapHighlightColor:`transparent`,color:e.alpha((e.vars||e).palette.text.primary,.26),fontSize:22,cursor:`pointer`,margin:`0 5px 0 -6px`,"&:hover":{color:e.alpha((e.vars||e).palette.text.primary,.4)}},variants:[{props:{size:`small`},style:{height:24,[`& .${Dv.icon}`]:{fontSize:18,marginLeft:4,marginRight:-4},[`& .${Dv.deleteIcon}`]:{fontSize:16,marginRight:4,marginLeft:-4}}},...Object.entries(e.palette).filter(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText,[`& .${Dv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].contrastText,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].contrastText}}}})),{props:e=>e.iconColor===e.color,style:{[`& .${Dv.icon}`]:{color:e.vars?e.vars.palette.Chip.defaultIconColor:t}}},{props:e=>e.iconColor===e.color&&e.color!==`default`,style:{[`& .${Dv.icon}`]:{color:`inherit`}}},{props:{onDelete:!0},style:{[`&.${Dv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,onDelete:!0},style:{[`&.${Dv.focusVisible}`]:{background:(e.vars||e).palette[t].dark}}})),{props:{clickable:!0},style:{userSelect:`none`,WebkitTapHighlightColor:`transparent`,cursor:`pointer`,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)},[`&.${Dv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},"&:active":{boxShadow:(e.vars||e).shadows[1]}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,clickable:!0},style:{[`&:hover, &.${Dv.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark}}})),{props:{variant:`outlined`},style:{backgroundColor:`transparent`,border:e.vars?`1px solid ${e.vars.palette.Chip.defaultBorder}`:`1px solid ${e.palette.mode===`light`?e.palette.grey[400]:e.palette.grey[700]}`,[`&.${Dv.clickable}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${Dv.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`& .${Dv.avatar}`]:{marginLeft:4},[`& .${Dv.avatarSmall}`]:{marginLeft:2},[`& .${Dv.icon}`]:{marginLeft:4},[`& .${Dv.iconSmall}`]:{marginLeft:2},[`& .${Dv.deleteIcon}`]:{marginRight:5},[`& .${Dv.deleteIconSmall}`]:{marginRight:3}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{variant:`outlined`,color:t},style:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.7)}`,[`&.${Dv.clickable}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)},[`&.${Dv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.focusOpacity)},[`& .${Dv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].main,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].main}}}}))]}})),Oie=J(`span`,{name:`MuiChip`,slot:`Label`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{size:r}=n;return[t.label,t[`label${Y(r)}`]]}})({overflow:`hidden`,textOverflow:`ellipsis`,paddingLeft:12,paddingRight:12,whiteSpace:`nowrap`,variants:[{props:{variant:`outlined`},style:{paddingLeft:11,paddingRight:11}},{props:{size:`small`},style:{paddingLeft:8,paddingRight:8}},{props:{size:`small`,variant:`outlined`},style:{paddingLeft:7,paddingRight:7}}]});function Ov(e){return e.key===`Backspace`||e.key===`Delete`}var kv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiChip`}),{avatar:r,className:i,clickable:a,color:o=`default`,component:s,deleteIcon:c,disabled:l=!1,icon:u,label:d,onClick:f,onDelete:p,onKeyDown:m,onKeyUp:h,size:g=`medium`,variant:_=`filled`,tabIndex:v,skipFocusWhenDisabled:y=!1,slots:b={},slotProps:x={},...S}=n,w=ch(C.useRef(null),t),T=e=>{e.stopPropagation(),p(e)},E=e=>{e.currentTarget===e.target&&Ov(e)&&e.preventDefault(),m&&m(e)},D=e=>{e.currentTarget===e.target&&p&&Ov(e)&&p(e),h&&h(e)},O=a!==!1&&f?!0:a,k=O||p?Nh:s||`div`,A={...n,component:k,disabled:l,size:g,color:o,iconColor:C.isValidElement(u)&&u.props.color||o,onDelete:!!p,clickable:O,variant:_},j=Eie(A),M=k===Nh?{component:s||`div`,focusVisibleClassName:j.focusVisible,...p&&{disableRipple:!0}}:{},N=null;p&&(N=c&&C.isValidElement(c)?C.cloneElement(c,{className:K(c.props.className,j.deleteIcon),onClick:T}):(0,G.jsx)(wie,{className:j.deleteIcon,onClick:T}));let P=null;r&&C.isValidElement(r)&&(P=C.cloneElement(r,{className:K(j.avatar,r.props.className)}));let F=null;u&&C.isValidElement(u)&&(F=C.cloneElement(u,{className:K(j.icon,u.props.className)}));let I={slots:b,slotProps:x},[L,R]=Hm(`root`,{elementType:Die,externalForwardedProps:{...I,...S},ownerState:A,shouldForwardComponentProp:!0,ref:w,className:K(j.root,i),additionalProps:{disabled:O&&l?!0:void 0,tabIndex:y&&l?-1:v,...M},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),f?.(t)},onKeyDown:t=>{e.onKeyDown?.(t),E(t)},onKeyUp:t=>{e.onKeyUp?.(t),D(t)}})}),[ee,z]=Hm(`label`,{elementType:Oie,externalForwardedProps:I,ownerState:A,className:j.label});return(0,G.jsxs)(L,{as:k,...R,children:[P||F,(0,G.jsx)(ee,{...z,children:d}),N]})});function Av(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function jv(e,t=!1){return e&&(Av(e.value)&&e.value!==``||t&&Av(e.defaultValue)&&e.defaultValue!==``)}function kie(e){return e.startAdornment}function Aie(e){return Id(`MuiFormControl`,e)}Ld(`MuiFormControl`,[`root`,`marginNone`,`marginNormal`,`marginDense`,`fullWidth`,`disabled`]);var jie=e=>{let{classes:t,margin:n,fullWidth:r}=e;return fp({root:[`root`,n!==`none`&&`margin${Y(n)}`,r&&`fullWidth`]},Aie,t)},Mie=J(`div`,{name:`MuiFormControl`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`margin${Y(n.margin)}`],n.fullWidth&&t.fullWidth]}})({display:`inline-flex`,flexDirection:`column`,position:`relative`,minWidth:0,padding:0,margin:0,border:0,verticalAlign:`top`,variants:[{props:{margin:`normal`},style:{marginTop:16,marginBottom:8}},{props:{margin:`dense`},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:`100%`}}]}),Mv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiFormControl`}),{children:r,className:i,color:a=`primary`,component:o=`div`,disabled:s=!1,error:c=!1,focused:l,fullWidth:u=!1,hiddenLabel:d=!1,margin:f=`none`,required:p=!1,size:m=`medium`,variant:h=`outlined`,...g}=n,_={...n,color:a,component:o,disabled:s,error:c,fullWidth:u,hiddenLabel:d,margin:f,required:p,size:m,variant:h},v=jie(_),[y,b]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{if(!Xm(t,[`Input`,`Select`]))return;let n=Xm(t,[`Select`])?t.props.input:t;n&&kie(n.props)&&(e=!0)}),e}),[x,S]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{Xm(t,[`Input`,`Select`])&&(jv(t.props,!0)||jv(t.props.inputProps,!0))&&(e=!0)}),e}),[w,T]=C.useState(!1);s&&w&&T(!1);let E=l!==void 0&&!s?l:w;C.useRef(!1);let D=C.useCallback(()=>{S(!0)},[]),O=C.useCallback(()=>{S(!1)},[]),k=C.useMemo(()=>({adornedStart:y,setAdornedStart:b,color:a,disabled:s,error:c,filled:x,focused:E,fullWidth:u,hiddenLabel:d,size:m,onBlur:()=>{T(!1)},onFocus:()=>{T(!0)},onEmpty:O,onFilled:D,registerEffect:void 0,required:p,variant:h}),[y,a,s,c,x,E,u,d,void 0,O,D,p,m,h]);return(0,G.jsx)(Sv.Provider,{value:k,children:(0,G.jsx)(Mie,{as:o,ownerState:_,className:K(v.root,i),ref:t,...g,children:r})})});function Nie(e){return Id(`MuiTypography`,e)}var Nv=Ld(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]),Pie={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Fie=Iee(),Iie=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return fp({root:[`root`,a,e.align!==`inherit`&&`align${Y(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},Nie,o)},Lie=J(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${Y(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(Pm(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${Y(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),Pv={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},Q=C.forwardRef(function(e,t){let{color:n,...r}=Om({props:e,name:`MuiTypography`}),i=!Pie[n],a=Fie({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=Pv,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p};return(0,G.jsx)(Lie,{as:c||(d?`p`:p[f]||Pv[f])||`span`,ref:t,className:K(Iie(h).root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})});function Rie(e){return Id(`MuiFormControlLabel`,e)}var Fv=Ld(`MuiFormControlLabel`,[`root`,`labelPlacementStart`,`labelPlacementTop`,`labelPlacementBottom`,`disabled`,`label`,`error`,`required`,`asterisk`]);function Iv({props:e,states:t,muiFormControl:n}){return t.reduce((t,r)=>(t[r]=e[r],n&&e[r]===void 0&&(t[r]=n[r]),t),{})}var zie=e=>{let{classes:t,disabled:n,labelPlacement:r,error:i,required:a}=e;return fp({root:[`root`,n&&`disabled`,`labelPlacement${Y(r)}`,i&&`error`,a&&`required`],label:[`label`,n&&`disabled`],asterisk:[`asterisk`,i&&`error`]},Rie,t)},Bie=J(`label`,{name:`MuiFormControlLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${Fv.label}`]:t.label},t.root,t[`labelPlacement${Y(n.labelPlacement)}`]]}})(Pm(({theme:e})=>({display:`inline-flex`,alignItems:`center`,cursor:`pointer`,verticalAlign:`middle`,WebkitTapHighlightColor:`transparent`,marginLeft:-11,marginRight:16,[`&.${Fv.disabled}`]:{cursor:`default`},[`& .${Fv.label}`]:{[`&.${Fv.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:`start`},style:{flexDirection:`row-reverse`,marginRight:-11}},{props:{labelPlacement:`top`},style:{flexDirection:`column-reverse`}},{props:{labelPlacement:`bottom`},style:{flexDirection:`column`}},{props:({labelPlacement:e})=>e===`start`||e===`top`||e===`bottom`,style:{marginLeft:16}}]}))),Vie=J(`span`,{name:`MuiFormControlLabel`,slot:`Asterisk`})(Pm(({theme:e})=>({[`&.${Fv.error}`]:{color:(e.vars||e).palette.error.main}}))),Lv=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiFormControlLabel`}),{checked:r,className:i,componentsProps:a={},control:o,disabled:s,disableTypography:c,inputRef:l,label:u,labelPlacement:d=`end`,name:f,onChange:p,required:m,slots:h={},slotProps:g={},value:_,...v}=n,y=Cv(),b=s??o.props.disabled??y?.disabled,x=m??o.props.required,S={disabled:b,required:x};[`checked`,`name`,`onChange`,`value`,`inputRef`].forEach(e=>{o.props[e]===void 0&&n[e]!==void 0&&(S[e]=n[e])});let w=Iv({props:n,muiFormControl:y,states:[`error`]}),T={...n,disabled:b,labelPlacement:d,required:x,error:w.error},E=zie(T),[D,O]=Hm(`typography`,{elementType:Q,externalForwardedProps:{slots:h,slotProps:{...a,...g}},ownerState:T}),k=u;return k!=null&&k.type!==Q&&!c&&(k=(0,G.jsx)(D,{component:`span`,...O,className:K(E.label,O?.className),children:k})),(0,G.jsxs)(Bie,{className:K(E.root,i),ownerState:T,ref:t,...v,children:[C.cloneElement(o,S),x?(0,G.jsxs)(`div`,{children:[k,(0,G.jsxs)(Vie,{ownerState:T,"aria-hidden":!0,className:E.asterisk,children:[` `,`*`]})]}):k]})}),Rv=zp({createStyledComponent:J(`div`,{name:`MuiGrid`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.container&&t.container]}}),componentName:`MuiGrid`,useThemeProps:e=>Om({props:e,name:`MuiGrid`}),useTheme:Cm});function Hie(e){return Id(`MuiLinearProgress`,e)}Ld(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var zv=4,Bv=td`
|
|
149
149
|
0% {
|
|
150
150
|
left: -35%;
|
|
151
151
|
right: 100%;
|
|
@@ -456,7 +456,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
456
456
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
457
457
|
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(C2(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=D2(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(C2(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(T2(t.key)&&!C2(t.sep,`newline`)){let e=D2(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):C2(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!C2(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||C2(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=D2(E2(t));O2(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
458
458
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
459
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=D2(E2(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=D2(E2(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function A2(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new S2||null,prettyErrors:t}}function cqe(e,t={}){let{lineCounter:n,prettyErrors:r}=A2(t),i=new k2(n?.addNewLine),a=new s2(t),o=Array.from(a.compose(i.parse(e)));if(r&&n)for(let t of o)t.errors.forEach(U0(e,n)),t.warnings.forEach(U0(e,n));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function j2(e,t={}){let{lineCounter:n,prettyErrors:r}=A2(t),i=new k2(n?.addNewLine),a=new s2(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new V0(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(U0(e,n)),o.warnings.forEach(U0(e,n))),o}function lqe(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=j2(e,n);if(!i)return null;if(i.warnings.forEach(e=>L1(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function uqe(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return U$(e)&&!r?e.toString(n):new R0(e,r,n).toString(n)}var dqe=c({Alias:()=>m1,CST:()=>nqe,Composer:()=>s2,Document:()=>R0,Lexer:()=>x2,LineCounter:()=>S2,Pair:()=>W1,Parser:()=>k2,Scalar:()=>_1,Schema:()=>L0,YAMLError:()=>B0,YAMLMap:()=>J1,YAMLParseError:()=>V0,YAMLSeq:()=>X1,YAMLWarning:()=>H0,isAlias:()=>H$,isCollection:()=>J$,isDocument:()=>U$,isMap:()=>W$,isNode:()=>Y$,isPair:()=>G$,isScalar:()=>K$,isSeq:()=>q$,parse:()=>lqe,parseAllDocuments:()=>cqe,parseDocument:()=>j2,stringify:()=>uqe,visit:()=>e1,visitAsync:()=>n1});function fqe(e){let t=null;try{t=dqe.parse(e.doc.toString())}catch{}let n=JK(e,WK.YAML);return{data:t,pointers:n}}var M2=e=>{switch(e){case WK.JSON:return $Ge;case WK.JSON5:return tKe;case WK.YAML:return fqe}};function pqe(e){return Object.entries(e)}function N2(e,t){if(typeof e==`string`||typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>N2(e,t));if(e instanceof Map){let n=new Map;for(let[r,i]of e){let e=r,a=N2(i,t);n.set(e,a)}return n}if(e instanceof Set){let n=new Set;for(let r of e){let e=N2(r,t);n.add(e)}return n}let n={};function r(e,r,i,a){i===e&&a===r?n[i]=N2(r,t):n[i]=a}for(let[n,i]of pqe(e)){let e=t(n,i);if(e.length===2&&typeof e[0]==`string`)r(n,i,e[0],e[1]);else for(let[t,a]of e)r(n,i,t,a)}return n}var mqe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},hqe=class{constructor(){this.completions=new Map,this.reservedKeys=new Set}reserve(e){this.reservedKeys.add(e)}add(e){this.reservedKeys.has(e.label)||this.completions.set(e.label,e)}};function P2(e){return!(!e||pq(e)||e.name===`UnknownPropertyError`||e.type===`undefined`)}var gqe=class{constructor(e){this.opts=e,this.originalSchema=null,this.schema=null,this.laxSchema=null,this.mode=WK.JSON,this.mode=e.mode??WK.JSON,this.parser=this.opts?.jsonParser??M2(this.mode)}doComplete(e){let t=sq(e.state);if(this.originalSchema!==t&&(this.schema=L2(t,t)??t,this.laxSchema=vqe(this.schema)),!this.schema||!this.laxSchema)return[];BK.log(`xxx`,`trying with original schema`);let n=this.doCompleteForSchema(e,this.schema);return n.options.length===0?(BK.log(`xxx`,`no completions with original schema, trying with lax schema`),this.doCompleteForSchema(e,this.laxSchema)):n}doCompleteForSchema(e,t){let n={from:e.pos,to:e.pos,options:[],filter:!1},r=e.state.doc.sliceString(0),i=YK(e.state,e.pos),a=e.state.sliceDoc(i.from,e.pos).replace(/^(["'])/,``);if(BK.log(`xxx`,`node`,i,`prefix`,a,`ctx`,e),!($K(i,this.mode)||eq(i,this.mode))&&!e.explicit)return BK.log(`xxx`,`no completions for non-word/primitive`,i),n;let o=ZK(e.state.doc,i),s=ZK(e.state.doc,i,!1);if(i&&($K(i,this.mode)||eq(i,this.mode)))n.from=i.from,n.to=i.to;else{let t=e.matchBefore(/[A-Za-z0-9._]*/),a=e.pos-o.length;BK.log(`xxx`,`overwriteStart after`,a,`ctx.pos`,e.pos,`word`,t,`currentWord`,o,`=>`,r[a-1],`..`,r[a],`..`,r),n.from=i.name===VK.INVALID?t?.from??e.pos:a,n.to=e.pos}let c=new hqe,l=!0,u=aq(i,VK.PROPERTY_NAME,this.mode);if(u&&(BK.log(`xxx`,`closestPropertyNameNode`,u,`node`,i),i=u),eq(i,this.mode)){BK.log(`xxx`,`isPropertyNameNode`,i);let e=i.parent;if(e){let t=rq(e,this.mode);l=!t||t.name===VK.INVALID&&t.from-t.to===0||(t.parent?tq(t.parent).length<=1:!1),BK.log(`xxx`,`addValue`,l,rq(e,this.mode),i),i=aq(e,VK.OBJECT,this.mode)??null}}if(BK.log(`xxx`,i,o,e,`node at pos`,YK(e.state,e.pos)),i&&[VK.OBJECT,VK.JSON_TEXT].includes(GK(i.name,this.mode))&&(eq(YK(e.state,e.pos),this.mode)||u)){if(i.from===e.pos)return BK.log(`xxx`,`no completions for just before opening brace`),n;this.getPropertyCompletions(t,e,i,c,l,s)}else{let n=this.getValueCompletions(t,e,{},c);BK.log(`xxx`,`getValueCompletions res`,n)}return n.options=Array.from(c.completions.values()).filter(e=>XK(e.label).startsWith(a)),BK.log(`xxx`,`result`,n,`prefix`,a,`collector.completions`,c.completions,`reservedKeys`,c.reservedKeys),n}applySnippetCompletion(e){return yLe(typeof e.apply==`string`?e.apply:e.label,e)}getPropertyCompletions(e,t,n,r,i,a){let o=tRe(n,VK.PROPERTY,this.mode);BK.log(`xxx`,`getPropertyCompletions`,n,t,o),o.forEach(e=>{let n=ZK(t.state.doc,nq(e,VK.PROPERTY_NAME,this.mode));r.reserve(XK(n))});let s=this.getSchemas(e,t);BK.log(`xxx`,`propertyCompletion schemas`,s),s.forEach(t=>{if(typeof t!=`object`)return;let n=t.properties;n&&Object.entries(n).forEach(([t,n])=>{if(typeof n==`object`){let o=n.description??``,s=n.type??``,c=Array.isArray(s)?s.toString():s,l={label:t,apply:this.getInsertTextForProperty(t,i,a,e,n),type:`property`,detail:c,info:()=>hY(`div`,{inner:N$(o)})};r.add(this.applySnippetCompletion(l))}});let o=t.propertyNames;if(typeof o==`object`&&(o.enum&&o.enum.forEach(t=>{let n=t?.toString();if(n){let t={label:n,apply:this.getInsertTextForProperty(n,i,a,e),type:`property`};r.add(this.applySnippetCompletion(t))}}),o.const)){let t=o.const.toString(),n={label:t,apply:this.getInsertTextForProperty(t,i,a,e),type:`property`};r.add(this.applySnippetCompletion(n))}})}getInsertTextForProperty(e,t,n,r,i){i&&=L2(i,r);let a=this.getInsertTextForPropertyName(e,n);if(!t)return a;a+=`: `;let o,s=0;if(typeof i==`object`){if(i.default!==void 0)o||=this.getInsertTextForGuessedValue(i.default,``),s++;else if(i.enum&&(!o&&i.enum.length===1&&(o=this.getInsertTextForGuessedValue(i.enum[0],``)),s+=i.enum.length),i.const!==void 0&&(o||=this.getInsertTextForGuessedValue(i.const,``),s++),Array.isArray(i.examples)&&i.examples.length&&(o||=this.getInsertTextForGuessedValue(i.examples[0],``),s+=i.examples.length),o===void 0&&s===0){let e=Array.isArray(i.type)?i.type[0]:i.type;switch(e||(i.properties?e=`object`:i.items&&(e=`array`)),e){case`boolean`:o=`#{}`;break;case`string`:o=this.getInsertTextForString(``);break;case`object`:switch(this.mode){case WK.JSON5:o=`{#{}}`;break;case WK.YAML:o=`#{}`;break;default:o=`{#{}}`;break}break;case`array`:o=`[#{}]`;break;case`number`:case`integer`:o=`#{0}`;break;case`null`:o=`#{null}`;break;default:o=`#{}`;break}}}return(!o||s>1)&&(BK.log(`xxx`,`value`,o,`nValueProposals`,s,i),o=`#{}`),a+o}getInsertTextForPropertyName(e,t){switch(this.mode){case WK.JSON5:case WK.YAML:return t.startsWith(`"`)?`"${e}"`:t.startsWith(`'`)?`'${e}'`:e;default:return`"${e}"`}}getInsertTextForString(e,t=`#`){switch(this.mode){case WK.JSON5:return`'${t}{${e}}'`;case WK.YAML:return`${t}{${e}}`;default:return`"${t}{${e}}"`}}getInsertTextForGuessedValue(e,t=``){switch(typeof e){case`object`:return e===null?"${null}"+t:this.getInsertTextForValue(e,t);case`string`:{let n=JSON.stringify(e);return n=n.substr(1,n.length-2),n=this.getInsertTextForPlainText(n),this.getInsertTextForString(n,`$`)+t}case`number`:case`boolean`:return"${"+JSON.stringify(e)+`}`+t}return this.getInsertTextForValue(e,t)}getInsertTextForPlainText(e){return e.replace(/[\\$}]/g,`\\$&`)}getInsertTextForValue(e,t){let n=JSON.stringify(e,null,` `);return n===`{}`?`{#{}}`+t:n===`[]`?`[#{}]`+t:this.getInsertTextForPlainText(n+t)}getValueCompletions(e,t,n,r){let i=kH(t.state).resolveInner(t.pos,-1),a=null,o;if(BK.log(`xxx`,`getValueCompletions`,i,t),i&&$K(i,this.mode)&&(a=i,i=i.parent),!i){this.addSchemaValueCompletions(e,n,r);return}if(GK(i.name,this.mode)===VK.PROPERTY){let e=nq(i,VK.PROPERTY_NAME,this.mode);e&&(o=ZK(t.state.doc,e),i=i.parent)}if(BK.log(`xxx`,`node`,i,`parentKey`,o),i&&(o!==void 0||GK(i.name,this.mode)===VK.ARRAY)){let s=this.getSchemas(e,t);for(let e of s){if(typeof e!=`object`)return;if(GK(i.name,this.mode)===VK.ARRAY&&e.items){let t=r;if(e.uniqueItems&&(t=Object.assign(Object.assign({},t),{add(e){t.completions.has(e.label)||r.add(e)},reserve(e){r.reserve(e)}})),Array.isArray(e.items)){let r=0;if(a){let e=iq(i,a,this.mode);e>=0&&(r=e)}let o=e.items[r];o&&this.addSchemaValueCompletions(o,n,t)}else this.addSchemaValueCompletions(e.items,n,t)}if((e.type==null||e.type!==`object`)&&this.addSchemaValueCompletions(e,n,r),o!==void 0){let t=!1;if(e.properties){let i=e.properties[o];i&&(t=!0,this.addSchemaValueCompletions(i,n,r))}if(e.patternProperties&&!t){for(let i of Object.keys(e.patternProperties))if(this.extendedRegExp(i)?.test(o)){t=!0;let a=e.patternProperties[i];a&&this.addSchemaValueCompletions(a,n,r)}}if(e.additionalProperties&&!t){let t=e.additionalProperties;this.addSchemaValueCompletions(t,n,r)}}n.boolean&&(this.addBooleanValueCompletion(!0,r),this.addBooleanValueCompletion(!1,r)),n.null&&this.addNullValueCompletion(r)}}return{valuePrefix:a?ZK(t.state.doc,a,!0,!1):``}}addSchemaValueCompletions(e,t,n){typeof e==`object`&&(this.addEnumValueCompletions(e,n),this.addDefaultValueCompletions(e,n),this.collectTypes(e,t),Array.isArray(e.allOf)&&e.allOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.anyOf)&&e.anyOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.oneOf)&&e.oneOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)))}addDefaultValueCompletions(e,t,n=0){let r=!1;if(e.default!==void 0){let i=e.type,a=e.default;for(let e=n;e>0;e--)a=[a],i=`array`;let o=Object.assign(Object.assign({type:i?.toString()},this.getAppliedValue(a)),{detail:`Default value`});t.add(o),r=!0}Array.isArray(e.examples)&&e.examples.forEach(i=>{let a=e.type,o=i;for(let e=n;e>0;e--)o=[o],a=`array`;t.add(Object.assign({type:a?.toString()},this.getAppliedValue(o))),r=!0}),!r&&typeof e.items==`object`&&!Array.isArray(e.items)&&n<5&&this.addDefaultValueCompletions(e.items,t,n+1)}addEnumValueCompletions(e,t){if(e.const!==void 0&&t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(e.const)),{info:e.description})),Array.isArray(e.enum))for(let n=0,r=e.enum.length;n<r;n++){let r=e.enum[n];t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(r)),{info:e.description}))}}addBooleanValueCompletion(e,t){t.add({type:`boolean`,label:e?`true`:`false`})}addNullValueCompletion(e){e.add({type:`null`,label:`null`})}collectTypes(e,t){if(Array.isArray(e.enum)||e.const!==void 0)return;let n=e.type;Array.isArray(n)?n.forEach(e=>t[e]=!0):n&&(t[n]=!0)}getSchemas(e,t){let{data:n}=this.parser(t.state),r=new mY(e),i=qK(t.state,t.pos,-1,this.mode);if(i===``&&(i=void 0),i!=null&&i.endsWith(`/`)){i=i.substring(0,i.length-1);let t=F2(e,n,i);if(t!=null)return[t]}let a=i?.replace(/\/[^/]*$/,``);a===``&&(a=void 0);let o=F2(e,n,a),s=i?.split(`/`).pop(),c=s==null||s in(o?.properties??{}),l=r.getSchema({pointer:i,data:n??void 0});return!c&&l?.type===`null`&&this.mode===`yaml`&&(l=void 0),BK.log(`xxxx`,`draft.getSchema`,l,`data`,n,`pointer`,i,`pointerPointsToKnownProperty`,c),pq(l)&&(l=l.data?.schema),!P2(l)&&o?[o]:(P2(l)||(l=r.getSchema({pointer:a}),i=a),BK.log(`xxx`,`pointer..`,JSON.stringify(i)),!P2(l)&&(!i||i===`/`)&&(l=L2(e,e)??e),BK.log(`xxx`,`subSchema..`,l),l?Array.isArray(l.allOf)?[l,...l.allOf.map(t=>L2(t,e))]:Array.isArray(l.oneOf)?[l,...l.oneOf.map(t=>L2(t,e))]:Array.isArray(l.anyOf)?[l,...l.anyOf.map(t=>L2(t,e))]:[l]:[])}getAppliedValue(e){let t=XK(JSON.stringify(e));switch(this.mode){case WK.JSON5:return{label:t,apply:$Le(JSON.stringify(e))};case WK.YAML:return{label:t,apply:t};default:return{label:t,apply:JSON.stringify(e)}}}getValueFromLabel(e){return JSON.parse(e)}extendedRegExp(e){let t=``;e.startsWith(`(?i)`)&&(e=e.substring(4),t=`i`);try{return new RegExp(e,t+`u`)}catch{try{return new RegExp(e,t)}catch{return}}}};function _qe(e={}){let t=new gqe(e);return function(e){return t.doComplete(e)}}function vqe(e){return N2(e,(e,t)=>e===`additionalProperties`&&t===!1||e===`required`&&Array.isArray(t)||e===`unevaluatedProperties`&&t===!1||e===`unevaluatedItems`&&t===!1?[]:[e,t])}function F2(e,t,n){let r=new mY(e),i=r.getSchema({pointer:n,data:t??void 0});if(!P2(i))return;let a=I2(r,i),o={};for(let e of a){let i=bqe(n,e),a=r.getSchema({pointer:i,data:t??void 0});P2(a)&&Object.assign(o,{[e]:a})}if(a.length===0||Object.keys(o).length===0)return;let s=i,{allOf:c,anyOf:l,oneOf:u}=s,d=mqe(s,[`allOf`,`anyOf`,`oneOf`]);return Object.assign(Object.assign({},d),{properties:o})}function I2(e,t){if(t=L2(t,e.rootSchema),typeof t!=`object`||!t)return[];let n=[];function r(t){let r=I2(e,t);n.push(...r)}if(typeof t.properties==`object`&&t.properties!=null&&n.push(...Object.keys(t.properties)),typeof t.then==`object`&&t.then!=null&&r(t.then),Array.isArray(t.allOf))for(let e of t.allOf)r(e);if(Array.isArray(t.anyOf))for(let e of t.anyOf)r(e);if(Array.isArray(t.oneOf))for(let e of t.oneOf)r(e);return n}function L2(e,t){if(typeof e==`object`&&e.$ref){let n=yqe(t,e.$ref);if(typeof n==`object`){let t=Object.assign(Object.assign({},e),n);return Reflect.deleteProperty(t,`$ref`),t}}return e}function yqe(e,t){let n=t.split(`/`),r=e;return n.forEach(t=>{if(t){if(t===`#`){r=e;return}typeof r==`object`&&(r=r[t])}}),r}function bqe(e,t){return e===void 0?`/${t}`:`${e}/${t}`}var R2=(e,t)=>{let n=e.length>2,r=e.map((n,r)=>{let i="`"+(t?t(n):n)+"`";return r===e.length-1?`or `+i:i});return n?r.join(`, `):r.join(` `)},xqe=e=>e?.data?.pointer&&e?.data?.pointer!==`#`?e.data.pointer.slice(1):e?.data?.property?`/${e.data.property}`:``,Sqe=e=>e.startState.field(oq)!==e.state.field(oq);function Cqe(e){let t=new Tqe(e);return e=>t.doValidation(e)}var wqe=[`NoAdditionalPropertiesError`,`RequiredPropertyError`,`InvalidPropertyNameError`,`ForbiddenPropertyError`,`UndefinedValueError`],Tqe=class{constructor(e){this.options=e,this.schema=null,this.mode=WK.JSON,this.rewriteError=e=>{let t=e?.data?.errors;return e.code===`one-of-error`&&t?.length?`Expected one of ${R2(t,e=>e.data.expected)}`:e.code===`type-error`?`Expected \`${e?.data?.expected&&Array.isArray(e?.data?.expected)?R2(e?.data?.expected):e?.data?.expected}\` but received \`${e?.data?.received}\``:e.message.replaceAll("in `#` ",``).replaceAll("at `#`",``).replaceAll(`/`,`.`).replaceAll(`#.`,``)},this.mode=this.options?.mode??WK.JSON,this.parser=this.options?.jsonParser??M2(this.mode)}get schemaTitle(){return this.schema?.getSchema()?.title??`json-schema`}doValidation(e){let t=sq(e.state);if(!t||(this.schema=new uY(t),!this.schema)||!e.state.doc.toString()?.length)return[];let n=this.parser(e.state);if(n.data==null)return[];let r=[];try{r=this.schema.validate(n.data)}catch{}return BK.log(`xxx`,`validation errors`,r,n.data),r.length?r.reduce((e,t)=>{let r=()=>{let n=this.rewriteError(t);e.push({from:0,to:0,message:n,severity:`error`,source:this.schemaTitle,renderMessage:()=>{let e=hY(`div`,{});return e.innerHTML=N$(n),e}})},i=xqe(t),a=n.pointers.get(i);if(t.name===`MaxPropertiesError`||t.name===`MinPropertiesError`||i===``)r();else if(a){let n=wqe.includes(t.name),r=this.rewriteError(t),i=n?a.keyFrom:a.valueFrom,o=n?a.keyTo:a.valueTo;o!==void 0&&i!==void 0&&e.push({from:i,to:o,message:r,renderMessage:()=>{let e=hY(`div`,{});return e.innerHTML=N$(r),e},severity:`error`,source:this.schemaTitle})}else r();return e},[]):[]}};function Eqe(e){let t=new Oqe(e);return async function(e,n,r){return t.doHover(e,n,r)}}function Dqe(e){if(e.type)return e.$ref?`${e.$ref} (${e.type})`:e.type;if(e.$ref)return`${e.$ref}`}function z2(e,t,n){return`${t}: ${R2(e[t].map(e=>{try{let{data:t}=n.resolveRef({data:e,pointer:e.$ref});return Dqe(t||e)}catch{return e.type}}))}`}var Oqe=class{constructor(e){this.opts=e,this.schema=null,this.mode=WK.JSON,this.opts=Object.assign({parser:JSON.parse},this.opts),this.mode=this.opts?.mode??WK.JSON}getDataForCursor(e,t,n){let r=sq(e.state);if(!r)return null;this.schema=new uY(r);let i=qK(e.state,t,n,this.mode),a;try{a=this.opts.parser(e.state.doc.toString())}catch{}if(!i)return null;let o=this.schema.getSchema({pointer:i,data:a,withSchemaWarning:!0});return pq(o)&&(o=o?.data.schema.$ref?this.schema.resolveRef(o):o?.data.schema),{schema:o,pointer:i}}formatMessage(e){let{message:t,typeInfo:n}=e;return t?hY(`div`,{class:`cm6-json-schema-hover`},[hY(`div`,{class:`cm6-json-schema-hover--description`,inner:N$(t,!1)}),hY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[hY(`div`,{class:`cm6-json-schema-hover--code`,inner:N$(n,!1)})])]):hY(`div`,{class:`cm6-json-schema-hover`},[hY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[hY(`code`,{class:`cm6-json-schema-hover--code`,inner:N$(n,!1)})])])}getHoverTexts(e,t){let n=``,r=null,{schema:i}=e;return i.oneOf&&(n=z2(i,`oneOf`,t)),i.anyOf&&(n=z2(i,`anyOf`,t)),i.allOf&&(n=z2(i,`allOf`,t)),i.type&&(n=Array.isArray(i.type)?R2(i.type):i.type),i.$ref&&(n=` Reference: ${i.$ref}`),i.enum&&(n=`\`enum\`: ${R2(i.enum)}`),i.format&&(n+=`\`format\`: ${i.format}`),i.pattern&&(n+=`\`pattern\`: ${i.pattern}`),i.description&&(r=i.description),{message:r,typeInfo:n}}async doHover(e,t,n){let r=t,i=t;try{let a=this.getDataForCursor(e,t,n);if(BK.log(`cursorData`,a),!a?.schema)return null;let o=(this.opts?.getHoverTexts??this.getHoverTexts)(a,this.schema),s=(this.opts?.formatHover??this.formatMessage)(o);return{pos:r,end:i,arrow:!0,above:!0,create:e=>({dom:s})}}catch(e){return BK.log(e),null}}},kqe=e=>(0,G.jsx)(ny,{disablePadding:!0,children:e.validationErrors.map((e,t)=>(0,G.jsx)(ay,{disableGutters:!0,disablePadding:!0,children:(0,G.jsxs)(Gv,{direction:`row`,spacing:1,children:[(0,G.jsx)(Q,{variant:`body2`,children:`•`}),(0,G.jsx)(Q,{variant:`caption`,children:e.instancePath.length===0?`/`:e.instancePath}),(0,G.jsx)(Q,{variant:`body2`,children:e.message})]})},t.toString()))}),B2=e=>{let t;try{t=JSON.parse(e)}catch{t=void 0}return t};function Aqe({schema:e,customValidate:t}){let n=(0,C.useMemo)(()=>new XP.default({allErrors:!0}),[]);return(0,C.useCallback)(r=>{let i=[];return n.validate(e,r),i.push(...n.errors??[]),i.push(...t?.(r)??[]),i},[n,e,t])}var jqe=e=>{let t=Mqe(),[n,r]=(0,C.useState)(()=>JSON.stringify(e.value,null,2)),i=Aqe(e),[a,o]=(0,C.useState)([]);(0,C.useEffect)(()=>{o(i(e.value))},[i,e.value]);let s=e.onChange,c=(0,C.useCallback)(e=>{let t=B2(e),n=i(t);s(t,n.length===0),r(e),o(n)},[i,s]),l=()=>{let e=B2(n);e&&r(JSON.stringify(e,null,2))};return(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Z,{position:`relative`,children:[(0,G.jsx)(RK,{value:n,onChange:e=>c(e),extensions:[DPe(),NU(TPe(),{delay:100}),NU(Cqe(),{delay:100,needsRefresh:Sqe}),xU.data.of({autocomplete:_qe({mode:`json4`})}),aH(Eqe()),iRe(e.schema)],theme:t,height:`400px`}),(0,G.jsx)(_v,{sx:{position:`absolute`,right:`0`,bottom:`0`},onClick:()=>l(),children:`Prettify`})]}),a.length>0&&(0,G.jsx)(Uh,{severity:`error`,variant:`outlined`,children:(0,G.jsx)(kqe,{validationErrors:a})})]})};function Mqe(){return Cm().palette.mode===`dark`?YPe:GPe}var Nqe=[{value:``,label:`Auto (based on domain/name)`},{value:`light`,label:`💡 Light`},{value:`switch`,label:`🔌 Switch`},{value:`climate`,label:`🌡️ Climate`},{value:`cover`,label:`🪟 Cover`},{value:`fan`,label:`🌀 Fan`},{value:`lock`,label:`🔒 Lock`},{value:`sensor`,label:`📊 Sensor`},{value:`media_player`,label:`📺 Media Player`},{value:`vacuum`,label:`🧹 Vacuum`},{value:`remote`,label:`🎮 Remote`},{value:`humidifier`,label:`💧 Humidifier`},{value:`speaker`,label:`🔊 Speaker`},{value:`garage`,label:`🚗 Garage`},{value:`door`,label:`🚪 Door`},{value:`window`,label:`🪟 Window`},{value:`motion`,label:`🏃 Motion`},{value:`battery`,label:`🔋 Battery`},{value:`power`,label:`⚡ Power`},{value:`camera`,label:`📷 Camera`},{value:`default`,label:`🔗 Default`}],Pqe=({bridgeId:e,selectedIcon:t,onIconChange:n})=>{let r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(null);(0,C.useEffect)(()=>{e&&vE(e).then(t=>{a(t),t&&s(`${yE(e)}?t=${Date.now()}`)}).catch(()=>{a(!1)})},[e]);let f=(0,C.useCallback)(async t=>{let i=t.target.files?.[0];if(!(!i||!e)){d(null),l(!0);try{await cge(e,i),a(!0),s(`${yE(e)}?t=${Date.now()}`),n(void 0)}catch(e){d(e instanceof Error?e.message:`Upload failed`)}finally{l(!1),r.current&&(r.current.value=``)}}},[e,n]),p=(0,C.useCallback)(async()=>{if(e){d(null);try{await lge(e),a(!1),s(null)}catch(e){d(e instanceof Error?e.message:`Delete failed`)}}},[e]),m=(0,C.useCallback)(e=>{n(e===``?void 0:e)},[n]);return(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Mv,{fullWidth:!0,size:`small`,children:[(0,G.jsx)(Bx,{id:`icon-select-label`,children:`Bridge Icon`}),(0,G.jsx)(vS,{labelId:`icon-select-label`,value:t??``,label:`Bridge Icon`,onChange:e=>m(e.target.value),disabled:i,children:Nqe.map(e=>(0,G.jsx)(yS,{value:e.value,children:e.label},e.value))}),(0,G.jsx)(xS,{children:i?`Custom icon is set. Delete it to use preset icons.`:`Select a preset icon or upload a custom image`})]}),e&&(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,gutterBottom:!0,children:`Custom Icon`}),(0,G.jsxs)(Gv,{direction:`row`,spacing:2,alignItems:`center`,children:[i&&o&&(0,G.jsx)(Z,{component:`img`,src:o,alt:`Custom bridge icon`,sx:{width:48,height:48,objectFit:`contain`,borderRadius:1,border:`1px solid`,borderColor:`divider`}}),(0,G.jsx)(`input`,{ref:r,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml`,style:{display:`none`},onChange:f}),(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(whe,{}),onClick:()=>r.current?.click(),disabled:c,children:c?`Uploading...`:`Upload Image`}),i&&(0,G.jsx)(_v,{variant:`outlined`,size:`small`,color:`error`,startIcon:(0,G.jsx)(NS,{}),onClick:p,children:`Delete`})]}),u&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:1},children:u}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,display:`block`},children:`Supported formats: PNG, JPG, GIF, WebP, SVG (max 5MB)`})]}),!e&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:`Save the bridge first to upload a custom icon.`})]})},V2={light:`Light`,switch:`On/Off Plug-in Unit`,lock:`Door Lock`,fan:`Fan`,binary_sensor:`Sensor`,sensor:`Sensor`,cover:`Window Covering`,climate:`Thermostat`,media_player:`Speaker / Video Player`,vacuum:`Robot Vacuum Cleaner`,humidifier:`Humidifier`,valve:`Water Valve`,alarm_control_panel:`On/Off Plug-in Unit`,event:`Generic Switch`,button:`Generic Switch`,input_button:`Generic Switch`,automation:`On/Off Switch`,script:`On/Off Switch`,scene:`On/Off Switch`,remote:`On/Off`,water_heater:`Water Heater`,input_boolean:`On/Off Plug-in Unit`,select:`Mode Select`,input_select:`Mode Select`,siren:`On/Off Plug-in Unit`},H2=e=>{try{return JSON.parse(e)}catch{return}};function Fqe({filter:e}){let[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(``),d=(0,C.useCallback)(async()=>{n(!0),o(null);try{let t=await fetch(`api/matter/filter-preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.text(),r=H2(n);if(!t.ok){let e=typeof r==`object`&&r&&`error`in r?String(r.error):n||`Failed to fetch preview`;throw Error(e)}i(r??H2(n)),c(!0)}catch(e){o(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},[e]);(0,C.useEffect)(()=>{if(!(e.include.length>0&&e.include.some(e=>e.type&&e.value))){i(null),c(!1);return}let t=JSON.stringify(e);if(t!==u.current)return u.current=t,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{d()},800),()=>{l.current&&clearTimeout(l.current)}},[e,d]);let f=r?r.entities.reduce((e,t)=>(e[t.domain]=(e[t.domain]||0)+1,e),{}):{},p=[];if(r){r.entities.some(e=>e.domain===`vacuum`)&&p.push(`This filter includes a vacuum. Consider using Server Mode (single device per bridge) for Apple Home/Alexa compatibility.`),r.total>50&&p.push(`${r.total} entities is a large number. Consider splitting across multiple bridges for better stability.`);let e=Object.keys(f).filter(e=>!V2[e]);e.length>0&&p.push(`Unsupported domains will be skipped: ${e.join(`, `)}`)}return(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(_v,{variant:`outlined`,startIcon:t?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(Whe,{}),onClick:d,disabled:t,size:`small`,children:t?`Loading...`:`Preview Matching Entities`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mt:1},children:a}),(0,G.jsx)(ey,{in:s&&r!==null,children:r&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsxs)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:[r.total,` entities match`]}),r.truncated&&(0,G.jsx)(kv,{label:`Showing first 100`,size:`small`,color:`warning`,variant:`outlined`})]}),p.length>0&&(0,G.jsx)(Gv,{spacing:.5,sx:{mb:1.5},children:p.map(e=>(0,G.jsx)(Uh,{severity:`warning`,variant:`outlined`,icon:e.includes(`vacuum`)?(0,G.jsx)(pv,{fontSize:`small`}):(0,G.jsx)(Cb,{fontSize:`small`}),sx:{py:0},children:(0,G.jsx)(Q,{variant:`caption`,children:e})},e))}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mb:2,children:Object.entries(f).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,G.jsx)(kv,{label:`${e}: ${t}${V2[e]?` → ${V2[e]}`:``}`,size:`small`,variant:`outlined`,color:V2[e]?`default`:`warning`},e))}),(0,G.jsx)(ny,{dense:!0,sx:{maxHeight:200,overflow:`auto`,bgcolor:`background.paper`,borderRadius:1,border:1,borderColor:`divider`},children:r.entities.map(e=>(0,G.jsx)(ay,{divider:!0,children:(0,G.jsx)(ly,{primary:e.friendly_name||e.entity_id,secondary:`${e.entity_id}${V2[e.domain]?` → ${V2[e.domain]}`:``}`,primaryTypographyProps:{variant:`body2`},secondaryTypographyProps:{variant:`caption`,fontFamily:`monospace`}})},e.entity_id))}),(0,G.jsx)(_v,{size:`small`,onClick:()=>c(!1),sx:{mt:1},children:`Hide Preview`})]})})]})}var Iqe=rF().ObjectFieldTemplate;function Lqe(e){return(e.fieldPathId?.$id??``)===`root_filter`?(0,G.jsx)(Rqe,{...e}):(0,G.jsx)(Iqe,{...e})}function Rqe(e){let t=(e.formData?.include?.length??0)+(e.formData?.exclude?.length??0),[n,r]=(0,C.useState)(t>0);return(0,G.jsxs)(QS,{expanded:n,onChange:(e,t)=>r(t),variant:`outlined`,disableGutters:!0,sx:{borderRadius:2,"&::before":{display:`none`},overflow:`hidden`},children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),sx:{px:2,"& .MuiAccordionSummary-content":{alignItems:`center`,gap:1.5}},children:[(0,G.jsx)(vb,{fontSize:`small`,color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,children:`Entity Filters`}),(0,G.jsx)(Lx,{badgeContent:t,color:`primary`,sx:{ml:1},max:99,children:(0,G.jsx)(Z,{})}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{ml:1},children:n?`Click to collapse`:`${t} rule${t===1?``:`s`} configured`})]}),(0,G.jsx)($S,{sx:{px:2,pb:2},children:e.properties.map(e=>(0,G.jsx)(`div`,{children:e.content},e.name))})]})}function zqe(e){let t=(0,C.useRef)(e),n=t.current;return t.current=e,n}function U2(e){let{items:t,canAdd:n,onAddClick:r,title:i,formData:a}=e,o=a??[],[s,c]=(0,C.useState)(()=>new Set),[l,u]=(0,C.useState)(``),d=zqe(o.length);(0,C.useEffect)(()=>{if(o.length>d){let e=o.length-1,t=o[e];!t?.type&&!t?.value&&c(t=>new Set([...t,e]))}},[o,d]);let f=(0,C.useCallback)(e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),p=(0,C.useMemo)(()=>{if(!l.trim())return null;let e=l.toLowerCase(),t=[];for(let n=0;n<o.length;n++){let r=o[n],i=r?.type??``,a=r?.value??``;(i.toLowerCase().includes(e)||a.toLowerCase().includes(e))&&t.push(n)}return new Set(t)},[l,o]),m=(0,C.useMemo)(()=>{let e=Array.from({length:t.length},(e,t)=>t);return p?e.filter(e=>p.has(e)):e},[t.length,p]);return(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,children:i}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(kv,{label:t.length,size:`small`,color:`default`,sx:{height:22,fontSize:`0.75rem`}}),n&&(0,G.jsx)(_v,{size:`small`,startIcon:(0,G.jsx)(pb,{}),onClick:r,children:`Add`})]})]}),t.length>3&&(0,G.jsx)(SS,{size:`small`,fullWidth:!0,placeholder:`Search rules...`,value:l,onChange:e=>u(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(eF,{position:`start`,children:(0,G.jsx)(lE,{fontSize:`small`,color:`action`})})}},sx:{mb:1}}),p&&m.length===0&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,py:2,children:`No matching rules`}),(0,G.jsx)(Gv,{spacing:.5,children:m.map(e=>{let n=o[e],r=n?.type??``,i=n?.value??``,a=s.has(e);return(0,G.jsxs)(Z,{sx:{border:1,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,sx:{px:1.5,py:.75,cursor:`pointer`,"&:hover":{bgcolor:`action.hover`},bgcolor:a?`action.selected`:`transparent`},onClick:()=>f(e),children:[a?(0,G.jsx)(mhe,{fontSize:`small`,color:`action`}):(0,G.jsx)(ghe,{fontSize:`small`,color:`action`}),r||i?(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,ml:.5,flex:1,minWidth:0,children:[(0,G.jsx)(kv,{label:r,size:`small`,variant:`outlined`,sx:{height:22,fontSize:`0.75rem`,flexShrink:0}}),(0,G.jsx)(Q,{variant:`body2`,noWrap:!0,sx:{flex:1,minWidth:0},children:i})]}):(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,ml:.5,fontStyle:`italic`,children:`New rule (click to configure)`})]}),(0,G.jsx)(ey,{in:a,children:(0,G.jsx)(Z,{sx:{px:2,pb:1.5,pt:.5},children:t[e]})})]},e)})})]})}var Bqe=new Set([``,`pattern`,`regex`]);function Vqe(e){let{schema:t,formData:n,onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=n??{},c=s.type??``,l=s.value??``,u=i||a,d=t.properties??{},f=(d.type?.oneOf??[]).filter(e=>typeof e.const==`string`),p=d.value?.title??`Value`,m=f.find(e=>e.const===c),h=(0,C.useCallback)(e=>r({...s,type:e},o.path),[s,r,o]),g=(0,C.useCallback)(e=>r({...s,value:e},o.path),[s,r,o]),_=Bqe.has(c)&&!u;return(0,G.jsxs)(Gv,{spacing:2,sx:{pt:1},children:[(0,G.jsxs)(Mv,{fullWidth:!0,size:`small`,disabled:u,children:[(0,G.jsx)(Bx,{id:`${o.path}-type`,children:`Type`}),(0,G.jsx)(vS,{labelId:`${o.path}-type`,label:`Type`,value:c,onChange:e=>h(e.target.value),children:f.map(e=>(0,G.jsx)(yS,{value:e.const,children:e.title??e.const},e.const))})]}),m?.description&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:m.description}),_?(0,G.jsx)(WS,{value:l,onChange:g,label:p,placeholder:`sensor.living_room_*`,helperText:`Search or type an entity ID. Wildcards and regex still work.`,margin:`none`}):(0,G.jsx)(SS,{fullWidth:!0,size:`small`,label:p,value:l,disabled:u,onChange:e=>g(e.target.value),helperText:d.value?.description})]})}function Hqe(e){let{schema:t,formData:n={},onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=t.properties??{},c=(0,C.useCallback)((e,t)=>{r({...n,[e]:t},o.path)},[n,r,o]);return(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:`Feature Flags`}),(0,G.jsx)(Rv,{container:!0,spacing:2,children:Object.entries(s).map(([e,t])=>{let r=n[e]??t.default??!1;return(0,G.jsx)(Rv,{size:{xs:12,sm:6,lg:4},children:(0,G.jsx)(vv,{variant:`outlined`,sx:{height:`100%`,opacity:t.title?.toLowerCase().includes(`deprecated`)??!1?.6:1,transition:`border-color 0.2s, box-shadow 0.2s`,borderColor:r?`primary.main`:`divider`,"&:hover":{transform:`none`,boxShadow:`none`}},children:(0,G.jsx)(bv,{onClick:()=>{!i&&!a&&c(e,!r)},disabled:i||a,sx:{height:`100%`},children:(0,G.jsxs)(xv,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:1,children:[(0,G.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,sx:{lineHeight:1.3},children:t.title??e}),r&&(0,G.jsx)(kv,{label:`Active`,size:`small`,color:`primary`,variant:`outlined`,sx:{mt:.5,height:20,fontSize:`0.7rem`}})]}),(0,G.jsx)(US,{checked:r,size:`small`,disabled:i||a,tabIndex:-1,onClick:e=>e.stopPropagation(),onChange:t=>c(e,t.target.checked)})]}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,lineHeight:1.4,flex:1},children:t.description})]})})})},e)})})]})}var W2=function(e){return e.JSON_EDITOR=`JSON_EDITOR`,e.FIELDS_EDITOR=`FIELDS_EDITOR`,e}(W2||{}),G2=e=>{let{t}=ms(),[n,r]=(0,C.useState)(W2.FIELDS_EDITOR),i=()=>{r(n===W2.FIELDS_EDITOR?W2.JSON_EDITOR:W2.FIELDS_EDITOR)},[a,o]=(0,C.useState)(e.bridge),[s,c]=(0,C.useState)(!0),l=(0,C.useCallback)(t=>{let n=t;if(!n?.port)return[];let r=e.usedPorts[n.port];return r!==void 0&&r!==e.bridgeId?[{instancePath:`/port`,message:`Port is already used by bridge with id ${r}`}]:[]},[e.bridgeId,e.usedPorts]),u=(e,t)=>{let n=e=>e?.icon;o(t=>{let r=n(t);return r==null?{...e}:{...e,icon:r}}),c(t)},d=(0,C.useCallback)(e=>{o(t=>{if(e!=null)return{...t,icon:e};let{icon:n,...r}=t??{};return r})},[]),f=(0,C.useMemo)(()=>{let e=a?.featureFlags,t=[];return e?.serverMode&&t.push({severity:`warning`,message:`Server Mode is enabled. Only ONE device should be in this bridge. Multiple devices will cause errors.`}),e?.serverMode&&e?.vacuumOnOff===!1&&t.push({severity:`warning`,message:`Server Mode with Vacuum OnOff disabled: Alexa REQUIRES the OnOff cluster (PowerController) for robotic vacuums. Without it, the vacuum commissions but never appears in Alexa. Only disable this for Apple Home.`}),!e?.serverMode&&e?.vacuumOnOff&&t.push({severity:`warning`,message:`Vacuum OnOff is enabled in bridge mode. This adds a non-standard cluster to the RVC device type which may cause issues with Apple Home and Google Home.`}),e?.autoForceSync&&e?.autoComposedDevices&&t.push({severity:`warning`,message:`Auto Force Sync with Auto Composed Devices increases network traffic. Composed devices have more clusters, so each sync cycle sends more data.`}),t},[a]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Uh,{severity:`warning`,variant:`outlined`,children:[`Please consult`,` `,(0,G.jsx)(Jv,{href:Y9.faq.bridgeConfig,target:`_blank`,children:`the documentation`}),` `,`for proper bridge configurations.`,` `,(0,G.jsx)(`strong`,{children:`Especially if you are using labels, see the "Labels" section.`})]}),(0,G.jsxs)(Uh,{severity:`info`,variant:`outlined`,children:[(0,G.jsx)(`strong`,{children:`Community tip:`}),` Users have reported that bridges with a large number of devices can become unstable depending on the controller. If you experience connectivity issues, consider splitting your devices across multiple bridges.`]}),f.map(e=>(0,G.jsx)(Uh,{severity:e.severity,variant:`outlined`,children:e.message},e.message)),(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(_v,{onClick:()=>i(),title:n===W2.FIELDS_EDITOR?t(`bridge.jsonEditor`):t(`bridge.formEditor`),children:n===W2.FIELDS_EDITOR?(0,G.jsx)(Jhe,{}):(0,G.jsx)(Lhe,{})})}),n===W2.FIELDS_EDITOR&&(0,G.jsx)(Mke,{value:a??{},onChange:u,schema:uv,uiSchema:{icon:{"ui:widget":`hidden`},featureFlags:{"ui:field":`featureFlags`},filter:{include:{"ui:options":{ArrayFieldTemplate:U2},items:{"ui:field":`entityFilterRule`}},exclude:{"ui:options":{ArrayFieldTemplate:U2},items:{"ui:field":`entityFilterRule`}}}},customValidate:l,templates:{ObjectFieldTemplate:Lqe},fields:{featureFlags:Hqe,entityFilterRule:Vqe}}),n===W2.JSON_EDITOR&&(0,G.jsx)(jqe,{value:a??{},onChange:u,schema:uv,customValidate:l}),a?.filter&&(0,G.jsx)(Fqe,{filter:a.filter}),(0,G.jsx)(vv,{variant:`outlined`,children:(0,G.jsxs)(xv,{children:[(0,G.jsx)(Q,{variant:`subtitle1`,gutterBottom:!0,fontWeight:600,children:t(`bridge.iconLabel`)}),(0,G.jsx)(Pqe,{bridgeId:e.bridgeId,selectedIcon:a?.icon,onIconChange:d})]})}),(0,G.jsxs)(Rv,{container:!0,children:[(0,G.jsx)(Rv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(_v,{fullWidth:!0,variant:`outlined`,color:`error`,onClick:e.onCancel,children:t(`common.cancel`)})}),(0,G.jsx)(Rv,{size:{xs:0,sm:4,md:6},sx:{display:{xs:`none`,sm:`block`}}}),(0,G.jsx)(Rv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(_v,{fullWidth:!0,variant:`outlined`,disabled:!s,onClick:async()=>{s&&await e.onSave(a)},children:t(`common.save`)})})]})]})]})},Uqe={name:``,featureFlags:{},filter:{include:[],exclude:[]}};function Wqe(e){let t=5540;for(;e[t];)t++;return t}var Gqe=()=>{let{t:e}=ms(),t=Xv(),n=Sr(),[r,i]=(0,C.useState)(),a=!!AT().content?.length,o=jT(),s=(0,C.useCallback)(e=>{i(e?.id)},[]),c=(0,C.useMemo)(()=>{if(!o)return;let e=Wqe(o);if(r){let t=iv.find(e=>e.id===r);if(t)return{name:t.name,port:e,filter:{...t.filter},featureFlags:{...t.featureFlags},icon:t.icon}}return{...Uqe,port:e}},[o,r]),l=Kme(),u=()=>{n(-1)};return!c||!o?e(`common.loading`):(0,G.jsxs)(Gv,{spacing:4,children:[(0,G.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:e(`common.create`),to:Y9.createBridge}]}),a&&(0,G.jsx)(Uh,{severity:`info`,variant:`outlined`,children:(0,G.jsxs)(Q,{children:[`Did you know that you can connect the same bridge with multiple assistants?`,` `,(0,G.jsx)(Jv,{href:Y9.faq.multiFabric,target:`_blank`,children:`Learn more.`})]})}),(0,G.jsx)(NE,{selectedTemplate:r,onSelect:s}),(0,G.jsx)(G2,{bridge:c,usedPorts:o,onSave:async n=>{await l({...n}).then(()=>t.show({message:e(`bridge.saveSuccess`),severity:`success`})).then(()=>u()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:u},r??`custom`)]})},Kqe=()=>{let{t:e}=ms(),t=Xv(),n=Sr(),{bridgeId:r}=Er(),{content:i,isLoading:a}=MT(r),o=jT(),s=qme(),c=(0,C.useMemo)(()=>{if(!(a||!i))return{name:i.name,port:i.port,filter:i.filter,...i.countryCode!=null&&{countryCode:i.countryCode},...i.featureFlags!=null&&{featureFlags:i.featureFlags},...i.icon!=null&&{icon:i.icon},...i.priority!=null&&{priority:i.priority},...i.serialNumberSuffix!=null&&{serialNumberSuffix:i.serialNumberSuffix}}},[a,i]),l=()=>{n(-1)};return a||!o?e(`common.loading`):!i||!c?e(`notFound.title`):(0,G.jsxs)(Gv,{spacing:4,children:[(0,G.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:i.name,to:Y9.bridge(r)},{name:e(`common.edit`),to:Y9.editBridge(r)}]}),(0,G.jsx)(G2,{bridgeId:r,bridge:c,usedPorts:o,onSave:async n=>{await s({...n,id:r}).then(()=>t.show({message:e(`bridge.updateSuccess`),severity:`success`})).then(()=>l()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:l})]})};async function qqe(){let e=await fetch(`api/backup/snapshots`);return await I_(e,`Failed to fetch backups`),F_(e)}async function Jqe(){let e=await fetch(`api/backup/snapshots/create`,{method:`POST`});return await I_(e,`Failed to create backup`),F_(e)}async function Yqe(e){let t=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/download`);if(!t.ok)throw Error(`Failed to download backup`);let n=await t.blob(),r=window.URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(r),document.body.removeChild(i)}async function Xqe(e,t){let n=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({overwriteExisting:!0,includeMappings:!0,restoreIdentity:!0,...t})});return await I_(n,`Failed to restore backup`),F_(n)}async function Zqe(e){await I_(await fetch(`api/backup/snapshots/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete backup`)}async function Qqe(){let e=await fetch(`api/backup/settings`);return await I_(e,`Failed to fetch backup settings`),F_(e)}async function $qe(e){let t=await fetch(`api/backup/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await I_(t,`Failed to update backup settings`),F_(t)}function eJe(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function K2(){let{t:e}=ms(),[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(new Set),[d,f]=(0,C.useState)(!1),[p,m]=(0,C.useState)(!0),[h,g]=(0,C.useState)(!0),[_,v]=(0,C.useState)(!1),[y,b]=(0,C.useState)(!1),[x,S]=(0,C.useState)(null),w=(0,C.useRef)(null),[T,E]=(0,C.useState)([]),[D,O]=(0,C.useState)(!0),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(null),[F,I]=(0,C.useState)(!1),L=(0,C.useCallback)(async()=>{try{O(!0);let[e,t]=await Promise.all([qqe(),Qqe()]);E(e),A(t)}catch(e){i(e instanceof Error?e.message:`Failed to load backups`)}finally{O(!1)}},[]);(0,C.useEffect)(()=>{L()},[L]);let R=async()=>{I(!0),i(null);try{await Jqe(),o(e(`backup.snapshotCreated`)),await L()}catch(e){i(e instanceof Error?e.message:`Failed to create backup`)}finally{I(!1)}},ee=async e=>{try{await Yqe(e)}catch(e){i(e instanceof Error?e.message:`Failed to download backup`)}},z=async t=>{n(!0),i(null);try{let n=await Xqe(t);n.errors.length>0?i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`):o(e(`backup.snapshotRestored`,{bridges:n.bridgesRestored,mappings:n.mappingsRestored,identities:n.identitiesRestored})),M(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Failed to restore backup`)}finally{n(!1)}},te=async e=>{try{await Zqe(e),P(null),await L()}catch(e){i(e instanceof Error?e.message:`Failed to delete backup`)}},B=async e=>{try{A(await $qe(e))}catch(e){i(e instanceof Error?e.message:`Failed to update settings`)}},V=async(t=!1)=>{n(!0),i(null);try{let n=await fetch(t?`api/backup/download?includeIdentity=true`:`api/backup/download`);if(!n.ok)throw Error(`Failed to create backup`);let r=await n.blob(),i=window.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]||`hamh-backup.zip`,document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(i),document.body.removeChild(a),o(e(`backup.downloadSuccess`))}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},ne=async e=>{let t=e.target.files?.[0];if(t){S(t),n(!0),i(null);try{let e=new FormData;e.append(`file`,t);let n=await fetch(`api/backup/restore/preview`,{method:`POST`,body:e});if(!n.ok){let e=await n.text(),t=`Failed to parse backup`;try{let n=JSON.parse(e);n.error&&(t=n.error)}catch{e&&(t=`${t} (HTTP ${n.status}: ${e.slice(0,120)})`)}throw Error(t)}let r=await n.json();c(r),u(new Set(r.bridges.map(e=>e.id))),v(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1),w.current&&(w.current.value=``)}}},re=async()=>{if(x){n(!0),i(null);try{let e=new FormData;e.append(`file`,x),e.append(`options`,JSON.stringify({bridgeIds:Array.from(l),overwriteExisting:d,includeMappings:p,restoreIdentity:h&&s?.includesIdentity}));let t=await fetch(`api/backup/restore`,{method:`POST`,body:e});if(!t.ok){let e=await t.text(),n=`Failed to restore backup`;try{let t=JSON.parse(e);t.error&&(n=t.error)}catch{e&&(n=`${n} (HTTP ${t.status}: ${e.slice(0,120)})`)}throw Error(n)}let n=await t.json();if(n.errors.length>0)i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`);else{let e=[`Restored ${n.bridgesRestored} bridges`];n.mappingsRestored>0&&e.push(`${n.mappingsRestored} entity mappings`),n.identitiesRestored>0&&e.push(`${n.identitiesRestored} identities`),o(`${e.join(`, `)}!`)}v(!1),c(null),S(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}}},ie=e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(t)};return(0,G.jsxs)(vv,{children:[(0,G.jsxs)(xv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,children:[(0,G.jsx)(HT,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.title`)]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`backup.description`)}),r&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},onClose:()=>i(null),children:r}),a&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,G.jsxs)(Rv,{container:!0,spacing:2,children:[(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(HT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.configBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupNote`)})]}),(0,G.jsx)(_v,{variant:`contained`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(HT,{}),onClick:()=>V(!1),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.configBackup`)})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(uE,{color:`warning`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.fullBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupWarning`)})]}),(0,G.jsx)(_v,{variant:`contained`,color:`warning`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(HT,{}),onClick:()=>V(!0),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.fullBackup`)})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(sE,{color:`info`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.restoreFromBackup`)})]}),(0,G.jsx)(Z,{sx:{flexGrow:1},children:(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.restoreDesc`)})}),(0,G.jsxs)(_v,{variant:`outlined`,color:`info`,startIcon:(0,G.jsx)(sE,{}),component:`label`,disabled:t,fullWidth:!0,sx:{mt:2},children:[e(`backup.restoreFromBackup`),(0,G.jsx)(`input`,{ref:w,type:`file`,accept:`.zip`,hidden:!0,onChange:ne})]})]})})]}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(HT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.storedBackups`)}),T.length>0&&(0,G.jsx)(kv,{label:T.length,size:`small`,color:`primary`,variant:`outlined`})]}),(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:F?(0,G.jsx)(Rh,{size:16,color:`inherit`}):(0,G.jsx)(pb,{}),onClick:R,disabled:F,children:e(`backup.createSnapshot`)})]}),D?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:2,children:(0,G.jsx)(Rh,{size:24})}):T.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:2},children:e(`backup.noSnapshots`)}):(0,G.jsx)(ny,{dense:!0,children:T.map(t=>(0,G.jsxs)(ay,{secondaryAction:(0,G.jsxs)(Z,{display:`flex`,gap:.5,children:[(0,G.jsx)(fb,{title:e(`backup.downloadSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>ee(t.filename),children:(0,G.jsx)(ET,{fontSize:`small`})})}),(0,G.jsx)(fb,{title:e(`backup.restoreSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,color:`warning`,onClick:()=>M(t.filename),children:(0,G.jsx)(sE,{fontSize:`small`})})}),(0,G.jsx)(fb,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>P(t.filename),children:(0,G.jsx)(NS,{fontSize:`small`})})})]}),children:[(0,G.jsx)(sy,{sx:{minWidth:36},children:(0,G.jsx)(HT,{fontSize:`small`,color:t.auto?`action`:`primary`})}),(0,G.jsx)(ly,{primary:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`v`,t.version]}),(0,G.jsx)(kv,{label:t.auto?e(`backup.auto`):e(`backup.manual`),size:`small`,variant:`outlined`,color:t.auto?`default`:`primary`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:eJe(t.sizeBytes)})]}),secondary:new Date(t.createdAt).toLocaleString()})]},t.filename))}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(DT,{color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.settings`)})]}),k&&(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,maxWidth:400},children:[(0,G.jsx)(Lv,{control:(0,G.jsx)(US,{checked:k.autoBackup,onChange:e=>B({autoBackup:e.target.checked})}),label:e(`backup.autoBackupLabel`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:-1},children:e(`backup.autoBackupDesc`)}),(0,G.jsx)(SS,{label:e(`backup.retentionCount`),type:`number`,size:`small`,value:k.backupRetentionCount,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=100&&B({backupRetentionCount:t})},inputProps:{min:1,max:100},helperText:e(`backup.retentionCountDesc`),sx:{maxWidth:200}})]})]}),(0,G.jsxs)(zb,{open:_,onClose:()=>v(!1),maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Hb,{children:e(`backup.restoreTitle`)}),(0,G.jsx)(Vb,{children:s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,gutterBottom:!0,children:[`Backup created: `,new Date(s.createdAt).toLocaleString()]}),s.includesIdentity&&(0,G.jsx)(Uh,{severity:`info`,sx:{mt:1},children:`This backup includes Matter identity data (keypairs, fabric credentials). Restoring identities allows bridges to reconnect without re-commissioning.`}),(0,G.jsxs)(Q,{variant:`subtitle2`,sx:{mt:2,mb:1},children:[e(`backup.selectBridges`),`:`]}),(0,G.jsx)(ny,{dense:!0,children:s.bridges.map(e=>(0,G.jsxs)(ay,{onClick:()=>ie(e.id),sx:{cursor:`pointer`},children:[(0,G.jsx)(sy,{children:(0,G.jsx)(Ev,{edge:`start`,checked:l.has(e.id),tabIndex:-1,disableRipple:!0})}),(0,G.jsx)(ly,{primary:e.name,secondary:(0,G.jsxs)(G.Fragment,{children:[`Port: `,e.port,e.hasMappings&&` • ${e.mappingCount} entity mappings`,e.exists&&(0,G.jsx)(Q,{component:`span`,color:`warning.main`,sx:{ml:1},children:`(exists)`})]})})]},e.id))}),(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{checked:d,onChange:e=>f(e.target.checked)}),label:e(`backup.overwriteExisting`)}),(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{checked:p,onChange:e=>m(e.target.checked)}),label:e(`backup.includeMappings`)}),s?.includesIdentity&&(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{checked:h,onChange:e=>g(e.target.checked)}),label:e(`backup.restoreIdentities`)})]})]})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>v(!1),children:e(`common.cancel`)}),(0,G.jsx)(_v,{variant:`contained`,onClick:re,disabled:t||l.size===0,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(zb,{open:y,onClose:()=>b(!1),children:[(0,G.jsxs)(Hb,{children:[(0,G.jsx)(oE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.restartRequired`)]}),(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Q,{children:e(`backup.restartMessage`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:e(`backup.restartNote`)})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>b(!1),children:e(`common.later`)}),(0,G.jsx)(_v,{variant:`contained`,color:`warning`,onClick:async()=>{n(!0);try{await fetch(`api/backup/restart`,{method:`POST`}),o(`Application is restarting...`)}catch(e){i(e instanceof Error?e.message:`Failed to restart`)}finally{n(!1),b(!1)}},disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(oE,{}),children:e(`backup.restartNow`)})]})]}),(0,G.jsxs)(zb,{open:j!==null,onClose:()=>M(null),children:[(0,G.jsxs)(Hb,{children:[(0,G.jsx)(sE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmRestore`)]}),(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Q,{children:e(`backup.confirmRestoreMessage`,{filename:j})}),(0,G.jsx)(Uh,{severity:`warning`,sx:{mt:2},children:e(`backup.restoreWarning`)})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>M(null),children:e(`common.cancel`)}),(0,G.jsx)(_v,{variant:`contained`,color:`warning`,onClick:()=>j&&z(j),disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(zb,{open:N!==null,onClose:()=>P(null),children:[(0,G.jsxs)(Hb,{children:[(0,G.jsx)(NS,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmDelete`)]}),(0,G.jsx)(Vb,{children:(0,G.jsx)(Q,{children:e(`backup.confirmDeleteMessage`,{filename:N})})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>P(null),children:e(`common.cancel`)}),(0,G.jsx)(_v,{variant:`contained`,color:`error`,onClick:()=>N&&te(N),children:e(`common.delete`)})]})]})]})}var tJe=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function nJe(e={}){let{t}=ms(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(`name`),[u,d]=(0,C.useState)(`asc`),f=e.sortField??c,p=e.sortDirection??u,m=e.onSortFieldChange??l,h=e.onSortDirectionChange??d,g=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/health/detailed`);e.ok?(r(await e.json()),s(null)):s(t(`health.fetchFailed`))}catch{s(t(`health.connectionError`))}finally{a(!1)}},[t]);(0,C.useEffect)(()=>{g();let e=setInterval(g,1e4);return()=>clearInterval(e)},[g]);let _=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/diagnostic/export`);if(e.ok){let t=await e.blob(),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`hamh-diagnostic-${new Date().toISOString().replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}}catch{s(t(`health.exportFailed`))}},[t]),v=async e=>{try{await fetch(`api/matter/bridges/${e}/actions/restart`,{method:`POST`}),g()}catch{s(t(`health.restartFailed`))}};return i?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:4,children:(0,G.jsx)(Rh,{})}):o||!n?(0,G.jsx)(Uh,{severity:`error`,sx:{m:2},children:o??t(`health.unableToLoad`)}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[n.status===`healthy`?(0,G.jsx)(fv,{color:`success`}):n.status===`degraded`?(0,G.jsx)(Qv,{color:`warning`}):(0,G.jsx)(Cx,{color:`error`}),(0,G.jsx)(Q,{variant:`h5`,children:t(`health.systemHealth`)}),(0,G.jsx)(kv,{label:n.status.toUpperCase(),color:n.status===`healthy`?`success`:n.status===`degraded`?`warning`:`error`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(UT,{}),onClick:_,children:t(`health.exportDiagnostic`)}),(0,G.jsx)(fb,{title:t(`common.refresh`),children:(0,G.jsx)(Bh,{onClick:g,"aria-label":`Refresh health data`,children:(0,G.jsx)(aE,{})})})]})]}),(0,G.jsxs)(Rv,{container:!0,spacing:2,children:[(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.version`)}),(0,G.jsx)(Q,{variant:`h6`,children:n.version})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.uptime`)}),(0,G.jsx)(Q,{variant:`h6`,children:tJe(n.uptime)})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.homeAssistant`)}),(0,G.jsx)(kv,{label:n.services.homeAssistant.connected?t(`health.connected`):t(`health.disconnected`),color:n.services.homeAssistant.connected?`success`:`error`,size:`small`})]})})]}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(tE,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.bridgeStatus`)}),(0,G.jsx)(kv,{label:`${n.services.bridges.running}/${n.services.bridges.total} ${t(`common.running`)}`,size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Mx,{fontSize:`small`,color:`action`}),(0,G.jsxs)(Mv,{size:`small`,sx:{minWidth:120},children:[(0,G.jsx)(Bx,{children:t(`health.sortBy`)}),(0,G.jsxs)(vS,{value:f,label:t(`health.sortBy`),onChange:e=>m(e.target.value),children:[(0,G.jsx)(yS,{value:`name`,children:t(`common.name`)}),(0,G.jsx)(yS,{value:`created`,children:t(`health.created`)})]})]}),(0,G.jsx)(fb,{title:t(p===`asc`?`health.ascending`:`health.descending`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>h(p===`asc`?`desc`:`asc`),"aria-label":`Sort ${p===`asc`?`descending`:`ascending`}`,children:p===`asc`?(0,G.jsx)(zT,{fontSize:`small`}):(0,G.jsx)(RT,{fontSize:`small`})})})]})]}),(0,G.jsx)(Rv,{container:!0,spacing:2,alignItems:`stretch`,children:[...n.bridgeDetails].sort((e,t)=>{let n=0;return n=f===`name`?e.name.localeCompare(t.name):e.id.localeCompare(t.id),p===`asc`?n:-n}).map(e=>(0,G.jsx)(Rv,{size:{xs:12,sm:6,md:6,lg:4,xl:3},sx:{display:`flex`},children:(0,G.jsx)(vv,{variant:`outlined`,sx:{width:`100%`,height:`100%`,minWidth:280,maxWidth:480,display:`flex`,flexDirection:`column`,borderColor:e.status===`running`?`success.main`:e.status===`failed`?`error.main`:`warning.main`},children:(0,G.jsxs)(xv,{sx:{flex:1,display:`flex`,flexDirection:`column`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,flexShrink:0,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,minWidth:0,children:[(0,G.jsx)(hb,{}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,noWrap:!0,sx:{maxWidth:140},children:e.name})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:.5,flexShrink:0,children:[(0,G.jsx)(kv,{label:e.status.toUpperCase(),color:e.status===`running`?`success`:e.status===`failed`?`error`:`warning`,size:`small`}),e.status===`failed`&&(0,G.jsx)(fb,{title:t(`bridge.restart`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>v(e.id),children:(0,G.jsx)(VT,{})})})]})]}),e.statusReason&&(0,G.jsx)(Q,{variant:`body2`,color:`error`,sx:{mt:1,flexShrink:0},children:e.statusReason}),(0,G.jsx)(Z,{sx:{mt:`auto`,pt:1,flexShrink:0},children:(0,G.jsxs)(Z,{display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`,children:[(0,G.jsx)(kv,{label:`${t(`common.port`)} ${e.port}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(kv,{label:`${e.deviceCount} ${t(`common.devices`)}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(kv,{label:`${e.fabricCount} ${t(`common.fabrics`)}`,size:`small`,variant:`outlined`,color:`default`}),e.failedEntityCount>0&&(0,G.jsx)(kv,{label:`${e.failedEntityCount} failed`,color:`error`,size:`small`})]})}),e.connectivity&&e.status===`running`&&(0,G.jsx)(Z,{sx:{mt:1,flexShrink:0},children:(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.sessions`),`:`,` `,e.connectivity.totalSessions,` |`,` `,t(`health.subscriptions`),`:`,` `,e.connectivity.totalSubscriptions,e.connectivity.fabricSummary&&e.connectivity.fabricSummary.length>1&&` (${e.connectivity.fabricSummary.length} ${t(`health.fabrics`)})`]})}),e.fabrics.length>0&&(0,G.jsxs)(Z,{sx:{mt:1,flexShrink:0},children:[(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.connectedTo`),`:`]}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mt:.5,children:e.fabrics.map(e=>(0,G.jsx)(fb,{title:(0,G.jsxs)(Z,{sx:{fontSize:`0.75rem`},children:[(0,G.jsxs)(`div`,{children:[`Fabric #`,e.fabricIndex]}),(0,G.jsxs)(`div`,{children:[`Vendor: `,xx(e.rootVendorId),` `,`(0x`,e.rootVendorId.toString(16).toUpperCase().padStart(4,`0`),`)`]}),(0,G.jsxs)(`div`,{children:[`Fabric ID: `,e.fabricId]}),(0,G.jsxs)(`div`,{children:[`Node ID: `,e.nodeId]}),(0,G.jsxs)(`div`,{children:[`Root Node ID: `,e.rootNodeId]})]}),children:(0,G.jsx)(kv,{icon:(0,G.jsx)(Sx,{fabric:e}),label:e.label||xx(e.rootVendorId),size:`small`,variant:`outlined`})},e.fabricIndex))})]})]})})},e.id))}),n.recovery.enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(VT,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.autoRecovery`)}),(0,G.jsx)(kv,{label:t(`common.enabled`),color:`success`,size:`small`})]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[t(`health.recoveryAttempts`),`: `,n.recovery.recoveryCount,n.recovery.lastRecoveryAttempt&&` | Last attempt: ${new Date(n.recovery.lastRecoveryAttempt).toLocaleString()}`]})]}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsx)(K2,{})]})}var q2=e=>e===`pass`?`success`:e===`warn`?`warning`:`error`;function rJe(){let{t:e}=ms(),[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useCallback)(async()=>{i(!0),o(null);try{let t=await fetch(`api/network`);t.ok?n(await t.json()):o(e(`health.fetchFailed`))}catch{o(e(`health.connectionError`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{l()},[l]);let u=t?.checks.filter(e=>e.status===`pass`).length??0,d=t?.checks.filter(e=>e.status===`warn`).length??0,f=t?.checks.filter(e=>e.status===`fail`).length??0;return(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`health.networkDiagnostics`)}),(0,G.jsx)(_v,{size:`small`,onClick:l,disabled:r,children:r?(0,G.jsx)(Rh,{size:16}):e(`health.refresh`)})]}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:1},children:a}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:1.5,flexWrap:`wrap`,children:[u>0&&(0,G.jsx)(kv,{label:`${u} ${e(`health.checksPassed`)}`,color:`success`,size:`small`,variant:`outlined`}),d>0&&(0,G.jsx)(kv,{label:`${d} ${e(`health.checksWarning`)}`,color:`warning`,size:`small`,variant:`outlined`}),f>0&&(0,G.jsx)(kv,{label:`${f} ${e(`health.checksFailed`)}`,color:`error`,size:`small`,variant:`outlined`}),(0,G.jsx)(kv,{label:t.matterConfig.boundInterface?`mDNS: ${t.matterConfig.boundInterface}`:`mDNS: all interfaces`,size:`small`,variant:`outlined`}),(0,G.jsx)(kv,{label:`IPv4: ${t.matterConfig.ipv4Enabled?`on`:`off`}`,size:`small`,variant:`outlined`})]}),t.checks.filter(e=>e.status!==`pass`).map(e=>(0,G.jsxs)(Uh,{severity:q2(e.status),sx:{mb:1},children:[(0,G.jsx)(`strong`,{children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.5},children:e.detail})]},e.name)),(0,G.jsx)(_v,{size:`small`,onClick:()=>c(!s),sx:{mt:.5},children:e(s?`health.hideDetails`:`health.showDetails`)}),(0,G.jsxs)(ey,{in:s,children:[(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:1,mb:.5},children:e(`health.allChecks`)}),(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:e(`health.check`)}),(0,G.jsx)(cC,{children:e(`health.statusLabel`)}),(0,G.jsx)(cC,{children:e(`health.message`)})]})}),(0,G.jsx)(sC,{children:t.checks.map(e=>(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:(0,G.jsx)(Q,{variant:`body2`,children:e.name})}),(0,G.jsx)(cC,{children:(0,G.jsx)(kv,{label:e.status,color:q2(e.status),size:`small`})}),(0,G.jsxs)(cC,{children:[(0,G.jsx)(Q,{variant:`body2`,children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,display:`block`,children:e.detail})]})]},e.name))})]}),(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:2,mb:.5},children:e(`health.networkInterfaces`)}),(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:e(`health.interfaceName`)}),(0,G.jsx)(cC,{children:`IPv4`}),(0,G.jsx)(cC,{children:`IPv6`}),(0,G.jsx)(cC,{children:`MAC`})]})}),(0,G.jsx)(sC,{children:t.interfaces.filter(e=>!e.internal).map(e=>(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:e.name}),(0,G.jsx)(cC,{children:e.ipv4.join(`, `)||`-`}),(0,G.jsx)(cC,{children:(0,G.jsx)(Q,{variant:`body2`,sx:{wordBreak:`break-all`,maxWidth:240},children:e.ipv6.join(`, `)||`-`})}),(0,G.jsx)(cC,{children:e.mac})]},e.name))})]})]})]})]})}var J2=`hamh-translation-overrides`;function Y2(e,t=``){let n={};for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(n,Y2(i,e)):n[e]=String(i??``)}return n}function X2(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.split(`.`),i=t;for(let t=0;t<e.length-1;t++)e[t]in i||(i[e[t]]={}),i=i[e[t]];i[e[e.length-1]]=r}return t}function Z2(e){try{let t=localStorage.getItem(J2);return t?JSON.parse(t)[e]??{}:{}}catch{return{}}}function Q2(e,t){try{let n=localStorage.getItem(J2),r=n?JSON.parse(n):{};Object.keys(t).length===0?delete r[e]:r[e]=t,localStorage.setItem(J2,JSON.stringify(r))}catch{}}var $2=`hamh-custom-languages`;function iJe(){try{let e=localStorage.getItem($2);return e?JSON.parse(e):[]}catch{return[]}}function e4(e){localStorage.setItem($2,JSON.stringify(e))}var t4=[{code:`de`,name:`Deutsch`},{code:`fr`,name:`Français`},{code:`es`,name:`Español`},{code:`it`,name:`Italiano`},{code:`zh`,name:`中文`},{code:`zh-TW`,name:`繁體中文`},{code:`ja`,name:`日本語`},{code:`th`,name:`ไทย`},{code:`sv`,name:`Svenska`},{code:`tr`,name:`Türkçe`},{code:`ru`,name:`Русский`}];function aJe(){let{t:e,i18n:t}=ms(),n=t.language??`en`,r=t4.some(e=>e.code===n)?n:n.split(`-`)[0]??`en`,[i,a]=(0,C.useState)(()=>r===`en`?`de`:r),[o,s]=(0,C.useState)(``),[c,l]=(0,C.useState)(()=>Z2(i)),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(`all`),[m,h]=(0,C.useState)(iJe),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(``),D=(0,C.useMemo)(()=>[...t4,...m],[m]),O=(0,C.useCallback)(e=>m.some(t=>t.code===e),[m]),k=(0,C.useMemo)(()=>Y2(gs),[]),A=(0,C.useMemo)(()=>{let e=t.getResourceBundle(i,`translation`);return e?Y2(e):{}},[i,t]),j=(0,C.useMemo)(()=>Object.keys(k).map(e=>({key:e,section:e.split(`.`)[0],enValue:k[e],currentValue:c[e]??A[e]??``,isOverridden:e in c})),[k,A,c]),M=(0,C.useMemo)(()=>{let e=j;if(o){let t=o.toLowerCase();e=e.filter(e=>e.key.toLowerCase().includes(t)||e.enValue.toLowerCase().includes(t)||e.currentValue.toLowerCase().includes(t))}return f===`missing`?e=e.filter(e=>!e.currentValue):f===`edited`&&(e=e.filter(e=>e.isOverridden)),e},[j,o,f]),N=(0,C.useMemo)(()=>[...new Set(M.map(e=>e.section))],[M]),P=Object.keys(k).length,F=j.filter(e=>e.currentValue).length,I=Object.keys(c).length,L=P>0?F/P*100:0;(0,C.useEffect)(()=>{l(Z2(i))},[i]);let R=(0,C.useCallback)(e=>{l(e),Q2(i,e);let n=t.getResourceBundle(i,`translation`),r=n?Y2(n):{},a={};for(let[t,n]of Object.entries(e))n&&n!==r[t]&&(a[t]=n);if(Object.keys(a).length>0){let e=X2({...r,...a});t.addResourceBundle(i,`translation`,e,!0,!0)}},[i,t]),ee=(0,C.useCallback)((e,t)=>{let n={...c,[e]:t};t||delete n[e],R(n)},[c,R]),z=(0,C.useCallback)(e=>{let t={...c};delete t[e],R(t)},[c,R]),te=(0,C.useCallback)(()=>{R({})},[R]),B=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=X2(e),n=JSON.stringify(t,null,2),r=new Blob([n],{type:`application/json`}),a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=`${i}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},[k,A,c,i]),V=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=X2(e);navigator.clipboard.writeText(JSON.stringify(t,null,2)),d(!0),setTimeout(()=>d(!1),2e3)},[k,A,c]),ne=(0,C.useCallback)(()=>{let n=v.trim().toLowerCase(),r=b.trim();if(!n){w(e(`translationEditor.codeRequired`));return}if(!r){w(e(`translationEditor.nameRequired`));return}if(t4.some(e=>e.code===n)||m.some(e=>e.code===n)||n===`en`){w(e(`translationEditor.languageExists`));return}let i=[...m,{code:n,name:r}];h(i),e4(i),t.addResourceBundle(n,`translation`,{},!0,!0),a(n),_(!1),y(``),x(``),w(``)},[v,b,m,t,e]),re=(0,C.useCallback)(()=>{if(!O(i))return;let e=m.filter(e=>e.code!==i);h(e),e4(e),Q2(i,{}),a(t4[0].code)},[i,m,O]),ie=(0,C.useCallback)(()=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.json`,t.onchange=()=>{let n=t.files?.[0];if(!n)return;let r=new FileReader;r.onload=()=>{try{let t=JSON.parse(r.result);if(typeof t!=`object`||!t)throw Error();let n=Y2(t),i=new Set(Object.keys(k)),a={},o=0;for(let[e,t]of Object.entries(n))i.has(e)&&t&&(a[e]=t,o++);R({...c,...a}),E(e(`translationEditor.importSuccess`,{count:o}))}catch{E(e(`translationEditor.importFailed`))}},r.readAsText(n)},t.click()},[k,c,R,e]);return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Xhe,{}),(0,G.jsx)(Q,{variant:`h5`,children:e(`translationEditor.title`)})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(Mv,{size:`small`,sx:{minWidth:140},children:[(0,G.jsx)(Bx,{children:e(`translationEditor.editLanguage`)}),(0,G.jsx)(vS,{value:i,label:e(`translationEditor.editLanguage`),onChange:e=>a(e.target.value),children:D.map(e=>(0,G.jsxs)(yS,{value:e.code,children:[(0,G.jsx)(ly,{primary:e.name}),O(e.code)&&(0,G.jsx)(sy,{sx:{minWidth:`auto`,ml:1},children:(0,G.jsx)(qT,{fontSize:`small`,color:`disabled`})})]},e.code))})]}),(0,G.jsx)(fb,{title:e(`translationEditor.addLanguage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>_(e=>!e),children:(0,G.jsx)(pb,{fontSize:`small`})})}),O(i)&&(0,G.jsx)(fb,{title:e(`translationEditor.removeLanguage`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:re,children:(0,G.jsx)(qT,{fontSize:`small`})})})]})]}),(0,G.jsx)(ey,{in:g,children:(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,alignItems:`flex-start`,flexWrap:`wrap`,children:[(0,G.jsx)(SS,{size:`small`,label:e(`translationEditor.newLanguageCode`),value:v,onChange:e=>y(e.target.value),error:!!S,sx:{width:180}}),(0,G.jsx)(SS,{size:`small`,label:e(`translationEditor.newLanguageName`),value:b,onChange:e=>x(e.target.value),sx:{width:220}}),(0,G.jsx)(_v,{variant:`contained`,size:`small`,onClick:ne,children:e(`translationEditor.addLanguageButton`)}),S&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:.5},children:S})]})}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:2},children:e(`translationEditor.info`)}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,mb:2,flexWrap:`wrap`,children:[(0,G.jsxs)(Z,{sx:{flexGrow:1,minWidth:200},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:.5,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`translationEditor.progress`,{translated:F,total:P})}),(0,G.jsxs)(Q,{variant:`body2`,fontWeight:600,children:[Math.round(L),`%`]})]}),(0,G.jsx)(Wv,{variant:`determinate`,value:L,sx:{height:8,borderRadius:4}})]}),I>0&&(0,G.jsx)(kv,{label:e(`translationEditor.localEdits`,{count:I}),color:`primary`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,flexWrap:`wrap`,children:[(0,G.jsx)(SS,{size:`small`,placeholder:e(`translationEditor.searchPlaceholder`),value:o,onChange:e=>s(e.target.value),sx:{flexGrow:1,minWidth:200},slotProps:{input:{startAdornment:(0,G.jsx)(eF,{position:`start`,children:(0,G.jsx)(lE,{fontSize:`small`})})}}}),(0,G.jsx)(Mv,{size:`small`,sx:{minWidth:130},children:(0,G.jsxs)(vS,{value:f,onChange:e=>p(e.target.value),children:[(0,G.jsx)(yS,{value:`all`,children:e(`translationEditor.filterAll`)}),(0,G.jsx)(yS,{value:`missing`,children:e(`translationEditor.filterMissing`)}),(0,G.jsx)(yS,{value:`edited`,children:e(`translationEditor.filterEdited`)})]})})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:3,flexWrap:`wrap`,children:[(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(gE,{}),onClick:B,children:e(`translationEditor.exportJson`)}),(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(ET,{}),onClick:ie,children:e(`translationEditor.importJson`)}),(0,G.jsx)(fb,{title:u?e(`translationEditor.copied`):``,children:(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(mb,{}),onClick:V,children:e(`translationEditor.copyJson`)})}),I>0&&(0,G.jsx)(_v,{variant:`outlined`,size:`small`,color:`warning`,startIcon:(0,G.jsx)(sE,{}),onClick:te,children:e(`translationEditor.resetAll`)})]}),N.map(t=>(0,G.jsxs)(Z,{sx:{mb:3},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,sx:{mb:1,textTransform:`capitalize`},children:t}),(0,G.jsx)(Wb,{sx:{mb:1.5}}),M.filter(e=>e.section===t).map(t=>(0,G.jsxs)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`1fr 1fr auto`},gap:1,mb:1.5,alignItems:`start`},children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{fontFamily:`monospace`},children:t.key}),(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.25},children:t.enValue})]}),(0,G.jsx)(SS,{size:`small`,fullWidth:!0,multiline:t.enValue.length>60,minRows:1,maxRows:4,value:t.currentValue,onChange:e=>ee(t.key,e.target.value),placeholder:t.enValue,sx:{"& .MuiOutlinedInput-root":t.isOverridden?{borderColor:`primary.main`,"& fieldset":{borderColor:`primary.main`,borderWidth:2}}:{}}}),t.isOverridden&&(0,G.jsx)(fb,{title:e(`translationEditor.resetKey`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>z(t.key),children:(0,G.jsx)(sE,{fontSize:`small`})})})]},t.key))]},t)),M.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,sx:{textAlign:`center`,py:4},children:e(`translationEditor.noResults`)}),(0,G.jsx)($h,{open:!!T,autoHideDuration:3e3,onClose:()=>E(``),message:T})]})}var n4=e=>{let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`},r4=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`},oJe=()=>{let[e,t]=(0,C.useState)(null),[n,r]=(0,C.useState)(!0),[i,a]=(0,C.useState)(!0);if((0,C.useEffect)(()=>{let e=null,n=async()=>{try{let n=await fetch(`api/system/info`);n.ok?(t(await n.json()),a(!0)):n.status===404&&(a(!1),e&&=(clearInterval(e),null))}catch{}finally{r(!1)}};return n(),e=setInterval(n,3e4),()=>{e&&clearInterval(e)}},[]),!i)return null;if(n)return(0,G.jsx)(vv,{children:(0,G.jsx)(xv,{children:(0,G.jsx)(Q,{children:`Loading system information...`})})});if(!e)return(0,G.jsx)(vv,{children:(0,G.jsx)(xv,{children:(0,G.jsx)(Q,{color:`error`,children:`Failed to load system information`})})});let o=e.memory.used/e.memory.total*100,s=e.storage.used/e.storage.total*100;return(0,G.jsx)(vv,{children:(0,G.jsxs)(xv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(The,{}),`System Information`]}),(0,G.jsxs)(Rv,{container:!0,spacing:3,children:[(0,G.jsx)(Rv,{size:{xs:12,md:6},children:(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`Application`}),(0,G.jsxs)(Gv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Version:`}),(0,G.jsx)(kv,{label:e.version,size:`small`,color:`primary`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Environment:`}),(0,G.jsx)(kv,{label:e.environment,size:`small`,variant:`outlined`,color:e.environment===`Home Assistant Add-on`?`success`:`default`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Node.js:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.nodeVersion})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Process Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:r4(e.process.uptime)})]})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`System`}),(0,G.jsxs)(Gv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Hostname:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.hostname})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Platform:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[e.platform,` (`,e.arch,`)`]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`CPU:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,sx:{maxWidth:200,textAlign:`right`},noWrap:!0,title:e.cpuModel,children:[e.cpuCount,`x`,` `,e.cpuModel.split(`@`)[0].trim()]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`System Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:r4(e.uptime)})]})]})]})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:6},children:(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(tE,{}),`Memory Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[n4(e.memory.used),` /`,` `,n4(e.memory.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[o.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${o}%`,backgroundColor:o>80?`error.main`:o>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(tE,{}),`HAMH Process Memory`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:.5},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`RSS: `,n4(e.process.rss)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[`Heap: `,n4(e.process.heapUsed),` /`,` `,n4(e.process.heapSizeLimit)]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${Math.min(e.process.heapUsed/e.process.heapSizeLimit*100,100)}%`,backgroundColor:e.process.heapUsed/e.process.heapSizeLimit>.85?`error.main`:e.process.heapUsed/e.process.heapSizeLimit>.6?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(qhe,{}),`Storage Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[n4(e.storage.used),` /`,` `,n4(e.storage.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[s.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${s}%`,backgroundColor:s>80?`error.main`:s>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]})]})}),(0,G.jsxs)(Rv,{size:{xs:12},children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(Bhe,{}),`Network Interfaces`]}),(0,G.jsx)(Gv,{spacing:1,sx:{mt:1},children:e.network.interfaces.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(Q,{variant:`body2`,children:e.name}),(0,G.jsx)(kv,{label:`${e.address} (${e.family})`,size:`small`,variant:`outlined`})]},`${e.name}-${e.address}`))})]})]})]})})},i4=200;function sJe(){let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,n=document.querySelector(`base`)?.href||window.location.origin,i=new URL(n),l=`${e}//${i.host}${i.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`),u=new WebSocket(l);o.current=u,u.onopen=()=>{a(!0),u.send(JSON.stringify({type:`subscribe_diagnostics`}))},u.onmessage=e=>{try{let n=JSON.parse(e.data);if(n.type===`diagnostic_event`){let e=n.data;t(t=>{let n=[...t,e];return n.length>i4?n.slice(-i4):n})}else if(n.type===`diagnostic_snapshot`){let e=n.data;r(e),t(e.recentEvents??[])}}catch{}},u.onclose=()=>{a(!1),o.current=null,s.current=setTimeout(c,3e3)},u.onerror=()=>u.close()},[]);return(0,C.useEffect)(()=>(c(),()=>{clearTimeout(s.current),o.current&&(o.current.send(JSON.stringify({type:`unsubscribe_diagnostics`})),o.current.close())}),[c]),{events:e,snapshot:n,connected:i,clearEvents:(0,C.useCallback)(()=>t([]),[])}}function a4(e){let t=e.replace(`#`,``),n=Number.parseInt(t.substring(0,2),16)/255,r=Number.parseInt(t.substring(2,4),16)/255,i=Number.parseInt(t.substring(4,6),16)/255;return .2126*(n<=.03928?n/12.92:((n+.055)/1.055)**2.4)+.7152*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.0722*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)>.179?`#000`:`#fff`}var o4={state_update:`#4caf50`,command_received:`#2196f3`,entity_error:`#f44336`,session_opened:`#ff9800`,session_closed:`#9e9e9e`,subscription_changed:`#9c27b0`,bridge_started:`#00bcd4`,bridge_stopped:`#795548`,entity_warning:`#ff9800`},s4={state_update:`diagnostics.stateUpdate`,command_received:`diagnostics.command`,entity_error:`diagnostics.entityError`,session_opened:`diagnostics.sessionOpen`,session_closed:`diagnostics.sessionClose`,subscription_changed:`diagnostics.subscription`,bridge_started:`diagnostics.bridgeStart`,bridge_stopped:`diagnostics.bridgeStop`,entity_warning:`diagnostics.entityWarning`};function cJe(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}var c4=Object.keys(o4);function lJe({sortField:e,sortDirection:t}={}){let{t:n}=ms(),r=Cm(),{events:i,snapshot:a,connected:o,clearEvents:s}=sJe(),[c,l]=(0,C.useState)(new Set(c4)),[u,d]=(0,C.useState)(!1),f=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},p=i.filter(e=>c.has(e.type)),m=(0,C.useMemo)(()=>{let n=a?.bridges??[];return e?[...n].sort((n,r)=>{let i=0;return i=e===`name`?n.bridgeName.localeCompare(r.bridgeName):n.bridgeId.localeCompare(r.bridgeId),t===`desc`?-i:i}):n},[a?.bridges,e,t]),h={};for(let e of i)h[e.type]=(h[e.type]??0)+1;return(0,G.jsx)(vv,{children:(0,G.jsxs)(xv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Yhe,{}),(0,G.jsx)(Q,{variant:`h6`,children:n(`diagnostics.title`)}),(0,G.jsx)(kv,{icon:(0,G.jsx)(jhe,{sx:{fontSize:10,color:o?r.palette.success.main:r.palette.error.main}}),label:n(o?`common.live`:`common.offline`),size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Gv,{direction:`row`,spacing:.5,alignItems:`center`,children:[(0,G.jsx)(fb,{title:n(`diagnostics.filterEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>d(e=>!e),color:u?`primary`:`default`,children:(0,G.jsx)(vb,{})})}),(0,G.jsx)(fb,{title:n(`diagnostics.clearEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:s,children:(0,G.jsx)(Che,{})})})]})]}),(0,G.jsxs)(Gv,{direction:`row`,spacing:.5,flexWrap:`wrap`,sx:{mb:2,gap:.5},children:[c4.map(e=>{let t=h[e]??0;if(t===0&&!u)return null;let r=o4[e];return(0,G.jsx)(kv,{label:`${n(s4[e])}: ${t}`,size:`small`,sx:{bgcolor:c.has(e)?r:`action.disabledBackground`,color:c.has(e)?a4(r):`text.disabled`,fontSize:`0.7rem`,height:22,cursor:`pointer`,opacity:c.has(e)?1:.5},onClick:()=>f(e)},e)}),a?.system&&(0,G.jsx)(kv,{label:`Total: ${a.system.eventCount}`,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})]}),(0,G.jsx)(ey,{in:u,children:(0,G.jsx)(Wm,{variant:`outlined`,sx:{p:1.5,mb:2},children:(0,G.jsx)(Rv,{container:!0,spacing:0,children:c4.map(e=>{let t=o4[e];return(0,G.jsx)(Rv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{size:`small`,checked:c.has(e),onChange:()=>f(e),sx:{color:t,"&.Mui-checked":{color:t}}}),label:(0,G.jsx)(Q,{variant:`caption`,children:n(s4[e])})})},e)})})})}),m.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Rv,{container:!0,spacing:1,sx:{mb:2},children:m.map(e=>(0,G.jsx)(uJe,{bridge:e},e.bridgeId))}),(0,G.jsx)(Wb,{sx:{mb:2}})]}),(0,G.jsx)(Z,{sx:{maxHeight:400,overflow:`auto`,bgcolor:`background.default`,borderRadius:1,p:1},children:p.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:4},children:i.length===0?`Waiting for diagnostic events…`:n(`diagnostics.noEvents`)}):p.map(e=>{let t=o4[e.type];return(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,py:.4,px:.5,minWidth:0,borderBottom:`1px solid`,borderColor:`divider`,"&:hover":{bgcolor:`action.hover`},"&:last-child":{borderBottom:`none`}},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.secondary`,whiteSpace:`nowrap`,fontFamily:`monospace`,fontSize:`0.72rem`,minWidth:85,pt:.1},children:cJe(e.timestamp)}),(0,G.jsx)(kv,{label:s4[e.type]?n(s4[e.type]):e.type,size:`small`,sx:{bgcolor:t??`#757575`,color:a4(t??`#757575`),fontSize:`0.62rem`,fontWeight:600,height:18,minWidth:90}}),e.bridgeName&&(0,G.jsxs)(Q,{variant:`caption`,sx:{color:`primary.main`,fontWeight:600,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:140,flexShrink:0},children:[`[`,e.bridgeName,`]`]}),e.entityId&&(0,G.jsx)(Q,{variant:`caption`,sx:{color:`warning.main`,fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:220,flexShrink:1},children:e.entityId}),(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.primary`,flex:1,wordBreak:`break-word`,fontSize:`0.72rem`},children:e.message})]},e.id)})})]})})}function uJe({bridge:e}){let[t,n]=(0,C.useState)(!1);return(0,G.jsx)(Rv,{size:{xs:12,sm:6},children:(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:1.5,overflow:`hidden`,minWidth:0},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,sx:{cursor:`pointer`},onClick:()=>n(e=>!e),children:[(0,G.jsxs)(Z,{sx:{minWidth:0,overflow:`hidden`},children:[(0,G.jsx)(Q,{variant:`body2`,fontWeight:500,noWrap:!0,children:e.bridgeName}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,noWrap:!0,children:[e.entityCount,` devices · `,e.sessionCount,` sessions`]})]}),(0,G.jsxs)(Gv,{direction:`row`,spacing:.5,alignItems:`center`,flexWrap:`wrap`,justifyContent:`flex-end`,sx:{flexShrink:0,ml:1},children:[Object.entries(e.featureFlags).filter(([,e])=>e).map(([e])=>(0,G.jsx)(kv,{label:e.replace(/^auto/,``).replace(/([A-Z])/g,` $1`).trim(),size:`small`,variant:`outlined`,sx:{fontSize:`0.6rem`,height:18}},e)),(0,G.jsx)(kv,{label:e.status,size:`small`,color:e.status===`running`?`success`:e.status===`failed`?`error`:`default`,sx:{height:20}}),(0,G.jsx)(qS,{sx:{transform:t?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`,fontSize:18,color:`text.secondary`}})]})]}),(0,G.jsx)(ey,{in:t,children:(0,G.jsx)(Z,{sx:{mt:1,maxHeight:200,overflow:`auto`},children:e.entities.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`baseline`,gap:.5,py:.3,borderBottom:`1px solid`,borderColor:`divider`},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{fontFamily:`monospace`,fontSize:`0.68rem`,minWidth:180,flexShrink:0,color:e.available?`text.primary`:`error.main`},noWrap:!0,children:e.entityId}),(0,G.jsx)(Z,{display:`flex`,gap:.3,flexWrap:`wrap`,children:e.matterClusters.map(e=>(0,G.jsx)(kv,{label:e,size:`small`,variant:`outlined`,sx:{fontSize:`0.58rem`,height:16,"& .MuiChip-label":{px:.5}}},e))})]},e.entityId))})})]})})}var dJe=()=>{let[e,t]=(0,C.useState)(`name`),[n,r]=(0,C.useState)(`asc`);return(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:3},children:[(0,G.jsx)(nJe,{sortField:e,sortDirection:n,onSortFieldChange:t,onSortDirectionChange:r}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(lJe,{sortField:e,sortDirection:n})}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(rJe,{})}),(0,G.jsx)(Z,{sx:{px:2,pb:2},children:(0,G.jsx)(oJe,{})}),(0,G.jsx)(Wb,{}),(0,G.jsx)(aJe,{})]})};async function fJe(){let e=await fetch(`api/matter/labels?_s=${Date.now()}`);return await I_(e,`Failed to fetch labels`),F_(e)}async function pJe(){let e=await fetch(`api/matter/areas?_s=${Date.now()}`);return await I_(e,`Failed to fetch areas`),F_(e)}async function mJe(){let e=await fetch(`api/matter/filter-values?_s=${Date.now()}`);return await I_(e,`Failed to fetch filter values`),F_(e)}var l4=({values:e,copiedId:t,onCopy:n,searchable:r})=>{let[i,a]=(0,C.useState)(``),o=(0,C.useMemo)(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,i]);return e.length===0?(0,G.jsx)(Z,{sx:{p:2,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`No values found.`})}):(0,G.jsxs)(Z,{children:[r&&e.length>10&&(0,G.jsx)(Z,{sx:{px:2,pt:1,pb:.5},children:(0,G.jsx)(SS,{size:`small`,fullWidth:!0,placeholder:`Search...`,value:i,onChange:e=>a(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(eF,{position:`start`,children:(0,G.jsx)(lE,{fontSize:`small`})})}}})}),(0,G.jsxs)(Z,{sx:{p:1.5,display:`flex`,flexWrap:`wrap`,gap:.75},children:[o.map(e=>(0,G.jsx)(kv,{label:e,size:`small`,variant:t===e?`filled`:`outlined`,color:t===e?`success`:`default`,onClick:()=>n(e),sx:{fontFamily:`monospace`,fontSize:`0.8rem`}},e)),i&&o.length===0&&(0,G.jsxs)(Q,{color:`text.secondary`,variant:`body2`,sx:{p:1},children:[`No matches for "`,i,`"`]})]})]})},hJe=()=>{let{t:e}=ms(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)([]),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(null),p=(0,C.useCallback)(async()=>{c(!0);try{let[e,t,r]=await Promise.all([fJe(),pJe(),mJe()]);n(e),i(t),o(r),u(null)}catch(t){u(t instanceof Error?t.message:e(`labels.loadFailed`))}finally{c(!1)}},[e]);(0,C.useEffect)(()=>{p()},[p]);let m=e=>{navigator.clipboard.writeText(e),f(e),setTimeout(()=>f(null),2e3)};return s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,sx:{mb:3},children:[(0,G.jsx)(vb,{sx:{mr:1,verticalAlign:`middle`}}),e(`labels.title`)]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:e(`labels.info`)}),l&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:l}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)($T,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.labelsSection`),` (`,t.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.labelsHint`)}),(0,G.jsx)(vv,{sx:{mb:4},children:t.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noLabels`)})}):(0,G.jsx)(lC,{children:(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.labelId`)}),(0,G.jsx)(cC,{width:48})]})}),(0,G.jsx)(sC,{children:t.map(t=>(0,G.jsxs)(mC,{hover:!0,children:[(0,G.jsxs)(cC,{children:[t.color&&(0,G.jsx)(Z,{component:`span`,sx:{display:`inline-block`,width:12,height:12,borderRadius:`50%`,backgroundColor:t.color,mr:1,verticalAlign:`middle`}}),t.name]}),(0,G.jsx)(cC,{children:(0,G.jsx)(`code`,{children:t.label_id})}),(0,G.jsx)(cC,{children:(0,G.jsx)(fb,{title:d===t.label_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.label_id),children:(0,G.jsx)(mb,{fontSize:`small`})})})})]},t.label_id))})]})})}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)(yT,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.areasSection`),` (`,r.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.areasHint`)}),(0,G.jsx)(vv,{sx:{mb:4},children:r.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noAreas`)})}):(0,G.jsx)(lC,{children:(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.areaId`)}),(0,G.jsx)(cC,{width:48})]})}),(0,G.jsx)(sC,{children:r.map(t=>(0,G.jsxs)(mC,{hover:!0,children:[(0,G.jsx)(cC,{children:t.name}),(0,G.jsx)(cC,{children:(0,G.jsx)(`code`,{children:t.area_id})}),(0,G.jsx)(cC,{children:(0,G.jsx)(fb,{title:d===t.area_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.area_id),children:(0,G.jsx)(mb,{fontSize:`small`})})})})]},t.area_id))})]})})}),a&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:e(`labels.otherFilterValues`)}),(0,G.jsxs)(QS,{defaultExpanded:!0,children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)($he,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.domains`),` (`,a.domains.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.domainsHint`)}),(0,G.jsx)(l4,{values:a.domains,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(YT,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.platforms`),` (`,a.platforms.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.platformsHint`)}),(0,G.jsx)(l4,{values:a.platforms,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(WT,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.entityCategories`),` (`,a.entityCategories.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.entityCategoriesHint`)}),(0,G.jsx)(l4,{values:a.entityCategories,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(WT,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceClasses`),` (`,a.deviceClasses.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceClassesHint`)}),(0,G.jsx)(l4,{values:a.deviceClasses,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(hb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceNames`),` (`,a.deviceNames.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceNamesHint`)}),(0,G.jsx)(l4,{values:a.deviceNames,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(hb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.productNames`),` (`,a.productNames.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.productNamesHint`)}),(0,G.jsx)(l4,{values:a.productNames,copiedId:d,onCopy:m,searchable:!0})]})]})]})]})};async function gJe(){let e=await fetch(`api/lock-credentials`);return await I_(e,`Failed to fetch lock credentials`),F_(e)}async function _Je(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return await I_(n,`Failed to update lock credential`),F_(n)}async function vJe(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}/enabled`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:t})});return await I_(n,`Failed to toggle credential`),F_(n)}async function yJe(e){await I_(await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete lock credential`)}var bJe=({open:e,onClose:t,onSave:n,initialEntityId:r=``,initialName:i=``,isEdit:a=!1})=>{let{t:o}=ms(),[s,c]=(0,C.useState)(r),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(i),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{e&&(c(r),f(i),u(``),m(``))},[e,r,i]),(0,G.jsxs)(zb,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Hb,{children:o(a?`lockCredentials.editCredential`:`lockCredentials.addCredential`)}),(0,G.jsx)(Vb,{children:(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,mt:1},children:[p&&(0,G.jsx)(Uh,{severity:`error`,children:p}),(0,G.jsx)(SS,{label:o(`lockCredentials.lockEntityId`),placeholder:`lock.front_door`,value:s,onChange:e=>c(e.target.value),disabled:a,fullWidth:!0,helperText:o(`lockCredentials.lockEntityHelperText`)}),(0,G.jsx)(SS,{label:o(`lockCredentials.pinCode`),type:`password`,placeholder:`1234`,value:l,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,8)),fullWidth:!0,helperText:`4-8 digit PIN code for this lock`,inputProps:{inputMode:`numeric`,pattern:`[0-9]*`}}),(0,G.jsx)(SS,{label:o(`lockCredentials.nameOptional`),placeholder:o(`lockCredentials.namePlaceholder`),value:d,onChange:e=>f(e.target.value),fullWidth:!0,helperText:o(`lockCredentials.nameHelperText`)})]})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:t,disabled:h,children:o(`common.cancel`)}),(0,G.jsx)(_v,{onClick:async()=>{if(!s.trim()){m(o(`lockCredentials.entityRequired`));return}if(!l||l.length<4||l.length>8){m(o(`lockCredentials.pinLength`));return}if(!/^\d+$/.test(l)){m(o(`lockCredentials.pinDigitsOnly`));return}g(!0);try{await n(s.trim(),l,d.trim()),t()}catch(e){m(e instanceof Error?e.message:o(`lockCredentials.saveFailed`))}finally{g(!1)}},variant:`contained`,disabled:h,startIcon:h?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(cE,{}),children:o(`common.save`)})]})]})},xJe=()=>{let{t:e}=ms(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(!0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(null),d=(0,C.useCallback)(async()=>{i(!0);try{n((await gJe()).credentials),o(null)}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.loadFailed`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{d()},[d]);let f=async(e,t,n)=>{await _Je(e,{entityId:e,pinCode:t,name:n||void 0,enabled:!0}),await d()},[p,m]=(0,C.useState)(null),h=async t=>{m(null);try{await yJe(t),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.deleteFailed`))}},g=async t=>{try{await vJe(t.entityId,!t.enabled),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.updateFailed`))}},_=e=>{u(e),c(!0)},v=()=>{u(null),c(!0)};return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:3},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,children:[(0,G.jsx)(vT,{sx:{mr:1,verticalAlign:`middle`}}),e(`lockCredentials.title`)]}),(0,G.jsx)(_v,{variant:`contained`,startIcon:(0,G.jsx)(pb,{}),onClick:v,children:e(`lockCredentials.addCredential`)})]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:`Configure PIN codes for locks that require authentication for remote lock/unlock operations. The PIN will be sent with lock/unlock commands to Matter locks.`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:a}),r?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):t.length===0?(0,G.jsx)(vv,{children:(0,G.jsxs)(xv,{sx:{textAlign:`center`,py:4},children:[(0,G.jsx)(vT,{sx:{fontSize:48,color:`text.secondary`,mb:2}}),(0,G.jsx)(Q,{variant:`h6`,color:`text.secondary`,children:`No lock credentials configured`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:`Add a PIN code for your Matter locks to enable remote lock/unlock`}),(0,G.jsx)(_v,{variant:`outlined`,startIcon:(0,G.jsx)(pb,{}),onClick:v,children:`Add Your First Credential`})]})}):(0,G.jsx)(vv,{children:(0,G.jsx)(ny,{children:t.map((n,r)=>(0,G.jsxs)(ay,{divider:r<t.length-1,onClick:()=>_(n),sx:{cursor:`pointer`,"&:hover":{bgcolor:`action.hover`}},children:[(0,G.jsx)(sy,{children:(0,G.jsx)(vT,{color:n.enabled?`primary`:`disabled`})}),(0,G.jsx)(ly,{primary:n.name||n.entityId,secondary:(0,G.jsxs)(G.Fragment,{children:[n.name&&(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,children:n.entityId}),(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,sx:{ml:n.name?2:0},children:`PIN: ****`})]})}),(0,G.jsxs)(iy,{children:[(0,G.jsx)(fb,{title:n.enabled?e(`lockCredentials.disable`):e(`lockCredentials.enable`),children:(0,G.jsx)(US,{edge:`end`,checked:n.enabled,onChange:e=>{e.stopPropagation(),g(n)}})}),(0,G.jsx)(fb,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{edge:`end`,onClick:e=>{e.stopPropagation(),m(n.entityId)},sx:{ml:1},children:(0,G.jsx)(NS,{})})})]})]},n.entityId))})}),(0,G.jsx)(bJe,{open:s,onClose:()=>c(!1),onSave:f,initialEntityId:l?.entityId,initialName:l?.name,isEdit:!!l}),(0,G.jsx)(PT,{open:p!==null,title:e(`lockCredentials.confirmDeleteTitle`),message:e(`lockCredentials.confirmDeleteMessage`,{entity:p??``}),confirmLabel:e(`common.delete`),confirmColor:`error`,onConfirm:()=>{p&&h(p)},onCancel:()=>m(null)})]})},SJe=()=>{let e=Sr(),{t}=ms();return(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(Ghe,{color:`disabled`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:t(`notFound.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`notFound.description`)}),(0,G.jsx)(_v,{variant:`contained`,startIcon:(0,G.jsx)(ZT,{}),onClick:()=>e(Y9.dashboard),children:t(`notFound.backToDashboard`)})]})};function u4(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=u4(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var CJe={value:()=>{}};function d4(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new f4(n)}function f4(e){this._=e}function wJe(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}f4.prototype=d4.prototype={constructor:f4,on:function(e,t){var n=this._,r=wJe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=TJe(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=p4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=p4(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new f4(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function TJe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function p4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=CJe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var m4={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function h4(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),m4.hasOwnProperty(t)?{space:m4[t],local:e}:e}function EJe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function DJe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function g4(e){var t=h4(e);return(t.local?DJe:EJe)(t)}function OJe(){}function _4(e){return e==null?OJe:function(){return this.querySelector(e)}}function kJe(e){typeof e!=`function`&&(e=_4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new M4(r,this._parents)}function AJe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function jJe(){return[]}function v4(e){return e==null?jJe:function(){return this.querySelectorAll(e)}}function MJe(e){return function(){return AJe(e.apply(this,arguments))}}function NJe(e){e=typeof e==`function`?MJe(e):v4(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new M4(r,i)}function y4(e){return function(){return this.matches(e)}}function b4(e){return function(t){return t.matches(e)}}var PJe=Array.prototype.find;function FJe(e){return function(){return PJe.call(this.children,e)}}function IJe(){return this.firstElementChild}function LJe(e){return this.select(e==null?IJe:FJe(typeof e==`function`?e:b4(e)))}var RJe=Array.prototype.filter;function zJe(){return Array.from(this.children)}function BJe(e){return function(){return RJe.call(this.children,e)}}function VJe(e){return this.selectAll(e==null?zJe:BJe(typeof e==`function`?e:b4(e)))}function HJe(e){typeof e!=`function`&&(e=y4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new M4(r,this._parents)}function x4(e){return Array(e.length)}function UJe(){return new M4(this._enter||this._groups.map(x4),this._parents)}function S4(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}S4.prototype={constructor:S4,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function WJe(e){return function(){return e}}function GJe(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new S4(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function KJe(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new S4(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function qJe(e){return e.__data__}function JJe(e,t){if(!arguments.length)return Array.from(this,qJe);var n=t?KJe:GJe,r=this._parents,i=this._groups;typeof e!=`function`&&(e=WJe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=YJe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new M4(o,r),o._enter=s,o._exit=c,o}function YJe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function XJe(){return new M4(this._exit||this._groups.map(x4),this._parents)}function ZJe(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function QJe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new M4(s,this._parents)}function $Je(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function eYe(e){e||=tYe;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new M4(i,this._parents).order()}function tYe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nYe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rYe(){return Array.from(this)}function iYe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function aYe(){let e=0;for(let t of this)++e;return e}function oYe(){return!this.node()}function sYe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function cYe(e){return function(){this.removeAttribute(e)}}function lYe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uYe(e,t){return function(){this.setAttribute(e,t)}}function dYe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function pYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function mYe(e,t){var n=h4(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?lYe:cYe:typeof t==`function`?n.local?pYe:fYe:n.local?dYe:uYe)(n,t))}function C4(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hYe(e){return function(){this.style.removeProperty(e)}}function gYe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function _Ye(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function vYe(e,t,n){return arguments.length>1?this.each((t==null?hYe:typeof t==`function`?_Ye:gYe)(e,t,n??``)):w4(this.node(),e)}function w4(e,t){return e.style.getPropertyValue(t)||C4(e).getComputedStyle(e,null).getPropertyValue(t)}function yYe(e){return function(){delete this[e]}}function bYe(e,t){return function(){this[e]=t}}function xYe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function SYe(e,t){return arguments.length>1?this.each((t==null?yYe:typeof t==`function`?xYe:bYe)(e,t)):this.node()[e]}function T4(e){return e.trim().split(/^|\s+/)}function E4(e){return e.classList||new D4(e)}function D4(e){this._node=e,this._names=T4(e.getAttribute(`class`)||``)}D4.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function O4(e,t){for(var n=E4(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function k4(e,t){for(var n=E4(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function CYe(e){return function(){O4(this,e)}}function wYe(e){return function(){k4(this,e)}}function TYe(e,t){return function(){(t.apply(this,arguments)?O4:k4)(this,e)}}function EYe(e,t){var n=T4(e+``);if(arguments.length<2){for(var r=E4(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?TYe:t?CYe:wYe)(n,t))}function DYe(){this.textContent=``}function OYe(e){return function(){this.textContent=e}}function kYe(e){return function(){this.textContent=e.apply(this,arguments)??``}}function AYe(e){return arguments.length?this.each(e==null?DYe:(typeof e==`function`?kYe:OYe)(e)):this.node().textContent}function jYe(){this.innerHTML=``}function MYe(e){return function(){this.innerHTML=e}}function NYe(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function PYe(e){return arguments.length?this.each(e==null?jYe:(typeof e==`function`?NYe:MYe)(e)):this.node().innerHTML}function FYe(){this.nextSibling&&this.parentNode.appendChild(this)}function IYe(){return this.each(FYe)}function LYe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function RYe(){return this.each(LYe)}function zYe(e){var t=typeof e==`function`?e:g4(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function BYe(){return null}function VYe(e,t){var n=typeof e==`function`?e:g4(e),r=t==null?BYe:typeof t==`function`?t:_4(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function HYe(){var e=this.parentNode;e&&e.removeChild(this)}function UYe(){return this.each(HYe)}function WYe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function GYe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function KYe(e){return this.select(e?GYe:WYe)}function qYe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function JYe(e){return function(t){e.call(this,t,this.__data__)}}function YYe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function XYe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ZYe(e,t,n){return function(){var r=this.__on,i,a=JYe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function QYe(e,t,n){var r=YYe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ZYe:XYe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function A4(e,t,n){var r=C4(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function $Ye(e,t){return function(){return A4(this,e,t)}}function eXe(e,t){return function(){return A4(this,e,t.apply(this,arguments))}}function tXe(e,t){return this.each((typeof t==`function`?eXe:$Ye)(e,t))}function*nXe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var j4=[null];function M4(e,t){this._groups=e,this._parents=t}function N4(){return new M4([[document.documentElement]],j4)}function rXe(){return this}M4.prototype=N4.prototype={constructor:M4,select:kJe,selectAll:NJe,selectChild:LJe,selectChildren:VJe,filter:HJe,data:JJe,enter:UJe,exit:XJe,join:ZJe,merge:QJe,selection:rXe,order:$Je,sort:eYe,call:nYe,nodes:rYe,node:iYe,size:aYe,empty:oYe,each:sYe,attr:mYe,style:vYe,property:SYe,classed:EYe,text:AYe,html:PYe,raise:IYe,lower:RYe,append:zYe,insert:VYe,remove:UYe,clone:KYe,datum:qYe,on:QYe,dispatch:tXe,[Symbol.iterator]:nXe};function P4(e){return typeof e==`string`?new M4([[document.querySelector(e)]],[document.documentElement]):new M4([[e]],j4)}function iXe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function F4(e,t){if(e=iXe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var aXe={passive:!1},I4={capture:!0,passive:!1};function L4(e){e.stopImmediatePropagation()}function R4(e){e.preventDefault(),e.stopImmediatePropagation()}function z4(e){var t=e.document.documentElement,n=P4(e).on(`dragstart.drag`,R4,I4);`onselectstart`in t?n.on(`selectstart.drag`,R4,I4):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function B4(e,t){var n=e.document.documentElement,r=P4(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,R4,I4),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var V4=e=>()=>e;function H4(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}H4.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function oXe(e){return!e.ctrlKey&&!e.button}function sXe(){return this.parentNode}function cXe(e,t){return t??{x:e.x,y:e.y}}function lXe(){return navigator.maxTouchPoints||`ontouchstart`in this}function U4(){var e=oXe,t=sXe,n=cXe,r=lXe,i={},a=d4(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,aXe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(P4(n.view).on(`mousemove.drag`,m,I4).on(`mouseup.drag`,h,I4),z4(n.view),L4(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(R4(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){P4(e.view).on(`mousemove.drag mouseup.drag`,null),B4(e.view,l),R4(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(L4(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(R4(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(L4(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=F4(l||r,t),p,m,h;if((h=n.call(e,new H4(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=F4(l||a,t),_=o;break}u.call(r,e,new H4(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:V4(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:V4(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:V4(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:V4(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function W4(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function G4(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function K4(){}var q4=.7,J4=1/q4,Y4=`\\s*([+-]?\\d+)\\s*`,X4=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Z4=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,uXe=/^#([0-9a-f]{3,8})$/,dXe=RegExp(`^rgb\\(${Y4},${Y4},${Y4}\\)$`),fXe=RegExp(`^rgb\\(${Z4},${Z4},${Z4}\\)$`),pXe=RegExp(`^rgba\\(${Y4},${Y4},${Y4},${X4}\\)$`),mXe=RegExp(`^rgba\\(${Z4},${Z4},${Z4},${X4}\\)$`),hXe=RegExp(`^hsl\\(${X4},${Z4},${Z4}\\)$`),gXe=RegExp(`^hsla\\(${X4},${Z4},${Z4},${X4}\\)$`),Q4={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};W4(K4,t3,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$4,formatHex:$4,formatHex8:_Xe,formatHsl:vXe,formatRgb:e3,toString:e3});function $4(){return this.rgb().formatHex()}function _Xe(){return this.rgb().formatHex8()}function vXe(){return f3(this).formatHsl()}function e3(){return this.rgb().formatRgb()}function t3(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=uXe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?n3(t):n===3?new a3(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?r3(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?r3(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dXe.exec(e))?new a3(t[1],t[2],t[3],1):(t=fXe.exec(e))?new a3(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pXe.exec(e))?r3(t[1],t[2],t[3],t[4]):(t=mXe.exec(e))?r3(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hXe.exec(e))?d3(t[1],t[2]/100,t[3]/100,1):(t=gXe.exec(e))?d3(t[1],t[2]/100,t[3]/100,t[4]):Q4.hasOwnProperty(e)?n3(Q4[e]):e===`transparent`?new a3(NaN,NaN,NaN,0):null}function n3(e){return new a3(e>>16&255,e>>8&255,e&255,1)}function r3(e,t,n,r){return r<=0&&(e=t=n=NaN),new a3(e,t,n,r)}function yXe(e){return e instanceof K4||(e=t3(e)),e?(e=e.rgb(),new a3(e.r,e.g,e.b,e.opacity)):new a3}function i3(e,t,n,r){return arguments.length===1?yXe(e):new a3(e,t,n,r??1)}function a3(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}W4(a3,i3,G4(K4,{brighter(e){return e=e==null?J4:J4**+e,new a3(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?q4:q4**+e,new a3(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new a3(l3(this.r),l3(this.g),l3(this.b),c3(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:o3,formatHex:o3,formatHex8:bXe,formatRgb:s3,toString:s3}));function o3(){return`#${u3(this.r)}${u3(this.g)}${u3(this.b)}`}function bXe(){return`#${u3(this.r)}${u3(this.g)}${u3(this.b)}${u3((isNaN(this.opacity)?1:this.opacity)*255)}`}function s3(){let e=c3(this.opacity);return`${e===1?`rgb(`:`rgba(`}${l3(this.r)}, ${l3(this.g)}, ${l3(this.b)}${e===1?`)`:`, ${e})`}`}function c3(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function l3(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function u3(e){return e=l3(e),(e<16?`0`:``)+e.toString(16)}function d3(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new p3(e,t,n,r)}function f3(e){if(e instanceof p3)return new p3(e.h,e.s,e.l,e.opacity);if(e instanceof K4||(e=t3(e)),!e)return new p3;if(e instanceof p3)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new p3(o,s,c,e.opacity)}function xXe(e,t,n,r){return arguments.length===1?f3(e):new p3(e,t,n,r??1)}function p3(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}W4(p3,xXe,G4(K4,{brighter(e){return e=e==null?J4:J4**+e,new p3(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?q4:q4**+e,new p3(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new a3(g3(e>=240?e-240:e+120,i,r),g3(e,i,r),g3(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new p3(m3(this.h),h3(this.s),h3(this.l),c3(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=c3(this.opacity);return`${e===1?`hsl(`:`hsla(`}${m3(this.h)}, ${h3(this.s)*100}%, ${h3(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function m3(e){return e=(e||0)%360,e<0?e+360:e}function h3(e){return Math.max(0,Math.min(1,e||0))}function g3(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var _3=e=>()=>e;function SXe(e,t){return function(n){return e+n*t}}function CXe(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function wXe(e){return(e=+e)==1?v3:function(t,n){return n-t?CXe(t,n,e):_3(isNaN(t)?n:t)}}function v3(e,t){var n=t-e;return n?SXe(e,n):_3(isNaN(e)?t:e)}var y3=(function e(t){var n=wXe(t);function r(e,t){var r=n((e=i3(e)).r,(t=i3(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=v3(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function TXe(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function EXe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function DXe(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=w3(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function OXe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function b3(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function kXe(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=w3(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var x3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,S3=new RegExp(x3.source,`g`);function AXe(e){return function(){return e}}function jXe(e){return function(t){return e(t)+``}}function C3(e,t){var n=x3.lastIndex=S3.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=x3.exec(e))&&(i=S3.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:b3(r,i)})),n=S3.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?jXe(c[0].x):AXe(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function w3(e,t){var n=typeof t,r;return t==null||n===`boolean`?_3(t):(n===`number`?b3:n===`string`?(r=t3(t))?(t=r,y3):C3:t instanceof t3?y3:t instanceof Date?OXe:EXe(t)?TXe:Array.isArray(t)?DXe:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?kXe:b3)(e,t)}var T3=180/Math.PI,E3={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function D3(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*T3,skewX:Math.atan(c)*T3,scaleX:o,scaleY:s}}var O3;function MXe(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?E3:D3(t.a,t.b,t.c,t.d,t.e,t.f)}function NXe(e){return e==null||(O3||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),O3.setAttribute(`transform`,e),!(e=O3.transform.baseVal.consolidate()))?E3:(e=e.matrix,D3(e.a,e.b,e.c,e.d,e.e,e.f))}function k3(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:b3(e,i)},{i:c-2,x:b3(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:b3(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:b3(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:b3(e,n)},{i:s-2,x:b3(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var PXe=k3(MXe,`px, `,`px)`,`deg)`),FXe=k3(NXe,`, `,`)`,`)`),IXe=1e-12;function A3(e){return((e=Math.exp(e))+1/e)/2}function LXe(e){return((e=Math.exp(e))-1/e)/2}function RXe(e){return((e=Math.exp(2*e))-1)/(e+1)}var j3=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<IXe)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=A3(y),c=s/(n*g)*(i*RXe(t*r+y)-LXe(y));return[a+c*d,o+c*f,s*i/A3(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),M3=0,N3=0,P3=0,F3=1e3,I3,L3,R3=0,z3=0,B3=0,V3=typeof performance==`object`&&performance.now?performance:Date,H3=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function U3(){return z3||=(H3(zXe),V3.now()+B3)}function zXe(){z3=0}function W3(){this._call=this._time=this._next=null}W3.prototype=G3.prototype={constructor:W3,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?U3():+n)+(t==null?0:+t),!this._next&&L3!==this&&(L3?L3._next=this:I3=this,L3=this),this._call=e,this._time=n,q3()},stop:function(){this._call&&(this._call=null,this._time=1/0,q3())}};function G3(e,t,n){var r=new W3;return r.restart(e,t,n),r}function BXe(){U3(),++M3;for(var e=I3,t;e;)(t=z3-e._time)>=0&&e._call.call(void 0,t),e=e._next;--M3}function K3(){z3=(R3=V3.now())+B3,M3=N3=0;try{BXe()}finally{M3=0,HXe(),z3=0}}function VXe(){var e=V3.now(),t=e-R3;t>F3&&(B3-=t,R3=e)}function HXe(){for(var e,t=I3,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:I3=n);L3=e,q3(r)}function q3(e){M3||(N3&&=clearTimeout(N3),e-z3>24?(e<1/0&&(N3=setTimeout(K3,e-V3.now()-B3)),P3&&=clearInterval(P3)):(P3||=(R3=V3.now(),setInterval(VXe,F3)),M3=1,H3(K3)))}function J3(e,t,n){var r=new W3;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var UXe=d4(`start`,`end`,`cancel`,`interrupt`),WXe=[];function Y3(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;GXe(e,n,{name:t,index:r,group:i,on:UXe,tween:WXe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function X3(e,t){var n=Q3(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Z3(e,t){var n=Q3(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Q3(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function GXe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=G3(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return J3(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(J3(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function $3(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function KXe(e){return this.each(function(){$3(this,e)})}function qXe(e,t){var n,r;return function(){var i=Z3(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function JXe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Z3(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function YXe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=Q3(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?qXe:JXe)(n,e,t))}function e6(e,t,n){var r=e._id;return e.each(function(){var e=Z3(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return Q3(e,r).value[t]}}function t6(e,t){var n;return(typeof t==`number`?b3:t instanceof t3?y3:(n=t3(t))?(t=n,y3):C3)(e,t)}function XXe(e){return function(){this.removeAttribute(e)}}function ZXe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function QXe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function $Xe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function eZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function tZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function nZe(e,t){var n=h4(e),r=n===`transform`?FXe:t6;return this.attrTween(e,typeof t==`function`?(n.local?tZe:eZe)(n,r,e6(this,`attr.`+e,t)):t==null?(n.local?ZXe:XXe)(n):(n.local?$Xe:QXe)(n,r,t))}function rZe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function iZe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function aZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&iZe(e,i)),n}return i._value=t,i}function oZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&rZe(e,i)),n}return i._value=t,i}function sZe(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=h4(e);return this.tween(n,(r.local?aZe:oZe)(r,t))}function cZe(e,t){return function(){X3(this,e).delay=+t.apply(this,arguments)}}function lZe(e,t){return t=+t,function(){X3(this,e).delay=t}}function uZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?cZe:lZe)(t,e)):Q3(this.node(),t).delay}function dZe(e,t){return function(){Z3(this,e).duration=+t.apply(this,arguments)}}function fZe(e,t){return t=+t,function(){Z3(this,e).duration=t}}function pZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?dZe:fZe)(t,e)):Q3(this.node(),t).duration}function mZe(e,t){if(typeof t!=`function`)throw Error();return function(){Z3(this,e).ease=t}}function hZe(e){var t=this._id;return arguments.length?this.each(mZe(t,e)):Q3(this.node(),t).ease}function gZe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Z3(this,e).ease=n}}function _Ze(e){if(typeof e!=`function`)throw Error();return this.each(gZe(this._id,e))}function vZe(e){typeof e!=`function`&&(e=y4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new r6(r,this._parents,this._name,this._id)}function yZe(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new r6(o,this._parents,this._name,this._id)}function bZe(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function xZe(e,t,n){var r,i,a=bZe(t)?X3:Z3;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function SZe(e,t){var n=this._id;return arguments.length<2?Q3(this.node(),n).on.on(e):this.each(xZe(n,e,t))}function CZe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function wZe(){return this.on(`end.remove`,CZe(this._id))}function TZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=_4(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Y3(l[f],t,n,f,l,Q3(u,n)));return new r6(a,this._parents,t,n)}function EZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=v4(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=Q3(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Y3(p,t,n,h,f,m);a.push(f),o.push(u)}return new r6(a,o,t,n)}var DZe=N4.prototype.constructor;function OZe(){return new DZe(this._groups,this._parents)}function kZe(e,t){var n,r,i;return function(){var a=w4(this,e),o=(this.style.removeProperty(e),w4(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function n6(e){return function(){this.style.removeProperty(e)}}function AZe(e,t,n){var r,i=n+``,a;return function(){var o=w4(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function jZe(e,t,n){var r,i,a;return function(){var o=w4(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),w4(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function MZe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Z3(this,e),l=c.on,u=c.value[a]==null?s||=n6(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function NZe(e,t,n){var r=(e+=``)==`transform`?PXe:t6;return t==null?this.styleTween(e,kZe(e,r)).on(`end.style.`+e,n6(e)):typeof t==`function`?this.styleTween(e,jZe(e,r,e6(this,`style.`+e,t))).each(MZe(this._id,e)):this.styleTween(e,AZe(e,r,t),n).on(`end.style.`+e,null)}function PZe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function FZe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&PZe(e,a,n)),r}return a._value=t,a}function IZe(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,FZe(e,t,n??``))}function LZe(e){return function(){this.textContent=e}}function RZe(e){return function(){this.textContent=e(this)??``}}function zZe(e){return this.tween(`text`,typeof e==`function`?RZe(e6(this,`text`,e)):LZe(e==null?``:e+``))}function BZe(e){return function(t){this.textContent=e.call(this,t)}}function VZe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&BZe(r)),t}return r._value=e,r}function HZe(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,VZe(e))}function UZe(){for(var e=this._name,t=this._id,n=i6(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=Q3(c,t);Y3(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new r6(r,this._parents,e,n)}function WZe(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=Z3(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var GZe=0;function r6(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function KZe(e){return N4().transition(e)}function i6(){return++GZe}var a6=N4.prototype;r6.prototype=KZe.prototype={constructor:r6,select:TZe,selectAll:EZe,selectChild:a6.selectChild,selectChildren:a6.selectChildren,filter:vZe,merge:yZe,selection:OZe,transition:UZe,call:a6.call,nodes:a6.nodes,node:a6.node,size:a6.size,empty:a6.empty,each:a6.each,on:SZe,attr:nZe,attrTween:sZe,style:NZe,styleTween:IZe,text:zZe,textTween:HZe,remove:wZe,tween:YXe,delay:uZe,duration:pZe,ease:hZe,easeVarying:_Ze,end:WZe,[Symbol.iterator]:a6[Symbol.iterator]};function qZe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var JZe={time:null,delay:0,duration:250,ease:qZe};function YZe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function XZe(e){var t,n;e instanceof r6?(t=e._id,e=e._name):(t=i6(),(n=JZe).time=U3(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Y3(c,e,t,l,o,n||YZe(c,t));return new r6(r,this._parents,e,t)}N4.prototype.interrupt=KXe,N4.prototype.transition=XZe;var o6=e=>()=>e;function ZZe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function s6(e,t,n){this.k=e,this.x=t,this.y=n}s6.prototype={constructor:s6,scale:function(e){return e===1?this:new s6(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new s6(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var c6=new s6(1,0,0);l6.prototype=s6.prototype;function l6(e){for(;!e.__zoom;)if(!(e=e.parentNode))return c6;return e.__zoom}function u6(e){e.stopImmediatePropagation()}function d6(e){e.preventDefault(),e.stopImmediatePropagation()}function QZe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function $Ze(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function f6(){return this.__zoom||c6}function eQe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tQe(){return navigator.maxTouchPoints||`ontouchstart`in this}function nQe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function p6(){var e=QZe,t=$Ze,n=nQe,r=eQe,i=tQe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=j3,l=d4(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,f6).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,f6),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(c6.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new s6(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new s6(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new s6(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=P4(this.that).datum();l.call(e,this.that,new ZZe(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=F4(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],$3(this),s.start();d6(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=P4(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=F4(t,i),l=t.clientX,u=t.clientY;z4(t.view),u6(t),a.mouse=[c,this.__zoom.invert(c)],$3(this),a.start();function d(e){if(d6(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=F4(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),B4(e.view,a.moved),d6(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=F4(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);d6(r),s>0?P4(this).transition().duration(s).call(x,d,c,r):P4(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(u6(t),s=0;s<i;++s)c=r[s],l=F4(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),$3(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(d6(e),s=0;s<a;++s)c=i[s],l=F4(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(u6(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=F4(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=P4(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:o6(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:o6(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:o6(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:o6([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var m6={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`},h6=[[-1/0,-1/0],[1/0,1/0]],g6=[`Enter`,` `,`Escape`],_6={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},v6;(function(e){e.Strict=`strict`,e.Loose=`loose`})(v6||={});var y6;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(y6||={});var b6;(function(e){e.Partial=`partial`,e.Full=`full`})(b6||={});var x6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},S6;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(S6||={});var C6;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(C6||={});var w6;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(w6||={});var T6={[w6.Left]:w6.Right,[w6.Right]:w6.Left,[w6.Top]:w6.Bottom,[w6.Bottom]:w6.Top};function E6(e){return e===null?null:e?`valid`:`invalid`}var D6=e=>`id`in e&&`source`in e&&`target`in e,rQe=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),O6=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),k6=(e,t=[0,0])=>{let{width:n,height:r}=e8(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},iQe=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:B6(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):O6(n)?n:t.nodeLookup.get(n.id)),R6(e,i?H6(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),A6=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=R6(n,H6(e)),r=!0)}),r?B6(n):{x:0,y:0,width:0,height:0}},j6=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...J6(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=W6(s,V6(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},aQe=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function oQe(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function sQe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=Z6(A6(oQe(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function M6({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,m6.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&$6(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=$6(d)?P6(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,m6.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function cQe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=aQe(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var N6=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),P6=(e={x:0,y:0},t,n)=>({x:N6(e.x,t[0][0],t[1][0]-(n?.width??0)),y:N6(e.y,t[0][1],t[1][1]-(n?.height??0))});function F6(e,t,n){let{width:r,height:i}=e8(n),{x:a,y:o}=n.internals.positionAbsolute;return P6(e,[[a,o],[a+r,o+i]],t)}var I6=(e,t,n)=>e<t?N6(Math.abs(e-t),1,t)/t:e>n?-N6(Math.abs(e-n),1,t)/t:0,L6=(e,t,n=15,r=40)=>[I6(e.x,r,t.width-r)*n,I6(e.y,r,t.height-r)*n],R6=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),z6=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),B6=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),V6=(e,t=[0,0])=>{let{x:n,y:r}=O6(e)?e.internals.positionAbsolute:k6(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},H6=(e,t=[0,0])=>{let{x:n,y:r}=O6(e)?e.internals.positionAbsolute:k6(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},U6=(e,t)=>B6(R6(z6(e),z6(t))),W6=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},G6=e=>K6(e.width)&&K6(e.height)&&K6(e.x)&&K6(e.y),K6=e=>!isNaN(e)&&isFinite(e),lQe=(e,t)=>{},q6=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),J6=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?q6(s,o):s},Y6=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function X6(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function uQe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=X6(e,n),i=X6(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=X6(e.top??e.y??0,n),i=X6(e.bottom??e.y??0,n),a=X6(e.left??e.x??0,t),o=X6(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function dQe(e,t,n,r,i,a){let{x:o,y:s}=Y6(e,[t,n,r]),{x:c,y:l}=Y6({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Z6=(e,t,n,r,i,a)=>{let o=uQe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=N6(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=dQe(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Q6=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function $6(e){return e!=null&&e!==`parent`}function e8(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function t8(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function n8(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function r8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function fQe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function pQe(e){return{..._6,...e||{}}}function i8(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=l8(e),s=J6({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?q6(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var a8=e=>({width:e.offsetWidth,height:e.offsetHeight}),o8=e=>e?.getRootNode?.()||window?.document,mQe=[`INPUT`,`SELECT`,`TEXTAREA`];function s8(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?mQe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var c8=e=>`clientX`in e,l8=(e,t)=>{let n=c8(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},u8=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...a8(t)}})};function d8({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function f8(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function p8({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case w6.Left:return[t-f8(t-r,a),n];case w6.Right:return[t+f8(r-t,a),n];case w6.Top:return[t,n-f8(n-i,a)];case w6.Bottom:return[t,n+f8(i-n,a)]}}function m8({sourceX:e,sourceY:t,sourcePosition:n=w6.Bottom,targetX:r,targetY:i,targetPosition:a=w6.Top,curvature:o=.25}){let[s,c]=p8({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=p8({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=d8({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function h8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function hQe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function gQe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=R6(H6(e),H6(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),W6({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},B6(a))>0}var _Qe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,vQe=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),yQe=(e,t,n={})=>{if(!e.source||!e.target)return m6.error006(),t;let r=n.getEdgeId||_Qe,i;return i=D6(e)?{...e}:{...e,id:r(e)},vQe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function g8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=h8({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var _8={[w6.Left]:{x:-1,y:0},[w6.Right]:{x:1,y:0},[w6.Top]:{x:0,y:-1},[w6.Bottom]:{x:0,y:1}},bQe=({source:e,sourcePosition:t=w6.Bottom,target:n})=>t===w6.Left||t===w6.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},v8=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function xQe({source:e,sourcePosition:t=w6.Bottom,target:n,targetPosition:r=w6.Top,center:i,offset:a,stepPosition:o}){let s=_8[t],c=_8[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=bQe({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=h8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function SQe(e,t,n,r){let i=Math.min(v8(e,t)/2,v8(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function y8({sourceX:e,sourceY:t,sourcePosition:n=w6.Bottom,targetX:r,targetY:i,targetPosition:a=w6.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=xQe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=SQe(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function b8(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function CQe(e){let{sourceNode:t,targetNode:n}=e;if(!b8(t)||!b8(n))return null;let r=t.internals.handleBounds||x8(t.handles),i=n.internals.handleBounds||x8(n.handles),a=C8(r?.source??[],e.sourceHandle),o=C8(e.connectionMode===v6.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,m6.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||w6.Bottom,c=o?.position||w6.Top,l=S8(t,a,s),u=S8(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function x8(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function S8(e,t,n=w6.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??e8(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case w6.Top:return{x:i+o/2,y:a};case w6.Right:return{x:i+o,y:a+s/2};case w6.Bottom:return{x:i+o/2,y:a+s};case w6.Left:return{x:i,y:a+s/2}}}function C8(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function w8(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function wQe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=w8(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var T8=1e3,TQe=10,E8={nodeOrigin:[0,0],nodeExtent:h6,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},EQe={...E8,checkEquality:!0};function D8(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function DQe(e,t,n){let r=D8(E8,n);for(let n of e.values())if(n.parentId)A8(n,e,t,r);else{let e=P6(k6(n,r.nodeOrigin),$6(n.extent)?n.extent:r.nodeExtent,e8(n));n.internals.positionAbsolute=e}}function OQe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function O8(e){return e===`manual`}function k8(e,t,n,r={}){let i=D8(EQe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!O8(i.zIndexMode)?T8:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=P6(k6(u,i.nodeOrigin),$6(u.extent)?u.extent:i.nodeExtent,e8(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:OQe(u,e),z:j8(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&A8(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function kQe(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function A8(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=D8(E8,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}kQe(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*TQe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=AQe(e,u,o,s,a&&!O8(c)?T8:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function j8(e,t,n){let r=K6(e.zIndex)?e.zIndex:0;return O8(n)?r:r+(e.selected?t:0)}function AQe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=e8(e),l=k6(e,n),u=$6(e.extent)?P6(l,e.extent,c):l,d=P6({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=F6(d,c,t));let f=j8(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function M8(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=U6(a.get(n.parentId)?.expandedRect??V6(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=e8(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function jQe(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=a8(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=$6(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=F6(h,s,t.get(e.parentId)):m&&(h=P6(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:u8(`source`,r.nodeElement,p,d,e.id),target:u8(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&A8(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:V6(g,i)}))}}if(f.length>0){let e=M8(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function MQe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r),s=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(s)}function N8(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function P8(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;N8(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),N8(`target`,s,c,e,i,o),t.set(r.id,r)}}function F8(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:F8(n,t):!1}function I8(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function NQe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!F8(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function L8({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function PQe({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=q6(a,t);return{x:o.x-a.x,y:o.y-a.y}}function FQe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=P4(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?z6(A6(s)):null,x=v&&l?PQe({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:q6(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=M6({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=L8({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=L6(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=i8(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=NQe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=L8({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=U4().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=i8(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=l8(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=i8(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=l8(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=l8(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!(!d||p)&&(c=!1,d=!1,cancelAnimationFrame(o),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=L8({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!I8(t,`.${g}`,v))&&(!_||I8(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function IQe(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())W6(i,V6(e))>0&&r.push(e);return r}var LQe=250;function RQe(e,t,n,r){let i=[],a=1/0,o=IQe(e,n,t+LQe);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=S8(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function R8(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...S8(o,c,c.position,!0)}:c}function z8(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function zQe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var B8=()=>!0;function BQe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=B8,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=o8(e.target),E=0,D,{x:O,y:k}=l8(e),A=z8(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=R8(i,A,r,c,t);if(!N)return;let P=l8(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=L6(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(ee)}let z={...N,nodeId:i,type:A,position:N.position},te=c.get(i),B={inProgress:!0,isValid:null,from:S8(te,z,w6.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:te,to:P,toHandle:null,toPosition:T6[z.position],toNode:null,pointer:P};function V(){M=!0,y(B),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&V();function ne(e){if(!M){let{x:t,y:n}=l8(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;V()}if(!x()||!z){re(e);return}let a=b();P=l8(e,j),D=RQe(J6(P,a,!1,[1,1]),n,c,z),F||=(ee(),!0);let s=V8(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=zQe(!!D,s.isValid);let u=c.get(i),f=u?S8(u,z,w6.Left,!0):B.from,p={...B,from:f,isValid:L,to:s.toHandle&&L?Y6({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:T6[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),B=p}function re(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=B,r={...n,toPosition:B.toHandle?B.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ne),T.removeEventListener(`mouseup`,re),T.removeEventListener(`touchmove`,ne),T.removeEventListener(`touchend`,re)}}T.addEventListener(`mousemove`,ne),T.addEventListener(`mouseup`,re),T.addEventListener(`touchmove`,ne),T.addEventListener(`touchend`,re)}function V8(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=B8,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=l8(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=z8(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===v6.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=R8(t,e,a,u,n,!0)}return _}var H8={onPointerDown:BQe,isValid:V8};function VQe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=P4(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Q6()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=p6().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:F4}}var U8=e=>({x:e.x,y:e.y,zoom:e.k}),W8=({x:e,y:t,zoom:n})=>c6.translate(e,t).scale(n),G8=(e,t)=>e.target.closest(`.${t}`),K8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),HQe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,q8=(e,t=0,n=HQe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},J8=e=>{let t=e.ctrlKey&&Q6()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function UQe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(G8(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=F4(u),t=d*2**J8(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===y6.Vertical?0:u.deltaX*f,m=i===y6.Horizontal?0:u.deltaY*f;!Q6()&&u.shiftKey&&i!==y6.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=U8(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function WQe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=G8(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function GQe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=U8(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function KQe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&K8(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,U8(a.transform))}}function qQe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&K8(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=U8(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function JQe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(G8(d,`${l}-flow__node`)||G8(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||G8(d,s)&&m||G8(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function YQe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=p6().scaleExtent([t,n]).translateExtent(r),f=P4(e).call(d);v({x:i.x,y:i.y,zoom:N6(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(J8);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?w3:j3).transform(q8(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!K6(E)||E<0?0:E);let k=O?UQe({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):WQe({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=GQe({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=KQe({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=qQe({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=JQe({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(A),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=W8(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=W8(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=W8(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?l6(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?w3:j3).scaleTo(q8(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?w3:j3).scaleBy(q8(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!K6(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var Y8;(function(e){e.Line=`line`,e.Handle=`handle`})(Y8||={});function XQe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function X8(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function Z8(e,t){return Math.max(0,t-e)}function Q8(e,t){return Math.max(0,e-t)}function $8(e,t,n){return Math.max(0,t-e,e-n)}function e5(e,t){return e?!t:t}function ZQe(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=$8(E,h,g),j=$8(D,_,v);if(o){let e=0,t=0;c&&w<0?e=Z8(y+w+O,o[0][0]):!c&&w>0&&(e=Q8(y+E+O,o[1][0])),l&&T<0?t=Z8(b+T+k,o[0][1]):!l&&T>0&&(t=Q8(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Q8(y+w,s[0][0]):!c&&w<0&&(e=Z8(y+E,s[1][0])),l&&T>0?t=Q8(b+T,s[0][1]):!l&&T<0&&(t=Z8(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=$8(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Q8(b+k+E/C,o[1][1])*C:Z8(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?Z8(b+E/C,s[1][1])*C:Q8(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=$8(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Q8(y+D*C+O,o[1][0])/C:Z8(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?Z8(y+D*C,s[1][0])/C:Q8(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(e5(c,l)?-w:w)/C:w=(e5(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var t5={width:0,height:0,x:0,y:0},QQe={...t5,pointerX:0,pointerY:0,aspectRatio:1};function $Qe(e){return[[0,0],[e.measured.width,e.measured.height]]}function e$e(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function t$e({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=P4(e),o={controlDirection:X8(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...t5},h={...QQe};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:X8(e)};let g,_=null,v=[],y,b,x,S=!1,C=U4().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=i8(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId),b=y&&g.extent===`parent`?$Qe(y):void 0),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=e$e(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=i8(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=ZQe(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=XQe({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var n5=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},n$e=e=>e?n5(e):n5,{useDebugValue:r$e}=C.default,{useSyncExternalStoreWithSelector:i$e}=zC.default,a$e=e=>e;function r5(e,t=a$e,n){let r=i$e(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return r$e(r),r}var i5=(e,t)=>{let n=n$e(e),r=(e,r=t)=>r5(n,e,r);return Object.assign(r,n),r},o$e=(e,t)=>e?i5(e,t):i5;function a5(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var o5=(0,C.createContext)(null),s$e=o5.Provider,s5=m6.error001();function c5(e,t){let n=(0,C.useContext)(o5);if(n===null)throw Error(s5);return r5(n,e,t)}function l5(){let e=(0,C.useContext)(o5);if(e===null)throw Error(s5);return(0,C.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var u5={display:`none`},c$e={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},d5=`react-flow__node-desc`,f5=`react-flow__edge-desc`,l$e=`react-flow__aria-live`,u$e=e=>e.ariaLiveMessage,d$e=e=>e.ariaLabelConfig;function f$e({rfId:e}){let t=c5(u$e);return(0,G.jsx)(`div`,{id:`${l$e}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:c$e,children:t})}function p$e({rfId:e,disableKeyboardA11y:t}){let n=c5(d$e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{id:`${d5}-${e}`,style:u5,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,G.jsx)(`div`,{id:`${f5}-${e}`,style:u5,children:n[`edge.a11yDescription.default`]}),!t&&(0,G.jsx)(f$e,{rfId:e})]})}var p5=(0,C.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,G.jsx)(`div`,{className:u4([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));p5.displayName=`Panel`;function m$e({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,G.jsx)(p5,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,G.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var h$e=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},m5=e=>e.id;function g$e(e,t){return a5(e.selectedNodes.map(m5),t.selectedNodes.map(m5))&&a5(e.selectedEdges.map(m5),t.selectedEdges.map(m5))}function _$e({onSelectionChange:e}){let t=l5(),{selectedNodes:n,selectedEdges:r}=c5(h$e,g$e);return(0,C.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var v$e=e=>!!e.onSelectionChangeHandlers;function y$e({onSelectionChange:e}){let t=c5(v$e);return e||t?(0,G.jsx)(_$e,{onSelectionChange:e}):null}var h5=typeof window<`u`?C.useLayoutEffect:C.useEffect,g5=[0,0],b$e={x:0,y:0,zoom:1},_5=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],x$e=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),v5={translateExtent:h6,nodeOrigin:g5,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function S$e(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=c5(x$e,a5),l=l5();h5(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=v5,s()}),[]);let u=(0,C.useRef)(v5);return h5(()=>{for(let s of _5){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:pQe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},_5.map(t=>e[t])),null}function y5(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function C$e(e){let[t,n]=(0,C.useState)(e===`system`?null:e);return(0,C.useEffect)(()=>{if(e!==`system`){n(e);return}let t=y5(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?y5()?.matches?`dark`:`light`:t}var b5=typeof document<`u`?document:null;function x5(e=null,t={target:b5,actInsideInputWithModifier:!0}){let[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(!1),a=(0,C.useRef)(new Set([])),[o,s]=(0,C.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
459
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=D2(E2(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=D2(E2(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function A2(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new S2||null,prettyErrors:t}}function cqe(e,t={}){let{lineCounter:n,prettyErrors:r}=A2(t),i=new k2(n?.addNewLine),a=new s2(t),o=Array.from(a.compose(i.parse(e)));if(r&&n)for(let t of o)t.errors.forEach(U0(e,n)),t.warnings.forEach(U0(e,n));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function j2(e,t={}){let{lineCounter:n,prettyErrors:r}=A2(t),i=new k2(n?.addNewLine),a=new s2(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new V0(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(U0(e,n)),o.warnings.forEach(U0(e,n))),o}function lqe(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=j2(e,n);if(!i)return null;if(i.warnings.forEach(e=>L1(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function uqe(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return U$(e)&&!r?e.toString(n):new R0(e,r,n).toString(n)}var dqe=c({Alias:()=>m1,CST:()=>nqe,Composer:()=>s2,Document:()=>R0,Lexer:()=>x2,LineCounter:()=>S2,Pair:()=>W1,Parser:()=>k2,Scalar:()=>_1,Schema:()=>L0,YAMLError:()=>B0,YAMLMap:()=>J1,YAMLParseError:()=>V0,YAMLSeq:()=>X1,YAMLWarning:()=>H0,isAlias:()=>H$,isCollection:()=>J$,isDocument:()=>U$,isMap:()=>W$,isNode:()=>Y$,isPair:()=>G$,isScalar:()=>K$,isSeq:()=>q$,parse:()=>lqe,parseAllDocuments:()=>cqe,parseDocument:()=>j2,stringify:()=>uqe,visit:()=>e1,visitAsync:()=>n1});function fqe(e){let t=null;try{t=dqe.parse(e.doc.toString())}catch{}let n=JK(e,WK.YAML);return{data:t,pointers:n}}var M2=e=>{switch(e){case WK.JSON:return $Ge;case WK.JSON5:return tKe;case WK.YAML:return fqe}};function pqe(e){return Object.entries(e)}function N2(e,t){if(typeof e==`string`||typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>N2(e,t));if(e instanceof Map){let n=new Map;for(let[r,i]of e){let e=r,a=N2(i,t);n.set(e,a)}return n}if(e instanceof Set){let n=new Set;for(let r of e){let e=N2(r,t);n.add(e)}return n}let n={};function r(e,r,i,a){i===e&&a===r?n[i]=N2(r,t):n[i]=a}for(let[n,i]of pqe(e)){let e=t(n,i);if(e.length===2&&typeof e[0]==`string`)r(n,i,e[0],e[1]);else for(let[t,a]of e)r(n,i,t,a)}return n}var mqe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},hqe=class{constructor(){this.completions=new Map,this.reservedKeys=new Set}reserve(e){this.reservedKeys.add(e)}add(e){this.reservedKeys.has(e.label)||this.completions.set(e.label,e)}};function P2(e){return!(!e||pq(e)||e.name===`UnknownPropertyError`||e.type===`undefined`)}var gqe=class{constructor(e){this.opts=e,this.originalSchema=null,this.schema=null,this.laxSchema=null,this.mode=WK.JSON,this.mode=e.mode??WK.JSON,this.parser=this.opts?.jsonParser??M2(this.mode)}doComplete(e){let t=sq(e.state);if(this.originalSchema!==t&&(this.schema=L2(t,t)??t,this.laxSchema=vqe(this.schema)),!this.schema||!this.laxSchema)return[];BK.log(`xxx`,`trying with original schema`);let n=this.doCompleteForSchema(e,this.schema);return n.options.length===0?(BK.log(`xxx`,`no completions with original schema, trying with lax schema`),this.doCompleteForSchema(e,this.laxSchema)):n}doCompleteForSchema(e,t){let n={from:e.pos,to:e.pos,options:[],filter:!1},r=e.state.doc.sliceString(0),i=YK(e.state,e.pos),a=e.state.sliceDoc(i.from,e.pos).replace(/^(["'])/,``);if(BK.log(`xxx`,`node`,i,`prefix`,a,`ctx`,e),!($K(i,this.mode)||eq(i,this.mode))&&!e.explicit)return BK.log(`xxx`,`no completions for non-word/primitive`,i),n;let o=ZK(e.state.doc,i),s=ZK(e.state.doc,i,!1);if(i&&($K(i,this.mode)||eq(i,this.mode)))n.from=i.from,n.to=i.to;else{let t=e.matchBefore(/[A-Za-z0-9._]*/),a=e.pos-o.length;BK.log(`xxx`,`overwriteStart after`,a,`ctx.pos`,e.pos,`word`,t,`currentWord`,o,`=>`,r[a-1],`..`,r[a],`..`,r),n.from=i.name===VK.INVALID?t?.from??e.pos:a,n.to=e.pos}let c=new hqe,l=!0,u=aq(i,VK.PROPERTY_NAME,this.mode);if(u&&(BK.log(`xxx`,`closestPropertyNameNode`,u,`node`,i),i=u),eq(i,this.mode)){BK.log(`xxx`,`isPropertyNameNode`,i);let e=i.parent;if(e){let t=rq(e,this.mode);l=!t||t.name===VK.INVALID&&t.from-t.to===0||(t.parent?tq(t.parent).length<=1:!1),BK.log(`xxx`,`addValue`,l,rq(e,this.mode),i),i=aq(e,VK.OBJECT,this.mode)??null}}if(BK.log(`xxx`,i,o,e,`node at pos`,YK(e.state,e.pos)),i&&[VK.OBJECT,VK.JSON_TEXT].includes(GK(i.name,this.mode))&&(eq(YK(e.state,e.pos),this.mode)||u)){if(i.from===e.pos)return BK.log(`xxx`,`no completions for just before opening brace`),n;this.getPropertyCompletions(t,e,i,c,l,s)}else{let n=this.getValueCompletions(t,e,{},c);BK.log(`xxx`,`getValueCompletions res`,n)}return n.options=Array.from(c.completions.values()).filter(e=>XK(e.label).startsWith(a)),BK.log(`xxx`,`result`,n,`prefix`,a,`collector.completions`,c.completions,`reservedKeys`,c.reservedKeys),n}applySnippetCompletion(e){return yLe(typeof e.apply==`string`?e.apply:e.label,e)}getPropertyCompletions(e,t,n,r,i,a){let o=tRe(n,VK.PROPERTY,this.mode);BK.log(`xxx`,`getPropertyCompletions`,n,t,o),o.forEach(e=>{let n=ZK(t.state.doc,nq(e,VK.PROPERTY_NAME,this.mode));r.reserve(XK(n))});let s=this.getSchemas(e,t);BK.log(`xxx`,`propertyCompletion schemas`,s),s.forEach(t=>{if(typeof t!=`object`)return;let n=t.properties;n&&Object.entries(n).forEach(([t,n])=>{if(typeof n==`object`){let o=n.description??``,s=n.type??``,c=Array.isArray(s)?s.toString():s,l={label:t,apply:this.getInsertTextForProperty(t,i,a,e,n),type:`property`,detail:c,info:()=>hY(`div`,{inner:N$(o)})};r.add(this.applySnippetCompletion(l))}});let o=t.propertyNames;if(typeof o==`object`&&(o.enum&&o.enum.forEach(t=>{let n=t?.toString();if(n){let t={label:n,apply:this.getInsertTextForProperty(n,i,a,e),type:`property`};r.add(this.applySnippetCompletion(t))}}),o.const)){let t=o.const.toString(),n={label:t,apply:this.getInsertTextForProperty(t,i,a,e),type:`property`};r.add(this.applySnippetCompletion(n))}})}getInsertTextForProperty(e,t,n,r,i){i&&=L2(i,r);let a=this.getInsertTextForPropertyName(e,n);if(!t)return a;a+=`: `;let o,s=0;if(typeof i==`object`){if(i.default!==void 0)o||=this.getInsertTextForGuessedValue(i.default,``),s++;else if(i.enum&&(!o&&i.enum.length===1&&(o=this.getInsertTextForGuessedValue(i.enum[0],``)),s+=i.enum.length),i.const!==void 0&&(o||=this.getInsertTextForGuessedValue(i.const,``),s++),Array.isArray(i.examples)&&i.examples.length&&(o||=this.getInsertTextForGuessedValue(i.examples[0],``),s+=i.examples.length),o===void 0&&s===0){let e=Array.isArray(i.type)?i.type[0]:i.type;switch(e||(i.properties?e=`object`:i.items&&(e=`array`)),e){case`boolean`:o=`#{}`;break;case`string`:o=this.getInsertTextForString(``);break;case`object`:switch(this.mode){case WK.JSON5:o=`{#{}}`;break;case WK.YAML:o=`#{}`;break;default:o=`{#{}}`;break}break;case`array`:o=`[#{}]`;break;case`number`:case`integer`:o=`#{0}`;break;case`null`:o=`#{null}`;break;default:o=`#{}`;break}}}return(!o||s>1)&&(BK.log(`xxx`,`value`,o,`nValueProposals`,s,i),o=`#{}`),a+o}getInsertTextForPropertyName(e,t){switch(this.mode){case WK.JSON5:case WK.YAML:return t.startsWith(`"`)?`"${e}"`:t.startsWith(`'`)?`'${e}'`:e;default:return`"${e}"`}}getInsertTextForString(e,t=`#`){switch(this.mode){case WK.JSON5:return`'${t}{${e}}'`;case WK.YAML:return`${t}{${e}}`;default:return`"${t}{${e}}"`}}getInsertTextForGuessedValue(e,t=``){switch(typeof e){case`object`:return e===null?"${null}"+t:this.getInsertTextForValue(e,t);case`string`:{let n=JSON.stringify(e);return n=n.substr(1,n.length-2),n=this.getInsertTextForPlainText(n),this.getInsertTextForString(n,`$`)+t}case`number`:case`boolean`:return"${"+JSON.stringify(e)+`}`+t}return this.getInsertTextForValue(e,t)}getInsertTextForPlainText(e){return e.replace(/[\\$}]/g,`\\$&`)}getInsertTextForValue(e,t){let n=JSON.stringify(e,null,` `);return n===`{}`?`{#{}}`+t:n===`[]`?`[#{}]`+t:this.getInsertTextForPlainText(n+t)}getValueCompletions(e,t,n,r){let i=kH(t.state).resolveInner(t.pos,-1),a=null,o;if(BK.log(`xxx`,`getValueCompletions`,i,t),i&&$K(i,this.mode)&&(a=i,i=i.parent),!i){this.addSchemaValueCompletions(e,n,r);return}if(GK(i.name,this.mode)===VK.PROPERTY){let e=nq(i,VK.PROPERTY_NAME,this.mode);e&&(o=ZK(t.state.doc,e),i=i.parent)}if(BK.log(`xxx`,`node`,i,`parentKey`,o),i&&(o!==void 0||GK(i.name,this.mode)===VK.ARRAY)){let s=this.getSchemas(e,t);for(let e of s){if(typeof e!=`object`)return;if(GK(i.name,this.mode)===VK.ARRAY&&e.items){let t=r;if(e.uniqueItems&&(t=Object.assign(Object.assign({},t),{add(e){t.completions.has(e.label)||r.add(e)},reserve(e){r.reserve(e)}})),Array.isArray(e.items)){let r=0;if(a){let e=iq(i,a,this.mode);e>=0&&(r=e)}let o=e.items[r];o&&this.addSchemaValueCompletions(o,n,t)}else this.addSchemaValueCompletions(e.items,n,t)}if((e.type==null||e.type!==`object`)&&this.addSchemaValueCompletions(e,n,r),o!==void 0){let t=!1;if(e.properties){let i=e.properties[o];i&&(t=!0,this.addSchemaValueCompletions(i,n,r))}if(e.patternProperties&&!t){for(let i of Object.keys(e.patternProperties))if(this.extendedRegExp(i)?.test(o)){t=!0;let a=e.patternProperties[i];a&&this.addSchemaValueCompletions(a,n,r)}}if(e.additionalProperties&&!t){let t=e.additionalProperties;this.addSchemaValueCompletions(t,n,r)}}n.boolean&&(this.addBooleanValueCompletion(!0,r),this.addBooleanValueCompletion(!1,r)),n.null&&this.addNullValueCompletion(r)}}return{valuePrefix:a?ZK(t.state.doc,a,!0,!1):``}}addSchemaValueCompletions(e,t,n){typeof e==`object`&&(this.addEnumValueCompletions(e,n),this.addDefaultValueCompletions(e,n),this.collectTypes(e,t),Array.isArray(e.allOf)&&e.allOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.anyOf)&&e.anyOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.oneOf)&&e.oneOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)))}addDefaultValueCompletions(e,t,n=0){let r=!1;if(e.default!==void 0){let i=e.type,a=e.default;for(let e=n;e>0;e--)a=[a],i=`array`;let o=Object.assign(Object.assign({type:i?.toString()},this.getAppliedValue(a)),{detail:`Default value`});t.add(o),r=!0}Array.isArray(e.examples)&&e.examples.forEach(i=>{let a=e.type,o=i;for(let e=n;e>0;e--)o=[o],a=`array`;t.add(Object.assign({type:a?.toString()},this.getAppliedValue(o))),r=!0}),!r&&typeof e.items==`object`&&!Array.isArray(e.items)&&n<5&&this.addDefaultValueCompletions(e.items,t,n+1)}addEnumValueCompletions(e,t){if(e.const!==void 0&&t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(e.const)),{info:e.description})),Array.isArray(e.enum))for(let n=0,r=e.enum.length;n<r;n++){let r=e.enum[n];t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(r)),{info:e.description}))}}addBooleanValueCompletion(e,t){t.add({type:`boolean`,label:e?`true`:`false`})}addNullValueCompletion(e){e.add({type:`null`,label:`null`})}collectTypes(e,t){if(Array.isArray(e.enum)||e.const!==void 0)return;let n=e.type;Array.isArray(n)?n.forEach(e=>t[e]=!0):n&&(t[n]=!0)}getSchemas(e,t){let{data:n}=this.parser(t.state),r=new mY(e),i=qK(t.state,t.pos,-1,this.mode);if(i===``&&(i=void 0),i!=null&&i.endsWith(`/`)){i=i.substring(0,i.length-1);let t=F2(e,n,i);if(t!=null)return[t]}let a=i?.replace(/\/[^/]*$/,``);a===``&&(a=void 0);let o=F2(e,n,a),s=i?.split(`/`).pop(),c=s==null||s in(o?.properties??{}),l=r.getSchema({pointer:i,data:n??void 0});return!c&&l?.type===`null`&&this.mode===`yaml`&&(l=void 0),BK.log(`xxxx`,`draft.getSchema`,l,`data`,n,`pointer`,i,`pointerPointsToKnownProperty`,c),pq(l)&&(l=l.data?.schema),!P2(l)&&o?[o]:(P2(l)||(l=r.getSchema({pointer:a}),i=a),BK.log(`xxx`,`pointer..`,JSON.stringify(i)),!P2(l)&&(!i||i===`/`)&&(l=L2(e,e)??e),BK.log(`xxx`,`subSchema..`,l),l?Array.isArray(l.allOf)?[l,...l.allOf.map(t=>L2(t,e))]:Array.isArray(l.oneOf)?[l,...l.oneOf.map(t=>L2(t,e))]:Array.isArray(l.anyOf)?[l,...l.anyOf.map(t=>L2(t,e))]:[l]:[])}getAppliedValue(e){let t=XK(JSON.stringify(e));switch(this.mode){case WK.JSON5:return{label:t,apply:$Le(JSON.stringify(e))};case WK.YAML:return{label:t,apply:t};default:return{label:t,apply:JSON.stringify(e)}}}getValueFromLabel(e){return JSON.parse(e)}extendedRegExp(e){let t=``;e.startsWith(`(?i)`)&&(e=e.substring(4),t=`i`);try{return new RegExp(e,t+`u`)}catch{try{return new RegExp(e,t)}catch{return}}}};function _qe(e={}){let t=new gqe(e);return function(e){return t.doComplete(e)}}function vqe(e){return N2(e,(e,t)=>e===`additionalProperties`&&t===!1||e===`required`&&Array.isArray(t)||e===`unevaluatedProperties`&&t===!1||e===`unevaluatedItems`&&t===!1?[]:[e,t])}function F2(e,t,n){let r=new mY(e),i=r.getSchema({pointer:n,data:t??void 0});if(!P2(i))return;let a=I2(r,i),o={};for(let e of a){let i=bqe(n,e),a=r.getSchema({pointer:i,data:t??void 0});P2(a)&&Object.assign(o,{[e]:a})}if(a.length===0||Object.keys(o).length===0)return;let s=i,{allOf:c,anyOf:l,oneOf:u}=s,d=mqe(s,[`allOf`,`anyOf`,`oneOf`]);return Object.assign(Object.assign({},d),{properties:o})}function I2(e,t){if(t=L2(t,e.rootSchema),typeof t!=`object`||!t)return[];let n=[];function r(t){let r=I2(e,t);n.push(...r)}if(typeof t.properties==`object`&&t.properties!=null&&n.push(...Object.keys(t.properties)),typeof t.then==`object`&&t.then!=null&&r(t.then),Array.isArray(t.allOf))for(let e of t.allOf)r(e);if(Array.isArray(t.anyOf))for(let e of t.anyOf)r(e);if(Array.isArray(t.oneOf))for(let e of t.oneOf)r(e);return n}function L2(e,t){if(typeof e==`object`&&e.$ref){let n=yqe(t,e.$ref);if(typeof n==`object`){let t=Object.assign(Object.assign({},e),n);return Reflect.deleteProperty(t,`$ref`),t}}return e}function yqe(e,t){let n=t.split(`/`),r=e;return n.forEach(t=>{if(t){if(t===`#`){r=e;return}typeof r==`object`&&(r=r[t])}}),r}function bqe(e,t){return e===void 0?`/${t}`:`${e}/${t}`}var R2=(e,t)=>{let n=e.length>2,r=e.map((n,r)=>{let i="`"+(t?t(n):n)+"`";return r===e.length-1?`or `+i:i});return n?r.join(`, `):r.join(` `)},xqe=e=>e?.data?.pointer&&e?.data?.pointer!==`#`?e.data.pointer.slice(1):e?.data?.property?`/${e.data.property}`:``,Sqe=e=>e.startState.field(oq)!==e.state.field(oq);function Cqe(e){let t=new Tqe(e);return e=>t.doValidation(e)}var wqe=[`NoAdditionalPropertiesError`,`RequiredPropertyError`,`InvalidPropertyNameError`,`ForbiddenPropertyError`,`UndefinedValueError`],Tqe=class{constructor(e){this.options=e,this.schema=null,this.mode=WK.JSON,this.rewriteError=e=>{let t=e?.data?.errors;return e.code===`one-of-error`&&t?.length?`Expected one of ${R2(t,e=>e.data.expected)}`:e.code===`type-error`?`Expected \`${e?.data?.expected&&Array.isArray(e?.data?.expected)?R2(e?.data?.expected):e?.data?.expected}\` but received \`${e?.data?.received}\``:e.message.replaceAll("in `#` ",``).replaceAll("at `#`",``).replaceAll(`/`,`.`).replaceAll(`#.`,``)},this.mode=this.options?.mode??WK.JSON,this.parser=this.options?.jsonParser??M2(this.mode)}get schemaTitle(){return this.schema?.getSchema()?.title??`json-schema`}doValidation(e){let t=sq(e.state);if(!t||(this.schema=new uY(t),!this.schema)||!e.state.doc.toString()?.length)return[];let n=this.parser(e.state);if(n.data==null)return[];let r=[];try{r=this.schema.validate(n.data)}catch{}return BK.log(`xxx`,`validation errors`,r,n.data),r.length?r.reduce((e,t)=>{let r=()=>{let n=this.rewriteError(t);e.push({from:0,to:0,message:n,severity:`error`,source:this.schemaTitle,renderMessage:()=>{let e=hY(`div`,{});return e.innerHTML=N$(n),e}})},i=xqe(t),a=n.pointers.get(i);if(t.name===`MaxPropertiesError`||t.name===`MinPropertiesError`||i===``)r();else if(a){let n=wqe.includes(t.name),r=this.rewriteError(t),i=n?a.keyFrom:a.valueFrom,o=n?a.keyTo:a.valueTo;o!==void 0&&i!==void 0&&e.push({from:i,to:o,message:r,renderMessage:()=>{let e=hY(`div`,{});return e.innerHTML=N$(r),e},severity:`error`,source:this.schemaTitle})}else r();return e},[]):[]}};function Eqe(e){let t=new Oqe(e);return async function(e,n,r){return t.doHover(e,n,r)}}function Dqe(e){if(e.type)return e.$ref?`${e.$ref} (${e.type})`:e.type;if(e.$ref)return`${e.$ref}`}function z2(e,t,n){return`${t}: ${R2(e[t].map(e=>{try{let{data:t}=n.resolveRef({data:e,pointer:e.$ref});return Dqe(t||e)}catch{return e.type}}))}`}var Oqe=class{constructor(e){this.opts=e,this.schema=null,this.mode=WK.JSON,this.opts=Object.assign({parser:JSON.parse},this.opts),this.mode=this.opts?.mode??WK.JSON}getDataForCursor(e,t,n){let r=sq(e.state);if(!r)return null;this.schema=new uY(r);let i=qK(e.state,t,n,this.mode),a;try{a=this.opts.parser(e.state.doc.toString())}catch{}if(!i)return null;let o=this.schema.getSchema({pointer:i,data:a,withSchemaWarning:!0});return pq(o)&&(o=o?.data.schema.$ref?this.schema.resolveRef(o):o?.data.schema),{schema:o,pointer:i}}formatMessage(e){let{message:t,typeInfo:n}=e;return t?hY(`div`,{class:`cm6-json-schema-hover`},[hY(`div`,{class:`cm6-json-schema-hover--description`,inner:N$(t,!1)}),hY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[hY(`div`,{class:`cm6-json-schema-hover--code`,inner:N$(n,!1)})])]):hY(`div`,{class:`cm6-json-schema-hover`},[hY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[hY(`code`,{class:`cm6-json-schema-hover--code`,inner:N$(n,!1)})])])}getHoverTexts(e,t){let n=``,r=null,{schema:i}=e;return i.oneOf&&(n=z2(i,`oneOf`,t)),i.anyOf&&(n=z2(i,`anyOf`,t)),i.allOf&&(n=z2(i,`allOf`,t)),i.type&&(n=Array.isArray(i.type)?R2(i.type):i.type),i.$ref&&(n=` Reference: ${i.$ref}`),i.enum&&(n=`\`enum\`: ${R2(i.enum)}`),i.format&&(n+=`\`format\`: ${i.format}`),i.pattern&&(n+=`\`pattern\`: ${i.pattern}`),i.description&&(r=i.description),{message:r,typeInfo:n}}async doHover(e,t,n){let r=t,i=t;try{let a=this.getDataForCursor(e,t,n);if(BK.log(`cursorData`,a),!a?.schema)return null;let o=(this.opts?.getHoverTexts??this.getHoverTexts)(a,this.schema),s=(this.opts?.formatHover??this.formatMessage)(o);return{pos:r,end:i,arrow:!0,above:!0,create:e=>({dom:s})}}catch(e){return BK.log(e),null}}},kqe=e=>(0,G.jsx)(ny,{disablePadding:!0,children:e.validationErrors.map((e,t)=>(0,G.jsx)(ay,{disableGutters:!0,disablePadding:!0,children:(0,G.jsxs)(Gv,{direction:`row`,spacing:1,children:[(0,G.jsx)(Q,{variant:`body2`,children:`•`}),(0,G.jsx)(Q,{variant:`caption`,children:e.instancePath.length===0?`/`:e.instancePath}),(0,G.jsx)(Q,{variant:`body2`,children:e.message})]})},t.toString()))}),B2=e=>{let t;try{t=JSON.parse(e)}catch{t=void 0}return t};function Aqe({schema:e,customValidate:t}){let n=(0,C.useMemo)(()=>new XP.default({allErrors:!0}),[]);return(0,C.useCallback)(r=>{let i=[];return n.validate(e,r),i.push(...n.errors??[]),i.push(...t?.(r)??[]),i},[n,e,t])}var jqe=e=>{let t=Mqe(),[n,r]=(0,C.useState)(()=>JSON.stringify(e.value,null,2)),i=Aqe(e),[a,o]=(0,C.useState)([]);(0,C.useEffect)(()=>{o(i(e.value))},[i,e.value]);let s=e.onChange,c=(0,C.useCallback)(e=>{let t=B2(e),n=i(t);s(t,n.length===0),r(e),o(n)},[i,s]),l=()=>{let e=B2(n);e&&r(JSON.stringify(e,null,2))};return(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Z,{position:`relative`,children:[(0,G.jsx)(RK,{value:n,onChange:e=>c(e),extensions:[DPe(),NU(TPe(),{delay:100}),NU(Cqe(),{delay:100,needsRefresh:Sqe}),xU.data.of({autocomplete:_qe({mode:`json4`})}),aH(Eqe()),iRe(e.schema)],theme:t,height:`400px`}),(0,G.jsx)(_v,{sx:{position:`absolute`,right:`0`,bottom:`0`},onClick:()=>l(),children:`Prettify`})]}),a.length>0&&(0,G.jsx)(Uh,{severity:`error`,variant:`outlined`,children:(0,G.jsx)(kqe,{validationErrors:a})})]})};function Mqe(){return Cm().palette.mode===`dark`?YPe:GPe}var Nqe=[{value:``,label:`Auto (based on domain/name)`},{value:`light`,label:`💡 Light`},{value:`switch`,label:`🔌 Switch`},{value:`climate`,label:`🌡️ Climate`},{value:`cover`,label:`🪟 Cover`},{value:`fan`,label:`🌀 Fan`},{value:`lock`,label:`🔒 Lock`},{value:`sensor`,label:`📊 Sensor`},{value:`media_player`,label:`📺 Media Player`},{value:`vacuum`,label:`🧹 Vacuum`},{value:`remote`,label:`🎮 Remote`},{value:`humidifier`,label:`💧 Humidifier`},{value:`speaker`,label:`🔊 Speaker`},{value:`garage`,label:`🚗 Garage`},{value:`door`,label:`🚪 Door`},{value:`window`,label:`🪟 Window`},{value:`motion`,label:`🏃 Motion`},{value:`battery`,label:`🔋 Battery`},{value:`power`,label:`⚡ Power`},{value:`camera`,label:`📷 Camera`},{value:`default`,label:`🔗 Default`}],Pqe=({bridgeId:e,selectedIcon:t,onIconChange:n})=>{let r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(null);(0,C.useEffect)(()=>{e&&vE(e).then(t=>{a(t),t&&s(`${yE(e)}?t=${Date.now()}`)}).catch(()=>{a(!1)})},[e]);let f=(0,C.useCallback)(async t=>{let i=t.target.files?.[0];if(!(!i||!e)){d(null),l(!0);try{await cge(e,i),a(!0),s(`${yE(e)}?t=${Date.now()}`),n(void 0)}catch(e){d(e instanceof Error?e.message:`Upload failed`)}finally{l(!1),r.current&&(r.current.value=``)}}},[e,n]),p=(0,C.useCallback)(async()=>{if(e){d(null);try{await lge(e),a(!1),s(null)}catch(e){d(e instanceof Error?e.message:`Delete failed`)}}},[e]),m=(0,C.useCallback)(e=>{n(e===``?void 0:e)},[n]);return(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Mv,{fullWidth:!0,size:`small`,children:[(0,G.jsx)(Bx,{id:`icon-select-label`,children:`Bridge Icon`}),(0,G.jsx)(vS,{labelId:`icon-select-label`,value:t??``,label:`Bridge Icon`,onChange:e=>m(e.target.value),disabled:i,children:Nqe.map(e=>(0,G.jsx)(yS,{value:e.value,children:e.label},e.value))}),(0,G.jsx)(xS,{children:i?`Custom icon is set. Delete it to use preset icons.`:`Select a preset icon or upload a custom image`})]}),e&&(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,gutterBottom:!0,children:`Custom Icon`}),(0,G.jsxs)(Gv,{direction:`row`,spacing:2,alignItems:`center`,children:[i&&o&&(0,G.jsx)(Z,{component:`img`,src:o,alt:`Custom bridge icon`,sx:{width:48,height:48,objectFit:`contain`,borderRadius:1,border:`1px solid`,borderColor:`divider`}}),(0,G.jsx)(`input`,{ref:r,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml`,style:{display:`none`},onChange:f}),(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(whe,{}),onClick:()=>r.current?.click(),disabled:c,children:c?`Uploading...`:`Upload Image`}),i&&(0,G.jsx)(_v,{variant:`outlined`,size:`small`,color:`error`,startIcon:(0,G.jsx)(NS,{}),onClick:p,children:`Delete`})]}),u&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:1},children:u}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,display:`block`},children:`Supported formats: PNG, JPG, GIF, WebP, SVG (max 5MB)`})]}),!e&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:`Save the bridge first to upload a custom icon.`})]})},V2={light:`Light`,switch:`On/Off Plug-in Unit`,lock:`Door Lock`,fan:`Fan`,binary_sensor:`Sensor`,sensor:`Sensor`,cover:`Window Covering`,climate:`Thermostat`,media_player:`Speaker / Video Player`,vacuum:`Robot Vacuum Cleaner`,humidifier:`Humidifier`,valve:`Water Valve`,alarm_control_panel:`On/Off Plug-in Unit`,event:`Generic Switch`,button:`Generic Switch`,input_button:`Generic Switch`,automation:`On/Off Switch`,script:`On/Off Switch`,scene:`On/Off Switch`,remote:`On/Off`,water_heater:`Water Heater`,input_boolean:`On/Off Plug-in Unit`,select:`Mode Select`,input_select:`Mode Select`,siren:`On/Off Plug-in Unit`,weather:`Sensor`},H2=e=>{try{return JSON.parse(e)}catch{return}};function Fqe({filter:e}){let[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(``),d=(0,C.useCallback)(async()=>{n(!0),o(null);try{let t=await fetch(`api/matter/filter-preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.text(),r=H2(n);if(!t.ok){let e=typeof r==`object`&&r&&`error`in r?String(r.error):n||`Failed to fetch preview`;throw Error(e)}i(r??H2(n)),c(!0)}catch(e){o(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},[e]);(0,C.useEffect)(()=>{if(!(e.include.length>0&&e.include.some(e=>e.type&&e.value))){i(null),c(!1);return}let t=JSON.stringify(e);if(t!==u.current)return u.current=t,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{d()},800),()=>{l.current&&clearTimeout(l.current)}},[e,d]);let f=r?r.entities.reduce((e,t)=>(e[t.domain]=(e[t.domain]||0)+1,e),{}):{},p=[];if(r){r.entities.some(e=>e.domain===`vacuum`)&&p.push(`This filter includes a vacuum. Consider using Server Mode (single device per bridge) for Apple Home/Alexa compatibility.`),r.total>50&&p.push(`${r.total} entities is a large number. Consider splitting across multiple bridges for better stability.`);let e=Object.keys(f).filter(e=>!V2[e]);e.length>0&&p.push(`Unsupported domains will be skipped: ${e.join(`, `)}`)}return(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(_v,{variant:`outlined`,startIcon:t?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(Whe,{}),onClick:d,disabled:t,size:`small`,children:t?`Loading...`:`Preview Matching Entities`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mt:1},children:a}),(0,G.jsx)(ey,{in:s&&r!==null,children:r&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsxs)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:[r.total,` entities match`]}),r.truncated&&(0,G.jsx)(kv,{label:`Showing first 100`,size:`small`,color:`warning`,variant:`outlined`})]}),p.length>0&&(0,G.jsx)(Gv,{spacing:.5,sx:{mb:1.5},children:p.map(e=>(0,G.jsx)(Uh,{severity:`warning`,variant:`outlined`,icon:e.includes(`vacuum`)?(0,G.jsx)(pv,{fontSize:`small`}):(0,G.jsx)(Cb,{fontSize:`small`}),sx:{py:0},children:(0,G.jsx)(Q,{variant:`caption`,children:e})},e))}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mb:2,children:Object.entries(f).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,G.jsx)(kv,{label:`${e}: ${t}${V2[e]?` → ${V2[e]}`:``}`,size:`small`,variant:`outlined`,color:V2[e]?`default`:`warning`},e))}),(0,G.jsx)(ny,{dense:!0,sx:{maxHeight:200,overflow:`auto`,bgcolor:`background.paper`,borderRadius:1,border:1,borderColor:`divider`},children:r.entities.map(e=>(0,G.jsx)(ay,{divider:!0,children:(0,G.jsx)(ly,{primary:e.friendly_name||e.entity_id,secondary:`${e.entity_id}${V2[e.domain]?` → ${V2[e.domain]}`:``}`,primaryTypographyProps:{variant:`body2`},secondaryTypographyProps:{variant:`caption`,fontFamily:`monospace`}})},e.entity_id))}),(0,G.jsx)(_v,{size:`small`,onClick:()=>c(!1),sx:{mt:1},children:`Hide Preview`})]})})]})}var Iqe=rF().ObjectFieldTemplate;function Lqe(e){return(e.fieldPathId?.$id??``)===`root_filter`?(0,G.jsx)(Rqe,{...e}):(0,G.jsx)(Iqe,{...e})}function Rqe(e){let t=(e.formData?.include?.length??0)+(e.formData?.exclude?.length??0),[n,r]=(0,C.useState)(t>0);return(0,G.jsxs)(QS,{expanded:n,onChange:(e,t)=>r(t),variant:`outlined`,disableGutters:!0,sx:{borderRadius:2,"&::before":{display:`none`},overflow:`hidden`},children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),sx:{px:2,"& .MuiAccordionSummary-content":{alignItems:`center`,gap:1.5}},children:[(0,G.jsx)(vb,{fontSize:`small`,color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,children:`Entity Filters`}),(0,G.jsx)(Lx,{badgeContent:t,color:`primary`,sx:{ml:1},max:99,children:(0,G.jsx)(Z,{})}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{ml:1},children:n?`Click to collapse`:`${t} rule${t===1?``:`s`} configured`})]}),(0,G.jsx)($S,{sx:{px:2,pb:2},children:e.properties.map(e=>(0,G.jsx)(`div`,{children:e.content},e.name))})]})}function zqe(e){let t=(0,C.useRef)(e),n=t.current;return t.current=e,n}function U2(e){let{items:t,canAdd:n,onAddClick:r,title:i,formData:a}=e,o=a??[],[s,c]=(0,C.useState)(()=>new Set),[l,u]=(0,C.useState)(``),d=zqe(o.length);(0,C.useEffect)(()=>{if(o.length>d){let e=o.length-1,t=o[e];!t?.type&&!t?.value&&c(t=>new Set([...t,e]))}},[o,d]);let f=(0,C.useCallback)(e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),p=(0,C.useMemo)(()=>{if(!l.trim())return null;let e=l.toLowerCase(),t=[];for(let n=0;n<o.length;n++){let r=o[n],i=r?.type??``,a=r?.value??``;(i.toLowerCase().includes(e)||a.toLowerCase().includes(e))&&t.push(n)}return new Set(t)},[l,o]),m=(0,C.useMemo)(()=>{let e=Array.from({length:t.length},(e,t)=>t);return p?e.filter(e=>p.has(e)):e},[t.length,p]);return(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,children:i}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(kv,{label:t.length,size:`small`,color:`default`,sx:{height:22,fontSize:`0.75rem`}}),n&&(0,G.jsx)(_v,{size:`small`,startIcon:(0,G.jsx)(pb,{}),onClick:r,children:`Add`})]})]}),t.length>3&&(0,G.jsx)(SS,{size:`small`,fullWidth:!0,placeholder:`Search rules...`,value:l,onChange:e=>u(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(eF,{position:`start`,children:(0,G.jsx)(lE,{fontSize:`small`,color:`action`})})}},sx:{mb:1}}),p&&m.length===0&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,py:2,children:`No matching rules`}),(0,G.jsx)(Gv,{spacing:.5,children:m.map(e=>{let n=o[e],r=n?.type??``,i=n?.value??``,a=s.has(e);return(0,G.jsxs)(Z,{sx:{border:1,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,sx:{px:1.5,py:.75,cursor:`pointer`,"&:hover":{bgcolor:`action.hover`},bgcolor:a?`action.selected`:`transparent`},onClick:()=>f(e),children:[a?(0,G.jsx)(mhe,{fontSize:`small`,color:`action`}):(0,G.jsx)(ghe,{fontSize:`small`,color:`action`}),r||i?(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,ml:.5,flex:1,minWidth:0,children:[(0,G.jsx)(kv,{label:r,size:`small`,variant:`outlined`,sx:{height:22,fontSize:`0.75rem`,flexShrink:0}}),(0,G.jsx)(Q,{variant:`body2`,noWrap:!0,sx:{flex:1,minWidth:0},children:i})]}):(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,ml:.5,fontStyle:`italic`,children:`New rule (click to configure)`})]}),(0,G.jsx)(ey,{in:a,children:(0,G.jsx)(Z,{sx:{px:2,pb:1.5,pt:.5},children:t[e]})})]},e)})})]})}var Bqe=new Set([``,`pattern`,`regex`]);function Vqe(e){let{schema:t,formData:n,onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=n??{},c=s.type??``,l=s.value??``,u=i||a,d=t.properties??{},f=(d.type?.oneOf??[]).filter(e=>typeof e.const==`string`),p=d.value?.title??`Value`,m=f.find(e=>e.const===c),h=(0,C.useCallback)(e=>r({...s,type:e},o.path),[s,r,o]),g=(0,C.useCallback)(e=>r({...s,value:e},o.path),[s,r,o]),_=Bqe.has(c)&&!u;return(0,G.jsxs)(Gv,{spacing:2,sx:{pt:1},children:[(0,G.jsxs)(Mv,{fullWidth:!0,size:`small`,disabled:u,children:[(0,G.jsx)(Bx,{id:`${o.path}-type`,children:`Type`}),(0,G.jsx)(vS,{labelId:`${o.path}-type`,label:`Type`,value:c,onChange:e=>h(e.target.value),children:f.map(e=>(0,G.jsx)(yS,{value:e.const,children:e.title??e.const},e.const))})]}),m?.description&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:m.description}),_?(0,G.jsx)(WS,{value:l,onChange:g,label:p,placeholder:`sensor.living_room_*`,helperText:`Search or type an entity ID. Wildcards and regex still work.`,margin:`none`}):(0,G.jsx)(SS,{fullWidth:!0,size:`small`,label:p,value:l,disabled:u,onChange:e=>g(e.target.value),helperText:d.value?.description})]})}function Hqe(e){let{schema:t,formData:n={},onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=t.properties??{},c=(0,C.useCallback)((e,t)=>{r({...n,[e]:t},o.path)},[n,r,o]);return(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:`Feature Flags`}),(0,G.jsx)(Rv,{container:!0,spacing:2,children:Object.entries(s).map(([e,t])=>{let r=n[e]??t.default??!1;return(0,G.jsx)(Rv,{size:{xs:12,sm:6,lg:4},children:(0,G.jsx)(vv,{variant:`outlined`,sx:{height:`100%`,opacity:t.title?.toLowerCase().includes(`deprecated`)??!1?.6:1,transition:`border-color 0.2s, box-shadow 0.2s`,borderColor:r?`primary.main`:`divider`,"&:hover":{transform:`none`,boxShadow:`none`}},children:(0,G.jsx)(bv,{onClick:()=>{!i&&!a&&c(e,!r)},disabled:i||a,sx:{height:`100%`},children:(0,G.jsxs)(xv,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:1,children:[(0,G.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,sx:{lineHeight:1.3},children:t.title??e}),r&&(0,G.jsx)(kv,{label:`Active`,size:`small`,color:`primary`,variant:`outlined`,sx:{mt:.5,height:20,fontSize:`0.7rem`}})]}),(0,G.jsx)(US,{checked:r,size:`small`,disabled:i||a,tabIndex:-1,onClick:e=>e.stopPropagation(),onChange:t=>c(e,t.target.checked)})]}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,lineHeight:1.4,flex:1},children:t.description})]})})})},e)})})]})}var W2=function(e){return e.JSON_EDITOR=`JSON_EDITOR`,e.FIELDS_EDITOR=`FIELDS_EDITOR`,e}(W2||{}),G2=e=>{let{t}=ms(),[n,r]=(0,C.useState)(W2.FIELDS_EDITOR),i=()=>{r(n===W2.FIELDS_EDITOR?W2.JSON_EDITOR:W2.FIELDS_EDITOR)},[a,o]=(0,C.useState)(e.bridge),[s,c]=(0,C.useState)(!0),l=(0,C.useCallback)(t=>{let n=t;if(!n?.port)return[];let r=e.usedPorts[n.port];return r!==void 0&&r!==e.bridgeId?[{instancePath:`/port`,message:`Port is already used by bridge with id ${r}`}]:[]},[e.bridgeId,e.usedPorts]),u=(e,t)=>{let n=e=>e?.icon;o(t=>{let r=n(t);return r==null?{...e}:{...e,icon:r}}),c(t)},d=(0,C.useCallback)(e=>{o(t=>{if(e!=null)return{...t,icon:e};let{icon:n,...r}=t??{};return r})},[]),f=(0,C.useMemo)(()=>{let e=a?.featureFlags,t=[];return e?.serverMode&&t.push({severity:`warning`,message:`Server Mode is enabled. Only ONE device should be in this bridge. Multiple devices will cause errors.`}),e?.serverMode&&e?.vacuumOnOff===!1&&t.push({severity:`warning`,message:`Server Mode with Vacuum OnOff disabled: Alexa REQUIRES the OnOff cluster (PowerController) for robotic vacuums. Without it, the vacuum commissions but never appears in Alexa. Only disable this for Apple Home.`}),!e?.serverMode&&e?.vacuumOnOff&&t.push({severity:`warning`,message:`Vacuum OnOff is enabled in bridge mode. This adds a non-standard cluster to the RVC device type which may cause issues with Apple Home and Google Home.`}),e?.autoForceSync&&e?.autoComposedDevices&&t.push({severity:`warning`,message:`Auto Force Sync with Auto Composed Devices increases network traffic. Composed devices have more clusters, so each sync cycle sends more data.`}),t},[a]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Uh,{severity:`warning`,variant:`outlined`,children:[`Please consult`,` `,(0,G.jsx)(Jv,{href:Y9.faq.bridgeConfig,target:`_blank`,children:`the documentation`}),` `,`for proper bridge configurations.`,` `,(0,G.jsx)(`strong`,{children:`Especially if you are using labels, see the "Labels" section.`})]}),(0,G.jsxs)(Uh,{severity:`info`,variant:`outlined`,children:[(0,G.jsx)(`strong`,{children:`Community tip:`}),` Users have reported that bridges with a large number of devices can become unstable depending on the controller. If you experience connectivity issues, consider splitting your devices across multiple bridges.`]}),f.map(e=>(0,G.jsx)(Uh,{severity:e.severity,variant:`outlined`,children:e.message},e.message)),(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(_v,{onClick:()=>i(),title:n===W2.FIELDS_EDITOR?t(`bridge.jsonEditor`):t(`bridge.formEditor`),children:n===W2.FIELDS_EDITOR?(0,G.jsx)(Jhe,{}):(0,G.jsx)(Lhe,{})})}),n===W2.FIELDS_EDITOR&&(0,G.jsx)(Mke,{value:a??{},onChange:u,schema:uv,uiSchema:{icon:{"ui:widget":`hidden`},featureFlags:{"ui:field":`featureFlags`},filter:{include:{"ui:options":{ArrayFieldTemplate:U2},items:{"ui:field":`entityFilterRule`}},exclude:{"ui:options":{ArrayFieldTemplate:U2},items:{"ui:field":`entityFilterRule`}}}},customValidate:l,templates:{ObjectFieldTemplate:Lqe},fields:{featureFlags:Hqe,entityFilterRule:Vqe}}),n===W2.JSON_EDITOR&&(0,G.jsx)(jqe,{value:a??{},onChange:u,schema:uv,customValidate:l}),a?.filter&&(0,G.jsx)(Fqe,{filter:a.filter}),(0,G.jsx)(vv,{variant:`outlined`,children:(0,G.jsxs)(xv,{children:[(0,G.jsx)(Q,{variant:`subtitle1`,gutterBottom:!0,fontWeight:600,children:t(`bridge.iconLabel`)}),(0,G.jsx)(Pqe,{bridgeId:e.bridgeId,selectedIcon:a?.icon,onIconChange:d})]})}),(0,G.jsxs)(Rv,{container:!0,children:[(0,G.jsx)(Rv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(_v,{fullWidth:!0,variant:`outlined`,color:`error`,onClick:e.onCancel,children:t(`common.cancel`)})}),(0,G.jsx)(Rv,{size:{xs:0,sm:4,md:6},sx:{display:{xs:`none`,sm:`block`}}}),(0,G.jsx)(Rv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(_v,{fullWidth:!0,variant:`outlined`,disabled:!s,onClick:async()=>{s&&await e.onSave(a)},children:t(`common.save`)})})]})]})]})},Uqe={name:``,featureFlags:{},filter:{include:[],exclude:[]}};function Wqe(e){let t=5540;for(;e[t];)t++;return t}var Gqe=()=>{let{t:e}=ms(),t=Xv(),n=Sr(),[r,i]=(0,C.useState)(),a=!!AT().content?.length,o=jT(),s=(0,C.useCallback)(e=>{i(e?.id)},[]),c=(0,C.useMemo)(()=>{if(!o)return;let e=Wqe(o);if(r){let t=iv.find(e=>e.id===r);if(t)return{name:t.name,port:e,filter:{...t.filter},featureFlags:{...t.featureFlags},icon:t.icon}}return{...Uqe,port:e}},[o,r]),l=Kme(),u=()=>{n(-1)};return!c||!o?e(`common.loading`):(0,G.jsxs)(Gv,{spacing:4,children:[(0,G.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:e(`common.create`),to:Y9.createBridge}]}),a&&(0,G.jsx)(Uh,{severity:`info`,variant:`outlined`,children:(0,G.jsxs)(Q,{children:[`Did you know that you can connect the same bridge with multiple assistants?`,` `,(0,G.jsx)(Jv,{href:Y9.faq.multiFabric,target:`_blank`,children:`Learn more.`})]})}),(0,G.jsx)(NE,{selectedTemplate:r,onSelect:s}),(0,G.jsx)(G2,{bridge:c,usedPorts:o,onSave:async n=>{await l({...n}).then(()=>t.show({message:e(`bridge.saveSuccess`),severity:`success`})).then(()=>u()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:u},r??`custom`)]})},Kqe=()=>{let{t:e}=ms(),t=Xv(),n=Sr(),{bridgeId:r}=Er(),{content:i,isLoading:a}=MT(r),o=jT(),s=qme(),c=(0,C.useMemo)(()=>{if(!(a||!i))return{name:i.name,port:i.port,filter:i.filter,...i.countryCode!=null&&{countryCode:i.countryCode},...i.featureFlags!=null&&{featureFlags:i.featureFlags},...i.icon!=null&&{icon:i.icon},...i.priority!=null&&{priority:i.priority},...i.serialNumberSuffix!=null&&{serialNumberSuffix:i.serialNumberSuffix}}},[a,i]),l=()=>{n(-1)};return a||!o?e(`common.loading`):!i||!c?e(`notFound.title`):(0,G.jsxs)(Gv,{spacing:4,children:[(0,G.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:i.name,to:Y9.bridge(r)},{name:e(`common.edit`),to:Y9.editBridge(r)}]}),(0,G.jsx)(G2,{bridgeId:r,bridge:c,usedPorts:o,onSave:async n=>{await s({...n,id:r}).then(()=>t.show({message:e(`bridge.updateSuccess`),severity:`success`})).then(()=>l()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:l})]})};async function qqe(){let e=await fetch(`api/backup/snapshots`);return await I_(e,`Failed to fetch backups`),F_(e)}async function Jqe(){let e=await fetch(`api/backup/snapshots/create`,{method:`POST`});return await I_(e,`Failed to create backup`),F_(e)}async function Yqe(e){let t=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/download`);if(!t.ok)throw Error(`Failed to download backup`);let n=await t.blob(),r=window.URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(r),document.body.removeChild(i)}async function Xqe(e,t){let n=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({overwriteExisting:!0,includeMappings:!0,restoreIdentity:!0,...t})});return await I_(n,`Failed to restore backup`),F_(n)}async function Zqe(e){await I_(await fetch(`api/backup/snapshots/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete backup`)}async function Qqe(){let e=await fetch(`api/backup/settings`);return await I_(e,`Failed to fetch backup settings`),F_(e)}async function $qe(e){let t=await fetch(`api/backup/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await I_(t,`Failed to update backup settings`),F_(t)}function eJe(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function K2(){let{t:e}=ms(),[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(new Set),[d,f]=(0,C.useState)(!1),[p,m]=(0,C.useState)(!0),[h,g]=(0,C.useState)(!0),[_,v]=(0,C.useState)(!1),[y,b]=(0,C.useState)(!1),[x,S]=(0,C.useState)(null),w=(0,C.useRef)(null),[T,E]=(0,C.useState)([]),[D,O]=(0,C.useState)(!0),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(null),[F,I]=(0,C.useState)(!1),L=(0,C.useCallback)(async()=>{try{O(!0);let[e,t]=await Promise.all([qqe(),Qqe()]);E(e),A(t)}catch(e){i(e instanceof Error?e.message:`Failed to load backups`)}finally{O(!1)}},[]);(0,C.useEffect)(()=>{L()},[L]);let R=async()=>{I(!0),i(null);try{await Jqe(),o(e(`backup.snapshotCreated`)),await L()}catch(e){i(e instanceof Error?e.message:`Failed to create backup`)}finally{I(!1)}},ee=async e=>{try{await Yqe(e)}catch(e){i(e instanceof Error?e.message:`Failed to download backup`)}},z=async t=>{n(!0),i(null);try{let n=await Xqe(t);n.errors.length>0?i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`):o(e(`backup.snapshotRestored`,{bridges:n.bridgesRestored,mappings:n.mappingsRestored,identities:n.identitiesRestored})),M(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Failed to restore backup`)}finally{n(!1)}},te=async e=>{try{await Zqe(e),P(null),await L()}catch(e){i(e instanceof Error?e.message:`Failed to delete backup`)}},B=async e=>{try{A(await $qe(e))}catch(e){i(e instanceof Error?e.message:`Failed to update settings`)}},V=async(t=!1)=>{n(!0),i(null);try{let n=await fetch(t?`api/backup/download?includeIdentity=true`:`api/backup/download`);if(!n.ok)throw Error(`Failed to create backup`);let r=await n.blob(),i=window.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]||`hamh-backup.zip`,document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(i),document.body.removeChild(a),o(e(`backup.downloadSuccess`))}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},ne=async e=>{let t=e.target.files?.[0];if(t){S(t),n(!0),i(null);try{let e=new FormData;e.append(`file`,t);let n=await fetch(`api/backup/restore/preview`,{method:`POST`,body:e});if(!n.ok){let e=await n.text(),t=`Failed to parse backup`;try{let n=JSON.parse(e);n.error&&(t=n.error)}catch{e&&(t=`${t} (HTTP ${n.status}: ${e.slice(0,120)})`)}throw Error(t)}let r=await n.json();c(r),u(new Set(r.bridges.map(e=>e.id))),v(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1),w.current&&(w.current.value=``)}}},re=async()=>{if(x){n(!0),i(null);try{let e=new FormData;e.append(`file`,x),e.append(`options`,JSON.stringify({bridgeIds:Array.from(l),overwriteExisting:d,includeMappings:p,restoreIdentity:h&&s?.includesIdentity}));let t=await fetch(`api/backup/restore`,{method:`POST`,body:e});if(!t.ok){let e=await t.text(),n=`Failed to restore backup`;try{let t=JSON.parse(e);t.error&&(n=t.error)}catch{e&&(n=`${n} (HTTP ${t.status}: ${e.slice(0,120)})`)}throw Error(n)}let n=await t.json();if(n.errors.length>0)i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`);else{let e=[`Restored ${n.bridgesRestored} bridges`];n.mappingsRestored>0&&e.push(`${n.mappingsRestored} entity mappings`),n.identitiesRestored>0&&e.push(`${n.identitiesRestored} identities`),o(`${e.join(`, `)}!`)}v(!1),c(null),S(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}}},ie=e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(t)};return(0,G.jsxs)(vv,{children:[(0,G.jsxs)(xv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,children:[(0,G.jsx)(HT,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.title`)]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`backup.description`)}),r&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},onClose:()=>i(null),children:r}),a&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,G.jsxs)(Rv,{container:!0,spacing:2,children:[(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(HT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.configBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupNote`)})]}),(0,G.jsx)(_v,{variant:`contained`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(HT,{}),onClick:()=>V(!1),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.configBackup`)})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(uE,{color:`warning`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.fullBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupWarning`)})]}),(0,G.jsx)(_v,{variant:`contained`,color:`warning`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(HT,{}),onClick:()=>V(!0),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.fullBackup`)})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(sE,{color:`info`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.restoreFromBackup`)})]}),(0,G.jsx)(Z,{sx:{flexGrow:1},children:(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.restoreDesc`)})}),(0,G.jsxs)(_v,{variant:`outlined`,color:`info`,startIcon:(0,G.jsx)(sE,{}),component:`label`,disabled:t,fullWidth:!0,sx:{mt:2},children:[e(`backup.restoreFromBackup`),(0,G.jsx)(`input`,{ref:w,type:`file`,accept:`.zip`,hidden:!0,onChange:ne})]})]})})]}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(HT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.storedBackups`)}),T.length>0&&(0,G.jsx)(kv,{label:T.length,size:`small`,color:`primary`,variant:`outlined`})]}),(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:F?(0,G.jsx)(Rh,{size:16,color:`inherit`}):(0,G.jsx)(pb,{}),onClick:R,disabled:F,children:e(`backup.createSnapshot`)})]}),D?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:2,children:(0,G.jsx)(Rh,{size:24})}):T.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:2},children:e(`backup.noSnapshots`)}):(0,G.jsx)(ny,{dense:!0,children:T.map(t=>(0,G.jsxs)(ay,{secondaryAction:(0,G.jsxs)(Z,{display:`flex`,gap:.5,children:[(0,G.jsx)(fb,{title:e(`backup.downloadSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>ee(t.filename),children:(0,G.jsx)(ET,{fontSize:`small`})})}),(0,G.jsx)(fb,{title:e(`backup.restoreSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,color:`warning`,onClick:()=>M(t.filename),children:(0,G.jsx)(sE,{fontSize:`small`})})}),(0,G.jsx)(fb,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>P(t.filename),children:(0,G.jsx)(NS,{fontSize:`small`})})})]}),children:[(0,G.jsx)(sy,{sx:{minWidth:36},children:(0,G.jsx)(HT,{fontSize:`small`,color:t.auto?`action`:`primary`})}),(0,G.jsx)(ly,{primary:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`v`,t.version]}),(0,G.jsx)(kv,{label:t.auto?e(`backup.auto`):e(`backup.manual`),size:`small`,variant:`outlined`,color:t.auto?`default`:`primary`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:eJe(t.sizeBytes)})]}),secondary:new Date(t.createdAt).toLocaleString()})]},t.filename))}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(DT,{color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.settings`)})]}),k&&(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,maxWidth:400},children:[(0,G.jsx)(Lv,{control:(0,G.jsx)(US,{checked:k.autoBackup,onChange:e=>B({autoBackup:e.target.checked})}),label:e(`backup.autoBackupLabel`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:-1},children:e(`backup.autoBackupDesc`)}),(0,G.jsx)(SS,{label:e(`backup.retentionCount`),type:`number`,size:`small`,value:k.backupRetentionCount,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=100&&B({backupRetentionCount:t})},inputProps:{min:1,max:100},helperText:e(`backup.retentionCountDesc`),sx:{maxWidth:200}})]})]}),(0,G.jsxs)(zb,{open:_,onClose:()=>v(!1),maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Hb,{children:e(`backup.restoreTitle`)}),(0,G.jsx)(Vb,{children:s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,gutterBottom:!0,children:[`Backup created: `,new Date(s.createdAt).toLocaleString()]}),s.includesIdentity&&(0,G.jsx)(Uh,{severity:`info`,sx:{mt:1},children:`This backup includes Matter identity data (keypairs, fabric credentials). Restoring identities allows bridges to reconnect without re-commissioning.`}),(0,G.jsxs)(Q,{variant:`subtitle2`,sx:{mt:2,mb:1},children:[e(`backup.selectBridges`),`:`]}),(0,G.jsx)(ny,{dense:!0,children:s.bridges.map(e=>(0,G.jsxs)(ay,{onClick:()=>ie(e.id),sx:{cursor:`pointer`},children:[(0,G.jsx)(sy,{children:(0,G.jsx)(Ev,{edge:`start`,checked:l.has(e.id),tabIndex:-1,disableRipple:!0})}),(0,G.jsx)(ly,{primary:e.name,secondary:(0,G.jsxs)(G.Fragment,{children:[`Port: `,e.port,e.hasMappings&&` • ${e.mappingCount} entity mappings`,e.exists&&(0,G.jsx)(Q,{component:`span`,color:`warning.main`,sx:{ml:1},children:`(exists)`})]})})]},e.id))}),(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{checked:d,onChange:e=>f(e.target.checked)}),label:e(`backup.overwriteExisting`)}),(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{checked:p,onChange:e=>m(e.target.checked)}),label:e(`backup.includeMappings`)}),s?.includesIdentity&&(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{checked:h,onChange:e=>g(e.target.checked)}),label:e(`backup.restoreIdentities`)})]})]})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>v(!1),children:e(`common.cancel`)}),(0,G.jsx)(_v,{variant:`contained`,onClick:re,disabled:t||l.size===0,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(zb,{open:y,onClose:()=>b(!1),children:[(0,G.jsxs)(Hb,{children:[(0,G.jsx)(oE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.restartRequired`)]}),(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Q,{children:e(`backup.restartMessage`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:e(`backup.restartNote`)})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>b(!1),children:e(`common.later`)}),(0,G.jsx)(_v,{variant:`contained`,color:`warning`,onClick:async()=>{n(!0);try{await fetch(`api/backup/restart`,{method:`POST`}),o(`Application is restarting...`)}catch(e){i(e instanceof Error?e.message:`Failed to restart`)}finally{n(!1),b(!1)}},disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(oE,{}),children:e(`backup.restartNow`)})]})]}),(0,G.jsxs)(zb,{open:j!==null,onClose:()=>M(null),children:[(0,G.jsxs)(Hb,{children:[(0,G.jsx)(sE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmRestore`)]}),(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Q,{children:e(`backup.confirmRestoreMessage`,{filename:j})}),(0,G.jsx)(Uh,{severity:`warning`,sx:{mt:2},children:e(`backup.restoreWarning`)})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>M(null),children:e(`common.cancel`)}),(0,G.jsx)(_v,{variant:`contained`,color:`warning`,onClick:()=>j&&z(j),disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(zb,{open:N!==null,onClose:()=>P(null),children:[(0,G.jsxs)(Hb,{children:[(0,G.jsx)(NS,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmDelete`)]}),(0,G.jsx)(Vb,{children:(0,G.jsx)(Q,{children:e(`backup.confirmDeleteMessage`,{filename:N})})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:()=>P(null),children:e(`common.cancel`)}),(0,G.jsx)(_v,{variant:`contained`,color:`error`,onClick:()=>N&&te(N),children:e(`common.delete`)})]})]})]})}var tJe=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function nJe(e={}){let{t}=ms(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(`name`),[u,d]=(0,C.useState)(`asc`),f=e.sortField??c,p=e.sortDirection??u,m=e.onSortFieldChange??l,h=e.onSortDirectionChange??d,g=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/health/detailed`);e.ok?(r(await e.json()),s(null)):s(t(`health.fetchFailed`))}catch{s(t(`health.connectionError`))}finally{a(!1)}},[t]);(0,C.useEffect)(()=>{g();let e=setInterval(g,1e4);return()=>clearInterval(e)},[g]);let _=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/diagnostic/export`);if(e.ok){let t=await e.blob(),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`hamh-diagnostic-${new Date().toISOString().replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}}catch{s(t(`health.exportFailed`))}},[t]),v=async e=>{try{await fetch(`api/matter/bridges/${e}/actions/restart`,{method:`POST`}),g()}catch{s(t(`health.restartFailed`))}};return i?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:4,children:(0,G.jsx)(Rh,{})}):o||!n?(0,G.jsx)(Uh,{severity:`error`,sx:{m:2},children:o??t(`health.unableToLoad`)}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[n.status===`healthy`?(0,G.jsx)(fv,{color:`success`}):n.status===`degraded`?(0,G.jsx)(Qv,{color:`warning`}):(0,G.jsx)(Cx,{color:`error`}),(0,G.jsx)(Q,{variant:`h5`,children:t(`health.systemHealth`)}),(0,G.jsx)(kv,{label:n.status.toUpperCase(),color:n.status===`healthy`?`success`:n.status===`degraded`?`warning`:`error`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(UT,{}),onClick:_,children:t(`health.exportDiagnostic`)}),(0,G.jsx)(fb,{title:t(`common.refresh`),children:(0,G.jsx)(Bh,{onClick:g,"aria-label":`Refresh health data`,children:(0,G.jsx)(aE,{})})})]})]}),(0,G.jsxs)(Rv,{container:!0,spacing:2,children:[(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.version`)}),(0,G.jsx)(Q,{variant:`h6`,children:n.version})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.uptime`)}),(0,G.jsx)(Q,{variant:`h6`,children:tJe(n.uptime)})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.homeAssistant`)}),(0,G.jsx)(kv,{label:n.services.homeAssistant.connected?t(`health.connected`):t(`health.disconnected`),color:n.services.homeAssistant.connected?`success`:`error`,size:`small`})]})})]}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(tE,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.bridgeStatus`)}),(0,G.jsx)(kv,{label:`${n.services.bridges.running}/${n.services.bridges.total} ${t(`common.running`)}`,size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Mx,{fontSize:`small`,color:`action`}),(0,G.jsxs)(Mv,{size:`small`,sx:{minWidth:120},children:[(0,G.jsx)(Bx,{children:t(`health.sortBy`)}),(0,G.jsxs)(vS,{value:f,label:t(`health.sortBy`),onChange:e=>m(e.target.value),children:[(0,G.jsx)(yS,{value:`name`,children:t(`common.name`)}),(0,G.jsx)(yS,{value:`created`,children:t(`health.created`)})]})]}),(0,G.jsx)(fb,{title:t(p===`asc`?`health.ascending`:`health.descending`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>h(p===`asc`?`desc`:`asc`),"aria-label":`Sort ${p===`asc`?`descending`:`ascending`}`,children:p===`asc`?(0,G.jsx)(zT,{fontSize:`small`}):(0,G.jsx)(RT,{fontSize:`small`})})})]})]}),(0,G.jsx)(Rv,{container:!0,spacing:2,alignItems:`stretch`,children:[...n.bridgeDetails].sort((e,t)=>{let n=0;return n=f===`name`?e.name.localeCompare(t.name):e.id.localeCompare(t.id),p===`asc`?n:-n}).map(e=>(0,G.jsx)(Rv,{size:{xs:12,sm:6,md:6,lg:4,xl:3},sx:{display:`flex`},children:(0,G.jsx)(vv,{variant:`outlined`,sx:{width:`100%`,height:`100%`,minWidth:280,maxWidth:480,display:`flex`,flexDirection:`column`,borderColor:e.status===`running`?`success.main`:e.status===`failed`?`error.main`:`warning.main`},children:(0,G.jsxs)(xv,{sx:{flex:1,display:`flex`,flexDirection:`column`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,flexShrink:0,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,minWidth:0,children:[(0,G.jsx)(hb,{}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,noWrap:!0,sx:{maxWidth:140},children:e.name})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:.5,flexShrink:0,children:[(0,G.jsx)(kv,{label:e.status.toUpperCase(),color:e.status===`running`?`success`:e.status===`failed`?`error`:`warning`,size:`small`}),e.status===`failed`&&(0,G.jsx)(fb,{title:t(`bridge.restart`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>v(e.id),children:(0,G.jsx)(VT,{})})})]})]}),e.statusReason&&(0,G.jsx)(Q,{variant:`body2`,color:`error`,sx:{mt:1,flexShrink:0},children:e.statusReason}),(0,G.jsx)(Z,{sx:{mt:`auto`,pt:1,flexShrink:0},children:(0,G.jsxs)(Z,{display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`,children:[(0,G.jsx)(kv,{label:`${t(`common.port`)} ${e.port}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(kv,{label:`${e.deviceCount} ${t(`common.devices`)}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(kv,{label:`${e.fabricCount} ${t(`common.fabrics`)}`,size:`small`,variant:`outlined`,color:`default`}),e.failedEntityCount>0&&(0,G.jsx)(kv,{label:`${e.failedEntityCount} failed`,color:`error`,size:`small`})]})}),e.connectivity&&e.status===`running`&&(0,G.jsx)(Z,{sx:{mt:1,flexShrink:0},children:(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.sessions`),`:`,` `,e.connectivity.totalSessions,` |`,` `,t(`health.subscriptions`),`:`,` `,e.connectivity.totalSubscriptions,e.connectivity.fabricSummary&&e.connectivity.fabricSummary.length>1&&` (${e.connectivity.fabricSummary.length} ${t(`health.fabrics`)})`]})}),e.fabrics.length>0&&(0,G.jsxs)(Z,{sx:{mt:1,flexShrink:0},children:[(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.connectedTo`),`:`]}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mt:.5,children:e.fabrics.map(e=>(0,G.jsx)(fb,{title:(0,G.jsxs)(Z,{sx:{fontSize:`0.75rem`},children:[(0,G.jsxs)(`div`,{children:[`Fabric #`,e.fabricIndex]}),(0,G.jsxs)(`div`,{children:[`Vendor: `,xx(e.rootVendorId),` `,`(0x`,e.rootVendorId.toString(16).toUpperCase().padStart(4,`0`),`)`]}),(0,G.jsxs)(`div`,{children:[`Fabric ID: `,e.fabricId]}),(0,G.jsxs)(`div`,{children:[`Node ID: `,e.nodeId]}),(0,G.jsxs)(`div`,{children:[`Root Node ID: `,e.rootNodeId]})]}),children:(0,G.jsx)(kv,{icon:(0,G.jsx)(Sx,{fabric:e}),label:e.label||xx(e.rootVendorId),size:`small`,variant:`outlined`})},e.fabricIndex))})]})]})})},e.id))}),n.recovery.enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(VT,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.autoRecovery`)}),(0,G.jsx)(kv,{label:t(`common.enabled`),color:`success`,size:`small`})]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[t(`health.recoveryAttempts`),`: `,n.recovery.recoveryCount,n.recovery.lastRecoveryAttempt&&` | Last attempt: ${new Date(n.recovery.lastRecoveryAttempt).toLocaleString()}`]})]}),(0,G.jsx)(Wb,{sx:{my:3}}),(0,G.jsx)(K2,{})]})}var q2=e=>e===`pass`?`success`:e===`warn`?`warning`:`error`;function rJe(){let{t:e}=ms(),[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useCallback)(async()=>{i(!0),o(null);try{let t=await fetch(`api/network`);t.ok?n(await t.json()):o(e(`health.fetchFailed`))}catch{o(e(`health.connectionError`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{l()},[l]);let u=t?.checks.filter(e=>e.status===`pass`).length??0,d=t?.checks.filter(e=>e.status===`warn`).length??0,f=t?.checks.filter(e=>e.status===`fail`).length??0;return(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`health.networkDiagnostics`)}),(0,G.jsx)(_v,{size:`small`,onClick:l,disabled:r,children:r?(0,G.jsx)(Rh,{size:16}):e(`health.refresh`)})]}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:1},children:a}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:1.5,flexWrap:`wrap`,children:[u>0&&(0,G.jsx)(kv,{label:`${u} ${e(`health.checksPassed`)}`,color:`success`,size:`small`,variant:`outlined`}),d>0&&(0,G.jsx)(kv,{label:`${d} ${e(`health.checksWarning`)}`,color:`warning`,size:`small`,variant:`outlined`}),f>0&&(0,G.jsx)(kv,{label:`${f} ${e(`health.checksFailed`)}`,color:`error`,size:`small`,variant:`outlined`}),(0,G.jsx)(kv,{label:t.matterConfig.boundInterface?`mDNS: ${t.matterConfig.boundInterface}`:`mDNS: all interfaces`,size:`small`,variant:`outlined`}),(0,G.jsx)(kv,{label:`IPv4: ${t.matterConfig.ipv4Enabled?`on`:`off`}`,size:`small`,variant:`outlined`})]}),t.checks.filter(e=>e.status!==`pass`).map(e=>(0,G.jsxs)(Uh,{severity:q2(e.status),sx:{mb:1},children:[(0,G.jsx)(`strong`,{children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.5},children:e.detail})]},e.name)),(0,G.jsx)(_v,{size:`small`,onClick:()=>c(!s),sx:{mt:.5},children:e(s?`health.hideDetails`:`health.showDetails`)}),(0,G.jsxs)(ey,{in:s,children:[(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:1,mb:.5},children:e(`health.allChecks`)}),(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:e(`health.check`)}),(0,G.jsx)(cC,{children:e(`health.statusLabel`)}),(0,G.jsx)(cC,{children:e(`health.message`)})]})}),(0,G.jsx)(sC,{children:t.checks.map(e=>(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:(0,G.jsx)(Q,{variant:`body2`,children:e.name})}),(0,G.jsx)(cC,{children:(0,G.jsx)(kv,{label:e.status,color:q2(e.status),size:`small`})}),(0,G.jsxs)(cC,{children:[(0,G.jsx)(Q,{variant:`body2`,children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,display:`block`,children:e.detail})]})]},e.name))})]}),(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:2,mb:.5},children:e(`health.networkInterfaces`)}),(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:e(`health.interfaceName`)}),(0,G.jsx)(cC,{children:`IPv4`}),(0,G.jsx)(cC,{children:`IPv6`}),(0,G.jsx)(cC,{children:`MAC`})]})}),(0,G.jsx)(sC,{children:t.interfaces.filter(e=>!e.internal).map(e=>(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{children:e.name}),(0,G.jsx)(cC,{children:e.ipv4.join(`, `)||`-`}),(0,G.jsx)(cC,{children:(0,G.jsx)(Q,{variant:`body2`,sx:{wordBreak:`break-all`,maxWidth:240},children:e.ipv6.join(`, `)||`-`})}),(0,G.jsx)(cC,{children:e.mac})]},e.name))})]})]})]})]})}var J2=`hamh-translation-overrides`;function Y2(e,t=``){let n={};for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(n,Y2(i,e)):n[e]=String(i??``)}return n}function X2(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.split(`.`),i=t;for(let t=0;t<e.length-1;t++)e[t]in i||(i[e[t]]={}),i=i[e[t]];i[e[e.length-1]]=r}return t}function Z2(e){try{let t=localStorage.getItem(J2);return t?JSON.parse(t)[e]??{}:{}}catch{return{}}}function Q2(e,t){try{let n=localStorage.getItem(J2),r=n?JSON.parse(n):{};Object.keys(t).length===0?delete r[e]:r[e]=t,localStorage.setItem(J2,JSON.stringify(r))}catch{}}var $2=`hamh-custom-languages`;function iJe(){try{let e=localStorage.getItem($2);return e?JSON.parse(e):[]}catch{return[]}}function e4(e){localStorage.setItem($2,JSON.stringify(e))}var t4=[{code:`de`,name:`Deutsch`},{code:`fr`,name:`Français`},{code:`es`,name:`Español`},{code:`it`,name:`Italiano`},{code:`zh`,name:`中文`},{code:`zh-TW`,name:`繁體中文`},{code:`ja`,name:`日本語`},{code:`th`,name:`ไทย`},{code:`sv`,name:`Svenska`},{code:`tr`,name:`Türkçe`},{code:`ru`,name:`Русский`}];function aJe(){let{t:e,i18n:t}=ms(),n=t.language??`en`,r=t4.some(e=>e.code===n)?n:n.split(`-`)[0]??`en`,[i,a]=(0,C.useState)(()=>r===`en`?`de`:r),[o,s]=(0,C.useState)(``),[c,l]=(0,C.useState)(()=>Z2(i)),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(`all`),[m,h]=(0,C.useState)(iJe),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(``),D=(0,C.useMemo)(()=>[...t4,...m],[m]),O=(0,C.useCallback)(e=>m.some(t=>t.code===e),[m]),k=(0,C.useMemo)(()=>Y2(gs),[]),A=(0,C.useMemo)(()=>{let e=t.getResourceBundle(i,`translation`);return e?Y2(e):{}},[i,t]),j=(0,C.useMemo)(()=>Object.keys(k).map(e=>({key:e,section:e.split(`.`)[0],enValue:k[e],currentValue:c[e]??A[e]??``,isOverridden:e in c})),[k,A,c]),M=(0,C.useMemo)(()=>{let e=j;if(o){let t=o.toLowerCase();e=e.filter(e=>e.key.toLowerCase().includes(t)||e.enValue.toLowerCase().includes(t)||e.currentValue.toLowerCase().includes(t))}return f===`missing`?e=e.filter(e=>!e.currentValue):f===`edited`&&(e=e.filter(e=>e.isOverridden)),e},[j,o,f]),N=(0,C.useMemo)(()=>[...new Set(M.map(e=>e.section))],[M]),P=Object.keys(k).length,F=j.filter(e=>e.currentValue).length,I=Object.keys(c).length,L=P>0?F/P*100:0;(0,C.useEffect)(()=>{l(Z2(i))},[i]);let R=(0,C.useCallback)(e=>{l(e),Q2(i,e);let n=t.getResourceBundle(i,`translation`),r=n?Y2(n):{},a={};for(let[t,n]of Object.entries(e))n&&n!==r[t]&&(a[t]=n);if(Object.keys(a).length>0){let e=X2({...r,...a});t.addResourceBundle(i,`translation`,e,!0,!0)}},[i,t]),ee=(0,C.useCallback)((e,t)=>{let n={...c,[e]:t};t||delete n[e],R(n)},[c,R]),z=(0,C.useCallback)(e=>{let t={...c};delete t[e],R(t)},[c,R]),te=(0,C.useCallback)(()=>{R({})},[R]),B=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=X2(e),n=JSON.stringify(t,null,2),r=new Blob([n],{type:`application/json`}),a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=`${i}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},[k,A,c,i]),V=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=X2(e);navigator.clipboard.writeText(JSON.stringify(t,null,2)),d(!0),setTimeout(()=>d(!1),2e3)},[k,A,c]),ne=(0,C.useCallback)(()=>{let n=v.trim().toLowerCase(),r=b.trim();if(!n){w(e(`translationEditor.codeRequired`));return}if(!r){w(e(`translationEditor.nameRequired`));return}if(t4.some(e=>e.code===n)||m.some(e=>e.code===n)||n===`en`){w(e(`translationEditor.languageExists`));return}let i=[...m,{code:n,name:r}];h(i),e4(i),t.addResourceBundle(n,`translation`,{},!0,!0),a(n),_(!1),y(``),x(``),w(``)},[v,b,m,t,e]),re=(0,C.useCallback)(()=>{if(!O(i))return;let e=m.filter(e=>e.code!==i);h(e),e4(e),Q2(i,{}),a(t4[0].code)},[i,m,O]),ie=(0,C.useCallback)(()=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.json`,t.onchange=()=>{let n=t.files?.[0];if(!n)return;let r=new FileReader;r.onload=()=>{try{let t=JSON.parse(r.result);if(typeof t!=`object`||!t)throw Error();let n=Y2(t),i=new Set(Object.keys(k)),a={},o=0;for(let[e,t]of Object.entries(n))i.has(e)&&t&&(a[e]=t,o++);R({...c,...a}),E(e(`translationEditor.importSuccess`,{count:o}))}catch{E(e(`translationEditor.importFailed`))}},r.readAsText(n)},t.click()},[k,c,R,e]);return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Xhe,{}),(0,G.jsx)(Q,{variant:`h5`,children:e(`translationEditor.title`)})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(Mv,{size:`small`,sx:{minWidth:140},children:[(0,G.jsx)(Bx,{children:e(`translationEditor.editLanguage`)}),(0,G.jsx)(vS,{value:i,label:e(`translationEditor.editLanguage`),onChange:e=>a(e.target.value),children:D.map(e=>(0,G.jsxs)(yS,{value:e.code,children:[(0,G.jsx)(ly,{primary:e.name}),O(e.code)&&(0,G.jsx)(sy,{sx:{minWidth:`auto`,ml:1},children:(0,G.jsx)(qT,{fontSize:`small`,color:`disabled`})})]},e.code))})]}),(0,G.jsx)(fb,{title:e(`translationEditor.addLanguage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>_(e=>!e),children:(0,G.jsx)(pb,{fontSize:`small`})})}),O(i)&&(0,G.jsx)(fb,{title:e(`translationEditor.removeLanguage`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:re,children:(0,G.jsx)(qT,{fontSize:`small`})})})]})]}),(0,G.jsx)(ey,{in:g,children:(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,alignItems:`flex-start`,flexWrap:`wrap`,children:[(0,G.jsx)(SS,{size:`small`,label:e(`translationEditor.newLanguageCode`),value:v,onChange:e=>y(e.target.value),error:!!S,sx:{width:180}}),(0,G.jsx)(SS,{size:`small`,label:e(`translationEditor.newLanguageName`),value:b,onChange:e=>x(e.target.value),sx:{width:220}}),(0,G.jsx)(_v,{variant:`contained`,size:`small`,onClick:ne,children:e(`translationEditor.addLanguageButton`)}),S&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:.5},children:S})]})}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:2},children:e(`translationEditor.info`)}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,mb:2,flexWrap:`wrap`,children:[(0,G.jsxs)(Z,{sx:{flexGrow:1,minWidth:200},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:.5,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`translationEditor.progress`,{translated:F,total:P})}),(0,G.jsxs)(Q,{variant:`body2`,fontWeight:600,children:[Math.round(L),`%`]})]}),(0,G.jsx)(Wv,{variant:`determinate`,value:L,sx:{height:8,borderRadius:4}})]}),I>0&&(0,G.jsx)(kv,{label:e(`translationEditor.localEdits`,{count:I}),color:`primary`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,flexWrap:`wrap`,children:[(0,G.jsx)(SS,{size:`small`,placeholder:e(`translationEditor.searchPlaceholder`),value:o,onChange:e=>s(e.target.value),sx:{flexGrow:1,minWidth:200},slotProps:{input:{startAdornment:(0,G.jsx)(eF,{position:`start`,children:(0,G.jsx)(lE,{fontSize:`small`})})}}}),(0,G.jsx)(Mv,{size:`small`,sx:{minWidth:130},children:(0,G.jsxs)(vS,{value:f,onChange:e=>p(e.target.value),children:[(0,G.jsx)(yS,{value:`all`,children:e(`translationEditor.filterAll`)}),(0,G.jsx)(yS,{value:`missing`,children:e(`translationEditor.filterMissing`)}),(0,G.jsx)(yS,{value:`edited`,children:e(`translationEditor.filterEdited`)})]})})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:3,flexWrap:`wrap`,children:[(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(gE,{}),onClick:B,children:e(`translationEditor.exportJson`)}),(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(ET,{}),onClick:ie,children:e(`translationEditor.importJson`)}),(0,G.jsx)(fb,{title:u?e(`translationEditor.copied`):``,children:(0,G.jsx)(_v,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(mb,{}),onClick:V,children:e(`translationEditor.copyJson`)})}),I>0&&(0,G.jsx)(_v,{variant:`outlined`,size:`small`,color:`warning`,startIcon:(0,G.jsx)(sE,{}),onClick:te,children:e(`translationEditor.resetAll`)})]}),N.map(t=>(0,G.jsxs)(Z,{sx:{mb:3},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,sx:{mb:1,textTransform:`capitalize`},children:t}),(0,G.jsx)(Wb,{sx:{mb:1.5}}),M.filter(e=>e.section===t).map(t=>(0,G.jsxs)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`1fr 1fr auto`},gap:1,mb:1.5,alignItems:`start`},children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{fontFamily:`monospace`},children:t.key}),(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.25},children:t.enValue})]}),(0,G.jsx)(SS,{size:`small`,fullWidth:!0,multiline:t.enValue.length>60,minRows:1,maxRows:4,value:t.currentValue,onChange:e=>ee(t.key,e.target.value),placeholder:t.enValue,sx:{"& .MuiOutlinedInput-root":t.isOverridden?{borderColor:`primary.main`,"& fieldset":{borderColor:`primary.main`,borderWidth:2}}:{}}}),t.isOverridden&&(0,G.jsx)(fb,{title:e(`translationEditor.resetKey`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>z(t.key),children:(0,G.jsx)(sE,{fontSize:`small`})})})]},t.key))]},t)),M.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,sx:{textAlign:`center`,py:4},children:e(`translationEditor.noResults`)}),(0,G.jsx)($h,{open:!!T,autoHideDuration:3e3,onClose:()=>E(``),message:T})]})}var n4=e=>{let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`},r4=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`},oJe=()=>{let[e,t]=(0,C.useState)(null),[n,r]=(0,C.useState)(!0),[i,a]=(0,C.useState)(!0);if((0,C.useEffect)(()=>{let e=null,n=async()=>{try{let n=await fetch(`api/system/info`);n.ok?(t(await n.json()),a(!0)):n.status===404&&(a(!1),e&&=(clearInterval(e),null))}catch{}finally{r(!1)}};return n(),e=setInterval(n,3e4),()=>{e&&clearInterval(e)}},[]),!i)return null;if(n)return(0,G.jsx)(vv,{children:(0,G.jsx)(xv,{children:(0,G.jsx)(Q,{children:`Loading system information...`})})});if(!e)return(0,G.jsx)(vv,{children:(0,G.jsx)(xv,{children:(0,G.jsx)(Q,{color:`error`,children:`Failed to load system information`})})});let o=e.memory.used/e.memory.total*100,s=e.storage.used/e.storage.total*100;return(0,G.jsx)(vv,{children:(0,G.jsxs)(xv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(The,{}),`System Information`]}),(0,G.jsxs)(Rv,{container:!0,spacing:3,children:[(0,G.jsx)(Rv,{size:{xs:12,md:6},children:(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`Application`}),(0,G.jsxs)(Gv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Version:`}),(0,G.jsx)(kv,{label:e.version,size:`small`,color:`primary`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Environment:`}),(0,G.jsx)(kv,{label:e.environment,size:`small`,variant:`outlined`,color:e.environment===`Home Assistant Add-on`?`success`:`default`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Node.js:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.nodeVersion})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Process Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:r4(e.process.uptime)})]})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`System`}),(0,G.jsxs)(Gv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Hostname:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.hostname})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Platform:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[e.platform,` (`,e.arch,`)`]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`CPU:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,sx:{maxWidth:200,textAlign:`right`},noWrap:!0,title:e.cpuModel,children:[e.cpuCount,`x`,` `,e.cpuModel.split(`@`)[0].trim()]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`System Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:r4(e.uptime)})]})]})]})]})}),(0,G.jsx)(Rv,{size:{xs:12,md:6},children:(0,G.jsxs)(Gv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(tE,{}),`Memory Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[n4(e.memory.used),` /`,` `,n4(e.memory.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[o.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${o}%`,backgroundColor:o>80?`error.main`:o>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(tE,{}),`HAMH Process Memory`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:.5},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`RSS: `,n4(e.process.rss)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[`Heap: `,n4(e.process.heapUsed),` /`,` `,n4(e.process.heapSizeLimit)]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${Math.min(e.process.heapUsed/e.process.heapSizeLimit*100,100)}%`,backgroundColor:e.process.heapUsed/e.process.heapSizeLimit>.85?`error.main`:e.process.heapUsed/e.process.heapSizeLimit>.6?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(qhe,{}),`Storage Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[n4(e.storage.used),` /`,` `,n4(e.storage.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[s.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${s}%`,backgroundColor:s>80?`error.main`:s>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]})]})}),(0,G.jsxs)(Rv,{size:{xs:12},children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(Bhe,{}),`Network Interfaces`]}),(0,G.jsx)(Gv,{spacing:1,sx:{mt:1},children:e.network.interfaces.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(Q,{variant:`body2`,children:e.name}),(0,G.jsx)(kv,{label:`${e.address} (${e.family})`,size:`small`,variant:`outlined`})]},`${e.name}-${e.address}`))})]})]})]})})},i4=200;function sJe(){let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,n=document.querySelector(`base`)?.href||window.location.origin,i=new URL(n),l=`${e}//${i.host}${i.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`),u=new WebSocket(l);o.current=u,u.onopen=()=>{a(!0),u.send(JSON.stringify({type:`subscribe_diagnostics`}))},u.onmessage=e=>{try{let n=JSON.parse(e.data);if(n.type===`diagnostic_event`){let e=n.data;t(t=>{let n=[...t,e];return n.length>i4?n.slice(-i4):n})}else if(n.type===`diagnostic_snapshot`){let e=n.data;r(e),t(e.recentEvents??[])}}catch{}},u.onclose=()=>{a(!1),o.current=null,s.current=setTimeout(c,3e3)},u.onerror=()=>u.close()},[]);return(0,C.useEffect)(()=>(c(),()=>{clearTimeout(s.current),o.current&&(o.current.send(JSON.stringify({type:`unsubscribe_diagnostics`})),o.current.close())}),[c]),{events:e,snapshot:n,connected:i,clearEvents:(0,C.useCallback)(()=>t([]),[])}}function a4(e){let t=e.replace(`#`,``),n=Number.parseInt(t.substring(0,2),16)/255,r=Number.parseInt(t.substring(2,4),16)/255,i=Number.parseInt(t.substring(4,6),16)/255;return .2126*(n<=.03928?n/12.92:((n+.055)/1.055)**2.4)+.7152*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.0722*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)>.179?`#000`:`#fff`}var o4={state_update:`#4caf50`,command_received:`#2196f3`,entity_error:`#f44336`,session_opened:`#ff9800`,session_closed:`#9e9e9e`,subscription_changed:`#9c27b0`,bridge_started:`#00bcd4`,bridge_stopped:`#795548`,entity_warning:`#ff9800`},s4={state_update:`diagnostics.stateUpdate`,command_received:`diagnostics.command`,entity_error:`diagnostics.entityError`,session_opened:`diagnostics.sessionOpen`,session_closed:`diagnostics.sessionClose`,subscription_changed:`diagnostics.subscription`,bridge_started:`diagnostics.bridgeStart`,bridge_stopped:`diagnostics.bridgeStop`,entity_warning:`diagnostics.entityWarning`};function cJe(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}var c4=Object.keys(o4);function lJe({sortField:e,sortDirection:t}={}){let{t:n}=ms(),r=Cm(),{events:i,snapshot:a,connected:o,clearEvents:s}=sJe(),[c,l]=(0,C.useState)(new Set(c4)),[u,d]=(0,C.useState)(!1),f=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},p=i.filter(e=>c.has(e.type)),m=(0,C.useMemo)(()=>{let n=a?.bridges??[];return e?[...n].sort((n,r)=>{let i=0;return i=e===`name`?n.bridgeName.localeCompare(r.bridgeName):n.bridgeId.localeCompare(r.bridgeId),t===`desc`?-i:i}):n},[a?.bridges,e,t]),h={};for(let e of i)h[e.type]=(h[e.type]??0)+1;return(0,G.jsx)(vv,{children:(0,G.jsxs)(xv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Yhe,{}),(0,G.jsx)(Q,{variant:`h6`,children:n(`diagnostics.title`)}),(0,G.jsx)(kv,{icon:(0,G.jsx)(jhe,{sx:{fontSize:10,color:o?r.palette.success.main:r.palette.error.main}}),label:n(o?`common.live`:`common.offline`),size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Gv,{direction:`row`,spacing:.5,alignItems:`center`,children:[(0,G.jsx)(fb,{title:n(`diagnostics.filterEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>d(e=>!e),color:u?`primary`:`default`,children:(0,G.jsx)(vb,{})})}),(0,G.jsx)(fb,{title:n(`diagnostics.clearEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:s,children:(0,G.jsx)(Che,{})})})]})]}),(0,G.jsxs)(Gv,{direction:`row`,spacing:.5,flexWrap:`wrap`,sx:{mb:2,gap:.5},children:[c4.map(e=>{let t=h[e]??0;if(t===0&&!u)return null;let r=o4[e];return(0,G.jsx)(kv,{label:`${n(s4[e])}: ${t}`,size:`small`,sx:{bgcolor:c.has(e)?r:`action.disabledBackground`,color:c.has(e)?a4(r):`text.disabled`,fontSize:`0.7rem`,height:22,cursor:`pointer`,opacity:c.has(e)?1:.5},onClick:()=>f(e)},e)}),a?.system&&(0,G.jsx)(kv,{label:`Total: ${a.system.eventCount}`,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})]}),(0,G.jsx)(ey,{in:u,children:(0,G.jsx)(Wm,{variant:`outlined`,sx:{p:1.5,mb:2},children:(0,G.jsx)(Rv,{container:!0,spacing:0,children:c4.map(e=>{let t=o4[e];return(0,G.jsx)(Rv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(Lv,{control:(0,G.jsx)(Ev,{size:`small`,checked:c.has(e),onChange:()=>f(e),sx:{color:t,"&.Mui-checked":{color:t}}}),label:(0,G.jsx)(Q,{variant:`caption`,children:n(s4[e])})})},e)})})})}),m.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Rv,{container:!0,spacing:1,sx:{mb:2},children:m.map(e=>(0,G.jsx)(uJe,{bridge:e},e.bridgeId))}),(0,G.jsx)(Wb,{sx:{mb:2}})]}),(0,G.jsx)(Z,{sx:{maxHeight:400,overflow:`auto`,bgcolor:`background.default`,borderRadius:1,p:1},children:p.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:4},children:i.length===0?`Waiting for diagnostic events…`:n(`diagnostics.noEvents`)}):p.map(e=>{let t=o4[e.type];return(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,py:.4,px:.5,minWidth:0,borderBottom:`1px solid`,borderColor:`divider`,"&:hover":{bgcolor:`action.hover`},"&:last-child":{borderBottom:`none`}},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.secondary`,whiteSpace:`nowrap`,fontFamily:`monospace`,fontSize:`0.72rem`,minWidth:85,pt:.1},children:cJe(e.timestamp)}),(0,G.jsx)(kv,{label:s4[e.type]?n(s4[e.type]):e.type,size:`small`,sx:{bgcolor:t??`#757575`,color:a4(t??`#757575`),fontSize:`0.62rem`,fontWeight:600,height:18,minWidth:90}}),e.bridgeName&&(0,G.jsxs)(Q,{variant:`caption`,sx:{color:`primary.main`,fontWeight:600,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:140,flexShrink:0},children:[`[`,e.bridgeName,`]`]}),e.entityId&&(0,G.jsx)(Q,{variant:`caption`,sx:{color:`warning.main`,fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:220,flexShrink:1},children:e.entityId}),(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.primary`,flex:1,wordBreak:`break-word`,fontSize:`0.72rem`},children:e.message})]},e.id)})})]})})}function uJe({bridge:e}){let[t,n]=(0,C.useState)(!1);return(0,G.jsx)(Rv,{size:{xs:12,sm:6},children:(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:1.5,overflow:`hidden`,minWidth:0},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,sx:{cursor:`pointer`},onClick:()=>n(e=>!e),children:[(0,G.jsxs)(Z,{sx:{minWidth:0,overflow:`hidden`},children:[(0,G.jsx)(Q,{variant:`body2`,fontWeight:500,noWrap:!0,children:e.bridgeName}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,noWrap:!0,children:[e.entityCount,` devices · `,e.sessionCount,` sessions`]})]}),(0,G.jsxs)(Gv,{direction:`row`,spacing:.5,alignItems:`center`,flexWrap:`wrap`,justifyContent:`flex-end`,sx:{flexShrink:0,ml:1},children:[Object.entries(e.featureFlags).filter(([,e])=>e).map(([e])=>(0,G.jsx)(kv,{label:e.replace(/^auto/,``).replace(/([A-Z])/g,` $1`).trim(),size:`small`,variant:`outlined`,sx:{fontSize:`0.6rem`,height:18}},e)),(0,G.jsx)(kv,{label:e.status,size:`small`,color:e.status===`running`?`success`:e.status===`failed`?`error`:`default`,sx:{height:20}}),(0,G.jsx)(qS,{sx:{transform:t?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`,fontSize:18,color:`text.secondary`}})]})]}),(0,G.jsx)(ey,{in:t,children:(0,G.jsx)(Z,{sx:{mt:1,maxHeight:200,overflow:`auto`},children:e.entities.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`baseline`,gap:.5,py:.3,borderBottom:`1px solid`,borderColor:`divider`},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{fontFamily:`monospace`,fontSize:`0.68rem`,minWidth:180,flexShrink:0,color:e.available?`text.primary`:`error.main`},noWrap:!0,children:e.entityId}),(0,G.jsx)(Z,{display:`flex`,gap:.3,flexWrap:`wrap`,children:e.matterClusters.map(e=>(0,G.jsx)(kv,{label:e,size:`small`,variant:`outlined`,sx:{fontSize:`0.58rem`,height:16,"& .MuiChip-label":{px:.5}}},e))})]},e.entityId))})})]})})}var dJe=()=>{let[e,t]=(0,C.useState)(`name`),[n,r]=(0,C.useState)(`asc`);return(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:3},children:[(0,G.jsx)(nJe,{sortField:e,sortDirection:n,onSortFieldChange:t,onSortDirectionChange:r}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(lJe,{sortField:e,sortDirection:n})}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(rJe,{})}),(0,G.jsx)(Z,{sx:{px:2,pb:2},children:(0,G.jsx)(oJe,{})}),(0,G.jsx)(Wb,{}),(0,G.jsx)(aJe,{})]})};async function fJe(){let e=await fetch(`api/matter/labels?_s=${Date.now()}`);return await I_(e,`Failed to fetch labels`),F_(e)}async function pJe(){let e=await fetch(`api/matter/areas?_s=${Date.now()}`);return await I_(e,`Failed to fetch areas`),F_(e)}async function mJe(){let e=await fetch(`api/matter/filter-values?_s=${Date.now()}`);return await I_(e,`Failed to fetch filter values`),F_(e)}var l4=({values:e,copiedId:t,onCopy:n,searchable:r})=>{let[i,a]=(0,C.useState)(``),o=(0,C.useMemo)(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,i]);return e.length===0?(0,G.jsx)(Z,{sx:{p:2,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`No values found.`})}):(0,G.jsxs)(Z,{children:[r&&e.length>10&&(0,G.jsx)(Z,{sx:{px:2,pt:1,pb:.5},children:(0,G.jsx)(SS,{size:`small`,fullWidth:!0,placeholder:`Search...`,value:i,onChange:e=>a(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(eF,{position:`start`,children:(0,G.jsx)(lE,{fontSize:`small`})})}}})}),(0,G.jsxs)(Z,{sx:{p:1.5,display:`flex`,flexWrap:`wrap`,gap:.75},children:[o.map(e=>(0,G.jsx)(kv,{label:e,size:`small`,variant:t===e?`filled`:`outlined`,color:t===e?`success`:`default`,onClick:()=>n(e),sx:{fontFamily:`monospace`,fontSize:`0.8rem`}},e)),i&&o.length===0&&(0,G.jsxs)(Q,{color:`text.secondary`,variant:`body2`,sx:{p:1},children:[`No matches for "`,i,`"`]})]})]})},hJe=()=>{let{t:e}=ms(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)([]),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(null),p=(0,C.useCallback)(async()=>{c(!0);try{let[e,t,r]=await Promise.all([fJe(),pJe(),mJe()]);n(e),i(t),o(r),u(null)}catch(t){u(t instanceof Error?t.message:e(`labels.loadFailed`))}finally{c(!1)}},[e]);(0,C.useEffect)(()=>{p()},[p]);let m=e=>{navigator.clipboard.writeText(e),f(e),setTimeout(()=>f(null),2e3)};return s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,sx:{mb:3},children:[(0,G.jsx)(vb,{sx:{mr:1,verticalAlign:`middle`}}),e(`labels.title`)]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:e(`labels.info`)}),l&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:l}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)($T,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.labelsSection`),` (`,t.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.labelsHint`)}),(0,G.jsx)(vv,{sx:{mb:4},children:t.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noLabels`)})}):(0,G.jsx)(lC,{children:(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.labelId`)}),(0,G.jsx)(cC,{width:48})]})}),(0,G.jsx)(sC,{children:t.map(t=>(0,G.jsxs)(mC,{hover:!0,children:[(0,G.jsxs)(cC,{children:[t.color&&(0,G.jsx)(Z,{component:`span`,sx:{display:`inline-block`,width:12,height:12,borderRadius:`50%`,backgroundColor:t.color,mr:1,verticalAlign:`middle`}}),t.name]}),(0,G.jsx)(cC,{children:(0,G.jsx)(`code`,{children:t.label_id})}),(0,G.jsx)(cC,{children:(0,G.jsx)(fb,{title:d===t.label_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.label_id),children:(0,G.jsx)(mb,{fontSize:`small`})})})})]},t.label_id))})]})})}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)(yT,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.areasSection`),` (`,r.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.areasHint`)}),(0,G.jsx)(vv,{sx:{mb:4},children:r.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noAreas`)})}):(0,G.jsx)(lC,{children:(0,G.jsxs)(iC,{size:`small`,children:[(0,G.jsx)(dC,{children:(0,G.jsxs)(mC,{children:[(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(cC,{sx:{fontWeight:`bold`},children:e(`labels.areaId`)}),(0,G.jsx)(cC,{width:48})]})}),(0,G.jsx)(sC,{children:r.map(t=>(0,G.jsxs)(mC,{hover:!0,children:[(0,G.jsx)(cC,{children:t.name}),(0,G.jsx)(cC,{children:(0,G.jsx)(`code`,{children:t.area_id})}),(0,G.jsx)(cC,{children:(0,G.jsx)(fb,{title:d===t.area_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.area_id),children:(0,G.jsx)(mb,{fontSize:`small`})})})})]},t.area_id))})]})})}),a&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:e(`labels.otherFilterValues`)}),(0,G.jsxs)(QS,{defaultExpanded:!0,children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)($he,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.domains`),` (`,a.domains.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.domainsHint`)}),(0,G.jsx)(l4,{values:a.domains,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(YT,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.platforms`),` (`,a.platforms.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.platformsHint`)}),(0,G.jsx)(l4,{values:a.platforms,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(WT,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.entityCategories`),` (`,a.entityCategories.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.entityCategoriesHint`)}),(0,G.jsx)(l4,{values:a.entityCategories,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(WT,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceClasses`),` (`,a.deviceClasses.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceClassesHint`)}),(0,G.jsx)(l4,{values:a.deviceClasses,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(hb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceNames`),` (`,a.deviceNames.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceNamesHint`)}),(0,G.jsx)(l4,{values:a.deviceNames,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(QS,{children:[(0,G.jsxs)(tC,{expandIcon:(0,G.jsx)(qS,{}),children:[(0,G.jsx)(hb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.productNames`),` (`,a.productNames.length,`)`]})]}),(0,G.jsxs)($S,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.productNamesHint`)}),(0,G.jsx)(l4,{values:a.productNames,copiedId:d,onCopy:m,searchable:!0})]})]})]})]})};async function gJe(){let e=await fetch(`api/lock-credentials`);return await I_(e,`Failed to fetch lock credentials`),F_(e)}async function _Je(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return await I_(n,`Failed to update lock credential`),F_(n)}async function vJe(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}/enabled`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:t})});return await I_(n,`Failed to toggle credential`),F_(n)}async function yJe(e){await I_(await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete lock credential`)}var bJe=({open:e,onClose:t,onSave:n,initialEntityId:r=``,initialName:i=``,isEdit:a=!1})=>{let{t:o}=ms(),[s,c]=(0,C.useState)(r),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(i),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{e&&(c(r),f(i),u(``),m(``))},[e,r,i]),(0,G.jsxs)(zb,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Hb,{children:o(a?`lockCredentials.editCredential`:`lockCredentials.addCredential`)}),(0,G.jsx)(Vb,{children:(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,mt:1},children:[p&&(0,G.jsx)(Uh,{severity:`error`,children:p}),(0,G.jsx)(SS,{label:o(`lockCredentials.lockEntityId`),placeholder:`lock.front_door`,value:s,onChange:e=>c(e.target.value),disabled:a,fullWidth:!0,helperText:o(`lockCredentials.lockEntityHelperText`)}),(0,G.jsx)(SS,{label:o(`lockCredentials.pinCode`),type:`password`,placeholder:`1234`,value:l,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,8)),fullWidth:!0,helperText:`4-8 digit PIN code for this lock`,inputProps:{inputMode:`numeric`,pattern:`[0-9]*`}}),(0,G.jsx)(SS,{label:o(`lockCredentials.nameOptional`),placeholder:o(`lockCredentials.namePlaceholder`),value:d,onChange:e=>f(e.target.value),fullWidth:!0,helperText:o(`lockCredentials.nameHelperText`)})]})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(_v,{onClick:t,disabled:h,children:o(`common.cancel`)}),(0,G.jsx)(_v,{onClick:async()=>{if(!s.trim()){m(o(`lockCredentials.entityRequired`));return}if(!l||l.length<4||l.length>8){m(o(`lockCredentials.pinLength`));return}if(!/^\d+$/.test(l)){m(o(`lockCredentials.pinDigitsOnly`));return}g(!0);try{await n(s.trim(),l,d.trim()),t()}catch(e){m(e instanceof Error?e.message:o(`lockCredentials.saveFailed`))}finally{g(!1)}},variant:`contained`,disabled:h,startIcon:h?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(cE,{}),children:o(`common.save`)})]})]})},xJe=()=>{let{t:e}=ms(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(!0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(null),d=(0,C.useCallback)(async()=>{i(!0);try{n((await gJe()).credentials),o(null)}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.loadFailed`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{d()},[d]);let f=async(e,t,n)=>{await _Je(e,{entityId:e,pinCode:t,name:n||void 0,enabled:!0}),await d()},[p,m]=(0,C.useState)(null),h=async t=>{m(null);try{await yJe(t),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.deleteFailed`))}},g=async t=>{try{await vJe(t.entityId,!t.enabled),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.updateFailed`))}},_=e=>{u(e),c(!0)},v=()=>{u(null),c(!0)};return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:3},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,children:[(0,G.jsx)(vT,{sx:{mr:1,verticalAlign:`middle`}}),e(`lockCredentials.title`)]}),(0,G.jsx)(_v,{variant:`contained`,startIcon:(0,G.jsx)(pb,{}),onClick:v,children:e(`lockCredentials.addCredential`)})]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:`Configure PIN codes for locks that require authentication for remote lock/unlock operations. The PIN will be sent with lock/unlock commands to Matter locks.`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:a}),r?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):t.length===0?(0,G.jsx)(vv,{children:(0,G.jsxs)(xv,{sx:{textAlign:`center`,py:4},children:[(0,G.jsx)(vT,{sx:{fontSize:48,color:`text.secondary`,mb:2}}),(0,G.jsx)(Q,{variant:`h6`,color:`text.secondary`,children:`No lock credentials configured`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:`Add a PIN code for your Matter locks to enable remote lock/unlock`}),(0,G.jsx)(_v,{variant:`outlined`,startIcon:(0,G.jsx)(pb,{}),onClick:v,children:`Add Your First Credential`})]})}):(0,G.jsx)(vv,{children:(0,G.jsx)(ny,{children:t.map((n,r)=>(0,G.jsxs)(ay,{divider:r<t.length-1,onClick:()=>_(n),sx:{cursor:`pointer`,"&:hover":{bgcolor:`action.hover`}},children:[(0,G.jsx)(sy,{children:(0,G.jsx)(vT,{color:n.enabled?`primary`:`disabled`})}),(0,G.jsx)(ly,{primary:n.name||n.entityId,secondary:(0,G.jsxs)(G.Fragment,{children:[n.name&&(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,children:n.entityId}),(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,sx:{ml:n.name?2:0},children:`PIN: ****`})]})}),(0,G.jsxs)(iy,{children:[(0,G.jsx)(fb,{title:n.enabled?e(`lockCredentials.disable`):e(`lockCredentials.enable`),children:(0,G.jsx)(US,{edge:`end`,checked:n.enabled,onChange:e=>{e.stopPropagation(),g(n)}})}),(0,G.jsx)(fb,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{edge:`end`,onClick:e=>{e.stopPropagation(),m(n.entityId)},sx:{ml:1},children:(0,G.jsx)(NS,{})})})]})]},n.entityId))})}),(0,G.jsx)(bJe,{open:s,onClose:()=>c(!1),onSave:f,initialEntityId:l?.entityId,initialName:l?.name,isEdit:!!l}),(0,G.jsx)(PT,{open:p!==null,title:e(`lockCredentials.confirmDeleteTitle`),message:e(`lockCredentials.confirmDeleteMessage`,{entity:p??``}),confirmLabel:e(`common.delete`),confirmColor:`error`,onConfirm:()=>{p&&h(p)},onCancel:()=>m(null)})]})},SJe=()=>{let e=Sr(),{t}=ms();return(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(Ghe,{color:`disabled`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:t(`notFound.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`notFound.description`)}),(0,G.jsx)(_v,{variant:`contained`,startIcon:(0,G.jsx)(ZT,{}),onClick:()=>e(Y9.dashboard),children:t(`notFound.backToDashboard`)})]})};function u4(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=u4(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var CJe={value:()=>{}};function d4(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new f4(n)}function f4(e){this._=e}function wJe(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}f4.prototype=d4.prototype={constructor:f4,on:function(e,t){var n=this._,r=wJe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=TJe(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=p4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=p4(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new f4(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function TJe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function p4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=CJe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var m4={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function h4(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),m4.hasOwnProperty(t)?{space:m4[t],local:e}:e}function EJe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function DJe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function g4(e){var t=h4(e);return(t.local?DJe:EJe)(t)}function OJe(){}function _4(e){return e==null?OJe:function(){return this.querySelector(e)}}function kJe(e){typeof e!=`function`&&(e=_4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new M4(r,this._parents)}function AJe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function jJe(){return[]}function v4(e){return e==null?jJe:function(){return this.querySelectorAll(e)}}function MJe(e){return function(){return AJe(e.apply(this,arguments))}}function NJe(e){e=typeof e==`function`?MJe(e):v4(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new M4(r,i)}function y4(e){return function(){return this.matches(e)}}function b4(e){return function(t){return t.matches(e)}}var PJe=Array.prototype.find;function FJe(e){return function(){return PJe.call(this.children,e)}}function IJe(){return this.firstElementChild}function LJe(e){return this.select(e==null?IJe:FJe(typeof e==`function`?e:b4(e)))}var RJe=Array.prototype.filter;function zJe(){return Array.from(this.children)}function BJe(e){return function(){return RJe.call(this.children,e)}}function VJe(e){return this.selectAll(e==null?zJe:BJe(typeof e==`function`?e:b4(e)))}function HJe(e){typeof e!=`function`&&(e=y4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new M4(r,this._parents)}function x4(e){return Array(e.length)}function UJe(){return new M4(this._enter||this._groups.map(x4),this._parents)}function S4(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}S4.prototype={constructor:S4,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function WJe(e){return function(){return e}}function GJe(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new S4(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function KJe(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new S4(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function qJe(e){return e.__data__}function JJe(e,t){if(!arguments.length)return Array.from(this,qJe);var n=t?KJe:GJe,r=this._parents,i=this._groups;typeof e!=`function`&&(e=WJe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=YJe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new M4(o,r),o._enter=s,o._exit=c,o}function YJe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function XJe(){return new M4(this._exit||this._groups.map(x4),this._parents)}function ZJe(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function QJe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new M4(s,this._parents)}function $Je(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function eYe(e){e||=tYe;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new M4(i,this._parents).order()}function tYe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nYe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rYe(){return Array.from(this)}function iYe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function aYe(){let e=0;for(let t of this)++e;return e}function oYe(){return!this.node()}function sYe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function cYe(e){return function(){this.removeAttribute(e)}}function lYe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uYe(e,t){return function(){this.setAttribute(e,t)}}function dYe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function pYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function mYe(e,t){var n=h4(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?lYe:cYe:typeof t==`function`?n.local?pYe:fYe:n.local?dYe:uYe)(n,t))}function C4(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hYe(e){return function(){this.style.removeProperty(e)}}function gYe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function _Ye(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function vYe(e,t,n){return arguments.length>1?this.each((t==null?hYe:typeof t==`function`?_Ye:gYe)(e,t,n??``)):w4(this.node(),e)}function w4(e,t){return e.style.getPropertyValue(t)||C4(e).getComputedStyle(e,null).getPropertyValue(t)}function yYe(e){return function(){delete this[e]}}function bYe(e,t){return function(){this[e]=t}}function xYe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function SYe(e,t){return arguments.length>1?this.each((t==null?yYe:typeof t==`function`?xYe:bYe)(e,t)):this.node()[e]}function T4(e){return e.trim().split(/^|\s+/)}function E4(e){return e.classList||new D4(e)}function D4(e){this._node=e,this._names=T4(e.getAttribute(`class`)||``)}D4.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function O4(e,t){for(var n=E4(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function k4(e,t){for(var n=E4(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function CYe(e){return function(){O4(this,e)}}function wYe(e){return function(){k4(this,e)}}function TYe(e,t){return function(){(t.apply(this,arguments)?O4:k4)(this,e)}}function EYe(e,t){var n=T4(e+``);if(arguments.length<2){for(var r=E4(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?TYe:t?CYe:wYe)(n,t))}function DYe(){this.textContent=``}function OYe(e){return function(){this.textContent=e}}function kYe(e){return function(){this.textContent=e.apply(this,arguments)??``}}function AYe(e){return arguments.length?this.each(e==null?DYe:(typeof e==`function`?kYe:OYe)(e)):this.node().textContent}function jYe(){this.innerHTML=``}function MYe(e){return function(){this.innerHTML=e}}function NYe(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function PYe(e){return arguments.length?this.each(e==null?jYe:(typeof e==`function`?NYe:MYe)(e)):this.node().innerHTML}function FYe(){this.nextSibling&&this.parentNode.appendChild(this)}function IYe(){return this.each(FYe)}function LYe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function RYe(){return this.each(LYe)}function zYe(e){var t=typeof e==`function`?e:g4(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function BYe(){return null}function VYe(e,t){var n=typeof e==`function`?e:g4(e),r=t==null?BYe:typeof t==`function`?t:_4(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function HYe(){var e=this.parentNode;e&&e.removeChild(this)}function UYe(){return this.each(HYe)}function WYe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function GYe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function KYe(e){return this.select(e?GYe:WYe)}function qYe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function JYe(e){return function(t){e.call(this,t,this.__data__)}}function YYe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function XYe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ZYe(e,t,n){return function(){var r=this.__on,i,a=JYe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function QYe(e,t,n){var r=YYe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ZYe:XYe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function A4(e,t,n){var r=C4(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function $Ye(e,t){return function(){return A4(this,e,t)}}function eXe(e,t){return function(){return A4(this,e,t.apply(this,arguments))}}function tXe(e,t){return this.each((typeof t==`function`?eXe:$Ye)(e,t))}function*nXe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var j4=[null];function M4(e,t){this._groups=e,this._parents=t}function N4(){return new M4([[document.documentElement]],j4)}function rXe(){return this}M4.prototype=N4.prototype={constructor:M4,select:kJe,selectAll:NJe,selectChild:LJe,selectChildren:VJe,filter:HJe,data:JJe,enter:UJe,exit:XJe,join:ZJe,merge:QJe,selection:rXe,order:$Je,sort:eYe,call:nYe,nodes:rYe,node:iYe,size:aYe,empty:oYe,each:sYe,attr:mYe,style:vYe,property:SYe,classed:EYe,text:AYe,html:PYe,raise:IYe,lower:RYe,append:zYe,insert:VYe,remove:UYe,clone:KYe,datum:qYe,on:QYe,dispatch:tXe,[Symbol.iterator]:nXe};function P4(e){return typeof e==`string`?new M4([[document.querySelector(e)]],[document.documentElement]):new M4([[e]],j4)}function iXe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function F4(e,t){if(e=iXe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var aXe={passive:!1},I4={capture:!0,passive:!1};function L4(e){e.stopImmediatePropagation()}function R4(e){e.preventDefault(),e.stopImmediatePropagation()}function z4(e){var t=e.document.documentElement,n=P4(e).on(`dragstart.drag`,R4,I4);`onselectstart`in t?n.on(`selectstart.drag`,R4,I4):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function B4(e,t){var n=e.document.documentElement,r=P4(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,R4,I4),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var V4=e=>()=>e;function H4(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}H4.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function oXe(e){return!e.ctrlKey&&!e.button}function sXe(){return this.parentNode}function cXe(e,t){return t??{x:e.x,y:e.y}}function lXe(){return navigator.maxTouchPoints||`ontouchstart`in this}function U4(){var e=oXe,t=sXe,n=cXe,r=lXe,i={},a=d4(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,aXe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(P4(n.view).on(`mousemove.drag`,m,I4).on(`mouseup.drag`,h,I4),z4(n.view),L4(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(R4(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){P4(e.view).on(`mousemove.drag mouseup.drag`,null),B4(e.view,l),R4(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(L4(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(R4(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(L4(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=F4(l||r,t),p,m,h;if((h=n.call(e,new H4(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=F4(l||a,t),_=o;break}u.call(r,e,new H4(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:V4(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:V4(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:V4(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:V4(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function W4(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function G4(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function K4(){}var q4=.7,J4=1/q4,Y4=`\\s*([+-]?\\d+)\\s*`,X4=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Z4=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,uXe=/^#([0-9a-f]{3,8})$/,dXe=RegExp(`^rgb\\(${Y4},${Y4},${Y4}\\)$`),fXe=RegExp(`^rgb\\(${Z4},${Z4},${Z4}\\)$`),pXe=RegExp(`^rgba\\(${Y4},${Y4},${Y4},${X4}\\)$`),mXe=RegExp(`^rgba\\(${Z4},${Z4},${Z4},${X4}\\)$`),hXe=RegExp(`^hsl\\(${X4},${Z4},${Z4}\\)$`),gXe=RegExp(`^hsla\\(${X4},${Z4},${Z4},${X4}\\)$`),Q4={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};W4(K4,t3,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$4,formatHex:$4,formatHex8:_Xe,formatHsl:vXe,formatRgb:e3,toString:e3});function $4(){return this.rgb().formatHex()}function _Xe(){return this.rgb().formatHex8()}function vXe(){return f3(this).formatHsl()}function e3(){return this.rgb().formatRgb()}function t3(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=uXe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?n3(t):n===3?new a3(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?r3(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?r3(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dXe.exec(e))?new a3(t[1],t[2],t[3],1):(t=fXe.exec(e))?new a3(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pXe.exec(e))?r3(t[1],t[2],t[3],t[4]):(t=mXe.exec(e))?r3(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hXe.exec(e))?d3(t[1],t[2]/100,t[3]/100,1):(t=gXe.exec(e))?d3(t[1],t[2]/100,t[3]/100,t[4]):Q4.hasOwnProperty(e)?n3(Q4[e]):e===`transparent`?new a3(NaN,NaN,NaN,0):null}function n3(e){return new a3(e>>16&255,e>>8&255,e&255,1)}function r3(e,t,n,r){return r<=0&&(e=t=n=NaN),new a3(e,t,n,r)}function yXe(e){return e instanceof K4||(e=t3(e)),e?(e=e.rgb(),new a3(e.r,e.g,e.b,e.opacity)):new a3}function i3(e,t,n,r){return arguments.length===1?yXe(e):new a3(e,t,n,r??1)}function a3(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}W4(a3,i3,G4(K4,{brighter(e){return e=e==null?J4:J4**+e,new a3(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?q4:q4**+e,new a3(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new a3(l3(this.r),l3(this.g),l3(this.b),c3(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:o3,formatHex:o3,formatHex8:bXe,formatRgb:s3,toString:s3}));function o3(){return`#${u3(this.r)}${u3(this.g)}${u3(this.b)}`}function bXe(){return`#${u3(this.r)}${u3(this.g)}${u3(this.b)}${u3((isNaN(this.opacity)?1:this.opacity)*255)}`}function s3(){let e=c3(this.opacity);return`${e===1?`rgb(`:`rgba(`}${l3(this.r)}, ${l3(this.g)}, ${l3(this.b)}${e===1?`)`:`, ${e})`}`}function c3(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function l3(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function u3(e){return e=l3(e),(e<16?`0`:``)+e.toString(16)}function d3(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new p3(e,t,n,r)}function f3(e){if(e instanceof p3)return new p3(e.h,e.s,e.l,e.opacity);if(e instanceof K4||(e=t3(e)),!e)return new p3;if(e instanceof p3)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new p3(o,s,c,e.opacity)}function xXe(e,t,n,r){return arguments.length===1?f3(e):new p3(e,t,n,r??1)}function p3(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}W4(p3,xXe,G4(K4,{brighter(e){return e=e==null?J4:J4**+e,new p3(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?q4:q4**+e,new p3(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new a3(g3(e>=240?e-240:e+120,i,r),g3(e,i,r),g3(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new p3(m3(this.h),h3(this.s),h3(this.l),c3(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=c3(this.opacity);return`${e===1?`hsl(`:`hsla(`}${m3(this.h)}, ${h3(this.s)*100}%, ${h3(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function m3(e){return e=(e||0)%360,e<0?e+360:e}function h3(e){return Math.max(0,Math.min(1,e||0))}function g3(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var _3=e=>()=>e;function SXe(e,t){return function(n){return e+n*t}}function CXe(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function wXe(e){return(e=+e)==1?v3:function(t,n){return n-t?CXe(t,n,e):_3(isNaN(t)?n:t)}}function v3(e,t){var n=t-e;return n?SXe(e,n):_3(isNaN(e)?t:e)}var y3=(function e(t){var n=wXe(t);function r(e,t){var r=n((e=i3(e)).r,(t=i3(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=v3(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function TXe(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function EXe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function DXe(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=w3(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function OXe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function b3(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function kXe(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=w3(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var x3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,S3=new RegExp(x3.source,`g`);function AXe(e){return function(){return e}}function jXe(e){return function(t){return e(t)+``}}function C3(e,t){var n=x3.lastIndex=S3.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=x3.exec(e))&&(i=S3.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:b3(r,i)})),n=S3.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?jXe(c[0].x):AXe(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function w3(e,t){var n=typeof t,r;return t==null||n===`boolean`?_3(t):(n===`number`?b3:n===`string`?(r=t3(t))?(t=r,y3):C3:t instanceof t3?y3:t instanceof Date?OXe:EXe(t)?TXe:Array.isArray(t)?DXe:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?kXe:b3)(e,t)}var T3=180/Math.PI,E3={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function D3(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*T3,skewX:Math.atan(c)*T3,scaleX:o,scaleY:s}}var O3;function MXe(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?E3:D3(t.a,t.b,t.c,t.d,t.e,t.f)}function NXe(e){return e==null||(O3||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),O3.setAttribute(`transform`,e),!(e=O3.transform.baseVal.consolidate()))?E3:(e=e.matrix,D3(e.a,e.b,e.c,e.d,e.e,e.f))}function k3(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:b3(e,i)},{i:c-2,x:b3(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:b3(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:b3(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:b3(e,n)},{i:s-2,x:b3(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var PXe=k3(MXe,`px, `,`px)`,`deg)`),FXe=k3(NXe,`, `,`)`,`)`),IXe=1e-12;function A3(e){return((e=Math.exp(e))+1/e)/2}function LXe(e){return((e=Math.exp(e))-1/e)/2}function RXe(e){return((e=Math.exp(2*e))-1)/(e+1)}var j3=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<IXe)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=A3(y),c=s/(n*g)*(i*RXe(t*r+y)-LXe(y));return[a+c*d,o+c*f,s*i/A3(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),M3=0,N3=0,P3=0,F3=1e3,I3,L3,R3=0,z3=0,B3=0,V3=typeof performance==`object`&&performance.now?performance:Date,H3=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function U3(){return z3||=(H3(zXe),V3.now()+B3)}function zXe(){z3=0}function W3(){this._call=this._time=this._next=null}W3.prototype=G3.prototype={constructor:W3,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?U3():+n)+(t==null?0:+t),!this._next&&L3!==this&&(L3?L3._next=this:I3=this,L3=this),this._call=e,this._time=n,q3()},stop:function(){this._call&&(this._call=null,this._time=1/0,q3())}};function G3(e,t,n){var r=new W3;return r.restart(e,t,n),r}function BXe(){U3(),++M3;for(var e=I3,t;e;)(t=z3-e._time)>=0&&e._call.call(void 0,t),e=e._next;--M3}function K3(){z3=(R3=V3.now())+B3,M3=N3=0;try{BXe()}finally{M3=0,HXe(),z3=0}}function VXe(){var e=V3.now(),t=e-R3;t>F3&&(B3-=t,R3=e)}function HXe(){for(var e,t=I3,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:I3=n);L3=e,q3(r)}function q3(e){M3||(N3&&=clearTimeout(N3),e-z3>24?(e<1/0&&(N3=setTimeout(K3,e-V3.now()-B3)),P3&&=clearInterval(P3)):(P3||=(R3=V3.now(),setInterval(VXe,F3)),M3=1,H3(K3)))}function J3(e,t,n){var r=new W3;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var UXe=d4(`start`,`end`,`cancel`,`interrupt`),WXe=[];function Y3(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;GXe(e,n,{name:t,index:r,group:i,on:UXe,tween:WXe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function X3(e,t){var n=Q3(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Z3(e,t){var n=Q3(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Q3(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function GXe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=G3(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return J3(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(J3(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function $3(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function KXe(e){return this.each(function(){$3(this,e)})}function qXe(e,t){var n,r;return function(){var i=Z3(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function JXe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Z3(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function YXe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=Q3(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?qXe:JXe)(n,e,t))}function e6(e,t,n){var r=e._id;return e.each(function(){var e=Z3(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return Q3(e,r).value[t]}}function t6(e,t){var n;return(typeof t==`number`?b3:t instanceof t3?y3:(n=t3(t))?(t=n,y3):C3)(e,t)}function XXe(e){return function(){this.removeAttribute(e)}}function ZXe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function QXe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function $Xe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function eZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function tZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function nZe(e,t){var n=h4(e),r=n===`transform`?FXe:t6;return this.attrTween(e,typeof t==`function`?(n.local?tZe:eZe)(n,r,e6(this,`attr.`+e,t)):t==null?(n.local?ZXe:XXe)(n):(n.local?$Xe:QXe)(n,r,t))}function rZe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function iZe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function aZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&iZe(e,i)),n}return i._value=t,i}function oZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&rZe(e,i)),n}return i._value=t,i}function sZe(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=h4(e);return this.tween(n,(r.local?aZe:oZe)(r,t))}function cZe(e,t){return function(){X3(this,e).delay=+t.apply(this,arguments)}}function lZe(e,t){return t=+t,function(){X3(this,e).delay=t}}function uZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?cZe:lZe)(t,e)):Q3(this.node(),t).delay}function dZe(e,t){return function(){Z3(this,e).duration=+t.apply(this,arguments)}}function fZe(e,t){return t=+t,function(){Z3(this,e).duration=t}}function pZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?dZe:fZe)(t,e)):Q3(this.node(),t).duration}function mZe(e,t){if(typeof t!=`function`)throw Error();return function(){Z3(this,e).ease=t}}function hZe(e){var t=this._id;return arguments.length?this.each(mZe(t,e)):Q3(this.node(),t).ease}function gZe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Z3(this,e).ease=n}}function _Ze(e){if(typeof e!=`function`)throw Error();return this.each(gZe(this._id,e))}function vZe(e){typeof e!=`function`&&(e=y4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new r6(r,this._parents,this._name,this._id)}function yZe(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new r6(o,this._parents,this._name,this._id)}function bZe(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function xZe(e,t,n){var r,i,a=bZe(t)?X3:Z3;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function SZe(e,t){var n=this._id;return arguments.length<2?Q3(this.node(),n).on.on(e):this.each(xZe(n,e,t))}function CZe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function wZe(){return this.on(`end.remove`,CZe(this._id))}function TZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=_4(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Y3(l[f],t,n,f,l,Q3(u,n)));return new r6(a,this._parents,t,n)}function EZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=v4(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=Q3(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Y3(p,t,n,h,f,m);a.push(f),o.push(u)}return new r6(a,o,t,n)}var DZe=N4.prototype.constructor;function OZe(){return new DZe(this._groups,this._parents)}function kZe(e,t){var n,r,i;return function(){var a=w4(this,e),o=(this.style.removeProperty(e),w4(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function n6(e){return function(){this.style.removeProperty(e)}}function AZe(e,t,n){var r,i=n+``,a;return function(){var o=w4(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function jZe(e,t,n){var r,i,a;return function(){var o=w4(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),w4(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function MZe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Z3(this,e),l=c.on,u=c.value[a]==null?s||=n6(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function NZe(e,t,n){var r=(e+=``)==`transform`?PXe:t6;return t==null?this.styleTween(e,kZe(e,r)).on(`end.style.`+e,n6(e)):typeof t==`function`?this.styleTween(e,jZe(e,r,e6(this,`style.`+e,t))).each(MZe(this._id,e)):this.styleTween(e,AZe(e,r,t),n).on(`end.style.`+e,null)}function PZe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function FZe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&PZe(e,a,n)),r}return a._value=t,a}function IZe(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,FZe(e,t,n??``))}function LZe(e){return function(){this.textContent=e}}function RZe(e){return function(){this.textContent=e(this)??``}}function zZe(e){return this.tween(`text`,typeof e==`function`?RZe(e6(this,`text`,e)):LZe(e==null?``:e+``))}function BZe(e){return function(t){this.textContent=e.call(this,t)}}function VZe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&BZe(r)),t}return r._value=e,r}function HZe(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,VZe(e))}function UZe(){for(var e=this._name,t=this._id,n=i6(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=Q3(c,t);Y3(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new r6(r,this._parents,e,n)}function WZe(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=Z3(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var GZe=0;function r6(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function KZe(e){return N4().transition(e)}function i6(){return++GZe}var a6=N4.prototype;r6.prototype=KZe.prototype={constructor:r6,select:TZe,selectAll:EZe,selectChild:a6.selectChild,selectChildren:a6.selectChildren,filter:vZe,merge:yZe,selection:OZe,transition:UZe,call:a6.call,nodes:a6.nodes,node:a6.node,size:a6.size,empty:a6.empty,each:a6.each,on:SZe,attr:nZe,attrTween:sZe,style:NZe,styleTween:IZe,text:zZe,textTween:HZe,remove:wZe,tween:YXe,delay:uZe,duration:pZe,ease:hZe,easeVarying:_Ze,end:WZe,[Symbol.iterator]:a6[Symbol.iterator]};function qZe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var JZe={time:null,delay:0,duration:250,ease:qZe};function YZe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function XZe(e){var t,n;e instanceof r6?(t=e._id,e=e._name):(t=i6(),(n=JZe).time=U3(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Y3(c,e,t,l,o,n||YZe(c,t));return new r6(r,this._parents,e,t)}N4.prototype.interrupt=KXe,N4.prototype.transition=XZe;var o6=e=>()=>e;function ZZe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function s6(e,t,n){this.k=e,this.x=t,this.y=n}s6.prototype={constructor:s6,scale:function(e){return e===1?this:new s6(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new s6(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var c6=new s6(1,0,0);l6.prototype=s6.prototype;function l6(e){for(;!e.__zoom;)if(!(e=e.parentNode))return c6;return e.__zoom}function u6(e){e.stopImmediatePropagation()}function d6(e){e.preventDefault(),e.stopImmediatePropagation()}function QZe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function $Ze(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function f6(){return this.__zoom||c6}function eQe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tQe(){return navigator.maxTouchPoints||`ontouchstart`in this}function nQe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function p6(){var e=QZe,t=$Ze,n=nQe,r=eQe,i=tQe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=j3,l=d4(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,f6).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,f6),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(c6.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new s6(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new s6(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new s6(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=P4(this.that).datum();l.call(e,this.that,new ZZe(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=F4(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],$3(this),s.start();d6(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=P4(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=F4(t,i),l=t.clientX,u=t.clientY;z4(t.view),u6(t),a.mouse=[c,this.__zoom.invert(c)],$3(this),a.start();function d(e){if(d6(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=F4(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),B4(e.view,a.moved),d6(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=F4(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);d6(r),s>0?P4(this).transition().duration(s).call(x,d,c,r):P4(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(u6(t),s=0;s<i;++s)c=r[s],l=F4(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),$3(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(d6(e),s=0;s<a;++s)c=i[s],l=F4(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(u6(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=F4(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=P4(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:o6(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:o6(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:o6(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:o6([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var m6={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`},h6=[[-1/0,-1/0],[1/0,1/0]],g6=[`Enter`,` `,`Escape`],_6={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},v6;(function(e){e.Strict=`strict`,e.Loose=`loose`})(v6||={});var y6;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(y6||={});var b6;(function(e){e.Partial=`partial`,e.Full=`full`})(b6||={});var x6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},S6;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(S6||={});var C6;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(C6||={});var w6;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(w6||={});var T6={[w6.Left]:w6.Right,[w6.Right]:w6.Left,[w6.Top]:w6.Bottom,[w6.Bottom]:w6.Top};function E6(e){return e===null?null:e?`valid`:`invalid`}var D6=e=>`id`in e&&`source`in e&&`target`in e,rQe=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),O6=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),k6=(e,t=[0,0])=>{let{width:n,height:r}=e8(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},iQe=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:B6(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):O6(n)?n:t.nodeLookup.get(n.id)),R6(e,i?H6(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),A6=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=R6(n,H6(e)),r=!0)}),r?B6(n):{x:0,y:0,width:0,height:0}},j6=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...J6(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=W6(s,V6(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},aQe=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function oQe(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function sQe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=Z6(A6(oQe(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function M6({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,m6.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&$6(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=$6(d)?P6(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,m6.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function cQe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=aQe(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var N6=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),P6=(e={x:0,y:0},t,n)=>({x:N6(e.x,t[0][0],t[1][0]-(n?.width??0)),y:N6(e.y,t[0][1],t[1][1]-(n?.height??0))});function F6(e,t,n){let{width:r,height:i}=e8(n),{x:a,y:o}=n.internals.positionAbsolute;return P6(e,[[a,o],[a+r,o+i]],t)}var I6=(e,t,n)=>e<t?N6(Math.abs(e-t),1,t)/t:e>n?-N6(Math.abs(e-n),1,t)/t:0,L6=(e,t,n=15,r=40)=>[I6(e.x,r,t.width-r)*n,I6(e.y,r,t.height-r)*n],R6=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),z6=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),B6=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),V6=(e,t=[0,0])=>{let{x:n,y:r}=O6(e)?e.internals.positionAbsolute:k6(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},H6=(e,t=[0,0])=>{let{x:n,y:r}=O6(e)?e.internals.positionAbsolute:k6(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},U6=(e,t)=>B6(R6(z6(e),z6(t))),W6=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},G6=e=>K6(e.width)&&K6(e.height)&&K6(e.x)&&K6(e.y),K6=e=>!isNaN(e)&&isFinite(e),lQe=(e,t)=>{},q6=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),J6=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?q6(s,o):s},Y6=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function X6(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function uQe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=X6(e,n),i=X6(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=X6(e.top??e.y??0,n),i=X6(e.bottom??e.y??0,n),a=X6(e.left??e.x??0,t),o=X6(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function dQe(e,t,n,r,i,a){let{x:o,y:s}=Y6(e,[t,n,r]),{x:c,y:l}=Y6({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Z6=(e,t,n,r,i,a)=>{let o=uQe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=N6(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=dQe(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Q6=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function $6(e){return e!=null&&e!==`parent`}function e8(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function t8(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function n8(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function r8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function fQe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function pQe(e){return{..._6,...e||{}}}function i8(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=l8(e),s=J6({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?q6(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var a8=e=>({width:e.offsetWidth,height:e.offsetHeight}),o8=e=>e?.getRootNode?.()||window?.document,mQe=[`INPUT`,`SELECT`,`TEXTAREA`];function s8(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?mQe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var c8=e=>`clientX`in e,l8=(e,t)=>{let n=c8(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},u8=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...a8(t)}})};function d8({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function f8(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function p8({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case w6.Left:return[t-f8(t-r,a),n];case w6.Right:return[t+f8(r-t,a),n];case w6.Top:return[t,n-f8(n-i,a)];case w6.Bottom:return[t,n+f8(i-n,a)]}}function m8({sourceX:e,sourceY:t,sourcePosition:n=w6.Bottom,targetX:r,targetY:i,targetPosition:a=w6.Top,curvature:o=.25}){let[s,c]=p8({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=p8({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=d8({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function h8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function hQe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function gQe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=R6(H6(e),H6(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),W6({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},B6(a))>0}var _Qe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,vQe=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),yQe=(e,t,n={})=>{if(!e.source||!e.target)return m6.error006(),t;let r=n.getEdgeId||_Qe,i;return i=D6(e)?{...e}:{...e,id:r(e)},vQe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function g8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=h8({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var _8={[w6.Left]:{x:-1,y:0},[w6.Right]:{x:1,y:0},[w6.Top]:{x:0,y:-1},[w6.Bottom]:{x:0,y:1}},bQe=({source:e,sourcePosition:t=w6.Bottom,target:n})=>t===w6.Left||t===w6.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},v8=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function xQe({source:e,sourcePosition:t=w6.Bottom,target:n,targetPosition:r=w6.Top,center:i,offset:a,stepPosition:o}){let s=_8[t],c=_8[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=bQe({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=h8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function SQe(e,t,n,r){let i=Math.min(v8(e,t)/2,v8(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function y8({sourceX:e,sourceY:t,sourcePosition:n=w6.Bottom,targetX:r,targetY:i,targetPosition:a=w6.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=xQe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=SQe(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function b8(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function CQe(e){let{sourceNode:t,targetNode:n}=e;if(!b8(t)||!b8(n))return null;let r=t.internals.handleBounds||x8(t.handles),i=n.internals.handleBounds||x8(n.handles),a=C8(r?.source??[],e.sourceHandle),o=C8(e.connectionMode===v6.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,m6.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||w6.Bottom,c=o?.position||w6.Top,l=S8(t,a,s),u=S8(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function x8(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function S8(e,t,n=w6.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??e8(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case w6.Top:return{x:i+o/2,y:a};case w6.Right:return{x:i+o,y:a+s/2};case w6.Bottom:return{x:i+o/2,y:a+s};case w6.Left:return{x:i,y:a+s/2}}}function C8(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function w8(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function wQe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=w8(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var T8=1e3,TQe=10,E8={nodeOrigin:[0,0],nodeExtent:h6,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},EQe={...E8,checkEquality:!0};function D8(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function DQe(e,t,n){let r=D8(E8,n);for(let n of e.values())if(n.parentId)A8(n,e,t,r);else{let e=P6(k6(n,r.nodeOrigin),$6(n.extent)?n.extent:r.nodeExtent,e8(n));n.internals.positionAbsolute=e}}function OQe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function O8(e){return e===`manual`}function k8(e,t,n,r={}){let i=D8(EQe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!O8(i.zIndexMode)?T8:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=P6(k6(u,i.nodeOrigin),$6(u.extent)?u.extent:i.nodeExtent,e8(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:OQe(u,e),z:j8(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&A8(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function kQe(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function A8(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=D8(E8,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}kQe(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*TQe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=AQe(e,u,o,s,a&&!O8(c)?T8:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function j8(e,t,n){let r=K6(e.zIndex)?e.zIndex:0;return O8(n)?r:r+(e.selected?t:0)}function AQe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=e8(e),l=k6(e,n),u=$6(e.extent)?P6(l,e.extent,c):l,d=P6({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=F6(d,c,t));let f=j8(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function M8(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=U6(a.get(n.parentId)?.expandedRect??V6(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=e8(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function jQe(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=a8(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=$6(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=F6(h,s,t.get(e.parentId)):m&&(h=P6(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:u8(`source`,r.nodeElement,p,d,e.id),target:u8(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&A8(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:V6(g,i)}))}}if(f.length>0){let e=M8(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function MQe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r),s=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(s)}function N8(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function P8(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;N8(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),N8(`target`,s,c,e,i,o),t.set(r.id,r)}}function F8(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:F8(n,t):!1}function I8(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function NQe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!F8(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function L8({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function PQe({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=q6(a,t);return{x:o.x-a.x,y:o.y-a.y}}function FQe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=P4(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?z6(A6(s)):null,x=v&&l?PQe({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:q6(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=M6({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=L8({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=L6(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=i8(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=NQe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=L8({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=U4().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=i8(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=l8(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=i8(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=l8(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=l8(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!(!d||p)&&(c=!1,d=!1,cancelAnimationFrame(o),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=L8({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!I8(t,`.${g}`,v))&&(!_||I8(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function IQe(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())W6(i,V6(e))>0&&r.push(e);return r}var LQe=250;function RQe(e,t,n,r){let i=[],a=1/0,o=IQe(e,n,t+LQe);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=S8(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function R8(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...S8(o,c,c.position,!0)}:c}function z8(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function zQe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var B8=()=>!0;function BQe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=B8,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=o8(e.target),E=0,D,{x:O,y:k}=l8(e),A=z8(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=R8(i,A,r,c,t);if(!N)return;let P=l8(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=L6(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(ee)}let z={...N,nodeId:i,type:A,position:N.position},te=c.get(i),B={inProgress:!0,isValid:null,from:S8(te,z,w6.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:te,to:P,toHandle:null,toPosition:T6[z.position],toNode:null,pointer:P};function V(){M=!0,y(B),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&V();function ne(e){if(!M){let{x:t,y:n}=l8(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;V()}if(!x()||!z){re(e);return}let a=b();P=l8(e,j),D=RQe(J6(P,a,!1,[1,1]),n,c,z),F||=(ee(),!0);let s=V8(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=zQe(!!D,s.isValid);let u=c.get(i),f=u?S8(u,z,w6.Left,!0):B.from,p={...B,from:f,isValid:L,to:s.toHandle&&L?Y6({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:T6[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),B=p}function re(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=B,r={...n,toPosition:B.toHandle?B.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ne),T.removeEventListener(`mouseup`,re),T.removeEventListener(`touchmove`,ne),T.removeEventListener(`touchend`,re)}}T.addEventListener(`mousemove`,ne),T.addEventListener(`mouseup`,re),T.addEventListener(`touchmove`,ne),T.addEventListener(`touchend`,re)}function V8(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=B8,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=l8(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=z8(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===v6.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=R8(t,e,a,u,n,!0)}return _}var H8={onPointerDown:BQe,isValid:V8};function VQe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=P4(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Q6()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=p6().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:F4}}var U8=e=>({x:e.x,y:e.y,zoom:e.k}),W8=({x:e,y:t,zoom:n})=>c6.translate(e,t).scale(n),G8=(e,t)=>e.target.closest(`.${t}`),K8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),HQe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,q8=(e,t=0,n=HQe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},J8=e=>{let t=e.ctrlKey&&Q6()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function UQe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(G8(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=F4(u),t=d*2**J8(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===y6.Vertical?0:u.deltaX*f,m=i===y6.Horizontal?0:u.deltaY*f;!Q6()&&u.shiftKey&&i!==y6.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=U8(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function WQe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=G8(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function GQe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=U8(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function KQe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&K8(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,U8(a.transform))}}function qQe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&K8(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=U8(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function JQe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(G8(d,`${l}-flow__node`)||G8(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||G8(d,s)&&m||G8(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function YQe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=p6().scaleExtent([t,n]).translateExtent(r),f=P4(e).call(d);v({x:i.x,y:i.y,zoom:N6(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(J8);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?w3:j3).transform(q8(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!K6(E)||E<0?0:E);let k=O?UQe({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):WQe({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=GQe({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=KQe({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=qQe({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=JQe({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(A),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=W8(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=W8(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=W8(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?l6(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?w3:j3).scaleTo(q8(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?w3:j3).scaleBy(q8(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!K6(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var Y8;(function(e){e.Line=`line`,e.Handle=`handle`})(Y8||={});function XQe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function X8(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function Z8(e,t){return Math.max(0,t-e)}function Q8(e,t){return Math.max(0,e-t)}function $8(e,t,n){return Math.max(0,t-e,e-n)}function e5(e,t){return e?!t:t}function ZQe(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=$8(E,h,g),j=$8(D,_,v);if(o){let e=0,t=0;c&&w<0?e=Z8(y+w+O,o[0][0]):!c&&w>0&&(e=Q8(y+E+O,o[1][0])),l&&T<0?t=Z8(b+T+k,o[0][1]):!l&&T>0&&(t=Q8(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Q8(y+w,s[0][0]):!c&&w<0&&(e=Z8(y+E,s[1][0])),l&&T>0?t=Q8(b+T,s[0][1]):!l&&T<0&&(t=Z8(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=$8(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Q8(b+k+E/C,o[1][1])*C:Z8(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?Z8(b+E/C,s[1][1])*C:Q8(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=$8(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Q8(y+D*C+O,o[1][0])/C:Z8(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?Z8(y+D*C,s[1][0])/C:Q8(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(e5(c,l)?-w:w)/C:w=(e5(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var t5={width:0,height:0,x:0,y:0},QQe={...t5,pointerX:0,pointerY:0,aspectRatio:1};function $Qe(e){return[[0,0],[e.measured.width,e.measured.height]]}function e$e(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function t$e({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=P4(e),o={controlDirection:X8(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...t5},h={...QQe};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:X8(e)};let g,_=null,v=[],y,b,x,S=!1,C=U4().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=i8(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId),b=y&&g.extent===`parent`?$Qe(y):void 0),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=e$e(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=i8(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=ZQe(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=XQe({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var n5=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},n$e=e=>e?n5(e):n5,{useDebugValue:r$e}=C.default,{useSyncExternalStoreWithSelector:i$e}=zC.default,a$e=e=>e;function r5(e,t=a$e,n){let r=i$e(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return r$e(r),r}var i5=(e,t)=>{let n=n$e(e),r=(e,r=t)=>r5(n,e,r);return Object.assign(r,n),r},o$e=(e,t)=>e?i5(e,t):i5;function a5(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var o5=(0,C.createContext)(null),s$e=o5.Provider,s5=m6.error001();function c5(e,t){let n=(0,C.useContext)(o5);if(n===null)throw Error(s5);return r5(n,e,t)}function l5(){let e=(0,C.useContext)(o5);if(e===null)throw Error(s5);return(0,C.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var u5={display:`none`},c$e={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},d5=`react-flow__node-desc`,f5=`react-flow__edge-desc`,l$e=`react-flow__aria-live`,u$e=e=>e.ariaLiveMessage,d$e=e=>e.ariaLabelConfig;function f$e({rfId:e}){let t=c5(u$e);return(0,G.jsx)(`div`,{id:`${l$e}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:c$e,children:t})}function p$e({rfId:e,disableKeyboardA11y:t}){let n=c5(d$e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{id:`${d5}-${e}`,style:u5,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,G.jsx)(`div`,{id:`${f5}-${e}`,style:u5,children:n[`edge.a11yDescription.default`]}),!t&&(0,G.jsx)(f$e,{rfId:e})]})}var p5=(0,C.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,G.jsx)(`div`,{className:u4([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));p5.displayName=`Panel`;function m$e({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,G.jsx)(p5,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,G.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var h$e=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},m5=e=>e.id;function g$e(e,t){return a5(e.selectedNodes.map(m5),t.selectedNodes.map(m5))&&a5(e.selectedEdges.map(m5),t.selectedEdges.map(m5))}function _$e({onSelectionChange:e}){let t=l5(),{selectedNodes:n,selectedEdges:r}=c5(h$e,g$e);return(0,C.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var v$e=e=>!!e.onSelectionChangeHandlers;function y$e({onSelectionChange:e}){let t=c5(v$e);return e||t?(0,G.jsx)(_$e,{onSelectionChange:e}):null}var h5=typeof window<`u`?C.useLayoutEffect:C.useEffect,g5=[0,0],b$e={x:0,y:0,zoom:1},_5=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],x$e=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),v5={translateExtent:h6,nodeOrigin:g5,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function S$e(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=c5(x$e,a5),l=l5();h5(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=v5,s()}),[]);let u=(0,C.useRef)(v5);return h5(()=>{for(let s of _5){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:pQe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},_5.map(t=>e[t])),null}function y5(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function C$e(e){let[t,n]=(0,C.useState)(e===`system`?null:e);return(0,C.useEffect)(()=>{if(e!==`system`){n(e);return}let t=y5(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?y5()?.matches?`dark`:`light`:t}var b5=typeof document<`u`?document:null;function x5(e=null,t={target:b5,actInsideInputWithModifier:!0}){let[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(!1),a=(0,C.useRef)(new Set([])),[o,s]=(0,C.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
460
460
|
`).replace(`
|
|
461
461
|
|
|
462
462
|
`,`
|
|
@@ -466,4 +466,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
466
466
|
To pick up a draggable item, press the space bar.
|
|
467
467
|
While dragging, use the arrow keys to move the item.
|
|
468
468
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
469
|
-
`},d2e={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 f2e(e){let{announcements:t=d2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=u2e}=e,{announce:a,announcement:o}=s2e(),s=$7(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),c2e((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(a2e,{id:r,value:i.draggable}),C.createElement(o2e,{id:s,announcement:o}));return n?(0,ya.createPortal)(u,n):u}var c9;(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`})(c9||={});function l9(){}function u9(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function p2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var d9=Object.freeze({x:0,y:0});function f9(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function p9(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function m2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function m9(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 h9(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function g9(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}}var h2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=g9(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=f9(g9(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(p9)},g2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=m9(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=m9(r),o=i.reduce((e,t,r)=>e+f9(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(p9)};function _2e(e,t){let 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),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var v2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=_2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(m2e)};function y2e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _9(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:d9}function b2e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var x2e=b2e(1);function S2e(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function C2e(e,t,n){let r=S2e(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var w2e={ignoreTransform:!1};function v9(e,t){t===void 0&&(t=w2e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=V7(e).getComputedStyle(e);t&&(n=C2e(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function y9(e){return v9(e,{ignoreTransform:!0})}function T2e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function E2e(e,t){return t===void 0&&(t=V7(e).getComputedStyle(e)),t.position===`fixed`}function D2e(e,t){t===void 0&&(t=V7(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function b9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(H7(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!U7(i)||W7(i)||n.includes(i))return n;let a=V7(e).getComputedStyle(i);return i!==e&&D2e(i,a)&&n.push(i),E2e(i,a)?n:r(i.parentNode)}return e?r(e):n}function x9(e){let[t]=b9(e,1);return t??null}function S9(e){return!R7||!e?null:z7(e)?e:B7(e)?H7(e)||e===G7(e).scrollingElement?window:U7(e)?e:null:null}function C9(e){return z7(e)?e.scrollX:e.scrollLeft}function w9(e){return z7(e)?e.scrollY:e.scrollTop}function T9(e){return{x:C9(e),y:w9(e)}}var E9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(E9||={});function O2e(e){return!R7||!e?!1:e===document.scrollingElement}function k2e(e){let t={x:0,y:0},n=O2e(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var A2e={x:.2,y:.2};function j2e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=A2e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=k2e(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=E9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=E9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=E9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=E9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function M2e(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{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 N2e(e){return e.reduce((e,t)=>t9(e,T9(t)),d9)}function P2e(e){return e.reduce((e,t)=>e+C9(t),0)}function F2e(e){return e.reduce((e,t)=>e+w9(t),0)}function I2e(e,t){if(t===void 0&&(t=v9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);x9(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var L2e=[[`x`,[`left`,`right`],P2e],[`y`,[`top`,`bottom`],F2e]],D9=class{constructor(e,t){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;let n=b9(t),r=N2e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of L2e)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},O9=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function R2e(e){let{EventTarget:t}=V7(e);return e instanceof t?e:G7(e)}function k9(e,t){let 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 A9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(A9||={});function z2e(e){e.preventDefault()}function B2e(e){e.stopPropagation()}var j9;(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`})(j9||={});var V2e={start:[j9.Space,j9.Enter],cancel:[j9.Esc],end:[j9.Space,j9.Enter,j9.Tab]},H2e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case j9.Right:return{...n,x:n.x+25};case j9.Left:return{...n,x:n.x-25};case j9.Down:return{...n,y:n.y+25};case j9.Up:return{...n,y:n.y-25}}},M9=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new O9(G7(t)),this.windowListeners=new O9(V7(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(A9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&I2e(n),t(d9)}handleKeyDown(e){if(r9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=V2e,coordinateGetter:a=H2e,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:d9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=n9(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=k2e(n),p=M2e(n),m={x:Math.min(i===j9.Right?p.right-p.width/2:p.right,Math.max(i===j9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===j9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===j9.Down?p.top:p.top+p.height/2,u.y))},h=i===j9.Right&&!s||i===j9.Left&&!c,g=i===j9.Down&&!l||i===j9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===j9.Right&&e<=d.x||i===j9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===j9.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===j9.Down&&e<=d.y||i===j9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===j9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,t9(n9(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};M9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=V2e,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function U2e(e){return!!(e&&`distance`in e)}function W2e(e){return!!(e&&`delay`in e)}var N9=class{constructor(e,t,n){n===void 0&&(n=R2e(e.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=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=G7(i),this.documentListeners=new O9(this.document),this.listeners=new O9(n),this.windowListeners=new O9(V7(i)),this.initialCoordinates=i9(r)??d9,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(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.DragStart,z2e),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),this.windowListeners.add(A9.ContextMenu,z2e),this.documentListeners.add(A9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(W2e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(U2e(t)){this.handlePending(t);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(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(A9.Click,B2e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(A9.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=i9(e)??d9,s=n9(n,o);if(!t&&a){if(U2e(a)){if(a.tolerance!=null&&k9(s,a.tolerance))return this.handleCancel();if(k9(s,a.distance))return this.handleStart()}if(W2e(a)&&k9(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===j9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},G2e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},P9=class extends N9{constructor(e){let{event:t}=e,n=G7(t.target);super(e,G2e,n)}};P9.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var K2e={move:{name:`mousemove`},end:{name:`mouseup`}},q2e;(function(e){e[e.RightClick=2]=`RightClick`})(q2e||={});var J2e=class extends N9{constructor(e){super(e,K2e,G7(e.event.target))}};J2e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===q2e.RightClick?!1:(r?.({event:n}),!0)}}];var F9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Y2e=class extends N9{constructor(e){super(e,F9)}static setup(){return window.addEventListener(F9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(F9.move.name,e)};function e(){}}};Y2e.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var I9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(I9||={});var L9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(L9||={});function X2e(e){let{acceleration:t,activator:n=I9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=L9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Q2e({delta:d,disabled:!a}),[m,h]=e2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case I9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case I9.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===L9.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=j2e(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Z2e={x:{[E9.Backward]:!1,[E9.Forward]:!1},y:{[E9.Backward]:!1,[E9.Forward]:!1}};function Q2e(e){let{delta:t,disabled:n}=e,r=Z7(t);return Y7(e=>{if(n||!r||!e)return Z2e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[E9.Backward]:e.x[E9.Backward]||i.x===-1,[E9.Forward]:e.x[E9.Forward]||i.x===1},y:{[E9.Backward]:e.y[E9.Backward]||i.y===-1,[E9.Forward]:e.y[E9.Forward]||i.y===1}}},[n,t,r])}function $2e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Y7(e=>t==null?null:r??e??null,[r,t])}function e4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var R9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(R9||={});var t4e;(function(e){e.Optimized=`optimized`})(t4e||={});var n4e=new Map;function r4e(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=J7(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=Y7(t=>{if(d&&!n)return n4e;if(!t||t===n4e||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new D9(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case R9.Always:return!1;case R9.BeforeDragging:return n;default:return!n}}}function i4e(e,t){return Y7(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function a4e(e,t){return i4e(e,t)}function o4e(e){let{callback:t,disabled:n}=e,r=q7(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function z9(e){let{callback:t,disabled:n}=e,r=q7(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function s4e(e){return new D9(v9(e),e)}function c4e(e,t,n){t===void 0&&(t=s4e);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=o4e({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=z9({callback:a});return K7(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function l4e(e){return _9(e,i4e(e))}var u4e=[];function d4e(e){let t=(0,C.useRef)(e),n=Y7(n=>e?n&&n!==u4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:b9(e):u4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function f4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=S9(e.target);t&&n(e=>e?(e.set(t,T9(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=S9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,T9(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{S9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>t9(e,t),d9):N2e(e):d9,[e,t])}function p4e(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==d9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?n9(e,n.current):d9}function m4e(e){(0,C.useEffect)(()=>{if(!R7)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function h4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function g4e(e){return(0,C.useMemo)(()=>e?T2e(e):null,[e])}var _4e=[];function v4e(e,t){t===void 0&&(t=v9);let[n]=e,r=g4e(n?V7(n):null),[i,a]=(0,C.useState)(_4e);function o(){a(()=>e.length?e.map(e=>O2e(e)?r:new D9(t(e),e)):_4e)}let s=z9({callback:o});return K7(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function y4e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return U7(t)?t:e}function b4e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=z9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(U7(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=X7((0,C.useCallback)(e=>{let n=y4e(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var x4e=[{sensor:P9,options:{}},{sensor:M9,options:{}}],S4e={current:{}},B9={draggable:{measure:y9},droppable:{measure:y9,strategy:R9.WhileDragging,frequency:t4e.Optimized},dragOverlay:{measure:v9}},V9=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},C4e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new V9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:l9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:B9,measureDroppableContainers:l9,windowRect:null,measuringScheduled:!1},w4e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:l9,draggableNodes:new Map,over:null,measureDroppableContainers:l9},H9=(0,C.createContext)(w4e),T4e=(0,C.createContext)(C4e);function E4e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new V9}}}function D4e(e,t){switch(t.type){case c9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case c9.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 c9.DragEnd:case c9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case c9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new V9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case c9.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new V9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case c9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new V9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function O4e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(H9),a=Z7(r),o=Z7(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!r9(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=r2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function k4e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function A4e(e){return(0,C.useMemo)(()=>({draggable:{...B9.draggable,...e?.draggable},droppable:{...B9.droppable,...e?.droppable},dragOverlay:{...B9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function j4e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;K7(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=_9(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=x9(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var M4e=(0,C.createContext)({...d9,scaleX:1,scaleY:1}),U9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(U9||={});var N4e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=x4e,collisionDetection:o=v2e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(D4e,void 0,E4e),[f,p]=l2e(),[m,h]=(0,C.useState)(U9.Uninitialized),g=m===U9.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??S4e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=J7(l,Object.values(l)),j=$7(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=A4e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=r4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=$2e(v,_),R=(0,C.useMemo)(()=>O?i9(O):null,[O]),ee=Te(),z=a4e(L,N.draggable.measure);j4e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=c4e(L,N.draggable.measure,z),B=c4e(L?L.parentElement:null),V=(0,C.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),re=b4e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=l4e(oe?null:te),ce=g4e(ie?V7(ie):null),le=d4e(g?ne??L:null),ue=v4e(le),H=k4e(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:te,containerNodeRect:B,draggingNodeRect:ae,over:V.current.over,overlayNodeRect:re.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),de=R?t9(R,y):null,fe=f4e(le),U=p4e(fe),pe=p4e(fe,[te]),me=t9(H,U),W=ae?x2e(ae,H):null,he=w&&W?o({active:w,collisionRect:W,droppableRects:P,droppableContainers:M,pointerCoordinates:de}):null,ge=h9(he,`id`),[_e,ve]=(0,C.useState)(null),ye=y2e(oe?H:t9(H,pe),_e?.rect??null,te),be=(0,C.useRef)(null),xe=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ya.unstable_batchedUpdates)(()=>{r?.(i),h(U9.Initializing),d({type:c9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(be.current),k(a)})},onMove(e){d({type:c9.DragMove,coordinates:e})},onEnd:o(c9.DragEnd),onCancel:o(c9.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===c9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=c9.DragCancel)}T.current=null,(0,ya.unstable_batchedUpdates)(()=>{d({type:e}),h(U9.Uninitialized),ve(null),D(null),k(null),be.current=null;let t=e===c9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=e4e(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,xe(n,t))},[v,xe]));m4e(a),K7(()=>{te&&m===U9.Initializing&&h(U9.Initialized)},[te,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,ya.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ya.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),K7(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:W,collisions:he,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:_e,scrollableAncestors:le,scrollAdjustedTranslate:me},S.current={initial:ae,translated:W}},[w,L,he,W,v,ie,ae,P,b,_e,le,me]),X2e({...ee,delta:y,draggingRect:W,pointerCoordinates:de,scrollableAncestors:le,scrollableAncestorRects:ue});let Ce=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:he,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:_e,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,he,B,re,v,b,P,_e,F,le,ue,N,I,ce]),we=(0,C.useMemo)(()=>({activatorEvent:O,activators:Se,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:F}),[O,Se,w,te,d,j,v,_e,F]);return C.createElement(s9.Provider,{value:p},C.createElement(H9.Provider,{value:we},C.createElement(T4e.Provider,{value:Ce},C.createElement(M4e.Provider,{value:ye},i)),C.createElement(O4e,{disabled:n?.restoreFocus===!1})),C.createElement(f2e,{...n,hiddenTextDescribedById:j}));function Te(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),P4e=(0,C.createContext)(null),F4e=`button`,I4e=`Draggable`;function L4e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=$7(I4e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(H9),{role:p=F4e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?M4e:P4e),[v,y]=X7(),[b,x]=X7(),S=h4e(o,t),w=J7(n);return K7(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===F4e?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function R4e(){return(0,C.useContext)(T4e)}var z4e=`Droppable`,B4e={timeout:25};function V4e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=$7(z4e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(H9),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...B4e,...i},_=J7(h??r),v=z9({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=X7((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=J7(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:c9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:c9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:c9.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function W9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function H4e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function G9(e){return e!==null&&e>=0}function U4e(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 W4e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var G4e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=W9(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},K9={scaleX:1,scaleY:1},K4e=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...K9}:null}let s=q4e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...K9}:r<t&&r>=a?{x:0,y:o.height+s,...K9}:{x:0,y:0,...K9}};function q4e(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var J4e=`Sortable`,Y4e=C.createContext({activeIndex:-1,containerId:J4e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:G4e,disabled:{draggable:!1,droppable:!1}});function X4e(e){let{children:t,id:n,items:r,strategy:i=G4e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=R4e(),d=$7(J4e,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!U4e(p,_.current),y=g!==-1&&h===-1||v,b=W4e(a);K7(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:H4e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(Y4e.Provider,{value:x},t)}var Z4e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return W9(n,r,i).indexOf(t)},Q4e=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},$4e={duration:200,easing:`ease`},e3e=`transform`,t3e=a9.Transition.toString({property:e3e,duration:0,easing:`linear`}),n3e={roleDescription:`sortable`};function r3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return K7(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=v9(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function i3e(e){let{animateLayoutChanges:t=Q4e,attributes:n,disabled:r,data:i,getNewIndex:a=Z4e,id:o,strategy:s,resizeObserverConfig:c,transition:l=$4e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(Y4e),y=a3e(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=V4e({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=L4e({id:o,data:x,attributes:{...n3e,...n},disabled:y.draggable}),R=$0e(D,M),ee=!!O,z=ee&&!m&&G9(f)&&G9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=G9(f)&&G9(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=O?.id,re=(0,C.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),ie=u!==re.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:b,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),oe=r3e({disabled:!ae,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ee&&re.current.newIndex!==V&&(re.current.newIndex=V),d!==re.current.containerId&&(re.current.containerId=d),u!==re.current.items&&(re.current.items=u)},[ee,V,d,u]),(0,C.useEffect)(()=>{if(ne===re.current.activeId)return;if(ne!=null&&re.current.activeId==null){re.current.activeId=ne;return}let e=setTimeout(()=>{re.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:x,rect:w,index:b,newIndex:V,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??B,transition:se()};function se(){if(oe||ie&&re.current.newIndex===b)return t3e;if(!(te&&!r9(k)||!l)&&(ee||ae))return a9.Transition.toString({...l,property:e3e})}}function a3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function q9(e){if(!e)return!1;let 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)}var o3e=[j9.Down,j9.Right,j9.Up,j9.Left],s3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(o3e.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case j9.Down:r.top<a.top&&t.push(n);break;case j9.Up:r.top>a.top&&t.push(n);break;case j9.Left:r.left>a.left&&t.push(n);break;case j9.Right:r.left<a.left&&t.push(n);break}});let c=g2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=h9(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=b9(c).some((e,t)=>s[t]!==e),i=c3e(e,t),a=l3e(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:n9(u,l)}}}};function c3e(e,t){return!q9(e)||!q9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l3e(e,t){return!q9(e)||!q9(t)||!c3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var u3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=i3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{vE(e.id).then(l)},[e.id]),(0,G.jsx)(vv,{ref:i,style:{transform:a9.Transform.toString(a),transition:o,opacity:s?.5:1},variant:`outlined`,sx:{cursor:`grab`,"&:active":{cursor:`grabbing`},bgcolor:s?`action.selected`:`background.paper`,width:`fit-content`},children:(0,G.jsxs)(xv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,G.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,G.jsx)(khe,{})}),(0,G.jsx)(kv,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,G.jsx)(Z,{component:`img`,src:yE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,G.jsx)(Tb,{sx:{bgcolor:TE(e),width:40,height:40,boxShadow:2},children:(0,G.jsx)(wE(e),{sx:{fontSize:24}})}),(0,G.jsxs)(Z,{sx:{flex:1},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},d3e=()=>{let{t:e}=ms(),t=Xv(),{content:n,isLoading:r}=AT(),i=Xme(),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!1);(0,C.useEffect)(()=>{n&&(o([...n].sort((e,t)=>(e.priority??100)-(t.priority??100))),c(!1))},[n]);let l=p2e(u9(P9),u9(M9,{coordinateGetter:s3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>W9(e,e.findIndex(e=>e.id===t.id),e.findIndex(e=>e.id===n.id))),c(!0))},[]),d=(0,C.useCallback)(async()=>{let n=a.map((e,t)=>({id:e.id,priority:(t+1)*10}));try{await i(n),t.show({message:e(`startup.saveSuccess`),severity:`success`}),c(!1)}catch(n){t.show({message:n instanceof Error?n.message:e(`startup.saveFailed`),severity:`error`})}},[a,i,t,e]),f=(0,C.useMemo)(()=>a.map(e=>e.id),[a]);return r?(0,G.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,G.jsxs)(Gv,{spacing:3,children:[(0,G.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:e(`startup.title`),to:Y9.startup}]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,G.jsx)(pv,{color:`primary`,fontSize:`large`}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,G.jsx)(Uh,{severity:`info`,action:(0,G.jsx)(_v,{color:`inherit`,size:`small`,startIcon:(0,G.jsx)(cE,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,G.jsx)(N4e,{sensors:l,collisionDetection:h2e,onDragEnd:u,children:(0,G.jsx)(X4e,{items:f,strategy:K4e,children:(0,G.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,G.jsx)(u3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(_v,{variant:`contained`,startIcon:(0,G.jsx)(cE,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},J9=`https://riddix.github.io/home-assistant-matter-hub`,Y9={dashboard:`/`,bridges:`/bridges`,bridge:e=>`/bridges/${e}`,createBridge:`/bridges/create`,areaSetup:`/bridges/area-setup`,editBridge:e=>`/bridges/${e}/edit`,devices:`/devices`,networkMap:`/network-map`,health:`/health`,labels:`/labels`,lockCredentials:`/lock-credentials`,plugins:`/plugins`,settings:`/settings`,startup:`/startup`,githubRepository:`https://github.com/riddix/home-assistant-matter-hub/`,documentation:J9,support:`${J9}/support`,faq:{multiFabric:`${J9}/connect-multiple-fabrics`,bridgeConfig:`${J9}/bridge-configuration`}},f3e=[{path:``,element:(0,G.jsx)(bre,{}),children:[{path:``,element:(0,G.jsx)(Jge,{})},{path:Y9.bridges,element:(0,G.jsx)(Hge,{})},{path:Y9.createBridge,element:(0,G.jsx)(Gqe,{})},{path:Y9.areaSetup,element:(0,G.jsx)(_ae,{})},{path:Y9.bridge(`:bridgeId`),element:(0,G.jsx)(fhe,{})},{path:Y9.editBridge(`:bridgeId`),element:(0,G.jsx)(Kqe,{})},{path:Y9.devices,element:(0,G.jsx)(f_e,{})},{path:Y9.networkMap,element:(0,G.jsx)(w0e,{})},{path:Y9.health,element:(0,G.jsx)(dJe,{})},{path:Y9.labels,element:(0,G.jsx)(hJe,{})},{path:Y9.lockCredentials,element:(0,G.jsx)(xJe,{})},{path:Y9.plugins,element:(0,G.jsx)(q0e,{})},{path:Y9.settings,element:(0,G.jsx)(Q0e,{})},{path:Y9.startup,element:(0,G.jsx)(d3e,{})},{path:`*`,element:(0,G.jsx)(SJe,{})}]}],p3e=D_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(G_.pending,e=>{e.items.isLoading=!0}).addCase(G_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(G_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(K_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(J_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(Y_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(q_.fulfilled,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.meta.arg);n!==-1&&e.items.content.splice(n,1)}}).addCase(X_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(Z_,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.payload.id);n===-1?e.items.content.push(t.payload):e.items.content[n]=t.payload}})}),m3e=D_({byBridge:{}},e=>{e.addCase(NT.pending,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(NT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(NT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)})}),X9=D_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(NT.pending,e=>{e.isLoading=!0}).addCase(NT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(NT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),h3e=Zne({reducer:{bridges:p3e,devices:m3e}}),Z9=_p({createStyledComponent:J(`div`,{name:`MuiContainer`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`maxWidth${Y(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>Om({props:e,name:`MuiContainer`})});function g3e(e){return Id(`MuiToolbar`,e)}Ld(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var _3e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return fp({root:[`root`,!n&&`gutters`,r]},g3e,t)},v3e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Pm(({theme:e})=>({position:`relative`,display:`flex`,alignItems:`center`,variants:[{props:({ownerState:e})=>!e.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}]}))),y3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiToolbar`}),{className:r,component:i=`div`,disableGutters:a=!1,variant:o=`regular`,...s}=n,c={...n,component:i,disableGutters:a,variant:o};return(0,G.jsx)(v3e,{as:i,className:K(_3e(c).root,r),ref:t,ownerState:c,...s})}),b3e=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t.componentStack)}render(){return this.state.hasError?(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(_b,{color:`error`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:Ps.t(`errorBoundary.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Ps.t(`errorBoundary.fallbackMessage`)}),(0,G.jsx)(_v,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Ps.t(`errorBoundary.reload`)})]}):this.props.children}};function x3e(e){return Id(`MuiFab`,e)}var S3e=Ld(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),C3e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=fp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},x3e,r);return{...r,...a}},w3e=J(Nh,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>Em(e)||e===`classes`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,t[Y(n.size)],t[n.color]]}})(Pm(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),borderRadius:`50%`,padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:`none`},[`&.${S3e.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:`small`},style:{width:40,height:40}},{props:{size:`medium`},style:{width:48,height:48}},{props:{variant:`extended`},style:{borderRadius:48/2,padding:`0 16px`,width:`auto`,minHeight:`auto`,minWidth:48,height:48}},{props:{variant:`extended`,size:`small`},style:{width:`auto`,padding:`0 8px`,borderRadius:34/2,minWidth:34,height:34}},{props:{variant:`extended`,size:`medium`},style:{width:`auto`,padding:`0 16px`,borderRadius:40/2,minWidth:40,height:40}},{props:{color:`inherit`},style:{color:`inherit`}}]})),Pm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Um([`dark`,`contrastText`])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Pm(({theme:e})=>({[`&.${S3e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),T3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiFab`}),{children:r,className:i,color:a=`default`,component:o=`button`,disabled:s=!1,disableFocusRipple:c=!1,focusVisibleClassName:l,size:u=`large`,variant:d=`circular`,...f}=n,p={...n,color:a,component:o,disabled:s,disableFocusRipple:c,size:u,variant:d},m=C3e(p);return(0,G.jsx)(w3e,{className:K(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:K(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),E3e=[{code:`en`,flag:`🇬🇧`,name:`English`},{code:`de`,flag:`🇩🇪`,name:`Deutsch`},{code:`fr`,flag:`🇫🇷`,name:`Français`},{code:`es`,flag:`🇪🇸`,name:`Español`},{code:`it`,flag:`🇮🇹`,name:`Italiano`},{code:`zh`,flag:`🇨🇳`,name:`中文`},{code:`zh-TW`,flag:`🇹🇼`,name:`繁體中文`},{code:`ja`,flag:`🇯🇵`,name:`日本語`},{code:`th`,flag:`🇹🇭`,name:`ไทย`},{code:`sv`,flag:`🇸🇪`,name:`Svenska`},{code:`tr`,flag:`🇹🇷`,name:`Türkçe`},{code:`ru`,flag:`🇷🇺`,name:`Русский`}],D3e=`hamh-custom-languages`;function O3e(){try{let e=localStorage.getItem(D3e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var k3e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function A3e(){let{t:e,i18n:t}=ms(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...E3e,...O3e()],[]),o=t.language??`en`,s=a.some(e=>e.code===o)?o:o.split(`-`)[0]??`en`,c=(0,C.useCallback)(()=>{r(e=>!e)},[]),l=(0,C.useCallback)(e=>{t.changeLanguage(e),r(!1)},[t]);return(0,G.jsx)(Kh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,G.jsxs)(Z,{children:[(0,G.jsx)(T3e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,G.jsx)(Ihe,{})}),(0,G.jsx)(sb,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,G.jsx)(Mb,{...t,timeout:200,children:(0,G.jsxs)(Wm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,G.jsxs)(Z,{onClick:()=>l(e.code),sx:{display:`flex`,alignItems:`center`,gap:1.5,px:2,py:1,cursor:`pointer`,bgcolor:s===e.code?`action.selected`:`transparent`,"&:hover":{bgcolor:`action.hover`},transition:`background-color 0.15s`},children:[(0,G.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,G.jsx)(Wb,{}),(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,G.jsx)(Zv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,G.jsx)(Jv,{href:k3e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var j3e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.700`,private:!1,type:`module`,bin:{"home-assistant-matter-hub":`./dist/backend/cli.js`},author:{name:`riddix`,url:`https://github.com/riddix`},keywords:[`home-assistant`,`homeassistant`,`home`,`assistant`,`apple home`,`google home`,`apple`,`google`,`alexa`,`matter`,`matter.js`,`matterjs`,`project-chip`,`smart`,`smarthome`,`smart-home`],bugs:{url:`https://github.com/riddix/home-assistant-matter-hub/issues`},license:`Apache-2.0`,repository:`github:riddix/home-assistant-matter-hub`,scripts:{cleanup:`npx rimraf node_modules dist pack LICENSE README.md`,build:`node build.js`,bundle:`pnpm pack --out package.tgz`,postbuild:`pnpm run bundle`,test:`vitest run`,prestart:`pnpm run build`,start:`dotenvx run -f ../../.env -- ./dist/backend/cli.js start`},dependencies:{"@matter/main":`0.17.0`,"@matter/nodejs":`0.17.0`,"@matter/general":`0.17.0`,ajv:`8.18.0`,archiver:`7.0.1`,color:`5.0.3`,debounce:`3.0.0`,express:`5.2.1`,"express-basic-auth":`1.2.1`,"express-ip-access-control":`1.1.3`,"home-assistant-js-websocket":`9.6.0`,"lodash-es":`4.18.1`,multer:`2.1.1`,nocache:`4.0.0`,unzipper:`0.12.3`,ws:`8.21.0`,yargs:`18.0.0`},devDependencies:{"@home-assistant-matter-hub/backend":`workspace:*`,"@home-assistant-matter-hub/frontend":`workspace:*`,"@home-assistant-matter-hub/common":`workspace:*`,"@types/lodash-es":`^4.17.12`},overrides:{minimatch:`9.0.7`,"path-to-regexp":`^8.4.0`,glob:`^13.0.0`},nx:{targets:{start:{cache:!1,dependsOn:[`build`]},pack:{cache:!0,dependsOn:[`build`],outputs:[`{projectRoot}/pack`]},build:{inputs:[`^default`,`default`,`{workspaceRoot}/README.md`,`{workspaceRoot}/LICENSE`],outputs:[`{projectRoot}/dist`,`{projectRoot}/README.md`,`{projectRoot}/LICENSE`]}}}};function M3e(){let e=`2.1.0-alpha.700`,[t,n]=(0,C.useState)(null);(0,C.useEffect)(()=>{fetch(`api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.version&&n(e.version)}).catch(()=>{})},[]);let r=(0,C.useMemo)(()=>!t||e===`0.0.0-dev`?!1:e!==t,[t]);return(0,C.useMemo)(()=>({name:j3e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var N3e=()=>{let{t:e}=ms(),t=[{name:e(`footer.github`),url:Y9.githubRepository},{name:e(`footer.documentation`),url:Y9.documentation},{name:e(`footer.support`),url:Y9.support}];return(0,G.jsxs)(Z9,{sx:{mt:16,mb:4},children:[(0,G.jsx)(Wb,{sx:{mt:4,mb:4}}),(0,G.jsx)(Rv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,G.jsx)(Rv,{size:{xs:12,sm:`auto`},children:(0,G.jsx)(_v,{fullWidth:!0,size:`small`,variant:`outlined`,component:Jv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function P3e(e){return Id(`MuiAppBar`,e)}Ld(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var F3e=e=>{let{color:t,position:n,classes:r}=e;return fp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},P3e,r)},I3e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,L3e=J(Wm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Pm(({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(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>e.enableColorOnDark===!0&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`}},{props:e=>e.enableColorOnDark===!1&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundColor:e.vars?I3e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?I3e(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`})}}]}))),R3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiAppBar`}),{className:r,color:i=`primary`,enableColorOnDark:a=!1,position:o=`fixed`,...s}=n,c={...n,color:i,position:o,enableColorOnDark:a};return(0,G.jsx)(L3e,{square:!0,component:`header`,ownerState:c,elevation:4,className:K(F3e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),z3e={visibility:`hidden`};function B3e(e,t,n){let r=n&&n.getBoundingClientRect(),i=eh(t),a=t.style.transform,o=t.style.transition;t.style.transition=``,t.style.transform=``;let s=t.getBoundingClientRect(),c=i.getComputedStyle(t).getPropertyValue(`transform`);t.style.transform=a,t.style.transition=o;let l=0,u=0;if(c&&c!==`none`&&typeof c==`string`){let e=c.split(`(`)[1].split(`)`)[0].split(`,`);l=parseInt(e[4],10),u=parseInt(e[5],10)}return e===`left`?r?`translateX(${r.right+l-s.left}px)`:`translateX(${i.innerWidth+l-s.left}px)`:e===`right`?r?`translateX(-${s.right-r.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:e===`up`?r?`translateY(${r.bottom+u-s.top}px)`:`translateY(${i.innerHeight+u-s.top}px)`:r?`translateY(-${s.top-r.top+s.height-u}px)`:`translateY(-${s.top+s.height-u}px)`}function V3e(e){return typeof e==`function`?e():e}function Q9(e,t,n){let r=B3e(e,t,V3e(n));r&&(t.style.transform=r)}var H3e=C.forwardRef(function(e,t){let n=Cm(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:o=!0,children:s,container:c,direction:l=`down`,easing:u=r,in:d,onEnter:f,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:_,style:v,timeout:y=i,...b}=e,x=C.useRef(null),S=ch(Wh(s),x,t),w=Jh(x,(e,t)=>{Q9(l,e,c),qh(e),f&&f(e,t)}),T=Jh(x,(e,t)=>{let r=Xh({timeout:y,style:v,easing:u},{mode:`enter`});e.style.transition=n.transitions.create(`transform`,r),e.style.transform=`none`,m&&m(e,t)}),E=Jh(x,p),D=Jh(x,_),O=Jh(x,e=>{let t=Xh({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Q9(l,e,c),h&&h(e)}),k=Jh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Q9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Ym(()=>{x.current&&Q9(l,x.current,c)}),t=eh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,G.jsx)(wh,{nodeRef:x,onEnter:w,onEntered:E,onEntering:T,onExit:O,onExited:k,onExiting:D,addEndListener:A,appear:o,in:d,timeout:y,...b,children:(e,{ownerState:t,...n})=>{let r;return r=e===`exited`&&!d?v||s.props.style?{visibility:`hidden`,...v,...s.props.style}:z3e:v&&s.props.style?{...v,...s.props.style}:v||s.props.style,C.cloneElement(s,{ref:S,style:r,...n})}})});function U3e(e){return Id(`MuiDrawer`,e)}Ld(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var W3e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},G3e=e=>{let{classes:t,anchor:n,variant:r}=e;return fp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},U3e,t)},K3e=J(Ib,{name:`MuiDrawer`,slot:`Root`,overridesResolver:W3e})(Pm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),q3e=J(`div`,{shouldForwardProp:Em,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:W3e})({flex:`0 0 auto`}),J3e=J(Wm,{name:`MuiDrawer`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${Y(n.anchor)}`],n.variant!==`temporary`&&t[`paperAnchorDocked${Y(n.anchor)}`]]}})(Pm(({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:e})=>e.anchor===`left`&&e.variant!==`temporary`,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`top`&&e.variant!==`temporary`,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`right`&&e.variant!==`temporary`,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`bottom`&&e.variant!==`temporary`,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),Y3e={left:`right`,right:`left`,top:`down`,bottom:`up`};function X3e(e){return[`left`,`right`].includes(e)}function Z3e({direction:e},t){return e===`rtl`&&X3e(t)?Y3e[t]:t}var Q3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiDrawer`}),r=Cm(),i=jf(),a={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:o=`left`,BackdropProps:s,children:c,className:l,elevation:u=16,hideBackdrop:d=!1,ModalProps:{BackdropProps:f,...p}={},onClose:m,open:h=!1,PaperProps:g={},SlideProps:_,TransitionComponent:v,transitionDuration:y=a,variant:b=`temporary`,slots:x={},slotProps:S={},...w}=n,T=C.useRef(!1);C.useEffect(()=>{T.current=!0},[]);let E=Z3e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=G3e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:lh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Hm(`root`,{ref:t,elementType:K3e,className:K(k.root,k.modal,l),shouldForwardComponentProp:!0,ownerState:O,externalForwardedProps:{...A,...w,...p},additionalProps:{open:h,onClose:m,hideBackdrop:d,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[N,P]=Hm(`paper`,{elementType:J3e,shouldForwardComponentProp:!0,className:K(k.paper,g.className),ownerState:O,externalForwardedProps:A,additionalProps:{elevation:b===`temporary`?u:0,square:!0,...b===`temporary`&&{role:`dialog`,"aria-modal":`true`}}}),[F,I]=Hm(`docked`,{elementType:q3e,ref:t,className:K(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Hm(`transition`,{elementType:H3e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:Y3e[E],timeout:y,appear:T.current}}),ee=(0,G.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,G.jsx)(F,{...I,children:ee});let z=(0,G.jsx)(L,{...R,children:ee});return b===`persistent`?(0,G.jsx)(F,{...I,children:z}):(0,G.jsx)(j,{...M,children:z})}),$3e=af({themeId:Sm}),e6e={error:Cx,warn:Qv,info:yb,debug:UT},t6e=({open:e,onClose:t})=>{let{t:n}=ms(),r=Cm(),i=(0,C.useMemo)(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(`error,warn,info`.split(`,`)),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(!0),h=(0,C.useCallback)(async()=>{try{let e=new URLSearchParams({level:l.join(`,`),limit:`500`,...d&&{search:d}}),t=await fetch(`api/logs?${e}`);t.ok&&o((await t.json()).entries)}catch(e){console.error(`Failed to fetch logs:`,e)}finally{c(!1)}},[l,d]);(0,C.useEffect)(()=>{e&&h()},[e,h]),(0,C.useEffect)(()=>{if(!p||!e)return;let t=setInterval(h,5e3);return()=>clearInterval(t)},[p,e,h]);let g=e=>{u(Array.isArray(e.target.value)?e.target.value:[e.target.value])},_=e=>{f(e.target.value)},v=async()=>{try{await fetch(`api/logs`,{method:`DELETE`}),o([])}catch(e){console.error(`Failed to clear logs:`,e)}},y=e=>(0,G.jsx)(e6e[e]||yb,{sx:{fontSize:16,color:i[e]}});return(0,G.jsxs)(zb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,G.jsxs)(Hb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(UT,{}),n(`logs.title`),(0,G.jsx)(Z,{sx:{flexGrow:1}}),(0,G.jsx)(fb,{title:n(`logs.autoRefresh`),children:(0,G.jsx)(kv,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,G.jsx)(Bh,{onClick:t,children:(0,G.jsx)(KT,{})})]}),(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Gv,{spacing:2,sx:{mb:2},children:(0,G.jsxs)(Gv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,G.jsxs)(Mv,{size:`small`,sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:n(`logs.logLevel`)}),(0,G.jsxs)(vS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,G.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,G.jsx)(kv,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,G.jsx)(yS,{value:`error`,children:n(`logs.error`)}),(0,G.jsx)(yS,{value:`warn`,children:n(`logs.warning`)}),(0,G.jsx)(yS,{value:`info`,children:n(`logs.info`)}),(0,G.jsx)(yS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,G.jsx)(SS,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,G.jsx)(_v,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,G.jsx)(_v,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,G.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,G.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,G.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,G.jsx)(kv,{label:e.level.toUpperCase(),size:`small`,sx:{backgroundColor:i[e.level],color:r.palette.getContrastText(i[e.level]??r.palette.grey[500]),fontSize:`0.7rem`,height:20}})]}),(0,G.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,G.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,G.jsx)(Bb,{children:(0,G.jsx)(_v,{onClick:t,children:n(`common.close`)})})]})};function n6e(){let{t:e}=ms(),{isConnected:t}=tv(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=async()=>{try{let e=await fetch(`api/health`);e.ok?(r(await e.json()),a(!1)):a(!0)}catch{a(!0)}};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let o=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`},s=n?.status===`healthy`&&!i,c=n?.services?.bridges,l=c&&c.total>0&&c.running===c.total,u=c&&c.total===0,d=n?(0,G.jsxs)(Z,{sx:{p:.5},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`nav.bridges`),`:`]}),` `,n.services.bridges.running??0,`/`,n.services.bridges.total??0,` `,e(`common.running`).toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e(`common.stopped`).toLowerCase()})`]}),n.services?.homeAssistant&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,G.jsx)(fb,{title:d,arrow:!0,children:(0,G.jsx)(kv,{icon:i||!s?(0,G.jsx)(Cx,{fontSize:`small`}):l?(0,G.jsx)(fv,{fontSize:`small`}):(0,G.jsx)(Sb,{fontSize:`small`}),label:e(i?`status.error`:s?t?u?`status.noBridges`:l?`common.online`:`common.starting`:`common.offline`:`status.unhealthy`),color:i||!s?`error`:!l||!t?`warning`:`success`,size:`small`,variant:`filled`,sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:`inherit`}}})})}var r6e=e=>(0,G.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,G.jsxs)(`g`,{style:{display:`inline`},children:[(0,G.jsx)(`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`}),(0,G.jsx)(`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`})]})}),i6e=e=>{let t=M3e();return(0,G.jsxs)(Z,{component:ea,to:Y9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,G.jsx)(r6e,{style:{height:`40px`}}),(0,G.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,G.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},a6e=()=>{let e=$3e(`(min-width:600px)`),{mode:t,setMode:n}=Nm(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Sr(),c=yr(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=ms(),f=[{label:d(`dashboard.title`),icon:(0,G.jsx)(ZT,{}),to:Y9.dashboard},{label:d(`nav.bridges`),icon:(0,G.jsx)(QT,{}),to:Y9.bridges},{label:d(`nav.devices`),icon:(0,G.jsx)(hb,{}),to:Y9.devices},{label:d(`nav.networkMap`),icon:(0,G.jsx)(LT,{}),to:Y9.networkMap},{label:d(`nav.startupOrder`),icon:(0,G.jsx)(pv,{}),to:Y9.startup},{label:d(`nav.lockCredentials`),icon:(0,G.jsx)(vT,{}),to:Y9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,G.jsx)($T,{}),to:Y9.labels},{label:`Plugins`,icon:(0,G.jsx)(YT,{}),to:Y9.plugins},{label:d(`nav.settings`),icon:(0,G.jsx)(DT,{}),to:Y9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,G.jsx)(Rhe,{}):(0,G.jsx)(Ehe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,G.jsx)(UT,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,G.jsx)(kx,{}),to:Y9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,G.jsxs)(Z,{children:[(0,G.jsx)(R3e,{sx:{height:`72px`},children:(0,G.jsx)(y3e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,G.jsxs)(Z9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(i6e,{large:e}),e?(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,G.jsx)(fb,{title:e.label,children:(0,G.jsx)(Bh,{component:ea,to:e.to,sx:{color:`inherit`,bgcolor:l(e.to)?`rgba(255,255,255,0.15)`:`transparent`,borderRadius:1},children:e.icon})},e.label):(0,G.jsx)(fb,{title:e.label,children:(0,G.jsx)(Bh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,G.jsx)(n6e,{})]}):(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,G.jsx)(n6e,{}),(0,G.jsx)(Bh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,G.jsx)(zhe,{})})]})]})})}),(0,G.jsx)(Q3e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,G.jsx)(ny,{sx:{width:250},children:f.map(e=>(0,G.jsxs)(Pae,{selected:l(e.to),onClick:()=>p(e),children:[(0,G.jsx)(sy,{children:e.icon}),(0,G.jsx)(ly,{primary:e.label})]},e.label))})}),(0,G.jsx)(t6e,{open:r,onClose:()=>i(!1)})]})},o6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=M3e(),{isConnected:r}=tv();return(0,G.jsxs)(Z,{children:[(0,G.jsx)(a6e,{}),(0,G.jsx)(y3e,{}),e&&(0,G.jsxs)(Uh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,G.jsx)(_v,{color:`inherit`,size:`small`,onClick:()=>window.location.reload(),children:`Reload`}),children:[`Version mismatch: frontend `,t,`, backend `,n,`. Please reload to get the latest UI.`]}),!r&&(0,G.jsx)(Uh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,G.jsx)(Z9,{sx:{p:2},children:(0,G.jsx)(b3e,{children:(0,G.jsx)(oi,{})})}),(0,G.jsx)(N3e,{}),(0,G.jsx)(A3e,{})]})},s6e=bm({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`}}}}}),$9=document.getElementsByTagName(`base`)[0]?.href?.replace(/\/$/,``);$9?.startsWith(`http`)&&($9=new URL($9).pathname);var c6e=Yi([{path:`/`,element:(0,G.jsx)(o6e,{}),children:f3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(C.StrictMode,{children:(0,G.jsx)(L,{store:h3e,children:(0,G.jsxs)(qee,{theme:s6e,children:[(0,G.jsx)(Vee,{}),(0,G.jsx)(wm,{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}}}),(0,G.jsx)(yre,{children:(0,G.jsx)(lne,{children:(0,G.jsx)(ba,{router:c6e})})})]})})}));
|
|
469
|
+
`},d2e={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 f2e(e){let{announcements:t=d2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=u2e}=e,{announce:a,announcement:o}=s2e(),s=$7(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),c2e((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(a2e,{id:r,value:i.draggable}),C.createElement(o2e,{id:s,announcement:o}));return n?(0,ya.createPortal)(u,n):u}var c9;(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`})(c9||={});function l9(){}function u9(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function p2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var d9=Object.freeze({x:0,y:0});function f9(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function p9(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function m2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function m9(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 h9(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function g9(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}}var h2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=g9(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=f9(g9(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(p9)},g2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=m9(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=m9(r),o=i.reduce((e,t,r)=>e+f9(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(p9)};function _2e(e,t){let 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),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var v2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=_2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(m2e)};function y2e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _9(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:d9}function b2e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var x2e=b2e(1);function S2e(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function C2e(e,t,n){let r=S2e(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var w2e={ignoreTransform:!1};function v9(e,t){t===void 0&&(t=w2e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=V7(e).getComputedStyle(e);t&&(n=C2e(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function y9(e){return v9(e,{ignoreTransform:!0})}function T2e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function E2e(e,t){return t===void 0&&(t=V7(e).getComputedStyle(e)),t.position===`fixed`}function D2e(e,t){t===void 0&&(t=V7(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function b9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(H7(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!U7(i)||W7(i)||n.includes(i))return n;let a=V7(e).getComputedStyle(i);return i!==e&&D2e(i,a)&&n.push(i),E2e(i,a)?n:r(i.parentNode)}return e?r(e):n}function x9(e){let[t]=b9(e,1);return t??null}function S9(e){return!R7||!e?null:z7(e)?e:B7(e)?H7(e)||e===G7(e).scrollingElement?window:U7(e)?e:null:null}function C9(e){return z7(e)?e.scrollX:e.scrollLeft}function w9(e){return z7(e)?e.scrollY:e.scrollTop}function T9(e){return{x:C9(e),y:w9(e)}}var E9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(E9||={});function O2e(e){return!R7||!e?!1:e===document.scrollingElement}function k2e(e){let t={x:0,y:0},n=O2e(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var A2e={x:.2,y:.2};function j2e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=A2e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=k2e(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=E9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=E9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=E9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=E9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function M2e(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{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 N2e(e){return e.reduce((e,t)=>t9(e,T9(t)),d9)}function P2e(e){return e.reduce((e,t)=>e+C9(t),0)}function F2e(e){return e.reduce((e,t)=>e+w9(t),0)}function I2e(e,t){if(t===void 0&&(t=v9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);x9(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var L2e=[[`x`,[`left`,`right`],P2e],[`y`,[`top`,`bottom`],F2e]],D9=class{constructor(e,t){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;let n=b9(t),r=N2e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of L2e)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},O9=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function R2e(e){let{EventTarget:t}=V7(e);return e instanceof t?e:G7(e)}function k9(e,t){let 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 A9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(A9||={});function z2e(e){e.preventDefault()}function B2e(e){e.stopPropagation()}var j9;(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`})(j9||={});var V2e={start:[j9.Space,j9.Enter],cancel:[j9.Esc],end:[j9.Space,j9.Enter,j9.Tab]},H2e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case j9.Right:return{...n,x:n.x+25};case j9.Left:return{...n,x:n.x-25};case j9.Down:return{...n,y:n.y+25};case j9.Up:return{...n,y:n.y-25}}},M9=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new O9(G7(t)),this.windowListeners=new O9(V7(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(A9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&I2e(n),t(d9)}handleKeyDown(e){if(r9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=V2e,coordinateGetter:a=H2e,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:d9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=n9(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=k2e(n),p=M2e(n),m={x:Math.min(i===j9.Right?p.right-p.width/2:p.right,Math.max(i===j9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===j9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===j9.Down?p.top:p.top+p.height/2,u.y))},h=i===j9.Right&&!s||i===j9.Left&&!c,g=i===j9.Down&&!l||i===j9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===j9.Right&&e<=d.x||i===j9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===j9.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===j9.Down&&e<=d.y||i===j9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===j9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,t9(n9(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};M9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=V2e,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function U2e(e){return!!(e&&`distance`in e)}function W2e(e){return!!(e&&`delay`in e)}var N9=class{constructor(e,t,n){n===void 0&&(n=R2e(e.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=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=G7(i),this.documentListeners=new O9(this.document),this.listeners=new O9(n),this.windowListeners=new O9(V7(i)),this.initialCoordinates=i9(r)??d9,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(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.DragStart,z2e),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),this.windowListeners.add(A9.ContextMenu,z2e),this.documentListeners.add(A9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(W2e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(U2e(t)){this.handlePending(t);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(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(A9.Click,B2e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(A9.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=i9(e)??d9,s=n9(n,o);if(!t&&a){if(U2e(a)){if(a.tolerance!=null&&k9(s,a.tolerance))return this.handleCancel();if(k9(s,a.distance))return this.handleStart()}if(W2e(a)&&k9(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===j9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},G2e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},P9=class extends N9{constructor(e){let{event:t}=e,n=G7(t.target);super(e,G2e,n)}};P9.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var K2e={move:{name:`mousemove`},end:{name:`mouseup`}},q2e;(function(e){e[e.RightClick=2]=`RightClick`})(q2e||={});var J2e=class extends N9{constructor(e){super(e,K2e,G7(e.event.target))}};J2e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===q2e.RightClick?!1:(r?.({event:n}),!0)}}];var F9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Y2e=class extends N9{constructor(e){super(e,F9)}static setup(){return window.addEventListener(F9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(F9.move.name,e)};function e(){}}};Y2e.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var I9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(I9||={});var L9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(L9||={});function X2e(e){let{acceleration:t,activator:n=I9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=L9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Q2e({delta:d,disabled:!a}),[m,h]=e2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case I9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case I9.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===L9.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=j2e(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Z2e={x:{[E9.Backward]:!1,[E9.Forward]:!1},y:{[E9.Backward]:!1,[E9.Forward]:!1}};function Q2e(e){let{delta:t,disabled:n}=e,r=Z7(t);return Y7(e=>{if(n||!r||!e)return Z2e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[E9.Backward]:e.x[E9.Backward]||i.x===-1,[E9.Forward]:e.x[E9.Forward]||i.x===1},y:{[E9.Backward]:e.y[E9.Backward]||i.y===-1,[E9.Forward]:e.y[E9.Forward]||i.y===1}}},[n,t,r])}function $2e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Y7(e=>t==null?null:r??e??null,[r,t])}function e4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var R9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(R9||={});var t4e;(function(e){e.Optimized=`optimized`})(t4e||={});var n4e=new Map;function r4e(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=J7(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=Y7(t=>{if(d&&!n)return n4e;if(!t||t===n4e||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new D9(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case R9.Always:return!1;case R9.BeforeDragging:return n;default:return!n}}}function i4e(e,t){return Y7(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function a4e(e,t){return i4e(e,t)}function o4e(e){let{callback:t,disabled:n}=e,r=q7(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function z9(e){let{callback:t,disabled:n}=e,r=q7(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function s4e(e){return new D9(v9(e),e)}function c4e(e,t,n){t===void 0&&(t=s4e);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=o4e({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=z9({callback:a});return K7(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function l4e(e){return _9(e,i4e(e))}var u4e=[];function d4e(e){let t=(0,C.useRef)(e),n=Y7(n=>e?n&&n!==u4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:b9(e):u4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function f4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=S9(e.target);t&&n(e=>e?(e.set(t,T9(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=S9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,T9(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{S9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>t9(e,t),d9):N2e(e):d9,[e,t])}function p4e(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==d9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?n9(e,n.current):d9}function m4e(e){(0,C.useEffect)(()=>{if(!R7)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function h4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function g4e(e){return(0,C.useMemo)(()=>e?T2e(e):null,[e])}var _4e=[];function v4e(e,t){t===void 0&&(t=v9);let[n]=e,r=g4e(n?V7(n):null),[i,a]=(0,C.useState)(_4e);function o(){a(()=>e.length?e.map(e=>O2e(e)?r:new D9(t(e),e)):_4e)}let s=z9({callback:o});return K7(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function y4e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return U7(t)?t:e}function b4e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=z9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(U7(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=X7((0,C.useCallback)(e=>{let n=y4e(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var x4e=[{sensor:P9,options:{}},{sensor:M9,options:{}}],S4e={current:{}},B9={draggable:{measure:y9},droppable:{measure:y9,strategy:R9.WhileDragging,frequency:t4e.Optimized},dragOverlay:{measure:v9}},V9=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},C4e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new V9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:l9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:B9,measureDroppableContainers:l9,windowRect:null,measuringScheduled:!1},w4e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:l9,draggableNodes:new Map,over:null,measureDroppableContainers:l9},H9=(0,C.createContext)(w4e),T4e=(0,C.createContext)(C4e);function E4e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new V9}}}function D4e(e,t){switch(t.type){case c9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case c9.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 c9.DragEnd:case c9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case c9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new V9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case c9.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new V9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case c9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new V9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function O4e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(H9),a=Z7(r),o=Z7(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!r9(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=r2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function k4e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function A4e(e){return(0,C.useMemo)(()=>({draggable:{...B9.draggable,...e?.draggable},droppable:{...B9.droppable,...e?.droppable},dragOverlay:{...B9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function j4e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;K7(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=_9(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=x9(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var M4e=(0,C.createContext)({...d9,scaleX:1,scaleY:1}),U9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(U9||={});var N4e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=x4e,collisionDetection:o=v2e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(D4e,void 0,E4e),[f,p]=l2e(),[m,h]=(0,C.useState)(U9.Uninitialized),g=m===U9.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??S4e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=J7(l,Object.values(l)),j=$7(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=A4e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=r4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=$2e(v,_),R=(0,C.useMemo)(()=>O?i9(O):null,[O]),ee=Te(),z=a4e(L,N.draggable.measure);j4e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=c4e(L,N.draggable.measure,z),B=c4e(L?L.parentElement:null),V=(0,C.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),re=b4e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=l4e(oe?null:te),ce=g4e(ie?V7(ie):null),le=d4e(g?ne??L:null),ue=v4e(le),H=k4e(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:te,containerNodeRect:B,draggingNodeRect:ae,over:V.current.over,overlayNodeRect:re.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),de=R?t9(R,y):null,fe=f4e(le),U=p4e(fe),pe=p4e(fe,[te]),me=t9(H,U),W=ae?x2e(ae,H):null,he=w&&W?o({active:w,collisionRect:W,droppableRects:P,droppableContainers:M,pointerCoordinates:de}):null,ge=h9(he,`id`),[_e,ve]=(0,C.useState)(null),ye=y2e(oe?H:t9(H,pe),_e?.rect??null,te),be=(0,C.useRef)(null),xe=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ya.unstable_batchedUpdates)(()=>{r?.(i),h(U9.Initializing),d({type:c9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(be.current),k(a)})},onMove(e){d({type:c9.DragMove,coordinates:e})},onEnd:o(c9.DragEnd),onCancel:o(c9.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===c9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=c9.DragCancel)}T.current=null,(0,ya.unstable_batchedUpdates)(()=>{d({type:e}),h(U9.Uninitialized),ve(null),D(null),k(null),be.current=null;let t=e===c9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=e4e(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,xe(n,t))},[v,xe]));m4e(a),K7(()=>{te&&m===U9.Initializing&&h(U9.Initialized)},[te,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,ya.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ya.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),K7(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:W,collisions:he,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:_e,scrollableAncestors:le,scrollAdjustedTranslate:me},S.current={initial:ae,translated:W}},[w,L,he,W,v,ie,ae,P,b,_e,le,me]),X2e({...ee,delta:y,draggingRect:W,pointerCoordinates:de,scrollableAncestors:le,scrollableAncestorRects:ue});let Ce=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:he,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:_e,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,he,B,re,v,b,P,_e,F,le,ue,N,I,ce]),we=(0,C.useMemo)(()=>({activatorEvent:O,activators:Se,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:F}),[O,Se,w,te,d,j,v,_e,F]);return C.createElement(s9.Provider,{value:p},C.createElement(H9.Provider,{value:we},C.createElement(T4e.Provider,{value:Ce},C.createElement(M4e.Provider,{value:ye},i)),C.createElement(O4e,{disabled:n?.restoreFocus===!1})),C.createElement(f2e,{...n,hiddenTextDescribedById:j}));function Te(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),P4e=(0,C.createContext)(null),F4e=`button`,I4e=`Draggable`;function L4e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=$7(I4e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(H9),{role:p=F4e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?M4e:P4e),[v,y]=X7(),[b,x]=X7(),S=h4e(o,t),w=J7(n);return K7(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===F4e?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function R4e(){return(0,C.useContext)(T4e)}var z4e=`Droppable`,B4e={timeout:25};function V4e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=$7(z4e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(H9),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...B4e,...i},_=J7(h??r),v=z9({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=X7((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=J7(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:c9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:c9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:c9.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function W9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function H4e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function G9(e){return e!==null&&e>=0}function U4e(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 W4e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var G4e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=W9(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},K9={scaleX:1,scaleY:1},K4e=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...K9}:null}let s=q4e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...K9}:r<t&&r>=a?{x:0,y:o.height+s,...K9}:{x:0,y:0,...K9}};function q4e(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var J4e=`Sortable`,Y4e=C.createContext({activeIndex:-1,containerId:J4e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:G4e,disabled:{draggable:!1,droppable:!1}});function X4e(e){let{children:t,id:n,items:r,strategy:i=G4e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=R4e(),d=$7(J4e,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!U4e(p,_.current),y=g!==-1&&h===-1||v,b=W4e(a);K7(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:H4e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(Y4e.Provider,{value:x},t)}var Z4e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return W9(n,r,i).indexOf(t)},Q4e=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},$4e={duration:200,easing:`ease`},e3e=`transform`,t3e=a9.Transition.toString({property:e3e,duration:0,easing:`linear`}),n3e={roleDescription:`sortable`};function r3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return K7(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=v9(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function i3e(e){let{animateLayoutChanges:t=Q4e,attributes:n,disabled:r,data:i,getNewIndex:a=Z4e,id:o,strategy:s,resizeObserverConfig:c,transition:l=$4e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(Y4e),y=a3e(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=V4e({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=L4e({id:o,data:x,attributes:{...n3e,...n},disabled:y.draggable}),R=$0e(D,M),ee=!!O,z=ee&&!m&&G9(f)&&G9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=G9(f)&&G9(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=O?.id,re=(0,C.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),ie=u!==re.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:b,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),oe=r3e({disabled:!ae,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ee&&re.current.newIndex!==V&&(re.current.newIndex=V),d!==re.current.containerId&&(re.current.containerId=d),u!==re.current.items&&(re.current.items=u)},[ee,V,d,u]),(0,C.useEffect)(()=>{if(ne===re.current.activeId)return;if(ne!=null&&re.current.activeId==null){re.current.activeId=ne;return}let e=setTimeout(()=>{re.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:x,rect:w,index:b,newIndex:V,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??B,transition:se()};function se(){if(oe||ie&&re.current.newIndex===b)return t3e;if(!(te&&!r9(k)||!l)&&(ee||ae))return a9.Transition.toString({...l,property:e3e})}}function a3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function q9(e){if(!e)return!1;let 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)}var o3e=[j9.Down,j9.Right,j9.Up,j9.Left],s3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(o3e.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case j9.Down:r.top<a.top&&t.push(n);break;case j9.Up:r.top>a.top&&t.push(n);break;case j9.Left:r.left>a.left&&t.push(n);break;case j9.Right:r.left<a.left&&t.push(n);break}});let c=g2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=h9(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=b9(c).some((e,t)=>s[t]!==e),i=c3e(e,t),a=l3e(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:n9(u,l)}}}};function c3e(e,t){return!q9(e)||!q9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l3e(e,t){return!q9(e)||!q9(t)||!c3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var u3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=i3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{vE(e.id).then(l)},[e.id]),(0,G.jsx)(vv,{ref:i,style:{transform:a9.Transform.toString(a),transition:o,opacity:s?.5:1},variant:`outlined`,sx:{cursor:`grab`,"&:active":{cursor:`grabbing`},bgcolor:s?`action.selected`:`background.paper`,width:`fit-content`},children:(0,G.jsxs)(xv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,G.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,G.jsx)(khe,{})}),(0,G.jsx)(kv,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,G.jsx)(Z,{component:`img`,src:yE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,G.jsx)(Tb,{sx:{bgcolor:TE(e),width:40,height:40,boxShadow:2},children:(0,G.jsx)(wE(e),{sx:{fontSize:24}})}),(0,G.jsxs)(Z,{sx:{flex:1},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},d3e=()=>{let{t:e}=ms(),t=Xv(),{content:n,isLoading:r}=AT(),i=Xme(),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!1);(0,C.useEffect)(()=>{n&&(o([...n].sort((e,t)=>(e.priority??100)-(t.priority??100))),c(!1))},[n]);let l=p2e(u9(P9),u9(M9,{coordinateGetter:s3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>W9(e,e.findIndex(e=>e.id===t.id),e.findIndex(e=>e.id===n.id))),c(!0))},[]),d=(0,C.useCallback)(async()=>{let n=a.map((e,t)=>({id:e.id,priority:(t+1)*10}));try{await i(n),t.show({message:e(`startup.saveSuccess`),severity:`success`}),c(!1)}catch(n){t.show({message:n instanceof Error?n.message:e(`startup.saveFailed`),severity:`error`})}},[a,i,t,e]),f=(0,C.useMemo)(()=>a.map(e=>e.id),[a]);return r?(0,G.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,G.jsxs)(Gv,{spacing:3,children:[(0,G.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:e(`startup.title`),to:Y9.startup}]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,G.jsx)(pv,{color:`primary`,fontSize:`large`}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,G.jsx)(Uh,{severity:`info`,action:(0,G.jsx)(_v,{color:`inherit`,size:`small`,startIcon:(0,G.jsx)(cE,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,G.jsx)(N4e,{sensors:l,collisionDetection:h2e,onDragEnd:u,children:(0,G.jsx)(X4e,{items:f,strategy:K4e,children:(0,G.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,G.jsx)(u3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(_v,{variant:`contained`,startIcon:(0,G.jsx)(cE,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},J9=`https://riddix.github.io/home-assistant-matter-hub`,Y9={dashboard:`/`,bridges:`/bridges`,bridge:e=>`/bridges/${e}`,createBridge:`/bridges/create`,areaSetup:`/bridges/area-setup`,editBridge:e=>`/bridges/${e}/edit`,devices:`/devices`,networkMap:`/network-map`,health:`/health`,labels:`/labels`,lockCredentials:`/lock-credentials`,plugins:`/plugins`,settings:`/settings`,startup:`/startup`,githubRepository:`https://github.com/riddix/home-assistant-matter-hub/`,documentation:J9,support:`${J9}/support`,faq:{multiFabric:`${J9}/connect-multiple-fabrics`,bridgeConfig:`${J9}/bridge-configuration`}},f3e=[{path:``,element:(0,G.jsx)(bre,{}),children:[{path:``,element:(0,G.jsx)(Jge,{})},{path:Y9.bridges,element:(0,G.jsx)(Hge,{})},{path:Y9.createBridge,element:(0,G.jsx)(Gqe,{})},{path:Y9.areaSetup,element:(0,G.jsx)(_ae,{})},{path:Y9.bridge(`:bridgeId`),element:(0,G.jsx)(fhe,{})},{path:Y9.editBridge(`:bridgeId`),element:(0,G.jsx)(Kqe,{})},{path:Y9.devices,element:(0,G.jsx)(f_e,{})},{path:Y9.networkMap,element:(0,G.jsx)(w0e,{})},{path:Y9.health,element:(0,G.jsx)(dJe,{})},{path:Y9.labels,element:(0,G.jsx)(hJe,{})},{path:Y9.lockCredentials,element:(0,G.jsx)(xJe,{})},{path:Y9.plugins,element:(0,G.jsx)(q0e,{})},{path:Y9.settings,element:(0,G.jsx)(Q0e,{})},{path:Y9.startup,element:(0,G.jsx)(d3e,{})},{path:`*`,element:(0,G.jsx)(SJe,{})}]}],p3e=D_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(G_.pending,e=>{e.items.isLoading=!0}).addCase(G_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(G_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(K_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(J_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(Y_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(q_.fulfilled,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.meta.arg);n!==-1&&e.items.content.splice(n,1)}}).addCase(X_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(Z_,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.payload.id);n===-1?e.items.content.push(t.payload):e.items.content[n]=t.payload}})}),m3e=D_({byBridge:{}},e=>{e.addCase(NT.pending,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(NT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(NT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)})}),X9=D_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(NT.pending,e=>{e.isLoading=!0}).addCase(NT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(NT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),h3e=Zne({reducer:{bridges:p3e,devices:m3e}}),Z9=_p({createStyledComponent:J(`div`,{name:`MuiContainer`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`maxWidth${Y(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>Om({props:e,name:`MuiContainer`})});function g3e(e){return Id(`MuiToolbar`,e)}Ld(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var _3e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return fp({root:[`root`,!n&&`gutters`,r]},g3e,t)},v3e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Pm(({theme:e})=>({position:`relative`,display:`flex`,alignItems:`center`,variants:[{props:({ownerState:e})=>!e.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}]}))),y3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiToolbar`}),{className:r,component:i=`div`,disableGutters:a=!1,variant:o=`regular`,...s}=n,c={...n,component:i,disableGutters:a,variant:o};return(0,G.jsx)(v3e,{as:i,className:K(_3e(c).root,r),ref:t,ownerState:c,...s})}),b3e=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t.componentStack)}render(){return this.state.hasError?(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(_b,{color:`error`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:Ps.t(`errorBoundary.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Ps.t(`errorBoundary.fallbackMessage`)}),(0,G.jsx)(_v,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Ps.t(`errorBoundary.reload`)})]}):this.props.children}};function x3e(e){return Id(`MuiFab`,e)}var S3e=Ld(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),C3e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=fp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},x3e,r);return{...r,...a}},w3e=J(Nh,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>Em(e)||e===`classes`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,t[Y(n.size)],t[n.color]]}})(Pm(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),borderRadius:`50%`,padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:`none`},[`&.${S3e.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:`small`},style:{width:40,height:40}},{props:{size:`medium`},style:{width:48,height:48}},{props:{variant:`extended`},style:{borderRadius:48/2,padding:`0 16px`,width:`auto`,minHeight:`auto`,minWidth:48,height:48}},{props:{variant:`extended`,size:`small`},style:{width:`auto`,padding:`0 8px`,borderRadius:34/2,minWidth:34,height:34}},{props:{variant:`extended`,size:`medium`},style:{width:`auto`,padding:`0 16px`,borderRadius:40/2,minWidth:40,height:40}},{props:{color:`inherit`},style:{color:`inherit`}}]})),Pm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Um([`dark`,`contrastText`])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Pm(({theme:e})=>({[`&.${S3e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),T3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiFab`}),{children:r,className:i,color:a=`default`,component:o=`button`,disabled:s=!1,disableFocusRipple:c=!1,focusVisibleClassName:l,size:u=`large`,variant:d=`circular`,...f}=n,p={...n,color:a,component:o,disabled:s,disableFocusRipple:c,size:u,variant:d},m=C3e(p);return(0,G.jsx)(w3e,{className:K(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:K(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),E3e=[{code:`en`,flag:`🇬🇧`,name:`English`},{code:`de`,flag:`🇩🇪`,name:`Deutsch`},{code:`fr`,flag:`🇫🇷`,name:`Français`},{code:`es`,flag:`🇪🇸`,name:`Español`},{code:`it`,flag:`🇮🇹`,name:`Italiano`},{code:`zh`,flag:`🇨🇳`,name:`中文`},{code:`zh-TW`,flag:`🇹🇼`,name:`繁體中文`},{code:`ja`,flag:`🇯🇵`,name:`日本語`},{code:`th`,flag:`🇹🇭`,name:`ไทย`},{code:`sv`,flag:`🇸🇪`,name:`Svenska`},{code:`tr`,flag:`🇹🇷`,name:`Türkçe`},{code:`ru`,flag:`🇷🇺`,name:`Русский`}],D3e=`hamh-custom-languages`;function O3e(){try{let e=localStorage.getItem(D3e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var k3e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function A3e(){let{t:e,i18n:t}=ms(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...E3e,...O3e()],[]),o=t.language??`en`,s=a.some(e=>e.code===o)?o:o.split(`-`)[0]??`en`,c=(0,C.useCallback)(()=>{r(e=>!e)},[]),l=(0,C.useCallback)(e=>{t.changeLanguage(e),r(!1)},[t]);return(0,G.jsx)(Kh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,G.jsxs)(Z,{children:[(0,G.jsx)(T3e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,G.jsx)(Ihe,{})}),(0,G.jsx)(sb,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,G.jsx)(Mb,{...t,timeout:200,children:(0,G.jsxs)(Wm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,G.jsxs)(Z,{onClick:()=>l(e.code),sx:{display:`flex`,alignItems:`center`,gap:1.5,px:2,py:1,cursor:`pointer`,bgcolor:s===e.code?`action.selected`:`transparent`,"&:hover":{bgcolor:`action.hover`},transition:`background-color 0.15s`},children:[(0,G.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,G.jsx)(Wb,{}),(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,G.jsx)(Zv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,G.jsx)(Jv,{href:k3e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var j3e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.701`,private:!1,type:`module`,bin:{"home-assistant-matter-hub":`./dist/backend/cli.js`},author:{name:`riddix`,url:`https://github.com/riddix`},keywords:[`home-assistant`,`homeassistant`,`home`,`assistant`,`apple home`,`google home`,`apple`,`google`,`alexa`,`matter`,`matter.js`,`matterjs`,`project-chip`,`smart`,`smarthome`,`smart-home`],bugs:{url:`https://github.com/riddix/home-assistant-matter-hub/issues`},license:`Apache-2.0`,repository:`github:riddix/home-assistant-matter-hub`,scripts:{cleanup:`npx rimraf node_modules dist pack LICENSE README.md`,build:`node build.js`,bundle:`pnpm pack --out package.tgz`,postbuild:`pnpm run bundle`,test:`vitest run`,prestart:`pnpm run build`,start:`dotenvx run -f ../../.env -- ./dist/backend/cli.js start`},dependencies:{"@matter/main":`0.17.0`,"@matter/nodejs":`0.17.0`,"@matter/general":`0.17.0`,ajv:`8.18.0`,archiver:`7.0.1`,color:`5.0.3`,debounce:`3.0.0`,express:`5.2.1`,"express-basic-auth":`1.2.1`,"express-ip-access-control":`1.1.3`,"home-assistant-js-websocket":`9.6.0`,"lodash-es":`4.18.1`,multer:`2.1.1`,nocache:`4.0.0`,unzipper:`0.12.3`,ws:`8.21.0`,yargs:`18.0.0`},devDependencies:{"@home-assistant-matter-hub/backend":`workspace:*`,"@home-assistant-matter-hub/frontend":`workspace:*`,"@home-assistant-matter-hub/common":`workspace:*`,"@types/lodash-es":`^4.17.12`},overrides:{minimatch:`9.0.7`,"path-to-regexp":`^8.4.0`,glob:`^13.0.0`},nx:{targets:{start:{cache:!1,dependsOn:[`build`]},pack:{cache:!0,dependsOn:[`build`],outputs:[`{projectRoot}/pack`]},build:{inputs:[`^default`,`default`,`{workspaceRoot}/README.md`,`{workspaceRoot}/LICENSE`],outputs:[`{projectRoot}/dist`,`{projectRoot}/README.md`,`{projectRoot}/LICENSE`]}}}};function M3e(){let e=`2.1.0-alpha.701`,[t,n]=(0,C.useState)(null);(0,C.useEffect)(()=>{fetch(`api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.version&&n(e.version)}).catch(()=>{})},[]);let r=(0,C.useMemo)(()=>!t||e===`0.0.0-dev`?!1:e!==t,[t]);return(0,C.useMemo)(()=>({name:j3e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var N3e=()=>{let{t:e}=ms(),t=[{name:e(`footer.github`),url:Y9.githubRepository},{name:e(`footer.documentation`),url:Y9.documentation},{name:e(`footer.support`),url:Y9.support}];return(0,G.jsxs)(Z9,{sx:{mt:16,mb:4},children:[(0,G.jsx)(Wb,{sx:{mt:4,mb:4}}),(0,G.jsx)(Rv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,G.jsx)(Rv,{size:{xs:12,sm:`auto`},children:(0,G.jsx)(_v,{fullWidth:!0,size:`small`,variant:`outlined`,component:Jv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function P3e(e){return Id(`MuiAppBar`,e)}Ld(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var F3e=e=>{let{color:t,position:n,classes:r}=e;return fp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},P3e,r)},I3e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,L3e=J(Wm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Pm(({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(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>e.enableColorOnDark===!0&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`}},{props:e=>e.enableColorOnDark===!1&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundColor:e.vars?I3e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?I3e(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`})}}]}))),R3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiAppBar`}),{className:r,color:i=`primary`,enableColorOnDark:a=!1,position:o=`fixed`,...s}=n,c={...n,color:i,position:o,enableColorOnDark:a};return(0,G.jsx)(L3e,{square:!0,component:`header`,ownerState:c,elevation:4,className:K(F3e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),z3e={visibility:`hidden`};function B3e(e,t,n){let r=n&&n.getBoundingClientRect(),i=eh(t),a=t.style.transform,o=t.style.transition;t.style.transition=``,t.style.transform=``;let s=t.getBoundingClientRect(),c=i.getComputedStyle(t).getPropertyValue(`transform`);t.style.transform=a,t.style.transition=o;let l=0,u=0;if(c&&c!==`none`&&typeof c==`string`){let e=c.split(`(`)[1].split(`)`)[0].split(`,`);l=parseInt(e[4],10),u=parseInt(e[5],10)}return e===`left`?r?`translateX(${r.right+l-s.left}px)`:`translateX(${i.innerWidth+l-s.left}px)`:e===`right`?r?`translateX(-${s.right-r.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:e===`up`?r?`translateY(${r.bottom+u-s.top}px)`:`translateY(${i.innerHeight+u-s.top}px)`:r?`translateY(-${s.top-r.top+s.height-u}px)`:`translateY(-${s.top+s.height-u}px)`}function V3e(e){return typeof e==`function`?e():e}function Q9(e,t,n){let r=B3e(e,t,V3e(n));r&&(t.style.transform=r)}var H3e=C.forwardRef(function(e,t){let n=Cm(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:o=!0,children:s,container:c,direction:l=`down`,easing:u=r,in:d,onEnter:f,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:_,style:v,timeout:y=i,...b}=e,x=C.useRef(null),S=ch(Wh(s),x,t),w=Jh(x,(e,t)=>{Q9(l,e,c),qh(e),f&&f(e,t)}),T=Jh(x,(e,t)=>{let r=Xh({timeout:y,style:v,easing:u},{mode:`enter`});e.style.transition=n.transitions.create(`transform`,r),e.style.transform=`none`,m&&m(e,t)}),E=Jh(x,p),D=Jh(x,_),O=Jh(x,e=>{let t=Xh({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Q9(l,e,c),h&&h(e)}),k=Jh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Q9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Ym(()=>{x.current&&Q9(l,x.current,c)}),t=eh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,G.jsx)(wh,{nodeRef:x,onEnter:w,onEntered:E,onEntering:T,onExit:O,onExited:k,onExiting:D,addEndListener:A,appear:o,in:d,timeout:y,...b,children:(e,{ownerState:t,...n})=>{let r;return r=e===`exited`&&!d?v||s.props.style?{visibility:`hidden`,...v,...s.props.style}:z3e:v&&s.props.style?{...v,...s.props.style}:v||s.props.style,C.cloneElement(s,{ref:S,style:r,...n})}})});function U3e(e){return Id(`MuiDrawer`,e)}Ld(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var W3e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},G3e=e=>{let{classes:t,anchor:n,variant:r}=e;return fp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},U3e,t)},K3e=J(Ib,{name:`MuiDrawer`,slot:`Root`,overridesResolver:W3e})(Pm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),q3e=J(`div`,{shouldForwardProp:Em,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:W3e})({flex:`0 0 auto`}),J3e=J(Wm,{name:`MuiDrawer`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${Y(n.anchor)}`],n.variant!==`temporary`&&t[`paperAnchorDocked${Y(n.anchor)}`]]}})(Pm(({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:e})=>e.anchor===`left`&&e.variant!==`temporary`,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`top`&&e.variant!==`temporary`,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`right`&&e.variant!==`temporary`,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`bottom`&&e.variant!==`temporary`,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),Y3e={left:`right`,right:`left`,top:`down`,bottom:`up`};function X3e(e){return[`left`,`right`].includes(e)}function Z3e({direction:e},t){return e===`rtl`&&X3e(t)?Y3e[t]:t}var Q3e=C.forwardRef(function(e,t){let n=Om({props:e,name:`MuiDrawer`}),r=Cm(),i=jf(),a={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:o=`left`,BackdropProps:s,children:c,className:l,elevation:u=16,hideBackdrop:d=!1,ModalProps:{BackdropProps:f,...p}={},onClose:m,open:h=!1,PaperProps:g={},SlideProps:_,TransitionComponent:v,transitionDuration:y=a,variant:b=`temporary`,slots:x={},slotProps:S={},...w}=n,T=C.useRef(!1);C.useEffect(()=>{T.current=!0},[]);let E=Z3e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=G3e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:lh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Hm(`root`,{ref:t,elementType:K3e,className:K(k.root,k.modal,l),shouldForwardComponentProp:!0,ownerState:O,externalForwardedProps:{...A,...w,...p},additionalProps:{open:h,onClose:m,hideBackdrop:d,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[N,P]=Hm(`paper`,{elementType:J3e,shouldForwardComponentProp:!0,className:K(k.paper,g.className),ownerState:O,externalForwardedProps:A,additionalProps:{elevation:b===`temporary`?u:0,square:!0,...b===`temporary`&&{role:`dialog`,"aria-modal":`true`}}}),[F,I]=Hm(`docked`,{elementType:q3e,ref:t,className:K(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Hm(`transition`,{elementType:H3e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:Y3e[E],timeout:y,appear:T.current}}),ee=(0,G.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,G.jsx)(F,{...I,children:ee});let z=(0,G.jsx)(L,{...R,children:ee});return b===`persistent`?(0,G.jsx)(F,{...I,children:z}):(0,G.jsx)(j,{...M,children:z})}),$3e=af({themeId:Sm}),e6e={error:Cx,warn:Qv,info:yb,debug:UT},t6e=({open:e,onClose:t})=>{let{t:n}=ms(),r=Cm(),i=(0,C.useMemo)(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(`error,warn,info`.split(`,`)),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(!0),h=(0,C.useCallback)(async()=>{try{let e=new URLSearchParams({level:l.join(`,`),limit:`500`,...d&&{search:d}}),t=await fetch(`api/logs?${e}`);t.ok&&o((await t.json()).entries)}catch(e){console.error(`Failed to fetch logs:`,e)}finally{c(!1)}},[l,d]);(0,C.useEffect)(()=>{e&&h()},[e,h]),(0,C.useEffect)(()=>{if(!p||!e)return;let t=setInterval(h,5e3);return()=>clearInterval(t)},[p,e,h]);let g=e=>{u(Array.isArray(e.target.value)?e.target.value:[e.target.value])},_=e=>{f(e.target.value)},v=async()=>{try{await fetch(`api/logs`,{method:`DELETE`}),o([])}catch(e){console.error(`Failed to clear logs:`,e)}},y=e=>(0,G.jsx)(e6e[e]||yb,{sx:{fontSize:16,color:i[e]}});return(0,G.jsxs)(zb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,G.jsxs)(Hb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(UT,{}),n(`logs.title`),(0,G.jsx)(Z,{sx:{flexGrow:1}}),(0,G.jsx)(fb,{title:n(`logs.autoRefresh`),children:(0,G.jsx)(kv,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,G.jsx)(Bh,{onClick:t,children:(0,G.jsx)(KT,{})})]}),(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Gv,{spacing:2,sx:{mb:2},children:(0,G.jsxs)(Gv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,G.jsxs)(Mv,{size:`small`,sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:n(`logs.logLevel`)}),(0,G.jsxs)(vS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,G.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,G.jsx)(kv,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,G.jsx)(yS,{value:`error`,children:n(`logs.error`)}),(0,G.jsx)(yS,{value:`warn`,children:n(`logs.warning`)}),(0,G.jsx)(yS,{value:`info`,children:n(`logs.info`)}),(0,G.jsx)(yS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,G.jsx)(SS,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,G.jsx)(_v,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,G.jsx)(_v,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,G.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,G.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,G.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,G.jsx)(kv,{label:e.level.toUpperCase(),size:`small`,sx:{backgroundColor:i[e.level],color:r.palette.getContrastText(i[e.level]??r.palette.grey[500]),fontSize:`0.7rem`,height:20}})]}),(0,G.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,G.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,G.jsx)(Bb,{children:(0,G.jsx)(_v,{onClick:t,children:n(`common.close`)})})]})};function n6e(){let{t:e}=ms(),{isConnected:t}=tv(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=async()=>{try{let e=await fetch(`api/health`);e.ok?(r(await e.json()),a(!1)):a(!0)}catch{a(!0)}};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let o=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`},s=n?.status===`healthy`&&!i,c=n?.services?.bridges,l=c&&c.total>0&&c.running===c.total,u=c&&c.total===0,d=n?(0,G.jsxs)(Z,{sx:{p:.5},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`nav.bridges`),`:`]}),` `,n.services.bridges.running??0,`/`,n.services.bridges.total??0,` `,e(`common.running`).toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e(`common.stopped`).toLowerCase()})`]}),n.services?.homeAssistant&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,G.jsx)(fb,{title:d,arrow:!0,children:(0,G.jsx)(kv,{icon:i||!s?(0,G.jsx)(Cx,{fontSize:`small`}):l?(0,G.jsx)(fv,{fontSize:`small`}):(0,G.jsx)(Sb,{fontSize:`small`}),label:e(i?`status.error`:s?t?u?`status.noBridges`:l?`common.online`:`common.starting`:`common.offline`:`status.unhealthy`),color:i||!s?`error`:!l||!t?`warning`:`success`,size:`small`,variant:`filled`,sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:`inherit`}}})})}var r6e=e=>(0,G.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,G.jsxs)(`g`,{style:{display:`inline`},children:[(0,G.jsx)(`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`}),(0,G.jsx)(`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`})]})}),i6e=e=>{let t=M3e();return(0,G.jsxs)(Z,{component:ea,to:Y9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,G.jsx)(r6e,{style:{height:`40px`}}),(0,G.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,G.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},a6e=()=>{let e=$3e(`(min-width:600px)`),{mode:t,setMode:n}=Nm(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Sr(),c=yr(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=ms(),f=[{label:d(`dashboard.title`),icon:(0,G.jsx)(ZT,{}),to:Y9.dashboard},{label:d(`nav.bridges`),icon:(0,G.jsx)(QT,{}),to:Y9.bridges},{label:d(`nav.devices`),icon:(0,G.jsx)(hb,{}),to:Y9.devices},{label:d(`nav.networkMap`),icon:(0,G.jsx)(LT,{}),to:Y9.networkMap},{label:d(`nav.startupOrder`),icon:(0,G.jsx)(pv,{}),to:Y9.startup},{label:d(`nav.lockCredentials`),icon:(0,G.jsx)(vT,{}),to:Y9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,G.jsx)($T,{}),to:Y9.labels},{label:`Plugins`,icon:(0,G.jsx)(YT,{}),to:Y9.plugins},{label:d(`nav.settings`),icon:(0,G.jsx)(DT,{}),to:Y9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,G.jsx)(Rhe,{}):(0,G.jsx)(Ehe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,G.jsx)(UT,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,G.jsx)(kx,{}),to:Y9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,G.jsxs)(Z,{children:[(0,G.jsx)(R3e,{sx:{height:`72px`},children:(0,G.jsx)(y3e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,G.jsxs)(Z9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(i6e,{large:e}),e?(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,G.jsx)(fb,{title:e.label,children:(0,G.jsx)(Bh,{component:ea,to:e.to,sx:{color:`inherit`,bgcolor:l(e.to)?`rgba(255,255,255,0.15)`:`transparent`,borderRadius:1},children:e.icon})},e.label):(0,G.jsx)(fb,{title:e.label,children:(0,G.jsx)(Bh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,G.jsx)(n6e,{})]}):(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,G.jsx)(n6e,{}),(0,G.jsx)(Bh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,G.jsx)(zhe,{})})]})]})})}),(0,G.jsx)(Q3e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,G.jsx)(ny,{sx:{width:250},children:f.map(e=>(0,G.jsxs)(Pae,{selected:l(e.to),onClick:()=>p(e),children:[(0,G.jsx)(sy,{children:e.icon}),(0,G.jsx)(ly,{primary:e.label})]},e.label))})}),(0,G.jsx)(t6e,{open:r,onClose:()=>i(!1)})]})},o6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=M3e(),{isConnected:r}=tv();return(0,G.jsxs)(Z,{children:[(0,G.jsx)(a6e,{}),(0,G.jsx)(y3e,{}),e&&(0,G.jsxs)(Uh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,G.jsx)(_v,{color:`inherit`,size:`small`,onClick:()=>window.location.reload(),children:`Reload`}),children:[`Version mismatch: frontend `,t,`, backend `,n,`. Please reload to get the latest UI.`]}),!r&&(0,G.jsx)(Uh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,G.jsx)(Z9,{sx:{p:2},children:(0,G.jsx)(b3e,{children:(0,G.jsx)(oi,{})})}),(0,G.jsx)(N3e,{}),(0,G.jsx)(A3e,{})]})},s6e=bm({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`}}}}}),$9=document.getElementsByTagName(`base`)[0]?.href?.replace(/\/$/,``);$9?.startsWith(`http`)&&($9=new URL($9).pathname);var c6e=Yi([{path:`/`,element:(0,G.jsx)(o6e,{}),children:f3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(C.StrictMode,{children:(0,G.jsx)(L,{store:h3e,children:(0,G.jsxs)(qee,{theme:s6e,children:[(0,G.jsx)(Vee,{}),(0,G.jsx)(wm,{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}}}),(0,G.jsx)(yre,{children:(0,G.jsx)(lne,{children:(0,G.jsx)(ba,{router:c6e})})})]})})}));
|