@linkdlab/funcnodes_react_flow 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/funcnodes_react_flow.css +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +19 -20
- package/dist/index.umd.js +6 -6
- package/package.json +89 -89
package/dist/index.cjs.js
CHANGED
|
@@ -416,7 +416,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
416
416
|
animation-iteration-count: infinite;
|
|
417
417
|
animation-delay: 200ms;
|
|
418
418
|
}
|
|
419
|
-
`,Cj=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiTouchRipple"}),{center:a=!1,classes:l={},className:u,...d}=r,[h,m]=z.useState([]),y=z.useRef(0),v=z.useRef(null);z.useEffect(()=>{v.current&&(v.current(),v.current=null)},[h]);const S=z.useRef(!1),w=pX(),A=z.useRef(null),E=z.useRef(null),R=z.useCallback(I=>{const{pulsate:L,rippleX:P,rippleY:G,rippleSize:$,cb:Z}=I;m(j=>[...j,T.jsx(xX,{classes:{ripple:dr(l.ripple,ll.ripple),rippleVisible:dr(l.rippleVisible,ll.rippleVisible),ripplePulsate:dr(l.ripplePulsate,ll.ripplePulsate),child:dr(l.child,ll.child),childLeaving:dr(l.childLeaving,ll.childLeaving),childPulsate:dr(l.childPulsate,ll.childPulsate)},timeout:HT,pulsate:L,rippleX:P,rippleY:G,rippleSize:$},y.current)]),y.current+=1,v.current=Z},[l]),k=z.useCallback((I={},L={},P=()=>{})=>{const{pulsate:G=!1,center:$=a||L.pulsate,fakeElement:Z=!1}=L;if(I?.type==="mousedown"&&S.current){S.current=!1;return}I?.type==="touchstart"&&(S.current=!0);const j=Z?null:E.current,X=j?j.getBoundingClientRect():{width:0,height:0,left:0,top:0};let ee,ae,U;if($||I===void 0||I.clientX===0&&I.clientY===0||!I.clientX&&!I.touches)ee=Math.round(X.width/2),ae=Math.round(X.height/2);else{const{clientX:te,clientY:V}=I.touches&&I.touches.length>0?I.touches[0]:I;ee=Math.round(te-X.left),ae=Math.round(V-X.top)}if($)U=Math.sqrt((2*X.width**2+X.height**2)/3),U%2===0&&(U+=1);else{const te=Math.max(Math.abs((j?j.clientWidth:0)-ee),ee)*2+2,V=Math.max(Math.abs((j?j.clientHeight:0)-ae),ae)*2+2;U=Math.sqrt(te**2+V**2)}I?.touches?A.current===null&&(A.current=()=>{R({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},w.start(mX,()=>{A.current&&(A.current(),A.current=null)})):R({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},[a,R,w]),D=z.useCallback(()=>{k({},{pulsate:!0})},[k]),M=z.useCallback((I,L)=>{if(w.clear(),I?.type==="touchend"&&A.current){A.current(),A.current=null,w.start(0,()=>{M(I,L)});return}A.current=null,m(P=>P.length>0?P.slice(1):P),v.current=L},[w]);return z.useImperativeHandle(n,()=>({pulsate:D,start:k,stop:M}),[D,k,M]),T.jsx(bX,{className:dr(ll.root,l.root,u),ref:E,...d,children:T.jsx(Sk,{component:null,exit:!0,children:h})})});process.env.NODE_ENV!=="production"&&(Cj.propTypes={center:ie.bool,classes:ie.object,className:ie.string});function SX(e){return os("MuiButtonBase",e)}const wX=yu("MuiButtonBase",["root","disabled","focusVisible"]),EX=e=>{const{disabled:t,focusVisible:n,focusVisibleClassName:r,classes:a}=e,u=Wc({root:["root",t&&"disabled",n&&"focusVisible"]},SX,a);return n&&r&&(u.root+=` ${r}`),u},CX=pl("button",{name:"MuiButtonBase",slot:"Root"})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${wX.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),_j=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiButtonBase"}),{action:a,centerRipple:l=!1,children:u,className:d,component:h="button",disabled:m=!1,disableRipple:y=!1,disableTouchRipple:v=!1,focusRipple:S=!1,focusVisibleClassName:w,LinkComponent:A="a",onBlur:E,onClick:R,onContextMenu:k,onDragLeave:D,onFocus:M,onFocusVisible:I,onKeyDown:L,onKeyUp:P,onMouseDown:G,onMouseLeave:$,onMouseUp:Z,onTouchEnd:j,onTouchMove:X,onTouchStart:ee,tabIndex:ae=0,TouchRippleProps:U,touchRippleRef:te,type:V,...W}=r,J=z.useRef(null),ne=aX(),B=PT(ne.ref,te),[oe,se]=z.useState(!1);m&&oe&&se(!1),z.useImperativeHandle(a,()=>({focusVisible:()=>{se(!0),J.current.focus()}}),[]);const Y=ne.shouldMount&&!y&&!m;z.useEffect(()=>{oe&&S&&!y&&ne.pulsate()},[y,S,oe,ne]);const he=Nc(ne,"start",G,v),Te=Nc(ne,"stop",k,v),me=Nc(ne,"stop",D,v),Ee=Nc(ne,"stop",Z,v),xe=Nc(ne,"stop",ut=>{oe&&ut.preventDefault(),$&&$(ut)},v),Be=Nc(ne,"start",ee,v),He=Nc(ne,"stop",j,v),Ye=Nc(ne,"stop",X,v),ke=Nc(ne,"stop",ut=>{R4(ut.target)||se(!1),E&&E(ut)},!1),Xe=x2(ut=>{J.current||(J.current=ut.currentTarget),R4(ut.target)&&(se(!0),I&&I(ut)),M&&M(ut)}),We=()=>{const ut=J.current;return h&&h!=="button"&&!(ut.tagName==="A"&&ut.href)},_t=x2(ut=>{S&&!ut.repeat&&oe&&ut.key===" "&&ne.stop(ut,()=>{ne.start(ut)}),ut.target===ut.currentTarget&&We()&&ut.key===" "&&ut.preventDefault(),L&&L(ut),ut.target===ut.currentTarget&&We()&&ut.key==="Enter"&&!m&&(ut.preventDefault(),R&&R(ut))}),Kt=x2(ut=>{S&&ut.key===" "&&oe&&!ut.defaultPrevented&&ne.stop(ut,()=>{ne.pulsate(ut)}),P&&P(ut),R&&ut.target===ut.currentTarget&&We()&&ut.key===" "&&!ut.defaultPrevented&&R(ut)});let Wt=h;Wt==="button"&&(W.href||W.to)&&(Wt=A);const qn={};Wt==="button"?(qn.type=V===void 0?"button":V,qn.disabled=m):(!W.href&&!W.to&&(qn.role="button"),m&&(qn["aria-disabled"]=m));const ra=PT(n,J),co={...r,centerRipple:l,component:h,disabled:m,disableRipple:y,disableTouchRipple:v,focusRipple:S,tabIndex:ae,focusVisible:oe},fo=EX(co);return T.jsxs(CX,{as:Wt,className:dr(fo.root,d),ownerState:co,onBlur:ke,onClick:R,onContextMenu:Te,onFocus:Xe,onKeyDown:_t,onKeyUp:Kt,onMouseDown:he,onMouseLeave:xe,onMouseUp:Ee,onDragLeave:me,onTouchEnd:He,onTouchMove:Ye,onTouchStart:Be,ref:ra,tabIndex:m?-1:ae,type:V,...qn,...W,children:[u,Y?T.jsx(Cj,{ref:B,center:l,...U}):null]})});function Nc(e,t,n,r=!1){return x2(a=>(n&&n(a),r||e[t](a),!0))}process.env.NODE_ENV!=="production"&&(_j.propTypes={action:eX,centerRipple:ie.bool,children:ie.node,classes:ie.object,className:ie.string,component:oX,disabled:ie.bool,disableRipple:ie.bool,disableTouchRipple:ie.bool,focusRipple:ie.bool,focusVisibleClassName:ie.string,href:ie.any,LinkComponent:ie.elementType,onBlur:ie.func,onClick:ie.func,onContextMenu:ie.func,onDragLeave:ie.func,onFocus:ie.func,onFocusVisible:ie.func,onKeyDown:ie.func,onKeyUp:ie.func,onMouseDown:ie.func,onMouseLeave:ie.func,onMouseUp:ie.func,onTouchEnd:ie.func,onTouchMove:ie.func,onTouchStart:ie.func,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),tabIndex:ie.number,TouchRippleProps:ie.object,touchRippleRef:ie.oneOfType([ie.func,ie.shape({current:ie.shape({pulsate:ie.func.isRequired,start:ie.func.isRequired,stop:ie.func.isRequired})})]),type:ie.oneOfType([ie.oneOf(["button","reset","submit"]),ie.string])});function _X(e){return os("MuiSvgIcon",e)}yu("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const AX=e=>{const{color:t,fontSize:n,classes:r}=e,a={root:["root",t!=="inherit"&&`color${Io(t)}`,`fontSize${Io(n)}`]};return Wc(a,_X,r)},TX=pl("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${Io(n.color)}`],t[`fontSize${Io(n.fontSize)}`]]}})(f0(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),G2=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiSvgIcon"}),{children:a,className:l,color:u="inherit",component:d="svg",fontSize:h="medium",htmlColor:m,inheritViewBox:y=!1,titleAccess:v,viewBox:S="0 0 24 24",...w}=r,A=z.isValidElement(a)&&a.type==="svg",E={...r,color:u,component:d,fontSize:h,instanceFontSize:t.fontSize,inheritViewBox:y,viewBox:S,hasSvgAsChild:A},R={};y||(R.viewBox=S);const k=AX(E);return T.jsxs(TX,{as:d,className:dr(k.root,l),focusable:"false",color:m,"aria-hidden":v?void 0:!0,role:v?"img":void 0,ref:n,...R,...w,...A&&a.props,ownerState:E,children:[A?a.props.children:a,v?T.jsx("title",{children:v}):null]})});process.env.NODE_ENV!=="production"&&(G2.propTypes={children:ie.node,classes:ie.object,className:ie.string,color:ie.oneOfType([ie.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),ie.string]),component:ie.elementType,fontSize:ie.oneOfType([ie.oneOf(["inherit","large","medium","small"]),ie.string]),htmlColor:ie.string,inheritViewBox:ie.bool,shapeRendering:ie.string,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),titleAccess:ie.string,viewBox:ie.string});G2.muiName="SvgIcon";function RX(e,t){function n(r,a){return T.jsx(G2,{"data-testid":process.env.NODE_ENV!=="production"?`${t}Icon`:void 0,ref:a,...r,children:e})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=G2.muiName,z.memo(z.forwardRef(n))}const kX=RX(T.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function OX(e){return os("MuiTableSortLabel",e)}const _A=yu("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]);function MX(e){return typeof e=="string"}function NX(e,t,n){return e===void 0||MX(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function DX(e,t,n){return typeof e=="function"?e(t,n):e}function IX(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function M4(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function zX(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:a,className:l}=e;if(!t){const w=dr(n?.className,l,a?.className,r?.className),A={...n?.style,...a?.style,...r?.style},E={...n,...a,...r};return w.length>0&&(E.className=w),Object.keys(A).length>0&&(E.style=A),{props:E,internalRef:void 0}}const u=IX({...a,...r}),d=M4(r),h=M4(a),m=t(u),y=dr(m?.className,n?.className,l,a?.className,r?.className),v={...m?.style,...n?.style,...a?.style,...r?.style},S={...m,...n,...h,...d};return y.length>0&&(S.className=y),Object.keys(v).length>0&&(S.style=v),{props:S,internalRef:m.ref}}function N4(e,t){const{className:n,elementType:r,ownerState:a,externalForwardedProps:l,internalForwardedProps:u,shouldForwardComponentProp:d=!1,...h}=t,{component:m,slots:y={[e]:void 0},slotProps:v={[e]:void 0},...S}=l,w=y[e]||r,A=DX(v[e],a),{props:{component:E,...R},internalRef:k}=zX({className:n,...h,externalForwardedProps:e==="root"?S:void 0,externalSlotProps:A}),D=PT(k,A?.ref,t.ref),M=e==="root"?E||m:E,I=NX(w,{...e==="root"&&!m&&!y[e]&&u,...e!=="root"&&!y[e]&&u,...R,...M&&!d&&{as:M},...M&&d&&{component:M},ref:D},a);return[w,I]}const jX=e=>{const{classes:t,direction:n,active:r}=e,a={root:["root",r&&"active",`direction${Io(n)}`],icon:["icon",`iconDirection${Io(n)}`]};return Wc(a,OX,t)},BX=pl(_j,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.active&&t.active]}})(f0(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${_A.icon}`]:{opacity:.5}},[`&.${_A.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${_A.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),LX=pl("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,t[`iconDirection${Io(n.direction)}`]]}})(f0(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),Aj=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiTableSortLabel"}),{active:a=!1,children:l,className:u,direction:d="asc",hideSortIcon:h=!1,IconComponent:m=kX,slots:y={},slotProps:v={},...S}=r,w={...r,active:a,direction:d,hideSortIcon:h,IconComponent:m},A=jX(w),E={slots:y,slotProps:v},[R,k]=N4("root",{elementType:BX,externalForwardedProps:E,ownerState:w,className:dr(A.root,u),ref:n}),[D,M]=N4("icon",{elementType:LX,externalForwardedProps:E,ownerState:w,className:A.icon});return T.jsxs(R,{disableRipple:!0,component:"span",...k,...S,children:[l,h&&!a?null:T.jsx(D,{as:m,...M})]})});process.env.NODE_ENV!=="production"&&(Aj.propTypes={active:ie.bool,children:ie.node,classes:ie.object,className:ie.string,direction:ie.oneOf(["asc","desc"]),hideSortIcon:ie.bool,IconComponent:ie.elementType,slotProps:ie.shape({icon:ie.oneOfType([ie.func,ie.object]),root:ie.oneOfType([ie.func,ie.object])}),slots:ie.shape({icon:ie.elementType,root:ie.elementType}),sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object])});const PX=e=>{const t=[];if(e===void 0)return{header:[],rows:[]};e.data===void 0&&(e.data=[]),(e.columns===void 0||e.columns.length===0)&&(e.data.length===0?e.columns=[]:e.columns=e.data[0].map((r,a)=>`col${a}`)),(e.index===void 0||e.index.length===0)&&(e.index=e.data.map((r,a)=>`row${a}`));const n=Math.max(e.index.length,e.data.length);for(let r=0;r<n;r++){const l=[r<e.index.length?e.index[r]:`row${r}`];for(let u=0;u<e.columns.length;u++)l.push(e.data[r]?e.data[r][u]:void 0);t.push(l)}return{header:["index",...e.columns],rows:t}},HX=(e,t)=>e==="desc"?(n,r)=>r[t]<n[t]?-1:r[t]>n[t]?1:0:(n,r)=>n[t]<r[t]?-1:n[t]>r[t]?1:0,VT=(e,t)=>{const n=e.map((r,a)=>[r,a]);return n.sort((r,a)=>t(r[0],a[0])),n.map(r=>r[0])},VX=(e,t,n=1e3)=>{if(e.length<=n)return VT(e,t);const r=[];for(let l=0;l<e.length;l+=n)r.push(e.slice(l,l+n));const a=r.map(l=>VT(l,t));return FX(a,t)},FX=(e,t)=>{if(e.length===1)return e[0];const n=[],r=new Array(e.length).fill(0);for(;r.some((a,l)=>a<e[l].length);){let a=-1,l=null;for(let u=0;u<e.length;u++)if(r[u]<e[u].length){const d=e[u][r[u]];(l===null||t(d,l)<0)&&(l=d,a=u)}a!==-1&&l!==null&&(n.push(l),r[a]++)}return n},D4=(e,t,n)=>{const r=Math.ceil(e/n);return{currentPage:r===0?1:Math.min(Math.max(1,t),r),pageSize:n,totalPages:r,totalRows:e}},GX=(e,t,n)=>{const r=(t-1)*n,a=r+n;return e.slice(r,a)},UX=(e,t,n,r,a=5)=>{const l=Math.max(0,Math.floor(e/n)-a),u=Math.min(r-1,Math.ceil((e+t)/n)+a);return{startIndex:l,endIndex:u}},$X=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},Tj=({tabledata:e,className:t="",size:n="small",onSortChange:r,enablePagination:a=void 0,pageSize:l=50,enableVirtualScrolling:u=void 0,virtualScrollingHeight:d=400,enableLazyLoading:h=void 0,onLoadMore:m})=>{e||(e={columns:[],index:[],data:[]});const y=e.index.length;y>1e4&&(h=h===void 0?!0:h),y>1e3&&(u=u===void 0?!0:u),y>2*l&&(a=a===void 0?!0:a),h=h===void 0?!1:h,u=u===void 0?!1:u,a=a===void 0?!1:a;const v=Q.useMemo(()=>PX(e),[e]),[S,w]=Q.useState("asc"),[A,E]=Q.useState("index"),[R,k]=Q.useState(()=>D4(v.rows.length,1,l)),[D,M]=Q.useState(0),I=Q.useRef(null),L=Q.useMemo(()=>{const J=v.header.indexOf(A);return J===-1?0:J},[v.header,A]),P=Q.useMemo(()=>$X((J,ne)=>{w(ne),E(J),r?.(J,ne)},150),[r]),G=Q.useCallback(J=>{const B=A===J&&S==="asc"?"desc":"asc";v.rows.length>1e3?P(J,B):(w(B),E(J),r?.(J,B))},[A,S,r,v.rows.length,P]),$=Q.useMemo(()=>HX(S,L),[S,L]),Z=Q.useMemo(()=>v.rows.length>1e3?VX(v.rows,$):VT(v.rows,$),[v.rows,$]),j=Q.useMemo(()=>a?GX(Z,R.currentPage,R.pageSize):Z,[Z,a,R.currentPage,R.pageSize]),X={itemHeight:48,overscan:5,containerHeight:d},ee=Q.useMemo(()=>u?UX(D,X.containerHeight,X.itemHeight,j.length,X.overscan):{startIndex:0,endIndex:j.length-1},[D,u,j.length,X]),ae=Q.useCallback(J=>{u&&M(J.currentTarget.scrollTop)},[u]),U=Q.useCallback(J=>{k(ne=>({...ne,currentPage:J}))},[]),te=Q.useCallback(J=>{if(!(!a||!(J.target.closest(".sortable-table-wrapper")===J.currentTarget)))switch(J.key){case"ArrowLeft":R.currentPage>1&&(J.preventDefault(),J.stopPropagation(),U(R.currentPage-1));break;case"ArrowRight":R.currentPage<R.totalPages&&(console.log("ArrowRight",R.currentPage,R.totalPages),J.preventDefault(),J.stopPropagation(),U(R.currentPage+1));break;case"Home":R.currentPage>1&&(J.preventDefault(),J.stopPropagation(),U(1));break;case"End":R.currentPage<R.totalPages&&(J.preventDefault(),J.stopPropagation(),U(R.totalPages));break}},[a,R.currentPage,R.totalPages,U]);Q.useEffect(()=>{a&&k(J=>D4(Z.length,J.currentPage,l))},[Z.length,a,l]),Q.useEffect(()=>{h&&m&&R.currentPage>=R.totalPages-1&&m(R.currentPage+1)},[h,m,R.currentPage,R.totalPages]);const V=()=>a?T.jsxs("div",{className:"sortable-table-pagination",children:[T.jsx("button",{onClick:()=>U(R.currentPage-1),disabled:R.currentPage<=1,className:"pagination-button",children:"Previous"}),T.jsxs("span",{className:"pagination-info",children:["Page ",R.currentPage," of ",R.totalPages,"(",R.totalRows," total rows)"]}),T.jsx("button",{onClick:()=>U(R.currentPage+1),disabled:R.currentPage>=R.totalPages,className:"pagination-button",children:"Next"})]}):null,W=()=>{const J=u?j.slice(ee.startIndex,ee.endIndex+1):j;return T.jsxs(yj,{children:[u&&T.jsx(C1,{style:{height:ee.startIndex*X.itemHeight},children:T.jsx(E1,{colSpan:v.header.length})}),J.map((ne,B)=>{const oe=u?ee.startIndex+B:B;return T.jsx(C1,{children:ne.map((se,Y)=>T.jsx(E1,{className:Y===0?"sortable-table-index-cell":"sortable-table-data-cell",children:se},`${e.index?.[oe]||oe}-${Y}`))},e.index?.[oe]||oe)}),u&&T.jsx(C1,{style:{height:(j.length-ee.endIndex-1)*X.itemHeight},children:T.jsx(E1,{colSpan:v.header.length})})]})};return T.jsxs("div",{className:"sortable-table-wrapper",onKeyDown:te,tabIndex:a?0:-1,role:a?"application":void 0,"aria-label":a?"Sortable table with pagination":void 0,children:[T.jsx(vj,{className:`sortable-table-container ${t}`,ref:I,onScroll:ae,style:u?{height:d}:void 0,children:T.jsxs(gj,{size:n,children:[T.jsx(bj,{className:"sortable-table-head",children:T.jsx(C1,{className:"sortable-table-header-row",children:v.header.map(J=>T.jsx(E1,{className:"sortable-table-header-cell","aria-label":`Sort by ${J}`,children:T.jsx(Aj,{active:A===J,direction:A===J?S:"asc",onClick:()=>G(J),className:"sortable-table-sort-label",sx:{"& .MuiTableSortLabel-icon":{color:"inherit !important"}},children:J})},J))})}),W()]})}),V()]})};Tj.displayName="SortableTable";function Ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function I4(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function JE(...e){return t=>{let n=!1;const r=e.map(a=>{const l=I4(a,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let a=0;a<r.length;a++){const l=r[a];typeof l=="function"?l():I4(e[a],null)}}}}function En(...e){return z.useCallback(JE(...e),e)}function XX(e,t){const n=z.createContext(t),r=l=>{const{children:u,...d}=l,h=z.useMemo(()=>d,Object.values(d));return T.jsx(n.Provider,{value:h,children:u})};r.displayName=e+"Provider";function a(l){const u=z.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,a]}function bu(e,t=[]){let n=[];function r(l,u){const d=z.createContext(u),h=n.length;n=[...n,u];const m=v=>{const{scope:S,children:w,...A}=v,E=S?.[e]?.[h]||d,R=z.useMemo(()=>A,Object.values(A));return T.jsx(E.Provider,{value:R,children:w})};m.displayName=l+"Provider";function y(v,S){const w=S?.[e]?.[h]||d,A=z.useContext(w);if(A)return A;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${l}\``)}return[m,y]}const a=()=>{const l=n.map(u=>z.createContext(u));return function(d){const h=d?.[e]||l;return z.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return a.scopeName=e,[r,YX(a,...t)]}function YX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const u=r.reduce((d,{useScope:h,scopeName:m})=>{const v=h(l)[`__scope${m}`];return{...d,...v}},{});return z.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Gc=globalThis?.document?z.useLayoutEffect:()=>{},ZX=z[" useId ".trim().toString()]||(()=>{}),WX=0;function hu(e){const[t,n]=z.useState(ZX());return Gc(()=>{n(r=>r??String(WX++))},[e]),e||(t?`radix-${t}`:"")}var qX=z[" useInsertionEffect ".trim().toString()]||Gc;function Hd({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,l,u]=JX({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:a;{const y=z.useRef(e!==void 0);z.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,r])}const m=z.useCallback(y=>{if(d){const v=QX(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[h,m]}function JX({defaultProp:e,onChange:t}){const[n,r]=z.useState(e),a=z.useRef(n),l=z.useRef(t);return qX(()=>{l.current=t},[t]),z.useEffect(()=>{a.current!==n&&(l.current?.(n),a.current=n)},[n,a]),[n,r,l]}function QX(e){return typeof e=="function"}function Jy(e){const t=KX(e),n=z.forwardRef((r,a)=>{const{children:l,...u}=r,d=z.Children.toArray(l),h=d.find(tY);if(h){const m=h.props.children,y=d.map(v=>v===h?z.Children.count(m)>1?z.Children.only(null):z.isValidElement(m)?m.props.children:null:v);return T.jsx(t,{...u,ref:a,children:z.isValidElement(m)?z.cloneElement(m,void 0,y):null})}return T.jsx(t,{...u,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function KX(e){const t=z.forwardRef((n,r)=>{const{children:a,...l}=n;if(z.isValidElement(a)){const u=rY(a),d=nY(l,a.props);return a.type!==z.Fragment&&(d.ref=r?JE(r,u):u),z.cloneElement(a,d)}return z.Children.count(a)>1?z.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eY=Symbol("radix.slottable");function tY(e){return z.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eY}function nY(e,t){const n={...t};for(const r in t){const a=e[r],l=t[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function rY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zt=oY.reduce((e,t)=>{const n=Jy(`Primitive.${t}`),r=z.forwardRef((a,l)=>{const{asChild:u,...d}=a,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ek(e,t){e&&kE.flushSync(()=>e.dispatchEvent(t))}function ka(e){const t=z.useRef(e);return z.useEffect(()=>{t.current=e}),z.useMemo(()=>(...n)=>t.current?.(...n),[])}function aY(e,t=globalThis?.document){const n=ka(e);z.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var iY="DismissableLayer",FT="dismissableLayer.update",lY="dismissableLayer.pointerDownOutside",sY="dismissableLayer.focusOutside",z4,Rj=z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yx=z.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=z.useContext(Rj),[y,v]=z.useState(null),S=y?.ownerDocument??globalThis?.document,[,w]=z.useState({}),A=En(t,G=>v(G)),E=Array.from(m.layers),[R]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=E.indexOf(R),D=y?E.indexOf(y):-1,M=m.layersWithOutsidePointerEventsDisabled.size>0,I=D>=k,L=cY(G=>{const $=G.target,Z=[...m.branches].some(j=>j.contains($));!I||Z||(a?.(G),u?.(G),G.defaultPrevented||d?.())},S),P=fY(G=>{const $=G.target;[...m.branches].some(j=>j.contains($))||(l?.(G),u?.(G),G.defaultPrevented||d?.())},S);return aY(G=>{D===m.layers.size-1&&(r?.(G),!G.defaultPrevented&&d&&(G.preventDefault(),d()))},S),z.useEffect(()=>{if(y)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(z4=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),j4(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(S.body.style.pointerEvents=z4)}},[y,S,n,m]),z.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),j4())},[y,m]),z.useEffect(()=>{const G=()=>w({});return document.addEventListener(FT,G),()=>document.removeEventListener(FT,G)},[]),T.jsx(zt.div,{...h,ref:A,style:{pointerEvents:M?I?"auto":"none":void 0,...e.style},onFocusCapture:Ke(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ke(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ke(e.onPointerDownCapture,L.onPointerDownCapture)})});yx.displayName=iY;var uY="DismissableLayerBranch",kj=z.forwardRef((e,t)=>{const n=z.useContext(Rj),r=z.useRef(null),a=En(t,r);return z.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),T.jsx(zt.div,{...e,ref:a})});kj.displayName=uY;function cY(e,t=globalThis?.document){const n=ka(e),r=z.useRef(!1),a=z.useRef(()=>{});return z.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let h=function(){Oj(lY,n,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=h,t.addEventListener("click",a.current,{once:!0})):h()}else t.removeEventListener("click",a.current);r.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function fY(e,t=globalThis?.document){const n=ka(e),r=z.useRef(!1);return z.useEffect(()=>{const a=l=>{l.target&&!r.current&&Oj(sY,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function j4(){const e=new CustomEvent(FT);document.dispatchEvent(e)}function Oj(e,t,n,{discrete:r}){const a=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Ek(a,l):a.dispatchEvent(l)}var dY=yx,hY=kj,AA="focusScope.autoFocusOnMount",TA="focusScope.autoFocusOnUnmount",B4={bubbles:!1,cancelable:!0},pY="FocusScope",QE=z.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...u}=e,[d,h]=z.useState(null),m=ka(a),y=ka(l),v=z.useRef(null),S=En(t,E=>h(E)),w=z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;z.useEffect(()=>{if(r){let E=function(M){if(w.paused||!d)return;const I=M.target;d.contains(I)?v.current=I:Cd(v.current,{select:!0})},R=function(M){if(w.paused||!d)return;const I=M.relatedTarget;I!==null&&(d.contains(I)||Cd(v.current,{select:!0}))},k=function(M){if(document.activeElement===document.body)for(const L of M)L.removedNodes.length>0&&Cd(d)};document.addEventListener("focusin",E),document.addEventListener("focusout",R);const D=new MutationObserver(k);return d&&D.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",R),D.disconnect()}}},[r,d,w.paused]),z.useEffect(()=>{if(d){P4.add(w);const E=document.activeElement;if(!d.contains(E)){const k=new CustomEvent(AA,B4);d.addEventListener(AA,m),d.dispatchEvent(k),k.defaultPrevented||(mY(xY(Mj(d)),{select:!0}),document.activeElement===E&&Cd(d))}return()=>{d.removeEventListener(AA,m),setTimeout(()=>{const k=new CustomEvent(TA,B4);d.addEventListener(TA,y),d.dispatchEvent(k),k.defaultPrevented||Cd(E??document.body,{select:!0}),d.removeEventListener(TA,y),P4.remove(w)},0)}}},[d,m,y,w]);const A=z.useCallback(E=>{if(!n&&!r||w.paused)return;const R=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,k=document.activeElement;if(R&&k){const D=E.currentTarget,[M,I]=gY(D);M&&I?!E.shiftKey&&k===I?(E.preventDefault(),n&&Cd(M,{select:!0})):E.shiftKey&&k===M&&(E.preventDefault(),n&&Cd(I,{select:!0})):k===D&&E.preventDefault()}},[n,r,w.paused]);return T.jsx(zt.div,{tabIndex:-1,...u,ref:S,onKeyDown:A})});QE.displayName=pY;function mY(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Cd(r,{select:t}),document.activeElement!==n)return}function gY(e){const t=Mj(e),n=L4(t,e),r=L4(t.reverse(),e);return[n,r]}function Mj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function L4(e,t){for(const n of e)if(!yY(n,{upTo:t}))return n}function yY(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vY(e){return e instanceof HTMLInputElement&&"select"in e}function Cd(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vY(e)&&t&&e.select()}}var P4=bY();function bY(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=H4(e,t),e.unshift(t)},remove(t){e=H4(e,t),e[0]?.resume()}}}function H4(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function xY(e){return e.filter(t=>t.tagName!=="A")}var SY="Portal",KE=z.forwardRef((e,t)=>{const{container:n,...r}=e,[a,l]=z.useState(!1);Gc(()=>l(!0),[]);const u=n||a&&globalThis?.document?.body;return u?dx.createPortal(T.jsx(zt.div,{...r,ref:t}),u):null});KE.displayName=SY;function wY(e,t){return z.useReducer((n,r)=>t[n][r]??n,e)}var as=e=>{const{present:t,children:n}=e,r=EY(t),a=typeof n=="function"?n({present:r.isPresent}):z.Children.only(n),l=En(r.ref,CY(a));return typeof n=="function"||r.isPresent?z.cloneElement(a,{ref:l}):null};as.displayName="Presence";function EY(e){const[t,n]=z.useState(),r=z.useRef(null),a=z.useRef(e),l=z.useRef("none"),u=e?"mounted":"unmounted",[d,h]=wY(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return z.useEffect(()=>{const m=Pw(r.current);l.current=d==="mounted"?m:"none"},[d]),Gc(()=>{const m=r.current,y=a.current;if(y!==e){const S=l.current,w=Pw(m);e?h("MOUNT"):w==="none"||m?.display==="none"?h("UNMOUNT"):h(y&&S!==w?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),Gc(()=>{if(t){let m;const y=t.ownerDocument.defaultView??window,v=w=>{const E=Pw(r.current).includes(w.animationName);if(w.target===t&&E&&(h("ANIMATION_END"),!a.current)){const R=t.style.animationFillMode;t.style.animationFillMode="forwards",m=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=R)})}},S=w=>{w.target===t&&(l.current=Pw(r.current))};return t.addEventListener("animationstart",S),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{y.clearTimeout(m),t.removeEventListener("animationstart",S),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:z.useCallback(m=>{r.current=m?getComputedStyle(m):null,n(m)},[])}}function Pw(e){return e?.animationName||"none"}function CY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var RA=0;function Ck(){z.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??V4()),document.body.insertAdjacentElement("beforeend",e[1]??V4()),RA++,()=>{RA===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),RA--}},[])}function V4(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var su=function(){return su=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},su.apply(this,arguments)};function Nj(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 a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function S2(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,l;r<a;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}var w2="right-scroll-bar-position",E2="width-before-scroll-bar",_Y="with-scroll-bars-hidden",AY="--removed-body-scroll-bar-size";function kA(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function TY(e,t){var n=Q.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var RY=typeof window<"u"?z.useLayoutEffect:z.useEffect,F4=new WeakMap;function kY(e,t){var n=TY(null,function(r){return e.forEach(function(a){return kA(a,r)})});return RY(function(){var r=F4.get(n);if(r){var a=new Set(r),l=new Set(e),u=n.current;a.forEach(function(d){l.has(d)||kA(d,null)}),l.forEach(function(d){a.has(d)||kA(d,u)})}F4.set(n,e)},[e]),n}function OY(e){return e}function MY(e,t){t===void 0&&(t=OY);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var u=t(l,r);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(r=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){r=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var y=u;u=[],y.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(y){u.push(y),m()},filter:function(y){return u=u.filter(y),n}}}};return a}function NY(e){e===void 0&&(e={});var t=MY(null);return t.options=su({async:!0,ssr:!1},e),t}var Dj=function(e){var t=e.sideCar,n=Nj(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return z.createElement(r,su({},n))};Dj.isSideCarExport=!0;function DY(e,t){return e.useMedium(t),Dj}var Ij=NY(),OA=function(){},eC=z.forwardRef(function(e,t){var n=z.useRef(null),r=z.useState({onScrollCapture:OA,onWheelCapture:OA,onTouchMoveCapture:OA}),a=r[0],l=r[1],u=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,y=e.enabled,v=e.shards,S=e.sideCar,w=e.noRelative,A=e.noIsolation,E=e.inert,R=e.allowPinchZoom,k=e.as,D=k===void 0?"div":k,M=e.gapMode,I=Nj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=S,P=kY([n,t]),G=su(su({},I),a);return z.createElement(z.Fragment,null,y&&z.createElement(L,{sideCar:Ij,removeScrollBar:m,shards:v,noRelative:w,noIsolation:A,inert:E,setCallbacks:l,allowPinchZoom:!!R,lockRef:n,gapMode:M}),u?z.cloneElement(z.Children.only(d),su(su({},G),{ref:P})):z.createElement(D,su({},G,{className:h,ref:P}),d))});eC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};eC.classNames={fullWidth:E2,zeroRight:w2};var IY=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zY(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=IY();return t&&e.setAttribute("nonce",t),e}function jY(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function BY(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var LY=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zY())&&(jY(t,n),BY(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},PY=function(){var e=LY();return function(t,n){z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},zj=function(){var e=PY(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},HY={left:0,top:0,right:0,gap:0},MA=function(e){return parseInt(e||"",10)||0},VY=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[MA(n),MA(r),MA(a)]},FY=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return HY;var t=VY(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},GY=zj(),Vy="data-scroll-locked",UY=function(e,t,n,r){var a=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
|
|
419
|
+
`,Cj=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiTouchRipple"}),{center:a=!1,classes:l={},className:u,...d}=r,[h,m]=z.useState([]),y=z.useRef(0),v=z.useRef(null);z.useEffect(()=>{v.current&&(v.current(),v.current=null)},[h]);const S=z.useRef(!1),w=pX(),A=z.useRef(null),E=z.useRef(null),R=z.useCallback(I=>{const{pulsate:L,rippleX:P,rippleY:G,rippleSize:$,cb:Z}=I;m(j=>[...j,T.jsx(xX,{classes:{ripple:dr(l.ripple,ll.ripple),rippleVisible:dr(l.rippleVisible,ll.rippleVisible),ripplePulsate:dr(l.ripplePulsate,ll.ripplePulsate),child:dr(l.child,ll.child),childLeaving:dr(l.childLeaving,ll.childLeaving),childPulsate:dr(l.childPulsate,ll.childPulsate)},timeout:HT,pulsate:L,rippleX:P,rippleY:G,rippleSize:$},y.current)]),y.current+=1,v.current=Z},[l]),k=z.useCallback((I={},L={},P=()=>{})=>{const{pulsate:G=!1,center:$=a||L.pulsate,fakeElement:Z=!1}=L;if(I?.type==="mousedown"&&S.current){S.current=!1;return}I?.type==="touchstart"&&(S.current=!0);const j=Z?null:E.current,X=j?j.getBoundingClientRect():{width:0,height:0,left:0,top:0};let ee,ae,U;if($||I===void 0||I.clientX===0&&I.clientY===0||!I.clientX&&!I.touches)ee=Math.round(X.width/2),ae=Math.round(X.height/2);else{const{clientX:te,clientY:V}=I.touches&&I.touches.length>0?I.touches[0]:I;ee=Math.round(te-X.left),ae=Math.round(V-X.top)}if($)U=Math.sqrt((2*X.width**2+X.height**2)/3),U%2===0&&(U+=1);else{const te=Math.max(Math.abs((j?j.clientWidth:0)-ee),ee)*2+2,V=Math.max(Math.abs((j?j.clientHeight:0)-ae),ae)*2+2;U=Math.sqrt(te**2+V**2)}I?.touches?A.current===null&&(A.current=()=>{R({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},w.start(mX,()=>{A.current&&(A.current(),A.current=null)})):R({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},[a,R,w]),D=z.useCallback(()=>{k({},{pulsate:!0})},[k]),M=z.useCallback((I,L)=>{if(w.clear(),I?.type==="touchend"&&A.current){A.current(),A.current=null,w.start(0,()=>{M(I,L)});return}A.current=null,m(P=>P.length>0?P.slice(1):P),v.current=L},[w]);return z.useImperativeHandle(n,()=>({pulsate:D,start:k,stop:M}),[D,k,M]),T.jsx(bX,{className:dr(ll.root,l.root,u),ref:E,...d,children:T.jsx(Sk,{component:null,exit:!0,children:h})})});process.env.NODE_ENV!=="production"&&(Cj.propTypes={center:ie.bool,classes:ie.object,className:ie.string});function SX(e){return os("MuiButtonBase",e)}const wX=yu("MuiButtonBase",["root","disabled","focusVisible"]),EX=e=>{const{disabled:t,focusVisible:n,focusVisibleClassName:r,classes:a}=e,u=Wc({root:["root",t&&"disabled",n&&"focusVisible"]},SX,a);return n&&r&&(u.root+=` ${r}`),u},CX=pl("button",{name:"MuiButtonBase",slot:"Root"})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${wX.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),_j=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiButtonBase"}),{action:a,centerRipple:l=!1,children:u,className:d,component:h="button",disabled:m=!1,disableRipple:y=!1,disableTouchRipple:v=!1,focusRipple:S=!1,focusVisibleClassName:w,LinkComponent:A="a",onBlur:E,onClick:R,onContextMenu:k,onDragLeave:D,onFocus:M,onFocusVisible:I,onKeyDown:L,onKeyUp:P,onMouseDown:G,onMouseLeave:$,onMouseUp:Z,onTouchEnd:j,onTouchMove:X,onTouchStart:ee,tabIndex:ae=0,TouchRippleProps:U,touchRippleRef:te,type:V,...W}=r,J=z.useRef(null),ne=aX(),B=PT(ne.ref,te),[oe,se]=z.useState(!1);m&&oe&&se(!1),z.useImperativeHandle(a,()=>({focusVisible:()=>{se(!0),J.current.focus()}}),[]);const Y=ne.shouldMount&&!y&&!m;z.useEffect(()=>{oe&&S&&!y&&ne.pulsate()},[y,S,oe,ne]);const he=Nc(ne,"start",G,v),Te=Nc(ne,"stop",k,v),me=Nc(ne,"stop",D,v),Ee=Nc(ne,"stop",Z,v),xe=Nc(ne,"stop",ut=>{oe&&ut.preventDefault(),$&&$(ut)},v),Be=Nc(ne,"start",ee,v),He=Nc(ne,"stop",j,v),Ye=Nc(ne,"stop",X,v),ke=Nc(ne,"stop",ut=>{R4(ut.target)||se(!1),E&&E(ut)},!1),Xe=x2(ut=>{J.current||(J.current=ut.currentTarget),R4(ut.target)&&(se(!0),I&&I(ut)),M&&M(ut)}),We=()=>{const ut=J.current;return h&&h!=="button"&&!(ut.tagName==="A"&&ut.href)},_t=x2(ut=>{S&&!ut.repeat&&oe&&ut.key===" "&&ne.stop(ut,()=>{ne.start(ut)}),ut.target===ut.currentTarget&&We()&&ut.key===" "&&ut.preventDefault(),L&&L(ut),ut.target===ut.currentTarget&&We()&&ut.key==="Enter"&&!m&&(ut.preventDefault(),R&&R(ut))}),Kt=x2(ut=>{S&&ut.key===" "&&oe&&!ut.defaultPrevented&&ne.stop(ut,()=>{ne.pulsate(ut)}),P&&P(ut),R&&ut.target===ut.currentTarget&&We()&&ut.key===" "&&!ut.defaultPrevented&&R(ut)});let Wt=h;Wt==="button"&&(W.href||W.to)&&(Wt=A);const qn={};Wt==="button"?(qn.type=V===void 0?"button":V,qn.disabled=m):(!W.href&&!W.to&&(qn.role="button"),m&&(qn["aria-disabled"]=m));const ra=PT(n,J),co={...r,centerRipple:l,component:h,disabled:m,disableRipple:y,disableTouchRipple:v,focusRipple:S,tabIndex:ae,focusVisible:oe},fo=EX(co);return T.jsxs(CX,{as:Wt,className:dr(fo.root,d),ownerState:co,onBlur:ke,onClick:R,onContextMenu:Te,onFocus:Xe,onKeyDown:_t,onKeyUp:Kt,onMouseDown:he,onMouseLeave:xe,onMouseUp:Ee,onDragLeave:me,onTouchEnd:He,onTouchMove:Ye,onTouchStart:Be,ref:ra,tabIndex:m?-1:ae,type:V,...qn,...W,children:[u,Y?T.jsx(Cj,{ref:B,center:l,...U}):null]})});function Nc(e,t,n,r=!1){return x2(a=>(n&&n(a),r||e[t](a),!0))}process.env.NODE_ENV!=="production"&&(_j.propTypes={action:eX,centerRipple:ie.bool,children:ie.node,classes:ie.object,className:ie.string,component:oX,disabled:ie.bool,disableRipple:ie.bool,disableTouchRipple:ie.bool,focusRipple:ie.bool,focusVisibleClassName:ie.string,href:ie.any,LinkComponent:ie.elementType,onBlur:ie.func,onClick:ie.func,onContextMenu:ie.func,onDragLeave:ie.func,onFocus:ie.func,onFocusVisible:ie.func,onKeyDown:ie.func,onKeyUp:ie.func,onMouseDown:ie.func,onMouseLeave:ie.func,onMouseUp:ie.func,onTouchEnd:ie.func,onTouchMove:ie.func,onTouchStart:ie.func,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),tabIndex:ie.number,TouchRippleProps:ie.object,touchRippleRef:ie.oneOfType([ie.func,ie.shape({current:ie.shape({pulsate:ie.func.isRequired,start:ie.func.isRequired,stop:ie.func.isRequired})})]),type:ie.oneOfType([ie.oneOf(["button","reset","submit"]),ie.string])});function _X(e){return os("MuiSvgIcon",e)}yu("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const AX=e=>{const{color:t,fontSize:n,classes:r}=e,a={root:["root",t!=="inherit"&&`color${Io(t)}`,`fontSize${Io(n)}`]};return Wc(a,_X,r)},TX=pl("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${Io(n.color)}`],t[`fontSize${Io(n.fontSize)}`]]}})(f0(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),G2=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiSvgIcon"}),{children:a,className:l,color:u="inherit",component:d="svg",fontSize:h="medium",htmlColor:m,inheritViewBox:y=!1,titleAccess:v,viewBox:S="0 0 24 24",...w}=r,A=z.isValidElement(a)&&a.type==="svg",E={...r,color:u,component:d,fontSize:h,instanceFontSize:t.fontSize,inheritViewBox:y,viewBox:S,hasSvgAsChild:A},R={};y||(R.viewBox=S);const k=AX(E);return T.jsxs(TX,{as:d,className:dr(k.root,l),focusable:"false",color:m,"aria-hidden":v?void 0:!0,role:v?"img":void 0,ref:n,...R,...w,...A&&a.props,ownerState:E,children:[A?a.props.children:a,v?T.jsx("title",{children:v}):null]})});process.env.NODE_ENV!=="production"&&(G2.propTypes={children:ie.node,classes:ie.object,className:ie.string,color:ie.oneOfType([ie.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),ie.string]),component:ie.elementType,fontSize:ie.oneOfType([ie.oneOf(["inherit","large","medium","small"]),ie.string]),htmlColor:ie.string,inheritViewBox:ie.bool,shapeRendering:ie.string,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),titleAccess:ie.string,viewBox:ie.string});G2.muiName="SvgIcon";function RX(e,t){function n(r,a){return T.jsx(G2,{"data-testid":process.env.NODE_ENV!=="production"?`${t}Icon`:void 0,ref:a,...r,children:e})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=G2.muiName,z.memo(z.forwardRef(n))}const kX=RX(T.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function OX(e){return os("MuiTableSortLabel",e)}const _A=yu("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]);function MX(e){return typeof e=="string"}function NX(e,t,n){return e===void 0||MX(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function DX(e,t,n){return typeof e=="function"?e(t,n):e}function IX(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function M4(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function zX(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:a,className:l}=e;if(!t){const w=dr(n?.className,l,a?.className,r?.className),A={...n?.style,...a?.style,...r?.style},E={...n,...a,...r};return w.length>0&&(E.className=w),Object.keys(A).length>0&&(E.style=A),{props:E,internalRef:void 0}}const u=IX({...a,...r}),d=M4(r),h=M4(a),m=t(u),y=dr(m?.className,n?.className,l,a?.className,r?.className),v={...m?.style,...n?.style,...a?.style,...r?.style},S={...m,...n,...h,...d};return y.length>0&&(S.className=y),Object.keys(v).length>0&&(S.style=v),{props:S,internalRef:m.ref}}function N4(e,t){const{className:n,elementType:r,ownerState:a,externalForwardedProps:l,internalForwardedProps:u,shouldForwardComponentProp:d=!1,...h}=t,{component:m,slots:y={[e]:void 0},slotProps:v={[e]:void 0},...S}=l,w=y[e]||r,A=DX(v[e],a),{props:{component:E,...R},internalRef:k}=zX({className:n,...h,externalForwardedProps:e==="root"?S:void 0,externalSlotProps:A}),D=PT(k,A?.ref,t.ref),M=e==="root"?E||m:E,I=NX(w,{...e==="root"&&!m&&!y[e]&&u,...e!=="root"&&!y[e]&&u,...R,...M&&!d&&{as:M},...M&&d&&{component:M},ref:D},a);return[w,I]}const jX=e=>{const{classes:t,direction:n,active:r}=e,a={root:["root",r&&"active",`direction${Io(n)}`],icon:["icon",`iconDirection${Io(n)}`]};return Wc(a,OX,t)},BX=pl(_j,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.active&&t.active]}})(f0(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${_A.icon}`]:{opacity:.5}},[`&.${_A.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${_A.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),LX=pl("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,t[`iconDirection${Io(n.direction)}`]]}})(f0(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),Aj=z.forwardRef(function(t,n){const r=vu({props:t,name:"MuiTableSortLabel"}),{active:a=!1,children:l,className:u,direction:d="asc",hideSortIcon:h=!1,IconComponent:m=kX,slots:y={},slotProps:v={},...S}=r,w={...r,active:a,direction:d,hideSortIcon:h,IconComponent:m},A=jX(w),E={slots:y,slotProps:v},[R,k]=N4("root",{elementType:BX,externalForwardedProps:E,ownerState:w,className:dr(A.root,u),ref:n}),[D,M]=N4("icon",{elementType:LX,externalForwardedProps:E,ownerState:w,className:A.icon});return T.jsxs(R,{disableRipple:!0,component:"span",...k,...S,children:[l,h&&!a?null:T.jsx(D,{as:m,...M})]})});process.env.NODE_ENV!=="production"&&(Aj.propTypes={active:ie.bool,children:ie.node,classes:ie.object,className:ie.string,direction:ie.oneOf(["asc","desc"]),hideSortIcon:ie.bool,IconComponent:ie.elementType,slotProps:ie.shape({icon:ie.oneOfType([ie.func,ie.object]),root:ie.oneOfType([ie.func,ie.object])}),slots:ie.shape({icon:ie.elementType,root:ie.elementType}),sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object])});const PX=e=>{const t=[];if(e===void 0)return{header:[],rows:[]};e.data===void 0&&(e.data=[]),(e.columns===void 0||e.columns.length===0)&&(e.data.length===0?e.columns=[]:e.columns=e.data[0].map((r,a)=>`col${a}`)),(e.index===void 0||e.index.length===0)&&(e.index=e.data.map((r,a)=>`row${a}`));const n=Math.max(e.index.length,e.data.length);for(let r=0;r<n;r++){const l=[r<e.index.length?e.index[r]:`row${r}`];for(let u=0;u<e.columns.length;u++)l.push(e.data[r]?e.data[r][u]:void 0);t.push(l)}return{header:["index",...e.columns],rows:t}},HX=(e,t)=>e==="desc"?(n,r)=>r[t]<n[t]?-1:r[t]>n[t]?1:0:(n,r)=>n[t]<r[t]?-1:n[t]>r[t]?1:0,VT=(e,t)=>{const n=e.map((r,a)=>[r,a]);return n.sort((r,a)=>t(r[0],a[0])),n.map(r=>r[0])},VX=(e,t,n=1e3)=>{if(e.length<=n)return VT(e,t);const r=[];for(let l=0;l<e.length;l+=n)r.push(e.slice(l,l+n));const a=r.map(l=>VT(l,t));return FX(a,t)},FX=(e,t)=>{if(e.length===1)return e[0];const n=[],r=new Array(e.length).fill(0);for(;r.some((a,l)=>a<e[l].length);){let a=-1,l=null;for(let u=0;u<e.length;u++)if(r[u]<e[u].length){const d=e[u][r[u]];(l===null||t(d,l)<0)&&(l=d,a=u)}a!==-1&&l!==null&&(n.push(l),r[a]++)}return n},D4=(e,t,n)=>{const r=Math.ceil(e/n);return{currentPage:r===0?1:Math.min(Math.max(1,t),r),pageSize:n,totalPages:r,totalRows:e}},GX=(e,t,n)=>{const r=(t-1)*n,a=r+n;return e.slice(r,a)},UX=(e,t,n,r,a=5)=>{const l=Math.max(0,Math.floor(e/n)-a),u=Math.min(r-1,Math.ceil((e+t)/n)+a);return{startIndex:l,endIndex:u}},$X=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},Tj=({tabledata:e,className:t="",size:n="small",onSortChange:r,enablePagination:a=void 0,pageSize:l=50,enableVirtualScrolling:u=void 0,virtualScrollingHeight:d=400,enableLazyLoading:h=void 0,onLoadMore:m})=>{e||(e={columns:[],index:[],data:[]});const y=e.index.length;y>1e4&&(h=h===void 0?!0:h),y>1e3&&(u=u===void 0?!0:u),y>2*l&&(a=a===void 0?!0:a),h=h===void 0?!1:h,u=u===void 0?!1:u,a=a===void 0?!1:a;const v=Q.useMemo(()=>PX(e),[e]),[S,w]=Q.useState("asc"),[A,E]=Q.useState("index"),[R,k]=Q.useState(()=>D4(v.rows.length,1,l)),[D,M]=Q.useState(0),I=Q.useRef(null),L=Q.useMemo(()=>{const J=v.header.indexOf(A);return J===-1?0:J},[v.header,A]),P=Q.useMemo(()=>$X((J,ne)=>{w(ne),E(J),r?.(J,ne)},150),[r]),G=Q.useCallback(J=>{const B=A===J&&S==="asc"?"desc":"asc";v.rows.length>1e3?P(J,B):(w(B),E(J),r?.(J,B))},[A,S,r,v.rows.length,P]),$=Q.useMemo(()=>HX(S,L),[S,L]),Z=Q.useMemo(()=>v.rows.length>1e3?VX(v.rows,$):VT(v.rows,$),[v.rows,$]),j=Q.useMemo(()=>a?GX(Z,R.currentPage,R.pageSize):Z,[Z,a,R.currentPage,R.pageSize]),X={itemHeight:48,overscan:5,containerHeight:d},ee=Q.useMemo(()=>u?UX(D,X.containerHeight,X.itemHeight,j.length,X.overscan):{startIndex:0,endIndex:j.length-1},[D,u,j.length,X]),ae=Q.useCallback(J=>{u&&M(J.currentTarget.scrollTop)},[u]),U=Q.useCallback(J=>{k(ne=>({...ne,currentPage:J}))},[]),te=Q.useCallback(J=>{if(!(!a||!(J.target.closest(".sortable-table-wrapper")===J.currentTarget)))switch(J.key){case"ArrowLeft":R.currentPage>1&&(J.preventDefault(),J.stopPropagation(),U(R.currentPage-1));break;case"ArrowRight":R.currentPage<R.totalPages&&(J.preventDefault(),J.stopPropagation(),U(R.currentPage+1));break;case"Home":R.currentPage>1&&(J.preventDefault(),J.stopPropagation(),U(1));break;case"End":R.currentPage<R.totalPages&&(J.preventDefault(),J.stopPropagation(),U(R.totalPages));break}},[a,R.currentPage,R.totalPages,U]);Q.useEffect(()=>{a&&k(J=>D4(Z.length,J.currentPage,l))},[Z.length,a,l]),Q.useEffect(()=>{h&&m&&R.currentPage>=R.totalPages-1&&m(R.currentPage+1)},[h,m,R.currentPage,R.totalPages]);const V=()=>a?T.jsxs("div",{className:"sortable-table-pagination",children:[T.jsx("button",{onClick:()=>U(R.currentPage-1),disabled:R.currentPage<=1,className:"pagination-button",children:"Previous"}),T.jsxs("span",{className:"pagination-info",children:["Page ",R.currentPage," of ",R.totalPages,"(",R.totalRows," total rows)"]}),T.jsx("button",{onClick:()=>U(R.currentPage+1),disabled:R.currentPage>=R.totalPages,className:"pagination-button",children:"Next"})]}):null,W=()=>{const J=u?j.slice(ee.startIndex,ee.endIndex+1):j;return T.jsxs(yj,{children:[u&&T.jsx(C1,{style:{height:ee.startIndex*X.itemHeight},children:T.jsx(E1,{colSpan:v.header.length})}),J.map((ne,B)=>{const oe=u?ee.startIndex+B:B;return T.jsx(C1,{children:ne.map((se,Y)=>T.jsx(E1,{className:Y===0?"sortable-table-index-cell":"sortable-table-data-cell",children:se},`${e.index?.[oe]||oe}-${Y}`))},e.index?.[oe]||oe)}),u&&T.jsx(C1,{style:{height:(j.length-ee.endIndex-1)*X.itemHeight},children:T.jsx(E1,{colSpan:v.header.length})})]})};return T.jsxs("div",{className:"sortable-table-wrapper",onKeyDown:te,tabIndex:a?0:-1,role:a?"application":void 0,"aria-label":a?"Sortable table with pagination":void 0,children:[T.jsx(vj,{className:`sortable-table-container ${t}`,ref:I,onScroll:ae,style:u?{height:d}:void 0,children:T.jsxs(gj,{size:n,children:[T.jsx(bj,{className:"sortable-table-head",children:T.jsx(C1,{className:"sortable-table-header-row",children:v.header.map(J=>T.jsx(E1,{className:"sortable-table-header-cell","aria-label":`Sort by ${J}`,children:T.jsx(Aj,{active:A===J,direction:A===J?S:"asc",onClick:()=>G(J),className:"sortable-table-sort-label",sx:{"& .MuiTableSortLabel-icon":{color:"inherit !important"}},children:J})},J))})}),W()]})}),V()]})};Tj.displayName="SortableTable";function Ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function I4(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function JE(...e){return t=>{let n=!1;const r=e.map(a=>{const l=I4(a,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let a=0;a<r.length;a++){const l=r[a];typeof l=="function"?l():I4(e[a],null)}}}}function En(...e){return z.useCallback(JE(...e),e)}function XX(e,t){const n=z.createContext(t),r=l=>{const{children:u,...d}=l,h=z.useMemo(()=>d,Object.values(d));return T.jsx(n.Provider,{value:h,children:u})};r.displayName=e+"Provider";function a(l){const u=z.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,a]}function bu(e,t=[]){let n=[];function r(l,u){const d=z.createContext(u),h=n.length;n=[...n,u];const m=v=>{const{scope:S,children:w,...A}=v,E=S?.[e]?.[h]||d,R=z.useMemo(()=>A,Object.values(A));return T.jsx(E.Provider,{value:R,children:w})};m.displayName=l+"Provider";function y(v,S){const w=S?.[e]?.[h]||d,A=z.useContext(w);if(A)return A;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${l}\``)}return[m,y]}const a=()=>{const l=n.map(u=>z.createContext(u));return function(d){const h=d?.[e]||l;return z.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return a.scopeName=e,[r,YX(a,...t)]}function YX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const u=r.reduce((d,{useScope:h,scopeName:m})=>{const v=h(l)[`__scope${m}`];return{...d,...v}},{});return z.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Gc=globalThis?.document?z.useLayoutEffect:()=>{},ZX=z[" useId ".trim().toString()]||(()=>{}),WX=0;function hu(e){const[t,n]=z.useState(ZX());return Gc(()=>{n(r=>r??String(WX++))},[e]),e||(t?`radix-${t}`:"")}var qX=z[" useInsertionEffect ".trim().toString()]||Gc;function Hd({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,l,u]=JX({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:a;{const y=z.useRef(e!==void 0);z.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,r])}const m=z.useCallback(y=>{if(d){const v=QX(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[h,m]}function JX({defaultProp:e,onChange:t}){const[n,r]=z.useState(e),a=z.useRef(n),l=z.useRef(t);return qX(()=>{l.current=t},[t]),z.useEffect(()=>{a.current!==n&&(l.current?.(n),a.current=n)},[n,a]),[n,r,l]}function QX(e){return typeof e=="function"}function Jy(e){const t=KX(e),n=z.forwardRef((r,a)=>{const{children:l,...u}=r,d=z.Children.toArray(l),h=d.find(tY);if(h){const m=h.props.children,y=d.map(v=>v===h?z.Children.count(m)>1?z.Children.only(null):z.isValidElement(m)?m.props.children:null:v);return T.jsx(t,{...u,ref:a,children:z.isValidElement(m)?z.cloneElement(m,void 0,y):null})}return T.jsx(t,{...u,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function KX(e){const t=z.forwardRef((n,r)=>{const{children:a,...l}=n;if(z.isValidElement(a)){const u=rY(a),d=nY(l,a.props);return a.type!==z.Fragment&&(d.ref=r?JE(r,u):u),z.cloneElement(a,d)}return z.Children.count(a)>1?z.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eY=Symbol("radix.slottable");function tY(e){return z.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eY}function nY(e,t){const n={...t};for(const r in t){const a=e[r],l=t[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function rY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zt=oY.reduce((e,t)=>{const n=Jy(`Primitive.${t}`),r=z.forwardRef((a,l)=>{const{asChild:u,...d}=a,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ek(e,t){e&&kE.flushSync(()=>e.dispatchEvent(t))}function ka(e){const t=z.useRef(e);return z.useEffect(()=>{t.current=e}),z.useMemo(()=>(...n)=>t.current?.(...n),[])}function aY(e,t=globalThis?.document){const n=ka(e);z.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var iY="DismissableLayer",FT="dismissableLayer.update",lY="dismissableLayer.pointerDownOutside",sY="dismissableLayer.focusOutside",z4,Rj=z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yx=z.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=z.useContext(Rj),[y,v]=z.useState(null),S=y?.ownerDocument??globalThis?.document,[,w]=z.useState({}),A=En(t,G=>v(G)),E=Array.from(m.layers),[R]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=E.indexOf(R),D=y?E.indexOf(y):-1,M=m.layersWithOutsidePointerEventsDisabled.size>0,I=D>=k,L=cY(G=>{const $=G.target,Z=[...m.branches].some(j=>j.contains($));!I||Z||(a?.(G),u?.(G),G.defaultPrevented||d?.())},S),P=fY(G=>{const $=G.target;[...m.branches].some(j=>j.contains($))||(l?.(G),u?.(G),G.defaultPrevented||d?.())},S);return aY(G=>{D===m.layers.size-1&&(r?.(G),!G.defaultPrevented&&d&&(G.preventDefault(),d()))},S),z.useEffect(()=>{if(y)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(z4=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),j4(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(S.body.style.pointerEvents=z4)}},[y,S,n,m]),z.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),j4())},[y,m]),z.useEffect(()=>{const G=()=>w({});return document.addEventListener(FT,G),()=>document.removeEventListener(FT,G)},[]),T.jsx(zt.div,{...h,ref:A,style:{pointerEvents:M?I?"auto":"none":void 0,...e.style},onFocusCapture:Ke(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ke(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ke(e.onPointerDownCapture,L.onPointerDownCapture)})});yx.displayName=iY;var uY="DismissableLayerBranch",kj=z.forwardRef((e,t)=>{const n=z.useContext(Rj),r=z.useRef(null),a=En(t,r);return z.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),T.jsx(zt.div,{...e,ref:a})});kj.displayName=uY;function cY(e,t=globalThis?.document){const n=ka(e),r=z.useRef(!1),a=z.useRef(()=>{});return z.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let h=function(){Oj(lY,n,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=h,t.addEventListener("click",a.current,{once:!0})):h()}else t.removeEventListener("click",a.current);r.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function fY(e,t=globalThis?.document){const n=ka(e),r=z.useRef(!1);return z.useEffect(()=>{const a=l=>{l.target&&!r.current&&Oj(sY,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function j4(){const e=new CustomEvent(FT);document.dispatchEvent(e)}function Oj(e,t,n,{discrete:r}){const a=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Ek(a,l):a.dispatchEvent(l)}var dY=yx,hY=kj,AA="focusScope.autoFocusOnMount",TA="focusScope.autoFocusOnUnmount",B4={bubbles:!1,cancelable:!0},pY="FocusScope",QE=z.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...u}=e,[d,h]=z.useState(null),m=ka(a),y=ka(l),v=z.useRef(null),S=En(t,E=>h(E)),w=z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;z.useEffect(()=>{if(r){let E=function(M){if(w.paused||!d)return;const I=M.target;d.contains(I)?v.current=I:Cd(v.current,{select:!0})},R=function(M){if(w.paused||!d)return;const I=M.relatedTarget;I!==null&&(d.contains(I)||Cd(v.current,{select:!0}))},k=function(M){if(document.activeElement===document.body)for(const L of M)L.removedNodes.length>0&&Cd(d)};document.addEventListener("focusin",E),document.addEventListener("focusout",R);const D=new MutationObserver(k);return d&&D.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",R),D.disconnect()}}},[r,d,w.paused]),z.useEffect(()=>{if(d){P4.add(w);const E=document.activeElement;if(!d.contains(E)){const k=new CustomEvent(AA,B4);d.addEventListener(AA,m),d.dispatchEvent(k),k.defaultPrevented||(mY(xY(Mj(d)),{select:!0}),document.activeElement===E&&Cd(d))}return()=>{d.removeEventListener(AA,m),setTimeout(()=>{const k=new CustomEvent(TA,B4);d.addEventListener(TA,y),d.dispatchEvent(k),k.defaultPrevented||Cd(E??document.body,{select:!0}),d.removeEventListener(TA,y),P4.remove(w)},0)}}},[d,m,y,w]);const A=z.useCallback(E=>{if(!n&&!r||w.paused)return;const R=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,k=document.activeElement;if(R&&k){const D=E.currentTarget,[M,I]=gY(D);M&&I?!E.shiftKey&&k===I?(E.preventDefault(),n&&Cd(M,{select:!0})):E.shiftKey&&k===M&&(E.preventDefault(),n&&Cd(I,{select:!0})):k===D&&E.preventDefault()}},[n,r,w.paused]);return T.jsx(zt.div,{tabIndex:-1,...u,ref:S,onKeyDown:A})});QE.displayName=pY;function mY(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Cd(r,{select:t}),document.activeElement!==n)return}function gY(e){const t=Mj(e),n=L4(t,e),r=L4(t.reverse(),e);return[n,r]}function Mj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function L4(e,t){for(const n of e)if(!yY(n,{upTo:t}))return n}function yY(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vY(e){return e instanceof HTMLInputElement&&"select"in e}function Cd(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vY(e)&&t&&e.select()}}var P4=bY();function bY(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=H4(e,t),e.unshift(t)},remove(t){e=H4(e,t),e[0]?.resume()}}}function H4(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function xY(e){return e.filter(t=>t.tagName!=="A")}var SY="Portal",KE=z.forwardRef((e,t)=>{const{container:n,...r}=e,[a,l]=z.useState(!1);Gc(()=>l(!0),[]);const u=n||a&&globalThis?.document?.body;return u?dx.createPortal(T.jsx(zt.div,{...r,ref:t}),u):null});KE.displayName=SY;function wY(e,t){return z.useReducer((n,r)=>t[n][r]??n,e)}var as=e=>{const{present:t,children:n}=e,r=EY(t),a=typeof n=="function"?n({present:r.isPresent}):z.Children.only(n),l=En(r.ref,CY(a));return typeof n=="function"||r.isPresent?z.cloneElement(a,{ref:l}):null};as.displayName="Presence";function EY(e){const[t,n]=z.useState(),r=z.useRef(null),a=z.useRef(e),l=z.useRef("none"),u=e?"mounted":"unmounted",[d,h]=wY(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return z.useEffect(()=>{const m=Pw(r.current);l.current=d==="mounted"?m:"none"},[d]),Gc(()=>{const m=r.current,y=a.current;if(y!==e){const S=l.current,w=Pw(m);e?h("MOUNT"):w==="none"||m?.display==="none"?h("UNMOUNT"):h(y&&S!==w?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),Gc(()=>{if(t){let m;const y=t.ownerDocument.defaultView??window,v=w=>{const E=Pw(r.current).includes(w.animationName);if(w.target===t&&E&&(h("ANIMATION_END"),!a.current)){const R=t.style.animationFillMode;t.style.animationFillMode="forwards",m=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=R)})}},S=w=>{w.target===t&&(l.current=Pw(r.current))};return t.addEventListener("animationstart",S),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{y.clearTimeout(m),t.removeEventListener("animationstart",S),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:z.useCallback(m=>{r.current=m?getComputedStyle(m):null,n(m)},[])}}function Pw(e){return e?.animationName||"none"}function CY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var RA=0;function Ck(){z.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??V4()),document.body.insertAdjacentElement("beforeend",e[1]??V4()),RA++,()=>{RA===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),RA--}},[])}function V4(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var su=function(){return su=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},su.apply(this,arguments)};function Nj(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 a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function S2(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,l;r<a;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}var w2="right-scroll-bar-position",E2="width-before-scroll-bar",_Y="with-scroll-bars-hidden",AY="--removed-body-scroll-bar-size";function kA(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function TY(e,t){var n=Q.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var RY=typeof window<"u"?z.useLayoutEffect:z.useEffect,F4=new WeakMap;function kY(e,t){var n=TY(null,function(r){return e.forEach(function(a){return kA(a,r)})});return RY(function(){var r=F4.get(n);if(r){var a=new Set(r),l=new Set(e),u=n.current;a.forEach(function(d){l.has(d)||kA(d,null)}),l.forEach(function(d){a.has(d)||kA(d,u)})}F4.set(n,e)},[e]),n}function OY(e){return e}function MY(e,t){t===void 0&&(t=OY);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var u=t(l,r);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(r=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){r=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var y=u;u=[],y.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(y){u.push(y),m()},filter:function(y){return u=u.filter(y),n}}}};return a}function NY(e){e===void 0&&(e={});var t=MY(null);return t.options=su({async:!0,ssr:!1},e),t}var Dj=function(e){var t=e.sideCar,n=Nj(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return z.createElement(r,su({},n))};Dj.isSideCarExport=!0;function DY(e,t){return e.useMedium(t),Dj}var Ij=NY(),OA=function(){},eC=z.forwardRef(function(e,t){var n=z.useRef(null),r=z.useState({onScrollCapture:OA,onWheelCapture:OA,onTouchMoveCapture:OA}),a=r[0],l=r[1],u=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,y=e.enabled,v=e.shards,S=e.sideCar,w=e.noRelative,A=e.noIsolation,E=e.inert,R=e.allowPinchZoom,k=e.as,D=k===void 0?"div":k,M=e.gapMode,I=Nj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=S,P=kY([n,t]),G=su(su({},I),a);return z.createElement(z.Fragment,null,y&&z.createElement(L,{sideCar:Ij,removeScrollBar:m,shards:v,noRelative:w,noIsolation:A,inert:E,setCallbacks:l,allowPinchZoom:!!R,lockRef:n,gapMode:M}),u?z.cloneElement(z.Children.only(d),su(su({},G),{ref:P})):z.createElement(D,su({},G,{className:h,ref:P}),d))});eC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};eC.classNames={fullWidth:E2,zeroRight:w2};var IY=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zY(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=IY();return t&&e.setAttribute("nonce",t),e}function jY(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function BY(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var LY=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zY())&&(jY(t,n),BY(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},PY=function(){var e=LY();return function(t,n){z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},zj=function(){var e=PY(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},HY={left:0,top:0,right:0,gap:0},MA=function(e){return parseInt(e||"",10)||0},VY=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[MA(n),MA(r),MA(a)]},FY=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return HY;var t=VY(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},GY=zj(),Vy="data-scroll-locked",UY=function(e,t,n,r){var a=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
|
|
420
420
|
.`.concat(_Y,` {
|
|
421
421
|
overflow: hidden `).concat(r,`;
|
|
422
422
|
padding-right: `).concat(d,"px ").concat(r,`;
|
|
@@ -1033,7 +1033,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1033
1033
|
* content-type
|
|
1034
1034
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
1035
1035
|
* MIT Licensed
|
|
1036
|
-
*/var oI;function vre(){if(oI)return Jw;oI=1;var e=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,t=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,r=/\\([\u000b\u0020-\u00ff])/g,a=/([\\"])/g,l=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Jw.format=u,Jw.parse=d;function u(v){if(!v||typeof v!="object")throw new TypeError("argument obj is required");var S=v.parameters,w=v.type;if(!w||!l.test(w))throw new TypeError("invalid type");var A=w;if(S&&typeof S=="object")for(var E,R=Object.keys(S).sort(),k=0;k<R.length;k++){if(E=R[k],!n.test(E))throw new TypeError("invalid parameter name");A+="; "+E+"="+m(S[E])}return A}function d(v){if(!v)throw new TypeError("argument string is required");var S=typeof v=="object"?h(v):v;if(typeof S!="string")throw new TypeError("argument string is required to be a string");var w=S.indexOf(";"),A=w!==-1?S.slice(0,w).trim():S.trim();if(!l.test(A))throw new TypeError("invalid media type");var E=new y(A.toLowerCase());if(w!==-1){var R,k,D;for(e.lastIndex=w;k=e.exec(S);){if(k.index!==w)throw new TypeError("invalid parameter format");w+=k[0].length,R=k[1].toLowerCase(),D=k[2],D.charCodeAt(0)===34&&(D=D.slice(1,-1),D.indexOf("\\")!==-1&&(D=D.replace(r,"$1"))),E.parameters[R]=D}if(w!==S.length)throw new TypeError("invalid parameter format")}return E}function h(v){var S;if(typeof v.getHeader=="function"?S=v.getHeader("content-type"):typeof v.headers=="object"&&(S=v.headers&&v.headers["content-type"]),typeof S!="string")throw new TypeError("content-type header is missing from object");return S}function m(v){var S=String(v);if(n.test(S))return S;if(S.length>0&&!t.test(S))throw new TypeError("invalid parameter value");return'"'+S.replace(a,"\\$1")+'"'}function y(v){this.parameters=Object.create(null),this.type=v}return Jw}var bre=vre(),Dy=new Map,OB=function(t){return t.cloneNode(!0)},aI=function(){return window.location.protocol==="file:"},MB=function(t,n,r){var a=new XMLHttpRequest;a.onreadystatechange=function(){try{if(!/\.svg/i.test(t)&&a.readyState===2){var l=a.getResponseHeader("Content-Type");if(!l)throw new Error("Content type not found");var u=bre.parse(l).type;if(!(u==="image/svg+xml"||u==="text/plain"))throw new Error("Invalid content type: ".concat(u))}if(a.readyState===4){if(a.status===404||a.responseXML===null)throw new Error(aI()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+t);if(a.status===200||aI()&&a.status===0)r(null,a);else throw new Error("There was a problem injecting the SVG: "+a.status+" "+a.statusText)}}catch(d){if(a.abort(),d instanceof Error)r(d,a);else throw d}},a.open("GET",t),a.withCredentials=n,a.overrideMimeType&&a.overrideMimeType("text/xml"),a.send()},Ad={},iI=function(t,n){Ad[t]=Ad[t]||[],Ad[t].push(n)},xre=function(t){for(var n=function(u,d){setTimeout(function(){if(Array.isArray(Ad[t])){var h=Dy.get(t),m=Ad[t][u];h instanceof SVGSVGElement&&m(null,OB(h)),h instanceof Error&&m(h),u===Ad[t].length-1&&delete Ad[t]}},0)},r=0,a=Ad[t].length;r<a;r++)n(r)},Sre=function(t,n,r){if(Dy.has(t)){var a=Dy.get(t);if(a===void 0){iI(t,r);return}if(a instanceof SVGSVGElement){r(null,OB(a));return}}Dy.set(t,void 0),iI(t,r),MB(t,n,function(l,u){var d;l?Dy.set(t,l):((d=u.responseXML)===null||d===void 0?void 0:d.documentElement)instanceof SVGSVGElement&&Dy.set(t,u.responseXML.documentElement),xre(t)})},wre=function(t,n,r){MB(t,n,function(a,l){var u;a?r(a):((u=l.responseXML)===null||u===void 0?void 0:u.documentElement)instanceof SVGSVGElement&&r(null,l.responseXML.documentElement)})},Ere=0,Cre=function(){return++Ere},eu=[],lI={},_re="http://www.w3.org/2000/svg",WA="http://www.w3.org/1999/xlink",sI=function(t,n,r,a,l,u,d){var h=t.getAttribute("data-src")||t.getAttribute("src");if(!h){d(new Error("Invalid data-src or src attribute"));return}if(eu.indexOf(t)!==-1){eu.splice(eu.indexOf(t),1),t=null;return}eu.push(t),t.setAttribute("src","");var m=a?Sre:wre;m(h,l,function(y,v){if(!v){eu.splice(eu.indexOf(t),1),t=null,d(y);return}var S=t.getAttribute("id");S&&v.setAttribute("id",S);var w=t.getAttribute("title");w&&v.setAttribute("title",w);var A=t.getAttribute("width");A&&v.setAttribute("width",A);var E=t.getAttribute("height");E&&v.setAttribute("height",E);var R=Array.from(new Set(S2(S2(S2([],(v.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(t.getAttribute("class")||"").split(" "),!0))).join(" ").trim();v.setAttribute("class",R);var k=t.getAttribute("style");k&&v.setAttribute("style",k),v.setAttribute("data-src",h);var D=[].filter.call(t.attributes,function(J){return/^data-\w[\w-]*$/.test(J.name)});if(Array.prototype.forEach.call(D,function(J){J.name&&J.value&&v.setAttribute(J.name,J.value)}),r){var M={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]},I,L,P,G,$;Object.keys(M).forEach(function(J){I=J,P=M[J],L=v.querySelectorAll(I+"[id]");for(var ne=function(Y,he){G=L[Y].id,$=G+"-"+Cre();var Te;Array.prototype.forEach.call(P,function(Xe){Te=v.querySelectorAll("["+Xe+'*="'+G+'"]');for(var We=0,_t=Te.length;We<_t;We++){var Kt=Te[We].getAttribute(Xe);Kt&&!Kt.match(new RegExp('url\\("?#'+G+'"?\\)'))||Te[We].setAttribute(Xe,"url(#"+$+")")}});for(var me=v.querySelectorAll("[*|href]"),Ee=[],xe=0,Be=me.length;xe<Be;xe++){var He=me[xe].getAttributeNS(WA,"href");He&&He.toString()==="#"+L[Y].id&&Ee.push(me[xe])}for(var Ye=0,ke=Ee.length;Ye<ke;Ye++)Ee[Ye].setAttributeNS(WA,"href","#"+$);L[Y].id=$},B=0,oe=L.length;B<oe;B++)ne(B)})}v.removeAttribute("xmlns:a");for(var Z=v.querySelectorAll("script"),j=[],X,ee,ae=0,U=Z.length;ae<U;ae++)ee=Z[ae].getAttribute("type"),(!ee||ee==="application/ecmascript"||ee==="application/javascript"||ee==="text/javascript")&&(X=Z[ae].innerText||Z[ae].textContent,X&&j.push(X),v.removeChild(Z[ae]));if(j.length>0&&(n==="always"||n==="once"&&!lI[h])){for(var te=0,V=j.length;te<V;te++)new Function(j[te])(window);lI[h]=!0}var W=v.querySelectorAll("style");if(Array.prototype.forEach.call(W,function(J){J.textContent+=""}),v.setAttribute("xmlns",_re),v.setAttribute("xmlns:xlink",WA),u(v),!t.parentNode){eu.splice(eu.indexOf(t),1),t=null,d(new Error("Parent node is null"));return}t.parentNode.replaceChild(v,t),eu.splice(eu.indexOf(t),1),t=null,d(null,v)})},Are=function(t,n){var r=n===void 0?{}:n,a=r.afterAll,l=a===void 0?function(){}:a,u=r.afterEach,d=u===void 0?function(){}:u,h=r.beforeEach,m=h===void 0?function(){}:h,y=r.cacheRequests,v=y===void 0?!0:y,S=r.evalScripts,w=S===void 0?"never":S,A=r.httpRequestWithCredentials,E=A===void 0?!1:A,R=r.renumerateIRIElements,k=R===void 0?!0:R;if(t&&"length"in t)for(var D=0,M=0,I=t.length;M<I;M++)sI(t[M],w,k,v,E,m,function(L,P){d(L,P),t&&"length"in t&&t.length===++D&&l(D)});else t?sI(t,w,k,v,E,m,function(L,P){d(L,P),l(1),t=null}):l(0)},Tre=function(t){var n=t?.ownerDocument||document;return n.defaultView||window},Rre=function(t,n){for(var r in t)if(!(r in n))return!0;for(var a in n)if(t[a]!==n[a])return!0;return!1},kre=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Qw="http://www.w3.org/2000/svg",uI="http://www.w3.org/1999/xlink",oO=function(e){function t(){for(var r,a=arguments.length,l=new Array(a),u=0;u<a;u++)l[u]=arguments[u];return r=e.call.apply(e,[this].concat(l))||this,r.initialState={hasError:!1,isLoading:!0},r.state=r.initialState,r._isMounted=!1,r.reactWrapper=void 0,r.nonReactWrapper=void 0,r.refCallback=function(d){r.reactWrapper=d},r}Sj(t,e);var n=t.prototype;return n.renderSVG=function(){var a=this;if(this.reactWrapper instanceof Tre(this.reactWrapper).Node){var l=this.props,u=l.desc,d=l.evalScripts,h=l.httpRequestWithCredentials,m=l.renumerateIRIElements,y=l.src,v=l.title,S=l.useRequestCache,w=this.props.onError,A=this.props.beforeInjection,E=this.props.afterInjection,R=this.props.wrapper,k,D;R==="svg"?(k=document.createElementNS(Qw,R),k.setAttribute("xmlns",Qw),k.setAttribute("xmlns:xlink",uI),D=document.createElementNS(Qw,R)):(k=document.createElement(R),D=document.createElement(R)),k.appendChild(D),D.dataset.src=y,this.nonReactWrapper=this.reactWrapper.appendChild(k);var M=function(G){if(a.removeSVG(),!a._isMounted){w(G);return}a.setState(function(){return{hasError:!0,isLoading:!1}},function(){w(G)})},I=function(G,$){if(G){M(G);return}a._isMounted&&a.setState(function(){return{isLoading:!1}},function(){try{E($)}catch(Z){M(Z)}})},L=function(G){if(G.setAttribute("role","img"),u){var $=G.querySelector(":scope > desc");$&&G.removeChild($);var Z=document.createElement("desc");Z.innerHTML=u,G.prepend(Z)}if(v){var j=G.querySelector(":scope > title");j&&G.removeChild(j);var X=document.createElement("title");X.innerHTML=v,G.prepend(X)}try{A(G)}catch(ee){M(ee)}};Are(D,{afterEach:I,beforeEach:L,cacheRequests:S,evalScripts:d,httpRequestWithCredentials:h,renumerateIRIElements:m})}},n.removeSVG=function(){var a;(a=this.nonReactWrapper)!=null&&a.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},n.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},n.componentDidUpdate=function(a){var l=this;Rre(st({},a),this.props)&&this.setState(function(){return l.initialState},function(){l.removeSVG(),l.renderSVG()})},n.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},n.render=function(){var a=this.props;a.afterInjection,a.beforeInjection,a.desc,a.evalScripts;var l=a.fallback;a.httpRequestWithCredentials;var u=a.loading;a.renumerateIRIElements,a.src,a.title,a.useRequestCache;var d=a.wrapper,h=bk(a,kre),m=d;return z.createElement(m,st({},h,{ref:this.refCallback},d==="svg"?{xmlns:Qw,xmlnsXlink:uI}:{}),this.state.isLoading&&u&&z.createElement(u,null),this.state.hasError&&l&&z.createElement(l,null))},t}(z.Component);oO.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"};oO.propTypes={afterInjection:Cr.func,beforeInjection:Cr.func,desc:Cr.string,evalScripts:Cr.oneOf(["always","once","never"]),fallback:Cr.oneOfType([Cr.func,Cr.object,Cr.string]),httpRequestWithCredentials:Cr.bool,loading:Cr.oneOfType([Cr.func,Cr.object,Cr.string]),onError:Cr.func,renumerateIRIElements:Cr.bool,src:Cr.string.isRequired,title:Cr.string,useRequestCache:Cr.bool,wrapper:Cr.oneOf(["div","span","svg"])};const aO=({text:e="No image data provided"})=>T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:e}),Ore=z.memo(({value:e,format:t="jpeg",alt:n="Base64 image",onError:r,onLoad:a,...l})=>{const[u,d]=z.useState(!1),[h,m]=z.useState(!0),y=z.useRef(null),v=z.useMemo(()=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"data"in e){const E=e.data;if(E instanceof ArrayBuffer){const R=new Uint8Array(E);let k="";for(let D=0;D<R.byteLength;D++)k+=String.fromCharCode(R[D]);return btoa(k)}}return""},[e]),S=z.useMemo(()=>v?`data:image/${t};base64,${v}`:"",[v,t]),w=z.useCallback(E=>{d(!0),m(!1),r?.(E)},[r]),A=z.useCallback(()=>{m(!1),d(!1),a?.()},[a]);return z.useEffect(()=>{const E=y.current;if(E)return E.addEventListener("error",w),E.addEventListener("load",A),()=>{E.removeEventListener("error",w),E.removeEventListener("load",A)}},[w,A,e]),z.useEffect(()=>{d(!1),m(!0)},[e]),v?u?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load base64 image"}):T.jsx("img",{ref:y,src:S,alt:n,className:`base64-image-renderer ${l.className||""} ${h?" loading":""}`,...l}):T.jsx(aO,{})}),Mre=z.memo(({value:e,alt:t="SVG image",onError:n,onLoad:r,...a})=>{const[l,u]=z.useState(!1),d=z.useMemo(()=>{if(!e)return"";try{return`data:image/svg+xml;base64,${btoa(e)}`}catch(m){return console.error("Failed to encode SVG to base64:",m),""}},[e]);z.useEffect(()=>{u(!1)},[e]);const h=z.useCallback(m=>{u(!0),n?.(m)},[n]);return e?l||!d?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load SVG"}):T.jsx(oO,{src:d,className:`svg-renderer ${a.className||""}`,style:{maxWidth:"100%",maxHeight:"100%",...a.style},beforeInjection:m=>{m.classList.add("svg-renderer"),m.setAttribute("style","max-width: 100%; max-height: 100%;"),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("aria-label",t);const y=()=>{u(!1),r?.()},v=S=>{u(!0),n?.(S)};try{m.addEventListener("load",y),m.addEventListener("error",v)}catch{y()}},onError:h}):T.jsx(aO,{})}),Nre=z.memo(({src:e,alt:t="Streaming image",onError:n,onLoad:r,...a})=>{const l=z.useRef(null),[u,d]=z.useState(!1),[h,m]=z.useState(!0);z.useEffect(()=>{l.current&&e&&(m(!0),d(!1),l.current.src=e)},[e]);const y=z.useCallback(S=>{d(!0),m(!1),n?.(S)},[n]),v=z.useCallback(()=>{m(!1),d(!1),r?.()},[r]);return z.useEffect(()=>{const S=l.current;if(S)return S.addEventListener("error",y),S.addEventListener("load",v),()=>{S.removeEventListener("error",y),S.removeEventListener("load",v)}},[y,v]),u?T.jsx(aO,{text:"Failed to load image"}):T.jsx("img",{ref:l,className:`streaming-image ${a.className||""} ${h?" loading":""}`,alt:t,...a})});function mC(e){const t=e+"CollectionProvider",[n,r]=bu(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=E=>{const{scope:R,children:k}=E,D=Q.useRef(null),M=Q.useRef(new Map).current;return T.jsx(a,{scope:R,itemMap:M,collectionRef:D,children:k})};u.displayName=t;const d=e+"CollectionSlot",h=Jy(d),m=Q.forwardRef((E,R)=>{const{scope:k,children:D}=E,M=l(d,k),I=En(R,M.collectionRef);return T.jsx(h,{ref:I,children:D})});m.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",S=Jy(y),w=Q.forwardRef((E,R)=>{const{scope:k,children:D,...M}=E,I=Q.useRef(null),L=En(R,I),P=l(y,k);return Q.useEffect(()=>(P.itemMap.set(I,{ref:I,...M}),()=>void P.itemMap.delete(I))),T.jsx(S,{[v]:"",ref:L,children:D})});w.displayName=y;function A(E){const R=l(e+"CollectionConsumer",E);return Q.useCallback(()=>{const D=R.collectionRef.current;if(!D)return[];const M=Array.from(D.querySelectorAll(`[${v}]`));return Array.from(R.itemMap.values()).sort((P,G)=>M.indexOf(P.ref.current)-M.indexOf(G.ref.current))},[R.collectionRef,R.itemMap])}return[{Provider:u,Slot:m,ItemSlot:w},A,r]}var Dre=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ire="VisuallyHidden",iO=z.forwardRef((e,t)=>T.jsx(zt.span,{...e,ref:t,style:{...Dre,...e.style}}));iO.displayName=Ire;var lO="ToastProvider",[sO,zre,jre]=mC("Toast"),[NB,jSe]=bu("Toast",[jre]),[Bre,gC]=NB(lO),DB=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:l=50,children:u}=e,[d,h]=z.useState(null),[m,y]=z.useState(0),v=z.useRef(!1),S=z.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${lO}\`. Expected non-empty \`string\`.`),T.jsx(sO.Provider,{scope:t,children:T.jsx(Bre,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:l,toastCount:m,viewport:d,onViewportChange:h,onToastAdd:z.useCallback(()=>y(w=>w+1),[]),onToastRemove:z.useCallback(()=>y(w=>w-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:S,children:u})})};DB.displayName=lO;var IB="ToastViewport",Lre=["F8"],pR="toast.viewportPause",mR="toast.viewportResume",zB=z.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Lre,label:a="Notifications ({hotkey})",...l}=e,u=gC(IB,n),d=zre(n),h=z.useRef(null),m=z.useRef(null),y=z.useRef(null),v=z.useRef(null),S=En(t,v,u.onViewportChange),w=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=u.toastCount>0;z.useEffect(()=>{const R=k=>{r.length!==0&&r.every(M=>k[M]||k.code===M)&&v.current?.focus()};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[r]),z.useEffect(()=>{const R=h.current,k=v.current;if(A&&R&&k){const D=()=>{if(!u.isClosePausedRef.current){const P=new CustomEvent(pR);k.dispatchEvent(P),u.isClosePausedRef.current=!0}},M=()=>{if(u.isClosePausedRef.current){const P=new CustomEvent(mR);k.dispatchEvent(P),u.isClosePausedRef.current=!1}},I=P=>{!R.contains(P.relatedTarget)&&M()},L=()=>{R.contains(document.activeElement)||M()};return R.addEventListener("focusin",D),R.addEventListener("focusout",I),R.addEventListener("pointermove",D),R.addEventListener("pointerleave",L),window.addEventListener("blur",D),window.addEventListener("focus",M),()=>{R.removeEventListener("focusin",D),R.removeEventListener("focusout",I),R.removeEventListener("pointermove",D),R.removeEventListener("pointerleave",L),window.removeEventListener("blur",D),window.removeEventListener("focus",M)}}},[A,u.isClosePausedRef]);const E=z.useCallback(({tabbingDirection:R})=>{const D=d().map(M=>{const I=M.ref.current,L=[I,...Jre(I)];return R==="forwards"?L:L.reverse()});return(R==="forwards"?D.reverse():D).flat()},[d]);return z.useEffect(()=>{const R=v.current;if(R){const k=D=>{const M=D.altKey||D.ctrlKey||D.metaKey;if(D.key==="Tab"&&!M){const L=document.activeElement,P=D.shiftKey;if(D.target===R&&P){m.current?.focus();return}const Z=E({tabbingDirection:P?"backwards":"forwards"}),j=Z.findIndex(X=>X===L);qA(Z.slice(j+1))?D.preventDefault():P?m.current?.focus():y.current?.focus()}};return R.addEventListener("keydown",k),()=>R.removeEventListener("keydown",k)}},[d,E]),T.jsxs(hY,{ref:h,role:"region","aria-label":a.replace("{hotkey}",w),tabIndex:-1,style:{pointerEvents:A?void 0:"none"},children:[A&&T.jsx(gR,{ref:m,onFocusFromOutsideViewport:()=>{const R=E({tabbingDirection:"forwards"});qA(R)}}),T.jsx(sO.Slot,{scope:n,children:T.jsx(zt.ol,{tabIndex:-1,...l,ref:S})}),A&&T.jsx(gR,{ref:y,onFocusFromOutsideViewport:()=>{const R=E({tabbingDirection:"backwards"});qA(R)}})]})});zB.displayName=IB;var jB="ToastFocusProxy",gR=z.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,l=gC(jB,n);return T.jsx(iO,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:u=>{const d=u.relatedTarget;!l.viewport?.contains(d)&&r()}})});gR.displayName=jB;var Cx="Toast",Pre="toast.swipeStart",Hre="toast.swipeMove",Vre="toast.swipeCancel",Fre="toast.swipeEnd",BB=z.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:l,...u}=e,[d,h]=Hd({prop:r,defaultProp:a??!0,onChange:l,caller:Cx});return T.jsx(as,{present:n||d,children:T.jsx($re,{open:d,...u,ref:t,onClose:()=>h(!1),onPause:ka(e.onPause),onResume:ka(e.onResume),onSwipeStart:Ke(e.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ke(e.onSwipeMove,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:Ke(e.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ke(e.onSwipeEnd,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),h(!1)})})})});BB.displayName=Cx;var[Gre,Ure]=NB(Cx,{onClose(){}}),$re=z.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:l,onClose:u,onEscapeKeyDown:d,onPause:h,onResume:m,onSwipeStart:y,onSwipeMove:v,onSwipeCancel:S,onSwipeEnd:w,...A}=e,E=gC(Cx,n),[R,k]=z.useState(null),D=En(t,U=>k(U)),M=z.useRef(null),I=z.useRef(null),L=a||E.duration,P=z.useRef(0),G=z.useRef(L),$=z.useRef(0),{onToastAdd:Z,onToastRemove:j}=E,X=ka(()=>{R?.contains(document.activeElement)&&E.viewport?.focus(),u()}),ee=z.useCallback(U=>{!U||U===1/0||(window.clearTimeout($.current),P.current=new Date().getTime(),$.current=window.setTimeout(X,U))},[X]);z.useEffect(()=>{const U=E.viewport;if(U){const te=()=>{ee(G.current),m?.()},V=()=>{const W=new Date().getTime()-P.current;G.current=G.current-W,window.clearTimeout($.current),h?.()};return U.addEventListener(pR,V),U.addEventListener(mR,te),()=>{U.removeEventListener(pR,V),U.removeEventListener(mR,te)}}},[E.viewport,L,h,m,ee]),z.useEffect(()=>{l&&!E.isClosePausedRef.current&&ee(L)},[l,L,E.isClosePausedRef,ee]),z.useEffect(()=>(Z(),()=>j()),[Z,j]);const ae=z.useMemo(()=>R?UB(R):null,[R]);return E.viewport?T.jsxs(T.Fragment,{children:[ae&&T.jsx(Xre,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:ae}),T.jsx(Gre,{scope:n,onClose:X,children:kE.createPortal(T.jsx(sO.ItemSlot,{scope:n,children:T.jsx(dY,{asChild:!0,onEscapeKeyDown:Ke(d,()=>{E.isFocusedToastEscapeKeyDownRef.current||X(),E.isFocusedToastEscapeKeyDownRef.current=!1}),children:T.jsx(zt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":l?"open":"closed","data-swipe-direction":E.swipeDirection,...A,ref:D,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ke(e.onKeyDown,U=>{U.key==="Escape"&&(d?.(U.nativeEvent),U.nativeEvent.defaultPrevented||(E.isFocusedToastEscapeKeyDownRef.current=!0,X()))}),onPointerDown:Ke(e.onPointerDown,U=>{U.button===0&&(M.current={x:U.clientX,y:U.clientY})}),onPointerMove:Ke(e.onPointerMove,U=>{if(!M.current)return;const te=U.clientX-M.current.x,V=U.clientY-M.current.y,W=!!I.current,J=["left","right"].includes(E.swipeDirection),ne=["left","up"].includes(E.swipeDirection)?Math.min:Math.max,B=J?ne(0,te):0,oe=J?0:ne(0,V),se=U.pointerType==="touch"?10:2,Y={x:B,y:oe},he={originalEvent:U,delta:Y};W?(I.current=Y,Kw(Hre,v,he,{discrete:!1})):cI(Y,E.swipeDirection,se)?(I.current=Y,Kw(Pre,y,he,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(te)>se||Math.abs(V)>se)&&(M.current=null)}),onPointerUp:Ke(e.onPointerUp,U=>{const te=I.current,V=U.target;if(V.hasPointerCapture(U.pointerId)&&V.releasePointerCapture(U.pointerId),I.current=null,M.current=null,te){const W=U.currentTarget,J={originalEvent:U,delta:te};cI(te,E.swipeDirection,E.swipeThreshold)?Kw(Fre,w,J,{discrete:!0}):Kw(Vre,S,J,{discrete:!0}),W.addEventListener("click",ne=>ne.preventDefault(),{once:!0})}})})})}),E.viewport)})]}):null}),Xre=e=>{const{__scopeToast:t,children:n,...r}=e,a=gC(Cx,t),[l,u]=z.useState(!1),[d,h]=z.useState(!1);return Wre(()=>u(!0)),z.useEffect(()=>{const m=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(m)},[]),d?null:T.jsx(KE,{asChild:!0,children:T.jsx(iO,{...r,children:l&&T.jsxs(T.Fragment,{children:[a.label," ",n]})})})},Yre="ToastTitle",LB=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(zt.div,{...r,ref:t})});LB.displayName=Yre;var Zre="ToastDescription",PB=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(zt.div,{...r,ref:t})});PB.displayName=Zre;var HB="ToastAction",VB=z.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?T.jsx(GB,{altText:n,asChild:!0,children:T.jsx(uO,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${HB}\`. Expected non-empty \`string\`.`),null)});VB.displayName=HB;var FB="ToastClose",uO=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=Ure(FB,n);return T.jsx(GB,{asChild:!0,children:T.jsx(zt.button,{type:"button",...r,ref:t,onClick:Ke(e.onClick,a.onClose)})})});uO.displayName=FB;var GB=z.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return T.jsx(zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function UB(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),qre(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",l=r.dataset.radixToastAnnounceExclude==="";if(!a)if(l){const u=r.dataset.radixToastAnnounceAlt;u&&t.push(u)}else t.push(...UB(r))}}),t}function Kw(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,l=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Ek(a,l):a.dispatchEvent(l)}var cI=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),l=r>a;return t==="left"||t==="right"?l&&r>n:!l&&a>n};function Wre(e=()=>{}){const t=ka(e);Gc(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function qre(e){return e.nodeType===e.ELEMENT_NODE}function Jre(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function qA(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Qre=DB,Kre=zB,eoe=BB,toe=LB,noe=PB,roe=VB,ooe=uO;const so=[];for(let e=0;e<256;++e)so.push((e+256).toString(16).slice(1));function aoe(e,t=0){return(so[e[t+0]]+so[e[t+1]]+so[e[t+2]]+so[e[t+3]]+"-"+so[e[t+4]]+so[e[t+5]]+"-"+so[e[t+6]]+so[e[t+7]]+"-"+so[e[t+8]]+so[e[t+9]]+"-"+so[e[t+10]]+so[e[t+11]]+so[e[t+12]]+so[e[t+13]]+so[e[t+14]]+so[e[t+15]]).toLowerCase()}let JA;const ioe=new Uint8Array(16);function loe(){if(!JA){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");JA=crypto.getRandomValues.bind(crypto)}return JA(ioe)}const soe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fI={randomUUID:soe};function cO(e,t,n){if(fI.randomUUID&&!e)return fI.randomUUID();e=e||{};const r=e.random??e.rng?.()??loe();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,aoe(r)}const $B=z.createContext(void 0),XB=z.createContext(void 0),uoe=350,coe=({children:e,fixedHeight:t,duration:n=5e3,maxVisible:r=3,...a})=>{const[l,u]=z.useState(new Map),d=z.useRef(new Map),h=z.useRef(null),m=z.useRef(!0),y=z.useCallback(()=>{const k=Array.from(d.current).reverse();if(t){const D=t;k.forEach(([,M],I)=>{if(!M)return;M.setAttribute("data-front",String(I===0)),M.setAttribute("data-hidden",String(I>=r)),M.style.setProperty("--index",String(I)),M.style.setProperty("--height",`${t}px`),M.style.setProperty("--front-height",`${D}px`);const L=t*I;M.style.setProperty("--hover-offset-y",`-${L}px`)})}else{const D=k.map(([,I])=>{if(!I)return 0;const L=I.querySelector(".ToastInner");if(!L)return I.clientHeight;const P=L.style.height;L.style.height="auto";const G=I.clientHeight;return L.style.height=P,G}),M=D[0]||0;k.forEach(([,I],L)=>{if(!I)return;const P=D[L];I.setAttribute("data-front",String(L===0)),I.setAttribute("data-hidden",String(L>=r)),I.style.setProperty("--index",String(L)),I.style.setProperty("--height",`${P}px`),I.style.setProperty("--front-height",`${M}px`);const G=D.slice(0,L).reduce(($,Z)=>$+Z,0);I.style.setProperty("--hover-offset-y",`-${G}px`)})}},[t,r]),v=z.useCallback(k=>{u(D=>{const M=new Map(D);return M.set(cO(),{...k,duration:k.duration||n,open:!0}),M})},[n]),S=z.useCallback(k=>{m.current&&u(D=>{const M=new Map(D);return M.delete(k),M})},[]),w=z.useCallback(k=>v({...k,status:k.status||"default"}),[v]),A=z.useCallback(k=>v({...k,status:"success"}),[v]),E=z.useCallback(k=>v({...k,status:"error"}),[v]);z.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]),z.useEffect(()=>{const k=h.current;if(k){const D=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","true")})},M=L=>{(!k.contains(L.target)||k===L.target)&&d.current.forEach(P=>{P.setAttribute("data-hovering","false")})},I=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","false")})};return k.addEventListener("pointermove",D),k.addEventListener("pointerleave",I),k.addEventListener("focusin",D),k.addEventListener("focusout",M),()=>{k.removeEventListener("pointermove",D),k.removeEventListener("pointerleave",I),k.removeEventListener("focusin",D),k.removeEventListener("focusout",M)}}},[]);const R=z.useMemo(()=>Object.assign(w,{success:A,error:E}),[w,A,E]);return T.jsx($B.Provider,{value:R,children:T.jsx(XB.Provider,{value:z.useMemo(()=>({toastElementsMapRef:d,sortToasts:y}),[y]),children:T.jsxs(Qre,{...a,children:[e,Array.from(l).map(([k,D])=>T.jsx(hoe,{id:k,toast:D,onOpenChange:M=>{M||(d.current.delete(k),y(),u(I=>{const L=new Map(I),P=L.get(k);return P&&L.set(k,{...P,open:!1}),L}),setTimeout(()=>{S(k)},uoe))}},k)),T.jsx(Kre,{ref:h,className:"ToastViewport",style:t?{"--fixed-toast-height":`${t}px`}:void 0})]})})})},foe=()=>{const e=z.useContext($B);if(e)return e;throw new Error("useToast must be used within Toasts")},doe=()=>{const e=z.useContext(XB);if(e)return e;throw new Error("useToastContext must be used within Toasts")},hoe=({onOpenChange:e,toast:t,id:n,...r})=>{const a=z.useRef(null),l=doe(),{sortToasts:u,toastElementsMapRef:d}=l,h=d.current;return z.useLayoutEffect(()=>(a.current&&(h.set(n,a.current),u()),()=>{h.delete(n),u()}),[n,u,h]),T.jsx(eoe,{...r,ref:a,type:t.type,duration:t.duration,className:"ToastRoot",onOpenChange:e,open:t.open,children:T.jsxs("div",{className:"ToastInner","data-status":t.status,children:[T.jsx(poe,{status:t.status}),t.title&&T.jsx(toe,{className:"ToastTitle",children:t.title}),T.jsx(noe,{className:"ToastDescription",children:t.description}),t.action&&T.jsx(roe,{className:"ToastAction Button small green",altText:t.action.altText,onClick:t.action.onClick,asChild:!0,children:T.jsx("button",{children:t.action.label})}),T.jsx(ooe,{"aria-label":"Close",className:"ToastClose",children:T.jsx(sC,{style:{fontSize:"12px"}})})]})})},poe=({status:e})=>e!=="default"&&e?T.jsxs("div",{style:{gridArea:"icon",alignSelf:"start"},children:[e==="success"&&T.jsx(_Q,{style:{color:"#61d345",fontSize:"20px"}}),e==="error"&&T.jsx(AQ,{style:{color:"#ff4b4b",fontSize:"20px"}})]}):null,moe={},dI=e=>{let t;const n=new Set,r=(y,v)=>{const S=typeof y=="function"?y(t):y;if(!Object.is(S,t)){const w=t;t=v??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(A=>A(t,w))}},a=()=>t,h={setState:r,getState:a,getInitialState:()=>m,subscribe:y=>(n.add(y),()=>n.delete(y)),destroy:()=>{(moe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},m=t=e(r,a,h);return h},YB=e=>e?dI(e):dI;var e2={exports:{}},QA={},t2={exports:{}},KA={};/**
|
|
1036
|
+
*/var oI;function vre(){if(oI)return Jw;oI=1;var e=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,t=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,r=/\\([\u000b\u0020-\u00ff])/g,a=/([\\"])/g,l=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Jw.format=u,Jw.parse=d;function u(v){if(!v||typeof v!="object")throw new TypeError("argument obj is required");var S=v.parameters,w=v.type;if(!w||!l.test(w))throw new TypeError("invalid type");var A=w;if(S&&typeof S=="object")for(var E,R=Object.keys(S).sort(),k=0;k<R.length;k++){if(E=R[k],!n.test(E))throw new TypeError("invalid parameter name");A+="; "+E+"="+m(S[E])}return A}function d(v){if(!v)throw new TypeError("argument string is required");var S=typeof v=="object"?h(v):v;if(typeof S!="string")throw new TypeError("argument string is required to be a string");var w=S.indexOf(";"),A=w!==-1?S.slice(0,w).trim():S.trim();if(!l.test(A))throw new TypeError("invalid media type");var E=new y(A.toLowerCase());if(w!==-1){var R,k,D;for(e.lastIndex=w;k=e.exec(S);){if(k.index!==w)throw new TypeError("invalid parameter format");w+=k[0].length,R=k[1].toLowerCase(),D=k[2],D.charCodeAt(0)===34&&(D=D.slice(1,-1),D.indexOf("\\")!==-1&&(D=D.replace(r,"$1"))),E.parameters[R]=D}if(w!==S.length)throw new TypeError("invalid parameter format")}return E}function h(v){var S;if(typeof v.getHeader=="function"?S=v.getHeader("content-type"):typeof v.headers=="object"&&(S=v.headers&&v.headers["content-type"]),typeof S!="string")throw new TypeError("content-type header is missing from object");return S}function m(v){var S=String(v);if(n.test(S))return S;if(S.length>0&&!t.test(S))throw new TypeError("invalid parameter value");return'"'+S.replace(a,"\\$1")+'"'}function y(v){this.parameters=Object.create(null),this.type=v}return Jw}var bre=vre(),Dy=new Map,OB=function(t){return t.cloneNode(!0)},aI=function(){return window.location.protocol==="file:"},MB=function(t,n,r){var a=new XMLHttpRequest;a.onreadystatechange=function(){try{if(!/\.svg/i.test(t)&&a.readyState===2){var l=a.getResponseHeader("Content-Type");if(!l)throw new Error("Content type not found");var u=bre.parse(l).type;if(!(u==="image/svg+xml"||u==="text/plain"))throw new Error("Invalid content type: ".concat(u))}if(a.readyState===4){if(a.status===404||a.responseXML===null)throw new Error(aI()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+t);if(a.status===200||aI()&&a.status===0)r(null,a);else throw new Error("There was a problem injecting the SVG: "+a.status+" "+a.statusText)}}catch(d){if(a.abort(),d instanceof Error)r(d,a);else throw d}},a.open("GET",t),a.withCredentials=n,a.overrideMimeType&&a.overrideMimeType("text/xml"),a.send()},Ad={},iI=function(t,n){Ad[t]=Ad[t]||[],Ad[t].push(n)},xre=function(t){for(var n=function(u,d){setTimeout(function(){if(Array.isArray(Ad[t])){var h=Dy.get(t),m=Ad[t][u];h instanceof SVGSVGElement&&m(null,OB(h)),h instanceof Error&&m(h),u===Ad[t].length-1&&delete Ad[t]}},0)},r=0,a=Ad[t].length;r<a;r++)n(r)},Sre=function(t,n,r){if(Dy.has(t)){var a=Dy.get(t);if(a===void 0){iI(t,r);return}if(a instanceof SVGSVGElement){r(null,OB(a));return}}Dy.set(t,void 0),iI(t,r),MB(t,n,function(l,u){var d;l?Dy.set(t,l):((d=u.responseXML)===null||d===void 0?void 0:d.documentElement)instanceof SVGSVGElement&&Dy.set(t,u.responseXML.documentElement),xre(t)})},wre=function(t,n,r){MB(t,n,function(a,l){var u;a?r(a):((u=l.responseXML)===null||u===void 0?void 0:u.documentElement)instanceof SVGSVGElement&&r(null,l.responseXML.documentElement)})},Ere=0,Cre=function(){return++Ere},eu=[],lI={},_re="http://www.w3.org/2000/svg",WA="http://www.w3.org/1999/xlink",sI=function(t,n,r,a,l,u,d){var h=t.getAttribute("data-src")||t.getAttribute("src");if(!h){d(new Error("Invalid data-src or src attribute"));return}if(eu.indexOf(t)!==-1){eu.splice(eu.indexOf(t),1),t=null;return}eu.push(t),t.setAttribute("src","");var m=a?Sre:wre;m(h,l,function(y,v){if(!v){eu.splice(eu.indexOf(t),1),t=null,d(y);return}var S=t.getAttribute("id");S&&v.setAttribute("id",S);var w=t.getAttribute("title");w&&v.setAttribute("title",w);var A=t.getAttribute("width");A&&v.setAttribute("width",A);var E=t.getAttribute("height");E&&v.setAttribute("height",E);var R=Array.from(new Set(S2(S2(S2([],(v.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(t.getAttribute("class")||"").split(" "),!0))).join(" ").trim();v.setAttribute("class",R);var k=t.getAttribute("style");k&&v.setAttribute("style",k),v.setAttribute("data-src",h);var D=[].filter.call(t.attributes,function(J){return/^data-\w[\w-]*$/.test(J.name)});if(Array.prototype.forEach.call(D,function(J){J.name&&J.value&&v.setAttribute(J.name,J.value)}),r){var M={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]},I,L,P,G,$;Object.keys(M).forEach(function(J){I=J,P=M[J],L=v.querySelectorAll(I+"[id]");for(var ne=function(Y,he){G=L[Y].id,$=G+"-"+Cre();var Te;Array.prototype.forEach.call(P,function(Xe){Te=v.querySelectorAll("["+Xe+'*="'+G+'"]');for(var We=0,_t=Te.length;We<_t;We++){var Kt=Te[We].getAttribute(Xe);Kt&&!Kt.match(new RegExp('url\\("?#'+G+'"?\\)'))||Te[We].setAttribute(Xe,"url(#"+$+")")}});for(var me=v.querySelectorAll("[*|href]"),Ee=[],xe=0,Be=me.length;xe<Be;xe++){var He=me[xe].getAttributeNS(WA,"href");He&&He.toString()==="#"+L[Y].id&&Ee.push(me[xe])}for(var Ye=0,ke=Ee.length;Ye<ke;Ye++)Ee[Ye].setAttributeNS(WA,"href","#"+$);L[Y].id=$},B=0,oe=L.length;B<oe;B++)ne(B)})}v.removeAttribute("xmlns:a");for(var Z=v.querySelectorAll("script"),j=[],X,ee,ae=0,U=Z.length;ae<U;ae++)ee=Z[ae].getAttribute("type"),(!ee||ee==="application/ecmascript"||ee==="application/javascript"||ee==="text/javascript")&&(X=Z[ae].innerText||Z[ae].textContent,X&&j.push(X),v.removeChild(Z[ae]));if(j.length>0&&(n==="always"||n==="once"&&!lI[h])){for(var te=0,V=j.length;te<V;te++)new Function(j[te])(window);lI[h]=!0}var W=v.querySelectorAll("style");if(Array.prototype.forEach.call(W,function(J){J.textContent+=""}),v.setAttribute("xmlns",_re),v.setAttribute("xmlns:xlink",WA),u(v),!t.parentNode){eu.splice(eu.indexOf(t),1),t=null,d(new Error("Parent node is null"));return}t.parentNode.replaceChild(v,t),eu.splice(eu.indexOf(t),1),t=null,d(null,v)})},Are=function(t,n){var r=n===void 0?{}:n,a=r.afterAll,l=a===void 0?function(){}:a,u=r.afterEach,d=u===void 0?function(){}:u,h=r.beforeEach,m=h===void 0?function(){}:h,y=r.cacheRequests,v=y===void 0?!0:y,S=r.evalScripts,w=S===void 0?"never":S,A=r.httpRequestWithCredentials,E=A===void 0?!1:A,R=r.renumerateIRIElements,k=R===void 0?!0:R;if(t&&"length"in t)for(var D=0,M=0,I=t.length;M<I;M++)sI(t[M],w,k,v,E,m,function(L,P){d(L,P),t&&"length"in t&&t.length===++D&&l(D)});else t?sI(t,w,k,v,E,m,function(L,P){d(L,P),l(1),t=null}):l(0)},Tre=function(t){var n=t?.ownerDocument||document;return n.defaultView||window},Rre=function(t,n){for(var r in t)if(!(r in n))return!0;for(var a in n)if(t[a]!==n[a])return!0;return!1},kre=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Qw="http://www.w3.org/2000/svg",uI="http://www.w3.org/1999/xlink",oO=function(e){function t(){for(var r,a=arguments.length,l=new Array(a),u=0;u<a;u++)l[u]=arguments[u];return r=e.call.apply(e,[this].concat(l))||this,r.initialState={hasError:!1,isLoading:!0},r.state=r.initialState,r._isMounted=!1,r.reactWrapper=void 0,r.nonReactWrapper=void 0,r.refCallback=function(d){r.reactWrapper=d},r}Sj(t,e);var n=t.prototype;return n.renderSVG=function(){var a=this;if(this.reactWrapper instanceof Tre(this.reactWrapper).Node){var l=this.props,u=l.desc,d=l.evalScripts,h=l.httpRequestWithCredentials,m=l.renumerateIRIElements,y=l.src,v=l.title,S=l.useRequestCache,w=this.props.onError,A=this.props.beforeInjection,E=this.props.afterInjection,R=this.props.wrapper,k,D;R==="svg"?(k=document.createElementNS(Qw,R),k.setAttribute("xmlns",Qw),k.setAttribute("xmlns:xlink",uI),D=document.createElementNS(Qw,R)):(k=document.createElement(R),D=document.createElement(R)),k.appendChild(D),D.dataset.src=y,this.nonReactWrapper=this.reactWrapper.appendChild(k);var M=function(G){if(a.removeSVG(),!a._isMounted){w(G);return}a.setState(function(){return{hasError:!0,isLoading:!1}},function(){w(G)})},I=function(G,$){if(G){M(G);return}a._isMounted&&a.setState(function(){return{isLoading:!1}},function(){try{E($)}catch(Z){M(Z)}})},L=function(G){if(G.setAttribute("role","img"),u){var $=G.querySelector(":scope > desc");$&&G.removeChild($);var Z=document.createElement("desc");Z.innerHTML=u,G.prepend(Z)}if(v){var j=G.querySelector(":scope > title");j&&G.removeChild(j);var X=document.createElement("title");X.innerHTML=v,G.prepend(X)}try{A(G)}catch(ee){M(ee)}};Are(D,{afterEach:I,beforeEach:L,cacheRequests:S,evalScripts:d,httpRequestWithCredentials:h,renumerateIRIElements:m})}},n.removeSVG=function(){var a;(a=this.nonReactWrapper)!=null&&a.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},n.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},n.componentDidUpdate=function(a){var l=this;Rre(st({},a),this.props)&&this.setState(function(){return l.initialState},function(){l.removeSVG(),l.renderSVG()})},n.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},n.render=function(){var a=this.props;a.afterInjection,a.beforeInjection,a.desc,a.evalScripts;var l=a.fallback;a.httpRequestWithCredentials;var u=a.loading;a.renumerateIRIElements,a.src,a.title,a.useRequestCache;var d=a.wrapper,h=bk(a,kre),m=d;return z.createElement(m,st({},h,{ref:this.refCallback},d==="svg"?{xmlns:Qw,xmlnsXlink:uI}:{}),this.state.isLoading&&u&&z.createElement(u,null),this.state.hasError&&l&&z.createElement(l,null))},t}(z.Component);oO.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"};oO.propTypes={afterInjection:Cr.func,beforeInjection:Cr.func,desc:Cr.string,evalScripts:Cr.oneOf(["always","once","never"]),fallback:Cr.oneOfType([Cr.func,Cr.object,Cr.string]),httpRequestWithCredentials:Cr.bool,loading:Cr.oneOfType([Cr.func,Cr.object,Cr.string]),onError:Cr.func,renumerateIRIElements:Cr.bool,src:Cr.string.isRequired,title:Cr.string,useRequestCache:Cr.bool,wrapper:Cr.oneOf(["div","span","svg"])};const aO=({text:e="No image data provided"})=>T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:e}),Ore=z.memo(({value:e,format:t="jpeg",alt:n="Base64 image",onError:r,onLoad:a,...l})=>{const[u,d]=z.useState(!1),[h,m]=z.useState(!0),y=z.useRef(null),v=z.useMemo(()=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"data"in e){const E=e.data;if(E instanceof ArrayBuffer){const R=new Uint8Array(E);let k="";for(let D=0;D<R.byteLength;D++)k+=String.fromCharCode(R[D]);return btoa(k)}}return""},[e]),S=z.useMemo(()=>v?`data:image/${t};base64,${v}`:"",[v,t]),w=z.useCallback(E=>{d(!0),m(!1),r?.(E)},[r]),A=z.useCallback(()=>{m(!1),d(!1),a?.()},[a]);return z.useEffect(()=>{const E=y.current;if(E)return E.addEventListener("error",w),E.addEventListener("load",A),()=>{E.removeEventListener("error",w),E.removeEventListener("load",A)}},[w,A,e]),z.useEffect(()=>{d(!1),m(!0)},[e]),v?u?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load base64 image"}):T.jsx("img",{ref:y,src:S,alt:n,className:`base64-image-renderer image-renderer ${l.className||""} ${h?" loading":""}`,...l}):T.jsx(aO,{})}),Mre=z.memo(({value:e,alt:t="SVG image",onError:n,onLoad:r,...a})=>{const[l,u]=z.useState(!1),d=z.useMemo(()=>{if(!e)return"";try{return`data:image/svg+xml;base64,${btoa(e)}`}catch(m){return console.error("Failed to encode SVG to base64:",m),""}},[e]);z.useEffect(()=>{u(!1)},[e]);const h=z.useCallback(m=>{u(!0),n?.(m)},[n]);return e?l||!d?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load SVG"}):T.jsx(oO,{src:d,className:`svg-renderer ${a.className||""}`,style:{maxWidth:"100%",maxHeight:"100%",...a.style},beforeInjection:m=>{m.classList.add("svg-renderer"),m.setAttribute("style","max-width: 100%; max-height: 100%;"),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("aria-label",t);const y=()=>{u(!1),r?.()},v=S=>{u(!0),n?.(S)};try{m.addEventListener("load",y),m.addEventListener("error",v)}catch{y()}},onError:h}):T.jsx(aO,{})}),Nre=z.memo(({src:e,alt:t="Streaming image",onError:n,onLoad:r,...a})=>{const l=z.useRef(null),[u,d]=z.useState(!1),[h,m]=z.useState(!0);z.useEffect(()=>{l.current&&e&&(m(!0),d(!1),l.current.src=e)},[e]);const y=z.useCallback(S=>{d(!0),m(!1),n?.(S)},[n]),v=z.useCallback(()=>{m(!1),d(!1),r?.()},[r]);return z.useEffect(()=>{const S=l.current;if(S)return S.addEventListener("error",y),S.addEventListener("load",v),()=>{S.removeEventListener("error",y),S.removeEventListener("load",v)}},[y,v]),u?T.jsx(aO,{text:"Failed to load image"}):T.jsx("img",{ref:l,className:`streaming-image image-renderer ${a.className||""} ${h?" loading":""}`,alt:t,...a})});function mC(e){const t=e+"CollectionProvider",[n,r]=bu(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=E=>{const{scope:R,children:k}=E,D=Q.useRef(null),M=Q.useRef(new Map).current;return T.jsx(a,{scope:R,itemMap:M,collectionRef:D,children:k})};u.displayName=t;const d=e+"CollectionSlot",h=Jy(d),m=Q.forwardRef((E,R)=>{const{scope:k,children:D}=E,M=l(d,k),I=En(R,M.collectionRef);return T.jsx(h,{ref:I,children:D})});m.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",S=Jy(y),w=Q.forwardRef((E,R)=>{const{scope:k,children:D,...M}=E,I=Q.useRef(null),L=En(R,I),P=l(y,k);return Q.useEffect(()=>(P.itemMap.set(I,{ref:I,...M}),()=>void P.itemMap.delete(I))),T.jsx(S,{[v]:"",ref:L,children:D})});w.displayName=y;function A(E){const R=l(e+"CollectionConsumer",E);return Q.useCallback(()=>{const D=R.collectionRef.current;if(!D)return[];const M=Array.from(D.querySelectorAll(`[${v}]`));return Array.from(R.itemMap.values()).sort((P,G)=>M.indexOf(P.ref.current)-M.indexOf(G.ref.current))},[R.collectionRef,R.itemMap])}return[{Provider:u,Slot:m,ItemSlot:w},A,r]}var Dre=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ire="VisuallyHidden",iO=z.forwardRef((e,t)=>T.jsx(zt.span,{...e,ref:t,style:{...Dre,...e.style}}));iO.displayName=Ire;var lO="ToastProvider",[sO,zre,jre]=mC("Toast"),[NB,jSe]=bu("Toast",[jre]),[Bre,gC]=NB(lO),DB=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:l=50,children:u}=e,[d,h]=z.useState(null),[m,y]=z.useState(0),v=z.useRef(!1),S=z.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${lO}\`. Expected non-empty \`string\`.`),T.jsx(sO.Provider,{scope:t,children:T.jsx(Bre,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:l,toastCount:m,viewport:d,onViewportChange:h,onToastAdd:z.useCallback(()=>y(w=>w+1),[]),onToastRemove:z.useCallback(()=>y(w=>w-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:S,children:u})})};DB.displayName=lO;var IB="ToastViewport",Lre=["F8"],pR="toast.viewportPause",mR="toast.viewportResume",zB=z.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Lre,label:a="Notifications ({hotkey})",...l}=e,u=gC(IB,n),d=zre(n),h=z.useRef(null),m=z.useRef(null),y=z.useRef(null),v=z.useRef(null),S=En(t,v,u.onViewportChange),w=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=u.toastCount>0;z.useEffect(()=>{const R=k=>{r.length!==0&&r.every(M=>k[M]||k.code===M)&&v.current?.focus()};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[r]),z.useEffect(()=>{const R=h.current,k=v.current;if(A&&R&&k){const D=()=>{if(!u.isClosePausedRef.current){const P=new CustomEvent(pR);k.dispatchEvent(P),u.isClosePausedRef.current=!0}},M=()=>{if(u.isClosePausedRef.current){const P=new CustomEvent(mR);k.dispatchEvent(P),u.isClosePausedRef.current=!1}},I=P=>{!R.contains(P.relatedTarget)&&M()},L=()=>{R.contains(document.activeElement)||M()};return R.addEventListener("focusin",D),R.addEventListener("focusout",I),R.addEventListener("pointermove",D),R.addEventListener("pointerleave",L),window.addEventListener("blur",D),window.addEventListener("focus",M),()=>{R.removeEventListener("focusin",D),R.removeEventListener("focusout",I),R.removeEventListener("pointermove",D),R.removeEventListener("pointerleave",L),window.removeEventListener("blur",D),window.removeEventListener("focus",M)}}},[A,u.isClosePausedRef]);const E=z.useCallback(({tabbingDirection:R})=>{const D=d().map(M=>{const I=M.ref.current,L=[I,...Jre(I)];return R==="forwards"?L:L.reverse()});return(R==="forwards"?D.reverse():D).flat()},[d]);return z.useEffect(()=>{const R=v.current;if(R){const k=D=>{const M=D.altKey||D.ctrlKey||D.metaKey;if(D.key==="Tab"&&!M){const L=document.activeElement,P=D.shiftKey;if(D.target===R&&P){m.current?.focus();return}const Z=E({tabbingDirection:P?"backwards":"forwards"}),j=Z.findIndex(X=>X===L);qA(Z.slice(j+1))?D.preventDefault():P?m.current?.focus():y.current?.focus()}};return R.addEventListener("keydown",k),()=>R.removeEventListener("keydown",k)}},[d,E]),T.jsxs(hY,{ref:h,role:"region","aria-label":a.replace("{hotkey}",w),tabIndex:-1,style:{pointerEvents:A?void 0:"none"},children:[A&&T.jsx(gR,{ref:m,onFocusFromOutsideViewport:()=>{const R=E({tabbingDirection:"forwards"});qA(R)}}),T.jsx(sO.Slot,{scope:n,children:T.jsx(zt.ol,{tabIndex:-1,...l,ref:S})}),A&&T.jsx(gR,{ref:y,onFocusFromOutsideViewport:()=>{const R=E({tabbingDirection:"backwards"});qA(R)}})]})});zB.displayName=IB;var jB="ToastFocusProxy",gR=z.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,l=gC(jB,n);return T.jsx(iO,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:u=>{const d=u.relatedTarget;!l.viewport?.contains(d)&&r()}})});gR.displayName=jB;var Cx="Toast",Pre="toast.swipeStart",Hre="toast.swipeMove",Vre="toast.swipeCancel",Fre="toast.swipeEnd",BB=z.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:l,...u}=e,[d,h]=Hd({prop:r,defaultProp:a??!0,onChange:l,caller:Cx});return T.jsx(as,{present:n||d,children:T.jsx($re,{open:d,...u,ref:t,onClose:()=>h(!1),onPause:ka(e.onPause),onResume:ka(e.onResume),onSwipeStart:Ke(e.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ke(e.onSwipeMove,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:Ke(e.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ke(e.onSwipeEnd,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),h(!1)})})})});BB.displayName=Cx;var[Gre,Ure]=NB(Cx,{onClose(){}}),$re=z.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:l,onClose:u,onEscapeKeyDown:d,onPause:h,onResume:m,onSwipeStart:y,onSwipeMove:v,onSwipeCancel:S,onSwipeEnd:w,...A}=e,E=gC(Cx,n),[R,k]=z.useState(null),D=En(t,U=>k(U)),M=z.useRef(null),I=z.useRef(null),L=a||E.duration,P=z.useRef(0),G=z.useRef(L),$=z.useRef(0),{onToastAdd:Z,onToastRemove:j}=E,X=ka(()=>{R?.contains(document.activeElement)&&E.viewport?.focus(),u()}),ee=z.useCallback(U=>{!U||U===1/0||(window.clearTimeout($.current),P.current=new Date().getTime(),$.current=window.setTimeout(X,U))},[X]);z.useEffect(()=>{const U=E.viewport;if(U){const te=()=>{ee(G.current),m?.()},V=()=>{const W=new Date().getTime()-P.current;G.current=G.current-W,window.clearTimeout($.current),h?.()};return U.addEventListener(pR,V),U.addEventListener(mR,te),()=>{U.removeEventListener(pR,V),U.removeEventListener(mR,te)}}},[E.viewport,L,h,m,ee]),z.useEffect(()=>{l&&!E.isClosePausedRef.current&&ee(L)},[l,L,E.isClosePausedRef,ee]),z.useEffect(()=>(Z(),()=>j()),[Z,j]);const ae=z.useMemo(()=>R?UB(R):null,[R]);return E.viewport?T.jsxs(T.Fragment,{children:[ae&&T.jsx(Xre,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:ae}),T.jsx(Gre,{scope:n,onClose:X,children:kE.createPortal(T.jsx(sO.ItemSlot,{scope:n,children:T.jsx(dY,{asChild:!0,onEscapeKeyDown:Ke(d,()=>{E.isFocusedToastEscapeKeyDownRef.current||X(),E.isFocusedToastEscapeKeyDownRef.current=!1}),children:T.jsx(zt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":l?"open":"closed","data-swipe-direction":E.swipeDirection,...A,ref:D,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ke(e.onKeyDown,U=>{U.key==="Escape"&&(d?.(U.nativeEvent),U.nativeEvent.defaultPrevented||(E.isFocusedToastEscapeKeyDownRef.current=!0,X()))}),onPointerDown:Ke(e.onPointerDown,U=>{U.button===0&&(M.current={x:U.clientX,y:U.clientY})}),onPointerMove:Ke(e.onPointerMove,U=>{if(!M.current)return;const te=U.clientX-M.current.x,V=U.clientY-M.current.y,W=!!I.current,J=["left","right"].includes(E.swipeDirection),ne=["left","up"].includes(E.swipeDirection)?Math.min:Math.max,B=J?ne(0,te):0,oe=J?0:ne(0,V),se=U.pointerType==="touch"?10:2,Y={x:B,y:oe},he={originalEvent:U,delta:Y};W?(I.current=Y,Kw(Hre,v,he,{discrete:!1})):cI(Y,E.swipeDirection,se)?(I.current=Y,Kw(Pre,y,he,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(te)>se||Math.abs(V)>se)&&(M.current=null)}),onPointerUp:Ke(e.onPointerUp,U=>{const te=I.current,V=U.target;if(V.hasPointerCapture(U.pointerId)&&V.releasePointerCapture(U.pointerId),I.current=null,M.current=null,te){const W=U.currentTarget,J={originalEvent:U,delta:te};cI(te,E.swipeDirection,E.swipeThreshold)?Kw(Fre,w,J,{discrete:!0}):Kw(Vre,S,J,{discrete:!0}),W.addEventListener("click",ne=>ne.preventDefault(),{once:!0})}})})})}),E.viewport)})]}):null}),Xre=e=>{const{__scopeToast:t,children:n,...r}=e,a=gC(Cx,t),[l,u]=z.useState(!1),[d,h]=z.useState(!1);return Wre(()=>u(!0)),z.useEffect(()=>{const m=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(m)},[]),d?null:T.jsx(KE,{asChild:!0,children:T.jsx(iO,{...r,children:l&&T.jsxs(T.Fragment,{children:[a.label," ",n]})})})},Yre="ToastTitle",LB=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(zt.div,{...r,ref:t})});LB.displayName=Yre;var Zre="ToastDescription",PB=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(zt.div,{...r,ref:t})});PB.displayName=Zre;var HB="ToastAction",VB=z.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?T.jsx(GB,{altText:n,asChild:!0,children:T.jsx(uO,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${HB}\`. Expected non-empty \`string\`.`),null)});VB.displayName=HB;var FB="ToastClose",uO=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=Ure(FB,n);return T.jsx(GB,{asChild:!0,children:T.jsx(zt.button,{type:"button",...r,ref:t,onClick:Ke(e.onClick,a.onClose)})})});uO.displayName=FB;var GB=z.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return T.jsx(zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function UB(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),qre(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",l=r.dataset.radixToastAnnounceExclude==="";if(!a)if(l){const u=r.dataset.radixToastAnnounceAlt;u&&t.push(u)}else t.push(...UB(r))}}),t}function Kw(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,l=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Ek(a,l):a.dispatchEvent(l)}var cI=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),l=r>a;return t==="left"||t==="right"?l&&r>n:!l&&a>n};function Wre(e=()=>{}){const t=ka(e);Gc(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function qre(e){return e.nodeType===e.ELEMENT_NODE}function Jre(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function qA(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Qre=DB,Kre=zB,eoe=BB,toe=LB,noe=PB,roe=VB,ooe=uO;const so=[];for(let e=0;e<256;++e)so.push((e+256).toString(16).slice(1));function aoe(e,t=0){return(so[e[t+0]]+so[e[t+1]]+so[e[t+2]]+so[e[t+3]]+"-"+so[e[t+4]]+so[e[t+5]]+"-"+so[e[t+6]]+so[e[t+7]]+"-"+so[e[t+8]]+so[e[t+9]]+"-"+so[e[t+10]]+so[e[t+11]]+so[e[t+12]]+so[e[t+13]]+so[e[t+14]]+so[e[t+15]]).toLowerCase()}let JA;const ioe=new Uint8Array(16);function loe(){if(!JA){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");JA=crypto.getRandomValues.bind(crypto)}return JA(ioe)}const soe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fI={randomUUID:soe};function cO(e,t,n){if(fI.randomUUID&&!e)return fI.randomUUID();e=e||{};const r=e.random??e.rng?.()??loe();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,aoe(r)}const $B=z.createContext(void 0),XB=z.createContext(void 0),uoe=350,coe=({children:e,fixedHeight:t,duration:n=5e3,maxVisible:r=3,...a})=>{const[l,u]=z.useState(new Map),d=z.useRef(new Map),h=z.useRef(null),m=z.useRef(!0),y=z.useCallback(()=>{const k=Array.from(d.current).reverse();if(t){const D=t;k.forEach(([,M],I)=>{if(!M)return;M.setAttribute("data-front",String(I===0)),M.setAttribute("data-hidden",String(I>=r)),M.style.setProperty("--index",String(I)),M.style.setProperty("--height",`${t}px`),M.style.setProperty("--front-height",`${D}px`);const L=t*I;M.style.setProperty("--hover-offset-y",`-${L}px`)})}else{const D=k.map(([,I])=>{if(!I)return 0;const L=I.querySelector(".ToastInner");if(!L)return I.clientHeight;const P=L.style.height;L.style.height="auto";const G=I.clientHeight;return L.style.height=P,G}),M=D[0]||0;k.forEach(([,I],L)=>{if(!I)return;const P=D[L];I.setAttribute("data-front",String(L===0)),I.setAttribute("data-hidden",String(L>=r)),I.style.setProperty("--index",String(L)),I.style.setProperty("--height",`${P}px`),I.style.setProperty("--front-height",`${M}px`);const G=D.slice(0,L).reduce(($,Z)=>$+Z,0);I.style.setProperty("--hover-offset-y",`-${G}px`)})}},[t,r]),v=z.useCallback(k=>{u(D=>{const M=new Map(D);return M.set(cO(),{...k,duration:k.duration||n,open:!0}),M})},[n]),S=z.useCallback(k=>{m.current&&u(D=>{const M=new Map(D);return M.delete(k),M})},[]),w=z.useCallback(k=>v({...k,status:k.status||"default"}),[v]),A=z.useCallback(k=>v({...k,status:"success"}),[v]),E=z.useCallback(k=>v({...k,status:"error"}),[v]);z.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]),z.useEffect(()=>{const k=h.current;if(k){const D=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","true")})},M=L=>{(!k.contains(L.target)||k===L.target)&&d.current.forEach(P=>{P.setAttribute("data-hovering","false")})},I=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","false")})};return k.addEventListener("pointermove",D),k.addEventListener("pointerleave",I),k.addEventListener("focusin",D),k.addEventListener("focusout",M),()=>{k.removeEventListener("pointermove",D),k.removeEventListener("pointerleave",I),k.removeEventListener("focusin",D),k.removeEventListener("focusout",M)}}},[]);const R=z.useMemo(()=>Object.assign(w,{success:A,error:E}),[w,A,E]);return T.jsx($B.Provider,{value:R,children:T.jsx(XB.Provider,{value:z.useMemo(()=>({toastElementsMapRef:d,sortToasts:y}),[y]),children:T.jsxs(Qre,{...a,children:[e,Array.from(l).map(([k,D])=>T.jsx(hoe,{id:k,toast:D,onOpenChange:M=>{M||(d.current.delete(k),y(),u(I=>{const L=new Map(I),P=L.get(k);return P&&L.set(k,{...P,open:!1}),L}),setTimeout(()=>{S(k)},uoe))}},k)),T.jsx(Kre,{ref:h,className:"ToastViewport",style:t?{"--fixed-toast-height":`${t}px`}:void 0})]})})})},foe=()=>{const e=z.useContext($B);if(e)return e;throw new Error("useToast must be used within Toasts")},doe=()=>{const e=z.useContext(XB);if(e)return e;throw new Error("useToastContext must be used within Toasts")},hoe=({onOpenChange:e,toast:t,id:n,...r})=>{const a=z.useRef(null),l=doe(),{sortToasts:u,toastElementsMapRef:d}=l,h=d.current;return z.useLayoutEffect(()=>(a.current&&(h.set(n,a.current),u()),()=>{h.delete(n),u()}),[n,u,h]),T.jsx(eoe,{...r,ref:a,type:t.type,duration:t.duration,className:"ToastRoot",onOpenChange:e,open:t.open,children:T.jsxs("div",{className:"ToastInner","data-status":t.status,children:[T.jsx(poe,{status:t.status}),t.title&&T.jsx(toe,{className:"ToastTitle",children:t.title}),T.jsx(noe,{className:"ToastDescription",children:t.description}),t.action&&T.jsx(roe,{className:"ToastAction Button small green",altText:t.action.altText,onClick:t.action.onClick,asChild:!0,children:T.jsx("button",{children:t.action.label})}),T.jsx(ooe,{"aria-label":"Close",className:"ToastClose",children:T.jsx(sC,{style:{fontSize:"12px"}})})]})})},poe=({status:e})=>e!=="default"&&e?T.jsxs("div",{style:{gridArea:"icon",alignSelf:"start"},children:[e==="success"&&T.jsx(_Q,{style:{color:"#61d345",fontSize:"20px"}}),e==="error"&&T.jsx(AQ,{style:{color:"#ff4b4b",fontSize:"20px"}})]}):null,moe={},dI=e=>{let t;const n=new Set,r=(y,v)=>{const S=typeof y=="function"?y(t):y;if(!Object.is(S,t)){const w=t;t=v??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(A=>A(t,w))}},a=()=>t,h={setState:r,getState:a,getInitialState:()=>m,subscribe:y=>(n.add(y),()=>n.delete(y)),destroy:()=>{(moe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},m=t=e(r,a,h);return h},YB=e=>e?dI(e):dI;var e2={exports:{}},QA={},t2={exports:{}},KA={};/**
|
|
1037
1037
|
* @license React
|
|
1038
1038
|
* use-sync-external-store-shim.production.js
|
|
1039
1039
|
*
|
|
@@ -1069,12 +1069,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1069
1069
|
`+t.error),n=t.id&&this.messagePromises.get(t.id),n)return n.reject(t.error);break;case"progress":if(!this.context.worker._zustand)return;this.context.worker._zustand.set_progress(t);break;case"workerevent":return await this.context.worker.getEventManager().receive_workerevent(t);case"large_message":return await this.context.worker.handle_large_message_hint(t);default:console.warn("Unhandled message",t);break}}async recieve_bytes(t,n){const{type:r}=t;if(r==="io_value"){if(!this.context.worker._zustand)return;const{node:a,io:l,preview:u,mime:d}=t,h=u?"value":"fullvalue";(!a||!l)&&console.error("Invalid io_value message",t);const m=JB({data:n,mime:d||"application/octet-stream"});this.context.worker._zustand.on_node_action({type:"update",node:{id:a,io:{[l]:{[h]:m}}},id:a,from_remote:!0})}else if(r=="result"){const a=t.id&&this.messagePromises.get(t.id);a&&a.resolve({bytes:n,header:t})}else console.warn("Unhandled bytes message",t)}async onbytes(t){try{const n=new TextDecoder("utf-8").decode(t),r=n.indexOf(`\r
|
|
1070
1070
|
\r
|
|
1071
1071
|
`);if(r===-1){console.error(`Header terminator not found for:
|
|
1072
|
-
`,n);return}const a=n.substring(0,r+4),l=t.slice(r+4),u=a.split(";"),d={};if(u.forEach(v=>{const[S,w]=v.split("=");d[S.trim()]=w.trim()}),!d.chunk||!d.msgid){console.error("Header missing required fields chunk or msgid",d);return}const[h,m]=d.chunk.split("/"),y=d.msgid;if(h==="1"&&m==="1")return this.recieve_bytes(d,l);if(this.blobChunks[y]||(this.blobChunks[y]={chunks:Array.from({length:parseInt(m)},()=>null),timestamp:Date.now()}),this.blobChunks[y].chunks.length!==parseInt(m)){console.error("Total chunks mismatch");return}if(this.blobChunks[y].chunks[parseInt(h)-1]=t,this.blobChunks[y].chunks.every(v=>v!==null)){const v=new Uint8Array(this.blobChunks[y].chunks.reduce((S,w)=>S.concat(Array.from(w)),[]));this.recieve_bytes(d,v),delete this.blobChunks[y]}}catch(n){console.error("Websocketworker: onbytes error",n,t);return}}}class Ooe extends Kc{constructor(){super(...arguments),this._ns_event_intercepts=new Map}start(){}stop(){}async _receive_edge_added(t,n,r,a){this.context.worker._zustand&&this.context.worker._zustand.on_edge_action({type:"add",from_remote:!0,src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a})}async _receive_groups(t){this.context.worker._zustand&&this.context.worker._zustand.on_group_action({type:"set",groups:t})}async _receive_node_added(t){if(this.context.worker._zustand)return this.context.worker._zustand.on_node_action({type:"add",node:t,id:t.id,from_remote:!0})}async receive_workerevent({event:t,data:n}){switch(t){case"worker_error":return this.context.worker._zustand?this.context.worker._zustand.logger.error(n.error):void 0;case"update_worker_dependencies":return this.context.worker._zustand?this.context.worker._zustand.lib.libstate.getState().set({external_worker:n.worker_dependencies}):void 0;case"lib_update":await this.context.worker.getSyncManager().sync_lib();return;case"fullsync":await this.context.worker.getSyncManager().stepwise_fullsync();return;case"external_worker_update":await this.context.worker.getSyncManager().sync_lib(),await this.context.worker.getSyncManager().sync_external_worker();return;case"starting":this.hookManager.call_hooks("starting");return;case"stopping":this.hookManager.call_hooks("stopping");return;default:console.warn("Unhandled worker event",t,n);break}}async intercept_ns_event(t){let n=t;for(const r of this._ns_event_intercepts.get(t.event)||[])n=await r(n);return n}async receive_nodespace_event(t){const{event:n,data:r}=await this.intercept_ns_event(t);switch(n){case"after_set_value":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value:r.result}}},id:r.node,from_remote:!0}):void 0;case"after_update_value_options":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value_options:r.result}}},id:r.node,from_remote:!0}):void 0;case"triggerstart":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}):void 0;case"triggerdone":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0}):void 0;case"triggerfast":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}),setTimeout(()=>{this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0})},50);return;case"node_trigger_error":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"error",errortype:"trigger",error:r.error,id:r.node,tb:r.tb,from_remote:!0}):void 0;case"node_removed":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"delete",id:r.node,from_remote:!0}),this.hookManager.call_hooks("node_removed",{node:r.node});return;case"node_added":this._receive_node_added(r.node);return;case"after_disconnect":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_unforward":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_connect":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_forward":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_add_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"after_remove_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"progress":if(!this.context.worker._zustand)return;if(r.node)return this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,progress:r.info},id:r.node,from_remote:!0});console.warn("Unhandled nodepsace event",n,r);break;default:if(["after_set_nodespace"].includes(n))return;console.warn("Unhandled nodepsace event",n,r);break}}add_ns_event_intercept(t,n){const r=this._ns_event_intercepts.get(t)||[];return r.push(n),this._ns_event_intercepts.set(t,r),()=>{const l=this._ns_event_intercepts.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}}class Moe extends Kc{constructor(){super(...arguments),this._hooks=new Map}start(){}stop(){}add_hook(t,n){const r=this._hooks.get(t)||[];return r.push(n),this._hooks.set(t,r),()=>{const l=this._hooks.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}async call_hooks(t,n){const r=[];for(const a of this._hooks.get(t)||[]){const l=a({worker:this.context.worker,data:n});l instanceof Promise&&r.push(l)}await Promise.all(r)}}class Noe extends Kc{start(){}stop(){}async trigger_node(t){await this.communicationManager._send_cmd({cmd:"trigger_node",kwargs:{nid:t},wait_for_response:!1})}async add_node(t){const n=await this.communicationManager._send_cmd({cmd:"add_node",kwargs:{id:t}});return this.eventManager._receive_node_added(n)}async remove_node(t){await this.communicationManager._send_cmd({cmd:"remove_node",kwargs:{id:t}})}locally_update_node(t){this.syncManager.locally_update_node(t)}set_io_value({nid:t,ioid:n,value:r,set_default:a=!1}){return this.communicationManager._send_cmd({cmd:"set_io_value",kwargs:{nid:t,ioid:n,value:r,set_default:a},wait_for_response:!0})}set_io_value_options({nid:t,ioid:n,values:r,keys:a,nullable:l}){return this.communicationManager._send_cmd({cmd:"update_io_value_options",kwargs:{nid:t,ioid:n,options:{options:{type:"enum",values:r,keys:a,nullable:l}}}})}async get_io_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_value",kwargs:{nid:t,ioid:n},wait_for_response:!0});return this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{value:r}}},id:t,from_remote:!0}),r}async get_ios_values({nid:t}){const n=await this.communicationManager._send_cmd({cmd:"get_ios_values",kwargs:{nid:t},wait_for_response:!0});if(!this.context.worker._zustand)return n;const r={};for(const a in n)r[a]={value:n[a]};return this.context.worker._zustand.on_node_action({type:"update",node:{io:r},id:t,from_remote:!0}),n}async get_io_full_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_full_value",kwargs:{nid:t,ioid:n},wait_for_response:!0,as_bytes:!0}),{header:a,bytes:l}=r,{mime:u}=a,d=JB({data:l,mime:u||"application/octet-stream"});return this.context.worker._zustand?.on_node_action?.({type:"update",node:{id:t,io:{[n]:{fullvalue:d}}},id:t,from_remote:!0}),d}async update_io_options({nid:t,ioid:n,options:r}){const a=await this.communicationManager._send_cmd({cmd:"update_io_options",kwargs:{nid:t,ioid:n,...r},wait_for_response:!0});if(!this.context.worker._zustand)return a;this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{...r}}},id:t,from_remote:!0})}async get_node_status(t){return await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0})}async get_remote_node_state(t){const n=await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0});this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:n,id:n.id,from_remote:!0})}}class Doe extends Kc{start(){}stop(){}add_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l=!1}){return this.communicationManager._send_cmd({cmd:"add_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l}})}remove_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}){return this.communicationManager._send_cmd({cmd:"remove_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}})}}class Ioe extends Kc{start(){}stop(){}async group_nodes(t,n){const r=await this.communicationManager._send_cmd({cmd:"group_nodes",kwargs:{node_ids:t,group_ids:n},wait_for_response:!0});return this.eventManager._receive_groups(r),r}async remove_group(t){await this.communicationManager._send_cmd({cmd:"remove_group",kwargs:{gid:t},wait_for_response:!0}),await this.syncManager.sync_nodespace()}locally_update_group(t){this.syncManager.locally_update_group(t)}}class zoe extends Kc{start(){}stop(){}async add_external_worker({module:t,cls_module:n,cls_name:r}){return await this.communicationManager._send_cmd({cmd:"add_external_worker",kwargs:{module:t,cls_module:n,cls_name:r}})}async add_lib(t,n){return await this.communicationManager._send_cmd({cmd:"add_package_dependency",kwargs:{name:t,version:n},wait_for_response:!1})}async remove_lib(t){return await this.communicationManager._send_cmd({cmd:"remove_package_dependency",kwargs:{name:t},wait_for_response:!1})}async get_available_modules(){return await this.communicationManager._send_cmd({cmd:"get_available_modules",wait_for_response:!0,unique:!0})}async remove_external_worker(t,n){return await this.communicationManager._send_cmd({cmd:"remove_external_worker",kwargs:{worker_id:t,class_id:n},wait_for_response:!0})}}class joe{getEventManager(){return this._eventManager}getSyncManager(){return this._syncManager}getCommunicationManager(){return this._communicationManager}getConnectionHealthManager(){return this._connectionhealthManager}getHookManager(){return this._hookManager}getNodeManager(){return this._nodeManager}getEdgeManager(){return this._edgeManager}getGroupManager(){return this._groupManager}getLibraryManager(){return this._libraryManager}constructor(t){this.uuid=t.uuid,this.on_error=t.on_error||(r=>{this._zustand?.logger.error(r)}),this.state=fl((r,a)=>({is_open:!1}));const n={worker:this};this._connectionhealthManager=new Aoe(n),this._communicationManager=new koe(n),this._eventManager=new Ooe({...n}),this._syncManager=new Toe({...n,on_sync_complete:t.on_sync_complete}),this._hookManager=new Moe(n),this._nodeManager=new Noe(n),this._edgeManager=new Doe(n),this._groupManager=new Ioe(n),this._libraryManager=new zoe(n),this._communicationManager.start(),this._connectionhealthManager.start(),this._syncManager.start(),this._eventManager.start(),this._hookManager.start(),this._nodeManager.start(),this._edgeManager.start(),this._groupManager.start(),this._libraryManager.start(),t.zustand&&this.set_zustand(t.zustand),this.api={node:this._nodeManager,group:this._groupManager,edge:this._edgeManager,hooks:this._hookManager,lib:this._libraryManager}}set_zustand(t){t!==this._zustand&&(this._zustand=t,t.set_worker(this),this._zustand.auto_progress(),this._syncManager.stepwise_fullsync())}get is_open(){return this.state.getState().is_open}set is_open(t){this.state.setState({is_open:t})}get is_responsive(){return this._connectionhealthManager.isResponsive()}clear(){return this._communicationManager._send_cmd({cmd:"clear",unique:!0})}save(){return this._communicationManager._send_cmd({cmd:"save",wait_for_response:!0,unique:!0})}load(t){return this._communicationManager._send_cmd({cmd:"load_data",kwargs:{data:t},wait_for_response:!0}).then(()=>{this._syncManager.stepwise_fullsync()})}async get_runstate(){return await this._communicationManager._send_cmd({cmd:"get_runstate",wait_for_response:!0,unique:!0})}async send(t){throw new Error("async send(data: any) not implemented")}async upload_file(t){throw new Error("upload_file not implemented ")}async handle_large_message_hint({}){throw new Error("async handle_large_message_hint({}: LargeMessageHint) not implemented ")}disconnect(){}onclose(){this.is_open=!1,this._zustand&&this._zustand.auto_progress()}async reconnect(){}async stop(){await this._communicationManager._send_cmd({cmd:"stop_worker",wait_for_response:!1});const t=this.onclose.bind(this);this.onclose=()=>{t(),this._zustand&&(this._zustand.worker===this&&this._zustand.clear_all(),this.onclose=t)}}async update_external_worker(t,n,r){return await this._communicationManager._send_cmd({cmd:"update_external_worker",kwargs:{worker_id:t,class_id:n,...r},wait_for_response:!0})}async export({withFiles:t=!1}){return await this._communicationManager._send_cmd({cmd:"export_worker",wait_for_response:!0,kwargs:{with_files:t}})}async update_from_export(t){const n=this._hookManager.add_hook("node_added",async({})=>{this._zustand?.center_all()});try{const r=await this._communicationManager._send_cmd({cmd:"update_from_export",kwargs:{data:t},wait_for_response:!0,response_timeout:6e5,unique:!0});return await new Promise(a=>{setTimeout(()=>{a()},1e3)}),await this._syncManager.stepwise_fullsync(),r}finally{n()}}_send_cmd(t){return this._communicationManager._send_cmd(t)}set_io_value(t){return this._nodeManager.set_io_value(t)}get_io_value(t){return this._nodeManager.get_io_value(t)}}function QB(e,t){return function(){return e.apply(t,arguments)}}const{toString:Boe}=Object.prototype,{getPrototypeOf:pO}=Object,{iterator:yC,toStringTag:KB}=Symbol,vC=(e=>t=>{const n=Boe.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ls=e=>(e=e.toLowerCase(),t=>vC(t)===e),bC=e=>t=>typeof t===e,{isArray:m0}=Array,J1=bC("undefined");function _x(e){return e!==null&&!J1(e)&&e.constructor!==null&&!J1(e.constructor)&&Aa(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const eL=ls("ArrayBuffer");function Loe(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&eL(e.buffer),t}const Poe=bC("string"),Aa=bC("function"),tL=bC("number"),Ax=e=>e!==null&&typeof e=="object",Hoe=e=>e===!0||e===!1,k2=e=>{if(vC(e)!=="object")return!1;const t=pO(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(KB in e)&&!(yC in e)},Voe=e=>{if(!Ax(e)||_x(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Foe=ls("Date"),Goe=ls("File"),Uoe=ls("Blob"),$oe=ls("FileList"),Xoe=e=>Ax(e)&&Aa(e.pipe),Yoe=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Aa(e.append)&&((t=vC(e))==="formdata"||t==="object"&&Aa(e.toString)&&e.toString()==="[object FormData]"))},Zoe=ls("URLSearchParams"),[Woe,qoe,Joe,Qoe]=["ReadableStream","Request","Response","Headers"].map(ls),Koe=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Tx(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),m0(e))for(r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else{if(_x(e))return;const l=n?Object.getOwnPropertyNames(e):Object.keys(e),u=l.length;let d;for(r=0;r<u;r++)d=l[r],t.call(null,e[d],d,e)}}function nL(e,t){if(_x(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,a;for(;r-- >0;)if(a=n[r],t===a.toLowerCase())return a;return null}const Op=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,rL=e=>!J1(e)&&e!==Op;function yR(){const{caseless:e}=rL(this)&&this||{},t={},n=(r,a)=>{const l=e&&nL(t,a)||a;k2(t[l])&&k2(r)?t[l]=yR(t[l],r):k2(r)?t[l]=yR({},r):m0(r)?t[l]=r.slice():t[l]=r};for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&Tx(arguments[r],n);return t}const eae=(e,t,n,{allOwnKeys:r}={})=>(Tx(t,(a,l)=>{n&&Aa(a)?e[l]=QB(a,n):e[l]=a},{allOwnKeys:r}),e),tae=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),nae=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},rae=(e,t,n,r)=>{let a,l,u;const d={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),l=a.length;l-- >0;)u=a[l],(!r||r(u,e,t))&&!d[u]&&(t[u]=e[u],d[u]=!0);e=n!==!1&&pO(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},oae=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},aae=e=>{if(!e)return null;if(m0(e))return e;let t=e.length;if(!tL(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},iae=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&pO(Uint8Array)),lae=(e,t)=>{const r=(e&&e[yC]).call(e);let a;for(;(a=r.next())&&!a.done;){const l=a.value;t.call(e,l[0],l[1])}},sae=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},uae=ls("HTMLFormElement"),cae=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),CI=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),fae=ls("RegExp"),oL=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Tx(n,(a,l)=>{let u;(u=t(a,l,e))!==!1&&(r[l]=u||a)}),Object.defineProperties(e,r)},dae=e=>{oL(e,(t,n)=>{if(Aa(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Aa(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},hae=(e,t)=>{const n={},r=a=>{a.forEach(l=>{n[l]=!0})};return m0(e)?r(e):r(String(e).split(t)),n},pae=()=>{},mae=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function gae(e){return!!(e&&Aa(e.append)&&e[KB]==="FormData"&&e[yC])}const yae=e=>{const t=new Array(10),n=(r,a)=>{if(Ax(r)){if(t.indexOf(r)>=0)return;if(_x(r))return r;if(!("toJSON"in r)){t[a]=r;const l=m0(r)?[]:{};return Tx(r,(u,d)=>{const h=n(u,a+1);!J1(h)&&(l[d]=h)}),t[a]=void 0,l}}return r};return n(e,0)},vae=ls("AsyncFunction"),bae=e=>e&&(Ax(e)||Aa(e))&&Aa(e.then)&&Aa(e.catch),aL=((e,t)=>e?setImmediate:t?((n,r)=>(Op.addEventListener("message",({source:a,data:l})=>{a===Op&&l===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Op.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Aa(Op.postMessage)),xae=typeof queueMicrotask<"u"?queueMicrotask.bind(Op):typeof process<"u"&&process.nextTick||aL,Sae=e=>e!=null&&Aa(e[yC]),Re={isArray:m0,isArrayBuffer:eL,isBuffer:_x,isFormData:Yoe,isArrayBufferView:Loe,isString:Poe,isNumber:tL,isBoolean:Hoe,isObject:Ax,isPlainObject:k2,isEmptyObject:Voe,isReadableStream:Woe,isRequest:qoe,isResponse:Joe,isHeaders:Qoe,isUndefined:J1,isDate:Foe,isFile:Goe,isBlob:Uoe,isRegExp:fae,isFunction:Aa,isStream:Xoe,isURLSearchParams:Zoe,isTypedArray:iae,isFileList:$oe,forEach:Tx,merge:yR,extend:eae,trim:Koe,stripBOM:tae,inherits:nae,toFlatObject:rae,kindOf:vC,kindOfTest:ls,endsWith:oae,toArray:aae,forEachEntry:lae,matchAll:sae,isHTMLForm:uae,hasOwnProperty:CI,hasOwnProp:CI,reduceDescriptors:oL,freezeMethods:dae,toObjectSet:hae,toCamelCase:cae,noop:pae,toFiniteNumber:mae,findKey:nL,global:Op,isContextDefined:rL,isSpecCompliantForm:gae,toJSONObject:yae,isAsyncFn:vae,isThenable:bae,setImmediate:aL,asap:xae,isIterable:Sae};function Ct(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}Re.inherits(Ct,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Re.toJSONObject(this.config),code:this.code,status:this.status}}});const iL=Ct.prototype,lL={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{lL[e]={value:e}});Object.defineProperties(Ct,lL);Object.defineProperty(iL,"isAxiosError",{value:!0});Ct.from=(e,t,n,r,a,l)=>{const u=Object.create(iL);return Re.toFlatObject(e,u,function(h){return h!==Error.prototype},d=>d!=="isAxiosError"),Ct.call(u,e.message,t,n,r,a),u.cause=e,u.name=e.name,l&&Object.assign(u,l),u};const wae=null;function vR(e){return Re.isPlainObject(e)||Re.isArray(e)}function sL(e){return Re.endsWith(e,"[]")?e.slice(0,-2):e}function _I(e,t,n){return e?e.concat(t).map(function(a,l){return a=sL(a),!n&&l?"["+a+"]":a}).join(n?".":""):t}function Eae(e){return Re.isArray(e)&&!e.some(vR)}const Cae=Re.toFlatObject(Re,{},null,function(t){return/^is[A-Z]/.test(t)});function xC(e,t,n){if(!Re.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=Re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,R){return!Re.isUndefined(R[E])});const r=n.metaTokens,a=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&Re.isSpecCompliantForm(t);if(!Re.isFunction(a))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(Re.isDate(A))return A.toISOString();if(Re.isBoolean(A))return A.toString();if(!h&&Re.isBlob(A))throw new Ct("Blob is not supported. Use a Buffer instead.");return Re.isArrayBuffer(A)||Re.isTypedArray(A)?h&&typeof Blob=="function"?new Blob([A]):Buffer.from(A):A}function y(A,E,R){let k=A;if(A&&!R&&typeof A=="object"){if(Re.endsWith(E,"{}"))E=r?E:E.slice(0,-2),A=JSON.stringify(A);else if(Re.isArray(A)&&Eae(A)||(Re.isFileList(A)||Re.endsWith(E,"[]"))&&(k=Re.toArray(A)))return E=sL(E),k.forEach(function(M,I){!(Re.isUndefined(M)||M===null)&&t.append(u===!0?_I([E],I,l):u===null?E:E+"[]",m(M))}),!1}return vR(A)?!0:(t.append(_I(R,E,l),m(A)),!1)}const v=[],S=Object.assign(Cae,{defaultVisitor:y,convertValue:m,isVisitable:vR});function w(A,E){if(!Re.isUndefined(A)){if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+E.join("."));v.push(A),Re.forEach(A,function(k,D){(!(Re.isUndefined(k)||k===null)&&a.call(t,k,Re.isString(D)?D.trim():D,E,S))===!0&&w(k,E?E.concat(D):[D])}),v.pop()}}if(!Re.isObject(e))throw new TypeError("data must be an object");return w(e),t}function AI(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function mO(e,t){this._pairs=[],e&&xC(e,this,t)}const uL=mO.prototype;uL.append=function(t,n){this._pairs.push([t,n])};uL.toString=function(t){const n=t?function(r){return t.call(this,r,AI)}:AI;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function _ae(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function cL(e,t,n){if(!t)return e;const r=n&&n.encode||_ae;Re.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let l;if(a?l=a(t,n):l=Re.isURLSearchParams(t)?t.toString():new mO(t,n).toString(r),l){const u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+l}return e}class TI{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Re.forEach(this.handlers,function(r){r!==null&&t(r)})}}const fL={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Aae=typeof URLSearchParams<"u"?URLSearchParams:mO,Tae=typeof FormData<"u"?FormData:null,Rae=typeof Blob<"u"?Blob:null,kae={isBrowser:!0,classes:{URLSearchParams:Aae,FormData:Tae,Blob:Rae},protocols:["http","https","file","blob","url","data"]},gO=typeof window<"u"&&typeof document<"u",bR=typeof navigator=="object"&&navigator||void 0,Oae=gO&&(!bR||["ReactNative","NativeScript","NS"].indexOf(bR.product)<0),Mae=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Nae=gO&&window.location.href||"http://localhost",Dae=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:gO,hasStandardBrowserEnv:Oae,hasStandardBrowserWebWorkerEnv:Mae,navigator:bR,origin:Nae},Symbol.toStringTag,{value:"Module"})),No={...Dae,...kae};function Iae(e,t){return xC(e,new No.classes.URLSearchParams,{visitor:function(n,r,a,l){return No.isNode&&Re.isBuffer(n)?(this.append(r,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...t})}function zae(e){return Re.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function jae(e){const t={},n=Object.keys(e);let r;const a=n.length;let l;for(r=0;r<a;r++)l=n[r],t[l]=e[l];return t}function dL(e){function t(n,r,a,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&Re.isArray(a)?a.length:u,h?(Re.hasOwnProp(a,u)?a[u]=[a[u],r]:a[u]=r,!d):((!a[u]||!Re.isObject(a[u]))&&(a[u]=[]),t(n,r,a[u],l)&&Re.isArray(a[u])&&(a[u]=jae(a[u])),!d)}if(Re.isFormData(e)&&Re.isFunction(e.entries)){const n={};return Re.forEachEntry(e,(r,a)=>{t(zae(r),a,n,0)}),n}return null}function Bae(e,t,n){if(Re.isString(e))try{return(t||JSON.parse)(e),Re.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Rx={transitional:fL,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,l=Re.isObject(t);if(l&&Re.isHTMLForm(t)&&(t=new FormData(t)),Re.isFormData(t))return a?JSON.stringify(dL(t)):t;if(Re.isArrayBuffer(t)||Re.isBuffer(t)||Re.isStream(t)||Re.isFile(t)||Re.isBlob(t)||Re.isReadableStream(t))return t;if(Re.isArrayBufferView(t))return t.buffer;if(Re.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let d;if(l){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Iae(t,this.formSerializer).toString();if((d=Re.isFileList(t))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return xC(d?{"files[]":t}:t,h&&new h,this.formSerializer)}}return l||a?(n.setContentType("application/json",!1),Bae(t)):t}],transformResponse:[function(t){const n=this.transitional||Rx.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(Re.isResponse(t)||Re.isReadableStream(t))return t;if(t&&Re.isString(t)&&(r&&!this.responseType||a)){const u=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t)}catch(d){if(u)throw d.name==="SyntaxError"?Ct.from(d,Ct.ERR_BAD_RESPONSE,this,null,this.response):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:No.classes.FormData,Blob:No.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Re.forEach(["delete","get","head","post","put","patch"],e=>{Rx.headers[e]={}});const Lae=Re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Pae=e=>{const t={};let n,r,a;return e&&e.split(`
|
|
1072
|
+
`,n);return}const a=n.substring(0,r+4),l=t.slice(r+4),u=a.split(";"),d={};if(u.forEach(v=>{const[S,w]=v.split("=");d[S.trim()]=w.trim()}),!d.chunk||!d.msgid){console.error("Header missing required fields chunk or msgid",d);return}const[h,m]=d.chunk.split("/"),y=d.msgid;if(h==="1"&&m==="1")return this.recieve_bytes(d,l);if(this.blobChunks[y]||(this.blobChunks[y]={chunks:Array.from({length:parseInt(m)},()=>null),timestamp:Date.now()}),this.blobChunks[y].chunks.length!==parseInt(m)){console.error("Total chunks mismatch");return}if(this.blobChunks[y].chunks[parseInt(h)-1]=t,this.blobChunks[y].chunks.every(v=>v!==null)){const v=new Uint8Array(this.blobChunks[y].chunks.reduce((S,w)=>S.concat(Array.from(w)),[]));this.recieve_bytes(d,v),delete this.blobChunks[y]}}catch(n){console.error("Websocketworker: onbytes error",n,t);return}}}class Ooe extends Kc{constructor(){super(...arguments),this._ns_event_intercepts=new Map}start(){}stop(){}async _receive_edge_added(t,n,r,a){this.context.worker._zustand&&this.context.worker._zustand.on_edge_action({type:"add",from_remote:!0,src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a})}async _receive_groups(t){this.context.worker._zustand&&this.context.worker._zustand.on_group_action({type:"set",groups:t})}async _receive_node_added(t){if(this.context.worker._zustand)return this.context.worker._zustand.on_node_action({type:"add",node:t,id:t.id,from_remote:!0})}async receive_workerevent({event:t,data:n}){switch(t){case"worker_error":return this.context.worker._zustand?this.context.worker._zustand.logger.error(n.error):void 0;case"update_worker_dependencies":return this.context.worker._zustand?this.context.worker._zustand.lib.libstate.getState().set({external_worker:n.worker_dependencies}):void 0;case"lib_update":await this.context.worker.getSyncManager().sync_lib();return;case"fullsync":await this.context.worker.getSyncManager().stepwise_fullsync();return;case"external_worker_update":await this.context.worker.getSyncManager().sync_lib(),await this.context.worker.getSyncManager().sync_external_worker();return;case"starting":this.hookManager.call_hooks("starting");return;case"stopping":this.hookManager.call_hooks("stopping");return;default:console.warn("Unhandled worker event",t,n);break}}async intercept_ns_event(t){let n=t;for(const r of this._ns_event_intercepts.get(t.event)||[])n=await r(n);return n}async receive_nodespace_event(t){const{event:n,data:r}=await this.intercept_ns_event(t);switch(n){case"after_set_value":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value:r.result}}},id:r.node,from_remote:!0}):void 0;case"after_update_value_options":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value_options:r.result}}},id:r.node,from_remote:!0}):void 0;case"triggerstart":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}):void 0;case"triggerdone":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0}):void 0;case"triggerfast":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}),setTimeout(()=>{this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0})},50);return;case"node_trigger_error":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"error",errortype:"trigger",error:r.error,id:r.node,tb:r.tb,from_remote:!0}):void 0;case"node_removed":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"delete",id:r.node,from_remote:!0}),this.hookManager.call_hooks("node_removed",{node:r.node});return;case"node_added":this._receive_node_added(r.node);return;case"after_disconnect":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_unforward":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_connect":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_forward":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_add_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"after_remove_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"progress":if(!this.context.worker._zustand)return;if(r.node)return this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,progress:r.info},id:r.node,from_remote:!0});console.warn("Unhandled nodepsace event",n,r);break;default:if(["after_set_nodespace"].includes(n))return;console.warn("Unhandled nodepsace event",n,r);break}}add_ns_event_intercept(t,n){const r=this._ns_event_intercepts.get(t)||[];return r.push(n),this._ns_event_intercepts.set(t,r),()=>{const l=this._ns_event_intercepts.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}}class Moe extends Kc{constructor(){super(...arguments),this._hooks=new Map}start(){}stop(){}add_hook(t,n){const r=this._hooks.get(t)||[];return r.push(n),this._hooks.set(t,r),()=>{const l=this._hooks.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}async call_hooks(t,n){const r=[];for(const a of this._hooks.get(t)||[]){const l=a({worker:this.context.worker,data:n});l instanceof Promise&&r.push(l)}await Promise.all(r)}}class Noe extends Kc{start(){}stop(){}async trigger_node(t){await this.communicationManager._send_cmd({cmd:"trigger_node",kwargs:{nid:t},wait_for_response:!1})}async add_node(t){const n=await this.communicationManager._send_cmd({cmd:"add_node",kwargs:{id:t}});return this.eventManager._receive_node_added(n)}async remove_node(t){await this.communicationManager._send_cmd({cmd:"remove_node",kwargs:{id:t}})}locally_update_node(t){this.syncManager.locally_update_node(t)}set_io_value({nid:t,ioid:n,value:r,set_default:a=!1}){return this.communicationManager._send_cmd({cmd:"set_io_value",kwargs:{nid:t,ioid:n,value:r,set_default:a},wait_for_response:!0})}set_io_value_options({nid:t,ioid:n,values:r,keys:a,nullable:l}){return this.communicationManager._send_cmd({cmd:"update_io_value_options",kwargs:{nid:t,ioid:n,options:{options:{type:"enum",values:r,keys:a,nullable:l}}}})}async get_io_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_value",kwargs:{nid:t,ioid:n},wait_for_response:!0});return this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{value:r}}},id:t,from_remote:!0}),r}async get_ios_values({nid:t}){const n=await this.communicationManager._send_cmd({cmd:"get_ios_values",kwargs:{nid:t},wait_for_response:!0});if(!this.context.worker._zustand)return n;const r={};for(const a in n)r[a]={value:n[a]};return this.context.worker._zustand.on_node_action({type:"update",node:{io:r},id:t,from_remote:!0}),n}async get_io_full_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_full_value",kwargs:{nid:t,ioid:n},wait_for_response:!0,as_bytes:!0}),{header:a,bytes:l}=r,{mime:u}=a,d=JB({data:l,mime:u||"application/octet-stream"});return this.context.worker._zustand?.on_node_action?.({type:"update",node:{id:t,io:{[n]:{fullvalue:d}}},id:t,from_remote:!0}),d}async update_io_options({nid:t,ioid:n,options:r}){const a=await this.communicationManager._send_cmd({cmd:"update_io_options",kwargs:{nid:t,ioid:n,...r},wait_for_response:!0});if(!this.context.worker._zustand)return a;this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{...r}}},id:t,from_remote:!0})}async get_node_status(t){return await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0})}async get_remote_node_state(t){const n=await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0});this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:n,id:n.id,from_remote:!0})}}class Doe extends Kc{start(){}stop(){}add_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l=!1}){return this.communicationManager._send_cmd({cmd:"add_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l}})}remove_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}){return this.communicationManager._send_cmd({cmd:"remove_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}})}}class Ioe extends Kc{start(){}stop(){}async group_nodes(t,n){const r=await this.communicationManager._send_cmd({cmd:"group_nodes",kwargs:{node_ids:t,group_ids:n},wait_for_response:!0});return this.eventManager._receive_groups(r),r}async remove_group(t){await this.communicationManager._send_cmd({cmd:"remove_group",kwargs:{gid:t},wait_for_response:!0}),await this.syncManager.sync_nodespace()}locally_update_group(t){this.syncManager.locally_update_group(t)}}class zoe extends Kc{start(){}stop(){}async add_external_worker({module:t,cls_module:n,cls_name:r}){return await this.communicationManager._send_cmd({cmd:"add_external_worker",kwargs:{module:t,cls_module:n,cls_name:r}})}async add_lib(t,n){return await this.communicationManager._send_cmd({cmd:"add_package_dependency",kwargs:{name:t,version:n},wait_for_response:!1})}async remove_lib(t){return await this.communicationManager._send_cmd({cmd:"remove_package_dependency",kwargs:{name:t},wait_for_response:!1})}async get_available_modules(){return await this.communicationManager._send_cmd({cmd:"get_available_modules",wait_for_response:!0,unique:!0})}async remove_external_worker(t,n){return await this.communicationManager._send_cmd({cmd:"remove_external_worker",kwargs:{worker_id:t,class_id:n},wait_for_response:!0})}}class joe{getEventManager(){return this._eventManager}getSyncManager(){return this._syncManager}getCommunicationManager(){return this._communicationManager}getConnectionHealthManager(){return this._connectionhealthManager}getHookManager(){return this._hookManager}getNodeManager(){return this._nodeManager}getEdgeManager(){return this._edgeManager}getGroupManager(){return this._groupManager}getLibraryManager(){return this._libraryManager}constructor(t){this.uuid=t.uuid,this.on_error=t.on_error||(r=>{this._zustand?.logger.error(r)}),this.state=fl((r,a)=>({is_open:!1}));const n={worker:this};this._connectionhealthManager=new Aoe(n),this._communicationManager=new koe(n),this._eventManager=new Ooe({...n}),this._syncManager=new Toe({...n,on_sync_complete:t.on_sync_complete}),this._hookManager=new Moe(n),this._nodeManager=new Noe(n),this._edgeManager=new Doe(n),this._groupManager=new Ioe(n),this._libraryManager=new zoe(n),this._communicationManager.start(),this._connectionhealthManager.start(),this._syncManager.start(),this._eventManager.start(),this._hookManager.start(),this._nodeManager.start(),this._edgeManager.start(),this._groupManager.start(),this._libraryManager.start(),t.zustand&&this.set_zustand(t.zustand),this.api={node:this._nodeManager,group:this._groupManager,edge:this._edgeManager,hooks:this._hookManager,lib:this._libraryManager}}set_zustand(t){t!==this._zustand&&(t.logger.debug("Setting zustand for worker"),this._zustand=t,t.set_worker(this),this._zustand.auto_progress(),this._syncManager.stepwise_fullsync())}get is_open(){return this.state.getState().is_open}set is_open(t){this.state.setState({is_open:t})}get is_responsive(){return this._connectionhealthManager.isResponsive()}clear(){return this._communicationManager._send_cmd({cmd:"clear",unique:!0})}save(){return this._communicationManager._send_cmd({cmd:"save",wait_for_response:!0,unique:!0})}load(t){return this._communicationManager._send_cmd({cmd:"load_data",kwargs:{data:t},wait_for_response:!0}).then(()=>{this._syncManager.stepwise_fullsync()})}async get_runstate(){return await this._communicationManager._send_cmd({cmd:"get_runstate",wait_for_response:!0,unique:!0})}async send(t){throw new Error("async send(data: any) not implemented")}async upload_file(t){throw new Error("upload_file not implemented ")}async handle_large_message_hint({}){throw new Error("async handle_large_message_hint({}: LargeMessageHint) not implemented ")}disconnect(){}onclose(){this.is_open=!1,this._zustand&&this._zustand.auto_progress()}async reconnect(){}async stop(){await this._communicationManager._send_cmd({cmd:"stop_worker",wait_for_response:!1});const t=this.onclose.bind(this);this.onclose=()=>{t(),this._zustand&&(this._zustand.worker===this&&this._zustand.clear_all(),this.onclose=t)}}async update_external_worker(t,n,r){return await this._communicationManager._send_cmd({cmd:"update_external_worker",kwargs:{worker_id:t,class_id:n,...r},wait_for_response:!0})}async export({withFiles:t=!1}){return await this._communicationManager._send_cmd({cmd:"export_worker",wait_for_response:!0,kwargs:{with_files:t}})}async update_from_export(t){const n=this._hookManager.add_hook("node_added",async({})=>{this._zustand?.center_all()});try{const r=await this._communicationManager._send_cmd({cmd:"update_from_export",kwargs:{data:t},wait_for_response:!0,response_timeout:6e5,unique:!0});return await new Promise(a=>{setTimeout(()=>{a()},1e3)}),await this._syncManager.stepwise_fullsync(),r}finally{n()}}_send_cmd(t){return this._communicationManager._send_cmd(t)}set_io_value(t){return this._nodeManager.set_io_value(t)}get_io_value(t){return this._nodeManager.get_io_value(t)}}function QB(e,t){return function(){return e.apply(t,arguments)}}const{toString:Boe}=Object.prototype,{getPrototypeOf:pO}=Object,{iterator:yC,toStringTag:KB}=Symbol,vC=(e=>t=>{const n=Boe.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ls=e=>(e=e.toLowerCase(),t=>vC(t)===e),bC=e=>t=>typeof t===e,{isArray:m0}=Array,J1=bC("undefined");function _x(e){return e!==null&&!J1(e)&&e.constructor!==null&&!J1(e.constructor)&&Aa(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const eL=ls("ArrayBuffer");function Loe(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&eL(e.buffer),t}const Poe=bC("string"),Aa=bC("function"),tL=bC("number"),Ax=e=>e!==null&&typeof e=="object",Hoe=e=>e===!0||e===!1,k2=e=>{if(vC(e)!=="object")return!1;const t=pO(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(KB in e)&&!(yC in e)},Voe=e=>{if(!Ax(e)||_x(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Foe=ls("Date"),Goe=ls("File"),Uoe=ls("Blob"),$oe=ls("FileList"),Xoe=e=>Ax(e)&&Aa(e.pipe),Yoe=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Aa(e.append)&&((t=vC(e))==="formdata"||t==="object"&&Aa(e.toString)&&e.toString()==="[object FormData]"))},Zoe=ls("URLSearchParams"),[Woe,qoe,Joe,Qoe]=["ReadableStream","Request","Response","Headers"].map(ls),Koe=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Tx(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),m0(e))for(r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else{if(_x(e))return;const l=n?Object.getOwnPropertyNames(e):Object.keys(e),u=l.length;let d;for(r=0;r<u;r++)d=l[r],t.call(null,e[d],d,e)}}function nL(e,t){if(_x(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,a;for(;r-- >0;)if(a=n[r],t===a.toLowerCase())return a;return null}const Op=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,rL=e=>!J1(e)&&e!==Op;function yR(){const{caseless:e}=rL(this)&&this||{},t={},n=(r,a)=>{const l=e&&nL(t,a)||a;k2(t[l])&&k2(r)?t[l]=yR(t[l],r):k2(r)?t[l]=yR({},r):m0(r)?t[l]=r.slice():t[l]=r};for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&Tx(arguments[r],n);return t}const eae=(e,t,n,{allOwnKeys:r}={})=>(Tx(t,(a,l)=>{n&&Aa(a)?e[l]=QB(a,n):e[l]=a},{allOwnKeys:r}),e),tae=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),nae=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},rae=(e,t,n,r)=>{let a,l,u;const d={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),l=a.length;l-- >0;)u=a[l],(!r||r(u,e,t))&&!d[u]&&(t[u]=e[u],d[u]=!0);e=n!==!1&&pO(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},oae=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},aae=e=>{if(!e)return null;if(m0(e))return e;let t=e.length;if(!tL(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},iae=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&pO(Uint8Array)),lae=(e,t)=>{const r=(e&&e[yC]).call(e);let a;for(;(a=r.next())&&!a.done;){const l=a.value;t.call(e,l[0],l[1])}},sae=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},uae=ls("HTMLFormElement"),cae=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),CI=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),fae=ls("RegExp"),oL=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Tx(n,(a,l)=>{let u;(u=t(a,l,e))!==!1&&(r[l]=u||a)}),Object.defineProperties(e,r)},dae=e=>{oL(e,(t,n)=>{if(Aa(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Aa(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},hae=(e,t)=>{const n={},r=a=>{a.forEach(l=>{n[l]=!0})};return m0(e)?r(e):r(String(e).split(t)),n},pae=()=>{},mae=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function gae(e){return!!(e&&Aa(e.append)&&e[KB]==="FormData"&&e[yC])}const yae=e=>{const t=new Array(10),n=(r,a)=>{if(Ax(r)){if(t.indexOf(r)>=0)return;if(_x(r))return r;if(!("toJSON"in r)){t[a]=r;const l=m0(r)?[]:{};return Tx(r,(u,d)=>{const h=n(u,a+1);!J1(h)&&(l[d]=h)}),t[a]=void 0,l}}return r};return n(e,0)},vae=ls("AsyncFunction"),bae=e=>e&&(Ax(e)||Aa(e))&&Aa(e.then)&&Aa(e.catch),aL=((e,t)=>e?setImmediate:t?((n,r)=>(Op.addEventListener("message",({source:a,data:l})=>{a===Op&&l===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Op.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Aa(Op.postMessage)),xae=typeof queueMicrotask<"u"?queueMicrotask.bind(Op):typeof process<"u"&&process.nextTick||aL,Sae=e=>e!=null&&Aa(e[yC]),Re={isArray:m0,isArrayBuffer:eL,isBuffer:_x,isFormData:Yoe,isArrayBufferView:Loe,isString:Poe,isNumber:tL,isBoolean:Hoe,isObject:Ax,isPlainObject:k2,isEmptyObject:Voe,isReadableStream:Woe,isRequest:qoe,isResponse:Joe,isHeaders:Qoe,isUndefined:J1,isDate:Foe,isFile:Goe,isBlob:Uoe,isRegExp:fae,isFunction:Aa,isStream:Xoe,isURLSearchParams:Zoe,isTypedArray:iae,isFileList:$oe,forEach:Tx,merge:yR,extend:eae,trim:Koe,stripBOM:tae,inherits:nae,toFlatObject:rae,kindOf:vC,kindOfTest:ls,endsWith:oae,toArray:aae,forEachEntry:lae,matchAll:sae,isHTMLForm:uae,hasOwnProperty:CI,hasOwnProp:CI,reduceDescriptors:oL,freezeMethods:dae,toObjectSet:hae,toCamelCase:cae,noop:pae,toFiniteNumber:mae,findKey:nL,global:Op,isContextDefined:rL,isSpecCompliantForm:gae,toJSONObject:yae,isAsyncFn:vae,isThenable:bae,setImmediate:aL,asap:xae,isIterable:Sae};function Ct(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}Re.inherits(Ct,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Re.toJSONObject(this.config),code:this.code,status:this.status}}});const iL=Ct.prototype,lL={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{lL[e]={value:e}});Object.defineProperties(Ct,lL);Object.defineProperty(iL,"isAxiosError",{value:!0});Ct.from=(e,t,n,r,a,l)=>{const u=Object.create(iL);return Re.toFlatObject(e,u,function(h){return h!==Error.prototype},d=>d!=="isAxiosError"),Ct.call(u,e.message,t,n,r,a),u.cause=e,u.name=e.name,l&&Object.assign(u,l),u};const wae=null;function vR(e){return Re.isPlainObject(e)||Re.isArray(e)}function sL(e){return Re.endsWith(e,"[]")?e.slice(0,-2):e}function _I(e,t,n){return e?e.concat(t).map(function(a,l){return a=sL(a),!n&&l?"["+a+"]":a}).join(n?".":""):t}function Eae(e){return Re.isArray(e)&&!e.some(vR)}const Cae=Re.toFlatObject(Re,{},null,function(t){return/^is[A-Z]/.test(t)});function xC(e,t,n){if(!Re.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=Re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,R){return!Re.isUndefined(R[E])});const r=n.metaTokens,a=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&Re.isSpecCompliantForm(t);if(!Re.isFunction(a))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(Re.isDate(A))return A.toISOString();if(Re.isBoolean(A))return A.toString();if(!h&&Re.isBlob(A))throw new Ct("Blob is not supported. Use a Buffer instead.");return Re.isArrayBuffer(A)||Re.isTypedArray(A)?h&&typeof Blob=="function"?new Blob([A]):Buffer.from(A):A}function y(A,E,R){let k=A;if(A&&!R&&typeof A=="object"){if(Re.endsWith(E,"{}"))E=r?E:E.slice(0,-2),A=JSON.stringify(A);else if(Re.isArray(A)&&Eae(A)||(Re.isFileList(A)||Re.endsWith(E,"[]"))&&(k=Re.toArray(A)))return E=sL(E),k.forEach(function(M,I){!(Re.isUndefined(M)||M===null)&&t.append(u===!0?_I([E],I,l):u===null?E:E+"[]",m(M))}),!1}return vR(A)?!0:(t.append(_I(R,E,l),m(A)),!1)}const v=[],S=Object.assign(Cae,{defaultVisitor:y,convertValue:m,isVisitable:vR});function w(A,E){if(!Re.isUndefined(A)){if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+E.join("."));v.push(A),Re.forEach(A,function(k,D){(!(Re.isUndefined(k)||k===null)&&a.call(t,k,Re.isString(D)?D.trim():D,E,S))===!0&&w(k,E?E.concat(D):[D])}),v.pop()}}if(!Re.isObject(e))throw new TypeError("data must be an object");return w(e),t}function AI(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function mO(e,t){this._pairs=[],e&&xC(e,this,t)}const uL=mO.prototype;uL.append=function(t,n){this._pairs.push([t,n])};uL.toString=function(t){const n=t?function(r){return t.call(this,r,AI)}:AI;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function _ae(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function cL(e,t,n){if(!t)return e;const r=n&&n.encode||_ae;Re.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let l;if(a?l=a(t,n):l=Re.isURLSearchParams(t)?t.toString():new mO(t,n).toString(r),l){const u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+l}return e}class TI{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Re.forEach(this.handlers,function(r){r!==null&&t(r)})}}const fL={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Aae=typeof URLSearchParams<"u"?URLSearchParams:mO,Tae=typeof FormData<"u"?FormData:null,Rae=typeof Blob<"u"?Blob:null,kae={isBrowser:!0,classes:{URLSearchParams:Aae,FormData:Tae,Blob:Rae},protocols:["http","https","file","blob","url","data"]},gO=typeof window<"u"&&typeof document<"u",bR=typeof navigator=="object"&&navigator||void 0,Oae=gO&&(!bR||["ReactNative","NativeScript","NS"].indexOf(bR.product)<0),Mae=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Nae=gO&&window.location.href||"http://localhost",Dae=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:gO,hasStandardBrowserEnv:Oae,hasStandardBrowserWebWorkerEnv:Mae,navigator:bR,origin:Nae},Symbol.toStringTag,{value:"Module"})),No={...Dae,...kae};function Iae(e,t){return xC(e,new No.classes.URLSearchParams,{visitor:function(n,r,a,l){return No.isNode&&Re.isBuffer(n)?(this.append(r,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...t})}function zae(e){return Re.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function jae(e){const t={},n=Object.keys(e);let r;const a=n.length;let l;for(r=0;r<a;r++)l=n[r],t[l]=e[l];return t}function dL(e){function t(n,r,a,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&Re.isArray(a)?a.length:u,h?(Re.hasOwnProp(a,u)?a[u]=[a[u],r]:a[u]=r,!d):((!a[u]||!Re.isObject(a[u]))&&(a[u]=[]),t(n,r,a[u],l)&&Re.isArray(a[u])&&(a[u]=jae(a[u])),!d)}if(Re.isFormData(e)&&Re.isFunction(e.entries)){const n={};return Re.forEachEntry(e,(r,a)=>{t(zae(r),a,n,0)}),n}return null}function Bae(e,t,n){if(Re.isString(e))try{return(t||JSON.parse)(e),Re.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Rx={transitional:fL,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,l=Re.isObject(t);if(l&&Re.isHTMLForm(t)&&(t=new FormData(t)),Re.isFormData(t))return a?JSON.stringify(dL(t)):t;if(Re.isArrayBuffer(t)||Re.isBuffer(t)||Re.isStream(t)||Re.isFile(t)||Re.isBlob(t)||Re.isReadableStream(t))return t;if(Re.isArrayBufferView(t))return t.buffer;if(Re.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let d;if(l){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Iae(t,this.formSerializer).toString();if((d=Re.isFileList(t))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return xC(d?{"files[]":t}:t,h&&new h,this.formSerializer)}}return l||a?(n.setContentType("application/json",!1),Bae(t)):t}],transformResponse:[function(t){const n=this.transitional||Rx.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(Re.isResponse(t)||Re.isReadableStream(t))return t;if(t&&Re.isString(t)&&(r&&!this.responseType||a)){const u=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t)}catch(d){if(u)throw d.name==="SyntaxError"?Ct.from(d,Ct.ERR_BAD_RESPONSE,this,null,this.response):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:No.classes.FormData,Blob:No.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Re.forEach(["delete","get","head","post","put","patch"],e=>{Rx.headers[e]={}});const Lae=Re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Pae=e=>{const t={};let n,r,a;return e&&e.split(`
|
|
1073
1073
|
`).forEach(function(u){a=u.indexOf(":"),n=u.substring(0,a).trim().toLowerCase(),r=u.substring(a+1).trim(),!(!n||t[n]&&Lae[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},RI=Symbol("internals");function p1(e){return e&&String(e).trim().toLowerCase()}function O2(e){return e===!1||e==null?e:Re.isArray(e)?e.map(O2):String(e)}function Hae(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Vae=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function nT(e,t,n,r,a){if(Re.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!Re.isString(t)){if(Re.isString(r))return t.indexOf(r)!==-1;if(Re.isRegExp(r))return r.test(t)}}function Fae(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Gae(e,t){const n=Re.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,l,u){return this[r].call(this,t,a,l,u)},configurable:!0})})}let Ta=class{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function l(d,h,m){const y=p1(h);if(!y)throw new Error("header name must be a non-empty string");const v=Re.findKey(a,y);(!v||a[v]===void 0||m===!0||m===void 0&&a[v]!==!1)&&(a[v||h]=O2(d))}const u=(d,h)=>Re.forEach(d,(m,y)=>l(m,y,h));if(Re.isPlainObject(t)||t instanceof this.constructor)u(t,n);else if(Re.isString(t)&&(t=t.trim())&&!Vae(t))u(Pae(t),n);else if(Re.isObject(t)&&Re.isIterable(t)){let d={},h,m;for(const y of t){if(!Re.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[m=y[0]]=(h=d[m])?Re.isArray(h)?[...h,y[1]]:[h,y[1]]:y[1]}u(d,n)}else t!=null&&l(n,t,r);return this}get(t,n){if(t=p1(t),t){const r=Re.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return Hae(a);if(Re.isFunction(n))return n.call(this,a,r);if(Re.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=p1(t),t){const r=Re.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||nT(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function l(u){if(u=p1(u),u){const d=Re.findKey(r,u);d&&(!n||nT(r,r[d],d,n))&&(delete r[d],a=!0)}}return Re.isArray(t)?t.forEach(l):l(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const l=n[r];(!t||nT(this,this[l],l,t,!0))&&(delete this[l],a=!0)}return a}normalize(t){const n=this,r={};return Re.forEach(this,(a,l)=>{const u=Re.findKey(r,l);if(u){n[u]=O2(a),delete n[l];return}const d=t?Fae(l):String(l).trim();d!==l&&delete n[l],n[d]=O2(a),r[d]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return Re.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&Re.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
1074
1074
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[RI]=this[RI]={accessors:{}}).accessors,a=this.prototype;function l(u){const d=p1(u);r[d]||(Gae(a,u),r[d]=!0)}return Re.isArray(t)?t.forEach(l):l(t),this}};Ta.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Re.reduceDescriptors(Ta.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Re.freezeMethods(Ta);function rT(e,t){const n=this||Rx,r=t||n,a=Ta.from(r.headers);let l=r.data;return Re.forEach(e,function(d){l=d.call(n,l,a.normalize(),t?t.status:void 0)}),a.normalize(),l}function hL(e){return!!(e&&e.__CANCEL__)}function g0(e,t,n){Ct.call(this,e??"canceled",Ct.ERR_CANCELED,t,n),this.name="CanceledError"}Re.inherits(g0,Ct,{__CANCEL__:!0});function pL(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ct("Request failed with status code "+n.status,[Ct.ERR_BAD_REQUEST,Ct.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Uae(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function $ae(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,l=0,u;return t=t!==void 0?t:1e3,function(h){const m=Date.now(),y=r[l];u||(u=m),n[a]=h,r[a]=m;let v=l,S=0;for(;v!==a;)S+=n[v++],v=v%e;if(a=(a+1)%e,a===l&&(l=(l+1)%e),m-u<t)return;const w=y&&m-y;return w?Math.round(S*1e3/w):void 0}}function Xae(e,t){let n=0,r=1e3/t,a,l;const u=(m,y=Date.now())=>{n=y,a=null,l&&(clearTimeout(l),l=null),e(...m)};return[(...m)=>{const y=Date.now(),v=y-n;v>=r?u(m,y):(a=m,l||(l=setTimeout(()=>{l=null,u(a)},r-v)))},()=>a&&u(a)]}const iE=(e,t,n=3)=>{let r=0;const a=$ae(50,250);return Xae(l=>{const u=l.loaded,d=l.lengthComputable?l.total:void 0,h=u-r,m=a(h),y=u<=d;r=u;const v={loaded:u,total:d,progress:d?u/d:void 0,bytes:h,rate:m||void 0,estimated:m&&d&&y?(d-u)/m:void 0,event:l,lengthComputable:d!=null,[t?"download":"upload"]:!0};e(v)},n)},kI=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},OI=e=>(...t)=>Re.asap(()=>e(...t)),Yae=No.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,No.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(No.origin),No.navigator&&/(msie|trident)/i.test(No.navigator.userAgent)):()=>!0,Zae=No.hasStandardBrowserEnv?{write(e,t,n,r,a,l){const u=[e+"="+encodeURIComponent(t)];Re.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),Re.isString(r)&&u.push("path="+r),Re.isString(a)&&u.push("domain="+a),l===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Wae(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function qae(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function mL(e,t,n){let r=!Wae(t);return e&&(r||n==!1)?qae(e,t):t}const MI=e=>e instanceof Ta?{...e}:e;function Fp(e,t){t=t||{};const n={};function r(m,y,v,S){return Re.isPlainObject(m)&&Re.isPlainObject(y)?Re.merge.call({caseless:S},m,y):Re.isPlainObject(y)?Re.merge({},y):Re.isArray(y)?y.slice():y}function a(m,y,v,S){if(Re.isUndefined(y)){if(!Re.isUndefined(m))return r(void 0,m,v,S)}else return r(m,y,v,S)}function l(m,y){if(!Re.isUndefined(y))return r(void 0,y)}function u(m,y){if(Re.isUndefined(y)){if(!Re.isUndefined(m))return r(void 0,m)}else return r(void 0,y)}function d(m,y,v){if(v in t)return r(m,y);if(v in e)return r(void 0,m)}const h={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d,headers:(m,y,v)=>a(MI(m),MI(y),v,!0)};return Re.forEach(Object.keys({...e,...t}),function(y){const v=h[y]||a,S=v(e[y],t[y],y);Re.isUndefined(S)&&v!==d||(n[y]=S)}),n}const gL=e=>{const t=Fp({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:l,headers:u,auth:d}=t;t.headers=u=Ta.from(u),t.url=cL(mL(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),d&&u.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let h;if(Re.isFormData(n)){if(No.hasStandardBrowserEnv||No.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((h=u.getContentType())!==!1){const[m,...y]=h?h.split(";").map(v=>v.trim()).filter(Boolean):[];u.setContentType([m||"multipart/form-data",...y].join("; "))}}if(No.hasStandardBrowserEnv&&(r&&Re.isFunction(r)&&(r=r(t)),r||r!==!1&&Yae(t.url))){const m=a&&l&&Zae.read(l);m&&u.set(a,m)}return t},Jae=typeof XMLHttpRequest<"u",Qae=Jae&&function(e){return new Promise(function(n,r){const a=gL(e);let l=a.data;const u=Ta.from(a.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:m}=a,y,v,S,w,A;function E(){w&&w(),A&&A(),a.cancelToken&&a.cancelToken.unsubscribe(y),a.signal&&a.signal.removeEventListener("abort",y)}let R=new XMLHttpRequest;R.open(a.method.toUpperCase(),a.url,!0),R.timeout=a.timeout;function k(){if(!R)return;const M=Ta.from("getAllResponseHeaders"in R&&R.getAllResponseHeaders()),L={data:!d||d==="text"||d==="json"?R.responseText:R.response,status:R.status,statusText:R.statusText,headers:M,config:e,request:R};pL(function(G){n(G),E()},function(G){r(G),E()},L),R=null}"onloadend"in R?R.onloadend=k:R.onreadystatechange=function(){!R||R.readyState!==4||R.status===0&&!(R.responseURL&&R.responseURL.indexOf("file:")===0)||setTimeout(k)},R.onabort=function(){R&&(r(new Ct("Request aborted",Ct.ECONNABORTED,e,R)),R=null)},R.onerror=function(){r(new Ct("Network Error",Ct.ERR_NETWORK,e,R)),R=null},R.ontimeout=function(){let I=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const L=a.transitional||fL;a.timeoutErrorMessage&&(I=a.timeoutErrorMessage),r(new Ct(I,L.clarifyTimeoutError?Ct.ETIMEDOUT:Ct.ECONNABORTED,e,R)),R=null},l===void 0&&u.setContentType(null),"setRequestHeader"in R&&Re.forEach(u.toJSON(),function(I,L){R.setRequestHeader(L,I)}),Re.isUndefined(a.withCredentials)||(R.withCredentials=!!a.withCredentials),d&&d!=="json"&&(R.responseType=a.responseType),m&&([S,A]=iE(m,!0),R.addEventListener("progress",S)),h&&R.upload&&([v,w]=iE(h),R.upload.addEventListener("progress",v),R.upload.addEventListener("loadend",w)),(a.cancelToken||a.signal)&&(y=M=>{R&&(r(!M||M.type?new g0(null,e,R):M),R.abort(),R=null)},a.cancelToken&&a.cancelToken.subscribe(y),a.signal&&(a.signal.aborted?y():a.signal.addEventListener("abort",y)));const D=Uae(a.url);if(D&&No.protocols.indexOf(D)===-1){r(new Ct("Unsupported protocol "+D+":",Ct.ERR_BAD_REQUEST,e));return}R.send(l||null)})},Kae=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const l=function(m){if(!a){a=!0,d();const y=m instanceof Error?m:this.reason;r.abort(y instanceof Ct?y:new g0(y instanceof Error?y.message:y))}};let u=t&&setTimeout(()=>{u=null,l(new Ct(`timeout ${t} of ms exceeded`,Ct.ETIMEDOUT))},t);const d=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(m=>{m.unsubscribe?m.unsubscribe(l):m.removeEventListener("abort",l)}),e=null)};e.forEach(m=>m.addEventListener("abort",l));const{signal:h}=r;return h.unsubscribe=()=>Re.asap(d),h}},eie=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,a;for(;r<n;)a=r+t,yield e.slice(r,a),r=a},tie=async function*(e,t){for await(const n of nie(e))yield*eie(n,t)},nie=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},NI=(e,t,n,r)=>{const a=tie(e,t);let l=0,u,d=h=>{u||(u=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:m,value:y}=await a.next();if(m){d(),h.close();return}let v=y.byteLength;if(n){let S=l+=v;n(S)}h.enqueue(new Uint8Array(y))}catch(m){throw d(m),m}},cancel(h){return d(h),a.return()}},{highWaterMark:2})},SC=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",yL=SC&&typeof ReadableStream=="function",rie=SC&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),vL=(e,...t)=>{try{return!!e(...t)}catch{return!1}},oie=yL&&vL(()=>{let e=!1;const t=new Request(No.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),DI=64*1024,xR=yL&&vL(()=>Re.isReadableStream(new Response("").body)),lE={stream:xR&&(e=>e.body)};SC&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!lE[t]&&(lE[t]=Re.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Ct(`Response type '${t}' is not supported`,Ct.ERR_NOT_SUPPORT,r)})})})(new Response);const aie=async e=>{if(e==null)return 0;if(Re.isBlob(e))return e.size;if(Re.isSpecCompliantForm(e))return(await new Request(No.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Re.isArrayBufferView(e)||Re.isArrayBuffer(e))return e.byteLength;if(Re.isURLSearchParams(e)&&(e=e+""),Re.isString(e))return(await rie(e)).byteLength},iie=async(e,t)=>{const n=Re.toFiniteNumber(e.getContentLength());return n??aie(t)},lie=SC&&(async e=>{let{url:t,method:n,data:r,signal:a,cancelToken:l,timeout:u,onDownloadProgress:d,onUploadProgress:h,responseType:m,headers:y,withCredentials:v="same-origin",fetchOptions:S}=gL(e);m=m?(m+"").toLowerCase():"text";let w=Kae([a,l&&l.toAbortSignal()],u),A;const E=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let R;try{if(h&&oie&&n!=="get"&&n!=="head"&&(R=await iie(y,r))!==0){let L=new Request(t,{method:"POST",body:r,duplex:"half"}),P;if(Re.isFormData(r)&&(P=L.headers.get("content-type"))&&y.setContentType(P),L.body){const[G,$]=kI(R,iE(OI(h)));r=NI(L.body,DI,G,$)}}Re.isString(v)||(v=v?"include":"omit");const k="credentials"in Request.prototype;A=new Request(t,{...S,signal:w,method:n.toUpperCase(),headers:y.normalize().toJSON(),body:r,duplex:"half",credentials:k?v:void 0});let D=await fetch(A,S);const M=xR&&(m==="stream"||m==="response");if(xR&&(d||M&&E)){const L={};["status","statusText","headers"].forEach(Z=>{L[Z]=D[Z]});const P=Re.toFiniteNumber(D.headers.get("content-length")),[G,$]=d&&kI(P,iE(OI(d),!0))||[];D=new Response(NI(D.body,DI,G,()=>{$&&$(),E&&E()}),L)}m=m||"text";let I=await lE[Re.findKey(lE,m)||"text"](D,e);return!M&&E&&E(),await new Promise((L,P)=>{pL(L,P,{data:I,headers:Ta.from(D.headers),status:D.status,statusText:D.statusText,config:e,request:A})})}catch(k){throw E&&E(),k&&k.name==="TypeError"&&/Load failed|fetch/i.test(k.message)?Object.assign(new Ct("Network Error",Ct.ERR_NETWORK,e,A),{cause:k.cause||k}):Ct.from(k,k&&k.code,e,A)}}),SR={http:wae,xhr:Qae,fetch:lie};Re.forEach(SR,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const II=e=>`- ${e}`,sie=e=>Re.isFunction(e)||e===null||e===!1,bL={getAdapter:e=>{e=Re.isArray(e)?e:[e];const{length:t}=e;let n,r;const a={};for(let l=0;l<t;l++){n=e[l];let u;if(r=n,!sie(n)&&(r=SR[(u=String(n)).toLowerCase()],r===void 0))throw new Ct(`Unknown adapter '${u}'`);if(r)break;a[u||"#"+l]=r}if(!r){const l=Object.entries(a).map(([d,h])=>`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let u=t?l.length>1?`since :
|
|
1075
1075
|
`+l.map(II).join(`
|
|
1076
1076
|
`):" "+II(l[0]):"as no adapter specified";throw new Ct("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return r},adapters:SR};function oT(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new g0(null,e)}function zI(e){return oT(e),e.headers=Ta.from(e.headers),e.data=rT.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),bL.getAdapter(e.adapter||Rx.adapter)(e).then(function(r){return oT(e),r.data=rT.call(e,e.transformResponse,r),r.headers=Ta.from(r.headers),r},function(r){return hL(r)||(oT(e),r&&r.response&&(r.response.data=rT.call(e,e.transformResponse,r.response),r.response.headers=Ta.from(r.response.headers))),Promise.reject(r)})}const xL="1.11.0",wC={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wC[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const jI={};wC.transitional=function(t,n,r){function a(l,u){return"[Axios v"+xL+"] Transitional option '"+l+"'"+u+(r?". "+r:"")}return(l,u,d)=>{if(t===!1)throw new Ct(a(u," has been removed"+(n?" in "+n:"")),Ct.ERR_DEPRECATED);return n&&!jI[u]&&(jI[u]=!0,console.warn(a(u," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(l,u,d):!0}};wC.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function uie(e,t,n){if(typeof e!="object")throw new Ct("options must be an object",Ct.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const l=r[a],u=t[l];if(u){const d=e[l],h=d===void 0||u(d,l,e);if(h!==!0)throw new Ct("option "+l+" must be "+h,Ct.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ct("Unknown option "+l,Ct.ERR_BAD_OPTION)}}const M2={assertOptions:uie,validators:wC},tu=M2.validators;let Dp=class{constructor(t){this.defaults=t||{},this.interceptors={request:new TI,response:new TI}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const l=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?l&&!String(r.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
1077
|
-
`+l):r.stack=l}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Fp(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:l}=n;r!==void 0&&M2.assertOptions(r,{silentJSONParsing:tu.transitional(tu.boolean),forcedJSONParsing:tu.transitional(tu.boolean),clarifyTimeoutError:tu.transitional(tu.boolean)},!1),a!=null&&(Re.isFunction(a)?n.paramsSerializer={serialize:a}:M2.assertOptions(a,{encode:tu.function,serialize:tu.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),M2.assertOptions(n,{baseUrl:tu.spelling("baseURL"),withXsrfToken:tu.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&Re.merge(l.common,l[n.method]);l&&Re.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),n.headers=Ta.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(n)===!1||(h=h&&E.synchronous,d.unshift(E.fulfilled,E.rejected))});const m=[];this.interceptors.response.forEach(function(E){m.push(E.fulfilled,E.rejected)});let y,v=0,S;if(!h){const A=[zI.bind(this),void 0];for(A.unshift(...d),A.push(...m),S=A.length,y=Promise.resolve(n);v<S;)y=y.then(A[v++],A[v++]);return y}S=d.length;let w=n;for(v=0;v<S;){const A=d[v++],E=d[v++];try{w=A(w)}catch(R){E.call(this,R);break}}try{y=zI.call(this,w)}catch(A){return Promise.reject(A)}for(v=0,S=m.length;v<S;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=Fp(this.defaults,t);const n=mL(t.baseURL,t.url,t.allowAbsoluteUrls);return cL(n,t.params,t.paramsSerializer)}};Re.forEach(["delete","get","head","options"],function(t){Dp.prototype[t]=function(n,r){return this.request(Fp(r||{},{method:t,url:n,data:(r||{}).data}))}});Re.forEach(["post","put","patch"],function(t){function n(r){return function(l,u,d){return this.request(Fp(d||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}Dp.prototype[t]=n(),Dp.prototype[t+"Form"]=n(!0)});let cie=class SL{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const r=this;this.promise.then(a=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](a);r._listeners=null}),this.promise.then=a=>{let l;const u=new Promise(d=>{r.subscribe(d),l=d}).then(a);return u.cancel=function(){r.unsubscribe(l)},u},t(function(l,u,d){r.reason||(r.reason=new g0(l,u,d),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new SL(function(a){t=a}),cancel:t}}};function fie(e){return function(n){return e.apply(null,n)}}function die(e){return Re.isObject(e)&&e.isAxiosError===!0}const wR={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wR).forEach(([e,t])=>{wR[t]=e});function wL(e){const t=new Dp(e),n=QB(Dp.prototype.request,t);return Re.extend(n,Dp.prototype,t,{allOwnKeys:!0}),Re.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return wL(Fp(e,a))},n}const hr=wL(Rx);hr.Axios=Dp;hr.CanceledError=g0;hr.CancelToken=cie;hr.isCancel=hL;hr.VERSION=xL;hr.toFormData=xC;hr.AxiosError=Ct;hr.Cancel=hr.CanceledError;hr.all=function(t){return Promise.all(t)};hr.spread=fie;hr.isAxiosError=die;hr.mergeConfig=Fp;hr.AxiosHeaders=Ta;hr.formToJSON=e=>dL(Re.isHTMLForm(e)?new FormData(e):e);hr.getAdapter=bL.getAdapter;hr.HttpStatusCode=wR;hr.default=hr;const{Axios:PSe,AxiosError:HSe,CanceledError:VSe,isCancel:FSe,CancelToken:GSe,VERSION:USe,all:$Se,Cancel:XSe,isAxiosError:YSe,spread:ZSe,toFormData:WSe,AxiosHeaders:qSe,HttpStatusCode:JSe,formToJSON:QSe,getAdapter:KSe,mergeConfig:ewe}=hr;class EL extends joe{constructor(t){super(t),this._websocket=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=5e3,this._reconnect=!0,this._reconnect_timeout=void 0,this._url=t.url,this._reconnect_timeout=setTimeout(()=>{this.connect()},200),this._zustand&&this._zustand.auto_progress()}connect(){this._zustand?.logger.info("Connecting to websocket"),this.is_open=!1,this._websocket=new WebSocket(this._url),this._websocket.onopen=()=>{this.onopen()},this._websocket.onclose=()=>{this.onclose()},this._websocket.onerror=()=>{this.on_ws_error()},this._websocket.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):t.data instanceof Blob&&t.data.arrayBuffer().then(n=>{const r=new Uint8Array(n);this.getCommunicationManager().onbytes(r)})}}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}auto_reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this._zustand?.logger.info(`Attempting to reconnect in ${t} ms`),this._reconnect_timeout=setTimeout(()=>{this._websocket&&this._websocket.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this._zustand?.logger.warn("Maximum reconnect attempts reached. Giving up.")}async onmessage(t){try{const n=JSON.parse(t);this._zustand?.logger.debug(`Recieved data of length: ${t.length} and data"`,n),await this.getCommunicationManager().receive(n)}catch(n){console.error("Websocketworker: onmessage JSON.parse error",n,t);return}}get http_protocol(){return this.secure_url?"https":"http"}get secure_url(){return this._url.startsWith("wss")}get url_wo_protocol(){return this._url.substring(this.secure_url?6:5)}get http_url(){var t=this.http_protocol+"://"+this.url_wo_protocol;return t[t.length-1]!=="/"&&(t+="/"),t}get_io_subscription_url({node_id:t,io_id:n,stream:r}){let a=this.http_url+`node/${t}/io/${n}/value`;return r&&(a+="/stream"),a}async upload_file({files:t,onProgressCallback:n,root:r}){const a=`${this.http_url}upload/`,l=new FormData,u=Array.isArray(t)?t:Array.from(t);for(const d of u){const h=d.webkitRelativePath||d.name,m=r?`${r}/${h}`:h;l.append("file",d,m)}try{return(await hr.post(a,l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:h=>{n&&n(h.loaded,h.total)}})).data.file}catch{throw new Error("Failed to upload file")}}async handle_large_message_hint({msg_id:t}){const n=this.http_url+"message/"+t,a=await(await fetch(n,{method:"GET",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})).json();this.getCommunicationManager().receive(a)}onopen(){this._zustand?.logger.info("Websocket opened"),this.is_open=!0,this._zustand&&this._zustand.auto_progress(),this.reconnectAttempts=0,this.getSyncManager().stepwise_fullsync()}onclose(){this._zustand?.logger.info("Websocket closed"),super.onclose(),this._reconnect&&(this._zustand?.logger.info("Websocket closed,reconnecting"),this.auto_reconnect())}on_ws_error(){this._zustand?.logger.warn("Websocket error"),this._websocket?this._websocket.close():this.auto_reconnect()}async send_large_message(t){const n=`${this.http_url}message/`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:t})}async send(t){if(!this._websocket||this._websocket.readyState!==WebSocket.OPEN){this._zustand?.logger.warn("Websocket not connected");return}const n=JSON.stringify(t);if(new Blob([n]).size>1e6)return this._zustand?.logger.info("Data too large, sending via http"),await this.send_large_message(n);this._zustand?.logger.debug("Sending data",t),this._websocket.send(n)}async stop(){await super.stop(),this._reconnect=!1}close(){this._websocket&&this._websocket.close()}disconnect(){super.disconnect(),this._reconnect=!1,this._reconnect_timeout&&(clearTimeout(this._reconnect_timeout),this._reconnect_timeout=void 0),this.close()}async reconnect(){if(await super.reconnect(),this._reconnect=!0,this._websocket&&(this._zustand?.logger.info("Reconnecting"),(this._websocket.readyState===WebSocket.OPEN||this._websocket.readyState===WebSocket.CONNECTING)&&(this._websocket.readyState===WebSocket.CONNECTING&&await new Promise((t,n)=>{if(this._websocket===null)return;let r=setTimeout(()=>{n("Timeout@reconnect")},2e3);this._websocket.addEventListener("open",()=>{clearTimeout(r),t(null)},{once:!0}),this._websocket.readyState===WebSocket.OPEN&&(clearTimeout(r),t(null))}),this._websocket.readyState===WebSocket.OPEN))){this.getSyncManager().stepwise_fullsync();return}this.connect()}}class hie{constructor(t,n){this.ws=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=2e3,this._wsuri=t,this.zustand=n,this.workers={},this.on_setWorker=r=>{this.zustand.set_worker(r)},this.connectionTimeout=setTimeout(()=>{this.connect()},200)}get wsuri(){return this._wsuri}get open(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.zustand.set_progress({progress:0,message:"connecting to worker manager",status:"info",blocking:!0}),this.zustand.logger.info("Connecting to websocket:",this._wsuri),this.ws=new WebSocket(this._wsuri),this.ws.onopen=()=>{this.onopen()},this.ws.onclose=()=>{this.onclose()},this.ws.onerror=()=>{this.on_ws_error()},this.ws.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):console.error("WorkerManager: onmessage event.data is not a string",typeof t.data)},this.connectionTimeout=setTimeout(()=>{this.ws?.readyState!==WebSocket.OPEN&&this.on_ws_error()},5e3)}on_ws_error(){console.warn("Websocket error"),this.ws?this.ws.close():this.reconnect()}onopen(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.zustand.auto_progress(),this.ws&&this.ws.send("worker_status");const t=window.localStorage.getItem("funcnodes__active_worker");t&&this.set_active(t)}onmessage(t){try{let n=JSON.parse(t);if(n.type==="worker_status"){const r={};for(let a of n.active)a.active=!0,r[a.uuid]=a;for(let a of n.inactive)a.active=!1,r[a.uuid]=a;this.zustand.workers.setState(r);return}else if(n.type==="set_worker"){if(n.data.type==="WSWorker"){let r="ws"+(n.data.ssl?"s":"")+"://"+n.data.host+":"+n.data.port;this.setWorker(this.workers[n.data.uuid]||new EL({url:r,zustand:this.zustand,uuid:n.data.uuid,on_sync_complete:this.zustand.options.on_sync_complete}))}else this.zustand.logger.error("WorkerManager: unknown worker type",n);return}else if(n.type==="progress"){this.zustand.set_progress(n);return}this.zustand.logger.error("WorkerManager: unknown message",n)}catch(n){console.error("WorkerManager: onmessage JSON.parse error",n,t);return}}setWorker(t){for(let n in this.workers)n!==t?.uuid&&this.workers[n].disconnect();t!==void 0&&(this.workers[t.uuid]=t,t.reconnect()),t?.uuid&&window.localStorage.setItem("funcnodes__active_worker",t?.uuid),this.zustand.worker!==void 0&&this.zustand.clear_all(),this.zustand.set_worker(t),this.on_setWorker(t)}async restart_worker(t){this.ws?.send(JSON.stringify({type:"restart_worker",workerid:t}))}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this.zustand.logger.info(`Attempting to reconnect in ${t} ms`),setTimeout(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this.zustand.logger.warn("Maximum reconnect attempts reached. Giving up.")}onclose(){this.zustand.logger.warn("WorkerManager: onclose"),this.reconnect()}set_active(t){this.ws&&this.ws.send(JSON.stringify({type:"set_active",workerid:t}))}new_worker({name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}){t||(t=void 0),r||(r=!1),a||(a=!1),n||(n=void 0,r=!1,a=!1),this.ws&&this.ws.send(JSON.stringify({type:"new_worker",kwargs:{name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}}))}remove(){for(let t in this.workers)this.workers[t].disconnect();this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.ws&&(this.ws.onclose=()=>{},this.ws.onerror=()=>{},this.ws.onmessage=()=>{},this.ws.onopen=()=>{},this.ws.close())}}const jo=()=>{const e=Qt();return e.worker?{...e.worker.api,worker:e.worker}:{node:void 0,group:void 0,edge:void 0,hooks:void 0,lib:void 0,worker:e.worker}},pie={show:!0},mie={show:!0,showmenu:!0},gie={minimap:!0,static:!1,minZoom:.1,maxZoom:5,allowFullScreen:!0,allowExpand:!0,showNodeSettings:!0},yie={id:"",debug:!1,useWorkerManager:!0,show_library:!0,header:mie,flow:gie,library:pie},CL=["classic","metal","light","solarized","midnight","forest","scientific","neon","ocean","sunset"];function Rr(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=Rr(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var vie={value:()=>{}};function EC(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new N2(n)}function N2(e){this._=e}function bie(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}N2.prototype=EC.prototype={constructor:N2,on:function(e,t){var n=this._,r=bie(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l<u;)if((a=(e=r[l]).type)&&(a=xie(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<u;)if(a=(e=r[l]).type)n[a]=BI(n[a],e.name,t);else if(t==null)for(a in n)n[a]=BI(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new N2(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,l;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,a=l.length;r<a;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,l=r.length;a<l;++a)r[a].value.apply(t,n)}};function xie(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function BI(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=vie,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var ER="http://www.w3.org/1999/xhtml";const LI={svg:"http://www.w3.org/2000/svg",xhtml:ER,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function CC(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),LI.hasOwnProperty(t)?{space:LI[t],local:e}:e}function Sie(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ER&&t.documentElement.namespaceURI===ER?t.createElement(e):t.createElementNS(n,e)}}function wie(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _L(e){var t=CC(e);return(t.local?wie:Sie)(t)}function Eie(){}function yO(e){return e==null?Eie:function(){return this.querySelector(e)}}function Cie(e){typeof e!="function"&&(e=yO(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=new Array(u),h,m,y=0;y<u;++y)(h=l[y])&&(m=e.call(h,h.__data__,y,l))&&("__data__"in h&&(m.__data__=h.__data__),d[y]=m);return new ii(r,this._parents)}function _ie(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Aie(){return[]}function AL(e){return e==null?Aie:function(){return this.querySelectorAll(e)}}function Tie(e){return function(){return _ie(e.apply(this,arguments))}}function Rie(e){typeof e=="function"?e=Tie(e):e=AL(e);for(var t=this._groups,n=t.length,r=[],a=[],l=0;l<n;++l)for(var u=t[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&(r.push(e.call(h,h.__data__,m,u)),a.push(h));return new ii(r,a)}function TL(e){return function(){return this.matches(e)}}function RL(e){return function(t){return t.matches(e)}}var kie=Array.prototype.find;function Oie(e){return function(){return kie.call(this.children,e)}}function Mie(){return this.firstElementChild}function Nie(e){return this.select(e==null?Mie:Oie(typeof e=="function"?e:RL(e)))}var Die=Array.prototype.filter;function Iie(){return Array.from(this.children)}function zie(e){return function(){return Die.call(this.children,e)}}function jie(e){return this.selectAll(e==null?Iie:zie(typeof e=="function"?e:RL(e)))}function Bie(e){typeof e!="function"&&(e=TL(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new ii(r,this._parents)}function kL(e){return new Array(e.length)}function Lie(){return new ii(this._enter||this._groups.map(kL),this._parents)}function sE(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}sE.prototype={constructor:sE,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 Pie(e){return function(){return e}}function Hie(e,t,n,r,a,l){for(var u=0,d,h=t.length,m=l.length;u<m;++u)(d=t[u])?(d.__data__=l[u],r[u]=d):n[u]=new sE(e,l[u]);for(;u<h;++u)(d=t[u])&&(a[u]=d)}function Vie(e,t,n,r,a,l,u){var d,h,m=new Map,y=t.length,v=l.length,S=new Array(y),w;for(d=0;d<y;++d)(h=t[d])&&(S[d]=w=u.call(h,h.__data__,d,t)+"",m.has(w)?a[d]=h:m.set(w,h));for(d=0;d<v;++d)w=u.call(e,l[d],d,l)+"",(h=m.get(w))?(r[d]=h,h.__data__=l[d],m.delete(w)):n[d]=new sE(e,l[d]);for(d=0;d<y;++d)(h=t[d])&&m.get(S[d])===h&&(a[d]=h)}function Fie(e){return e.__data__}function Gie(e,t){if(!arguments.length)return Array.from(this,Fie);var n=t?Vie:Hie,r=this._parents,a=this._groups;typeof e!="function"&&(e=Pie(e));for(var l=a.length,u=new Array(l),d=new Array(l),h=new Array(l),m=0;m<l;++m){var y=r[m],v=a[m],S=v.length,w=Uie(e.call(y,y&&y.__data__,m,r)),A=w.length,E=d[m]=new Array(A),R=u[m]=new Array(A),k=h[m]=new Array(S);n(y,v,E,R,k,w,t);for(var D=0,M=0,I,L;D<A;++D)if(I=E[D]){for(D>=M&&(M=D+1);!(L=R[M])&&++M<A;);I._next=L||null}}return u=new ii(u,r),u._enter=d,u._exit=h,u}function Uie(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $ie(){return new ii(this._exit||this._groups.map(kL),this._parents)}function Xie(e,t,n){var r=this.enter(),a=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?l.remove():n(l),r&&a?r.merge(a).order():a}function Yie(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,l=r.length,u=Math.min(a,l),d=new Array(a),h=0;h<u;++h)for(var m=n[h],y=r[h],v=m.length,S=d[h]=new Array(v),w,A=0;A<v;++A)(w=m[A]||y[A])&&(S[A]=w);for(;h<a;++h)d[h]=n[h];return new ii(d,this._parents)}function Zie(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,l=r[a],u;--a>=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function Wie(e){e||(e=qie);function t(v,S){return v&&S?e(v.__data__,S.__data__):!v-!S}for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l){for(var u=n[l],d=u.length,h=a[l]=new Array(d),m,y=0;y<d;++y)(m=u[y])&&(h[y]=m);h.sort(t)}return new ii(a,this._parents).order()}function qie(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Jie(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qie(){return Array.from(this)}function Kie(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length;a<l;++a){var u=r[a];if(u)return u}return null}function ele(){let e=0;for(const t of this)++e;return e}function tle(){return!this.node()}function nle(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],l=0,u=a.length,d;l<u;++l)(d=a[l])&&e.call(d,d.__data__,l,a);return this}function rle(e){return function(){this.removeAttribute(e)}}function ole(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ale(e,t){return function(){this.setAttribute(e,t)}}function ile(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function lle(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sle(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 ule(e,t){var n=CC(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?ole:rle:typeof t=="function"?n.local?sle:lle:n.local?ile:ale)(n,t))}function OL(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cle(e){return function(){this.style.removeProperty(e)}}function fle(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dle(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function hle(e,t,n){return arguments.length>1?this.each((t==null?cle:typeof t=="function"?dle:fle)(e,t,n??"")):t0(this.node(),e)}function t0(e,t){return e.style.getPropertyValue(t)||OL(e).getComputedStyle(e,null).getPropertyValue(t)}function ple(e){return function(){delete this[e]}}function mle(e,t){return function(){this[e]=t}}function gle(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yle(e,t){return arguments.length>1?this.each((t==null?ple:typeof t=="function"?gle:mle)(e,t)):this.node()[e]}function ML(e){return e.trim().split(/^|\s+/)}function vO(e){return e.classList||new NL(e)}function NL(e){this._node=e,this._names=ML(e.getAttribute("class")||"")}NL.prototype={add:function(e){var t=this._names.indexOf(e);t<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 DL(e,t){for(var n=vO(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function IL(e,t){for(var n=vO(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function vle(e){return function(){DL(this,e)}}function ble(e){return function(){IL(this,e)}}function xle(e,t){return function(){(t.apply(this,arguments)?DL:IL)(this,e)}}function Sle(e,t){var n=ML(e+"");if(arguments.length<2){for(var r=vO(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?xle:t?vle:ble)(n,t))}function wle(){this.textContent=""}function Ele(e){return function(){this.textContent=e}}function Cle(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _le(e){return arguments.length?this.each(e==null?wle:(typeof e=="function"?Cle:Ele)(e)):this.node().textContent}function Ale(){this.innerHTML=""}function Tle(e){return function(){this.innerHTML=e}}function Rle(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function kle(e){return arguments.length?this.each(e==null?Ale:(typeof e=="function"?Rle:Tle)(e)):this.node().innerHTML}function Ole(){this.nextSibling&&this.parentNode.appendChild(this)}function Mle(){return this.each(Ole)}function Nle(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dle(){return this.each(Nle)}function Ile(e){var t=typeof e=="function"?e:_L(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zle(){return null}function jle(e,t){var n=typeof e=="function"?e:_L(e),r=t==null?zle:typeof t=="function"?t:yO(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Ble(){var e=this.parentNode;e&&e.removeChild(this)}function Lle(){return this.each(Ble)}function Ple(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hle(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vle(e){return this.select(e?Hle:Ple)}function Fle(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Gle(e){return function(t){e.call(this,t,this.__data__)}}function Ule(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function $le(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function Xle(e,t,n){return function(){var r=this.__on,a,l=Gle(t);if(r){for(var u=0,d=r.length;u<d;++u)if((a=r[u]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},r?r.push(a):this.__on=[a]}}function Yle(e,t,n){var r=Ule(e+""),a,l=r.length,u;if(arguments.length<2){var d=this.node().__on;if(d){for(var h=0,m=d.length,y;h<m;++h)for(a=0,y=d[h];a<l;++a)if((u=r[a]).type===y.type&&u.name===y.name)return y.value}return}for(d=t?Xle:$le,a=0;a<l;++a)this.each(d(r[a],t,n));return this}function zL(e,t,n){var r=OL(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Zle(e,t){return function(){return zL(this,e,t)}}function Wle(e,t){return function(){return zL(this,e,t.apply(this,arguments))}}function qle(e,t){return this.each((typeof t=="function"?Wle:Zle)(e,t))}function*Jle(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length,u;a<l;++a)(u=r[a])&&(yield u)}var jL=[null];function ii(e,t){this._groups=e,this._parents=t}function kx(){return new ii([[document.documentElement]],jL)}function Qle(){return this}ii.prototype=kx.prototype={constructor:ii,select:Cie,selectAll:Rie,selectChild:Nie,selectChildren:jie,filter:Bie,data:Gie,enter:Lie,exit:$ie,join:Xie,merge:Yie,selection:Qle,order:Zie,sort:Wie,call:Jie,nodes:Qie,node:Kie,size:ele,empty:tle,each:nle,attr:ule,style:hle,property:yle,classed:Sle,text:_le,html:kle,raise:Mle,lower:Dle,append:Ile,insert:jle,remove:Lle,clone:Vle,datum:Fle,on:Yle,dispatch:qle,[Symbol.iterator]:Jle};function ti(e){return typeof e=="string"?new ii([[document.querySelector(e)]],[document.documentElement]):new ii([[e]],jL)}function Kle(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Wl(e,t){if(e=Kle(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 a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const ese={passive:!1},Q1={capture:!0,passive:!1};function aT(e){e.stopImmediatePropagation()}function Xy(e){e.preventDefault(),e.stopImmediatePropagation()}function BL(e){var t=e.document.documentElement,n=ti(e).on("dragstart.drag",Xy,Q1);"onselectstart"in t?n.on("selectstart.drag",Xy,Q1):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function LL(e,t){var n=e.document.documentElement,r=ti(e).on("dragstart.drag",null);t&&(r.on("click.drag",Xy,Q1),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const r2=e=>()=>e;function CR(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:d,dx:h,dy:m,dispatch:y}){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:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:y}})}CR.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tse(e){return!e.ctrlKey&&!e.button}function nse(){return this.parentNode}function rse(e,t){return t??{x:e.x,y:e.y}}function ose(){return navigator.maxTouchPoints||"ontouchstart"in this}function PL(){var e=tse,t=nse,n=rse,r=ose,a={},l=EC("start","drag","end"),u=0,d,h,m,y,v=0;function S(I){I.on("mousedown.drag",w).filter(r).on("touchstart.drag",R).on("touchmove.drag",k,ese).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(I,L){if(!(y||!e.call(this,I,L))){var P=M(this,t.call(this,I,L),I,L,"mouse");P&&(ti(I.view).on("mousemove.drag",A,Q1).on("mouseup.drag",E,Q1),BL(I.view),aT(I),m=!1,d=I.clientX,h=I.clientY,P("start",I))}}function A(I){if(Xy(I),!m){var L=I.clientX-d,P=I.clientY-h;m=L*L+P*P>v}a.mouse("drag",I)}function E(I){ti(I.view).on("mousemove.drag mouseup.drag",null),LL(I.view,m),Xy(I),a.mouse("end",I)}function R(I,L){if(e.call(this,I,L)){var P=I.changedTouches,G=t.call(this,I,L),$=P.length,Z,j;for(Z=0;Z<$;++Z)(j=M(this,G,I,L,P[Z].identifier,P[Z]))&&(aT(I),j("start",I,P[Z]))}}function k(I){var L=I.changedTouches,P=L.length,G,$;for(G=0;G<P;++G)($=a[L[G].identifier])&&(Xy(I),$("drag",I,L[G]))}function D(I){var L=I.changedTouches,P=L.length,G,$;for(y&&clearTimeout(y),y=setTimeout(function(){y=null},500),G=0;G<P;++G)($=a[L[G].identifier])&&(aT(I),$("end",I,L[G]))}function M(I,L,P,G,$,Z){var j=l.copy(),X=Wl(Z||P,L),ee,ae,U;if((U=n.call(I,new CR("beforestart",{sourceEvent:P,target:S,identifier:$,active:u,x:X[0],y:X[1],dx:0,dy:0,dispatch:j}),G))!=null)return ee=U.x-X[0]||0,ae=U.y-X[1]||0,function te(V,W,J){var ne=X,B;switch(V){case"start":a[$]=te,B=u++;break;case"end":delete a[$],--u;case"drag":X=Wl(J||W,L),B=u;break}j.call(V,I,new CR(V,{sourceEvent:W,subject:U,target:S,identifier:$,active:B,x:X[0]+ee,y:X[1]+ae,dx:X[0]-ne[0],dy:X[1]-ne[1],dispatch:j}),G)}}return S.filter=function(I){return arguments.length?(e=typeof I=="function"?I:r2(!!I),S):e},S.container=function(I){return arguments.length?(t=typeof I=="function"?I:r2(I),S):t},S.subject=function(I){return arguments.length?(n=typeof I=="function"?I:r2(I),S):n},S.touchable=function(I){return arguments.length?(r=typeof I=="function"?I:r2(!!I),S):r},S.on=function(){var I=l.on.apply(l,arguments);return I===l?S:I},S.clickDistance=function(I){return arguments.length?(v=(I=+I)*I,S):Math.sqrt(v)},S}function bO(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function HL(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ox(){}var K1=.7,uE=1/K1,Yy="\\s*([+-]?\\d+)\\s*",ex="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ase=/^#([0-9a-f]{3,8})$/,ise=new RegExp(`^rgb\\(${Yy},${Yy},${Yy}\\)$`),lse=new RegExp(`^rgb\\(${mu},${mu},${mu}\\)$`),sse=new RegExp(`^rgba\\(${Yy},${Yy},${Yy},${ex}\\)$`),use=new RegExp(`^rgba\\(${mu},${mu},${mu},${ex}\\)$`),cse=new RegExp(`^hsl\\(${ex},${mu},${mu}\\)$`),fse=new RegExp(`^hsla\\(${ex},${mu},${mu},${ex}\\)$`),PI={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};bO(Ox,Gp,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:HI,formatHex:HI,formatHex8:dse,formatHsl:hse,formatRgb:VI,toString:VI});function HI(){return this.rgb().formatHex()}function dse(){return this.rgb().formatHex8()}function hse(){return VL(this).formatHsl()}function VI(){return this.rgb().formatRgb()}function Gp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ase.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?FI(t):n===3?new _a(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?o2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?o2(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=ise.exec(e))?new _a(t[1],t[2],t[3],1):(t=lse.exec(e))?new _a(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=sse.exec(e))?o2(t[1],t[2],t[3],t[4]):(t=use.exec(e))?o2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cse.exec(e))?$I(t[1],t[2]/100,t[3]/100,1):(t=fse.exec(e))?$I(t[1],t[2]/100,t[3]/100,t[4]):PI.hasOwnProperty(e)?FI(PI[e]):e==="transparent"?new _a(NaN,NaN,NaN,0):null}function FI(e){return new _a(e>>16&255,e>>8&255,e&255,1)}function o2(e,t,n,r){return r<=0&&(e=t=n=NaN),new _a(e,t,n,r)}function pse(e){return e instanceof Ox||(e=Gp(e)),e?(e=e.rgb(),new _a(e.r,e.g,e.b,e.opacity)):new _a}function _R(e,t,n,r){return arguments.length===1?pse(e):new _a(e,t,n,r??1)}function _a(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}bO(_a,_R,HL(Ox,{brighter(e){return e=e==null?uE:Math.pow(uE,e),new _a(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?K1:Math.pow(K1,e),new _a(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _a(Ip(this.r),Ip(this.g),Ip(this.b),cE(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:GI,formatHex:GI,formatHex8:mse,formatRgb:UI,toString:UI}));function GI(){return`#${Mp(this.r)}${Mp(this.g)}${Mp(this.b)}`}function mse(){return`#${Mp(this.r)}${Mp(this.g)}${Mp(this.b)}${Mp((isNaN(this.opacity)?1:this.opacity)*255)}`}function UI(){const e=cE(this.opacity);return`${e===1?"rgb(":"rgba("}${Ip(this.r)}, ${Ip(this.g)}, ${Ip(this.b)}${e===1?")":`, ${e})`}`}function cE(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ip(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mp(e){return e=Ip(e),(e<16?"0":"")+e.toString(16)}function $I(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ql(e,t,n,r)}function VL(e){if(e instanceof ql)return new ql(e.h,e.s,e.l,e.opacity);if(e instanceof Ox||(e=Gp(e)),!e)return new ql;if(e instanceof ql)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,d=l-a,h=(l+a)/2;return d?(t===l?u=(n-r)/d+(n<r)*6:n===l?u=(r-t)/d+2:u=(t-n)/d+4,d/=h<.5?l+a:2-l-a,u*=60):d=h>0&&h<1?0:u,new ql(u,d,h,e.opacity)}function gse(e,t,n,r){return arguments.length===1?VL(e):new ql(e,t,n,r??1)}function ql(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}bO(ql,gse,HL(Ox,{brighter(e){return e=e==null?uE:Math.pow(uE,e),new ql(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?K1:Math.pow(K1,e),new ql(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,a=2*n-r;return new _a(iT(e>=240?e-240:e+120,a,r),iT(e,a,r),iT(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new ql(XI(this.h),a2(this.s),a2(this.l),cE(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(){const e=cE(this.opacity);return`${e===1?"hsl(":"hsla("}${XI(this.h)}, ${a2(this.s)*100}%, ${a2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function XI(e){return e=(e||0)%360,e<0?e+360:e}function a2(e){return Math.max(0,Math.min(1,e||0))}function iT(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const xO=e=>()=>e;function yse(e,t){return function(n){return e+n*t}}function vse(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function bse(e){return(e=+e)==1?FL:function(t,n){return n-t?vse(t,n,e):xO(isNaN(t)?n:t)}}function FL(e,t){var n=t-e;return n?yse(e,n):xO(isNaN(e)?t:e)}const fE=function e(t){var n=bse(t);function r(a,l){var u=n((a=_R(a)).r,(l=_R(l)).r),d=n(a.g,l.g),h=n(a.b,l.b),m=FL(a.opacity,l.opacity);return function(y){return a.r=u(y),a.g=d(y),a.b=h(y),a.opacity=m(y),a+""}}return r.gamma=e,r}(1);function xse(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;a<n;++a)r[a]=e[a]*(1-l)+t[a]*l;return r}}function Sse(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wse(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),l=new Array(n),u;for(u=0;u<r;++u)a[u]=D1(e[u],t[u]);for(;u<n;++u)l[u]=t[u];return function(d){for(u=0;u<r;++u)l[u]=a[u](d);return l}}function Ese(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function lu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Cse(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=D1(e[a],t[a]):r[a]=t[a];return function(l){for(a in n)r[a]=n[a](l);return r}}var AR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,lT=new RegExp(AR.source,"g");function _se(e){return function(){return e}}function Ase(e){return function(t){return e(t)+""}}function GL(e,t){var n=AR.lastIndex=lT.lastIndex=0,r,a,l,u=-1,d=[],h=[];for(e=e+"",t=t+"";(r=AR.exec(e))&&(a=lT.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),d[u]?d[u]+=l:d[++u]=l),(r=r[0])===(a=a[0])?d[u]?d[u]+=a:d[++u]=a:(d[++u]=null,h.push({i:u,x:lu(r,a)})),n=lT.lastIndex;return n<t.length&&(l=t.slice(n),d[u]?d[u]+=l:d[++u]=l),d.length<2?h[0]?Ase(h[0].x):_se(t):(t=h.length,function(m){for(var y=0,v;y<t;++y)d[(v=h[y]).i]=v.x(m);return d.join("")})}function D1(e,t){var n=typeof t,r;return t==null||n==="boolean"?xO(t):(n==="number"?lu:n==="string"?(r=Gp(t))?(t=r,fE):GL:t instanceof Gp?fE:t instanceof Date?Ese:Sse(t)?xse:Array.isArray(t)?wse:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Cse:lu)(e,t)}var YI=180/Math.PI,TR={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function UL(e,t,n,r,a,l){var u,d,h;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(h=e*n+t*r)&&(n-=e*h,r-=t*h),(d=Math.sqrt(n*n+r*r))&&(n/=d,r/=d,h/=d),e*r<t*n&&(e=-e,t=-t,h=-h,u=-u),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*YI,skewX:Math.atan(h)*YI,scaleX:u,scaleY:d}}var i2;function Tse(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?TR:UL(t.a,t.b,t.c,t.d,t.e,t.f)}function Rse(e){return e==null||(i2||(i2=document.createElementNS("http://www.w3.org/2000/svg","g")),i2.setAttribute("transform",e),!(e=i2.transform.baseVal.consolidate()))?TR:(e=e.matrix,UL(e.a,e.b,e.c,e.d,e.e,e.f))}function $L(e,t,n,r){function a(m){return m.length?m.pop()+" ":""}function l(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push("translate(",null,t,null,n);A.push({i:E-4,x:lu(m,v)},{i:E-2,x:lu(y,S)})}else(v||S)&&w.push("translate("+v+t+S+n)}function u(m,y,v,S){m!==y?(m-y>180?y+=360:y-m>180&&(m+=360),S.push({i:v.push(a(v)+"rotate(",null,r)-2,x:lu(m,y)})):y&&v.push(a(v)+"rotate("+y+r)}function d(m,y,v,S){m!==y?S.push({i:v.push(a(v)+"skewX(",null,r)-2,x:lu(m,y)}):y&&v.push(a(v)+"skewX("+y+r)}function h(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push(a(w)+"scale(",null,",",null,")");A.push({i:E-4,x:lu(m,v)},{i:E-2,x:lu(y,S)})}else(v!==1||S!==1)&&w.push(a(w)+"scale("+v+","+S+")")}return function(m,y){var v=[],S=[];return m=e(m),y=e(y),l(m.translateX,m.translateY,y.translateX,y.translateY,v,S),u(m.rotate,y.rotate,v,S),d(m.skewX,y.skewX,v,S),h(m.scaleX,m.scaleY,y.scaleX,y.scaleY,v,S),m=y=null,function(w){for(var A=-1,E=S.length,R;++A<E;)v[(R=S[A]).i]=R.x(w);return v.join("")}}}var kse=$L(Tse,"px, ","px)","deg)"),Ose=$L(Rse,", ",")",")"),Mse=1e-12;function ZI(e){return((e=Math.exp(e))+1/e)/2}function Nse(e){return((e=Math.exp(e))-1/e)/2}function Dse(e){return((e=Math.exp(2*e))-1)/(e+1)}const D2=function e(t,n,r){function a(l,u){var d=l[0],h=l[1],m=l[2],y=u[0],v=u[1],S=u[2],w=y-d,A=v-h,E=w*w+A*A,R,k;if(E<Mse)k=Math.log(S/m)/t,R=function(G){return[d+G*w,h+G*A,m*Math.exp(t*G*k)]};else{var D=Math.sqrt(E),M=(S*S-m*m+r*E)/(2*m*n*D),I=(S*S-m*m-r*E)/(2*S*n*D),L=Math.log(Math.sqrt(M*M+1)-M),P=Math.log(Math.sqrt(I*I+1)-I);k=(P-L)/t,R=function(G){var $=G*k,Z=ZI(L),j=m/(n*D)*(Z*Dse(t*$+L)-Nse(L));return[d+j*w,h+j*A,m*Z/ZI(t*$+L)]}}return R.duration=k*1e3*t/Math.SQRT2,R}return a.rho=function(l){var u=Math.max(.001,+l),d=u*u,h=d*d;return e(u,d,h)},a}(Math.SQRT2,2,4);var n0=0,T1=0,m1=0,XL=1e3,dE,R1,hE=0,Up=0,_C=0,tx=typeof performance=="object"&&performance.now?performance:Date,YL=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function SO(){return Up||(YL(Ise),Up=tx.now()+_C)}function Ise(){Up=0}function pE(){this._call=this._time=this._next=null}pE.prototype=ZL.prototype={constructor:pE,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?SO():+n)+(t==null?0:+t),!this._next&&R1!==this&&(R1?R1._next=this:dE=this,R1=this),this._call=e,this._time=n,RR()},stop:function(){this._call&&(this._call=null,this._time=1/0,RR())}};function ZL(e,t,n){var r=new pE;return r.restart(e,t,n),r}function zse(){SO(),++n0;for(var e=dE,t;e;)(t=Up-e._time)>=0&&e._call.call(void 0,t),e=e._next;--n0}function WI(){Up=(hE=tx.now())+_C,n0=T1=0;try{zse()}finally{n0=0,Bse(),Up=0}}function jse(){var e=tx.now(),t=e-hE;t>XL&&(_C-=t,hE=e)}function Bse(){for(var e,t=dE,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:dE=n);R1=e,RR(r)}function RR(e){if(!n0){T1&&(T1=clearTimeout(T1));var t=e-Up;t>24?(e<1/0&&(T1=setTimeout(WI,e-tx.now()-_C)),m1&&(m1=clearInterval(m1))):(m1||(hE=tx.now(),m1=setInterval(jse,XL)),n0=1,YL(WI))}}function qI(e,t,n){var r=new pE;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var Lse=EC("start","end","cancel","interrupt"),Pse=[],WL=0,JI=1,kR=2,I2=3,QI=4,OR=5,z2=6;function AC(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;Hse(e,n,{name:t,index:r,group:a,on:Lse,tween:Pse,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:WL})}function wO(e,t){var n=ss(e,t);if(n.state>WL)throw new Error("too late; already scheduled");return n}function Su(e,t){var n=ss(e,t);if(n.state>I2)throw new Error("too late; already running");return n}function ss(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Hse(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=ZL(l,0,n.time);function l(m){n.state=JI,n.timer.restart(u,n.delay,n.time),n.delay<=m&&u(m-n.delay)}function u(m){var y,v,S,w;if(n.state!==JI)return h();for(y in r)if(w=r[y],w.name===n.name){if(w.state===I2)return qI(u);w.state===QI?(w.state=z2,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[y]):+y<t&&(w.state=z2,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[y])}if(qI(function(){n.state===I2&&(n.state=QI,n.timer.restart(d,n.delay,n.time),d(m))}),n.state=kR,n.on.call("start",e,e.__data__,n.index,n.group),n.state===kR){for(n.state=I2,a=new Array(S=n.tween.length),y=0,v=-1;y<S;++y)(w=n.tween[y].value.call(e,e.__data__,n.index,n.group))&&(a[++v]=w);a.length=v+1}}function d(m){for(var y=m<n.duration?n.ease.call(null,m/n.duration):(n.timer.restart(h),n.state=OR,1),v=-1,S=a.length;++v<S;)a[v].call(e,y);n.state===OR&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=z2,n.timer.stop(),delete r[t];for(var m in r)return;delete e.__transition}}function j2(e,t){var n=e.__transition,r,a,l=!0,u;if(n){t=t==null?null:t+"";for(u in n){if((r=n[u]).name!==t){l=!1;continue}a=r.state>kR&&r.state<OR,r.state=z2,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[u]}l&&delete e.__transition}}function Vse(e){return this.each(function(){j2(this,e)})}function Fse(e,t){var n,r;return function(){var a=Su(this,e),l=a.tween;if(l!==n){r=n=l;for(var u=0,d=r.length;u<d;++u)if(r[u].name===t){r=r.slice(),r.splice(u,1);break}}a.tween=r}}function Gse(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=Su(this,e),u=l.tween;if(u!==r){a=(r=u).slice();for(var d={name:t,value:n},h=0,m=a.length;h<m;++h)if(a[h].name===t){a[h]=d;break}h===m&&a.push(d)}l.tween=a}}function Use(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ss(this.node(),n).tween,a=0,l=r.length,u;a<l;++a)if((u=r[a]).name===e)return u.value;return null}return this.each((t==null?Fse:Gse)(n,e,t))}function EO(e,t,n){var r=e._id;return e.each(function(){var a=Su(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return ss(a,r).value[t]}}function qL(e,t){var n;return(typeof t=="number"?lu:t instanceof Gp?fE:(n=Gp(t))?(t=n,fE):GL)(e,t)}function $se(e){return function(){this.removeAttribute(e)}}function Xse(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Yse(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttribute(e);return u===a?null:u===r?l:l=t(r=u,n)}}function Zse(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===a?null:u===r?l:l=t(r=u,n)}}function Wse(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function qse(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function Jse(e,t){var n=CC(e),r=n==="transform"?Ose:qL;return this.attrTween(e,typeof t=="function"?(n.local?qse:Wse)(n,r,EO(this,"attr."+e,t)):t==null?(n.local?Xse:$se)(n):(n.local?Zse:Yse)(n,r,t))}function Qse(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Kse(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function eue(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&Kse(e,l)),n}return a._value=t,a}function tue(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&Qse(e,l)),n}return a._value=t,a}function nue(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 new Error;var r=CC(e);return this.tween(n,(r.local?eue:tue)(r,t))}function rue(e,t){return function(){wO(this,e).delay=+t.apply(this,arguments)}}function oue(e,t){return t=+t,function(){wO(this,e).delay=t}}function aue(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rue:oue)(t,e)):ss(this.node(),t).delay}function iue(e,t){return function(){Su(this,e).duration=+t.apply(this,arguments)}}function lue(e,t){return t=+t,function(){Su(this,e).duration=t}}function sue(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iue:lue)(t,e)):ss(this.node(),t).duration}function uue(e,t){if(typeof t!="function")throw new Error;return function(){Su(this,e).ease=t}}function cue(e){var t=this._id;return arguments.length?this.each(uue(t,e)):ss(this.node(),t).ease}function fue(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Su(this,e).ease=n}}function due(e){if(typeof e!="function")throw new Error;return this.each(fue(this._id,e))}function hue(e){typeof e!="function"&&(e=TL(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new Zc(r,this._parents,this._name,this._id)}function pue(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,l=Math.min(r,a),u=new Array(r),d=0;d<l;++d)for(var h=t[d],m=n[d],y=h.length,v=u[d]=new Array(y),S,w=0;w<y;++w)(S=h[w]||m[w])&&(v[w]=S);for(;d<r;++d)u[d]=t[d];return new Zc(u,this._parents,this._name,this._id)}function mue(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function gue(e,t,n){var r,a,l=mue(t)?wO:Su;return function(){var u=l(this,e),d=u.on;d!==r&&(a=(r=d).copy()).on(t,n),u.on=a}}function yue(e,t){var n=this._id;return arguments.length<2?ss(this.node(),n).on.on(e):this.each(gue(n,e,t))}function vue(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function bue(){return this.on("end.remove",vue(this._id))}function xue(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yO(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u<a;++u)for(var d=r[u],h=d.length,m=l[u]=new Array(h),y,v,S=0;S<h;++S)(y=d[S])&&(v=e.call(y,y.__data__,S,d))&&("__data__"in y&&(v.__data__=y.__data__),m[S]=v,AC(m[S],t,n,S,m,ss(y,n)));return new Zc(l,this._parents,t,n)}function Sue(e){var t=this._name,n=this._id;typeof e!="function"&&(e=AL(e));for(var r=this._groups,a=r.length,l=[],u=[],d=0;d<a;++d)for(var h=r[d],m=h.length,y,v=0;v<m;++v)if(y=h[v]){for(var S=e.call(y,y.__data__,v,h),w,A=ss(y,n),E=0,R=S.length;E<R;++E)(w=S[E])&&AC(w,t,n,E,S,A);l.push(S),u.push(y)}return new Zc(l,u,t,n)}var wue=kx.prototype.constructor;function Eue(){return new wue(this._groups,this._parents)}function Cue(e,t){var n,r,a;return function(){var l=t0(this,e),u=(this.style.removeProperty(e),t0(this,e));return l===u?null:l===n&&u===r?a:a=t(n=l,r=u)}}function JL(e){return function(){this.style.removeProperty(e)}}function _ue(e,t,n){var r,a=n+"",l;return function(){var u=t0(this,e);return u===a?null:u===r?l:l=t(r=u,n)}}function Aue(e,t,n){var r,a,l;return function(){var u=t0(this,e),d=n(this),h=d+"";return d==null&&(h=d=(this.style.removeProperty(e),t0(this,e))),u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d))}}function Tue(e,t){var n,r,a,l="style."+t,u="end."+l,d;return function(){var h=Su(this,e),m=h.on,y=h.value[l]==null?d||(d=JL(t)):void 0;(m!==n||a!==y)&&(r=(n=m).copy()).on(u,a=y),h.on=r}}function Rue(e,t,n){var r=(e+="")=="transform"?kse:qL;return t==null?this.styleTween(e,Cue(e,r)).on("end.style."+e,JL(e)):typeof t=="function"?this.styleTween(e,Aue(e,r,EO(this,"style."+e,t))).each(Tue(this._id,e)):this.styleTween(e,_ue(e,r,t),n).on("end.style."+e,null)}function kue(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Oue(e,t,n){var r,a;function l(){var u=t.apply(this,arguments);return u!==a&&(r=(a=u)&&kue(e,u,n)),r}return l._value=t,l}function Mue(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 new Error;return this.tween(r,Oue(e,t,n??""))}function Nue(e){return function(){this.textContent=e}}function Due(e){return function(){var t=e(this);this.textContent=t??""}}function Iue(e){return this.tween("text",typeof e=="function"?Due(EO(this,"text",e)):Nue(e==null?"":e+""))}function zue(e){return function(t){this.textContent=e.call(this,t)}}function jue(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&zue(a)),t}return r._value=e,r}function Bue(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 new Error;return this.tween(t,jue(e))}function Lue(){for(var e=this._name,t=this._id,n=QL(),r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)if(h=u[m]){var y=ss(h,t);AC(h,e,n,m,u,{time:y.time+y.delay+y.duration,delay:0,duration:y.duration,ease:y.ease})}return new Zc(r,this._parents,e,n)}function Pue(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(l,u){var d={value:u},h={value:function(){--a===0&&l()}};n.each(function(){var m=Su(this,r),y=m.on;y!==e&&(t=(e=y).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(h)),m.on=t}),a===0&&l()})}var Hue=0;function Zc(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function QL(){return++Hue}var Dc=kx.prototype;Zc.prototype={constructor:Zc,select:xue,selectAll:Sue,selectChild:Dc.selectChild,selectChildren:Dc.selectChildren,filter:hue,merge:pue,selection:Eue,transition:Lue,call:Dc.call,nodes:Dc.nodes,node:Dc.node,size:Dc.size,empty:Dc.empty,each:Dc.each,on:yue,attr:Jse,attrTween:nue,style:Rue,styleTween:Mue,text:Iue,textTween:Bue,remove:bue,tween:Use,delay:aue,duration:sue,ease:cue,easeVarying:due,end:Pue,[Symbol.iterator]:Dc[Symbol.iterator]};function Vue(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Fue={time:null,delay:0,duration:250,ease:Vue};function Gue(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Uue(e){var t,n;e instanceof Zc?(t=e._id,e=e._name):(t=QL(),(n=Fue).time=SO(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&AC(h,e,t,m,u,n||Gue(h,t));return new Zc(r,this._parents,e,t)}kx.prototype.interrupt=Vse;kx.prototype.transition=Uue;const l2=e=>()=>e;function $ue(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){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:a}})}function Lc(e,t,n){this.k=e,this.x=t,this.y=n}Lc.prototype={constructor:Lc,scale:function(e){return e===1?this:new Lc(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Lc(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 TC=new Lc(1,0,0);KL.prototype=Lc.prototype;function KL(e){for(;!e.__zoom;)if(!(e=e.parentNode))return TC;return e.__zoom}function sT(e){e.stopImmediatePropagation()}function g1(e){e.preventDefault(),e.stopImmediatePropagation()}function Xue(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Yue(){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 KI(){return this.__zoom||TC}function Zue(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Wue(){return navigator.maxTouchPoints||"ontouchstart"in this}function que(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function eP(){var e=Xue,t=Yue,n=que,r=Zue,a=Wue,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=D2,m=EC("start","zoom","end"),y,v,S,w=500,A=150,E=0,R=10;function k(U){U.property("__zoom",KI).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",j).filter(a).on("touchstart.zoom",X).on("touchmove.zoom",ee).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(U,te,V,W){var J=U.selection?U.selection():U;J.property("__zoom",KI),U!==J?L(U,te,V,W):J.interrupt().each(function(){P(this,arguments).event(W).start().zoom(null,typeof te=="function"?te.apply(this,arguments):te).end()})},k.scaleBy=function(U,te,V,W){k.scaleTo(U,function(){var J=this.__zoom.k,ne=typeof te=="function"?te.apply(this,arguments):te;return J*ne},V,W)},k.scaleTo=function(U,te,V,W){k.transform(U,function(){var J=t.apply(this,arguments),ne=this.__zoom,B=V==null?I(J):typeof V=="function"?V.apply(this,arguments):V,oe=ne.invert(B),se=typeof te=="function"?te.apply(this,arguments):te;return n(M(D(ne,se),B,oe),J,u)},V,W)},k.translateBy=function(U,te,V,W){k.transform(U,function(){return n(this.__zoom.translate(typeof te=="function"?te.apply(this,arguments):te,typeof V=="function"?V.apply(this,arguments):V),t.apply(this,arguments),u)},null,W)},k.translateTo=function(U,te,V,W,J){k.transform(U,function(){var ne=t.apply(this,arguments),B=this.__zoom,oe=W==null?I(ne):typeof W=="function"?W.apply(this,arguments):W;return n(TC.translate(oe[0],oe[1]).scale(B.k).translate(typeof te=="function"?-te.apply(this,arguments):-te,typeof V=="function"?-V.apply(this,arguments):-V),ne,u)},W,J)};function D(U,te){return te=Math.max(l[0],Math.min(l[1],te)),te===U.k?U:new Lc(te,U.x,U.y)}function M(U,te,V){var W=te[0]-V[0]*U.k,J=te[1]-V[1]*U.k;return W===U.x&&J===U.y?U:new Lc(U.k,W,J)}function I(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function L(U,te,V,W){U.on("start.zoom",function(){P(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(W).end()}).tween("zoom",function(){var J=this,ne=arguments,B=P(J,ne).event(W),oe=t.apply(J,ne),se=V==null?I(oe):typeof V=="function"?V.apply(J,ne):V,Y=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),he=J.__zoom,Te=typeof te=="function"?te.apply(J,ne):te,me=h(he.invert(se).concat(Y/he.k),Te.invert(se).concat(Y/Te.k));return function(Ee){if(Ee===1)Ee=Te;else{var xe=me(Ee),Be=Y/xe[2];Ee=new Lc(Be,se[0]-xe[0]*Be,se[1]-xe[1]*Be)}B.zoom(null,Ee)}})}function P(U,te,V){return!V&&U.__zooming||new G(U,te)}function G(U,te){this.that=U,this.args=te,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,te),this.taps=0}G.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,te){return this.mouse&&U!=="mouse"&&(this.mouse[1]=te.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=te.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=te.invert(this.touch1[0])),this.that.__zoom=te,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var te=ti(this.that).datum();m.call(U,this.that,new $ue(U,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:m}),te)}};function $(U,...te){if(!e.apply(this,arguments))return;var V=P(this,te).event(U),W=this.__zoom,J=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,r.apply(this,arguments)))),ne=Wl(U);if(V.wheel)(V.mouse[0][0]!==ne[0]||V.mouse[0][1]!==ne[1])&&(V.mouse[1]=W.invert(V.mouse[0]=ne)),clearTimeout(V.wheel);else{if(W.k===J)return;V.mouse=[ne,W.invert(ne)],j2(this),V.start()}g1(U),V.wheel=setTimeout(B,A),V.zoom("mouse",n(M(D(W,J),V.mouse[0],V.mouse[1]),V.extent,u));function B(){V.wheel=null,V.end()}}function Z(U,...te){if(S||!e.apply(this,arguments))return;var V=U.currentTarget,W=P(this,te,!0).event(U),J=ti(U.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",Y,!0),ne=Wl(U,V),B=U.clientX,oe=U.clientY;BL(U.view),sT(U),W.mouse=[ne,this.__zoom.invert(ne)],j2(this),W.start();function se(he){if(g1(he),!W.moved){var Te=he.clientX-B,me=he.clientY-oe;W.moved=Te*Te+me*me>E}W.event(he).zoom("mouse",n(M(W.that.__zoom,W.mouse[0]=Wl(he,V),W.mouse[1]),W.extent,u))}function Y(he){J.on("mousemove.zoom mouseup.zoom",null),LL(he.view,W.moved),g1(he),W.event(he).end()}}function j(U,...te){if(e.apply(this,arguments)){var V=this.__zoom,W=Wl(U.changedTouches?U.changedTouches[0]:U,this),J=V.invert(W),ne=V.k*(U.shiftKey?.5:2),B=n(M(D(V,ne),W,J),t.apply(this,te),u);g1(U),d>0?ti(this).transition().duration(d).call(L,B,W,U):ti(this).call(k.transform,B,W,U)}}function X(U,...te){if(e.apply(this,arguments)){var V=U.touches,W=V.length,J=P(this,te,U.changedTouches.length===W).event(U),ne,B,oe,se;for(sT(U),B=0;B<W;++B)oe=V[B],se=Wl(oe,this),se=[se,this.__zoom.invert(se),oe.identifier],J.touch0?!J.touch1&&J.touch0[2]!==se[2]&&(J.touch1=se,J.taps=0):(J.touch0=se,ne=!0,J.taps=1+!!y);y&&(y=clearTimeout(y)),ne&&(J.taps<2&&(v=se[0],y=setTimeout(function(){y=null},w)),j2(this),J.start())}}function ee(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,J=W.length,ne,B,oe,se;for(g1(U),ne=0;ne<J;++ne)B=W[ne],oe=Wl(B,this),V.touch0&&V.touch0[2]===B.identifier?V.touch0[0]=oe:V.touch1&&V.touch1[2]===B.identifier&&(V.touch1[0]=oe);if(B=V.that.__zoom,V.touch1){var Y=V.touch0[0],he=V.touch0[1],Te=V.touch1[0],me=V.touch1[1],Ee=(Ee=Te[0]-Y[0])*Ee+(Ee=Te[1]-Y[1])*Ee,xe=(xe=me[0]-he[0])*xe+(xe=me[1]-he[1])*xe;B=D(B,Math.sqrt(Ee/xe)),oe=[(Y[0]+Te[0])/2,(Y[1]+Te[1])/2],se=[(he[0]+me[0])/2,(he[1]+me[1])/2]}else if(V.touch0)oe=V.touch0[0],se=V.touch0[1];else return;V.zoom("touch",n(M(B,oe,se),V.extent,u))}}function ae(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,J=W.length,ne,B;for(sT(U),S&&clearTimeout(S),S=setTimeout(function(){S=null},w),ne=0;ne<J;++ne)B=W[ne],V.touch0&&V.touch0[2]===B.identifier?delete V.touch0:V.touch1&&V.touch1[2]===B.identifier&&delete V.touch1;if(V.touch1&&!V.touch0&&(V.touch0=V.touch1,delete V.touch1),V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2&&(B=Wl(B,this),Math.hypot(v[0]-B[0],v[1]-B[1])<R)){var oe=ti(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return k.wheelDelta=function(U){return arguments.length?(r=typeof U=="function"?U:l2(+U),k):r},k.filter=function(U){return arguments.length?(e=typeof U=="function"?U:l2(!!U),k):e},k.touchable=function(U){return arguments.length?(a=typeof U=="function"?U:l2(!!U),k):a},k.extent=function(U){return arguments.length?(t=typeof U=="function"?U:l2([[+U[0][0],+U[0][1]],[+U[1][0],+U[1][1]]]),k):t},k.scaleExtent=function(U){return arguments.length?(l[0]=+U[0],l[1]=+U[1],k):[l[0],l[1]]},k.translateExtent=function(U){return arguments.length?(u[0][0]=+U[0][0],u[1][0]=+U[1][0],u[0][1]=+U[0][1],u[1][1]=+U[1][1],k):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},k.constrain=function(U){return arguments.length?(n=U,k):n},k.duration=function(U){return arguments.length?(d=+U,k):d},k.interpolate=function(U){return arguments.length?(h=U,k):h},k.on=function(){var U=m.on.apply(m,arguments);return U===m?k:U},k.clickDistance=function(U){return arguments.length?(E=(U=+U)*U,k):Math.sqrt(E)},k.tapDistance=function(U){return arguments.length?(R=+U,k):R},k}const li={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."},nx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],tP=["Enter"," ","Escape"],nP={"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"};var r0;(function(e){e.Strict="strict",e.Loose="loose"})(r0||(r0={}));var zp;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(zp||(zp={}));var rx;(function(e){e.Partial="partial",e.Full="full"})(rx||(rx={}));const rP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Td;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Td||(Td={}));var mE;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mE||(mE={}));var at;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(at||(at={}));const e5={[at.Left]:at.Right,[at.Right]:at.Left,[at.Top]:at.Bottom,[at.Bottom]:at.Top};function oP(e){return e===null?null:e?"valid":"invalid"}const aP=e=>"id"in e&&"source"in e&&"target"in e,Jue=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),CO=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Mx=(e,t=[0,0])=>{const{width:n,height:r}=ef(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},Que=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):CO(a)?a:t.nodeLookup.get(a.id));const d=u?gE(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return RC(r,d)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return kC(n)},Nx=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const a=gE(r);n=RC(n,a)}}),kC(n)},_O=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const d={...Dx(t,[n,r,a]),width:t.width/a,height:t.height/a},h=[];for(const m of e.values()){const{measured:y,selectable:v=!0,hidden:S=!1}=m;if(u&&!v||S)continue;const w=y.width??m.width??m.initialWidth??null,A=y.height??m.height??m.initialHeight??null,E=ox(d,a0(m)),R=(w??0)*(A??0),k=l&&E>0;(!m.internals.handleBounds||k||E>=R||m.dragging)&&h.push(m)}return h},Kue=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function ece(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&(t?.includeHiddenNodes||!a.hidden)&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function tce({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return Promise.resolve(!0);const d=ece(e,u),h=Nx(d),m=AO(h,t,n,u?.minZoom??a,u?.maxZoom??l,u?.padding??.1);return await r.setViewport(m,{duration:u?.duration,ease:u?.ease,interpolate:u?.interpolate}),Promise.resolve(!0)}function iP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),d=u.parentId?n.get(u.parentId):void 0,{x:h,y:m}=d?d.internals.positionAbsolute:{x:0,y:0},y=u.origin??r;let v=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!d)l?.("005",li.error005());else{const w=d.measured.width,A=d.measured.height;w&&A&&(v=[[h,m],[h+w,m+A]])}else d&&i0(u.extent)&&(v=[[u.extent[0][0]+h,u.extent[0][1]+m],[u.extent[1][0]+h,u.extent[1][1]+m]]);const S=i0(v)?$p(t,v,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&l?.("015",li.error015()),{position:{x:S.x-h+(u.measured.width??0)*y[0],y:S.y-m+(u.measured.height??0)*y[1]},positionAbsolute:S}}async function nce({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(S=>S.id)),u=[];for(const S of n){if(S.deletable===!1)continue;const w=l.has(S.id),A=!w&&S.parentId&&u.find(E=>E.id===S.parentId);(w||A)&&u.push(S)}const d=new Set(t.map(S=>S.id)),h=r.filter(S=>S.deletable!==!1),y=Kue(u,h);for(const S of h)d.has(S.id)&&!y.find(A=>A.id===S.id)&&y.push(S);if(!a)return{edges:y,nodes:u};const v=await a({nodes:u,edges:y});return typeof v=="boolean"?v?{edges:y,nodes:u}:{edges:[],nodes:[]}:v}const o0=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),$p=(e={x:0,y:0},t,n)=>({x:o0(e.x,t[0][0],t[1][0]-(n?.width??0)),y:o0(e.y,t[0][1],t[1][1]-(n?.height??0))});function lP(e,t,n){const{width:r,height:a}=ef(n),{x:l,y:u}=n.internals.positionAbsolute;return $p(e,[[l,u],[l+r,u+a]],t)}const t5=(e,t,n)=>e<t?o0(Math.abs(e-t),1,t)/t:e>n?-o0(Math.abs(e-n),1,t)/t:0,sP=(e,t,n=15,r=40)=>{const a=t5(e.x,r,t.width-r)*n,l=t5(e.y,r,t.height-r)*n;return[a,l]},RC=(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)}),MR=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),kC=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),a0=(e,t=[0,0])=>{const{x:n,y:r}=CO(e)?e.internals.positionAbsolute:Mx(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}},gE=(e,t=[0,0])=>{const{x:n,y:r}=CO(e)?e.internals.positionAbsolute:Mx(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)}},uP=(e,t)=>kC(RC(MR(e),MR(t))),ox=(e,t)=>{const 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)},n5=e=>Kl(e.width)&&Kl(e.height)&&Kl(e.x)&&Kl(e.y),Kl=e=>!isNaN(e)&&isFinite(e),cP=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},OC=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Dx=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const d={x:(e-n)/a,y:(t-r)/a};return l?OC(d,u):d},yE=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Oy(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const 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 rce(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Oy(e,n),a=Oy(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Oy(e.top??e.y??0,n),a=Oy(e.bottom??e.y??0,n),l=Oy(e.left??e.x??0,t),u=Oy(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function oce(e,t,n,r,a,l){const{x:u,y:d}=yE(e,[t,n,r]),{x:h,y:m}=yE({x:e.x+e.width,y:e.y+e.height},[t,n,r]),y=a-h,v=l-m;return{left:Math.floor(u),top:Math.floor(d),right:Math.floor(y),bottom:Math.floor(v)}}const AO=(e,t,n,r,a,l)=>{const u=rce(l,t,n),d=(t-u.x)/e.width,h=(n-u.y)/e.height,m=Math.min(d,h),y=o0(m,r,a),v=e.x+e.width/2,S=e.y+e.height/2,w=t/2-v*y,A=n/2-S*y,E=oce(e,w,A,y,t,n),R={left:Math.min(E.left-u.left,0),top:Math.min(E.top-u.top,0),right:Math.min(E.right-u.right,0),bottom:Math.min(E.bottom-u.bottom,0)};return{x:w-R.left+R.right,y:A-R.top+R.bottom,zoom:y}},vE=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function i0(e){return e!==void 0&&e!=="parent"}function ef(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function fP(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function dP(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const d=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*d[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*d[1]}return l}function r5(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ace(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function ice(e){return{...nP,...e||{}}}function I1(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=fu(e),d=Dx({x:l-(a?.left??0),y:u-(a?.top??0)},r),{x:h,y:m}=n?OC(d,t):d;return{xSnapped:h,ySnapped:m,...d}}const TO=e=>({width:e.offsetWidth,height:e.offsetHeight}),hP=e=>e?.getRootNode?.()||window?.document,lce=["INPUT","SELECT","TEXTAREA"];function pP(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:lce.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const mP=e=>"clientX"in e,fu=(e,t)=>{const n=mP(e),r=n?e.clientX:e.touches?.[0].clientX,a=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:a-(t?.top??0)}},o5=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const d=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(d.left-n.left)/r,y:(d.top-n.top)/r,...TO(u)}})};function gP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d}){const h=e*.125+a*.375+u*.375+n*.125,m=t*.125+l*.375+d*.375+r*.125,y=Math.abs(h-e),v=Math.abs(m-t);return[h,m,y,v]}function s2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function a5({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case at.Left:return[t-s2(t-r,l),n];case at.Right:return[t+s2(r-t,l),n];case at.Top:return[t,n-s2(n-a,l)];case at.Bottom:return[t,n+s2(a-n,l)]}}function RO({sourceX:e,sourceY:t,sourcePosition:n=at.Bottom,targetX:r,targetY:a,targetPosition:l=at.Top,curvature:u=.25}){const[d,h]=a5({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[m,y]=a5({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[v,S,w,A]=gP({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:m,targetControlY:y});return[`M${e},${t} C${d},${h} ${m},${y} ${r},${a}`,v,S,w,A]}function yP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,u=Math.abs(r-t)/2,d=r<t?r+u:r-u;return[l,d,a,u]}function sce({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:a=!1}){if(r!==void 0)return r;const l=a&&n?1e3:0,u=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return l+u}function uce({sourceNode:e,targetNode:t,width:n,height:r,transform:a}){const l=RC(gE(e),gE(t));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u={x:-a[0]/a[2],y:-a[1]/a[2],width:n/a[2],height:r/a[2]};return ox(u,kC(l))>0}const cce=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,fce=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),dce=(e,t)=>{if(!e.source||!e.target)return cP("006",li.error006()),t;let n;return aP(e)?n={...e}:n={...e,id:cce(e)},fce(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function vP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,d]=yP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,d]}const i5={[at.Left]:{x:-1,y:0},[at.Right]:{x:1,y:0},[at.Top]:{x:0,y:-1},[at.Bottom]:{x:0,y:1}},hce=({source:e,sourcePosition:t=at.Bottom,target:n})=>t===at.Left||t===at.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},l5=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function pce({source:e,sourcePosition:t=at.Bottom,target:n,targetPosition:r=at.Top,center:a,offset:l,stepPosition:u}){const d=i5[t],h=i5[r],m={x:e.x+d.x*l,y:e.y+d.y*l},y={x:n.x+h.x*l,y:n.y+h.y*l},v=hce({source:m,sourcePosition:t,target:y}),S=v.x!==0?"x":"y",w=v[S];let A=[],E,R;const k={x:0,y:0},D={x:0,y:0},[,,M,I]=yP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(d[S]*h[S]===-1){S==="x"?(E=a.x??m.x+(y.x-m.x)*u,R=a.y??(m.y+y.y)/2):(E=a.x??(m.x+y.x)/2,R=a.y??m.y+(y.y-m.y)*u);const P=[{x:E,y:m.y},{x:E,y:y.y}],G=[{x:m.x,y:R},{x:y.x,y:R}];d[S]===w?A=S==="x"?P:G:A=S==="x"?G:P}else{const P=[{x:m.x,y:y.y}],G=[{x:y.x,y:m.y}];if(S==="x"?A=d.x===w?G:P:A=d.y===w?P:G,t===r){const ee=Math.abs(e[S]-n[S]);if(ee<=l){const ae=Math.min(l-1,l-ee);d[S]===w?k[S]=(m[S]>e[S]?-1:1)*ae:D[S]=(y[S]>n[S]?-1:1)*ae}}if(t!==r){const ee=S==="x"?"y":"x",ae=d[S]===h[ee],U=m[ee]>y[ee],te=m[ee]<y[ee];(d[S]===1&&(!ae&&U||ae&&te)||d[S]!==1&&(!ae&&te||ae&&U))&&(A=S==="x"?P:G)}const $={x:m.x+k.x,y:m.y+k.y},Z={x:y.x+D.x,y:y.y+D.y},j=Math.max(Math.abs($.x-A[0].x),Math.abs(Z.x-A[0].x)),X=Math.max(Math.abs($.y-A[0].y),Math.abs(Z.y-A[0].y));j>=X?(E=($.x+Z.x)/2,R=A[0].y):(E=A[0].x,R=($.y+Z.y)/2)}return[[e,{x:m.x+k.x,y:m.y+k.y},...A,{x:y.x+D.x,y:y.y+D.y},n],E,R,M,I]}function mce(e,t,n,r){const a=Math.min(l5(e,t)/2,l5(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const m=e.x<n.x?-1:1,y=e.y<n.y?1:-1;return`L ${l+a*m},${u}Q ${l},${u} ${l},${u+a*y}`}const d=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${l},${u+a*h}Q ${l},${u} ${l+a*d},${u}`}function NR({sourceX:e,sourceY:t,sourcePosition:n=at.Bottom,targetX:r,targetY:a,targetPosition:l=at.Top,borderRadius:u=5,centerX:d,centerY:h,offset:m=20,stepPosition:y=.5}){const[v,S,w,A,E]=pce({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:d,y:h},offset:m,stepPosition:y});return[v.reduce((k,D,M)=>{let I="";return M>0&&M<v.length-1?I=mce(v[M-1],D,v[M+1],u):I=`${M===0?"M":"L"}${D.x} ${D.y}`,k+=I,k},""),S,w,A,E]}function s5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function gce(e){const{sourceNode:t,targetNode:n}=e;if(!s5(t)||!s5(n))return null;const r=t.internals.handleBounds||u5(t.handles),a=n.internals.handleBounds||u5(n.handles),l=c5(r?.source??[],e.sourceHandle),u=c5(e.connectionMode===r0.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),e.targetHandle);if(!l||!u)return e.onError?.("008",li.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const d=l?.position||at.Bottom,h=u?.position||at.Top,m=ax(t,l,d),y=ax(n,u,h);return{sourceX:m.x,sourceY:m.y,targetX:y.x,targetY:y.y,sourcePosition:d,targetPosition:h}}function u5(e){if(!e)return null;const t=[],n=[];for(const 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 ax(e,t,n=at.Left,r=!1){const a=(t?.x??0)+e.internals.positionAbsolute.x,l=(t?.y??0)+e.internals.positionAbsolute.y,{width:u,height:d}=t??ef(e);if(r)return{x:a+u/2,y:l+d/2};switch(t?.position??n){case at.Top:return{x:a+u/2,y:l};case at.Right:return{x:a+u,y:l+d/2};case at.Bottom:return{x:a+u/2,y:l+d};case at.Left:return{x:a,y:l+d/2}}}function c5(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function DR(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function yce(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,d)=>([d.markerStart||r,d.markerEnd||a].forEach(h=>{if(h&&typeof h=="object"){const m=DR(h,t);l.has(m)||(u.push({id:m,color:h.color||n,...h}),l.add(m))}}),u),[]).sort((u,d)=>u.id.localeCompare(d.id))}const kO={nodeOrigin:[0,0],nodeExtent:nx,elevateNodesOnSelect:!0,defaults:{}},vce={...kO,checkEquality:!0};function OO(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function bce(e,t,n){const r=OO(kO,n);for(const a of e.values())if(a.parentId)MO(a,e,t,r);else{const l=Mx(a,r.nodeOrigin),u=i0(a.extent)?a.extent:r.nodeExtent,d=$p(l,u,ef(a));a.internals.positionAbsolute=d}}function IR(e,t,n,r){const a=OO(vce,r);let l=e.length>0;const u=new Map(t),d=a?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const h of e){let m=u.get(h.id);if(a.checkEquality&&h===m?.internals.userNode)t.set(h.id,m);else{const y=Mx(h,a.nodeOrigin),v=i0(h.extent)?h.extent:a.nodeExtent,S=$p(y,v,ef(h));m={...a.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:S,handleBounds:h.measured?m?.internals.handleBounds:void 0,z:bP(h,d),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(l=!1),h.parentId&&MO(m,t,n,r)}return l}function xce(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function MO(e,t,n,r){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u}=OO(kO,r),d=e.parentId,h=t.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xce(e,n);const m=a?1e3:0,{x:y,y:v,z:S}=Sce(e,h,l,u,m),{positionAbsolute:w}=e.internals,A=y!==w.x||v!==w.y;(A||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:A?{x:y,y:v}:w,z:S}})}function bP(e,t){return(Kl(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Sce(e,t,n,r,a){const{x:l,y:u}=t.internals.positionAbsolute,d=ef(e),h=Mx(e,n),m=i0(e.extent)?$p(h,e.extent,d):h;let y=$p({x:l+m.x,y:u+m.y},r,d);e.extent==="parent"&&(y=lP(y,d,t));const v=bP(e,a),S=t.internals.z??0;return{x:y.x,y:y.y,z:S>=v?S+1:v}}function NO(e,t,n,r=[0,0]){const a=[],l=new Map;for(const u of e){const d=t.get(u.parentId);if(!d)continue;const h=l.get(u.parentId)?.expandedRect??a0(d),m=uP(h,u.rect);l.set(u.parentId,{expandedRect:m,parent:d})}return l.size>0&&l.forEach(({expandedRect:u,parent:d},h)=>{const m=d.internals.positionAbsolute,y=ef(d),v=d.origin??r,S=u.x<m.x?Math.round(Math.abs(m.x-u.x)):0,w=u.y<m.y?Math.round(Math.abs(m.y-u.y)):0,A=Math.max(y.width,Math.round(u.width)),E=Math.max(y.height,Math.round(u.height)),R=(A-y.width)*v[0],k=(E-y.height)*v[1];(S>0||w>0||R||k)&&(a.push({id:h,type:"position",position:{x:d.position.x-S+R,y:d.position.y-w+k}}),n.get(h)?.forEach(D=>{e.some(M=>M.id===D.id)||a.push({id:D.id,type:"position",position:{x:D.position.x+S,y:D.position.y+w}})})),(y.width<u.width||y.height<u.height||S||w)&&a.push({id:h,type:"dimensions",setAttributes:!0,dimensions:{width:A+(S?v[0]*S-R:0),height:E+(w?v[1]*w-k:0)}})}),a}function wce(e,t,n,r,a,l){const u=r?.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const h=[],m=window.getComputedStyle(u),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=[];for(const S of e.values()){const w=t.get(S.id);if(!w)continue;if(w.hidden){t.set(w.id,{...w,internals:{...w.internals,handleBounds:void 0}}),d=!0;continue}const A=TO(S.nodeElement),E=w.measured.width!==A.width||w.measured.height!==A.height;if(!!(A.width&&A.height&&(E||!w.internals.handleBounds||S.force))){const k=S.nodeElement.getBoundingClientRect(),D=i0(w.extent)?w.extent:l;let{positionAbsolute:M}=w.internals;w.parentId&&w.extent==="parent"?M=lP(M,A,t.get(w.parentId)):D&&(M=$p(M,D,A));const I={...w,measured:A,internals:{...w.internals,positionAbsolute:M,handleBounds:{source:o5("source",S.nodeElement,k,y,w.id),target:o5("target",S.nodeElement,k,y,w.id)}}};t.set(w.id,I),w.parentId&&MO(I,t,n,{nodeOrigin:a}),d=!0,E&&(h.push({id:w.id,type:"dimensions",dimensions:A}),w.expandParent&&w.parentId&&v.push({id:w.id,parentId:w.parentId,rect:a0(I,a)}))}}if(v.length>0){const S=NO(v,t,n,a);h.push(...S)}return{changes:h,updatedInternals:d}}async function Ece({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r),d=!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2]);return Promise.resolve(d)}function f5(e,t,n,r,a,l){let u=a;const d=r.get(u)||new Map;r.set(u,d.set(n,t)),u=`${a}-${e}`;const h=r.get(u)||new Map;if(r.set(u,h.set(n,t)),l){u=`${a}-${e}-${l}`;const m=r.get(u)||new Map;r.set(u,m.set(n,t))}}function xP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:d=null}=r,h={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:d},m=`${a}-${u}--${l}-${d}`,y=`${l}-${d}--${a}-${u}`;f5("source",h,y,e,a,u),f5("target",h,m,e,l,d),t.set(r.id,r)}}function SP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:SP(n,t):!1}function d5(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 Cce(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!SP(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const d=e.get(l);d&&a.set(l,{id:l,position:d.position||{x:0,y:0},distance:{x:n.x-d.internals.positionAbsolute.x,y:n.y-d.internals.positionAbsolute.y},extent:d.extent,parentId:d.parentId,origin:d.origin,expandParent:d.expandParent,internals:{positionAbsolute:d.internals.positionAbsolute||{x:0,y:0}},measured:{width:d.measured.width??0,height:d.measured.height??0}})}return a}function uT({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const a=[];for(const[u,d]of t){const h=n.get(u)?.internals.userNode;h&&a.push({...h,position:d.position,dragging:r})}if(!e)return[a[0],a];const l=n.get(e)?.internals.userNode;return[l?{...l,position:t.get(e)?.position||l.position,dragging:r}:a[0],a]}function _ce({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,d=new Map,h=!1,m={x:0,y:0},y=null,v=!1,S=null,w=!1,A=!1;function E({noDragClassName:k,handleSelector:D,domNode:M,isSelectable:I,nodeId:L,nodeClickDistance:P=0}){S=ti(M);function G({x:X,y:ee},ae){const{nodeLookup:U,nodeExtent:te,snapGrid:V,snapToGrid:W,nodeOrigin:J,onNodeDrag:ne,onSelectionDrag:B,onError:oe,updateNodePositions:se}=t();l={x:X,y:ee};let Y=!1,he={x:0,y:0,x2:0,y2:0};if(d.size>1&&te){const Te=Nx(d);he=MR(Te)}for(const[Te,me]of d){if(!U.has(Te))continue;let Ee={x:X-me.distance.x,y:ee-me.distance.y};W&&(Ee=OC(Ee,V));let xe=[[te[0][0],te[0][1]],[te[1][0],te[1][1]]];if(d.size>1&&te&&!me.extent){const{positionAbsolute:Ye}=me.internals,ke=Ye.x-he.x+te[0][0],Xe=Ye.x+me.measured.width-he.x2+te[1][0],We=Ye.y-he.y+te[0][1],_t=Ye.y+me.measured.height-he.y2+te[1][1];xe=[[ke,We],[Xe,_t]]}const{position:Be,positionAbsolute:He}=iP({nodeId:Te,nextPosition:Ee,nodeLookup:U,nodeExtent:xe,nodeOrigin:J,onError:oe});Y=Y||me.position.x!==Be.x||me.position.y!==Be.y,me.position=Be,me.internals.positionAbsolute=He}if(A=A||Y,!!Y&&(se(d,!0),ae&&(r||ne||!L&&B))){const[Te,me]=uT({nodeId:L,dragItems:d,nodeLookup:U});r?.(ae,d,Te,me),ne?.(ae,Te,me),L||B?.(ae,me)}}async function $(){if(!y)return;const{transform:X,panBy:ee,autoPanSpeed:ae,autoPanOnNodeDrag:U}=t();if(!U){h=!1,cancelAnimationFrame(u);return}const[te,V]=sP(m,y,ae);(te!==0||V!==0)&&(l.x=(l.x??0)-te/X[2],l.y=(l.y??0)-V/X[2],await ee({x:te,y:V})&&G(l,null)),u=requestAnimationFrame($)}function Z(X){const{nodeLookup:ee,multiSelectionActive:ae,nodesDraggable:U,transform:te,snapGrid:V,snapToGrid:W,selectNodesOnDrag:J,onNodeDragStart:ne,onSelectionDragStart:B,unselectNodesAndEdges:oe}=t();v=!0,(!J||!I)&&!ae&&L&&(ee.get(L)?.selected||oe()),I&&J&&L&&e?.(L);const se=I1(X.sourceEvent,{transform:te,snapGrid:V,snapToGrid:W,containerBounds:y});if(l=se,d=Cce(ee,U,se,L),d.size>0&&(n||ne||!L&&B)){const[Y,he]=uT({nodeId:L,dragItems:d,nodeLookup:ee});n?.(X.sourceEvent,d,Y,he),ne?.(X.sourceEvent,Y,he),L||B?.(X.sourceEvent,he)}}const j=PL().clickDistance(P).on("start",X=>{const{domNode:ee,nodeDragThreshold:ae,transform:U,snapGrid:te,snapToGrid:V}=t();y=ee?.getBoundingClientRect()||null,w=!1,A=!1,ae===0&&Z(X),l=I1(X.sourceEvent,{transform:U,snapGrid:te,snapToGrid:V,containerBounds:y}),m=fu(X.sourceEvent,y)}).on("drag",X=>{const{autoPanOnNodeDrag:ee,transform:ae,snapGrid:U,snapToGrid:te,nodeDragThreshold:V,nodeLookup:W}=t(),J=I1(X.sourceEvent,{transform:ae,snapGrid:U,snapToGrid:te,containerBounds:y});if((X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||L&&!W.has(L))&&(w=!0),!w){if(!h&&ee&&v&&(h=!0,$()),!v){const ne=J.xSnapped-(l.x??0),B=J.ySnapped-(l.y??0);Math.sqrt(ne*ne+B*B)>V&&Z(X)}(l.x!==J.xSnapped||l.y!==J.ySnapped)&&d&&v&&(m=fu(X.sourceEvent,y),G(J,X.sourceEvent))}}).on("end",X=>{if(!(!v||w)&&(h=!1,v=!1,cancelAnimationFrame(u),d.size>0)){const{nodeLookup:ee,updateNodePositions:ae,onNodeDragStop:U,onSelectionDragStop:te}=t();if(A&&(ae(d,!1),A=!1),a||U||!L&&te){const[V,W]=uT({nodeId:L,dragItems:d,nodeLookup:ee,dragging:!1});a?.(X.sourceEvent,d,V,W),U?.(X.sourceEvent,V,W),L||te?.(X.sourceEvent,W)}}}).filter(X=>{const ee=X.target;return!X.button&&(!k||!d5(ee,`.${k}`,M))&&(!D||d5(ee,D,M))});S.call(j)}function R(){S?.on(".drag",null)}return{update:E,destroy:R}}function Ace(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())ox(a,a0(l))>0&&r.push(l);return r}const Tce=250;function Rce(e,t,n,r){let a=[],l=1/0;const u=Ace(e,n,t+Tce);for(const d of u){const h=[...d.internals.handleBounds?.source??[],...d.internals.handleBounds?.target??[]];for(const m of h){if(r.nodeId===m.nodeId&&r.type===m.type&&r.id===m.id)continue;const{x:y,y:v}=ax(d,m,m.position,!0),S=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(v-e.y,2));S>t||(S<l?(a=[{...m,x:y,y:v}],l=S):S===l&&a.push({...m,x:y,y:v}))}}if(!a.length)return null;if(a.length>1){const d=r.type==="source"?"target":"source";return a.find(h=>h.type===d)??a[0]}return a[0]}function wP(e,t,n,r,a,l=!1){const u=r.get(e);if(!u)return null;const d=a==="strict"?u.internals.handleBounds?.[t]:[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]],h=(n?d?.find(m=>m.id===n):d?.[0])??null;return h&&l?{...h,...ax(u,h,h.position,!0)}:h}function EP(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function kce(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const CP=()=>!0;function Oce(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:d,nodeLookup:h,lib:m,autoPanOnConnect:y,flowId:v,panBy:S,cancelConnection:w,onConnectStart:A,onConnect:E,onConnectEnd:R,isValidConnection:k=CP,onReconnectEnd:D,updateConnection:M,getTransform:I,getFromHandle:L,autoPanSpeed:P,dragThreshold:G=1}){const $=hP(e.target);let Z=0,j;const{x:X,y:ee}=fu(e),ae=$?.elementFromPoint(X,ee),U=EP(l,ae),te=d?.getBoundingClientRect();let V=!1;if(!te||!U)return;const W=wP(a,U,r,h,t);if(!W)return;let J=fu(e,te),ne=!1,B=null,oe=!1,se=null;function Y(){if(!y||!te)return;const[Ye,ke]=sP(J,te,P);S({x:Ye,y:ke}),Z=requestAnimationFrame(Y)}const he={...W,nodeId:a,type:U,position:W.position},Te=h.get(a);let Ee={inProgress:!0,isValid:null,from:ax(Te,he,at.Left,!0),fromHandle:he,fromPosition:he.position,fromNode:Te,to:J,toHandle:null,toPosition:e5[he.position],toNode:null};function xe(){V=!0,M(Ee),A?.(e,{nodeId:a,handleId:r,handleType:U})}G===0&&xe();function Be(Ye){if(!V){const{x:_t,y:Kt}=fu(Ye),Wt=_t-X,qn=Kt-ee;if(!(Wt*Wt+qn*qn>G*G))return;xe()}if(!L()||!he){He(Ye);return}const ke=I();J=fu(Ye,te),j=Rce(Dx(J,ke,!1,[1,1]),n,h,he),ne||(Y(),ne=!0);const Xe=_P(Ye,{handle:j,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:k,doc:$,lib:m,flowId:v,nodeLookup:h});se=Xe.handleDomNode,B=Xe.connection,oe=kce(!!j,Xe.isValid);const We={...Ee,isValid:oe,to:Xe.toHandle&&oe?yE({x:Xe.toHandle.x,y:Xe.toHandle.y},ke):J,toHandle:Xe.toHandle,toPosition:oe&&Xe.toHandle?Xe.toHandle.position:e5[he.position],toNode:Xe.toHandle?h.get(Xe.toHandle.nodeId):null};oe&&j&&Ee.toHandle&&We.toHandle&&Ee.toHandle.type===We.toHandle.type&&Ee.toHandle.nodeId===We.toHandle.nodeId&&Ee.toHandle.id===We.toHandle.id&&Ee.to.x===We.to.x&&Ee.to.y===We.to.y||(M(We),Ee=We)}function He(Ye){if(V){(j||se)&&B&&oe&&E?.(B);const{inProgress:ke,...Xe}=Ee,We={...Xe,toPosition:Ee.toHandle?Ee.toPosition:null};R?.(Ye,We),l&&D?.(Ye,We)}w(),cancelAnimationFrame(Z),ne=!1,oe=!1,B=null,se=null,$.removeEventListener("mousemove",Be),$.removeEventListener("mouseup",He),$.removeEventListener("touchmove",Be),$.removeEventListener("touchend",He)}$.addEventListener("mousemove",Be),$.addEventListener("mouseup",He),$.addEventListener("touchmove",Be),$.addEventListener("touchend",He)}function _P(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:d,flowId:h,isValidConnection:m=CP,nodeLookup:y}){const v=l==="target",S=t?u.querySelector(`.${d}-flow__handle[data-id="${h}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:w,y:A}=fu(e),E=u.elementFromPoint(w,A),R=E?.classList.contains(`${d}-flow__handle`)?E:S,k={handleDomNode:R,isValid:!1,connection:null,toHandle:null};if(R){const D=EP(void 0,R),M=R.getAttribute("data-nodeid"),I=R.getAttribute("data-handleid"),L=R.classList.contains("connectable"),P=R.classList.contains("connectableend");if(!M||!D)return k;const G={source:v?M:r,sourceHandle:v?I:a,target:v?r:M,targetHandle:v?a:I};k.connection=G;const Z=L&&P&&(n===r0.Strict?v&&D==="source"||!v&&D==="target":M!==r||I!==a);k.isValid=Z&&m(G),k.toHandle=wP(M,D,I,y,n,!0)}return k}const zR={onPointerDown:Oce,isValid:_P};function Mce({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=ti(e);function l({translateExtent:d,width:h,height:m,zoomStep:y=10,pannable:v=!0,zoomable:S=!0,inversePan:w=!1}){const A=M=>{const I=n();if(M.sourceEvent.type!=="wheel"||!t)return;const L=-M.sourceEvent.deltaY*(M.sourceEvent.deltaMode===1?.05:M.sourceEvent.deltaMode?1:.002)*y,P=I[2]*Math.pow(2,L);t.scaleTo(P)};let E=[0,0];const R=M=>{(M.sourceEvent.type==="mousedown"||M.sourceEvent.type==="touchstart")&&(E=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY])},k=M=>{const I=n();if(M.sourceEvent.type!=="mousemove"&&M.sourceEvent.type!=="touchmove"||!t)return;const L=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY],P=[L[0]-E[0],L[1]-E[1]];E=L;const G=r()*Math.max(I[2],Math.log(I[2]))*(w?-1:1),$={x:I[0]-P[0]*G,y:I[1]-P[1]*G},Z=[[0,0],[h,m]];t.setViewportConstrained({x:$.x,y:$.y,zoom:I[2]},Z,d)},D=eP().on("start",R).on("zoom",v?k:null).on("zoom.wheel",S?A:null);a.call(D,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:Wl}}const Nce=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,MC=e=>({x:e.x,y:e.y,zoom:e.k}),cT=({x:e,y:t,zoom:n})=>TC.translate(e,t).scale(n),By=(e,t)=>e.target.closest(`.${t}`),AP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Dce=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,fT=(e,t=0,n=Dce,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},TP=e=>{const t=e.ctrlKey&&vE()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ice({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:d,onPanZoom:h,onPanZoomEnd:m}){return y=>{if(By(y,t))return!1;y.preventDefault(),y.stopImmediatePropagation();const v=n.property("__zoom").k||1;if(y.ctrlKey&&u){const R=Wl(y),k=TP(y),D=v*Math.pow(2,k);r.scaleTo(n,D,R,y);return}const S=y.deltaMode===1?20:1;let w=a===zp.Vertical?0:y.deltaX*S,A=a===zp.Horizontal?0:y.deltaY*S;!vE()&&y.shiftKey&&a!==zp.Vertical&&(w=y.deltaY*S,A=0),r.translateBy(n,-(w/v)*l,-(A/v)*l,{internal:!0});const E=MC(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,d?.(y,E)),e.isPanScrolling&&(h?.(y,E),e.panScrollTimeout=setTimeout(()=>{m?.(y,E),e.isPanScrolling=!1},150))}}function zce({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,d=By(r,e);if(r.ctrlKey&&l&&d&&r.preventDefault(),u||d)return null;r.preventDefault(),n.call(this,r,a)}}function jce({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const a=MC(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=a,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,a)}}function Bce({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{e.usedRightMouseButton=!!(n&&AP(t,e.mouseButton??0)),l.sourceEvent?.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!l.sourceEvent?.internal&&a?.(l.sourceEvent,MC(l.transform))}}function Lce({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{if(!u.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,l&&AP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a&&Nce(e.prevViewport,u.transform))){const d=MC(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a?.(u.sourceEvent,d)},n?150:0)}}}function Pce({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:d,noPanClassName:h,lib:m}){return y=>{const v=e||t,S=n&&y.ctrlKey;if(y.button===1&&y.type==="mousedown"&&(By(y,`${m}-flow__node`)||By(y,`${m}-flow__edge`)))return!0;if(!r&&!v&&!a&&!l&&!n||u||By(y,d)&&y.type==="wheel"||By(y,h)&&(y.type!=="wheel"||a&&y.type==="wheel"&&!e)||!n&&y.ctrlKey&&y.type==="wheel")return!1;if(!n&&y.type==="touchstart"&&y.touches?.length>1)return y.preventDefault(),!1;if(!v&&!a&&!S&&y.type==="wheel"||!r&&(y.type==="mousedown"||y.type==="touchstart")||Array.isArray(r)&&!r.includes(y.button)&&y.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(y.button)||!y.button||y.button<=1;return(!y.ctrlKey||y.type==="wheel")&&w}}function Hce({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:a,viewport:l,onPanZoom:u,onPanZoomStart:d,onPanZoomEnd:h,onDraggingChange:m}){const y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),S=eP().clickDistance(!Kl(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(a),w=ti(e).call(S);M({x:l.x,y:l.y,zoom:o0(l.zoom,t,n)},[[0,0],[v.width,v.height]],a);const A=w.on("wheel.zoom"),E=w.on("dblclick.zoom");S.wheelDelta(TP);function R(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?D1:D2).transform(fT(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function k({noWheelClassName:ee,noPanClassName:ae,onPaneContextMenu:U,userSelectionActive:te,panOnScroll:V,panOnDrag:W,panOnScrollMode:J,panOnScrollSpeed:ne,preventScrolling:B,zoomOnPinch:oe,zoomOnScroll:se,zoomOnDoubleClick:Y,zoomActivationKeyPressed:he,lib:Te,onTransformChange:me}){te&&!y.isZoomingOrPanning&&D();const xe=V&&!he&&!te?Ice({zoomPanValues:y,noWheelClassName:ee,d3Selection:w,d3Zoom:S,panOnScrollMode:J,panOnScrollSpeed:ne,zoomOnPinch:oe,onPanZoomStart:d,onPanZoom:u,onPanZoomEnd:h}):zce({noWheelClassName:ee,preventScrolling:B,d3ZoomHandler:A});if(w.on("wheel.zoom",xe,{passive:!1}),!te){const He=jce({zoomPanValues:y,onDraggingChange:m,onPanZoomStart:d});S.on("start",He);const Ye=Bce({zoomPanValues:y,panOnDrag:W,onPaneContextMenu:!!U,onPanZoom:u,onTransformChange:me});S.on("zoom",Ye);const ke=Lce({zoomPanValues:y,panOnDrag:W,panOnScroll:V,onPaneContextMenu:U,onPanZoomEnd:h,onDraggingChange:m});S.on("end",ke)}const Be=Pce({zoomActivationKeyPressed:he,panOnDrag:W,zoomOnScroll:se,panOnScroll:V,zoomOnDoubleClick:Y,zoomOnPinch:oe,userSelectionActive:te,noPanClassName:ae,noWheelClassName:ee,lib:Te});S.filter(Be),Y?w.on("dblclick.zoom",E):w.on("dblclick.zoom",null)}function D(){S.on("zoom",null)}async function M(ee,ae,U){const te=cT(ee),V=S?.constrain()(te,ae,U);return V&&await R(V),new Promise(W=>W(V))}async function I(ee,ae){const U=cT(ee);return await R(U,ae),new Promise(te=>te(U))}function L(ee){if(w){const ae=cT(ee),U=w.property("__zoom");(U.k!==ee.zoom||U.x!==ee.x||U.y!==ee.y)&&S?.transform(w,ae,null,{sync:!0})}}function P(){const ee=w?KL(w.node()):{x:0,y:0,k:1};return{x:ee.x,y:ee.y,zoom:ee.k}}function G(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?D1:D2).scaleTo(fT(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function $(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?D1:D2).scaleBy(fT(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function Z(ee){S?.scaleExtent(ee)}function j(ee){S?.translateExtent(ee)}function X(ee){const ae=!Kl(ee)||ee<0?0:ee;S?.clickDistance(ae)}return{update:k,destroy:D,setViewport:I,setViewportConstrained:M,getViewport:P,scaleTo:G,scaleBy:$,setScaleExtent:Z,setTranslateExtent:j,syncViewport:L,setClickDistance:X}}var l0;(function(e){e.Line="line",e.Handle="handle"})(l0||(l0={}));function Vce({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,d=n-r,h=[u>0?1:u<0?-1:0,d>0?1:d<0?-1:0];return u&&a&&(h[0]=h[0]*-1),d&&l&&(h[1]=h[1]*-1),h}function Fce(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function Sd(e,t){return Math.max(0,t-e)}function wd(e,t){return Math.max(0,e-t)}function u2(e,t,n){return Math.max(0,t-e,e-n)}function h5(e,t){return e?!t:t}function Gce(e,t,n,r,a,l,u,d){let{affectsX:h,affectsY:m}=t;const{isHorizontal:y,isVertical:v}=t,S=y&&v,{xSnapped:w,ySnapped:A}=n,{minWidth:E,maxWidth:R,minHeight:k,maxHeight:D}=r,{x:M,y:I,width:L,height:P,aspectRatio:G}=e;let $=Math.floor(y?w-e.pointerX:0),Z=Math.floor(v?A-e.pointerY:0);const j=L+(h?-$:$),X=P+(m?-Z:Z),ee=-l[0]*L,ae=-l[1]*P;let U=u2(j,E,R),te=u2(X,k,D);if(u){let J=0,ne=0;h&&$<0?J=Sd(M+$+ee,u[0][0]):!h&&$>0&&(J=wd(M+j+ee,u[1][0])),m&&Z<0?ne=Sd(I+Z+ae,u[0][1]):!m&&Z>0&&(ne=wd(I+X+ae,u[1][1])),U=Math.max(U,J),te=Math.max(te,ne)}if(d){let J=0,ne=0;h&&$>0?J=wd(M+$,d[0][0]):!h&&$<0&&(J=Sd(M+j,d[1][0])),m&&Z>0?ne=wd(I+Z,d[0][1]):!m&&Z<0&&(ne=Sd(I+X,d[1][1])),U=Math.max(U,J),te=Math.max(te,ne)}if(a){if(y){const J=u2(j/G,k,D)*G;if(U=Math.max(U,J),u){let ne=0;!h&&!m||h&&!m&&S?ne=wd(I+ae+j/G,u[1][1])*G:ne=Sd(I+ae+(h?$:-$)/G,u[0][1])*G,U=Math.max(U,ne)}if(d){let ne=0;!h&&!m||h&&!m&&S?ne=Sd(I+j/G,d[1][1])*G:ne=wd(I+(h?$:-$)/G,d[0][1])*G,U=Math.max(U,ne)}}if(v){const J=u2(X*G,E,R)/G;if(te=Math.max(te,J),u){let ne=0;!h&&!m||m&&!h&&S?ne=wd(M+X*G+ee,u[1][0])/G:ne=Sd(M+(m?Z:-Z)*G+ee,u[0][0])/G,te=Math.max(te,ne)}if(d){let ne=0;!h&&!m||m&&!h&&S?ne=Sd(M+X*G,d[1][0])/G:ne=wd(M+(m?Z:-Z)*G,d[0][0])/G,te=Math.max(te,ne)}}}Z=Z+(Z<0?te:-te),$=$+($<0?U:-U),a&&(S?j>X*G?Z=(h5(h,m)?-$:$)/G:$=(h5(h,m)?-Z:Z)*G:y?(Z=$/G,m=h):($=Z*G,h=m));const V=h?M+$:M,W=m?I+Z:I;return{width:L+(h?-$:$),height:P+(m?-Z:Z),x:l[0]*$*(h?-1:1)+V,y:l[1]*Z*(m?-1:1)+W}}const RP={width:0,height:0,x:0,y:0},Uce={...RP,pointerX:0,pointerY:0,aspectRatio:1};function $ce(e){return[[0,0],[e.measured.width,e.measured.height]]}function Xce(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,d=n[0]*l,h=n[1]*u;return[[r-d,a-h],[r+l-d,a+u-h]]}function Yce({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=ti(e);function u({controlPosition:h,boundaries:m,keepAspectRatio:y,resizeDirection:v,onResizeStart:S,onResize:w,onResizeEnd:A,shouldResize:E}){let R={...RP},k={...Uce};const D=Fce(h);let M,I=null,L=[],P,G,$;const Z=PL().on("start",j=>{const{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,paneDomNode:V}=n();if(M=X.get(t),!M)return;I=V?.getBoundingClientRect()??null;const{xSnapped:W,ySnapped:J}=I1(j.sourceEvent,{transform:ee,snapGrid:ae,snapToGrid:U,containerBounds:I});R={width:M.measured.width??0,height:M.measured.height??0,x:M.position.x??0,y:M.position.y??0},k={...R,pointerX:W,pointerY:J,aspectRatio:R.width/R.height},P=void 0,M.parentId&&(M.extent==="parent"||M.expandParent)&&(P=X.get(M.parentId),G=P&&M.extent==="parent"?$ce(P):void 0),L=[],$=void 0;for(const[ne,B]of X)if(B.parentId===t&&(L.push({id:ne,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const oe=Xce(B,M,B.origin??te);$?$=[[Math.min(oe[0][0],$[0][0]),Math.min(oe[0][1],$[0][1])],[Math.max(oe[1][0],$[1][0]),Math.max(oe[1][1],$[1][1])]]:$=oe}S?.(j,{...R})}).on("drag",j=>{const{transform:X,snapGrid:ee,snapToGrid:ae,nodeOrigin:U}=n(),te=I1(j.sourceEvent,{transform:X,snapGrid:ee,snapToGrid:ae,containerBounds:I}),V=[];if(!M)return;const{x:W,y:J,width:ne,height:B}=R,oe={},se=M.origin??U,{width:Y,height:he,x:Te,y:me}=Gce(k,D,te,m,y,se,G,$),Ee=Y!==ne,xe=he!==B,Be=Te!==W&&Ee,He=me!==J&&xe;if(!Be&&!He&&!Ee&&!xe)return;if((Be||He||se[0]===1||se[1]===1)&&(oe.x=Be?Te:R.x,oe.y=He?me:R.y,R.x=oe.x,R.y=oe.y,L.length>0)){const We=Te-W,_t=me-J;for(const Kt of L)Kt.position={x:Kt.position.x-We+se[0]*(Y-ne),y:Kt.position.y-_t+se[1]*(he-B)},V.push(Kt)}if((Ee||xe)&&(oe.width=Ee&&(!v||v==="horizontal")?Y:R.width,oe.height=xe&&(!v||v==="vertical")?he:R.height,R.width=oe.width,R.height=oe.height),P&&M.expandParent){const We=se[0]*(oe.width??0);oe.x&&oe.x<We&&(R.x=We,k.x=k.x-(oe.x-We));const _t=se[1]*(oe.height??0);oe.y&&oe.y<_t&&(R.y=_t,k.y=k.y-(oe.y-_t))}const Ye=Vce({width:R.width,prevWidth:ne,height:R.height,prevHeight:B,affectsX:D.affectsX,affectsY:D.affectsY}),ke={...R,direction:Ye};E?.(j,ke)!==!1&&(w?.(j,ke),r(oe,V))}).on("end",j=>{A?.(j,{...R}),a?.({...R})});l.call(Z)}function d(){l.on(".drag",null)}return{update:u,destroy:d}}const{useDebugValue:Zce}=Q,{useSyncExternalStoreWithSelector:Wce}=WB,qce=e=>e;function kP(e,t=qce,n){const r=Wce(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Zce(r),r}const p5=(e,t)=>{const n=YB(e),r=(a,l=t)=>kP(n,a,l);return Object.assign(r,n),r},Jce=(e,t)=>e?p5(e,t):p5;function Wn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const NC=Q.createContext(null),Qce=NC.Provider,OP=li.error001();function Zt(e,t){const n=Q.useContext(NC);if(n===null)throw new Error(OP);return kP(n,e,t)}function Un(){const e=Q.useContext(NC);if(e===null)throw new Error(OP);return Q.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const m5={display:"none"},Kce={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},MP="react-flow__node-desc",NP="react-flow__edge-desc",efe="react-flow__aria-live",tfe=e=>e.ariaLiveMessage,nfe=e=>e.ariaLabelConfig;function rfe({rfId:e}){const t=Zt(tfe);return T.jsx("div",{id:`${efe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Kce,children:t})}function ofe({rfId:e,disableKeyboardA11y:t}){const n=Zt(nfe);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${MP}-${e}`,style:m5,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${NP}-${e}`,style:m5,children:n["edge.a11yDescription.default"]}),!t&&T.jsx(rfe,{rfId:e})]})}const DC=Q.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return T.jsx("div",{className:Rr(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});DC.displayName="Panel";function afe({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:T.jsx(DC,{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:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ife=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},c2=e=>e.id;function lfe(e,t){return Wn(e.selectedNodes.map(c2),t.selectedNodes.map(c2))&&Wn(e.selectedEdges.map(c2),t.selectedEdges.map(c2))}function sfe({onSelectionChange:e}){const t=Un(),{selectedNodes:n,selectedEdges:r}=Zt(ife,lfe);return Q.useEffect(()=>{const a={nodes:n,edges:r};e?.(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const ufe=e=>!!e.onSelectionChangeHandlers;function cfe({onSelectionChange:e}){const t=Zt(ufe);return e||t?T.jsx(sfe,{onSelectionChange:e}):null}const DP=[0,0],ffe={x:0,y:0,zoom:1},dfe=["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","paneClickDistance","ariaLabelConfig"],g5=[...dfe,"rfId"],hfe=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,setPaneClickDistance:e.setPaneClickDistance}),y5={translateExtent:nx,nodeOrigin:DP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function pfe(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:d,setDefaultNodesAndEdges:h,setPaneClickDistance:m}=Zt(hfe,Wn),y=Un();Q.useEffect(()=>(h(e.defaultNodes,e.defaultEdges),()=>{v.current=y5,d()}),[]);const v=Q.useRef(y5);return Q.useEffect(()=>{for(const S of g5){const w=e[S],A=v.current[S];w!==A&&(typeof e[S]>"u"||(S==="nodes"?t(w):S==="edges"?n(w):S==="minZoom"?r(w):S==="maxZoom"?a(w):S==="translateExtent"?l(w):S==="nodeExtent"?u(w):S==="paneClickDistance"?m(w):S==="ariaLabelConfig"?y.setState({ariaLabelConfig:ice(w)}):S==="fitView"?y.setState({fitViewQueued:w}):S==="fitViewOptions"?y.setState({fitViewOptions:w}):y.setState({[S]:w})))}v.current=e},g5.map(S=>e[S])),null}function v5(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function mfe(e){const[t,n]=Q.useState(e==="system"?null:e);return Q.useEffect(()=>{if(e!=="system"){n(e);return}const r=v5(),a=()=>n(r?.matches?"dark":"light");return a(),r?.addEventListener("change",a),()=>{r?.removeEventListener("change",a)}},[e]),t!==null?t:v5()?.matches?"dark":"light"}const b5=typeof document<"u"?document:null;function Pc(e=null,t={target:b5,actInsideInputWithModifier:!0}){const[n,r]=Q.useState(!1),a=Q.useRef(!1),l=Q.useRef(new Set([])),[u,d]=Q.useMemo(()=>{if(e!==null){const m=(Array.isArray(e)?e:[e]).filter(v=>typeof v=="string").map(v=>v.replace("+",`
|
|
1077
|
+
`+l):r.stack=l}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Fp(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:l}=n;r!==void 0&&M2.assertOptions(r,{silentJSONParsing:tu.transitional(tu.boolean),forcedJSONParsing:tu.transitional(tu.boolean),clarifyTimeoutError:tu.transitional(tu.boolean)},!1),a!=null&&(Re.isFunction(a)?n.paramsSerializer={serialize:a}:M2.assertOptions(a,{encode:tu.function,serialize:tu.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),M2.assertOptions(n,{baseUrl:tu.spelling("baseURL"),withXsrfToken:tu.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&Re.merge(l.common,l[n.method]);l&&Re.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),n.headers=Ta.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(n)===!1||(h=h&&E.synchronous,d.unshift(E.fulfilled,E.rejected))});const m=[];this.interceptors.response.forEach(function(E){m.push(E.fulfilled,E.rejected)});let y,v=0,S;if(!h){const A=[zI.bind(this),void 0];for(A.unshift(...d),A.push(...m),S=A.length,y=Promise.resolve(n);v<S;)y=y.then(A[v++],A[v++]);return y}S=d.length;let w=n;for(v=0;v<S;){const A=d[v++],E=d[v++];try{w=A(w)}catch(R){E.call(this,R);break}}try{y=zI.call(this,w)}catch(A){return Promise.reject(A)}for(v=0,S=m.length;v<S;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=Fp(this.defaults,t);const n=mL(t.baseURL,t.url,t.allowAbsoluteUrls);return cL(n,t.params,t.paramsSerializer)}};Re.forEach(["delete","get","head","options"],function(t){Dp.prototype[t]=function(n,r){return this.request(Fp(r||{},{method:t,url:n,data:(r||{}).data}))}});Re.forEach(["post","put","patch"],function(t){function n(r){return function(l,u,d){return this.request(Fp(d||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}Dp.prototype[t]=n(),Dp.prototype[t+"Form"]=n(!0)});let cie=class SL{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const r=this;this.promise.then(a=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](a);r._listeners=null}),this.promise.then=a=>{let l;const u=new Promise(d=>{r.subscribe(d),l=d}).then(a);return u.cancel=function(){r.unsubscribe(l)},u},t(function(l,u,d){r.reason||(r.reason=new g0(l,u,d),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new SL(function(a){t=a}),cancel:t}}};function fie(e){return function(n){return e.apply(null,n)}}function die(e){return Re.isObject(e)&&e.isAxiosError===!0}const wR={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wR).forEach(([e,t])=>{wR[t]=e});function wL(e){const t=new Dp(e),n=QB(Dp.prototype.request,t);return Re.extend(n,Dp.prototype,t,{allOwnKeys:!0}),Re.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return wL(Fp(e,a))},n}const hr=wL(Rx);hr.Axios=Dp;hr.CanceledError=g0;hr.CancelToken=cie;hr.isCancel=hL;hr.VERSION=xL;hr.toFormData=xC;hr.AxiosError=Ct;hr.Cancel=hr.CanceledError;hr.all=function(t){return Promise.all(t)};hr.spread=fie;hr.isAxiosError=die;hr.mergeConfig=Fp;hr.AxiosHeaders=Ta;hr.formToJSON=e=>dL(Re.isHTMLForm(e)?new FormData(e):e);hr.getAdapter=bL.getAdapter;hr.HttpStatusCode=wR;hr.default=hr;const{Axios:PSe,AxiosError:HSe,CanceledError:VSe,isCancel:FSe,CancelToken:GSe,VERSION:USe,all:$Se,Cancel:XSe,isAxiosError:YSe,spread:ZSe,toFormData:WSe,AxiosHeaders:qSe,HttpStatusCode:JSe,formToJSON:QSe,getAdapter:KSe,mergeConfig:ewe}=hr;class EL extends joe{constructor(t){super(t),this._websocket=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=5e3,this._reconnect=!0,this._reconnect_timeout=void 0,this._url=t.url,this._reconnect_timeout=setTimeout(()=>{this.connect()},200),this._zustand&&this._zustand.auto_progress()}connect(){this._zustand?.logger.info("Connecting to websocket"),this.is_open=!1,this._websocket=new WebSocket(this._url),this._websocket.onopen=()=>{this.onopen()},this._websocket.onclose=()=>{this.onclose()},this._websocket.onerror=()=>{this.on_ws_error()},this._websocket.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):t.data instanceof Blob&&t.data.arrayBuffer().then(n=>{const r=new Uint8Array(n);this.getCommunicationManager().onbytes(r)})}}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}auto_reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this._zustand?.logger.info(`Attempting to reconnect in ${t} ms`),this._reconnect_timeout=setTimeout(()=>{this._websocket&&this._websocket.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this._zustand?.logger.warn("Maximum reconnect attempts reached. Giving up.")}async onmessage(t){try{const n=JSON.parse(t);this._zustand?.logger.debug(`Recieved data of length: ${t.length} and data"`,n),await this.getCommunicationManager().receive(n)}catch(n){console.error("Websocketworker: onmessage JSON.parse error",n,t);return}}get http_protocol(){return this.secure_url?"https":"http"}get secure_url(){return this._url.startsWith("wss")}get url_wo_protocol(){return this._url.substring(this.secure_url?6:5)}get http_url(){var t=this.http_protocol+"://"+this.url_wo_protocol;return t[t.length-1]!=="/"&&(t+="/"),t}get_io_subscription_url({node_id:t,io_id:n,stream:r}){let a=this.http_url+`node/${t}/io/${n}/value`;return r&&(a+="/stream"),a}async upload_file({files:t,onProgressCallback:n,root:r}){const a=`${this.http_url}upload/`,l=new FormData,u=Array.isArray(t)?t:Array.from(t);for(const d of u){const h=d.webkitRelativePath||d.name,m=r?`${r}/${h}`:h;l.append("file",d,m)}try{return(await hr.post(a,l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:h=>{n&&n(h.loaded,h.total)}})).data.file}catch{throw new Error("Failed to upload file")}}async handle_large_message_hint({msg_id:t}){const n=this.http_url+"message/"+t,a=await(await fetch(n,{method:"GET",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})).json();this.getCommunicationManager().receive(a)}onopen(){this._zustand?.logger.info("Websocket opened"),this.is_open=!0,this._zustand&&this._zustand.auto_progress(),this.reconnectAttempts=0,this.getSyncManager().stepwise_fullsync()}onclose(){this._zustand?.logger.info("Websocket closed"),super.onclose(),this._reconnect&&(this._zustand?.logger.info("Websocket closed,reconnecting"),this.auto_reconnect())}on_ws_error(){this._zustand?.logger.warn("Websocket error"),this._websocket?this._websocket.close():this.auto_reconnect()}async send_large_message(t){const n=`${this.http_url}message/`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:t})}async send(t){if(!this._websocket||this._websocket.readyState!==WebSocket.OPEN){this._zustand?.logger.warn("Websocket not connected");return}const n=JSON.stringify(t);if(new Blob([n]).size>1e6)return this._zustand?.logger.info("Data too large, sending via http"),await this.send_large_message(n);this._zustand?.logger.debug("Sending data",t),this._websocket.send(n)}async stop(){await super.stop(),this._reconnect=!1}close(){this._websocket&&this._websocket.close()}disconnect(){super.disconnect(),this._reconnect=!1,this._reconnect_timeout&&(clearTimeout(this._reconnect_timeout),this._reconnect_timeout=void 0),this.close()}async reconnect(){if(await super.reconnect(),this._reconnect=!0,this._websocket&&(this._zustand?.logger.info("Reconnecting"),(this._websocket.readyState===WebSocket.OPEN||this._websocket.readyState===WebSocket.CONNECTING)&&(this._websocket.readyState===WebSocket.CONNECTING&&await new Promise((t,n)=>{if(this._websocket===null)return;let r=setTimeout(()=>{n("Timeout@reconnect")},2e3);this._websocket.addEventListener("open",()=>{clearTimeout(r),t(null)},{once:!0}),this._websocket.readyState===WebSocket.OPEN&&(clearTimeout(r),t(null))}),this._websocket.readyState===WebSocket.OPEN))){this.getSyncManager().stepwise_fullsync();return}this.connect()}}class hie{constructor(t,n){this.ws=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=2e3,n.logger.debug("Initializing worker manager"),this._wsuri=t,this.zustand=n,this.workers={},this.on_setWorker=r=>{this.zustand.set_worker(r)},this.connectionTimeout=setTimeout(()=>{this.connect()},200)}get wsuri(){return this._wsuri}get open(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.zustand.set_progress({progress:0,message:"connecting to worker manager",status:"info",blocking:!0}),this.zustand.logger.info("Connecting to websocket:",this._wsuri),this.ws=new WebSocket(this._wsuri),this.ws.onopen=()=>{this.onopen()},this.ws.onclose=()=>{this.onclose()},this.ws.onerror=()=>{this.on_ws_error()},this.ws.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):console.error("WorkerManager: onmessage event.data is not a string",typeof t.data)},this.connectionTimeout=setTimeout(()=>{this.ws?.readyState!==WebSocket.OPEN&&this.on_ws_error()},5e3)}on_ws_error(){console.warn("Websocket error"),this.ws?this.ws.close():this.reconnect()}onopen(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.zustand.auto_progress(),this.ws&&this.ws.send("worker_status");const t=window.localStorage.getItem("funcnodes__active_worker");t&&this.set_active(t)}onmessage(t){try{let n=JSON.parse(t);if(n.type==="worker_status"){const r={};for(let a of n.active)a.active=!0,r[a.uuid]=a;for(let a of n.inactive)a.active=!1,r[a.uuid]=a;this.zustand.workers.setState(r);return}else if(n.type==="set_worker"){if(n.data.type==="WSWorker"){let r="ws"+(n.data.ssl?"s":"")+"://"+n.data.host+":"+n.data.port;this.setWorker(this.workers[n.data.uuid]||new EL({url:r,zustand:this.zustand,uuid:n.data.uuid,on_sync_complete:this.zustand.options.on_sync_complete}))}else this.zustand.logger.error("WorkerManager: unknown worker type",n);return}else if(n.type==="progress"){this.zustand.set_progress(n);return}this.zustand.logger.error("WorkerManager: unknown message",n)}catch(n){console.error("WorkerManager: onmessage JSON.parse error",n,t);return}}setWorker(t){for(let n in this.workers)n!==t?.uuid&&this.workers[n].disconnect();t!==void 0&&(this.workers[t.uuid]=t,t.reconnect()),t?.uuid&&window.localStorage.setItem("funcnodes__active_worker",t?.uuid),this.zustand.worker!==void 0&&this.zustand.clear_all(),this.zustand.set_worker(t),this.on_setWorker(t)}async restart_worker(t){this.ws?.send(JSON.stringify({type:"restart_worker",workerid:t}))}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this.zustand.logger.info(`Attempting to reconnect in ${t} ms`),setTimeout(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this.zustand.logger.warn("Maximum reconnect attempts reached. Giving up.")}onclose(){this.zustand.logger.warn("WorkerManager: onclose"),this.reconnect()}set_active(t){this.ws&&this.ws.send(JSON.stringify({type:"set_active",workerid:t}))}new_worker({name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}){t||(t=void 0),r||(r=!1),a||(a=!1),n||(n=void 0,r=!1,a=!1),this.ws&&this.ws.send(JSON.stringify({type:"new_worker",kwargs:{name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}}))}remove(){for(let t in this.workers)this.workers[t].disconnect();this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.ws&&(this.ws.onclose=()=>{},this.ws.onerror=()=>{},this.ws.onmessage=()=>{},this.ws.onopen=()=>{},this.ws.close())}}const jo=()=>{const e=Qt();return e.worker?{...e.worker.api,worker:e.worker}:{node:void 0,group:void 0,edge:void 0,hooks:void 0,lib:void 0,worker:e.worker}},pie={show:!0},mie={show:!0,showmenu:!0},gie={minimap:!0,static:!1,minZoom:.1,maxZoom:5,allowFullScreen:!0,allowExpand:!0,showNodeSettings:!0},yie={id:"",debug:!1,useWorkerManager:!0,show_library:!0,header:mie,flow:gie,library:pie},CL=["classic","metal","light","solarized","midnight","forest","scientific","neon","ocean","sunset"];function Rr(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=Rr(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var vie={value:()=>{}};function EC(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new N2(n)}function N2(e){this._=e}function bie(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}N2.prototype=EC.prototype={constructor:N2,on:function(e,t){var n=this._,r=bie(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l<u;)if((a=(e=r[l]).type)&&(a=xie(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<u;)if(a=(e=r[l]).type)n[a]=BI(n[a],e.name,t);else if(t==null)for(a in n)n[a]=BI(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new N2(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,l;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,a=l.length;r<a;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,l=r.length;a<l;++a)r[a].value.apply(t,n)}};function xie(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function BI(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=vie,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var ER="http://www.w3.org/1999/xhtml";const LI={svg:"http://www.w3.org/2000/svg",xhtml:ER,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function CC(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),LI.hasOwnProperty(t)?{space:LI[t],local:e}:e}function Sie(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ER&&t.documentElement.namespaceURI===ER?t.createElement(e):t.createElementNS(n,e)}}function wie(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _L(e){var t=CC(e);return(t.local?wie:Sie)(t)}function Eie(){}function yO(e){return e==null?Eie:function(){return this.querySelector(e)}}function Cie(e){typeof e!="function"&&(e=yO(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=new Array(u),h,m,y=0;y<u;++y)(h=l[y])&&(m=e.call(h,h.__data__,y,l))&&("__data__"in h&&(m.__data__=h.__data__),d[y]=m);return new ii(r,this._parents)}function _ie(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Aie(){return[]}function AL(e){return e==null?Aie:function(){return this.querySelectorAll(e)}}function Tie(e){return function(){return _ie(e.apply(this,arguments))}}function Rie(e){typeof e=="function"?e=Tie(e):e=AL(e);for(var t=this._groups,n=t.length,r=[],a=[],l=0;l<n;++l)for(var u=t[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&(r.push(e.call(h,h.__data__,m,u)),a.push(h));return new ii(r,a)}function TL(e){return function(){return this.matches(e)}}function RL(e){return function(t){return t.matches(e)}}var kie=Array.prototype.find;function Oie(e){return function(){return kie.call(this.children,e)}}function Mie(){return this.firstElementChild}function Nie(e){return this.select(e==null?Mie:Oie(typeof e=="function"?e:RL(e)))}var Die=Array.prototype.filter;function Iie(){return Array.from(this.children)}function zie(e){return function(){return Die.call(this.children,e)}}function jie(e){return this.selectAll(e==null?Iie:zie(typeof e=="function"?e:RL(e)))}function Bie(e){typeof e!="function"&&(e=TL(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new ii(r,this._parents)}function kL(e){return new Array(e.length)}function Lie(){return new ii(this._enter||this._groups.map(kL),this._parents)}function sE(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}sE.prototype={constructor:sE,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 Pie(e){return function(){return e}}function Hie(e,t,n,r,a,l){for(var u=0,d,h=t.length,m=l.length;u<m;++u)(d=t[u])?(d.__data__=l[u],r[u]=d):n[u]=new sE(e,l[u]);for(;u<h;++u)(d=t[u])&&(a[u]=d)}function Vie(e,t,n,r,a,l,u){var d,h,m=new Map,y=t.length,v=l.length,S=new Array(y),w;for(d=0;d<y;++d)(h=t[d])&&(S[d]=w=u.call(h,h.__data__,d,t)+"",m.has(w)?a[d]=h:m.set(w,h));for(d=0;d<v;++d)w=u.call(e,l[d],d,l)+"",(h=m.get(w))?(r[d]=h,h.__data__=l[d],m.delete(w)):n[d]=new sE(e,l[d]);for(d=0;d<y;++d)(h=t[d])&&m.get(S[d])===h&&(a[d]=h)}function Fie(e){return e.__data__}function Gie(e,t){if(!arguments.length)return Array.from(this,Fie);var n=t?Vie:Hie,r=this._parents,a=this._groups;typeof e!="function"&&(e=Pie(e));for(var l=a.length,u=new Array(l),d=new Array(l),h=new Array(l),m=0;m<l;++m){var y=r[m],v=a[m],S=v.length,w=Uie(e.call(y,y&&y.__data__,m,r)),A=w.length,E=d[m]=new Array(A),R=u[m]=new Array(A),k=h[m]=new Array(S);n(y,v,E,R,k,w,t);for(var D=0,M=0,I,L;D<A;++D)if(I=E[D]){for(D>=M&&(M=D+1);!(L=R[M])&&++M<A;);I._next=L||null}}return u=new ii(u,r),u._enter=d,u._exit=h,u}function Uie(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $ie(){return new ii(this._exit||this._groups.map(kL),this._parents)}function Xie(e,t,n){var r=this.enter(),a=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?l.remove():n(l),r&&a?r.merge(a).order():a}function Yie(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,l=r.length,u=Math.min(a,l),d=new Array(a),h=0;h<u;++h)for(var m=n[h],y=r[h],v=m.length,S=d[h]=new Array(v),w,A=0;A<v;++A)(w=m[A]||y[A])&&(S[A]=w);for(;h<a;++h)d[h]=n[h];return new ii(d,this._parents)}function Zie(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,l=r[a],u;--a>=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function Wie(e){e||(e=qie);function t(v,S){return v&&S?e(v.__data__,S.__data__):!v-!S}for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l){for(var u=n[l],d=u.length,h=a[l]=new Array(d),m,y=0;y<d;++y)(m=u[y])&&(h[y]=m);h.sort(t)}return new ii(a,this._parents).order()}function qie(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Jie(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qie(){return Array.from(this)}function Kie(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length;a<l;++a){var u=r[a];if(u)return u}return null}function ele(){let e=0;for(const t of this)++e;return e}function tle(){return!this.node()}function nle(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],l=0,u=a.length,d;l<u;++l)(d=a[l])&&e.call(d,d.__data__,l,a);return this}function rle(e){return function(){this.removeAttribute(e)}}function ole(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ale(e,t){return function(){this.setAttribute(e,t)}}function ile(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function lle(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sle(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 ule(e,t){var n=CC(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?ole:rle:typeof t=="function"?n.local?sle:lle:n.local?ile:ale)(n,t))}function OL(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cle(e){return function(){this.style.removeProperty(e)}}function fle(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dle(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function hle(e,t,n){return arguments.length>1?this.each((t==null?cle:typeof t=="function"?dle:fle)(e,t,n??"")):t0(this.node(),e)}function t0(e,t){return e.style.getPropertyValue(t)||OL(e).getComputedStyle(e,null).getPropertyValue(t)}function ple(e){return function(){delete this[e]}}function mle(e,t){return function(){this[e]=t}}function gle(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yle(e,t){return arguments.length>1?this.each((t==null?ple:typeof t=="function"?gle:mle)(e,t)):this.node()[e]}function ML(e){return e.trim().split(/^|\s+/)}function vO(e){return e.classList||new NL(e)}function NL(e){this._node=e,this._names=ML(e.getAttribute("class")||"")}NL.prototype={add:function(e){var t=this._names.indexOf(e);t<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 DL(e,t){for(var n=vO(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function IL(e,t){for(var n=vO(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function vle(e){return function(){DL(this,e)}}function ble(e){return function(){IL(this,e)}}function xle(e,t){return function(){(t.apply(this,arguments)?DL:IL)(this,e)}}function Sle(e,t){var n=ML(e+"");if(arguments.length<2){for(var r=vO(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?xle:t?vle:ble)(n,t))}function wle(){this.textContent=""}function Ele(e){return function(){this.textContent=e}}function Cle(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _le(e){return arguments.length?this.each(e==null?wle:(typeof e=="function"?Cle:Ele)(e)):this.node().textContent}function Ale(){this.innerHTML=""}function Tle(e){return function(){this.innerHTML=e}}function Rle(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function kle(e){return arguments.length?this.each(e==null?Ale:(typeof e=="function"?Rle:Tle)(e)):this.node().innerHTML}function Ole(){this.nextSibling&&this.parentNode.appendChild(this)}function Mle(){return this.each(Ole)}function Nle(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dle(){return this.each(Nle)}function Ile(e){var t=typeof e=="function"?e:_L(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zle(){return null}function jle(e,t){var n=typeof e=="function"?e:_L(e),r=t==null?zle:typeof t=="function"?t:yO(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Ble(){var e=this.parentNode;e&&e.removeChild(this)}function Lle(){return this.each(Ble)}function Ple(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hle(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vle(e){return this.select(e?Hle:Ple)}function Fle(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Gle(e){return function(t){e.call(this,t,this.__data__)}}function Ule(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function $le(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function Xle(e,t,n){return function(){var r=this.__on,a,l=Gle(t);if(r){for(var u=0,d=r.length;u<d;++u)if((a=r[u]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},r?r.push(a):this.__on=[a]}}function Yle(e,t,n){var r=Ule(e+""),a,l=r.length,u;if(arguments.length<2){var d=this.node().__on;if(d){for(var h=0,m=d.length,y;h<m;++h)for(a=0,y=d[h];a<l;++a)if((u=r[a]).type===y.type&&u.name===y.name)return y.value}return}for(d=t?Xle:$le,a=0;a<l;++a)this.each(d(r[a],t,n));return this}function zL(e,t,n){var r=OL(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Zle(e,t){return function(){return zL(this,e,t)}}function Wle(e,t){return function(){return zL(this,e,t.apply(this,arguments))}}function qle(e,t){return this.each((typeof t=="function"?Wle:Zle)(e,t))}function*Jle(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length,u;a<l;++a)(u=r[a])&&(yield u)}var jL=[null];function ii(e,t){this._groups=e,this._parents=t}function kx(){return new ii([[document.documentElement]],jL)}function Qle(){return this}ii.prototype=kx.prototype={constructor:ii,select:Cie,selectAll:Rie,selectChild:Nie,selectChildren:jie,filter:Bie,data:Gie,enter:Lie,exit:$ie,join:Xie,merge:Yie,selection:Qle,order:Zie,sort:Wie,call:Jie,nodes:Qie,node:Kie,size:ele,empty:tle,each:nle,attr:ule,style:hle,property:yle,classed:Sle,text:_le,html:kle,raise:Mle,lower:Dle,append:Ile,insert:jle,remove:Lle,clone:Vle,datum:Fle,on:Yle,dispatch:qle,[Symbol.iterator]:Jle};function ti(e){return typeof e=="string"?new ii([[document.querySelector(e)]],[document.documentElement]):new ii([[e]],jL)}function Kle(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Wl(e,t){if(e=Kle(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 a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const ese={passive:!1},Q1={capture:!0,passive:!1};function aT(e){e.stopImmediatePropagation()}function Xy(e){e.preventDefault(),e.stopImmediatePropagation()}function BL(e){var t=e.document.documentElement,n=ti(e).on("dragstart.drag",Xy,Q1);"onselectstart"in t?n.on("selectstart.drag",Xy,Q1):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function LL(e,t){var n=e.document.documentElement,r=ti(e).on("dragstart.drag",null);t&&(r.on("click.drag",Xy,Q1),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const r2=e=>()=>e;function CR(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:d,dx:h,dy:m,dispatch:y}){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:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:y}})}CR.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tse(e){return!e.ctrlKey&&!e.button}function nse(){return this.parentNode}function rse(e,t){return t??{x:e.x,y:e.y}}function ose(){return navigator.maxTouchPoints||"ontouchstart"in this}function PL(){var e=tse,t=nse,n=rse,r=ose,a={},l=EC("start","drag","end"),u=0,d,h,m,y,v=0;function S(I){I.on("mousedown.drag",w).filter(r).on("touchstart.drag",R).on("touchmove.drag",k,ese).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(I,L){if(!(y||!e.call(this,I,L))){var P=M(this,t.call(this,I,L),I,L,"mouse");P&&(ti(I.view).on("mousemove.drag",A,Q1).on("mouseup.drag",E,Q1),BL(I.view),aT(I),m=!1,d=I.clientX,h=I.clientY,P("start",I))}}function A(I){if(Xy(I),!m){var L=I.clientX-d,P=I.clientY-h;m=L*L+P*P>v}a.mouse("drag",I)}function E(I){ti(I.view).on("mousemove.drag mouseup.drag",null),LL(I.view,m),Xy(I),a.mouse("end",I)}function R(I,L){if(e.call(this,I,L)){var P=I.changedTouches,G=t.call(this,I,L),$=P.length,Z,j;for(Z=0;Z<$;++Z)(j=M(this,G,I,L,P[Z].identifier,P[Z]))&&(aT(I),j("start",I,P[Z]))}}function k(I){var L=I.changedTouches,P=L.length,G,$;for(G=0;G<P;++G)($=a[L[G].identifier])&&(Xy(I),$("drag",I,L[G]))}function D(I){var L=I.changedTouches,P=L.length,G,$;for(y&&clearTimeout(y),y=setTimeout(function(){y=null},500),G=0;G<P;++G)($=a[L[G].identifier])&&(aT(I),$("end",I,L[G]))}function M(I,L,P,G,$,Z){var j=l.copy(),X=Wl(Z||P,L),ee,ae,U;if((U=n.call(I,new CR("beforestart",{sourceEvent:P,target:S,identifier:$,active:u,x:X[0],y:X[1],dx:0,dy:0,dispatch:j}),G))!=null)return ee=U.x-X[0]||0,ae=U.y-X[1]||0,function te(V,W,J){var ne=X,B;switch(V){case"start":a[$]=te,B=u++;break;case"end":delete a[$],--u;case"drag":X=Wl(J||W,L),B=u;break}j.call(V,I,new CR(V,{sourceEvent:W,subject:U,target:S,identifier:$,active:B,x:X[0]+ee,y:X[1]+ae,dx:X[0]-ne[0],dy:X[1]-ne[1],dispatch:j}),G)}}return S.filter=function(I){return arguments.length?(e=typeof I=="function"?I:r2(!!I),S):e},S.container=function(I){return arguments.length?(t=typeof I=="function"?I:r2(I),S):t},S.subject=function(I){return arguments.length?(n=typeof I=="function"?I:r2(I),S):n},S.touchable=function(I){return arguments.length?(r=typeof I=="function"?I:r2(!!I),S):r},S.on=function(){var I=l.on.apply(l,arguments);return I===l?S:I},S.clickDistance=function(I){return arguments.length?(v=(I=+I)*I,S):Math.sqrt(v)},S}function bO(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function HL(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ox(){}var K1=.7,uE=1/K1,Yy="\\s*([+-]?\\d+)\\s*",ex="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ase=/^#([0-9a-f]{3,8})$/,ise=new RegExp(`^rgb\\(${Yy},${Yy},${Yy}\\)$`),lse=new RegExp(`^rgb\\(${mu},${mu},${mu}\\)$`),sse=new RegExp(`^rgba\\(${Yy},${Yy},${Yy},${ex}\\)$`),use=new RegExp(`^rgba\\(${mu},${mu},${mu},${ex}\\)$`),cse=new RegExp(`^hsl\\(${ex},${mu},${mu}\\)$`),fse=new RegExp(`^hsla\\(${ex},${mu},${mu},${ex}\\)$`),PI={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};bO(Ox,Gp,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:HI,formatHex:HI,formatHex8:dse,formatHsl:hse,formatRgb:VI,toString:VI});function HI(){return this.rgb().formatHex()}function dse(){return this.rgb().formatHex8()}function hse(){return VL(this).formatHsl()}function VI(){return this.rgb().formatRgb()}function Gp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ase.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?FI(t):n===3?new _a(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?o2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?o2(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=ise.exec(e))?new _a(t[1],t[2],t[3],1):(t=lse.exec(e))?new _a(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=sse.exec(e))?o2(t[1],t[2],t[3],t[4]):(t=use.exec(e))?o2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cse.exec(e))?$I(t[1],t[2]/100,t[3]/100,1):(t=fse.exec(e))?$I(t[1],t[2]/100,t[3]/100,t[4]):PI.hasOwnProperty(e)?FI(PI[e]):e==="transparent"?new _a(NaN,NaN,NaN,0):null}function FI(e){return new _a(e>>16&255,e>>8&255,e&255,1)}function o2(e,t,n,r){return r<=0&&(e=t=n=NaN),new _a(e,t,n,r)}function pse(e){return e instanceof Ox||(e=Gp(e)),e?(e=e.rgb(),new _a(e.r,e.g,e.b,e.opacity)):new _a}function _R(e,t,n,r){return arguments.length===1?pse(e):new _a(e,t,n,r??1)}function _a(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}bO(_a,_R,HL(Ox,{brighter(e){return e=e==null?uE:Math.pow(uE,e),new _a(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?K1:Math.pow(K1,e),new _a(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _a(Ip(this.r),Ip(this.g),Ip(this.b),cE(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:GI,formatHex:GI,formatHex8:mse,formatRgb:UI,toString:UI}));function GI(){return`#${Mp(this.r)}${Mp(this.g)}${Mp(this.b)}`}function mse(){return`#${Mp(this.r)}${Mp(this.g)}${Mp(this.b)}${Mp((isNaN(this.opacity)?1:this.opacity)*255)}`}function UI(){const e=cE(this.opacity);return`${e===1?"rgb(":"rgba("}${Ip(this.r)}, ${Ip(this.g)}, ${Ip(this.b)}${e===1?")":`, ${e})`}`}function cE(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ip(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mp(e){return e=Ip(e),(e<16?"0":"")+e.toString(16)}function $I(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ql(e,t,n,r)}function VL(e){if(e instanceof ql)return new ql(e.h,e.s,e.l,e.opacity);if(e instanceof Ox||(e=Gp(e)),!e)return new ql;if(e instanceof ql)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,d=l-a,h=(l+a)/2;return d?(t===l?u=(n-r)/d+(n<r)*6:n===l?u=(r-t)/d+2:u=(t-n)/d+4,d/=h<.5?l+a:2-l-a,u*=60):d=h>0&&h<1?0:u,new ql(u,d,h,e.opacity)}function gse(e,t,n,r){return arguments.length===1?VL(e):new ql(e,t,n,r??1)}function ql(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}bO(ql,gse,HL(Ox,{brighter(e){return e=e==null?uE:Math.pow(uE,e),new ql(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?K1:Math.pow(K1,e),new ql(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,a=2*n-r;return new _a(iT(e>=240?e-240:e+120,a,r),iT(e,a,r),iT(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new ql(XI(this.h),a2(this.s),a2(this.l),cE(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(){const e=cE(this.opacity);return`${e===1?"hsl(":"hsla("}${XI(this.h)}, ${a2(this.s)*100}%, ${a2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function XI(e){return e=(e||0)%360,e<0?e+360:e}function a2(e){return Math.max(0,Math.min(1,e||0))}function iT(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const xO=e=>()=>e;function yse(e,t){return function(n){return e+n*t}}function vse(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function bse(e){return(e=+e)==1?FL:function(t,n){return n-t?vse(t,n,e):xO(isNaN(t)?n:t)}}function FL(e,t){var n=t-e;return n?yse(e,n):xO(isNaN(e)?t:e)}const fE=function e(t){var n=bse(t);function r(a,l){var u=n((a=_R(a)).r,(l=_R(l)).r),d=n(a.g,l.g),h=n(a.b,l.b),m=FL(a.opacity,l.opacity);return function(y){return a.r=u(y),a.g=d(y),a.b=h(y),a.opacity=m(y),a+""}}return r.gamma=e,r}(1);function xse(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;a<n;++a)r[a]=e[a]*(1-l)+t[a]*l;return r}}function Sse(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wse(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),l=new Array(n),u;for(u=0;u<r;++u)a[u]=D1(e[u],t[u]);for(;u<n;++u)l[u]=t[u];return function(d){for(u=0;u<r;++u)l[u]=a[u](d);return l}}function Ese(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function lu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Cse(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=D1(e[a],t[a]):r[a]=t[a];return function(l){for(a in n)r[a]=n[a](l);return r}}var AR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,lT=new RegExp(AR.source,"g");function _se(e){return function(){return e}}function Ase(e){return function(t){return e(t)+""}}function GL(e,t){var n=AR.lastIndex=lT.lastIndex=0,r,a,l,u=-1,d=[],h=[];for(e=e+"",t=t+"";(r=AR.exec(e))&&(a=lT.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),d[u]?d[u]+=l:d[++u]=l),(r=r[0])===(a=a[0])?d[u]?d[u]+=a:d[++u]=a:(d[++u]=null,h.push({i:u,x:lu(r,a)})),n=lT.lastIndex;return n<t.length&&(l=t.slice(n),d[u]?d[u]+=l:d[++u]=l),d.length<2?h[0]?Ase(h[0].x):_se(t):(t=h.length,function(m){for(var y=0,v;y<t;++y)d[(v=h[y]).i]=v.x(m);return d.join("")})}function D1(e,t){var n=typeof t,r;return t==null||n==="boolean"?xO(t):(n==="number"?lu:n==="string"?(r=Gp(t))?(t=r,fE):GL:t instanceof Gp?fE:t instanceof Date?Ese:Sse(t)?xse:Array.isArray(t)?wse:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Cse:lu)(e,t)}var YI=180/Math.PI,TR={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function UL(e,t,n,r,a,l){var u,d,h;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(h=e*n+t*r)&&(n-=e*h,r-=t*h),(d=Math.sqrt(n*n+r*r))&&(n/=d,r/=d,h/=d),e*r<t*n&&(e=-e,t=-t,h=-h,u=-u),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*YI,skewX:Math.atan(h)*YI,scaleX:u,scaleY:d}}var i2;function Tse(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?TR:UL(t.a,t.b,t.c,t.d,t.e,t.f)}function Rse(e){return e==null||(i2||(i2=document.createElementNS("http://www.w3.org/2000/svg","g")),i2.setAttribute("transform",e),!(e=i2.transform.baseVal.consolidate()))?TR:(e=e.matrix,UL(e.a,e.b,e.c,e.d,e.e,e.f))}function $L(e,t,n,r){function a(m){return m.length?m.pop()+" ":""}function l(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push("translate(",null,t,null,n);A.push({i:E-4,x:lu(m,v)},{i:E-2,x:lu(y,S)})}else(v||S)&&w.push("translate("+v+t+S+n)}function u(m,y,v,S){m!==y?(m-y>180?y+=360:y-m>180&&(m+=360),S.push({i:v.push(a(v)+"rotate(",null,r)-2,x:lu(m,y)})):y&&v.push(a(v)+"rotate("+y+r)}function d(m,y,v,S){m!==y?S.push({i:v.push(a(v)+"skewX(",null,r)-2,x:lu(m,y)}):y&&v.push(a(v)+"skewX("+y+r)}function h(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push(a(w)+"scale(",null,",",null,")");A.push({i:E-4,x:lu(m,v)},{i:E-2,x:lu(y,S)})}else(v!==1||S!==1)&&w.push(a(w)+"scale("+v+","+S+")")}return function(m,y){var v=[],S=[];return m=e(m),y=e(y),l(m.translateX,m.translateY,y.translateX,y.translateY,v,S),u(m.rotate,y.rotate,v,S),d(m.skewX,y.skewX,v,S),h(m.scaleX,m.scaleY,y.scaleX,y.scaleY,v,S),m=y=null,function(w){for(var A=-1,E=S.length,R;++A<E;)v[(R=S[A]).i]=R.x(w);return v.join("")}}}var kse=$L(Tse,"px, ","px)","deg)"),Ose=$L(Rse,", ",")",")"),Mse=1e-12;function ZI(e){return((e=Math.exp(e))+1/e)/2}function Nse(e){return((e=Math.exp(e))-1/e)/2}function Dse(e){return((e=Math.exp(2*e))-1)/(e+1)}const D2=function e(t,n,r){function a(l,u){var d=l[0],h=l[1],m=l[2],y=u[0],v=u[1],S=u[2],w=y-d,A=v-h,E=w*w+A*A,R,k;if(E<Mse)k=Math.log(S/m)/t,R=function(G){return[d+G*w,h+G*A,m*Math.exp(t*G*k)]};else{var D=Math.sqrt(E),M=(S*S-m*m+r*E)/(2*m*n*D),I=(S*S-m*m-r*E)/(2*S*n*D),L=Math.log(Math.sqrt(M*M+1)-M),P=Math.log(Math.sqrt(I*I+1)-I);k=(P-L)/t,R=function(G){var $=G*k,Z=ZI(L),j=m/(n*D)*(Z*Dse(t*$+L)-Nse(L));return[d+j*w,h+j*A,m*Z/ZI(t*$+L)]}}return R.duration=k*1e3*t/Math.SQRT2,R}return a.rho=function(l){var u=Math.max(.001,+l),d=u*u,h=d*d;return e(u,d,h)},a}(Math.SQRT2,2,4);var n0=0,T1=0,m1=0,XL=1e3,dE,R1,hE=0,Up=0,_C=0,tx=typeof performance=="object"&&performance.now?performance:Date,YL=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function SO(){return Up||(YL(Ise),Up=tx.now()+_C)}function Ise(){Up=0}function pE(){this._call=this._time=this._next=null}pE.prototype=ZL.prototype={constructor:pE,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?SO():+n)+(t==null?0:+t),!this._next&&R1!==this&&(R1?R1._next=this:dE=this,R1=this),this._call=e,this._time=n,RR()},stop:function(){this._call&&(this._call=null,this._time=1/0,RR())}};function ZL(e,t,n){var r=new pE;return r.restart(e,t,n),r}function zse(){SO(),++n0;for(var e=dE,t;e;)(t=Up-e._time)>=0&&e._call.call(void 0,t),e=e._next;--n0}function WI(){Up=(hE=tx.now())+_C,n0=T1=0;try{zse()}finally{n0=0,Bse(),Up=0}}function jse(){var e=tx.now(),t=e-hE;t>XL&&(_C-=t,hE=e)}function Bse(){for(var e,t=dE,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:dE=n);R1=e,RR(r)}function RR(e){if(!n0){T1&&(T1=clearTimeout(T1));var t=e-Up;t>24?(e<1/0&&(T1=setTimeout(WI,e-tx.now()-_C)),m1&&(m1=clearInterval(m1))):(m1||(hE=tx.now(),m1=setInterval(jse,XL)),n0=1,YL(WI))}}function qI(e,t,n){var r=new pE;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var Lse=EC("start","end","cancel","interrupt"),Pse=[],WL=0,JI=1,kR=2,I2=3,QI=4,OR=5,z2=6;function AC(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;Hse(e,n,{name:t,index:r,group:a,on:Lse,tween:Pse,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:WL})}function wO(e,t){var n=ss(e,t);if(n.state>WL)throw new Error("too late; already scheduled");return n}function Su(e,t){var n=ss(e,t);if(n.state>I2)throw new Error("too late; already running");return n}function ss(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Hse(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=ZL(l,0,n.time);function l(m){n.state=JI,n.timer.restart(u,n.delay,n.time),n.delay<=m&&u(m-n.delay)}function u(m){var y,v,S,w;if(n.state!==JI)return h();for(y in r)if(w=r[y],w.name===n.name){if(w.state===I2)return qI(u);w.state===QI?(w.state=z2,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[y]):+y<t&&(w.state=z2,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[y])}if(qI(function(){n.state===I2&&(n.state=QI,n.timer.restart(d,n.delay,n.time),d(m))}),n.state=kR,n.on.call("start",e,e.__data__,n.index,n.group),n.state===kR){for(n.state=I2,a=new Array(S=n.tween.length),y=0,v=-1;y<S;++y)(w=n.tween[y].value.call(e,e.__data__,n.index,n.group))&&(a[++v]=w);a.length=v+1}}function d(m){for(var y=m<n.duration?n.ease.call(null,m/n.duration):(n.timer.restart(h),n.state=OR,1),v=-1,S=a.length;++v<S;)a[v].call(e,y);n.state===OR&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=z2,n.timer.stop(),delete r[t];for(var m in r)return;delete e.__transition}}function j2(e,t){var n=e.__transition,r,a,l=!0,u;if(n){t=t==null?null:t+"";for(u in n){if((r=n[u]).name!==t){l=!1;continue}a=r.state>kR&&r.state<OR,r.state=z2,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[u]}l&&delete e.__transition}}function Vse(e){return this.each(function(){j2(this,e)})}function Fse(e,t){var n,r;return function(){var a=Su(this,e),l=a.tween;if(l!==n){r=n=l;for(var u=0,d=r.length;u<d;++u)if(r[u].name===t){r=r.slice(),r.splice(u,1);break}}a.tween=r}}function Gse(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=Su(this,e),u=l.tween;if(u!==r){a=(r=u).slice();for(var d={name:t,value:n},h=0,m=a.length;h<m;++h)if(a[h].name===t){a[h]=d;break}h===m&&a.push(d)}l.tween=a}}function Use(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ss(this.node(),n).tween,a=0,l=r.length,u;a<l;++a)if((u=r[a]).name===e)return u.value;return null}return this.each((t==null?Fse:Gse)(n,e,t))}function EO(e,t,n){var r=e._id;return e.each(function(){var a=Su(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return ss(a,r).value[t]}}function qL(e,t){var n;return(typeof t=="number"?lu:t instanceof Gp?fE:(n=Gp(t))?(t=n,fE):GL)(e,t)}function $se(e){return function(){this.removeAttribute(e)}}function Xse(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Yse(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttribute(e);return u===a?null:u===r?l:l=t(r=u,n)}}function Zse(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===a?null:u===r?l:l=t(r=u,n)}}function Wse(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function qse(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function Jse(e,t){var n=CC(e),r=n==="transform"?Ose:qL;return this.attrTween(e,typeof t=="function"?(n.local?qse:Wse)(n,r,EO(this,"attr."+e,t)):t==null?(n.local?Xse:$se)(n):(n.local?Zse:Yse)(n,r,t))}function Qse(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Kse(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function eue(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&Kse(e,l)),n}return a._value=t,a}function tue(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&Qse(e,l)),n}return a._value=t,a}function nue(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 new Error;var r=CC(e);return this.tween(n,(r.local?eue:tue)(r,t))}function rue(e,t){return function(){wO(this,e).delay=+t.apply(this,arguments)}}function oue(e,t){return t=+t,function(){wO(this,e).delay=t}}function aue(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rue:oue)(t,e)):ss(this.node(),t).delay}function iue(e,t){return function(){Su(this,e).duration=+t.apply(this,arguments)}}function lue(e,t){return t=+t,function(){Su(this,e).duration=t}}function sue(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iue:lue)(t,e)):ss(this.node(),t).duration}function uue(e,t){if(typeof t!="function")throw new Error;return function(){Su(this,e).ease=t}}function cue(e){var t=this._id;return arguments.length?this.each(uue(t,e)):ss(this.node(),t).ease}function fue(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Su(this,e).ease=n}}function due(e){if(typeof e!="function")throw new Error;return this.each(fue(this._id,e))}function hue(e){typeof e!="function"&&(e=TL(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new Zc(r,this._parents,this._name,this._id)}function pue(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,l=Math.min(r,a),u=new Array(r),d=0;d<l;++d)for(var h=t[d],m=n[d],y=h.length,v=u[d]=new Array(y),S,w=0;w<y;++w)(S=h[w]||m[w])&&(v[w]=S);for(;d<r;++d)u[d]=t[d];return new Zc(u,this._parents,this._name,this._id)}function mue(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function gue(e,t,n){var r,a,l=mue(t)?wO:Su;return function(){var u=l(this,e),d=u.on;d!==r&&(a=(r=d).copy()).on(t,n),u.on=a}}function yue(e,t){var n=this._id;return arguments.length<2?ss(this.node(),n).on.on(e):this.each(gue(n,e,t))}function vue(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function bue(){return this.on("end.remove",vue(this._id))}function xue(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yO(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u<a;++u)for(var d=r[u],h=d.length,m=l[u]=new Array(h),y,v,S=0;S<h;++S)(y=d[S])&&(v=e.call(y,y.__data__,S,d))&&("__data__"in y&&(v.__data__=y.__data__),m[S]=v,AC(m[S],t,n,S,m,ss(y,n)));return new Zc(l,this._parents,t,n)}function Sue(e){var t=this._name,n=this._id;typeof e!="function"&&(e=AL(e));for(var r=this._groups,a=r.length,l=[],u=[],d=0;d<a;++d)for(var h=r[d],m=h.length,y,v=0;v<m;++v)if(y=h[v]){for(var S=e.call(y,y.__data__,v,h),w,A=ss(y,n),E=0,R=S.length;E<R;++E)(w=S[E])&&AC(w,t,n,E,S,A);l.push(S),u.push(y)}return new Zc(l,u,t,n)}var wue=kx.prototype.constructor;function Eue(){return new wue(this._groups,this._parents)}function Cue(e,t){var n,r,a;return function(){var l=t0(this,e),u=(this.style.removeProperty(e),t0(this,e));return l===u?null:l===n&&u===r?a:a=t(n=l,r=u)}}function JL(e){return function(){this.style.removeProperty(e)}}function _ue(e,t,n){var r,a=n+"",l;return function(){var u=t0(this,e);return u===a?null:u===r?l:l=t(r=u,n)}}function Aue(e,t,n){var r,a,l;return function(){var u=t0(this,e),d=n(this),h=d+"";return d==null&&(h=d=(this.style.removeProperty(e),t0(this,e))),u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d))}}function Tue(e,t){var n,r,a,l="style."+t,u="end."+l,d;return function(){var h=Su(this,e),m=h.on,y=h.value[l]==null?d||(d=JL(t)):void 0;(m!==n||a!==y)&&(r=(n=m).copy()).on(u,a=y),h.on=r}}function Rue(e,t,n){var r=(e+="")=="transform"?kse:qL;return t==null?this.styleTween(e,Cue(e,r)).on("end.style."+e,JL(e)):typeof t=="function"?this.styleTween(e,Aue(e,r,EO(this,"style."+e,t))).each(Tue(this._id,e)):this.styleTween(e,_ue(e,r,t),n).on("end.style."+e,null)}function kue(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Oue(e,t,n){var r,a;function l(){var u=t.apply(this,arguments);return u!==a&&(r=(a=u)&&kue(e,u,n)),r}return l._value=t,l}function Mue(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 new Error;return this.tween(r,Oue(e,t,n??""))}function Nue(e){return function(){this.textContent=e}}function Due(e){return function(){var t=e(this);this.textContent=t??""}}function Iue(e){return this.tween("text",typeof e=="function"?Due(EO(this,"text",e)):Nue(e==null?"":e+""))}function zue(e){return function(t){this.textContent=e.call(this,t)}}function jue(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&zue(a)),t}return r._value=e,r}function Bue(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 new Error;return this.tween(t,jue(e))}function Lue(){for(var e=this._name,t=this._id,n=QL(),r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)if(h=u[m]){var y=ss(h,t);AC(h,e,n,m,u,{time:y.time+y.delay+y.duration,delay:0,duration:y.duration,ease:y.ease})}return new Zc(r,this._parents,e,n)}function Pue(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(l,u){var d={value:u},h={value:function(){--a===0&&l()}};n.each(function(){var m=Su(this,r),y=m.on;y!==e&&(t=(e=y).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(h)),m.on=t}),a===0&&l()})}var Hue=0;function Zc(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function QL(){return++Hue}var Dc=kx.prototype;Zc.prototype={constructor:Zc,select:xue,selectAll:Sue,selectChild:Dc.selectChild,selectChildren:Dc.selectChildren,filter:hue,merge:pue,selection:Eue,transition:Lue,call:Dc.call,nodes:Dc.nodes,node:Dc.node,size:Dc.size,empty:Dc.empty,each:Dc.each,on:yue,attr:Jse,attrTween:nue,style:Rue,styleTween:Mue,text:Iue,textTween:Bue,remove:bue,tween:Use,delay:aue,duration:sue,ease:cue,easeVarying:due,end:Pue,[Symbol.iterator]:Dc[Symbol.iterator]};function Vue(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Fue={time:null,delay:0,duration:250,ease:Vue};function Gue(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Uue(e){var t,n;e instanceof Zc?(t=e._id,e=e._name):(t=QL(),(n=Fue).time=SO(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&AC(h,e,t,m,u,n||Gue(h,t));return new Zc(r,this._parents,e,t)}kx.prototype.interrupt=Vse;kx.prototype.transition=Uue;const l2=e=>()=>e;function $ue(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){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:a}})}function Lc(e,t,n){this.k=e,this.x=t,this.y=n}Lc.prototype={constructor:Lc,scale:function(e){return e===1?this:new Lc(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Lc(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 TC=new Lc(1,0,0);KL.prototype=Lc.prototype;function KL(e){for(;!e.__zoom;)if(!(e=e.parentNode))return TC;return e.__zoom}function sT(e){e.stopImmediatePropagation()}function g1(e){e.preventDefault(),e.stopImmediatePropagation()}function Xue(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Yue(){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 KI(){return this.__zoom||TC}function Zue(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Wue(){return navigator.maxTouchPoints||"ontouchstart"in this}function que(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function eP(){var e=Xue,t=Yue,n=que,r=Zue,a=Wue,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=D2,m=EC("start","zoom","end"),y,v,S,w=500,A=150,E=0,R=10;function k(U){U.property("__zoom",KI).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",j).filter(a).on("touchstart.zoom",X).on("touchmove.zoom",ee).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(U,te,V,W){var J=U.selection?U.selection():U;J.property("__zoom",KI),U!==J?L(U,te,V,W):J.interrupt().each(function(){P(this,arguments).event(W).start().zoom(null,typeof te=="function"?te.apply(this,arguments):te).end()})},k.scaleBy=function(U,te,V,W){k.scaleTo(U,function(){var J=this.__zoom.k,ne=typeof te=="function"?te.apply(this,arguments):te;return J*ne},V,W)},k.scaleTo=function(U,te,V,W){k.transform(U,function(){var J=t.apply(this,arguments),ne=this.__zoom,B=V==null?I(J):typeof V=="function"?V.apply(this,arguments):V,oe=ne.invert(B),se=typeof te=="function"?te.apply(this,arguments):te;return n(M(D(ne,se),B,oe),J,u)},V,W)},k.translateBy=function(U,te,V,W){k.transform(U,function(){return n(this.__zoom.translate(typeof te=="function"?te.apply(this,arguments):te,typeof V=="function"?V.apply(this,arguments):V),t.apply(this,arguments),u)},null,W)},k.translateTo=function(U,te,V,W,J){k.transform(U,function(){var ne=t.apply(this,arguments),B=this.__zoom,oe=W==null?I(ne):typeof W=="function"?W.apply(this,arguments):W;return n(TC.translate(oe[0],oe[1]).scale(B.k).translate(typeof te=="function"?-te.apply(this,arguments):-te,typeof V=="function"?-V.apply(this,arguments):-V),ne,u)},W,J)};function D(U,te){return te=Math.max(l[0],Math.min(l[1],te)),te===U.k?U:new Lc(te,U.x,U.y)}function M(U,te,V){var W=te[0]-V[0]*U.k,J=te[1]-V[1]*U.k;return W===U.x&&J===U.y?U:new Lc(U.k,W,J)}function I(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function L(U,te,V,W){U.on("start.zoom",function(){P(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(W).end()}).tween("zoom",function(){var J=this,ne=arguments,B=P(J,ne).event(W),oe=t.apply(J,ne),se=V==null?I(oe):typeof V=="function"?V.apply(J,ne):V,Y=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),he=J.__zoom,Te=typeof te=="function"?te.apply(J,ne):te,me=h(he.invert(se).concat(Y/he.k),Te.invert(se).concat(Y/Te.k));return function(Ee){if(Ee===1)Ee=Te;else{var xe=me(Ee),Be=Y/xe[2];Ee=new Lc(Be,se[0]-xe[0]*Be,se[1]-xe[1]*Be)}B.zoom(null,Ee)}})}function P(U,te,V){return!V&&U.__zooming||new G(U,te)}function G(U,te){this.that=U,this.args=te,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,te),this.taps=0}G.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,te){return this.mouse&&U!=="mouse"&&(this.mouse[1]=te.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=te.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=te.invert(this.touch1[0])),this.that.__zoom=te,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var te=ti(this.that).datum();m.call(U,this.that,new $ue(U,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:m}),te)}};function $(U,...te){if(!e.apply(this,arguments))return;var V=P(this,te).event(U),W=this.__zoom,J=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,r.apply(this,arguments)))),ne=Wl(U);if(V.wheel)(V.mouse[0][0]!==ne[0]||V.mouse[0][1]!==ne[1])&&(V.mouse[1]=W.invert(V.mouse[0]=ne)),clearTimeout(V.wheel);else{if(W.k===J)return;V.mouse=[ne,W.invert(ne)],j2(this),V.start()}g1(U),V.wheel=setTimeout(B,A),V.zoom("mouse",n(M(D(W,J),V.mouse[0],V.mouse[1]),V.extent,u));function B(){V.wheel=null,V.end()}}function Z(U,...te){if(S||!e.apply(this,arguments))return;var V=U.currentTarget,W=P(this,te,!0).event(U),J=ti(U.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",Y,!0),ne=Wl(U,V),B=U.clientX,oe=U.clientY;BL(U.view),sT(U),W.mouse=[ne,this.__zoom.invert(ne)],j2(this),W.start();function se(he){if(g1(he),!W.moved){var Te=he.clientX-B,me=he.clientY-oe;W.moved=Te*Te+me*me>E}W.event(he).zoom("mouse",n(M(W.that.__zoom,W.mouse[0]=Wl(he,V),W.mouse[1]),W.extent,u))}function Y(he){J.on("mousemove.zoom mouseup.zoom",null),LL(he.view,W.moved),g1(he),W.event(he).end()}}function j(U,...te){if(e.apply(this,arguments)){var V=this.__zoom,W=Wl(U.changedTouches?U.changedTouches[0]:U,this),J=V.invert(W),ne=V.k*(U.shiftKey?.5:2),B=n(M(D(V,ne),W,J),t.apply(this,te),u);g1(U),d>0?ti(this).transition().duration(d).call(L,B,W,U):ti(this).call(k.transform,B,W,U)}}function X(U,...te){if(e.apply(this,arguments)){var V=U.touches,W=V.length,J=P(this,te,U.changedTouches.length===W).event(U),ne,B,oe,se;for(sT(U),B=0;B<W;++B)oe=V[B],se=Wl(oe,this),se=[se,this.__zoom.invert(se),oe.identifier],J.touch0?!J.touch1&&J.touch0[2]!==se[2]&&(J.touch1=se,J.taps=0):(J.touch0=se,ne=!0,J.taps=1+!!y);y&&(y=clearTimeout(y)),ne&&(J.taps<2&&(v=se[0],y=setTimeout(function(){y=null},w)),j2(this),J.start())}}function ee(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,J=W.length,ne,B,oe,se;for(g1(U),ne=0;ne<J;++ne)B=W[ne],oe=Wl(B,this),V.touch0&&V.touch0[2]===B.identifier?V.touch0[0]=oe:V.touch1&&V.touch1[2]===B.identifier&&(V.touch1[0]=oe);if(B=V.that.__zoom,V.touch1){var Y=V.touch0[0],he=V.touch0[1],Te=V.touch1[0],me=V.touch1[1],Ee=(Ee=Te[0]-Y[0])*Ee+(Ee=Te[1]-Y[1])*Ee,xe=(xe=me[0]-he[0])*xe+(xe=me[1]-he[1])*xe;B=D(B,Math.sqrt(Ee/xe)),oe=[(Y[0]+Te[0])/2,(Y[1]+Te[1])/2],se=[(he[0]+me[0])/2,(he[1]+me[1])/2]}else if(V.touch0)oe=V.touch0[0],se=V.touch0[1];else return;V.zoom("touch",n(M(B,oe,se),V.extent,u))}}function ae(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,J=W.length,ne,B;for(sT(U),S&&clearTimeout(S),S=setTimeout(function(){S=null},w),ne=0;ne<J;++ne)B=W[ne],V.touch0&&V.touch0[2]===B.identifier?delete V.touch0:V.touch1&&V.touch1[2]===B.identifier&&delete V.touch1;if(V.touch1&&!V.touch0&&(V.touch0=V.touch1,delete V.touch1),V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2&&(B=Wl(B,this),Math.hypot(v[0]-B[0],v[1]-B[1])<R)){var oe=ti(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return k.wheelDelta=function(U){return arguments.length?(r=typeof U=="function"?U:l2(+U),k):r},k.filter=function(U){return arguments.length?(e=typeof U=="function"?U:l2(!!U),k):e},k.touchable=function(U){return arguments.length?(a=typeof U=="function"?U:l2(!!U),k):a},k.extent=function(U){return arguments.length?(t=typeof U=="function"?U:l2([[+U[0][0],+U[0][1]],[+U[1][0],+U[1][1]]]),k):t},k.scaleExtent=function(U){return arguments.length?(l[0]=+U[0],l[1]=+U[1],k):[l[0],l[1]]},k.translateExtent=function(U){return arguments.length?(u[0][0]=+U[0][0],u[1][0]=+U[1][0],u[0][1]=+U[0][1],u[1][1]=+U[1][1],k):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},k.constrain=function(U){return arguments.length?(n=U,k):n},k.duration=function(U){return arguments.length?(d=+U,k):d},k.interpolate=function(U){return arguments.length?(h=U,k):h},k.on=function(){var U=m.on.apply(m,arguments);return U===m?k:U},k.clickDistance=function(U){return arguments.length?(E=(U=+U)*U,k):Math.sqrt(E)},k.tapDistance=function(U){return arguments.length?(R=+U,k):R},k}const li={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."},nx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],tP=["Enter"," ","Escape"],nP={"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"};var r0;(function(e){e.Strict="strict",e.Loose="loose"})(r0||(r0={}));var zp;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(zp||(zp={}));var rx;(function(e){e.Partial="partial",e.Full="full"})(rx||(rx={}));const rP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Td;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Td||(Td={}));var mE;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mE||(mE={}));var at;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(at||(at={}));const e5={[at.Left]:at.Right,[at.Right]:at.Left,[at.Top]:at.Bottom,[at.Bottom]:at.Top};function oP(e){return e===null?null:e?"valid":"invalid"}const aP=e=>"id"in e&&"source"in e&&"target"in e,Jue=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),CO=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Mx=(e,t=[0,0])=>{const{width:n,height:r}=ef(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},Que=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):CO(a)?a:t.nodeLookup.get(a.id));const d=u?gE(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return RC(r,d)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return kC(n)},Nx=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const a=gE(r);n=RC(n,a)}}),kC(n)},_O=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const d={...Dx(t,[n,r,a]),width:t.width/a,height:t.height/a},h=[];for(const m of e.values()){const{measured:y,selectable:v=!0,hidden:S=!1}=m;if(u&&!v||S)continue;const w=y.width??m.width??m.initialWidth??null,A=y.height??m.height??m.initialHeight??null,E=ox(d,a0(m)),R=(w??0)*(A??0),k=l&&E>0;(!m.internals.handleBounds||k||E>=R||m.dragging)&&h.push(m)}return h},Kue=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function ece(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&(t?.includeHiddenNodes||!a.hidden)&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function tce({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return Promise.resolve(!0);const d=ece(e,u),h=Nx(d),m=AO(h,t,n,u?.minZoom??a,u?.maxZoom??l,u?.padding??.1);return await r.setViewport(m,{duration:u?.duration,ease:u?.ease,interpolate:u?.interpolate}),Promise.resolve(!0)}function iP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),d=u.parentId?n.get(u.parentId):void 0,{x:h,y:m}=d?d.internals.positionAbsolute:{x:0,y:0},y=u.origin??r;let v=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!d)l?.("005",li.error005());else{const w=d.measured.width,A=d.measured.height;w&&A&&(v=[[h,m],[h+w,m+A]])}else d&&i0(u.extent)&&(v=[[u.extent[0][0]+h,u.extent[0][1]+m],[u.extent[1][0]+h,u.extent[1][1]+m]]);const S=i0(v)?$p(t,v,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&l?.("015",li.error015()),{position:{x:S.x-h+(u.measured.width??0)*y[0],y:S.y-m+(u.measured.height??0)*y[1]},positionAbsolute:S}}async function nce({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(S=>S.id)),u=[];for(const S of n){if(S.deletable===!1)continue;const w=l.has(S.id),A=!w&&S.parentId&&u.find(E=>E.id===S.parentId);(w||A)&&u.push(S)}const d=new Set(t.map(S=>S.id)),h=r.filter(S=>S.deletable!==!1),y=Kue(u,h);for(const S of h)d.has(S.id)&&!y.find(A=>A.id===S.id)&&y.push(S);if(!a)return{edges:y,nodes:u};const v=await a({nodes:u,edges:y});return typeof v=="boolean"?v?{edges:y,nodes:u}:{edges:[],nodes:[]}:v}const o0=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),$p=(e={x:0,y:0},t,n)=>({x:o0(e.x,t[0][0],t[1][0]-(n?.width??0)),y:o0(e.y,t[0][1],t[1][1]-(n?.height??0))});function lP(e,t,n){const{width:r,height:a}=ef(n),{x:l,y:u}=n.internals.positionAbsolute;return $p(e,[[l,u],[l+r,u+a]],t)}const t5=(e,t,n)=>e<t?o0(Math.abs(e-t),1,t)/t:e>n?-o0(Math.abs(e-n),1,t)/t:0,sP=(e,t,n=15,r=40)=>{const a=t5(e.x,r,t.width-r)*n,l=t5(e.y,r,t.height-r)*n;return[a,l]},RC=(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)}),MR=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),kC=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),a0=(e,t=[0,0])=>{const{x:n,y:r}=CO(e)?e.internals.positionAbsolute:Mx(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}},gE=(e,t=[0,0])=>{const{x:n,y:r}=CO(e)?e.internals.positionAbsolute:Mx(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)}},uP=(e,t)=>kC(RC(MR(e),MR(t))),ox=(e,t)=>{const 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)},n5=e=>Kl(e.width)&&Kl(e.height)&&Kl(e.x)&&Kl(e.y),Kl=e=>!isNaN(e)&&isFinite(e),cP=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},OC=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Dx=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const d={x:(e-n)/a,y:(t-r)/a};return l?OC(d,u):d},yE=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Oy(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const 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 rce(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Oy(e,n),a=Oy(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Oy(e.top??e.y??0,n),a=Oy(e.bottom??e.y??0,n),l=Oy(e.left??e.x??0,t),u=Oy(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function oce(e,t,n,r,a,l){const{x:u,y:d}=yE(e,[t,n,r]),{x:h,y:m}=yE({x:e.x+e.width,y:e.y+e.height},[t,n,r]),y=a-h,v=l-m;return{left:Math.floor(u),top:Math.floor(d),right:Math.floor(y),bottom:Math.floor(v)}}const AO=(e,t,n,r,a,l)=>{const u=rce(l,t,n),d=(t-u.x)/e.width,h=(n-u.y)/e.height,m=Math.min(d,h),y=o0(m,r,a),v=e.x+e.width/2,S=e.y+e.height/2,w=t/2-v*y,A=n/2-S*y,E=oce(e,w,A,y,t,n),R={left:Math.min(E.left-u.left,0),top:Math.min(E.top-u.top,0),right:Math.min(E.right-u.right,0),bottom:Math.min(E.bottom-u.bottom,0)};return{x:w-R.left+R.right,y:A-R.top+R.bottom,zoom:y}},vE=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function i0(e){return e!==void 0&&e!=="parent"}function ef(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function fP(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function dP(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const d=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*d[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*d[1]}return l}function r5(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ace(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function ice(e){return{...nP,...e||{}}}function I1(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=fu(e),d=Dx({x:l-(a?.left??0),y:u-(a?.top??0)},r),{x:h,y:m}=n?OC(d,t):d;return{xSnapped:h,ySnapped:m,...d}}const TO=e=>({width:e.offsetWidth,height:e.offsetHeight}),hP=e=>e?.getRootNode?.()||window?.document,lce=["INPUT","SELECT","TEXTAREA"];function pP(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:lce.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const mP=e=>"clientX"in e,fu=(e,t)=>{const n=mP(e),r=n?e.clientX:e.touches?.[0].clientX,a=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:a-(t?.top??0)}},o5=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const d=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(d.left-n.left)/r,y:(d.top-n.top)/r,...TO(u)}})};function gP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d}){const h=e*.125+a*.375+u*.375+n*.125,m=t*.125+l*.375+d*.375+r*.125,y=Math.abs(h-e),v=Math.abs(m-t);return[h,m,y,v]}function s2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function a5({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case at.Left:return[t-s2(t-r,l),n];case at.Right:return[t+s2(r-t,l),n];case at.Top:return[t,n-s2(n-a,l)];case at.Bottom:return[t,n+s2(a-n,l)]}}function RO({sourceX:e,sourceY:t,sourcePosition:n=at.Bottom,targetX:r,targetY:a,targetPosition:l=at.Top,curvature:u=.25}){const[d,h]=a5({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[m,y]=a5({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[v,S,w,A]=gP({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:m,targetControlY:y});return[`M${e},${t} C${d},${h} ${m},${y} ${r},${a}`,v,S,w,A]}function yP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,u=Math.abs(r-t)/2,d=r<t?r+u:r-u;return[l,d,a,u]}function sce({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:a=!1}){if(r!==void 0)return r;const l=a&&n?1e3:0,u=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return l+u}function uce({sourceNode:e,targetNode:t,width:n,height:r,transform:a}){const l=RC(gE(e),gE(t));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u={x:-a[0]/a[2],y:-a[1]/a[2],width:n/a[2],height:r/a[2]};return ox(u,kC(l))>0}const cce=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,fce=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),dce=(e,t)=>{if(!e.source||!e.target)return cP("006",li.error006()),t;let n;return aP(e)?n={...e}:n={...e,id:cce(e)},fce(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function vP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,d]=yP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,d]}const i5={[at.Left]:{x:-1,y:0},[at.Right]:{x:1,y:0},[at.Top]:{x:0,y:-1},[at.Bottom]:{x:0,y:1}},hce=({source:e,sourcePosition:t=at.Bottom,target:n})=>t===at.Left||t===at.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},l5=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function pce({source:e,sourcePosition:t=at.Bottom,target:n,targetPosition:r=at.Top,center:a,offset:l,stepPosition:u}){const d=i5[t],h=i5[r],m={x:e.x+d.x*l,y:e.y+d.y*l},y={x:n.x+h.x*l,y:n.y+h.y*l},v=hce({source:m,sourcePosition:t,target:y}),S=v.x!==0?"x":"y",w=v[S];let A=[],E,R;const k={x:0,y:0},D={x:0,y:0},[,,M,I]=yP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(d[S]*h[S]===-1){S==="x"?(E=a.x??m.x+(y.x-m.x)*u,R=a.y??(m.y+y.y)/2):(E=a.x??(m.x+y.x)/2,R=a.y??m.y+(y.y-m.y)*u);const P=[{x:E,y:m.y},{x:E,y:y.y}],G=[{x:m.x,y:R},{x:y.x,y:R}];d[S]===w?A=S==="x"?P:G:A=S==="x"?G:P}else{const P=[{x:m.x,y:y.y}],G=[{x:y.x,y:m.y}];if(S==="x"?A=d.x===w?G:P:A=d.y===w?P:G,t===r){const ee=Math.abs(e[S]-n[S]);if(ee<=l){const ae=Math.min(l-1,l-ee);d[S]===w?k[S]=(m[S]>e[S]?-1:1)*ae:D[S]=(y[S]>n[S]?-1:1)*ae}}if(t!==r){const ee=S==="x"?"y":"x",ae=d[S]===h[ee],U=m[ee]>y[ee],te=m[ee]<y[ee];(d[S]===1&&(!ae&&U||ae&&te)||d[S]!==1&&(!ae&&te||ae&&U))&&(A=S==="x"?P:G)}const $={x:m.x+k.x,y:m.y+k.y},Z={x:y.x+D.x,y:y.y+D.y},j=Math.max(Math.abs($.x-A[0].x),Math.abs(Z.x-A[0].x)),X=Math.max(Math.abs($.y-A[0].y),Math.abs(Z.y-A[0].y));j>=X?(E=($.x+Z.x)/2,R=A[0].y):(E=A[0].x,R=($.y+Z.y)/2)}return[[e,{x:m.x+k.x,y:m.y+k.y},...A,{x:y.x+D.x,y:y.y+D.y},n],E,R,M,I]}function mce(e,t,n,r){const a=Math.min(l5(e,t)/2,l5(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const m=e.x<n.x?-1:1,y=e.y<n.y?1:-1;return`L ${l+a*m},${u}Q ${l},${u} ${l},${u+a*y}`}const d=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${l},${u+a*h}Q ${l},${u} ${l+a*d},${u}`}function NR({sourceX:e,sourceY:t,sourcePosition:n=at.Bottom,targetX:r,targetY:a,targetPosition:l=at.Top,borderRadius:u=5,centerX:d,centerY:h,offset:m=20,stepPosition:y=.5}){const[v,S,w,A,E]=pce({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:d,y:h},offset:m,stepPosition:y});return[v.reduce((k,D,M)=>{let I="";return M>0&&M<v.length-1?I=mce(v[M-1],D,v[M+1],u):I=`${M===0?"M":"L"}${D.x} ${D.y}`,k+=I,k},""),S,w,A,E]}function s5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function gce(e){const{sourceNode:t,targetNode:n}=e;if(!s5(t)||!s5(n))return null;const r=t.internals.handleBounds||u5(t.handles),a=n.internals.handleBounds||u5(n.handles),l=c5(r?.source??[],e.sourceHandle),u=c5(e.connectionMode===r0.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),e.targetHandle);if(!l||!u)return e.onError?.("008",li.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const d=l?.position||at.Bottom,h=u?.position||at.Top,m=ax(t,l,d),y=ax(n,u,h);return{sourceX:m.x,sourceY:m.y,targetX:y.x,targetY:y.y,sourcePosition:d,targetPosition:h}}function u5(e){if(!e)return null;const t=[],n=[];for(const 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 ax(e,t,n=at.Left,r=!1){const a=(t?.x??0)+e.internals.positionAbsolute.x,l=(t?.y??0)+e.internals.positionAbsolute.y,{width:u,height:d}=t??ef(e);if(r)return{x:a+u/2,y:l+d/2};switch(t?.position??n){case at.Top:return{x:a+u/2,y:l};case at.Right:return{x:a+u,y:l+d/2};case at.Bottom:return{x:a+u/2,y:l+d};case at.Left:return{x:a,y:l+d/2}}}function c5(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function DR(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function yce(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,d)=>([d.markerStart||r,d.markerEnd||a].forEach(h=>{if(h&&typeof h=="object"){const m=DR(h,t);l.has(m)||(u.push({id:m,color:h.color||n,...h}),l.add(m))}}),u),[]).sort((u,d)=>u.id.localeCompare(d.id))}const kO={nodeOrigin:[0,0],nodeExtent:nx,elevateNodesOnSelect:!0,defaults:{}},vce={...kO,checkEquality:!0};function OO(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function bce(e,t,n){const r=OO(kO,n);for(const a of e.values())if(a.parentId)MO(a,e,t,r);else{const l=Mx(a,r.nodeOrigin),u=i0(a.extent)?a.extent:r.nodeExtent,d=$p(l,u,ef(a));a.internals.positionAbsolute=d}}function IR(e,t,n,r){const a=OO(vce,r);let l=e.length>0;const u=new Map(t),d=a?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const h of e){let m=u.get(h.id);if(a.checkEquality&&h===m?.internals.userNode)t.set(h.id,m);else{const y=Mx(h,a.nodeOrigin),v=i0(h.extent)?h.extent:a.nodeExtent,S=$p(y,v,ef(h));m={...a.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:S,handleBounds:h.measured?m?.internals.handleBounds:void 0,z:bP(h,d),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(l=!1),h.parentId&&MO(m,t,n,r)}return l}function xce(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function MO(e,t,n,r){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u}=OO(kO,r),d=e.parentId,h=t.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xce(e,n);const m=a?1e3:0,{x:y,y:v,z:S}=Sce(e,h,l,u,m),{positionAbsolute:w}=e.internals,A=y!==w.x||v!==w.y;(A||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:A?{x:y,y:v}:w,z:S}})}function bP(e,t){return(Kl(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Sce(e,t,n,r,a){const{x:l,y:u}=t.internals.positionAbsolute,d=ef(e),h=Mx(e,n),m=i0(e.extent)?$p(h,e.extent,d):h;let y=$p({x:l+m.x,y:u+m.y},r,d);e.extent==="parent"&&(y=lP(y,d,t));const v=bP(e,a),S=t.internals.z??0;return{x:y.x,y:y.y,z:S>=v?S+1:v}}function NO(e,t,n,r=[0,0]){const a=[],l=new Map;for(const u of e){const d=t.get(u.parentId);if(!d)continue;const h=l.get(u.parentId)?.expandedRect??a0(d),m=uP(h,u.rect);l.set(u.parentId,{expandedRect:m,parent:d})}return l.size>0&&l.forEach(({expandedRect:u,parent:d},h)=>{const m=d.internals.positionAbsolute,y=ef(d),v=d.origin??r,S=u.x<m.x?Math.round(Math.abs(m.x-u.x)):0,w=u.y<m.y?Math.round(Math.abs(m.y-u.y)):0,A=Math.max(y.width,Math.round(u.width)),E=Math.max(y.height,Math.round(u.height)),R=(A-y.width)*v[0],k=(E-y.height)*v[1];(S>0||w>0||R||k)&&(a.push({id:h,type:"position",position:{x:d.position.x-S+R,y:d.position.y-w+k}}),n.get(h)?.forEach(D=>{e.some(M=>M.id===D.id)||a.push({id:D.id,type:"position",position:{x:D.position.x+S,y:D.position.y+w}})})),(y.width<u.width||y.height<u.height||S||w)&&a.push({id:h,type:"dimensions",setAttributes:!0,dimensions:{width:A+(S?v[0]*S-R:0),height:E+(w?v[1]*w-k:0)}})}),a}function wce(e,t,n,r,a,l){const u=r?.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const h=[],m=window.getComputedStyle(u),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=[];for(const S of e.values()){const w=t.get(S.id);if(!w)continue;if(w.hidden){t.set(w.id,{...w,internals:{...w.internals,handleBounds:void 0}}),d=!0;continue}const A=TO(S.nodeElement),E=w.measured.width!==A.width||w.measured.height!==A.height;if(!!(A.width&&A.height&&(E||!w.internals.handleBounds||S.force))){const k=S.nodeElement.getBoundingClientRect(),D=i0(w.extent)?w.extent:l;let{positionAbsolute:M}=w.internals;w.parentId&&w.extent==="parent"?M=lP(M,A,t.get(w.parentId)):D&&(M=$p(M,D,A));const I={...w,measured:A,internals:{...w.internals,positionAbsolute:M,handleBounds:{source:o5("source",S.nodeElement,k,y,w.id),target:o5("target",S.nodeElement,k,y,w.id)}}};t.set(w.id,I),w.parentId&&MO(I,t,n,{nodeOrigin:a}),d=!0,E&&(h.push({id:w.id,type:"dimensions",dimensions:A}),w.expandParent&&w.parentId&&v.push({id:w.id,parentId:w.parentId,rect:a0(I,a)}))}}if(v.length>0){const S=NO(v,t,n,a);h.push(...S)}return{changes:h,updatedInternals:d}}async function Ece({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r),d=!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2]);return Promise.resolve(d)}function f5(e,t,n,r,a,l){let u=a;const d=r.get(u)||new Map;r.set(u,d.set(n,t)),u=`${a}-${e}`;const h=r.get(u)||new Map;if(r.set(u,h.set(n,t)),l){u=`${a}-${e}-${l}`;const m=r.get(u)||new Map;r.set(u,m.set(n,t))}}function xP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:d=null}=r,h={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:d},m=`${a}-${u}--${l}-${d}`,y=`${l}-${d}--${a}-${u}`;f5("source",h,y,e,a,u),f5("target",h,m,e,l,d),t.set(r.id,r)}}function SP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:SP(n,t):!1}function d5(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 Cce(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!SP(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const d=e.get(l);d&&a.set(l,{id:l,position:d.position||{x:0,y:0},distance:{x:n.x-d.internals.positionAbsolute.x,y:n.y-d.internals.positionAbsolute.y},extent:d.extent,parentId:d.parentId,origin:d.origin,expandParent:d.expandParent,internals:{positionAbsolute:d.internals.positionAbsolute||{x:0,y:0}},measured:{width:d.measured.width??0,height:d.measured.height??0}})}return a}function uT({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const a=[];for(const[u,d]of t){const h=n.get(u)?.internals.userNode;h&&a.push({...h,position:d.position,dragging:r})}if(!e)return[a[0],a];const l=n.get(e)?.internals.userNode;return[l?{...l,position:t.get(e)?.position||l.position,dragging:r}:a[0],a]}function _ce({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,d=new Map,h=!1,m={x:0,y:0},y=null,v=!1,S=null,w=!1,A=!1;function E({noDragClassName:k,handleSelector:D,domNode:M,isSelectable:I,nodeId:L,nodeClickDistance:P=0}){S=ti(M);function G({x:X,y:ee},ae){const{nodeLookup:U,nodeExtent:te,snapGrid:V,snapToGrid:W,nodeOrigin:J,onNodeDrag:ne,onSelectionDrag:B,onError:oe,updateNodePositions:se}=t();l={x:X,y:ee};let Y=!1,he={x:0,y:0,x2:0,y2:0};if(d.size>1&&te){const Te=Nx(d);he=MR(Te)}for(const[Te,me]of d){if(!U.has(Te))continue;let Ee={x:X-me.distance.x,y:ee-me.distance.y};W&&(Ee=OC(Ee,V));let xe=[[te[0][0],te[0][1]],[te[1][0],te[1][1]]];if(d.size>1&&te&&!me.extent){const{positionAbsolute:Ye}=me.internals,ke=Ye.x-he.x+te[0][0],Xe=Ye.x+me.measured.width-he.x2+te[1][0],We=Ye.y-he.y+te[0][1],_t=Ye.y+me.measured.height-he.y2+te[1][1];xe=[[ke,We],[Xe,_t]]}const{position:Be,positionAbsolute:He}=iP({nodeId:Te,nextPosition:Ee,nodeLookup:U,nodeExtent:xe,nodeOrigin:J,onError:oe});Y=Y||me.position.x!==Be.x||me.position.y!==Be.y,me.position=Be,me.internals.positionAbsolute=He}if(A=A||Y,!!Y&&(se(d,!0),ae&&(r||ne||!L&&B))){const[Te,me]=uT({nodeId:L,dragItems:d,nodeLookup:U});r?.(ae,d,Te,me),ne?.(ae,Te,me),L||B?.(ae,me)}}async function $(){if(!y)return;const{transform:X,panBy:ee,autoPanSpeed:ae,autoPanOnNodeDrag:U}=t();if(!U){h=!1,cancelAnimationFrame(u);return}const[te,V]=sP(m,y,ae);(te!==0||V!==0)&&(l.x=(l.x??0)-te/X[2],l.y=(l.y??0)-V/X[2],await ee({x:te,y:V})&&G(l,null)),u=requestAnimationFrame($)}function Z(X){const{nodeLookup:ee,multiSelectionActive:ae,nodesDraggable:U,transform:te,snapGrid:V,snapToGrid:W,selectNodesOnDrag:J,onNodeDragStart:ne,onSelectionDragStart:B,unselectNodesAndEdges:oe}=t();v=!0,(!J||!I)&&!ae&&L&&(ee.get(L)?.selected||oe()),I&&J&&L&&e?.(L);const se=I1(X.sourceEvent,{transform:te,snapGrid:V,snapToGrid:W,containerBounds:y});if(l=se,d=Cce(ee,U,se,L),d.size>0&&(n||ne||!L&&B)){const[Y,he]=uT({nodeId:L,dragItems:d,nodeLookup:ee});n?.(X.sourceEvent,d,Y,he),ne?.(X.sourceEvent,Y,he),L||B?.(X.sourceEvent,he)}}const j=PL().clickDistance(P).on("start",X=>{const{domNode:ee,nodeDragThreshold:ae,transform:U,snapGrid:te,snapToGrid:V}=t();y=ee?.getBoundingClientRect()||null,w=!1,A=!1,ae===0&&Z(X),l=I1(X.sourceEvent,{transform:U,snapGrid:te,snapToGrid:V,containerBounds:y}),m=fu(X.sourceEvent,y)}).on("drag",X=>{const{autoPanOnNodeDrag:ee,transform:ae,snapGrid:U,snapToGrid:te,nodeDragThreshold:V,nodeLookup:W}=t(),J=I1(X.sourceEvent,{transform:ae,snapGrid:U,snapToGrid:te,containerBounds:y});if((X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||L&&!W.has(L))&&(w=!0),!w){if(!h&&ee&&v&&(h=!0,$()),!v){const ne=J.xSnapped-(l.x??0),B=J.ySnapped-(l.y??0);Math.sqrt(ne*ne+B*B)>V&&Z(X)}(l.x!==J.xSnapped||l.y!==J.ySnapped)&&d&&v&&(m=fu(X.sourceEvent,y),G(J,X.sourceEvent))}}).on("end",X=>{if(!(!v||w)&&(h=!1,v=!1,cancelAnimationFrame(u),d.size>0)){const{nodeLookup:ee,updateNodePositions:ae,onNodeDragStop:U,onSelectionDragStop:te}=t();if(A&&(ae(d,!1),A=!1),a||U||!L&&te){const[V,W]=uT({nodeId:L,dragItems:d,nodeLookup:ee,dragging:!1});a?.(X.sourceEvent,d,V,W),U?.(X.sourceEvent,V,W),L||te?.(X.sourceEvent,W)}}}).filter(X=>{const ee=X.target;return!X.button&&(!k||!d5(ee,`.${k}`,M))&&(!D||d5(ee,D,M))});S.call(j)}function R(){S?.on(".drag",null)}return{update:E,destroy:R}}function Ace(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())ox(a,a0(l))>0&&r.push(l);return r}const Tce=250;function Rce(e,t,n,r){let a=[],l=1/0;const u=Ace(e,n,t+Tce);for(const d of u){const h=[...d.internals.handleBounds?.source??[],...d.internals.handleBounds?.target??[]];for(const m of h){if(r.nodeId===m.nodeId&&r.type===m.type&&r.id===m.id)continue;const{x:y,y:v}=ax(d,m,m.position,!0),S=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(v-e.y,2));S>t||(S<l?(a=[{...m,x:y,y:v}],l=S):S===l&&a.push({...m,x:y,y:v}))}}if(!a.length)return null;if(a.length>1){const d=r.type==="source"?"target":"source";return a.find(h=>h.type===d)??a[0]}return a[0]}function wP(e,t,n,r,a,l=!1){const u=r.get(e);if(!u)return null;const d=a==="strict"?u.internals.handleBounds?.[t]:[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]],h=(n?d?.find(m=>m.id===n):d?.[0])??null;return h&&l?{...h,...ax(u,h,h.position,!0)}:h}function EP(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function kce(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const CP=()=>!0;function Oce(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:d,nodeLookup:h,lib:m,autoPanOnConnect:y,flowId:v,panBy:S,cancelConnection:w,onConnectStart:A,onConnect:E,onConnectEnd:R,isValidConnection:k=CP,onReconnectEnd:D,updateConnection:M,getTransform:I,getFromHandle:L,autoPanSpeed:P,dragThreshold:G=1}){const $=hP(e.target);let Z=0,j;const{x:X,y:ee}=fu(e),ae=$?.elementFromPoint(X,ee),U=EP(l,ae),te=d?.getBoundingClientRect();let V=!1;if(!te||!U)return;const W=wP(a,U,r,h,t);if(!W)return;let J=fu(e,te),ne=!1,B=null,oe=!1,se=null;function Y(){if(!y||!te)return;const[Ye,ke]=sP(J,te,P);S({x:Ye,y:ke}),Z=requestAnimationFrame(Y)}const he={...W,nodeId:a,type:U,position:W.position},Te=h.get(a);let Ee={inProgress:!0,isValid:null,from:ax(Te,he,at.Left,!0),fromHandle:he,fromPosition:he.position,fromNode:Te,to:J,toHandle:null,toPosition:e5[he.position],toNode:null};function xe(){V=!0,M(Ee),A?.(e,{nodeId:a,handleId:r,handleType:U})}G===0&&xe();function Be(Ye){if(!V){const{x:_t,y:Kt}=fu(Ye),Wt=_t-X,qn=Kt-ee;if(!(Wt*Wt+qn*qn>G*G))return;xe()}if(!L()||!he){He(Ye);return}const ke=I();J=fu(Ye,te),j=Rce(Dx(J,ke,!1,[1,1]),n,h,he),ne||(Y(),ne=!0);const Xe=_P(Ye,{handle:j,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:k,doc:$,lib:m,flowId:v,nodeLookup:h});se=Xe.handleDomNode,B=Xe.connection,oe=kce(!!j,Xe.isValid);const We={...Ee,isValid:oe,to:Xe.toHandle&&oe?yE({x:Xe.toHandle.x,y:Xe.toHandle.y},ke):J,toHandle:Xe.toHandle,toPosition:oe&&Xe.toHandle?Xe.toHandle.position:e5[he.position],toNode:Xe.toHandle?h.get(Xe.toHandle.nodeId):null};oe&&j&&Ee.toHandle&&We.toHandle&&Ee.toHandle.type===We.toHandle.type&&Ee.toHandle.nodeId===We.toHandle.nodeId&&Ee.toHandle.id===We.toHandle.id&&Ee.to.x===We.to.x&&Ee.to.y===We.to.y||(M(We),Ee=We)}function He(Ye){if(V){(j||se)&&B&&oe&&E?.(B);const{inProgress:ke,...Xe}=Ee,We={...Xe,toPosition:Ee.toHandle?Ee.toPosition:null};R?.(Ye,We),l&&D?.(Ye,We)}w(),cancelAnimationFrame(Z),ne=!1,oe=!1,B=null,se=null,$.removeEventListener("mousemove",Be),$.removeEventListener("mouseup",He),$.removeEventListener("touchmove",Be),$.removeEventListener("touchend",He)}$.addEventListener("mousemove",Be),$.addEventListener("mouseup",He),$.addEventListener("touchmove",Be),$.addEventListener("touchend",He)}function _P(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:d,flowId:h,isValidConnection:m=CP,nodeLookup:y}){const v=l==="target",S=t?u.querySelector(`.${d}-flow__handle[data-id="${h}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:w,y:A}=fu(e),E=u.elementFromPoint(w,A),R=E?.classList.contains(`${d}-flow__handle`)?E:S,k={handleDomNode:R,isValid:!1,connection:null,toHandle:null};if(R){const D=EP(void 0,R),M=R.getAttribute("data-nodeid"),I=R.getAttribute("data-handleid"),L=R.classList.contains("connectable"),P=R.classList.contains("connectableend");if(!M||!D)return k;const G={source:v?M:r,sourceHandle:v?I:a,target:v?r:M,targetHandle:v?a:I};k.connection=G;const Z=L&&P&&(n===r0.Strict?v&&D==="source"||!v&&D==="target":M!==r||I!==a);k.isValid=Z&&m(G),k.toHandle=wP(M,D,I,y,n,!0)}return k}const zR={onPointerDown:Oce,isValid:_P};function Mce({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=ti(e);function l({translateExtent:d,width:h,height:m,zoomStep:y=10,pannable:v=!0,zoomable:S=!0,inversePan:w=!1}){const A=M=>{const I=n();if(M.sourceEvent.type!=="wheel"||!t)return;const L=-M.sourceEvent.deltaY*(M.sourceEvent.deltaMode===1?.05:M.sourceEvent.deltaMode?1:.002)*y,P=I[2]*Math.pow(2,L);t.scaleTo(P)};let E=[0,0];const R=M=>{(M.sourceEvent.type==="mousedown"||M.sourceEvent.type==="touchstart")&&(E=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY])},k=M=>{const I=n();if(M.sourceEvent.type!=="mousemove"&&M.sourceEvent.type!=="touchmove"||!t)return;const L=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY],P=[L[0]-E[0],L[1]-E[1]];E=L;const G=r()*Math.max(I[2],Math.log(I[2]))*(w?-1:1),$={x:I[0]-P[0]*G,y:I[1]-P[1]*G},Z=[[0,0],[h,m]];t.setViewportConstrained({x:$.x,y:$.y,zoom:I[2]},Z,d)},D=eP().on("start",R).on("zoom",v?k:null).on("zoom.wheel",S?A:null);a.call(D,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:Wl}}const Nce=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,MC=e=>({x:e.x,y:e.y,zoom:e.k}),cT=({x:e,y:t,zoom:n})=>TC.translate(e,t).scale(n),By=(e,t)=>e.target.closest(`.${t}`),AP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Dce=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,fT=(e,t=0,n=Dce,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},TP=e=>{const t=e.ctrlKey&&vE()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ice({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:d,onPanZoom:h,onPanZoomEnd:m}){return y=>{if(By(y,t))return!1;y.preventDefault(),y.stopImmediatePropagation();const v=n.property("__zoom").k||1;if(y.ctrlKey&&u){const R=Wl(y),k=TP(y),D=v*Math.pow(2,k);r.scaleTo(n,D,R,y);return}const S=y.deltaMode===1?20:1;let w=a===zp.Vertical?0:y.deltaX*S,A=a===zp.Horizontal?0:y.deltaY*S;!vE()&&y.shiftKey&&a!==zp.Vertical&&(w=y.deltaY*S,A=0),r.translateBy(n,-(w/v)*l,-(A/v)*l,{internal:!0});const E=MC(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,d?.(y,E)),e.isPanScrolling&&(h?.(y,E),e.panScrollTimeout=setTimeout(()=>{m?.(y,E),e.isPanScrolling=!1},150))}}function zce({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,d=By(r,e);if(r.ctrlKey&&l&&d&&r.preventDefault(),u||d)return null;r.preventDefault(),n.call(this,r,a)}}function jce({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const a=MC(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=a,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,a)}}function Bce({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{e.usedRightMouseButton=!!(n&&AP(t,e.mouseButton??0)),l.sourceEvent?.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!l.sourceEvent?.internal&&a?.(l.sourceEvent,MC(l.transform))}}function Lce({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{if(!u.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,l&&AP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a&&Nce(e.prevViewport,u.transform))){const d=MC(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a?.(u.sourceEvent,d)},n?150:0)}}}function Pce({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:d,noPanClassName:h,lib:m}){return y=>{const v=e||t,S=n&&y.ctrlKey;if(y.button===1&&y.type==="mousedown"&&(By(y,`${m}-flow__node`)||By(y,`${m}-flow__edge`)))return!0;if(!r&&!v&&!a&&!l&&!n||u||By(y,d)&&y.type==="wheel"||By(y,h)&&(y.type!=="wheel"||a&&y.type==="wheel"&&!e)||!n&&y.ctrlKey&&y.type==="wheel")return!1;if(!n&&y.type==="touchstart"&&y.touches?.length>1)return y.preventDefault(),!1;if(!v&&!a&&!S&&y.type==="wheel"||!r&&(y.type==="mousedown"||y.type==="touchstart")||Array.isArray(r)&&!r.includes(y.button)&&y.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(y.button)||!y.button||y.button<=1;return(!y.ctrlKey||y.type==="wheel")&&w}}function Hce({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:a,viewport:l,onPanZoom:u,onPanZoomStart:d,onPanZoomEnd:h,onDraggingChange:m}){const y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),S=eP().clickDistance(!Kl(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(a),w=ti(e).call(S);M({x:l.x,y:l.y,zoom:o0(l.zoom,t,n)},[[0,0],[v.width,v.height]],a);const A=w.on("wheel.zoom"),E=w.on("dblclick.zoom");S.wheelDelta(TP);function R(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?D1:D2).transform(fT(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function k({noWheelClassName:ee,noPanClassName:ae,onPaneContextMenu:U,userSelectionActive:te,panOnScroll:V,panOnDrag:W,panOnScrollMode:J,panOnScrollSpeed:ne,preventScrolling:B,zoomOnPinch:oe,zoomOnScroll:se,zoomOnDoubleClick:Y,zoomActivationKeyPressed:he,lib:Te,onTransformChange:me}){te&&!y.isZoomingOrPanning&&D();const xe=V&&!he&&!te?Ice({zoomPanValues:y,noWheelClassName:ee,d3Selection:w,d3Zoom:S,panOnScrollMode:J,panOnScrollSpeed:ne,zoomOnPinch:oe,onPanZoomStart:d,onPanZoom:u,onPanZoomEnd:h}):zce({noWheelClassName:ee,preventScrolling:B,d3ZoomHandler:A});if(w.on("wheel.zoom",xe,{passive:!1}),!te){const He=jce({zoomPanValues:y,onDraggingChange:m,onPanZoomStart:d});S.on("start",He);const Ye=Bce({zoomPanValues:y,panOnDrag:W,onPaneContextMenu:!!U,onPanZoom:u,onTransformChange:me});S.on("zoom",Ye);const ke=Lce({zoomPanValues:y,panOnDrag:W,panOnScroll:V,onPaneContextMenu:U,onPanZoomEnd:h,onDraggingChange:m});S.on("end",ke)}const Be=Pce({zoomActivationKeyPressed:he,panOnDrag:W,zoomOnScroll:se,panOnScroll:V,zoomOnDoubleClick:Y,zoomOnPinch:oe,userSelectionActive:te,noPanClassName:ae,noWheelClassName:ee,lib:Te});S.filter(Be),Y?w.on("dblclick.zoom",E):w.on("dblclick.zoom",null)}function D(){S.on("zoom",null)}async function M(ee,ae,U){const te=cT(ee),V=S?.constrain()(te,ae,U);return V&&await R(V),new Promise(W=>W(V))}async function I(ee,ae){const U=cT(ee);return await R(U,ae),new Promise(te=>te(U))}function L(ee){if(w){const ae=cT(ee),U=w.property("__zoom");(U.k!==ee.zoom||U.x!==ee.x||U.y!==ee.y)&&S?.transform(w,ae,null,{sync:!0})}}function P(){const ee=w?KL(w.node()):{x:0,y:0,k:1};return{x:ee.x,y:ee.y,zoom:ee.k}}function G(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?D1:D2).scaleTo(fT(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function $(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?D1:D2).scaleBy(fT(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function Z(ee){S?.scaleExtent(ee)}function j(ee){S?.translateExtent(ee)}function X(ee){const ae=!Kl(ee)||ee<0?0:ee;S?.clickDistance(ae)}return{update:k,destroy:D,setViewport:I,setViewportConstrained:M,getViewport:P,scaleTo:G,scaleBy:$,setScaleExtent:Z,setTranslateExtent:j,syncViewport:L,setClickDistance:X}}var l0;(function(e){e.Line="line",e.Handle="handle"})(l0||(l0={}));function Vce({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,d=n-r,h=[u>0?1:u<0?-1:0,d>0?1:d<0?-1:0];return u&&a&&(h[0]=h[0]*-1),d&&l&&(h[1]=h[1]*-1),h}function Fce(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function Sd(e,t){return Math.max(0,t-e)}function wd(e,t){return Math.max(0,e-t)}function u2(e,t,n){return Math.max(0,t-e,e-n)}function h5(e,t){return e?!t:t}function Gce(e,t,n,r,a,l,u,d){let{affectsX:h,affectsY:m}=t;const{isHorizontal:y,isVertical:v}=t,S=y&&v,{xSnapped:w,ySnapped:A}=n,{minWidth:E,maxWidth:R,minHeight:k,maxHeight:D}=r,{x:M,y:I,width:L,height:P,aspectRatio:G}=e;let $=Math.floor(y?w-e.pointerX:0),Z=Math.floor(v?A-e.pointerY:0);const j=L+(h?-$:$),X=P+(m?-Z:Z),ee=-l[0]*L,ae=-l[1]*P;let U=u2(j,E,R),te=u2(X,k,D);if(u){let J=0,ne=0;h&&$<0?J=Sd(M+$+ee,u[0][0]):!h&&$>0&&(J=wd(M+j+ee,u[1][0])),m&&Z<0?ne=Sd(I+Z+ae,u[0][1]):!m&&Z>0&&(ne=wd(I+X+ae,u[1][1])),U=Math.max(U,J),te=Math.max(te,ne)}if(d){let J=0,ne=0;h&&$>0?J=wd(M+$,d[0][0]):!h&&$<0&&(J=Sd(M+j,d[1][0])),m&&Z>0?ne=wd(I+Z,d[0][1]):!m&&Z<0&&(ne=Sd(I+X,d[1][1])),U=Math.max(U,J),te=Math.max(te,ne)}if(a){if(y){const J=u2(j/G,k,D)*G;if(U=Math.max(U,J),u){let ne=0;!h&&!m||h&&!m&&S?ne=wd(I+ae+j/G,u[1][1])*G:ne=Sd(I+ae+(h?$:-$)/G,u[0][1])*G,U=Math.max(U,ne)}if(d){let ne=0;!h&&!m||h&&!m&&S?ne=Sd(I+j/G,d[1][1])*G:ne=wd(I+(h?$:-$)/G,d[0][1])*G,U=Math.max(U,ne)}}if(v){const J=u2(X*G,E,R)/G;if(te=Math.max(te,J),u){let ne=0;!h&&!m||m&&!h&&S?ne=wd(M+X*G+ee,u[1][0])/G:ne=Sd(M+(m?Z:-Z)*G+ee,u[0][0])/G,te=Math.max(te,ne)}if(d){let ne=0;!h&&!m||m&&!h&&S?ne=Sd(M+X*G,d[1][0])/G:ne=wd(M+(m?Z:-Z)*G,d[0][0])/G,te=Math.max(te,ne)}}}Z=Z+(Z<0?te:-te),$=$+($<0?U:-U),a&&(S?j>X*G?Z=(h5(h,m)?-$:$)/G:$=(h5(h,m)?-Z:Z)*G:y?(Z=$/G,m=h):($=Z*G,h=m));const V=h?M+$:M,W=m?I+Z:I;return{width:L+(h?-$:$),height:P+(m?-Z:Z),x:l[0]*$*(h?-1:1)+V,y:l[1]*Z*(m?-1:1)+W}}const RP={width:0,height:0,x:0,y:0},Uce={...RP,pointerX:0,pointerY:0,aspectRatio:1};function $ce(e){return[[0,0],[e.measured.width,e.measured.height]]}function Xce(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,d=n[0]*l,h=n[1]*u;return[[r-d,a-h],[r+l-d,a+u-h]]}function Yce({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=ti(e);function u({controlPosition:h,boundaries:m,keepAspectRatio:y,resizeDirection:v,onResizeStart:S,onResize:w,onResizeEnd:A,shouldResize:E}){let R={...RP},k={...Uce};const D=Fce(h);let M,I=null,L=[],P,G,$;const Z=PL().on("start",j=>{const{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,paneDomNode:V}=n();if(M=X.get(t),!M)return;I=V?.getBoundingClientRect()??null;const{xSnapped:W,ySnapped:J}=I1(j.sourceEvent,{transform:ee,snapGrid:ae,snapToGrid:U,containerBounds:I});R={width:M.measured.width??0,height:M.measured.height??0,x:M.position.x??0,y:M.position.y??0},k={...R,pointerX:W,pointerY:J,aspectRatio:R.width/R.height},P=void 0,M.parentId&&(M.extent==="parent"||M.expandParent)&&(P=X.get(M.parentId),G=P&&M.extent==="parent"?$ce(P):void 0),L=[],$=void 0;for(const[ne,B]of X)if(B.parentId===t&&(L.push({id:ne,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const oe=Xce(B,M,B.origin??te);$?$=[[Math.min(oe[0][0],$[0][0]),Math.min(oe[0][1],$[0][1])],[Math.max(oe[1][0],$[1][0]),Math.max(oe[1][1],$[1][1])]]:$=oe}S?.(j,{...R})}).on("drag",j=>{const{transform:X,snapGrid:ee,snapToGrid:ae,nodeOrigin:U}=n(),te=I1(j.sourceEvent,{transform:X,snapGrid:ee,snapToGrid:ae,containerBounds:I}),V=[];if(!M)return;const{x:W,y:J,width:ne,height:B}=R,oe={},se=M.origin??U,{width:Y,height:he,x:Te,y:me}=Gce(k,D,te,m,y,se,G,$),Ee=Y!==ne,xe=he!==B,Be=Te!==W&&Ee,He=me!==J&&xe;if(!Be&&!He&&!Ee&&!xe)return;if((Be||He||se[0]===1||se[1]===1)&&(oe.x=Be?Te:R.x,oe.y=He?me:R.y,R.x=oe.x,R.y=oe.y,L.length>0)){const We=Te-W,_t=me-J;for(const Kt of L)Kt.position={x:Kt.position.x-We+se[0]*(Y-ne),y:Kt.position.y-_t+se[1]*(he-B)},V.push(Kt)}if((Ee||xe)&&(oe.width=Ee&&(!v||v==="horizontal")?Y:R.width,oe.height=xe&&(!v||v==="vertical")?he:R.height,R.width=oe.width,R.height=oe.height),P&&M.expandParent){const We=se[0]*(oe.width??0);oe.x&&oe.x<We&&(R.x=We,k.x=k.x-(oe.x-We));const _t=se[1]*(oe.height??0);oe.y&&oe.y<_t&&(R.y=_t,k.y=k.y-(oe.y-_t))}const Ye=Vce({width:R.width,prevWidth:ne,height:R.height,prevHeight:B,affectsX:D.affectsX,affectsY:D.affectsY}),ke={...R,direction:Ye};E?.(j,ke)!==!1&&(w?.(j,ke),r(oe,V))}).on("end",j=>{A?.(j,{...R}),a?.({...R})});l.call(Z)}function d(){l.on(".drag",null)}return{update:u,destroy:d}}const{useDebugValue:Zce}=Q,{useSyncExternalStoreWithSelector:Wce}=WB,qce=e=>e;function kP(e,t=qce,n){const r=Wce(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Zce(r),r}const p5=(e,t)=>{const n=YB(e),r=(a,l=t)=>kP(n,a,l);return Object.assign(r,n),r},Jce=(e,t)=>e?p5(e,t):p5;function Wn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const NC=Q.createContext(null),Qce=NC.Provider,OP=li.error001();function Zt(e,t){const n=Q.useContext(NC);if(n===null)throw new Error(OP);return kP(n,e,t)}function Un(){const e=Q.useContext(NC);if(e===null)throw new Error(OP);return Q.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const m5={display:"none"},Kce={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},MP="react-flow__node-desc",NP="react-flow__edge-desc",efe="react-flow__aria-live",tfe=e=>e.ariaLiveMessage,nfe=e=>e.ariaLabelConfig;function rfe({rfId:e}){const t=Zt(tfe);return T.jsx("div",{id:`${efe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Kce,children:t})}function ofe({rfId:e,disableKeyboardA11y:t}){const n=Zt(nfe);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${MP}-${e}`,style:m5,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${NP}-${e}`,style:m5,children:n["edge.a11yDescription.default"]}),!t&&T.jsx(rfe,{rfId:e})]})}const DC=Q.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return T.jsx("div",{className:Rr(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});DC.displayName="Panel";function afe({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:T.jsx(DC,{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:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ife=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},c2=e=>e.id;function lfe(e,t){return Wn(e.selectedNodes.map(c2),t.selectedNodes.map(c2))&&Wn(e.selectedEdges.map(c2),t.selectedEdges.map(c2))}function sfe({onSelectionChange:e}){const t=Un(),{selectedNodes:n,selectedEdges:r}=Zt(ife,lfe);return Q.useEffect(()=>{const a={nodes:n,edges:r};e?.(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const ufe=e=>!!e.onSelectionChangeHandlers;function cfe({onSelectionChange:e}){const t=Zt(ufe);return e||t?T.jsx(sfe,{onSelectionChange:e}):null}const DP=[0,0],ffe={x:0,y:0,zoom:1},dfe=["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","paneClickDistance","ariaLabelConfig"],g5=[...dfe,"rfId"],hfe=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,setPaneClickDistance:e.setPaneClickDistance}),y5={translateExtent:nx,nodeOrigin:DP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function pfe(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:d,setDefaultNodesAndEdges:h,setPaneClickDistance:m}=Zt(hfe,Wn),y=Un();Q.useEffect(()=>(h(e.defaultNodes,e.defaultEdges),()=>{v.current=y5,d()}),[]);const v=Q.useRef(y5);return Q.useEffect(()=>{for(const S of g5){const w=e[S],A=v.current[S];w!==A&&(typeof e[S]>"u"||(S==="nodes"?t(w):S==="edges"?n(w):S==="minZoom"?r(w):S==="maxZoom"?a(w):S==="translateExtent"?l(w):S==="nodeExtent"?u(w):S==="paneClickDistance"?m(w):S==="ariaLabelConfig"?y.setState({ariaLabelConfig:ice(w)}):S==="fitView"?y.setState({fitViewQueued:w}):S==="fitViewOptions"?y.setState({fitViewOptions:w}):y.setState({[S]:w})))}v.current=e},g5.map(S=>e[S])),null}function v5(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function mfe(e){const[t,n]=Q.useState(e==="system"?null:e);return Q.useEffect(()=>{if(e!=="system"){n(e);return}const r=v5(),a=()=>n(r?.matches?"dark":"light");return a(),r?.addEventListener("change",a),()=>{r?.removeEventListener("change",a)}},[e]),t!==null?t:v5()?.matches?"dark":"light"}const b5=typeof document<"u"?document:null;function Pc(e=null,t={target:b5,actInsideInputWithModifier:!0}){const[n,r]=Q.useState(!1),a=Q.useRef(!1),l=Q.useRef(new Set([])),[u,d]=Q.useMemo(()=>{if(e!==null){const m=(Array.isArray(e)?e:[e]).filter(v=>typeof v=="string").map(v=>v.replace("+",`
|
|
1078
1078
|
`).replace(`
|
|
1079
1079
|
|
|
1080
1080
|
`,`
|
|
@@ -1082,7 +1082,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1082
1082
|
`)),y=m.reduce((v,S)=>v.concat(...S),[]);return[m,y]}return[[],[]]},[e]);return Q.useEffect(()=>{const h=t?.target??b5,m=t?.actInsideInputWithModifier??!0;if(e!==null){const y=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey||w.altKey,(!a.current||a.current&&!m)&&pP(w))return!1;const E=S5(w.code,d);if(l.current.add(w[E]),x5(u,l.current,!1)){const R=w.composedPath?.()?.[0]||w.target,k=R?.nodeName==="BUTTON"||R?.nodeName==="A";t.preventDefault!==!1&&(a.current||!k)&&w.preventDefault(),r(!0)}},v=w=>{const A=S5(w.code,d);x5(u,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(w[A]),w.key==="Meta"&&l.current.clear(),a.current=!1},S=()=>{l.current.clear(),r(!1)};return h?.addEventListener("keydown",y),h?.addEventListener("keyup",v),window.addEventListener("blur",S),window.addEventListener("contextmenu",S),()=>{h?.removeEventListener("keydown",y),h?.removeEventListener("keyup",v),window.removeEventListener("blur",S),window.removeEventListener("contextmenu",S)}}},[e,r]),n}function x5(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function S5(e,t){return t.includes(e)?"code":"key"}const gfe=()=>{const e=Un();return Q.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:u,panZoom:d}=e.getState(),h=AO(t,r,a,l,u,n?.padding??.1);return d?(await d.setViewport(h,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:d,y:h}=u.getBoundingClientRect(),m={x:t.x-d,y:t.y-h},y=n.snapGrid??a,v=n.snapToGrid??l;return Dx(m,r,v,y)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),u=yE(t,n);return{x:u.x+a,y:u.y+l}}}),[])};function IP(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const u=r.get(l.id);u?u.push(l):r.set(l.id,[l])}for(const l of t){const u=r.get(l.id);if(!u){n.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){n.push({...u[0].item});continue}const d={...l};for(const h of u)yfe(h,d);n.push(d)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function yfe(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function DO(e,t){return IP(e,t)}function zP(e,t){return IP(e,t)}function _p(e,t){return{id:e,type:"select",selected:t}}function Ly(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const u=t.has(a);!(l.selected===void 0&&!u)&&l.selected!==u&&(n&&(l.selected=u),r.push(_p(l.id,u)))}return r}function w5({items:e=[],lookup:t}){const n=[],r=new Map(e.map(a=>[a.id,a]));for(const[a,l]of e.entries()){const u=t.get(l.id),d=u?.internals?.userNode??u;d!==void 0&&d!==l&&n.push({id:l.id,item:l,type:"replace"}),d===void 0&&n.push({item:l,type:"add",index:a})}for(const[a]of t)r.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function E5(e){return{id:e.id,type:"remove"}}const C5=e=>Jue(e),vfe=e=>aP(e);function jP(e){return Q.forwardRef(e)}const bfe=typeof window<"u"?Q.useLayoutEffect:Q.useEffect;function _5(e){const[t,n]=Q.useState(BigInt(0)),[r]=Q.useState(()=>xfe(()=>n(a=>a+BigInt(1))));return bfe(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function xfe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const BP=Q.createContext(null);function Sfe({children:e}){const t=Un(),n=Q.useCallback(d=>{const{nodes:h=[],setNodes:m,hasDefaultNodes:y,onNodesChange:v,nodeLookup:S,fitViewQueued:w}=t.getState();let A=h;for(const R of d)A=typeof R=="function"?R(A):R;const E=w5({items:A,lookup:S});y&&m(A),E.length>0?v?.(E):w&&window.requestAnimationFrame(()=>{const{fitViewQueued:R,nodes:k,setNodes:D}=t.getState();R&&D(k)})},[]),r=_5(n),a=Q.useCallback(d=>{const{edges:h=[],setEdges:m,hasDefaultEdges:y,onEdgesChange:v,edgeLookup:S}=t.getState();let w=h;for(const A of d)w=typeof A=="function"?A(w):A;y?m(w):v&&v(w5({items:w,lookup:S}))},[]),l=_5(a),u=Q.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return T.jsx(BP.Provider,{value:u,children:e})}function wfe(){const e=Q.useContext(BP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Efe=e=>!!e.panZoom;function Yp(){const e=gfe(),t=Un(),n=wfe(),r=Zt(Efe),a=Q.useMemo(()=>{const l=v=>t.getState().nodeLookup.get(v),u=v=>{n.nodeQueue.push(v)},d=v=>{n.edgeQueue.push(v)},h=v=>{const{nodeLookup:S,nodeOrigin:w}=t.getState(),A=C5(v)?v:S.get(v.id),E=A.parentId?dP(A.position,A.measured,A.parentId,S,w):A.position,R={...A,position:E,width:A.measured?.width??A.width,height:A.measured?.height??A.height};return a0(R)},m=(v,S,w={replace:!1})=>{u(A=>A.map(E=>{if(E.id===v){const R=typeof S=="function"?S(E):S;return w.replace&&C5(R)?R:{...E,...R}}return E}))},y=(v,S,w={replace:!1})=>{d(A=>A.map(E=>{if(E.id===v){const R=typeof S=="function"?S(E):S;return w.replace&&vfe(R)?R:{...E,...R}}return E}))};return{getNodes:()=>t.getState().nodes.map(v=>({...v})),getNode:v=>l(v)?.internals.userNode,getInternalNode:l,getEdges:()=>{const{edges:v=[]}=t.getState();return v.map(S=>({...S}))},getEdge:v=>t.getState().edgeLookup.get(v),setNodes:u,setEdges:d,addNodes:v=>{const S=Array.isArray(v)?v:[v];n.nodeQueue.push(w=>[...w,...S])},addEdges:v=>{const S=Array.isArray(v)?v:[v];n.edgeQueue.push(w=>[...w,...S])},toObject:()=>{const{nodes:v=[],edges:S=[],transform:w}=t.getState(),[A,E,R]=w;return{nodes:v.map(k=>({...k})),edges:S.map(k=>({...k})),viewport:{x:A,y:E,zoom:R}}},deleteElements:async({nodes:v=[],edges:S=[]})=>{const{nodes:w,edges:A,onNodesDelete:E,onEdgesDelete:R,triggerNodeChanges:k,triggerEdgeChanges:D,onDelete:M,onBeforeDelete:I}=t.getState(),{nodes:L,edges:P}=await nce({nodesToRemove:v,edgesToRemove:S,nodes:w,edges:A,onBeforeDelete:I}),G=P.length>0,$=L.length>0;if(G){const Z=P.map(E5);R?.(P),D(Z)}if($){const Z=L.map(E5);E?.(L),k(Z)}return($||G)&&M?.({nodes:L,edges:P}),{deletedNodes:L,deletedEdges:P}},getIntersectingNodes:(v,S=!0,w)=>{const A=n5(v),E=A?v:h(v),R=w!==void 0;return E?(w||t.getState().nodes).filter(k=>{const D=t.getState().nodeLookup.get(k.id);if(D&&!A&&(k.id===v.id||!D.internals.positionAbsolute))return!1;const M=a0(R?k:D),I=ox(M,E);return S&&I>0||I>=M.width*M.height||I>=E.width*E.height}):[]},isNodeIntersecting:(v,S,w=!0)=>{const E=n5(v)?v:h(v);if(!E)return!1;const R=ox(E,S);return w&&R>0||R>=E.width*E.height},updateNode:m,updateNodeData:(v,S,w={replace:!1})=>{m(v,A=>{const E=typeof S=="function"?S(A):S;return w.replace?{...A,data:E}:{...A,data:{...A.data,...E}}},w)},updateEdge:y,updateEdgeData:(v,S,w={replace:!1})=>{y(v,A=>{const E=typeof S=="function"?S(A):S;return w.replace?{...A,data:E}:{...A,data:{...A.data,...E}}},w)},getNodesBounds:v=>{const{nodeLookup:S,nodeOrigin:w}=t.getState();return Que(v,{nodeLookup:S,nodeOrigin:w})},getHandleConnections:({type:v,id:S,nodeId:w})=>Array.from(t.getState().connectionLookup.get(`${w}-${v}${S?`-${S}`:""}`)?.values()??[]),getNodeConnections:({type:v,handleId:S,nodeId:w})=>Array.from(t.getState().connectionLookup.get(`${w}${v?S?`-${v}-${S}`:`-${v}`:""}`)?.values()??[]),fitView:async v=>{const S=t.getState().fitViewResolver??ace();return t.setState({fitViewQueued:!0,fitViewOptions:v,fitViewResolver:S}),n.nodeQueue.push(w=>[...w]),S.promise}}},[]);return Q.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const A5=e=>e.selected,Cfe=typeof window<"u"?window:void 0;function _fe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Un(),{deleteElements:r}=Yp(),a=Pc(e,{actInsideInputWithModifier:!1}),l=Pc(t,{target:Cfe});Q.useEffect(()=>{if(a){const{edges:u,nodes:d}=n.getState();r({nodes:d.filter(A5),edges:u.filter(A5)}),n.setState({nodesSelectionActive:!1})}},[a]),Q.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function Afe(e){const t=Un();Q.useEffect(()=>{const n=()=>{if(!e.current)return!1;const r=TO(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",li.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const IC={position:"absolute",width:"100%",height:"100%",top:0,left:0},Tfe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function Rfe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=zp.Free,zoomOnDoubleClick:u=!0,panOnDrag:d=!0,defaultViewport:h,translateExtent:m,minZoom:y,maxZoom:v,zoomActivationKeyCode:S,preventScrolling:w=!0,children:A,noWheelClassName:E,noPanClassName:R,onViewportChange:k,isControlledViewport:D,paneClickDistance:M}){const I=Un(),L=Q.useRef(null),{userSelectionActive:P,lib:G}=Zt(Tfe,Wn),$=Pc(S),Z=Q.useRef();Afe(L);const j=Q.useCallback(X=>{k?.({x:X[0],y:X[1],zoom:X[2]}),D||I.setState({transform:X})},[k,D]);return Q.useEffect(()=>{if(L.current){Z.current=Hce({domNode:L.current,minZoom:y,maxZoom:v,translateExtent:m,viewport:h,paneClickDistance:M,onDraggingChange:U=>I.setState({paneDragging:U}),onPanZoomStart:(U,te)=>{const{onViewportChangeStart:V,onMoveStart:W}=I.getState();W?.(U,te),V?.(te)},onPanZoom:(U,te)=>{const{onViewportChange:V,onMove:W}=I.getState();W?.(U,te),V?.(te)},onPanZoomEnd:(U,te)=>{const{onViewportChangeEnd:V,onMoveEnd:W}=I.getState();W?.(U,te),V?.(te)}});const{x:X,y:ee,zoom:ae}=Z.current.getViewport();return I.setState({panZoom:Z.current,transform:[X,ee,ae],domNode:L.current.closest(".react-flow")}),()=>{Z.current?.destroy()}}},[]),Q.useEffect(()=>{Z.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:d,zoomActivationKeyPressed:$,preventScrolling:w,noPanClassName:R,userSelectionActive:P,noWheelClassName:E,lib:G,onTransformChange:j})},[e,t,n,r,a,l,u,d,$,w,R,P,E,G,j]),T.jsx("div",{className:"react-flow__renderer",ref:L,style:IC,children:A})}const kfe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ofe(){const{userSelectionActive:e,userSelectionRect:t}=Zt(kfe,Wn);return e&&t?T.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const dT=(e,t)=>n=>{n.target===t.current&&e?.(n)},Mfe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Nfe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=rx.Full,panOnDrag:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:y,onPaneMouseMove:v,onPaneMouseLeave:S,children:w}){const A=Un(),{userSelectionActive:E,elementsSelectable:R,dragging:k,connectionInProgress:D}=Zt(Mfe,Wn),M=R&&(e||E),I=Q.useRef(null),L=Q.useRef(),P=Q.useRef(new Set),G=Q.useRef(new Set),$=Q.useRef(!1),Z=Q.useRef(!1),j=W=>{if($.current||D){$.current=!1;return}d?.(W),A.getState().resetSelectedElements(),A.setState({nodesSelectionActive:!1})},X=W=>{if(Array.isArray(r)&&r?.includes(2)){W.preventDefault();return}h?.(W)},ee=m?W=>m(W):void 0,ae=W=>{const{resetSelectedElements:J,domNode:ne}=A.getState();if(L.current=ne?.getBoundingClientRect(),!R||!e||W.button!==0||W.target!==I.current||!L.current)return;W.target?.setPointerCapture?.(W.pointerId),Z.current=!0,$.current=!1;const{x:B,y:oe}=fu(W.nativeEvent,L.current);J(),A.setState({userSelectionRect:{width:0,height:0,startX:B,startY:oe,x:B,y:oe}}),l?.(W)},U=W=>{const{userSelectionRect:J,transform:ne,nodeLookup:B,edgeLookup:oe,connectionLookup:se,triggerNodeChanges:Y,triggerEdgeChanges:he,defaultEdgeOptions:Te}=A.getState();if(!L.current||!J)return;$.current=!0;const{x:me,y:Ee}=fu(W.nativeEvent,L.current),{startX:xe,startY:Be}=J,He={startX:xe,startY:Be,x:me<xe?me:xe,y:Ee<Be?Ee:Be,width:Math.abs(me-xe),height:Math.abs(Ee-Be)},Ye=P.current,ke=G.current;P.current=new Set(_O(B,He,ne,n===rx.Partial,!0).map(We=>We.id)),G.current=new Set;const Xe=Te?.selectable??!0;for(const We of P.current){const _t=se.get(We);if(_t)for(const{edgeId:Kt}of _t.values()){const Wt=oe.get(Kt);Wt&&(Wt.selectable??Xe)&&G.current.add(Kt)}}if(!r5(Ye,P.current)){const We=Ly(B,P.current,!0);Y(We)}if(!r5(ke,G.current)){const We=Ly(oe,G.current);he(We)}A.setState({userSelectionRect:He,userSelectionActive:!0,nodesSelectionActive:!1})},te=W=>{if(W.button!==0||!Z.current)return;W.target?.releasePointerCapture?.(W.pointerId);const{userSelectionRect:J}=A.getState();!E&&J&&W.target===I.current&&j?.(W),A.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:P.current.size>0}),u?.(W),(t||a)&&($.current=!1),Z.current=!1},V=r===!0||Array.isArray(r)&&r.includes(0);return T.jsxs("div",{className:Rr(["react-flow__pane",{draggable:V,dragging:k,selection:e}]),onClick:M?void 0:dT(j,I),onContextMenu:dT(X,I),onWheel:dT(ee,I),onPointerEnter:M?void 0:y,onPointerDown:M?ae:v,onPointerMove:M?U:v,onPointerUp:M?te:void 0,onPointerLeave:S,ref:I,style:IC,children:[w,T.jsx(Ofe,{})]})}function jR({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:d,onError:h}=t.getState(),m=d.get(e);if(!m){h?.("012",li.error012(e));return}t.setState({nodesSelectionActive:!1}),m.selected?(n||m.selected&&u)&&(l({nodes:[m],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):a([e])}function LP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:u}){const d=Un(),[h,m]=Q.useState(!1),y=Q.useRef();return Q.useEffect(()=>{y.current=_ce({getStoreItems:()=>d.getState(),onNodeMouseDown:v=>{jR({id:v,store:d,nodeRef:e})},onDragStart:()=>{m(!0)},onDragStop:()=>{m(!1)}})},[]),Q.useEffect(()=>{if(t)y.current?.destroy();else if(e.current)return y.current?.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:u}),()=>{y.current?.destroy()}},[n,r,t,l,e,a]),h}const Dfe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function PP(){const e=Un();return Q.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:u,onError:d,updateNodePositions:h,nodeLookup:m,nodeOrigin:y}=e.getState(),v=new Map,S=Dfe(u),w=a?l[0]:5,A=a?l[1]:5,E=n.direction.x*w*n.factor,R=n.direction.y*A*n.factor;for(const[,k]of m){if(!S(k))continue;let D={x:k.internals.positionAbsolute.x+E,y:k.internals.positionAbsolute.y+R};a&&(D=OC(D,l));const{position:M,positionAbsolute:I}=iP({nodeId:k.id,nextPosition:D,nodeLookup:m,nodeExtent:r,nodeOrigin:y,onError:d});k.position=M,k.internals.positionAbsolute=I,v.set(k.id,k)}h(v)},[])}const IO=Q.createContext(null),Ife=IO.Provider;IO.Consumer;const HP=()=>Q.useContext(IO),zfe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),jfe=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:u}=r,{fromHandle:d,toHandle:h,isValid:m}=u,y=h?.nodeId===e&&h?.id===t&&h?.type===n;return{connectingFrom:d?.nodeId===e&&d?.id===t&&d?.type===n,connectingTo:y,clickConnecting:a?.nodeId===e&&a?.id===t&&a?.type===n,isPossibleEndHandle:l===r0.Strict?d?.type!==n:e!==d?.nodeId||t!==d?.id,connectionInProcess:!!d,clickConnectionInProcess:!!a,valid:y&&m}};function Bfe({type:e="source",position:t=at.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:u,onConnect:d,children:h,className:m,onMouseDown:y,onTouchStart:v,...S},w){const A=u||null,E=e==="target",R=Un(),k=HP(),{connectOnClick:D,noPanClassName:M,rfId:I}=Zt(zfe,Wn),{connectingFrom:L,connectingTo:P,clickConnecting:G,isPossibleEndHandle:$,connectionInProcess:Z,clickConnectionInProcess:j,valid:X}=Zt(jfe(k,A,e),Wn);k||R.getState().onError?.("010",li.error010());const ee=te=>{const{defaultEdgeOptions:V,onConnect:W,hasDefaultEdges:J}=R.getState(),ne={...V,...te};if(J){const{edges:B,setEdges:oe}=R.getState();oe(dce(ne,B))}W?.(ne),d?.(ne)},ae=te=>{if(!k)return;const V=mP(te.nativeEvent);if(a&&(V&&te.button===0||!V)){const W=R.getState();zR.onPointerDown(te.nativeEvent,{autoPanOnConnect:W.autoPanOnConnect,connectionMode:W.connectionMode,connectionRadius:W.connectionRadius,domNode:W.domNode,nodeLookup:W.nodeLookup,lib:W.lib,isTarget:E,handleId:A,nodeId:k,flowId:W.rfId,panBy:W.panBy,cancelConnection:W.cancelConnection,onConnectStart:W.onConnectStart,onConnectEnd:W.onConnectEnd,updateConnection:W.updateConnection,onConnect:ee,isValidConnection:n||W.isValidConnection,getTransform:()=>R.getState().transform,getFromHandle:()=>R.getState().connection.fromHandle,autoPanSpeed:W.autoPanSpeed,dragThreshold:W.connectionDragThreshold})}V?y?.(te):v?.(te)},U=te=>{const{onClickConnectStart:V,onClickConnectEnd:W,connectionClickStartHandle:J,connectionMode:ne,isValidConnection:B,lib:oe,rfId:se,nodeLookup:Y,connection:he}=R.getState();if(!k||!J&&!a)return;if(!J){V?.(te.nativeEvent,{nodeId:k,handleId:A,handleType:e}),R.setState({connectionClickStartHandle:{nodeId:k,type:e,id:A}});return}const Te=hP(te.target),me=n||B,{connection:Ee,isValid:xe}=zR.isValid(te.nativeEvent,{handle:{nodeId:k,id:A,type:e},connectionMode:ne,fromNodeId:J.nodeId,fromHandleId:J.id||null,fromType:J.type,isValidConnection:me,flowId:se,doc:Te,lib:oe,nodeLookup:Y});xe&&Ee&&ee(Ee);const Be=structuredClone(he);delete Be.inProgress,Be.toPosition=Be.toHandle?Be.toHandle.position:null,W?.(te,Be),R.setState({connectionClickStartHandle:null})};return T.jsx("div",{"data-handleid":A,"data-nodeid":k,"data-handlepos":t,"data-id":`${I}-${k}-${A}-${e}`,className:Rr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",M,m,{source:!E,target:E,connectable:r,connectablestart:a,connectableend:l,clickconnecting:G,connectingfrom:L,connectingto:P,valid:X,connectionindicator:r&&(!Z||$)&&(Z||j?l:a)}]),onMouseDown:ae,onTouchStart:ae,onClick:D?U:void 0,ref:w,...S,children:h})}const ix=Q.memo(jP(Bfe));function Lfe({data:e,isConnectable:t,sourcePosition:n=at.Bottom}){return T.jsxs(T.Fragment,{children:[e?.label,T.jsx(ix,{type:"source",position:n,isConnectable:t})]})}function Pfe({data:e,isConnectable:t,targetPosition:n=at.Top,sourcePosition:r=at.Bottom}){return T.jsxs(T.Fragment,{children:[T.jsx(ix,{type:"target",position:n,isConnectable:t}),e?.label,T.jsx(ix,{type:"source",position:r,isConnectable:t})]})}function Hfe(){return null}function Vfe({data:e,isConnectable:t,targetPosition:n=at.Top}){return T.jsxs(T.Fragment,{children:[T.jsx(ix,{type:"target",position:n,isConnectable:t}),e?.label]})}const bE={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},T5={input:Lfe,default:Pfe,output:Vfe,group:Hfe};function Ffe(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const Gfe=e=>{const{width:t,height:n,x:r,y:a}=Nx(e.nodeLookup,{filter:l=>!!l.selected});return{width:Kl(t)?t:null,height:Kl(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function Ufe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Un(),{width:a,height:l,transformString:u,userSelectionActive:d}=Zt(Gfe,Wn),h=PP(),m=Q.useRef(null);if(Q.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),LP({nodeRef:m}),d||!a||!l)return null;const y=e?S=>{const w=r.getState().nodes.filter(A=>A.selected);e(S,w)}:void 0,v=S=>{Object.prototype.hasOwnProperty.call(bE,S.key)&&(S.preventDefault(),h({direction:bE[S.key],factor:S.shiftKey?4:1}))};return T.jsx("div",{className:Rr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:T.jsx("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:a,height:l}})})}const R5=typeof window<"u"?window:void 0,$fe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function VP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:d,deleteKeyCode:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:v,onSelectionStart:S,onSelectionEnd:w,multiSelectionKeyCode:A,panActivationKeyCode:E,zoomActivationKeyCode:R,elementsSelectable:k,zoomOnScroll:D,zoomOnPinch:M,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:P,zoomOnDoubleClick:G,panOnDrag:$,defaultViewport:Z,translateExtent:j,minZoom:X,maxZoom:ee,preventScrolling:ae,onSelectionContextMenu:U,noWheelClassName:te,noPanClassName:V,disableKeyboardA11y:W,onViewportChange:J,isControlledViewport:ne}){const{nodesSelectionActive:B,userSelectionActive:oe}=Zt($fe),se=Pc(m,{target:R5}),Y=Pc(E,{target:R5}),he=Y||$,Te=Y||I,me=y&&he!==!0,Ee=se||oe||me;return _fe({deleteKeyCode:h,multiSelectionKeyCode:A}),T.jsx(Rfe,{onPaneContextMenu:l,elementsSelectable:k,zoomOnScroll:D,zoomOnPinch:M,panOnScroll:Te,panOnScrollSpeed:L,panOnScrollMode:P,zoomOnDoubleClick:G,panOnDrag:!se&&he,defaultViewport:Z,translateExtent:j,minZoom:X,maxZoom:ee,zoomActivationKeyCode:R,preventScrolling:ae,noWheelClassName:te,noPanClassName:V,onViewportChange:J,isControlledViewport:ne,paneClickDistance:d,children:T.jsxs(Nfe,{onSelectionStart:S,onSelectionEnd:w,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:he,isSelecting:!!Ee,selectionMode:v,selectionKeyPressed:se,selectionOnDrag:me,children:[e,B&&T.jsx(Ufe,{onSelectionContextMenu:U,noPanClassName:V,disableKeyboardA11y:W})]})})}VP.displayName="FlowRenderer";const Xfe=Q.memo(VP),Yfe=e=>t=>e?_O(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Zfe(e){return Zt(Q.useCallback(Yfe(e),[e]),Wn)}const Wfe=e=>e.updateNodeInternals;function qfe(){const e=Zt(Wfe),[t]=Q.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return Q.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Jfe({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=Un(),l=Q.useRef(null),u=Q.useRef(null),d=Q.useRef(e.sourcePosition),h=Q.useRef(e.targetPosition),m=Q.useRef(t),y=n&&!!e.internals.handleBounds;return Q.useEffect(()=>{l.current&&!e.hidden&&(!y||u.current!==l.current)&&(u.current&&r?.unobserve(u.current),r?.observe(l.current),u.current=l.current)},[y,e.hidden]),Q.useEffect(()=>()=>{u.current&&(r?.unobserve(u.current),u.current=null)},[]),Q.useEffect(()=>{if(l.current){const v=m.current!==t,S=d.current!==e.sourcePosition,w=h.current!==e.targetPosition;(v||S||w)&&(m.current=t,d.current=e.sourcePosition,h.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function Qfe({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:u,nodesDraggable:d,elementsSelectable:h,nodesConnectable:m,nodesFocusable:y,resizeObserver:v,noDragClassName:S,noPanClassName:w,disableKeyboardA11y:A,rfId:E,nodeTypes:R,nodeClickDistance:k,onError:D}){const{node:M,internals:I,isParent:L}=Zt(xe=>{const Be=xe.nodeLookup.get(e),He=xe.parentLookup.has(e);return{node:Be,internals:Be.internals,isParent:He}},Wn);let P=M.type||"default",G=R?.[P]||T5[P];G===void 0&&(D?.("003",li.error003(P)),P="default",G=R?.default||T5.default);const $=!!(M.draggable||d&&typeof M.draggable>"u"),Z=!!(M.selectable||h&&typeof M.selectable>"u"),j=!!(M.connectable||m&&typeof M.connectable>"u"),X=!!(M.focusable||y&&typeof M.focusable>"u"),ee=Un(),ae=fP(M),U=Jfe({node:M,nodeType:P,hasDimensions:ae,resizeObserver:v}),te=LP({nodeRef:U,disabled:M.hidden||!$,noDragClassName:S,handleSelector:M.dragHandle,nodeId:e,isSelectable:Z,nodeClickDistance:k}),V=PP();if(M.hidden)return null;const W=ef(M),J=Ffe(M),ne=Z||$||t||n||r||a,B=n?xe=>n(xe,{...I.userNode}):void 0,oe=r?xe=>r(xe,{...I.userNode}):void 0,se=a?xe=>a(xe,{...I.userNode}):void 0,Y=l?xe=>l(xe,{...I.userNode}):void 0,he=u?xe=>u(xe,{...I.userNode}):void 0,Te=xe=>{const{selectNodesOnDrag:Be,nodeDragThreshold:He}=ee.getState();Z&&(!Be||!$||He>0)&&jR({id:e,store:ee,nodeRef:U}),t&&t(xe,{...I.userNode})},me=xe=>{if(!(pP(xe.nativeEvent)||A)){if(tP.includes(xe.key)&&Z){const Be=xe.key==="Escape";jR({id:e,store:ee,unselect:Be,nodeRef:U})}else if($&&M.selected&&Object.prototype.hasOwnProperty.call(bE,xe.key)){xe.preventDefault();const{ariaLabelConfig:Be}=ee.getState();ee.setState({ariaLiveMessage:Be["node.a11yDescription.ariaLiveMessage"]({direction:xe.key.replace("Arrow","").toLowerCase(),x:~~I.positionAbsolute.x,y:~~I.positionAbsolute.y})}),V({direction:bE[xe.key],factor:xe.shiftKey?4:1})}}},Ee=()=>{if(A||!U.current?.matches(":focus-visible"))return;const{transform:xe,width:Be,height:He,autoPanOnNodeFocus:Ye,setCenter:ke}=ee.getState();if(!Ye)return;_O(new Map([[e,M]]),{x:0,y:0,width:Be,height:He},xe,!0).length>0||ke(M.position.x+W.width/2,M.position.y+W.height/2,{zoom:xe[2]})};return T.jsx("div",{className:Rr(["react-flow__node",`react-flow__node-${P}`,{[w]:$},M.className,{selected:M.selected,selectable:Z,parent:L,draggable:$,dragging:te}]),ref:U,style:{zIndex:I.z,transform:`translate(${I.positionAbsolute.x}px,${I.positionAbsolute.y}px)`,pointerEvents:ne?"all":"none",visibility:ae?"visible":"hidden",...M.style,...J},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:oe,onMouseLeave:se,onContextMenu:Y,onClick:Te,onDoubleClick:he,onKeyDown:X?me:void 0,tabIndex:X?0:void 0,onFocus:X?Ee:void 0,role:M.ariaRole??(X?"group":void 0),"aria-roledescription":"node","aria-describedby":A?void 0:`${MP}-${E}`,"aria-label":M.ariaLabel,...M.domAttributes,children:T.jsx(Ife,{value:e,children:T.jsx(G,{id:e,data:M.data,type:P,positionAbsoluteX:I.positionAbsolute.x,positionAbsoluteY:I.positionAbsolute.y,selected:M.selected??!1,selectable:Z,draggable:$,deletable:M.deletable??!0,isConnectable:j,sourcePosition:M.sourcePosition,targetPosition:M.targetPosition,dragging:te,dragHandle:M.dragHandle,zIndex:I.z,parentId:M.parentId,...W})})})}const Kfe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function FP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,onError:l}=Zt(Kfe,Wn),u=Zfe(e.onlyRenderVisibleElements),d=qfe();return T.jsx("div",{className:"react-flow__nodes",style:IC,children:u.map(h=>T.jsx(Qfe,{id:h,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:d,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:l},h))})}FP.displayName="NodeRenderer";const ede=Q.memo(FP);function tde(e){return Zt(Q.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),u=n.nodeLookup.get(a.target);l&&u&&uce({sourceNode:l,targetNode:u,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),Wn)}const nde=({color:e="none",strokeWidth:t=1})=>T.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),rde=({color:e="none",strokeWidth:t=1})=>T.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),k5={[mE.Arrow]:nde,[mE.ArrowClosed]:rde};function ode(e){const t=Un();return Q.useMemo(()=>Object.prototype.hasOwnProperty.call(k5,e)?k5[e]:(t.getState().onError?.("009",li.error009(e)),null),[e])}const ade=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:d="auto-start-reverse"})=>{const h=ode(t);return h?T.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:d,refX:"0",refY:"0",children:T.jsx(h,{color:n,strokeWidth:u})}):null},GP=({defaultColor:e,rfId:t})=>{const n=Zt(l=>l.edges),r=Zt(l=>l.defaultEdgeOptions),a=Q.useMemo(()=>yce(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return a.length?T.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:T.jsx("defs",{children:a.map(l=>T.jsx(ade,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};GP.displayName="MarkerDefinitions";var ide=Q.memo(GP);function UP({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:d=2,children:h,className:m,...y}){const[v,S]=Q.useState({x:1,y:0,width:0,height:0}),w=Rr(["react-flow__edge-textwrapper",m]),A=Q.useRef(null);return Q.useEffect(()=>{if(A.current){const E=A.current.getBBox();S({x:E.x,y:E.y,width:E.width,height:E.height})}},[n]),n?T.jsxs("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:w,visibility:v.width?"visible":"hidden",...y,children:[a&&T.jsx("rect",{width:v.width+2*u[0],x:-u[0],y:-u[1],height:v.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:d,ry:d}),T.jsx("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:A,style:r,children:n}),h]}):null}UP.displayName="EdgeText";const lde=Q.memo(UP);function Ix({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,interactionWidth:m=20,...y}){return T.jsxs(T.Fragment,{children:[T.jsx("path",{...y,d:e,fill:"none",className:Rr(["react-flow__edge-path",y.className])}),m&&T.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Kl(t)&&Kl(n)?T.jsx(lde,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h}):null]})}function O5({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===at.Left||e===at.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function $P({sourceX:e,sourceY:t,sourcePosition:n=at.Bottom,targetX:r,targetY:a,targetPosition:l=at.Top}){const[u,d]=O5({pos:n,x1:e,y1:t,x2:r,y2:a}),[h,m]=O5({pos:l,x1:r,y1:a,x2:e,y2:t}),[y,v,S,w]=gP({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${e},${t} C${u},${d} ${h},${m} ${r},${a}`,y,v,S,w]}function XP(e){return Q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:d,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:R,interactionWidth:k})=>{const[D,M,I]=$P({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:d}),L=e.isInternal?void 0:t;return T.jsx(Ix,{id:L,path:D,labelX:M,labelY:I,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:R,interactionWidth:k})})}const sde=XP({isInternal:!1}),YP=XP({isInternal:!0});sde.displayName="SimpleBezierEdge";YP.displayName="SimpleBezierEdgeInternal";function ZP(e){return Q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,sourcePosition:w=at.Bottom,targetPosition:A=at.Top,markerEnd:E,markerStart:R,pathOptions:k,interactionWidth:D})=>{const[M,I,L]=NR({sourceX:n,sourceY:r,sourcePosition:w,targetX:a,targetY:l,targetPosition:A,borderRadius:k?.borderRadius,offset:k?.offset,stepPosition:k?.stepPosition}),P=e.isInternal?void 0:t;return T.jsx(Ix,{id:P,path:M,labelX:I,labelY:L,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,markerEnd:E,markerStart:R,interactionWidth:D})})}const WP=ZP({isInternal:!1}),qP=ZP({isInternal:!0});WP.displayName="SmoothStepEdge";qP.displayName="SmoothStepEdgeInternal";function JP(e){return Q.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return T.jsx(WP,{...n,id:r,pathOptions:Q.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const ude=JP({isInternal:!1}),QP=JP({isInternal:!0});ude.displayName="StepEdge";QP.displayName="StepEdgeInternal";function KP(e){return Q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,markerEnd:w,markerStart:A,interactionWidth:E})=>{const[R,k,D]=vP({sourceX:n,sourceY:r,targetX:a,targetY:l}),M=e.isInternal?void 0:t;return T.jsx(Ix,{id:M,path:R,labelX:k,labelY:D,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,markerEnd:w,markerStart:A,interactionWidth:E})})}const cde=KP({isInternal:!1}),eH=KP({isInternal:!0});cde.displayName="StraightEdge";eH.displayName="StraightEdgeInternal";function tH(e){return Q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u=at.Bottom,targetPosition:d=at.Top,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:R,pathOptions:k,interactionWidth:D})=>{const[M,I,L]=RO({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:d,curvature:k?.curvature}),P=e.isInternal?void 0:t;return T.jsx(Ix,{id:P,path:M,labelX:I,labelY:L,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:R,interactionWidth:D})})}const fde=tH({isInternal:!1}),nH=tH({isInternal:!0});fde.displayName="BezierEdge";nH.displayName="BezierEdgeInternal";const M5={default:nH,straight:eH,step:QP,smoothstep:qP,simplebezier:YP},N5={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},dde=(e,t,n)=>n===at.Left?e-t:n===at.Right?e+t:e,hde=(e,t,n)=>n===at.Top?e-t:n===at.Bottom?e+t:e,D5="react-flow__edgeupdater";function I5({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:u,type:d}){return T.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:u,className:Rr([D5,`${D5}-${d}`]),cx:dde(t,r,e),cy:hde(n,r,e),r,stroke:"transparent",fill:"transparent"})}function pde({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:u,sourcePosition:d,targetPosition:h,onReconnect:m,onReconnectStart:y,onReconnectEnd:v,setReconnecting:S,setUpdateHover:w}){const A=Un(),E=(I,L)=>{if(I.button!==0)return;const{autoPanOnConnect:P,domNode:G,isValidConnection:$,connectionMode:Z,connectionRadius:j,lib:X,onConnectStart:ee,onConnectEnd:ae,cancelConnection:U,nodeLookup:te,rfId:V,panBy:W,updateConnection:J}=A.getState(),ne=L.type==="target",B=(Y,he)=>{S(!1),v?.(Y,n,L.type,he)},oe=Y=>m?.(n,Y),se=(Y,he)=>{S(!0),y?.(I,n,L.type),ee?.(Y,he)};zR.onPointerDown(I.nativeEvent,{autoPanOnConnect:P,connectionMode:Z,connectionRadius:j,domNode:G,handleId:L.id,nodeId:L.nodeId,nodeLookup:te,isTarget:ne,edgeUpdaterType:L.type,lib:X,flowId:V,cancelConnection:U,panBy:W,isValidConnection:$,onConnect:oe,onConnectStart:se,onConnectEnd:ae,onReconnectEnd:B,updateConnection:J,getTransform:()=>A.getState().transform,getFromHandle:()=>A.getState().connection.fromHandle,dragThreshold:A.getState().connectionDragThreshold})},R=I=>E(I,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),k=I=>E(I,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),D=()=>w(!0),M=()=>w(!1);return T.jsxs(T.Fragment,{children:[(e===!0||e==="source")&&T.jsx(I5,{position:d,centerX:r,centerY:a,radius:t,onMouseDown:R,onMouseEnter:D,onMouseOut:M,type:"source"}),(e===!0||e==="target")&&T.jsx(I5,{position:h,centerX:l,centerY:u,radius:t,onMouseDown:k,onMouseEnter:D,onMouseOut:M,type:"target"})]})}function mde({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:u,onMouseEnter:d,onMouseMove:h,onMouseLeave:m,reconnectRadius:y,onReconnect:v,onReconnectStart:S,onReconnectEnd:w,rfId:A,edgeTypes:E,noPanClassName:R,onError:k,disableKeyboardA11y:D}){let M=Zt(ke=>ke.edgeLookup.get(e));const I=Zt(ke=>ke.defaultEdgeOptions);M=I?{...I,...M}:M;let L=M.type||"default",P=E?.[L]||M5[L];P===void 0&&(k?.("011",li.error011(L)),L="default",P=E?.default||M5.default);const G=!!(M.focusable||t&&typeof M.focusable>"u"),$=typeof v<"u"&&(M.reconnectable||n&&typeof M.reconnectable>"u"),Z=!!(M.selectable||r&&typeof M.selectable>"u"),j=Q.useRef(null),[X,ee]=Q.useState(!1),[ae,U]=Q.useState(!1),te=Un(),{zIndex:V,sourceX:W,sourceY:J,targetX:ne,targetY:B,sourcePosition:oe,targetPosition:se}=Zt(Q.useCallback(ke=>{const Xe=ke.nodeLookup.get(M.source),We=ke.nodeLookup.get(M.target);if(!Xe||!We)return{zIndex:M.zIndex,...N5};const _t=gce({id:e,sourceNode:Xe,targetNode:We,sourceHandle:M.sourceHandle||null,targetHandle:M.targetHandle||null,connectionMode:ke.connectionMode,onError:k});return{zIndex:sce({selected:M.selected,zIndex:M.zIndex,sourceNode:Xe,targetNode:We,elevateOnSelect:ke.elevateEdgesOnSelect}),..._t||N5}},[M.source,M.target,M.sourceHandle,M.targetHandle,M.selected,M.zIndex]),Wn),Y=Q.useMemo(()=>M.markerStart?`url('#${DR(M.markerStart,A)}')`:void 0,[M.markerStart,A]),he=Q.useMemo(()=>M.markerEnd?`url('#${DR(M.markerEnd,A)}')`:void 0,[M.markerEnd,A]);if(M.hidden||W===null||J===null||ne===null||B===null)return null;const Te=ke=>{const{addSelectedEdges:Xe,unselectNodesAndEdges:We,multiSelectionActive:_t}=te.getState();Z&&(te.setState({nodesSelectionActive:!1}),M.selected&&_t?(We({nodes:[],edges:[M]}),j.current?.blur()):Xe([e])),a&&a(ke,M)},me=l?ke=>{l(ke,{...M})}:void 0,Ee=u?ke=>{u(ke,{...M})}:void 0,xe=d?ke=>{d(ke,{...M})}:void 0,Be=h?ke=>{h(ke,{...M})}:void 0,He=m?ke=>{m(ke,{...M})}:void 0,Ye=ke=>{if(!D&&tP.includes(ke.key)&&Z){const{unselectNodesAndEdges:Xe,addSelectedEdges:We}=te.getState();ke.key==="Escape"?(j.current?.blur(),Xe({edges:[M]})):We([e])}};return T.jsx("svg",{style:{zIndex:V},children:T.jsxs("g",{className:Rr(["react-flow__edge",`react-flow__edge-${L}`,M.className,R,{selected:M.selected,animated:M.animated,inactive:!Z&&!a,updating:X,selectable:Z}]),onClick:Te,onDoubleClick:me,onContextMenu:Ee,onMouseEnter:xe,onMouseMove:Be,onMouseLeave:He,onKeyDown:G?Ye:void 0,tabIndex:G?0:void 0,role:M.ariaRole??(G?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":M.ariaLabel===null?void 0:M.ariaLabel||`Edge from ${M.source} to ${M.target}`,"aria-describedby":G?`${NP}-${A}`:void 0,ref:j,...M.domAttributes,children:[!ae&&T.jsx(P,{id:e,source:M.source,target:M.target,type:M.type,selected:M.selected,animated:M.animated,selectable:Z,deletable:M.deletable??!0,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,sourceX:W,sourceY:J,targetX:ne,targetY:B,sourcePosition:oe,targetPosition:se,data:M.data,style:M.style,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerStart:Y,markerEnd:he,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth}),$&&T.jsx(pde,{edge:M,isReconnectable:$,reconnectRadius:y,onReconnect:v,onReconnectStart:S,onReconnectEnd:w,sourceX:W,sourceY:J,targetX:ne,targetY:B,sourcePosition:oe,targetPosition:se,setUpdateHover:ee,setReconnecting:U})]})})}const gde=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function rH({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:d,onEdgeMouseMove:h,onEdgeMouseLeave:m,onEdgeClick:y,reconnectRadius:v,onEdgeDoubleClick:S,onReconnectStart:w,onReconnectEnd:A,disableKeyboardA11y:E}){const{edgesFocusable:R,edgesReconnectable:k,elementsSelectable:D,onError:M}=Zt(gde,Wn),I=tde(t);return T.jsxs("div",{className:"react-flow__edges",children:[T.jsx(ide,{defaultColor:e,rfId:n}),I.map(L=>T.jsx(mde,{id:L,edgesFocusable:R,edgesReconnectable:k,elementsSelectable:D,noPanClassName:a,onReconnect:l,onContextMenu:u,onMouseEnter:d,onMouseMove:h,onMouseLeave:m,onClick:y,reconnectRadius:v,onDoubleClick:S,onReconnectStart:w,onReconnectEnd:A,rfId:n,onError:M,edgeTypes:r,disableKeyboardA11y:E},L))]})}rH.displayName="EdgeRenderer";const yde=Q.memo(rH),vde=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function bde({children:e}){const t=Zt(vde);return T.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function xde(e){const t=Yp(),n=Q.useRef(!1);Q.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Sde=e=>e.panZoom?.syncViewport;function wde(e){const t=Zt(Sde),n=Un();return Q.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Ede(e){return e.connection.inProgress?{...e.connection,to:Dx(e.connection.to,e.transform)}:{...e.connection}}function Cde(e){return Ede}function _de(e){const t=Cde();return Zt(t,Wn)}const Ade=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Tde({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:u,isValid:d,inProgress:h}=Zt(Ade,Wn);return!(l&&a&&h)?null:T.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:T.jsx("g",{className:Rr(["react-flow__connection",oP(d)]),children:T.jsx(oH,{style:t,type:n,CustomComponent:r,isValid:d})})})}const oH=({style:e,type:t=Td.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:u,fromHandle:d,fromPosition:h,to:m,toNode:y,toHandle:v,toPosition:S}=_de();if(!a)return;if(n)return T.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:d,fromX:l.x,fromY:l.y,toX:m.x,toY:m.y,fromPosition:h,toPosition:S,connectionStatus:oP(r),toNode:y,toHandle:v});let w="";const A={sourceX:l.x,sourceY:l.y,sourcePosition:h,targetX:m.x,targetY:m.y,targetPosition:S};switch(t){case Td.Bezier:[w]=RO(A);break;case Td.SimpleBezier:[w]=$P(A);break;case Td.Step:[w]=NR({...A,borderRadius:0});break;case Td.SmoothStep:[w]=NR(A);break;default:[w]=vP(A)}return T.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};oH.displayName="ConnectionLine";const Rde={};function z5(e=Rde){const t=Q.useRef(e),n=Un();Q.useEffect(()=>{if(process.env.NODE_ENV==="development"){const r=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const a of r)if(t.current[a]!==e[a]){n.getState().onError?.("002",li.error002());break}t.current=e}},[e])}function kde(){const e=Un(),t=Q.useRef(!1);Q.useEffect(()=>{if(process.env.NODE_ENV==="development"&&!t.current){const n=document.querySelector(".react-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.getState().onError?.("013",li.error013("react")),t.current=!0}},[])}function aH({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:m,onNodeContextMenu:y,onSelectionContextMenu:v,onSelectionStart:S,onSelectionEnd:w,connectionLineType:A,connectionLineStyle:E,connectionLineComponent:R,connectionLineContainerStyle:k,selectionKeyCode:D,selectionOnDrag:M,selectionMode:I,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:G,deleteKeyCode:$,onlyRenderVisibleElements:Z,elementsSelectable:j,defaultViewport:X,translateExtent:ee,minZoom:ae,maxZoom:U,preventScrolling:te,defaultMarkerColor:V,zoomOnScroll:W,zoomOnPinch:J,panOnScroll:ne,panOnScrollSpeed:B,panOnScrollMode:oe,zoomOnDoubleClick:se,panOnDrag:Y,onPaneClick:he,onPaneMouseEnter:Te,onPaneMouseMove:me,onPaneMouseLeave:Ee,onPaneScroll:xe,onPaneContextMenu:Be,paneClickDistance:He,nodeClickDistance:Ye,onEdgeContextMenu:ke,onEdgeMouseEnter:Xe,onEdgeMouseMove:We,onEdgeMouseLeave:_t,reconnectRadius:Kt,onReconnect:Wt,onReconnectStart:qn,onReconnectEnd:ra,noDragClassName:co,noWheelClassName:fo,noPanClassName:ut,disableKeyboardA11y:ho,nodeExtent:Eu,rfId:ml,viewport:Oe,onViewportChange:Le}){return z5(e),z5(t),kde(),xde(n),wde(Oe),T.jsx(Xfe,{onPaneClick:he,onPaneMouseEnter:Te,onPaneMouseMove:me,onPaneMouseLeave:Ee,onPaneContextMenu:Be,onPaneScroll:xe,paneClickDistance:He,deleteKeyCode:$,selectionKeyCode:D,selectionOnDrag:M,selectionMode:I,onSelectionStart:S,onSelectionEnd:w,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:G,elementsSelectable:j,zoomOnScroll:W,zoomOnPinch:J,zoomOnDoubleClick:se,panOnScroll:ne,panOnScrollSpeed:B,panOnScrollMode:oe,panOnDrag:Y,defaultViewport:X,translateExtent:ee,minZoom:ae,maxZoom:U,onSelectionContextMenu:v,preventScrolling:te,noDragClassName:co,noWheelClassName:fo,noPanClassName:ut,disableKeyboardA11y:ho,onViewportChange:Le,isControlledViewport:!!Oe,children:T.jsxs(bde,{children:[T.jsx(yde,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:Wt,onReconnectStart:qn,onReconnectEnd:ra,onlyRenderVisibleElements:Z,onEdgeContextMenu:ke,onEdgeMouseEnter:Xe,onEdgeMouseMove:We,onEdgeMouseLeave:_t,reconnectRadius:Kt,defaultMarkerColor:V,noPanClassName:ut,disableKeyboardA11y:ho,rfId:ml}),T.jsx(Tde,{style:E,type:A,component:R,containerStyle:k}),T.jsx("div",{className:"react-flow__edgelabel-renderer"}),T.jsx(ede,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:m,onNodeContextMenu:y,nodeClickDistance:Ye,onlyRenderVisibleElements:Z,noPanClassName:ut,noDragClassName:co,disableKeyboardA11y:ho,nodeExtent:Eu,rfId:ml}),T.jsx("div",{className:"react-flow__viewport-portal"})]})})}aH.displayName="GraphView";const Ode=Q.memo(aH),j5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:h=.5,maxZoom:m=2,nodeOrigin:y,nodeExtent:v}={})=>{const S=new Map,w=new Map,A=new Map,E=new Map,R=r??t??[],k=n??e??[],D=y??[0,0],M=v??nx;xP(A,E,R);const I=IR(k,S,w,{nodeOrigin:D,nodeExtent:M,elevateNodesOnSelect:!1});let L=[0,0,1];if(u&&a&&l){const P=Nx(S,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:G,y:$,zoom:Z}=AO(P,a,l,h,m,d?.padding??.1);L=[G,$,Z]}return{rfId:"1",width:0,height:0,transform:L,nodes:k,nodesInitialized:I,nodeLookup:S,parentLookup:w,edges:R,edgeLookup:E,connectionLookup:A,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:h,maxZoom:m,translateExtent:nx,nodeExtent:M,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:r0.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:D,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:d,fitViewResolver:null,connection:{...rP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:cP,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:nP}},Mde=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:y,nodeExtent:v})=>Jce((S,w)=>{async function A(){const{nodeLookup:E,panZoom:R,fitViewOptions:k,fitViewResolver:D,width:M,height:I,minZoom:L,maxZoom:P}=w();R&&(await tce({nodes:E,width:M,height:I,panZoom:R,minZoom:L,maxZoom:P},k),D?.resolve(!0),S({fitViewResolver:null}))}return{...j5({nodes:e,edges:t,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:y,nodeExtent:v,defaultNodes:n,defaultEdges:r}),setNodes:E=>{const{nodeLookup:R,parentLookup:k,nodeOrigin:D,elevateNodesOnSelect:M,fitViewQueued:I}=w(),L=IR(E,R,k,{nodeOrigin:D,nodeExtent:v,elevateNodesOnSelect:M,checkEquality:!0});I&&L?(A(),S({nodes:E,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0})):S({nodes:E,nodesInitialized:L})},setEdges:E=>{const{connectionLookup:R,edgeLookup:k}=w();xP(R,k,E),S({edges:E})},setDefaultNodesAndEdges:(E,R)=>{if(E){const{setNodes:k}=w();k(E),S({hasDefaultNodes:!0})}if(R){const{setEdges:k}=w();k(R),S({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:R,nodeLookup:k,parentLookup:D,domNode:M,nodeOrigin:I,nodeExtent:L,debug:P,fitViewQueued:G}=w(),{changes:$,updatedInternals:Z}=wce(E,k,D,M,I,L);Z&&(bce(k,D,{nodeOrigin:I,nodeExtent:L}),G?(A(),S({fitViewQueued:!1,fitViewOptions:void 0})):S({}),$?.length>0&&(P&&console.log("React Flow: trigger node changes",$),R?.($)))},updateNodePositions:(E,R=!1)=>{const k=[],D=[],{nodeLookup:M,triggerNodeChanges:I}=w();for(const[L,P]of E){const G=M.get(L),$=!!(G?.expandParent&&G?.parentId&&P?.position),Z={id:L,type:"position",position:$?{x:Math.max(0,P.position.x),y:Math.max(0,P.position.y)}:P.position,dragging:R};$&&G.parentId&&k.push({id:L,parentId:G.parentId,rect:{...P.internals.positionAbsolute,width:P.measured.width??0,height:P.measured.height??0}}),D.push(Z)}if(k.length>0){const{parentLookup:L,nodeOrigin:P}=w(),G=NO(k,M,L,P);D.push(...G)}I(D)},triggerNodeChanges:E=>{const{onNodesChange:R,setNodes:k,nodes:D,hasDefaultNodes:M,debug:I}=w();if(E?.length){if(M){const L=DO(E,D);k(L)}I&&console.log("React Flow: trigger node changes",E),R?.(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:R,setEdges:k,edges:D,hasDefaultEdges:M,debug:I}=w();if(E?.length){if(M){const L=zP(E,D);k(L)}I&&console.log("React Flow: trigger edge changes",E),R?.(E)}},addSelectedNodes:E=>{const{multiSelectionActive:R,edgeLookup:k,nodeLookup:D,triggerNodeChanges:M,triggerEdgeChanges:I}=w();if(R){const L=E.map(P=>_p(P,!0));M(L);return}M(Ly(D,new Set([...E]),!0)),I(Ly(k))},addSelectedEdges:E=>{const{multiSelectionActive:R,edgeLookup:k,nodeLookup:D,triggerNodeChanges:M,triggerEdgeChanges:I}=w();if(R){const L=E.map(P=>_p(P,!0));I(L);return}I(Ly(k,new Set([...E]))),M(Ly(D,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:R}={})=>{const{edges:k,nodes:D,nodeLookup:M,triggerNodeChanges:I,triggerEdgeChanges:L}=w(),P=E||D,G=R||k,$=P.map(j=>{const X=M.get(j.id);return X&&(X.selected=!1),_p(j.id,!1)}),Z=G.map(j=>_p(j.id,!1));I($),L(Z)},setMinZoom:E=>{const{panZoom:R,maxZoom:k}=w();R?.setScaleExtent([E,k]),S({minZoom:E})},setMaxZoom:E=>{const{panZoom:R,minZoom:k}=w();R?.setScaleExtent([k,E]),S({maxZoom:E})},setTranslateExtent:E=>{w().panZoom?.setTranslateExtent(E),S({translateExtent:E})},setPaneClickDistance:E=>{w().panZoom?.setClickDistance(E)},resetSelectedElements:()=>{const{edges:E,nodes:R,triggerNodeChanges:k,triggerEdgeChanges:D,elementsSelectable:M}=w();if(!M)return;const I=R.reduce((P,G)=>G.selected?[...P,_p(G.id,!1)]:P,[]),L=E.reduce((P,G)=>G.selected?[...P,_p(G.id,!1)]:P,[]);k(I),D(L)},setNodeExtent:E=>{const{nodes:R,nodeLookup:k,parentLookup:D,nodeOrigin:M,elevateNodesOnSelect:I,nodeExtent:L}=w();E[0][0]===L[0][0]&&E[0][1]===L[0][1]&&E[1][0]===L[1][0]&&E[1][1]===L[1][1]||(IR(R,k,D,{nodeOrigin:M,nodeExtent:E,elevateNodesOnSelect:I,checkEquality:!1}),S({nodeExtent:E}))},panBy:E=>{const{transform:R,width:k,height:D,panZoom:M,translateExtent:I}=w();return Ece({delta:E,panZoom:M,transform:R,translateExtent:I,width:k,height:D})},setCenter:async(E,R,k)=>{const{width:D,height:M,maxZoom:I,panZoom:L}=w();if(!L)return Promise.resolve(!1);const P=typeof k?.zoom<"u"?k.zoom:I;return await L.setViewport({x:D/2-E*P,y:M/2-R*P,zoom:P},{duration:k?.duration,ease:k?.ease,interpolate:k?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{S({connection:{...rP}})},updateConnection:E=>{S({connection:E})},reset:()=>S({...j5()})}},Object.is);function Nde({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:u,initialMaxZoom:d,initialFitViewOptions:h,fitView:m,nodeOrigin:y,nodeExtent:v,children:S}){const[w]=Q.useState(()=>Mde({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:m,minZoom:u,maxZoom:d,fitViewOptions:h,nodeOrigin:y,nodeExtent:v}));return T.jsx(Qce,{value:w,children:T.jsx(Sfe,{children:S})})}function Dde({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:u,fitView:d,fitViewOptions:h,minZoom:m,maxZoom:y,nodeOrigin:v,nodeExtent:S}){return Q.useContext(NC)?T.jsx(T.Fragment,{children:e}):T.jsx(Nde,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:u,fitView:d,initialFitViewOptions:h,initialMinZoom:m,initialMaxZoom:y,nodeOrigin:v,nodeExtent:S,children:e})}const Ide={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function zde({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:u,onNodeClick:d,onEdgeClick:h,onInit:m,onMove:y,onMoveStart:v,onMoveEnd:S,onConnect:w,onConnectStart:A,onConnectEnd:E,onClickConnectStart:R,onClickConnectEnd:k,onNodeMouseEnter:D,onNodeMouseMove:M,onNodeMouseLeave:I,onNodeContextMenu:L,onNodeDoubleClick:P,onNodeDragStart:G,onNodeDrag:$,onNodeDragStop:Z,onNodesDelete:j,onEdgesDelete:X,onDelete:ee,onSelectionChange:ae,onSelectionDragStart:U,onSelectionDrag:te,onSelectionDragStop:V,onSelectionContextMenu:W,onSelectionStart:J,onSelectionEnd:ne,onBeforeDelete:B,connectionMode:oe,connectionLineType:se=Td.Bezier,connectionLineStyle:Y,connectionLineComponent:he,connectionLineContainerStyle:Te,deleteKeyCode:me="Backspace",selectionKeyCode:Ee="Shift",selectionOnDrag:xe=!1,selectionMode:Be=rx.Full,panActivationKeyCode:He="Space",multiSelectionKeyCode:Ye=vE()?"Meta":"Control",zoomActivationKeyCode:ke=vE()?"Meta":"Control",snapToGrid:Xe,snapGrid:We,onlyRenderVisibleElements:_t=!1,selectNodesOnDrag:Kt,nodesDraggable:Wt,autoPanOnNodeFocus:qn,nodesConnectable:ra,nodesFocusable:co,nodeOrigin:fo=DP,edgesFocusable:ut,edgesReconnectable:ho,elementsSelectable:Eu=!0,defaultViewport:ml=ffe,minZoom:Oe=.5,maxZoom:Le=2,translateExtent:tt=nx,preventScrolling:lt=!0,nodeExtent:jt,defaultMarkerColor:Ur="#b1b1b7",zoomOnScroll:Na=!0,zoomOnPinch:mr=!0,panOnScroll:kr=!1,panOnScrollSpeed:$n=.5,panOnScrollMode:Cn=zp.Free,zoomOnDoubleClick:or=!0,panOnDrag:en=!0,onPaneClick:ui,onPaneMouseEnter:gl,onPaneMouseMove:ci,onPaneMouseLeave:yl,onPaneScroll:Kp,onPaneContextMenu:Cu,paneClickDistance:us=0,nodeClickDistance:Lo=0,children:rf,onReconnect:em,onReconnectStart:S0,onReconnectEnd:Xn,onEdgeContextMenu:Jn,onEdgeDoubleClick:Or,onEdgeMouseEnter:cs,onEdgeMouseMove:of,onEdgeMouseLeave:tm,reconnectRadius:af=10,onNodesChange:nm,onEdgesChange:qe,noDragClassName:_u="nodrag",noWheelClassName:ar="nowheel",noPanClassName:fi="nopan",fitView:fs,fitViewOptions:oa,connectOnClick:Yn,attributionPosition:Au,proOptions:Kr,defaultEdgeOptions:di,elevateNodesOnSelect:hi,elevateEdgesOnSelect:rm,disableKeyboardA11y:Tu=!1,autoPanOnConnect:Gd,autoPanOnNodeDrag:om,autoPanSpeed:Da,connectionRadius:Ru,isValidConnection:aa,onError:lf,style:Ud,id:pi,nodeDragThreshold:Mr,connectionDragThreshold:mi,viewport:vl,onViewportChange:$d,width:gr,height:ku,colorMode:Xd="light",debug:gi,onScroll:yi,ariaLabelConfig:ds,...w0},po){const hs=pi||"1",sf=mfe(Xd),Ou=Q.useCallback(vi=>{vi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),yi?.(vi)},[yi]);return T.jsx("div",{"data-testid":"rf__wrapper",...w0,onScroll:Ou,style:{...Ud,...Ide},ref:po,className:Rr(["react-flow",a,sf]),id:pi,role:"application",children:T.jsxs(Dde,{nodes:e,edges:t,width:gr,height:ku,fitView:fs,fitViewOptions:oa,minZoom:Oe,maxZoom:Le,nodeOrigin:fo,nodeExtent:jt,children:[T.jsx(Ode,{onInit:m,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:D,onNodeMouseMove:M,onNodeMouseLeave:I,onNodeContextMenu:L,onNodeDoubleClick:P,nodeTypes:l,edgeTypes:u,connectionLineType:se,connectionLineStyle:Y,connectionLineComponent:he,connectionLineContainerStyle:Te,selectionKeyCode:Ee,selectionOnDrag:xe,selectionMode:Be,deleteKeyCode:me,multiSelectionKeyCode:Ye,panActivationKeyCode:He,zoomActivationKeyCode:ke,onlyRenderVisibleElements:_t,defaultViewport:ml,translateExtent:tt,minZoom:Oe,maxZoom:Le,preventScrolling:lt,zoomOnScroll:Na,zoomOnPinch:mr,zoomOnDoubleClick:or,panOnScroll:kr,panOnScrollSpeed:$n,panOnScrollMode:Cn,panOnDrag:en,onPaneClick:ui,onPaneMouseEnter:gl,onPaneMouseMove:ci,onPaneMouseLeave:yl,onPaneScroll:Kp,onPaneContextMenu:Cu,paneClickDistance:us,nodeClickDistance:Lo,onSelectionContextMenu:W,onSelectionStart:J,onSelectionEnd:ne,onReconnect:em,onReconnectStart:S0,onReconnectEnd:Xn,onEdgeContextMenu:Jn,onEdgeDoubleClick:Or,onEdgeMouseEnter:cs,onEdgeMouseMove:of,onEdgeMouseLeave:tm,reconnectRadius:af,defaultMarkerColor:Ur,noDragClassName:_u,noWheelClassName:ar,noPanClassName:fi,rfId:hs,disableKeyboardA11y:Tu,nodeExtent:jt,viewport:vl,onViewportChange:$d}),T.jsx(pfe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:A,onConnectEnd:E,onClickConnectStart:R,onClickConnectEnd:k,nodesDraggable:Wt,autoPanOnNodeFocus:qn,nodesConnectable:ra,nodesFocusable:co,edgesFocusable:ut,edgesReconnectable:ho,elementsSelectable:Eu,elevateNodesOnSelect:hi,elevateEdgesOnSelect:rm,minZoom:Oe,maxZoom:Le,nodeExtent:jt,onNodesChange:nm,onEdgesChange:qe,snapToGrid:Xe,snapGrid:We,connectionMode:oe,translateExtent:tt,connectOnClick:Yn,defaultEdgeOptions:di,fitView:fs,fitViewOptions:oa,onNodesDelete:j,onEdgesDelete:X,onDelete:ee,onNodeDragStart:G,onNodeDrag:$,onNodeDragStop:Z,onSelectionDrag:te,onSelectionDragStart:U,onSelectionDragStop:V,onMove:y,onMoveStart:v,onMoveEnd:S,noPanClassName:fi,nodeOrigin:fo,rfId:hs,autoPanOnConnect:Gd,autoPanOnNodeDrag:om,autoPanSpeed:Da,onError:lf,connectionRadius:Ru,isValidConnection:aa,selectNodesOnDrag:Kt,nodeDragThreshold:Mr,connectionDragThreshold:mi,onBeforeDelete:B,paneClickDistance:us,debug:gi,ariaLabelConfig:ds}),T.jsx(cfe,{onSelectionChange:ae}),rf,T.jsx(afe,{proOptions:Kr,position:Au}),T.jsx(ofe,{rfId:hs,disableKeyboardA11y:Tu})]})})}var jde=jP(zde);function Bde({dimensions:e,lineWidth:t,variant:n,className:r}){return T.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Rr(["react-flow__background-pattern",n,r])})}function Lde({radius:e,className:t}){return T.jsx("circle",{cx:e,cy:e,r:e,className:Rr(["react-flow__background-pattern","dots",t])})}var ea;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ea||(ea={}));const Pde={[ea.Dots]:1,[ea.Lines]:1,[ea.Cross]:6},Hde=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function iH({id:e,variant:t=ea.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:u,bgColor:d,style:h,className:m,patternClassName:y}){const v=Q.useRef(null),{transform:S,patternId:w}=Zt(Hde,Wn),A=r||Pde[t],E=t===ea.Dots,R=t===ea.Cross,k=Array.isArray(n)?n:[n,n],D=[k[0]*S[2]||1,k[1]*S[2]||1],M=A*S[2],I=Array.isArray(l)?l:[l,l],L=R?[M,M]:D,P=[I[0]*S[2]||1+L[0]/2,I[1]*S[2]||1+L[1]/2],G=`${w}${e||""}`;return T.jsxs("svg",{className:Rr(["react-flow__background",m]),style:{...h,...IC,"--xy-background-color-props":d,"--xy-background-pattern-color-props":u},ref:v,"data-testid":"rf__background",children:[T.jsx("pattern",{id:G,x:S[0]%D[0],y:S[1]%D[1],width:D[0],height:D[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${P[0]},-${P[1]})`,children:E?T.jsx(Lde,{radius:M/2,className:y}):T.jsx(Bde,{dimensions:L,lineWidth:a,variant:t,className:y})}),T.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${G})`})]})}iH.displayName="Background";const Vde=Q.memo(iH);function Fde(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:T.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Gde(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:T.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Ude(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:T.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function $de(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Xde(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function f2({children:e,className:t,...n}){return T.jsx("button",{type:"button",className:Rr(["react-flow__controls-button",t]),...n,children:e})}const Yde=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function lH({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:u,onFitView:d,onInteractiveChange:h,className:m,children:y,position:v="bottom-left",orientation:S="vertical","aria-label":w}){const A=Un(),{isInteractive:E,minZoomReached:R,maxZoomReached:k,ariaLabelConfig:D}=Zt(Yde,Wn),{zoomIn:M,zoomOut:I,fitView:L}=Yp(),P=()=>{M(),l?.()},G=()=>{I(),u?.()},$=()=>{L(a),d?.()},Z=()=>{A.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),h?.(!E)},j=S==="horizontal"?"horizontal":"vertical";return T.jsxs(DC,{className:Rr(["react-flow__controls",j,m]),position:v,style:e,"data-testid":"rf__controls","aria-label":w??D["controls.ariaLabel"],children:[t&&T.jsxs(T.Fragment,{children:[T.jsx(f2,{onClick:P,className:"react-flow__controls-zoomin",title:D["controls.zoomIn.ariaLabel"],"aria-label":D["controls.zoomIn.ariaLabel"],disabled:k,children:T.jsx(Fde,{})}),T.jsx(f2,{onClick:G,className:"react-flow__controls-zoomout",title:D["controls.zoomOut.ariaLabel"],"aria-label":D["controls.zoomOut.ariaLabel"],disabled:R,children:T.jsx(Gde,{})})]}),n&&T.jsx(f2,{className:"react-flow__controls-fitview",onClick:$,title:D["controls.fitView.ariaLabel"],"aria-label":D["controls.fitView.ariaLabel"],children:T.jsx(Ude,{})}),r&&T.jsx(f2,{className:"react-flow__controls-interactive",onClick:Z,title:D["controls.interactive.ariaLabel"],"aria-label":D["controls.interactive.ariaLabel"],children:E?T.jsx(Xde,{}):T.jsx($de,{})}),y]})}lH.displayName="Controls";Q.memo(lH);function Zde({id:e,x:t,y:n,width:r,height:a,style:l,color:u,strokeColor:d,strokeWidth:h,className:m,borderRadius:y,shapeRendering:v,selected:S,onClick:w}){const{background:A,backgroundColor:E}=l||{},R=u||A||E;return T.jsx("rect",{className:Rr(["react-flow__minimap-node",{selected:S},m]),x:t,y:n,rx:y,ry:y,width:r,height:a,style:{fill:R,stroke:d,strokeWidth:h},shapeRendering:v,onClick:w?k=>w(k,e):void 0})}const Wde=Q.memo(Zde),qde=e=>e.nodes.map(t=>t.id),hT=e=>e instanceof Function?e:()=>e;function Jde({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=Wde,onClick:u}){const d=Zt(qde,Wn),h=hT(t),m=hT(e),y=hT(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return T.jsx(T.Fragment,{children:d.map(S=>T.jsx(Kde,{id:S,nodeColorFunc:h,nodeStrokeColorFunc:m,nodeClassNameFunc:y,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:u,shapeRendering:v},S))})}function Qde({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:d,onClick:h}){const{node:m,x:y,y:v,width:S,height:w}=Zt(A=>{const{internals:E}=A.nodeLookup.get(e),R=E.userNode,{x:k,y:D}=E.positionAbsolute,{width:M,height:I}=ef(R);return{node:R,x:k,y:D,width:M,height:I}},Wn);return!m||m.hidden||!fP(m)?null:T.jsx(d,{x:y,y:v,width:S,height:w,style:m.style,selected:!!m.selected,className:r(m),color:t(m),borderRadius:a,strokeColor:n(m),strokeWidth:l,shapeRendering:u,onClick:h,id:m.id})}const Kde=Q.memo(Qde);var ehe=Q.memo(Jde);const the=200,nhe=150,rhe=e=>!e.hidden,ohe=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?uP(Nx(e.nodeLookup,{filter:rhe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ahe="react-flow__minimap-desc";function sH({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:d,bgColor:h,maskColor:m,maskStrokeColor:y,maskStrokeWidth:v,position:S="bottom-right",onClick:w,onNodeClick:A,pannable:E=!1,zoomable:R=!1,ariaLabel:k,inversePan:D,zoomStep:M=10,offsetScale:I=5}){const L=Un(),P=Q.useRef(null),{boundingRect:G,viewBB:$,rfId:Z,panZoom:j,translateExtent:X,flowWidth:ee,flowHeight:ae,ariaLabelConfig:U}=Zt(ohe,Wn),te=e?.width??the,V=e?.height??nhe,W=G.width/te,J=G.height/V,ne=Math.max(W,J),B=ne*te,oe=ne*V,se=I*ne,Y=G.x-(B-G.width)/2-se,he=G.y-(oe-G.height)/2-se,Te=B+se*2,me=oe+se*2,Ee=`${ahe}-${Z}`,xe=Q.useRef(0),Be=Q.useRef();xe.current=ne,Q.useEffect(()=>{if(P.current&&j)return Be.current=Mce({domNode:P.current,panZoom:j,getTransform:()=>L.getState().transform,getViewScale:()=>xe.current}),()=>{Be.current?.destroy()}},[j]),Q.useEffect(()=>{Be.current?.update({translateExtent:X,width:ee,height:ae,inversePan:D,pannable:E,zoomStep:M,zoomable:R})},[E,R,D,M,X,ee,ae]);const He=w?Xe=>{const[We,_t]=Be.current?.pointer(Xe)||[0,0];w(Xe,{x:We,y:_t})}:void 0,Ye=A?Q.useCallback((Xe,We)=>{const _t=L.getState().nodeLookup.get(We).internals.userNode;A(Xe,_t)},[]):void 0,ke=k??U["minimap.ariaLabel"];return T.jsx(DC,{position:S,style:{...e,"--xy-minimap-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-background-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-color-props":typeof y=="string"?y:void 0,"--xy-minimap-mask-stroke-width-props":typeof v=="number"?v*ne:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Rr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:T.jsxs("svg",{width:te,height:V,viewBox:`${Y} ${he} ${Te} ${me}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Ee,ref:P,onClick:He,children:[ke&&T.jsx("title",{id:Ee,children:ke}),T.jsx(ehe,{onClick:Ye,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:d}),T.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-se},${he-se}h${Te+se*2}v${me+se*2}h${-Te-se*2}z
|
|
1083
1083
|
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}sH.displayName="MiniMap";const ihe=Q.memo(sH),lhe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,she={[l0.Line]:"right",[l0.Handle]:"bottom-right"};function uhe({nodeId:e,position:t,variant:n=l0.Handle,className:r,style:a=void 0,children:l,color:u,minWidth:d=10,minHeight:h=10,maxWidth:m=Number.MAX_VALUE,maxHeight:y=Number.MAX_VALUE,keepAspectRatio:v=!1,resizeDirection:S,autoScale:w=!0,shouldResize:A,onResizeStart:E,onResize:R,onResizeEnd:k}){const D=HP(),M=typeof e=="string"?e:D,I=Un(),L=Q.useRef(null),P=n===l0.Handle,G=Zt(Q.useCallback(lhe(P&&w),[P,w]),Wn),$=Q.useRef(null),Z=t??she[n];Q.useEffect(()=>{if(!(!L.current||!M))return $.current||($.current=Yce({domNode:L.current,nodeId:M,getStoreItems:()=>{const{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,domNode:V}=I.getState();return{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,paneDomNode:V}},onChange:(X,ee)=>{const{triggerNodeChanges:ae,nodeLookup:U,parentLookup:te,nodeOrigin:V}=I.getState(),W=[],J={x:X.x,y:X.y},ne=U.get(M);if(ne&&ne.expandParent&&ne.parentId){const B=ne.origin??V,oe=X.width??ne.measured.width??0,se=X.height??ne.measured.height??0,Y={id:ne.id,parentId:ne.parentId,rect:{width:oe,height:se,...dP({x:X.x??ne.position.x,y:X.y??ne.position.y},{width:oe,height:se},ne.parentId,U,B)}},he=NO([Y],U,te,V);W.push(...he),J.x=X.x?Math.max(B[0]*oe,X.x):void 0,J.y=X.y?Math.max(B[1]*se,X.y):void 0}if(J.x!==void 0&&J.y!==void 0){const B={id:M,type:"position",position:{...J}};W.push(B)}if(X.width!==void 0&&X.height!==void 0){const oe={id:M,type:"dimensions",resizing:!0,setAttributes:S?S==="horizontal"?"width":"height":!0,dimensions:{width:X.width,height:X.height}};W.push(oe)}for(const B of ee){const oe={...B,type:"position"};W.push(oe)}ae(W)},onEnd:({width:X,height:ee})=>{const ae={id:M,type:"dimensions",resizing:!1,dimensions:{width:X,height:ee}};I.getState().triggerNodeChanges([ae])}})),$.current.update({controlPosition:Z,boundaries:{minWidth:d,minHeight:h,maxWidth:m,maxHeight:y},keepAspectRatio:v,resizeDirection:S,onResizeStart:E,onResize:R,onResizeEnd:k,shouldResize:A}),()=>{$.current?.destroy()}},[Z,d,h,m,y,v,E,R,k,A]);const j=Z.split("-");return T.jsx("div",{className:Rr(["react-flow__resize-control","nodrag",...j,n,r]),ref:L,style:{...a,scale:G,...u&&{[P?"backgroundColor":"borderColor"]:u}},children:l})}Q.memo(uhe);function che(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const{useRef:fhe}=Q;function zO(e){const t=fhe();return n=>{const r=e(n);return che(t.current,r)?t.current:t.current=r}}const dhe=()=>{const{group:e}=jo();return async(t,n)=>{if(e)return await e.group_nodes(t,n)}},hhe=()=>{const{group:e}=jo();return async t=>{if(e)for(const n of t)await e.remove_group(n)}},phe=({data:e})=>{const t=e?.group?.id||e?.id,n=hhe(),r=z.useCallback(a=>{a.stopPropagation(),t&&n([t])},[t,n]);return T.jsxs("div",{className:"fn-group",children:[T.jsx("button",{className:"fn-group-remove",title:"Remove group",onClick:r,children:T.jsx(sC,{})}),"Group"]})},jO=z.memo(({value:e})=>{const t=e?.toString()??"",n=Math.round(3*t.length/4);return T.jsx("div",{children:T.jsxs("pre",{children:["Bytes(",n,")"]})})}),uH=z.memo(({value:e})=>typeof e!="string"?T.jsx("div",{children:"Invalid SVG"}):T.jsx(Mre,{value:e})),cH=({value:e,preValue:t,onLoaded:n})=>{const[r,a]=z.useState(t?.toString()||e?.toString());return z.useEffect(()=>{if(e===t||e==null)return;const u=new Image,d=e.toString();return u.onload=()=>{n?.(),a(d)},u.src=d,()=>{u.onload=null}},[e,t,n]),r===void 0?T.jsx(T.Fragment,{}):typeof r!="string"?(console.error("ImageRenderer: value is not a string",r),T.jsx(T.Fragment,{})):r.startsWith("data:")||r.startsWith("blob:")?T.jsx(Nre,{src:r}):T.jsx(Ore,{value:r,format:"jpeg"})},mhe=z.memo(({value:e})=>{let t="";try{t=JSON.stringify(e)}catch{}return T.jsx("div",{children:T.jsx("pre",{children:t})})}),zC=({value:e})=>T.jsx(pre,{data:e}),fH=z.memo(({value:e})=>{if(typeof e!="object"||e==null)return T.jsx("div",{children:"Invalid Table"});if(!("columns"in e&&"index"in e&&"data"in e))return T.jsx("div",{children:"Invalid Table"});if(!Array.isArray(e.columns)||!Array.isArray(e.index)||!Array.isArray(e.data)||!e.data.every(n=>Array.isArray(n)))return T.jsx("div",{children:"Invalid Table"});const t={columns:e.columns||[],index:e.index||[],data:e.data||[]};return T.jsx(Tj,{tabledata:t})}),xE=e=>T.jsx(mhe,{...e}),SE=zC,BO={string:xE,str:xE,table:fH,image:cH,svg:uH,dict:zC,bytes:jO},ghe=()=>{const e=Gn(),{full:t,preview:n}=e.valuestore(),r=JSON.stringify(t?.value||n?.value)||"";return`Bytes(${Math.round(3*r.length/4)})`},yhe={bytes:ghe},zx=e=>({value:t,preValue:n,onLoaded:r})=>T.jsx(e,{value:t,preValue:n,onLoaded:r}),Ko=(e,t=void 0,n={})=>({})=>{const r=Gn(),{full:a,preview:l}=r.valuestore(),d=(a===void 0?l:a)?.value||t;return T.jsx(e,{value:d,...n})},LO=e=>({})=>T.jsx(e,{}),PO=(e,t=void 0)=>({})=>{const n=Gn(),{full:r,preview:a}=n.valuestore(),u=(r===void 0?a:r)?.value||t;return T.jsx(e,{value:u})},vhe={...Object.fromEntries(Object.entries(BO).map(([e,t])=>[e,t?zx(t):void 0]))},B5=zx(zC),dH={...Object.fromEntries(Object.entries(BO).map(([e,t])=>[e,t?Ko(t):void 0])),string:Ko(xE),str:Ko(xE),table:Ko(fH,void 0,{pageSize:10}),image:Ko(cH),svg:Ko(uH,""),dict:Ko(zC,"{}"),bytes:Ko(jO,"")},bhe={...Object.fromEntries(Object.entries(dH).map(([e,t])=>[e,t?LO(t):void 0]))},xhe=()=>{const e=Gn(),{preview:t,full:n}=e.valuestore();let r=(JSON.stringify(n||t)||"").replace(/\\n/g,`
|
|
1084
1084
|
`);return r.length>63&&(r=r.slice(0,60)+"..."),T.jsx("div",{children:r})},She={},whe=({inputconverter:e})=>{const t=Gn(),{preview:n}=t.valuestore(),r=t.use(),a=n?.value===void 0,l=z.useRef(null),u=Zp(r);z.useEffect(()=>{l.current&&(l.current.indeterminate=a)},[l,a]);const d=z.useCallback(h=>{let m=h.target.checked;try{m=e[0](h.target.checked)}catch{}u(m)},[u,e]);return T.jsx("input",{ref:l,type:"checkbox",className:"styledcheckbox booleaninput",checked:!!e[1](n?.value),onChange:d,disabled:r.connected})},Ehe=({})=>{const e=Gn(),t=Qt(),n=e.use(),{preview:r,full:a}=e.valuestore(),l=a===void 0?r?.value:a.value,u=Zp(n),d=typeof l=="string"||Array.isArray(l)&&l.every(S=>typeof S=="number")?l:void 0,h=n.value_options?.colorspace||"hex",m=z.useCallback(S=>{let w="<NoValue>";S&&(S[h]?w=S[h]():w=S.hex()),S===null&&(w=null);try{w=w}catch{}u(w)},[u,h]);let y=!1;typeof n.type!="string"&&"anyOf"in n.type&&n.type.anyOf!==void 0&&(y=n.type.anyOf.some(S=>S==="None"));const v=t.local_state(()=>t.reactflowRef);return T.jsx(hee,{onChange:m,inicolordata:d,allow_null:y,inicolorspace:h,portalContainer:v})};function hH(e,[t,n]){return Math.min(n,Math.max(t,e))}var Che=z.createContext(void 0);function jC(e){const t=z.useContext(Che);return e||t||"ltr"}function _he(e){const t=z.useRef({value:e,previous:e});return z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var pH=["PageUp","PageDown"],mH=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gH={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},y0="Slider",[BR,Ahe,The]=mC(y0),[yH,twe]=bu(y0,[The]),[Rhe,BC]=yH(y0),vH=z.forwardRef((e,t)=>{const{name:n,min:r=0,max:a=100,step:l=1,orientation:u="horizontal",disabled:d=!1,minStepsBetweenThumbs:h=0,defaultValue:m=[r],value:y,onValueChange:v=()=>{},onValueCommit:S=()=>{},inverted:w=!1,form:A,...E}=e,R=z.useRef(new Set),k=z.useRef(0),M=u==="horizontal"?khe:Ohe,[I=[],L]=Hd({prop:y,defaultProp:m,onChange:X=>{[...R.current][k.current]?.focus(),v(X)}}),P=z.useRef(I);function G(X){const ee=zhe(I,X);j(X,ee)}function $(X){j(X,k.current)}function Z(){const X=P.current[k.current];I[k.current]!==X&&S(I)}function j(X,ee,{commit:ae}={commit:!1}){const U=Phe(l),te=Hhe(Math.round((X-r)/l)*l+r,U),V=hH(te,[r,a]);L((W=[])=>{const J=Dhe(W,V,ee);if(Lhe(J,h*l)){k.current=J.indexOf(V);const ne=String(J)!==String(W);return ne&&ae&&S(J),ne?J:W}else return W})}return T.jsx(Rhe,{scope:e.__scopeSlider,name:n,disabled:d,min:r,max:a,valueIndexToChangeRef:k,thumbs:R.current,values:I,orientation:u,form:A,children:T.jsx(BR.Provider,{scope:e.__scopeSlider,children:T.jsx(BR.Slot,{scope:e.__scopeSlider,children:T.jsx(M,{"aria-disabled":d,"data-disabled":d?"":void 0,...E,ref:t,onPointerDown:Ke(E.onPointerDown,()=>{d||(P.current=I)}),min:r,max:a,inverted:w,onSlideStart:d?void 0:G,onSlideMove:d?void 0:$,onSlideEnd:d?void 0:Z,onHomeKeyDown:()=>!d&&j(r,0,{commit:!0}),onEndKeyDown:()=>!d&&j(a,I.length-1,{commit:!0}),onStepKeyDown:({event:X,direction:ee})=>{if(!d){const te=pH.includes(X.key)||X.shiftKey&&mH.includes(X.key)?10:1,V=k.current,W=I[V],J=l*te*ee;j(W+J,V,{commit:!0})}}})})})})});vH.displayName=y0;var[bH,xH]=yH(y0,{startEdge:"left",endEdge:"right",size:"width",direction:1}),khe=z.forwardRef((e,t)=>{const{min:n,max:r,dir:a,inverted:l,onSlideStart:u,onSlideMove:d,onSlideEnd:h,onStepKeyDown:m,...y}=e,[v,S]=z.useState(null),w=En(t,M=>S(M)),A=z.useRef(void 0),E=jC(a),R=E==="ltr",k=R&&!l||!R&&l;function D(M){const I=A.current||v.getBoundingClientRect(),L=[0,I.width],G=HO(L,k?[n,r]:[r,n]);return A.current=I,G(M-I.left)}return T.jsx(bH,{scope:e.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:T.jsx(SH,{dir:E,"data-orientation":"horizontal",...y,ref:w,style:{...y.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:M=>{const I=D(M.clientX);u?.(I)},onSlideMove:M=>{const I=D(M.clientX);d?.(I)},onSlideEnd:()=>{A.current=void 0,h?.()},onStepKeyDown:M=>{const L=gH[k?"from-left":"from-right"].includes(M.key);m?.({event:M,direction:L?-1:1})}})})}),Ohe=z.forwardRef((e,t)=>{const{min:n,max:r,inverted:a,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:h,...m}=e,y=z.useRef(null),v=En(t,y),S=z.useRef(void 0),w=!a;function A(E){const R=S.current||y.current.getBoundingClientRect(),k=[0,R.height],M=HO(k,w?[r,n]:[n,r]);return S.current=R,M(E-R.top)}return T.jsx(bH,{scope:e.__scopeSlider,startEdge:w?"bottom":"top",endEdge:w?"top":"bottom",size:"height",direction:w?1:-1,children:T.jsx(SH,{"data-orientation":"vertical",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:E=>{const R=A(E.clientY);l?.(R)},onSlideMove:E=>{const R=A(E.clientY);u?.(R)},onSlideEnd:()=>{S.current=void 0,d?.()},onStepKeyDown:E=>{const k=gH[w?"from-bottom":"from-top"].includes(E.key);h?.({event:E,direction:k?-1:1})}})})}),SH=z.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:l,onHomeKeyDown:u,onEndKeyDown:d,onStepKeyDown:h,...m}=e,y=BC(y0,n);return T.jsx(zt.span,{...m,ref:t,onKeyDown:Ke(e.onKeyDown,v=>{v.key==="Home"?(u(v),v.preventDefault()):v.key==="End"?(d(v),v.preventDefault()):pH.concat(mH).includes(v.key)&&(h(v),v.preventDefault())}),onPointerDown:Ke(e.onPointerDown,v=>{const S=v.target;S.setPointerCapture(v.pointerId),v.preventDefault(),y.thumbs.has(S)?S.focus():r(v)}),onPointerMove:Ke(e.onPointerMove,v=>{v.target.hasPointerCapture(v.pointerId)&&a(v)}),onPointerUp:Ke(e.onPointerUp,v=>{const S=v.target;S.hasPointerCapture(v.pointerId)&&(S.releasePointerCapture(v.pointerId),l(v))})})}),wH="SliderTrack",EH=z.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=BC(wH,n);return T.jsx(zt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});EH.displayName=wH;var LR="SliderRange",CH=z.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=BC(LR,n),l=xH(LR,n),u=z.useRef(null),d=En(t,u),h=a.values.length,m=a.values.map(S=>TH(S,a.min,a.max)),y=h>1?Math.min(...m):0,v=100-Math.max(...m);return T.jsx(zt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:d,style:{...e.style,[l.startEdge]:y+"%",[l.endEdge]:v+"%"}})});CH.displayName=LR;var PR="SliderThumb",_H=z.forwardRef((e,t)=>{const n=Ahe(e.__scopeSlider),[r,a]=z.useState(null),l=En(t,d=>a(d)),u=z.useMemo(()=>r?n().findIndex(d=>d.ref.current===r):-1,[n,r]);return T.jsx(Mhe,{...e,ref:l,index:u})}),Mhe=z.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:a,...l}=e,u=BC(PR,n),d=xH(PR,n),[h,m]=z.useState(null),y=En(t,D=>m(D)),v=h?u.form||!!h.closest("form"):!0,S=A6(h),w=u.values[r],A=w===void 0?0:TH(w,u.min,u.max),E=Ihe(r,u.values.length),R=S?.[d.size],k=R?jhe(R,A,d.direction):0;return z.useEffect(()=>{if(h)return u.thumbs.add(h),()=>{u.thumbs.delete(h)}},[h,u.thumbs]),T.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${A}% + ${k}px)`},children:[T.jsx(BR.ItemSlot,{scope:e.__scopeSlider,children:T.jsx(zt.span,{role:"slider","aria-label":e["aria-label"]||E,"aria-valuemin":u.min,"aria-valuenow":w,"aria-valuemax":u.max,"aria-orientation":u.orientation,"data-orientation":u.orientation,"data-disabled":u.disabled?"":void 0,tabIndex:u.disabled?void 0:0,...l,ref:y,style:w===void 0?{display:"none"}:e.style,onFocus:Ke(e.onFocus,()=>{u.valueIndexToChangeRef.current=r})})}),v&&T.jsx(AH,{name:a??(u.name?u.name+(u.values.length>1?"[]":""):void 0),form:u.form,value:w},r)]})});_H.displayName=PR;var Nhe="RadioBubbleInput",AH=z.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const a=z.useRef(null),l=En(a,r),u=_he(t);return z.useEffect(()=>{const d=a.current;if(!d)return;const h=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&y){const v=new Event("input",{bubbles:!0});y.call(d,t),d.dispatchEvent(v)}},[u,t]),T.jsx(zt.input,{style:{display:"none"},...n,ref:l,defaultValue:t})});AH.displayName=Nhe;function Dhe(e=[],t,n){const r=[...e];return r[n]=t,r.sort((a,l)=>a-l)}function TH(e,t,n){const l=100/(n-t)*(e-t);return hH(l,[0,100])}function Ihe(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function zhe(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),r=Math.min(...n);return n.indexOf(r)}function jhe(e,t,n){const r=e/2,l=HO([0,50],[0,r]);return(r-l(t)*n)*n}function Bhe(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Lhe(e,t){if(t>0){const n=Bhe(e);return Math.min(...n)>=t}return!0}function HO(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Phe(e){return(String(e).split(".")[1]||"").length}function Hhe(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Vhe=vH,Fhe=EH,Ghe=CH,Uhe=_H;function $he(e){return e===0?0:Math.abs(e)<1e-12?e:Number(e.toPrecision(12))}const RH=({inputconverter:e,parser:t=n=>parseFloat(n)})=>{const n=Gn(),{preview:r}=n.valuestore(),a=n.use(),l=Zp(a),[u,d]=z.useState(e[1](r?.value));z.useEffect(()=>{d(e[1](r?.value))},[r]);const h=z.useCallback(w=>{w=t(parseFloat(w.toString()).toString()),isNaN(w)?(w="<NoValue>",d("")):(a.value_options?.min!==void 0&&w<a.value_options.min&&(w=a.value_options.min),a.value_options?.max!==void 0&&w>a.value_options.max&&(w=a.value_options.max),w=$he(w),d(w.toString()));try{w=e[0](w)}catch{}w!==r?.value&&l(w)},[a,e,l]),m=z.useCallback(w=>{h(w.target.value)},[h]);let y=a.connected?e[1](r?.value):u;y===void 0&&(y=a.value_options?.min),y===void 0&&(y=a.value_options?.max),y===void 0&&(y=""),y===null&&(y="");let v=null,S=1;return a.value_options?.step!==void 0?S=a.value_options.step:a.value_options?.max!==void 0&&a.value_options?.min!==void 0&&(S=(a.value_options?.max-a.value_options?.min)/1e3),a.value_options?.max!==void 0&&a.value_options?.min!==void 0&&!a.connected&&(v=T.jsx("div",{style:{minWidth:"6.25rem"},className:"SliderContainer",children:T.jsxs(Vhe,{className:"SliderRoot",value:[y===void 0?a.value_options?.min:y],min:a.value_options?.min,max:a.value_options?.max,step:S,disabled:a.connected,onValueCommit:w=>{isNaN(w[0])||h(w[0])},onValueChange:w=>{isNaN(w[0])||d(w[0].toString())},onKeyDown:w=>{["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(w.key)&&w.stopPropagation()},children:[T.jsx(Fhe,{className:"SliderTrack",children:T.jsx(Ghe,{className:"SliderRange"})}),T.jsx(Uhe,{className:"SliderThumb"})]})})),T.jsxs(T.Fragment,{children:[v,T.jsx("input",{type:"text",className:"nodedatainput styledinput numberinput",value:y,onChange:w=>d(w.target.value),onBlur:m,step:S,onKeyDown:w=>{if(!(w.ctrlKey||w.metaKey)){if(w.key==="ArrowUp"){w.shiftKey&&(S*=10);let A=(parseFloat(y)||0)+S;h(A);return}if(w.key==="ArrowDown"){w.shiftKey&&(S*=10);let A=(parseFloat(y)||0)-S;h(A);return}!/^[0-9.eE+-]$/.test(w.key)&&!["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(w.key)&&w.preventDefault()}},disabled:a.connected,min:a.value_options?.min,max:a.value_options?.max})]})},Xhe=({inputconverter:e})=>RH({inputconverter:e,parser:parseFloat}),Yhe=({inputconverter:e})=>RH({inputconverter:e,parser:parseInt}),Zhe=e=>e,Whe=e=>parseFloat(e),qhe=e=>!!e,Jhe=e=>e==="null"?null:e,Qhe=e=>e==="nuinputconvertermber"?Whe:e==="boolean"?qhe:e==="undefined"?Jhe:Zhe,lx=({inputconverter:e,parser:t})=>{const n=Gn(),r=n.use(),{preview:a,full:l}=n.valuestore(),u=l===void 0?a?.value:l.value,d=Zp(r);let h=r.value_options?.options||[];Array.isArray(h)&&(h={type:"enum",values:h,keys:h.map(E=>E===null?"None":E.toString()),nullable:!1}),h.type!=="enum"&&(h={type:"enum",values:Object.values(h),keys:Object.keys(h),nullable:!1}),h=h,h.nullable&&!h.values.includes(null)&&!h.keys.includes("None")&&(h.values.unshift(null),h.keys.unshift("None"));const m=[];for(let E=0;E<h.values.length;E++){const R=h.values[E]===null||h.values[E]===void 0?"undefined":typeof h.values[E];let k=h.values[E];k===null&&(k="null"),k===void 0&&(k="undefined"),m.push([h.keys[E],k.toString(),R])}const y=z.useCallback(({value:E,datatype:R})=>{let D=(t||Qhe(R))(E);try{D=e[0](E)}catch{}d(D)},[r,e,d]);let v=u;v===null&&(v="null"),v===void 0&&(v="undefined");const S=m.find(E=>E[1]===v.toString());let w;S!==void 0&&(w={value:S[1],label:S[0],datatype:S[2]});const A=m.map(E=>({value:E[1],label:E[0],datatype:E[2]}));return T.jsx(qne,{className:"nodedatainput styleddropdown",options:A,defaultValue:w,onChange:E=>{if(E===null){y({value:"<NoValue>",datatype:"string"});return}y(E)}})},L5=({inputconverter:e})=>{const t=Gn(),{preview:n,full:r}=t.valuestore(),a=t.use(),l=r===void 0?n?.value:r?.value,u=Zp(a),[d,h]=z.useState(e[1](l));z.useEffect(()=>{h(e[1](l))},[l]);const m=z.useCallback(w=>{let A=w.target.value;A||(A="<NoValue>");try{A=e[0](A)}catch{}A!==l&&u(A)},[u,e,l]);let y=a.connected?e[1](l):d;y==null&&(y=""),y=y.toString();const v=(y.toString().match(/\n/g)||[]).length,S=Math.max(...y.split(`
|
|
1085
|
-
`).map(w=>w.length),0);return T.jsx("textarea",{className:"nodedatainput styledinput stringinput",value:y,onChange:w=>h(w.target.value),onBlur:w=>{m(w)},disabled:a.connected,rows:v+1,cols:S+1})},Khe={float:Xhe,int:Yhe,bool:whe,string:L5,str:L5,color:Ehe,select:lx,enum:lx,bytes:PO(jO,"")},epe={},tpe={},nu={Inputrenderer:Khe,Outputrenderer:She,HandlePreviewRenderer:bhe,DataOverlayRenderer:vhe,DataPreviewViewRenderer:dH,DataViewRenderer:BO,InLineRenderer:yhe,NodeRenderer:epe,NodeHooks:tpe},npe=(e,t)=>{const n=t.options||{},r=n.overwrite===void 0?!0:n.overwrite;switch(t.type){case"EXTEND_INPUT_RENDER":return!r&&e.Inputrenderer[t.payload.type]?e:{...e,Inputrenderer:{...e.Inputrenderer,[t.payload.type]:t.payload.component}};case"EXTEND_FROM_PLUGIN":{let u=!1;const d=[[t.payload.plugin.input_renderers||{},e.Inputrenderer],[t.payload.plugin.output_renderers||{},e.Outputrenderer],[t.payload.plugin.handle_preview_renderers||{},e.HandlePreviewRenderer],[t.payload.plugin.data_overlay_renderers||{},e.DataOverlayRenderer],[t.payload.plugin.data_preview_renderers||{},e.DataPreviewViewRenderer],[t.payload.plugin.data_view_renderers||{},e.DataViewRenderer],[t.payload.plugin.node_renderers||{},e.NodeRenderer],[t.payload.plugin.node_hooks||{},e.NodeHooks]];for(const[m,y]of d){if(Object.keys(m).length>0){if(r)u=!0;else for(const v in m)if(!y[v]){u=!0;break}}if(u)break}if(!u)return e;const h={...e};return d.forEach(([m,y])=>{Object.assign(y,m)}),h}default:const l={EXTEND_OUTPUT_RENDER:"Outputrenderer",EXTEND_HANDLE_PREVIEW_RENDER:"HandlePreviewRenderer",EXTEND_DATA_OVERLAY_RENDER:"DataOverlayRenderer",EXTEND_DATA_PREVIEW_RENDER:"DataPreviewViewRenderer",EXTEND_DATA_VIEW_RENDER:"DataViewRenderer",EXTEND_NODE_CONTEXT_EXTENDER:"NodeContextExtenders",EXTEND_NODE_RENDERER:"NodeRenderer",EXTEND_NODE_HOOKS:"NodeHooks"}[t.type];if(l){const u=e[l];return!r&&u[t.payload.type]?e:{...e,[l]:{...u,[t.payload.type]:t.payload.component}}}return e}},rpe=({children:e,plugins:t,fnrf_zst:n})=>{const[r,a]=Q.useReducer(npe,nu),l=(A,E,R)=>{a({type:"EXTEND_INPUT_RENDER",payload:{type:A,component:E},options:R})},u=(A,E,R)=>{a({type:"EXTEND_OUTPUT_RENDER",payload:{type:A,component:E},options:R})},d=(A,E,R)=>{a({type:"EXTEND_HANDLE_PREVIEW_RENDER",payload:{type:A,component:E},options:R})},h=(A,E,R)=>{a({type:"EXTEND_DATA_OVERLAY_RENDER",payload:{type:A,component:E},options:R})},m=(A,E,R)=>{a({type:"EXTEND_DATA_PREVIEW_RENDER",payload:{type:A,component:E},options:R})},y=(A,E,R)=>{a({type:"EXTEND_DATA_VIEW_RENDER",payload:{type:A,component:E},options:R})},v=(A,E,R)=>{a({type:"EXTEND_NODE_RENDERER",payload:{type:A,component:E},options:R})},S=(A,E,R)=>{a({type:"EXTEND_NODE_HOOKS",payload:{type:A,component:E},options:R})},w=(A,E)=>{a({type:"EXTEND_FROM_PLUGIN",payload:{plugin:A},options:E})};return Q.useEffect(()=>{for(const A in t){const E=t[A];if(!E)continue;const R=E.renderpluginfactory;R&&w(R({React:z,fnrf_zst:n,NodeContext:LC}))}},[t]),T.jsx(tf.Provider,{value:{Inputrenderer:r.Inputrenderer,Outputrenderer:r.Outputrenderer,HandlePreviewRenderer:r.HandlePreviewRenderer,DataOverlayRenderer:r.DataOverlayRenderer,DataPreviewViewRenderer:r.DataPreviewViewRenderer,DataViewRenderer:r.DataViewRenderer,InLineRenderer:r.InLineRenderer,NodeRenderer:r.NodeRenderer,NodeHooks:r.NodeHooks,extendNodeRenderer:v,extendInputRenderMapping:l,extendOutputRenderMapping:u,extendHandlePreviewRenderMapping:d,extendDataOverlayRenderMapping:h,extendDataPreviewRenderMapping:m,extendDataViewRenderMapping:y,extendNodeHooks:S,extendFromPlugin:w},children:e})},tf=Q.createContext({Inputrenderer:nu.Inputrenderer,Outputrenderer:nu.Outputrenderer,HandlePreviewRenderer:nu.HandlePreviewRenderer,DataOverlayRenderer:nu.DataOverlayRenderer,DataPreviewViewRenderer:nu.DataPreviewViewRenderer,DataViewRenderer:nu.DataViewRenderer,InLineRenderer:nu.InLineRenderer,NodeRenderer:nu.NodeRenderer,NodeHooks:nu.NodeHooks,extendInputRenderMapping:(e,t,n)=>{},extendOutputRenderMapping:(e,t,n)=>{},extendHandlePreviewRenderMapping:(e,t,n)=>{},extendDataOverlayRenderMapping:(e,t,n)=>{},extendDataPreviewRenderMapping:(e,t,n)=>{},extendDataViewRenderMapping:(e,t,n)=>{},extendNodeRenderer:(e,t,n)=>{},extendNodeHooks:(e,t,n)=>{},extendFromPlugin:(e,t)=>{}}),kH=e=>{const t=Qt(),{DataOverlayRenderer:n,DataViewRenderer:r}=Q.useContext(tf);if(e===void 0)return;const a=t.render_options(),[l]=Wp(e,a.typemap||{});return l?n[l]?n[l]:r[l]?zx(r[l]):B5:B5},ope=e=>{const t=Qt(),n=kH(e),{DataPreviewViewRenderer:r,DataViewRenderer:a}=Q.useContext(tf),l=t.render_options();if(e===void 0)return[void 0,n];const[u]=Wp(e,l.typemap||{});return u?r[u]?[r[u],n]:a[u]?[Ko(a[u]),n]:[Ko(SE),n]:[Ko(SE),n]},ape=e=>{const n=Qt().render_options(),{HandlePreviewRenderer:r,DataPreviewViewRenderer:a}=Q.useContext(tf),l=kH(e);let u;if(e){const[d]=Wp(e,n.typemap||{});d?r[d]?u=r[d]:a[d]?u=a[d]:u=Ko(SE):u=Ko(SE)}return[u,l]},ipe=e=>{const[t,n]=Q.useState(!1),r=e.use(a=>a.in_trigger);return Q.useEffect(()=>{let a;return r&&!t?n(!0):t&&(a=setTimeout(()=>n(!1),200)),()=>clearTimeout(a)},[r,t]),{visualTrigger:t,nodestore:e}},LC=z.createContext({}),Oa=()=>Q.useContext(LC),Ld=z.createContext(void 0);function Gn(e){if(e)return Oa().io_stores.get(e);{const t=Q.useContext(Ld);if(!t)throw new Error("IOContext not set");return t}}function Zp(e){const{node:t}=jo();if(e||(e=Gn().use()),typeof e=="string"&&(e=Gn(e)?.use(),!e))throw new Error(`No IO found for ${e}`);if(!e)throw new Error("No IO found");return z.useCallback((r,a)=>{console.log("io value set",r),t?.set_io_value({nid:e.node,ioid:e.id,value:r,set_default:a??e.render_options.set_default})},[e,t])}function OH(e){const{node:t}=jo();let n,r;if(!e){const u=Gn().useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}if(typeof e=="string"){const l=Gn(e);if(!l)throw new Error(`No IO found for ${e}`);const u=l.useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}else{if(!e)throw new Error("No IO found");n=e.id,r=e.node}return z.useCallback(l=>{t?.set_io_value_options({nid:r,ioid:n,values:l.values??l.keys,keys:l.keys,nullable:l.nullable??!1})},[t,n,r])}function MH(e){return Gn(e)?.valuestore()}function jx(e){const t=Gn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=jo();return z.useCallback(()=>a?.get_io_full_value({nid:n,ioid:r}),[a,n,r])}function VO(e){const t=Gn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=jo();return z.useCallback(u=>{a?.update_io_options({nid:n,ioid:r,options:{hidden:u}})},[a,n,r])}const NH=({iostore:e,Component:t})=>{const[n,r]=z.useState(void 0),[a,l]=z.useState(void 0),{full:u}=e.valuestore(),d=jx();z.useEffect(()=>{u===void 0?d?.():l(u.value)},[u,d]);const h=()=>{a!==void 0&&r(a)};return T.jsx(t,{value:a,preValue:n,onLoaded:h})},DH=({Component:e})=>T.jsx(e,{}),Wp=(e,t)=>IH(e.render_options?.type??"any",t),IH=(e,t)=>{if(typeof e=="string")return e in t?[t[e],e]:[e,e];if("allOf"in e&&e.allOf!==void 0)return[void 0,void 0];if("anyOf"in e&&e.anyOf!==void 0){const n=e.anyOf.map(r=>IH(r||"any",t));for(const r of n)switch(r[0]){case"bool":return["bool",r[1]];case"enum":return["enum",r[1]];case"float":return["float",r[1]];case"int":return["int",r[1]];case"string":return["string",r[1]];case"str":return["string",r[1]]}return[void 0,void 0]}return!("type"in e)||e.type===void 0?[void 0,void 0]:e.type==="enum"?["enum","enum"]:[void 0,void 0]},HR=({typestring:e,preview:t,...n})=>{const[r,a]=Q.useState(!1),[l,u]=Q.useState(!1),d=Qt(),h=Gn(),m=h.use(),y=jx(),[v,S]=ape(m),w=d.local_state(()=>d.reactflowRef);return T.jsxs(W6,{open:r||l,onOpenChange:u,children:[T.jsx(q6,{asChild:!0,children:T.jsx(ix,{id:m.id,"data-type":e,...n})}),T.jsx(J6,{container:w,children:T.jsxs(Q6,{className:"iotooltipcontent",sideOffset:5,avoidCollisions:!0,collisionBoundary:w,collisionPadding:10,onOpenAutoFocus:A=>A.preventDefault(),onCloseAutoFocus:A=>A.preventDefault(),children:[T.jsxs("div",{className:"iotooltip_container",children:[T.jsxs("div",{className:"iotooltip_header",children:[r?T.jsx(xQ,{onClick:()=>a(!1)}):T.jsx(bQ,{onClick:()=>a(!0)}),S&&T.jsx(Jc,{title:m.full_id,trigger:T.jsx(l6,{}),onOpenChange:A=>{A&&y?.(),a(A)},children:T.jsx(NH,{Component:S,iostore:h})})]}),v?T.jsx(DH,{Component:v}):`no preview available for "${e}"`]}),T.jsx(tee,{className:"iotooltipcontentarrow"})]})})]})},s0={"":[e=>e,e=>e],str_to_json:[e=>JSON.parse(e),e=>typeof e=="string"?e:JSON.stringify(e)],str_to_list:[e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{try{return JSON.parse("["+e+"]")}catch{}}throw new Error("Invalid list")},e=>JSON.stringify(e)]},lpe=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Qt().render_options(),l=Gn().use(),[u,d]=Wp(l,r.typemap||{}),{Inputrenderer:h}=Q.useContext(tf),m=u?l.value_options?.options?lx:h[u]:void 0,y=s0[(d&&r.inputconverter?.[d])??""]||s0[""],{keys:v}=Fk(),S=w=>{v.has("s")&&(e&&e("inputs/"+l.id),t&&t(!0),w.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeinput","data-type":u,onClick:S,children:[T.jsx(HR,{typestring:u,position:at.Left,type:"target"}),T.jsxs("div",{className:"inner_nodeio",children:[m&&T.jsx("div",{className:"iovaluefield nodrag","data-type":u,children:T.jsx(m,{inputconverter:y})}),T.jsx("div",{className:"ioname",children:l.name})]}),T.jsx(HR,{typestring:u,position:at.Right,type:"source"})]})},spe=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Qt().render_options(),l=Gn().use(),[u]=Wp(l,r.typemap||{}),{Outputrenderer:d}=Q.useContext(tf),{keys:h}=Fk(),m=u?d[u]:void 0,y=v=>{h.has("s")&&(e&&e("outputs/"+l.id),t&&t(!0),v.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeoutput","data-type":u,onClick:y,children:[T.jsx(HR,{typestring:u,position:at.Right,type:"source"}),T.jsxs("div",{className:"inner_nodeio",children:[T.jsx("div",{className:"ioname",children:l.name}),m?T.jsx("div",{className:"iovaluefield nodrag",children:T.jsx(m,{})}):T.jsx("div",{className:"iovaluefield",children:T.jsx(xhe,{})})]})]})},upe=()=>{const t=Qt().render_options(),r=Gn().use(),a=VO(),[l,u]=Wp(r,t.typemap||{}),{Inputrenderer:d}=z.useContext(tf),h=l?r.value_options?.options?lx:d[l]:void 0,m=s0[(u&&t.inputconverter?.[u])??""]||s0[""];return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:r.name}),h&&T.jsx(h,{inputconverter:m}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:r.connected,onChange:y=>{a?.(y.target.checked)},checked:r.hidden})]})})]})},cpe=()=>{const t=Gn().use(),n=VO();return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:t.name}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:t.connected,onChange:r=>{n?.(r.target.checked)},checked:t.hidden})]})})]})},zH=({})=>{const e=Qt(),{node:t}=jo(),r=Gn().use(),a=e.render_options(),l=VO(),[u,d]=z.useState(r.name);z.useEffect(()=>d(r.name),[r.name]);const h=z.useCallback(E=>d(E.target.value),[]),m=z.useCallback(()=>{u!==r.name&&t?.update_io_options({nid:r.node,ioid:r.id,options:{name:u}})},[r,t,u]),[y,v]=Wp(r,a.typemap||{}),S=s0[(v&&a.inputconverter?.[v])??""]||s0[""],{Inputrenderer:w}=z.useContext(tf),A=y?r.value_options?.options?lx:w[y]:void 0;return T.jsxs("div",{className:"nodesettings-io-entry funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-name-${r.id}`,children:"Name:"}),T.jsx("input",{id:`io-name-${r.id}`,type:"text",value:u,onChange:h,onBlur:m,className:"styledinput"})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"ID:"}),T.jsx("span",{children:r.id})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value:"}),A&&T.jsx(A,{inputconverter:S})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Type:"}),T.jsx("pre",{children:JSON.stringify(r.type,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-hidden-${r.id}`,children:"Hidden:"}),T.jsx("input",{id:`io-hidden-${r.id}`,type:"checkbox",checked:r.hidden,onChange:E=>l?.(E.target.checked),className:"styledcheckbox",disabled:r.connected&&r.is_input})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value Options:"}),T.jsx("pre",{children:JSON.stringify(r.value_options,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Render Options:"}),T.jsx("pre",{className:"code-display",children:JSON.stringify(r.render_options,null,2)})]}),r.is_input&&T.jsxs(T.Fragment,{children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Does Trigger:"}),T.jsx("span",{children:String(r.does_trigger)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Required:"}),T.jsx("span",{children:String(r.required)})]})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Emit Value Set:"}),T.jsx("span",{children:String(r.emit_value_set)})]}),T.jsx("hr",{})]})},VR={xxs:0,xs:320,s:480,m:768,l:960,xl:1280,xxl:1920},fpe=Object.entries(VR).sort(([,e],[,t])=>t-e),jH=z.createContext(void 0),dpe=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},hpe=e=>{for(const[t,n]of fpe)if(e>=n)return t;return"xxs"},BH=z.memo(z.forwardRef((e,t)=>{const{className:n,children:r,...a}=e,[l,u]=z.useState({wKey:"m",w:0,h:0}),d=z.useRef(null);z.useImperativeHandle(t,()=>d.current,[]);const h=z.useCallback(y=>{const v=y.width,S=y.height,w=hpe(v);u(A=>A.wKey===w&&A.w===v&&A.h===S?A:{wKey:w,w:v,h:S})},[]),m=z.useMemo(()=>dpe(h,16),[h]);return z.useEffect(()=>{const y=d.current;if(!y)return;const v=new ResizeObserver(S=>{const w=S[0];w&&m(w.contentRect)});return h(y.getBoundingClientRect()),v.observe(y),()=>{v.disconnect()}},[h,m]),T.jsx(jH.Provider,{value:l,children:T.jsx("div",{ref:d,className:`size-context w-${l.wKey} ${n||""}`.trim(),...a,children:r})})}));BH.displayName="SizeContextContainer";const ppe=()=>{const e=z.useContext(jH);if(!e)throw new Error("useSizeContext must be used within a SizeContextContainerContext");return e},mpe=(e,t)=>e===t?!1:e===""?!0:VR[e]<VR[t],gpe=e=>{const{wKey:t}=ppe();return mpe(t,e)},P5=(e,t,n="",r="")=>{const a=[];return typeof e=="string"?a.push(`${t}-${e}`):typeof e=="boolean"?a.push(e?n:r):e&&typeof e=="object"&&Object.entries(e).forEach(([l,u])=>{if(typeof u=="string")a.push(l===""?`${t}-${u}`:`${l}-${t}-${u}`);else if(typeof u=="boolean"){const d=u?n:r;d&&a.push(l===""?d:`${l}-${d}`)}}),a.filter(Boolean).join(" ")},Od=z.memo(({direction:e,className:t="",children:n,wrap:r=!1,grow:a=!1,...l})=>{const u="float-container",d=P5(e,"direction"),h=P5(a,"","grow","no-grow"),y=[u,d,h,typeof r=="boolean"&&r?"flex-wrap":"",t].filter(Boolean).join(" ");return T.jsx("div",{className:y,...l,children:n})});Od.displayName="FloatContainer";const ype={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"◀"}),right:e=>T.jsx(T.Fragment,{children:"▶"})},vpe={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"▶"}),right:e=>T.jsx(T.Fragment,{children:"◀"})},FO=z.memo(({direction:e,expanded:t=!0,children:n,className:r,maxSize:a="18.75rem",expanderSize:l="2rem",containerStyle:u,style:d,containerClassName:h,expandIcons:m,collapseIcons:y,onExpandChange:v,...S})=>{const[w,A]=z.useState(t);z.useEffect(()=>{A(t)},[t]);const E=z.useCallback(()=>{A(j=>{const X=!j;return v?.(X),X})},[v]),R=z.useCallback(j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),E())},[E]),k=e==="right"||e==="left",D=e==="left"||e==="up",M=w?y?.[e]||vpe[e]:m?.[e]||ype[e],I=`${e} ${w?"expanded":"collapsed"}`,L=z.useMemo(()=>({[k?"width":"height"]:w?a:l}),[k,w,a,l]),P=z.useMemo(()=>({[k?"width":"height"]:w?a:0}),[k,w,a]),G=z.useMemo(()=>({[k?"width":"height"]:l}),[k,l]),$=T.jsx("div",{className:`expanding_container_content ${I} ${r||""}`.trim(),style:{...d,...P},...S,children:n}),Z=T.jsx("div",{className:`expanding_container_expander ${I}`,onClick:E,onKeyDown:R,style:G,role:"button",tabIndex:0,"aria-label":`${w?"Collapse":"Expand"} ${e}`,children:T.jsx(M,{})});return T.jsxs("div",{className:`expanding_container ${I} ${h||""}`,style:{...u,...L},children:[D?Z:$,D?$:Z]})});FO.displayName="ExpandingContainer";const bpe=({nodestore:e})=>{const t=e.use();return T.jsx(LC.Provider,{value:e,children:T.jsxs("div",{className:"nodesettings_content",children:[T.jsx("div",{className:"nodesettings_section",children:T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:"Name"}),T.jsx("div",{children:T.jsx(XO,{})})]})}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Inputs"}),t.inputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ld.Provider,{value:r,children:T.jsx(upe,{})},n)})]}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Outputs"}),t.outputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ld.Provider,{value:r,children:T.jsx(cpe,{})},n)})]})]})})},xpe=()=>{const e=Qt(),t=e.local_state(r=>r.selected_nodes);if(t.length===0)return T.jsx("div",{children:"Node Settings"});if(t.length>1)return T.jsx("div",{children:"Multiple Nodes Selected"});const n=e.nodespace.get_node(t[0]);return n?T.jsx(bpe,{nodestore:n}):T.jsx("div",{children:"Node not found"})},Spe=()=>{const e=Qt(),t=e.local_settings(r=>r.view_settings.expand_node_props),n=r=>{e.update_view_settings({expand_node_props:r})};return T.jsx(FO,{direction:"left",expanded:t===void 0?!1:t,containerClassName:"pos-right pos-top bg1 h-12",className:"nodesettings_content",onExpandChange:n,collapseIcons:{up:q2,down:Y1,left:X1,right:W2},expandIcons:{up:Y1,down:q2,left:W2,right:X1},children:T.jsx(xpe,{})})};var pT="rovingFocusGroup.onEntryFocus",wpe={bubbles:!1,cancelable:!0},Bx="RovingFocusGroup",[FR,LH,Epe]=mC(Bx),[Cpe,PC]=bu(Bx,[Epe]),[_pe,Ape]=Cpe(Bx),PH=z.forwardRef((e,t)=>T.jsx(FR.Provider,{scope:e.__scopeRovingFocusGroup,children:T.jsx(FR.Slot,{scope:e.__scopeRovingFocusGroup,children:T.jsx(Tpe,{...e,ref:t})})}));PH.displayName=Bx;var Tpe=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=e,S=z.useRef(null),w=En(t,S),A=jC(l),[E,R]=Hd({prop:u,defaultProp:d??null,onChange:h,caller:Bx}),[k,D]=z.useState(!1),M=ka(m),I=LH(n),L=z.useRef(!1),[P,G]=z.useState(0);return z.useEffect(()=>{const $=S.current;if($)return $.addEventListener(pT,M),()=>$.removeEventListener(pT,M)},[M]),T.jsx(_pe,{scope:n,orientation:r,dir:A,loop:a,currentTabStopId:E,onItemFocus:z.useCallback($=>R($),[R]),onItemShiftTab:z.useCallback(()=>D(!0),[]),onFocusableItemAdd:z.useCallback(()=>G($=>$+1),[]),onFocusableItemRemove:z.useCallback(()=>G($=>$-1),[]),children:T.jsx(zt.div,{tabIndex:k||P===0?-1:0,"data-orientation":r,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:Ke(e.onMouseDown,()=>{L.current=!0}),onFocus:Ke(e.onFocus,$=>{const Z=!L.current;if($.target===$.currentTarget&&Z&&!k){const j=new CustomEvent(pT,wpe);if($.currentTarget.dispatchEvent(j),!j.defaultPrevented){const X=I().filter(V=>V.focusable),ee=X.find(V=>V.active),ae=X.find(V=>V.id===E),te=[ee,ae,...X].filter(Boolean).map(V=>V.ref.current);FH(te,y)}}L.current=!1}),onBlur:Ke(e.onBlur,()=>D(!1))})})}),HH="RovingFocusGroupItem",VH=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:l,children:u,...d}=e,h=hu(),m=l||h,y=Ape(HH,n),v=y.currentTabStopId===m,S=LH(n),{onFocusableItemAdd:w,onFocusableItemRemove:A,currentTabStopId:E}=y;return z.useEffect(()=>{if(r)return w(),()=>A()},[r,w,A]),T.jsx(FR.ItemSlot,{scope:n,id:m,focusable:r,active:a,children:T.jsx(zt.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:t,onMouseDown:Ke(e.onMouseDown,R=>{r?y.onItemFocus(m):R.preventDefault()}),onFocus:Ke(e.onFocus,()=>y.onItemFocus(m)),onKeyDown:Ke(e.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){y.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const k=Ope(R,y.orientation,y.dir);if(k!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let M=S().filter(I=>I.focusable).map(I=>I.ref.current);if(k==="last")M.reverse();else if(k==="prev"||k==="next"){k==="prev"&&M.reverse();const I=M.indexOf(R.currentTarget);M=y.loop?Mpe(M,I+1):M.slice(I+1)}setTimeout(()=>FH(M))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:E!=null}):u})})});VH.displayName=HH;var Rpe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function kpe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ope(e,t,n){const r=kpe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Rpe[r]}function FH(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Mpe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var GH=PH,UH=VH,HC="Tabs",[Npe,nwe]=bu(HC,[PC]),$H=PC(),[Dpe,GO]=Npe(HC),XH=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:h="automatic",...m}=e,y=jC(d),[v,S]=Hd({prop:r,onChange:a,defaultProp:l??"",caller:HC});return T.jsx(Dpe,{scope:n,baseId:hu(),value:v,onValueChange:S,orientation:u,dir:y,activationMode:h,children:T.jsx(zt.div,{dir:y,"data-orientation":u,...m,ref:t})})});XH.displayName=HC;var YH="TabsList",ZH=z.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,l=GO(YH,n),u=$H(n);return T.jsx(GH,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:r,children:T.jsx(zt.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});ZH.displayName=YH;var WH="TabsTrigger",qH=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...l}=e,u=GO(WH,n),d=$H(n),h=KH(u.baseId,r),m=eV(u.baseId,r),y=r===u.value;return T.jsx(UH,{asChild:!0,...d,focusable:!a,active:y,children:T.jsx(zt.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":m,"data-state":y?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:h,...l,ref:t,onMouseDown:Ke(e.onMouseDown,v=>{!a&&v.button===0&&v.ctrlKey===!1?u.onValueChange(r):v.preventDefault()}),onKeyDown:Ke(e.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&u.onValueChange(r)}),onFocus:Ke(e.onFocus,()=>{const v=u.activationMode!=="manual";!y&&!a&&v&&u.onValueChange(r)})})})});qH.displayName=WH;var JH="TabsContent",QH=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:l,...u}=e,d=GO(JH,n),h=KH(d.baseId,r),m=eV(d.baseId,r),y=r===d.value,v=z.useRef(y);return z.useEffect(()=>{const S=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(S)},[]),T.jsx(as,{present:a||y,children:({present:S})=>T.jsx(zt.div,{"data-state":y?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!S,id:m,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:v.current?"0s":void 0},children:S&&l})})});QH.displayName=JH;function KH(e,t){return`${e}-trigger-${t}`}function eV(e,t){return`${e}-content-${t}`}var UO=XH,$O=ZH,z1=qH,j1=QH;const Ipe=({})=>{const e=Qt(),t=Oa(),{description:n,id:r,node_id:a,node_name:l,reset_inputs_on_trigger:u}=t.useShallow(v=>({description:v.description,id:v.id,node_id:v.node_id,node_name:v.node_name,reset_inputs_on_trigger:v.reset_inputs_on_trigger})),[d,h]=z.useState(n||"");z.useEffect(()=>h(n||""),[n]);const m=v=>h(v.target.value),y=()=>{d!==(n||"")&&e.on_node_action({type:"update",from_remote:!1,id:r,node:{description:d}})};return T.jsxs("div",{className:"nodesettings-section funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-name-${r}`,children:"Name:"}),T.jsx(XO,{})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Instance ID:"}),T.jsx("span",{children:r})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type ID:"}),T.jsx("span",{children:a})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type Name:"}),T.jsx("span",{children:l})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-desc-${r}`,children:"Description:"}),T.jsx("textarea",{id:`node-desc-${r}`,value:d,onChange:m,onBlur:y,className:"styledinput",rows:3})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Reset Inputs on Trigger:"}),T.jsx("input",{type:"checkbox",checked:u,onChange:v=>{e.on_node_action({type:"update",from_remote:!1,id:r,node:{reset_inputs_on_trigger:v.target.checked}})},className:"styledcheckbox"})]})]})},zpe=({splitnodesettingsPath:e=[]})=>{const t=Oa(),n=t.use(r=>r.inputs);return T.jsxs(UO,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx($O,{className:"nodesettings-tabs-list","aria-label":"Manage node inputs",children:n.map(r=>T.jsx(z1,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(j1,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ld.Provider,{value:a,children:T.jsx(zH,{})})},r)})]})},jpe=({splitnodesettingsPath:e=[]})=>{const t=Oa(),n=t.use(r=>r.outputs);return T.jsxs(UO,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx($O,{className:"nodesettings-tabs-list","aria-label":"Manage node outputs",children:n.map(r=>T.jsx(z1,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(j1,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ld.Provider,{value:a,children:T.jsx(zH,{})})},r)})]})},Bpe=({nodeSettingsPath:e})=>{const t=e.split("/")||["general"];return T.jsxs(UO,{defaultValue:t[0]||"general",className:"nodesettings-tabs funcnodes-control-root",children:[T.jsxs($O,{className:"nodesettings-tabs-list","aria-label":"Manage node settings",children:[T.jsx(z1,{value:"general",className:"nodesettings-tabs-trigger",children:"General"}),T.jsx(z1,{value:"inputs",className:"nodesettings-tabs-trigger",children:"Inputs"}),T.jsx(z1,{value:"outputs",className:"nodesettings-tabs-trigger",children:"Outputs"})]}),T.jsx(j1,{value:"general",className:"nodesettings-tabs-content",children:T.jsx(Ipe,{})}),T.jsx(j1,{value:"inputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(zpe,{splitnodesettingsPath:t.slice(1)})}),T.jsx(j1,{value:"outputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(jpe,{splitnodesettingsPath:t.slice(1)})})]})},Lpe=z.memo(({isOpen:e,onOpenChange:t,nodeSettingsPath:n})=>{const a=Oa().use(l=>l.id);return T.jsx(Jc,{title:`Node Settings: ${a}`,open:e,onOpenChange:t,dialogClassName:"nodesettings-dialog",children:T.jsx(Bpe,{nodeSettingsPath:n})})}),Ppe=z.memo(({toogleShowSettings:e})=>{const t=Qt(),{node:n}=jo(),r=Oa(),{id:a,description:l,node_name:u}=r.useShallow(h=>({id:h.id,description:h.description,node_name:h.node_name})),d=z.useCallback(()=>{t.on_node_action({type:"trigger",from_remote:!1,id:a})},[t,a]);return T.jsxs("div",{className:"nodeheader",title:l||u,children:[T.jsxs("div",{className:"nodeheader_element",children:[T.jsx(wQ,{fontSize:"inherit",className:"triggerbutton nodeheaderbutton ",onClick:d}),T.jsx(SQ,{fontSize:"inherit",className:"nodestatusbutton nodeheaderbutton",onClick:async()=>{n&&console.log("nodestatus",await n.get_node_status(a))}}),T.jsx(CQ,{fontSize:"inherit",className:"nodesettingsbutton nodeheaderbutton",onClick:()=>{e?.()}})]}),T.jsx("div",{className:"nodeheader_element nodeheader_title",children:T.jsx("div",{className:"nodeheader_title_text",children:u})}),T.jsx("div",{className:"nodeheader_element",children:T.jsx(Sx,{fontSize:"inherit"})})]})}),Hpe=z.memo(({iostore:e})=>{const t=e.use(),r=Oa().use(d=>d.render_options),a=jx(t.id),[l,u]=ope(t);return T.jsx("div",{className:"nodrag nodedatabody","data-src":r?.data?.src||"",children:l&&t&&T.jsx(Ld.Provider,{value:e,children:T.jsx(Jc,{title:t.full_id,trigger:T.jsx("div",{className:"nodedatabutton",children:T.jsx(DH,{Component:l})}),onOpenChange:d=>{d&&a?.()},children:u&&T.jsx(NH,{Component:u,iostore:e})})})})}),Vpe=z.memo(({setShowSettings:e,setNodeSettingsPath:t})=>{const n=Oa(),{render_options:r,outputs:a,inputs:l}=n.useShallow(d=>({render_options:d.render_options,outputs:d.outputs,inputs:d.inputs})),u=r?.data?.src?n.io_stores.get(r?.data?.src):void 0;return T.jsxs("div",{className:"nodebody nowheel ",children:[a.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ld.Provider,{value:h,children:T.jsx(spe,{setNodeSettingsPath:t,setShowSettings:e})},d)}),u&&T.jsx(Hpe,{iostore:u}),l.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ld.Provider,{value:h,children:T.jsx(lpe,{setNodeSettingsPath:t,setShowSettings:e})},d)})]})}),XO=()=>{const e=Oa(),{original_name:t,id:n}=e.useShallow(h=>({original_name:h.name,id:h.id})),[r,a]=Q.useState(t);Q.useEffect(()=>{a(t)},[t]);const l=Qt(),u=h=>{a(h.target.value)},d=h=>{const m=h.target.value;m!==t&&l.on_node_action({type:"update",from_remote:!1,id:n,node:{name:m}})};return T.jsx("input",{className:"nodename_input",value:r,onChange:u,onBlur:d})},Fpe=()=>{const t=Oa().use(n=>n.progress);return t?T.jsx(yre,{state:t,className:"nodeprogress"}):null},Gpe=z.memo(()=>{const t=Oa().use(n=>n.error);return T.jsxs("div",{className:"nodefooter",children:[t&&T.jsx("div",{className:"nodeerror",children:t}),T.jsx(Fpe,{})]})}),Upe=()=>{const e=Oa(),{collapsed:t,error:n,node_id:r}=e.useShallow(A=>({collapsed:A.properties["frontend:collapsed"]||!1,error:A.error,node_id:A.node_id})),{visualTrigger:a}=ipe(e),[l,u]=Q.useState(!1),[d,h]=Q.useState(""),{keys:m}=Fk(),v=z.useContext(tf).NodeHooks[r]??[],S=z.useCallback(()=>{u(A=>!A)},[]),w=A=>{m.has("s")&&!l&&(h(""),u(!0),A.stopPropagation())};return T.jsxs("div",{className:"innernode"+(a?" intrigger":"")+(n?" error":""),onClick:w,children:[T.jsx(Ppe,{toogleShowSettings:S}),T.jsx(XO,{}),t?null:T.jsx(Vpe,{setNodeSettingsPath:h,setShowSettings:u}),T.jsx(Gpe,{}),T.jsx(Lpe,{isOpen:l,onOpenChange:u,nodeSettingsPath:d}),v.map((A,E)=>T.jsx(z.Fragment,{children:T.jsx(A,{})},E))]})},$pe=z.memo(({data:e})=>T.jsx(LC.Provider,{value:e.nodestore,children:T.jsx(Upe,{})}),(e,t)=>e.data.nodestore===t.data.nodestore),Xpe=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:a,sourcePosition:l,targetPosition:u,data:d,...h})=>{const[m]=RO({sourceX:t,sourceY:n,sourcePosition:l,targetX:r,targetY:a,targetPosition:u});return T.jsx(T.Fragment,{children:T.jsx(Ix,{id:e,path:m,...h})})},Ype={default:$pe,group:phe},Zpe={default:Xpe},Wpe=e=>({nodes:e.getNodes(),edges:e.getEdges(),onNodesChange:e.onNodesChange,onEdgesChange:e.onEdgesChange,onConnect:e.onConnect}),YO=e=>{const t=new Set,n=e.filter(a=>a.type==="group");n.forEach(a=>{t.add(a.id)});const r=e.filter(a=>!t.has(a.id));return{group_nodes:n,default_nodes:r}};function ZO(e){const t=new Map(e.map(u=>[u.id,u])),n=new Map,r=[];for(const u of e)if(n.has(u.id)||n.set(u.id,[]),u.parentId&&t.has(u.parentId)){const d=t.get(u.parentId);if(d){const h=n.get(d.id)||[];h.push(u),n.set(d.id,h)}else r.push(u)}else r.push(u);const a=[];function l(u){a.push(u);const d=n.get(u.id)||[];for(const h of d)l(h)}for(const u of r)l(u);if(a.length!==e.length){console.warn("Sorting mismatch: Not all nodes could be placed. Check for circular dependencies or missing parents.");const u=new Set(a.map(d=>d.id));e.forEach(d=>{u.has(d.id)||a.push(d)})}return a}const tV=()=>{const{getNodes:e}=Yp();return{getNodes:e,getSelectedNodes:a=>(a===void 0&&(a=e()),a.filter(l=>l.selected)),getSplitNodes:a=>{a===void 0&&(a=e());const{group_nodes:l,default_nodes:u}=YO(a);return{group_nodes:l,default_nodes:u}},getSortedNodes:a=>(a===void 0&&(a=e()),ZO(a))}},nV=(e,t)=>{const n=e.getState(),{new_obj:r,change:a}=jp(n,t);a&&e.setState(r)},rV=e=>fl(e);function H5(e){return e!=null&&typeof e=="object"&&"id"in e&&typeof e.id=="string"}const oV=e=>{let t=e.io??{},n=e.io_order,r=[];const a={};if(n===void 0)if(Array.isArray(t)){const l=t.filter(H5);r=l.map(u=>u.id);for(const u of l)a[u.id]=u}else{r=Object.keys(t);for(const l in t)t[l]!==void 0&&(a[l]=t[l])}else if(r=n,Array.isArray(t)){const l=t.filter(H5);for(const u of l)a[u.id]=u,r.includes(u.id)||r.push(u.id)}else for(const l in t)t[l]!==void 0&&(a[l]=t[l]),r.includes(l)||r.push(l);return{...e,io_order:r,io:a}},qpe={id:"dummy",node_id:"dummy",node_name:"dummy",properties:{"frontend:size":[200,100],"frontend:pos":[NaN,NaN],"frontend:collapsed":!1},io:{},io_order:[],name:"dummy",in_trigger:!1,reset_inputs_on_trigger:!1,progress:{ascii:!1,elapsed:0,initial:0,n:0,prefix:"idle",unit:"it",unit_divisor:1e3,unit_scale:!1}},Jpe={id:"dummy",name:"dummy",node:"dummy",full_id:"dummy",type:"any",value:void 0,is_input:!1,connected:!1,does_trigger:!0,fullvalue:void 0,render_options:{set_default:!0,type:"any"},hidden:!1,emit_value_set:!0,required:!1},Qpe=ak(qpe),Kpe=ak(Jpe),eme=e=>{const t=e.io_order;if(t===void 0)throw new Error("Node must have io_order");return{...e,inputs:Object.keys(e.io).filter(r=>e.io[r].is_input),outputs:Object.keys(e.io).filter(r=>!e.io[r].is_input),io_order:t}},tme=e=>(e.value==="<NoValue>"&&(e.value=void 0),e.fullvalue==="<NoValue>"&&(e.fullvalue=void 0),e.hidden===void 0&&(e.hidden=!1),[{...e},e.value,e.fullvalue]),nme=e=>{if(!e.id)throw new Error("Node must have an id");const t=Qpe(e);return eme(t)},rme=(e,t)=>{const n=e.getState(),r={},a=oV(t),l=Object.keys(a);for(const u of l)switch(u){case"id":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"node_id":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"node_name":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"name":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"in_trigger":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"error":{a[u]!==n[u]&&(r[u]=a[u]);break}case"render_options":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"io_order":{const[d,h]=((m,y)=>y===void 0?[m,!1]:[y,!ok(m,y)])(n[u],a[u]);h&&(r[u]=d.filter(m=>m!==void 0));break}case"io":{const d=a[u];if(d===void 0)break;for(const h in d){const m=e.io_stores.get(h);if(!m){console.error("io key not found in oldvalue:",h);continue}m.update(d[h])}break}case"progress":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"description":{r[u]=a[u];break}case"properties":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"status":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"reset_inputs_on_trigger":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}default:try{Lz(u,a[u])}catch(d){console.error(d)}}Object.keys(r).length>0&&e.setState(r)},ome=(e,t)=>{const n=e.getState(),r={},a={},l=Object.keys(t);for(const u of l)switch(u){case"name":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"id":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"connected":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"does_trigger":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"hidden":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"full_id":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"is_input":break;case"node":break;case"type":break;case"value":{a.preview=t[u];break}case"fullvalue":{a.full=t[u];break}case"render_options":{const[d,h]=zy(n[u],t[u]);h&&(r[u]=d);break}case"value_options":{const[d,h]=zy(n[u],t[u]);h&&(r[u]=d);break}case"valuepreview_type":{r[u]=t[u];break}case"emit_value_set":{r[u]=t[u];break}case"default":{r[u]=t[u];break}case"required":{r[u]=t[u];break}default:try{Lz(u,t[u])}catch(d){console.error(d)}}Object.keys(a).length>0&&e.updateValueStore(a),Object.keys(r).length>0&&e.setState(r)},ame=e=>{if(!e.id)throw new Error("IO must have an id but is missing for "+JSON.stringify(e));e.name===void 0&&(e.name=e.id);const t=Kpe(e);return(t.render_options.type==="any"||t.render_options.type===void 0)&&(t.render_options.type=t.type),tme(t)},ime=(e,t)=>{let n;const[r,a,l]=ame(t);return n={io_state:rV((u,d)=>r),use:u=>u?n.io_state(u):n.io_state(),useShallow:u=>n.io_state(zO(u)),getState:()=>n.io_state.getState(),setState:u=>{n.io_state.setState(u)},update:u=>{ome(n,u)},valuestore:fl((u,d)=>{let h=a;h==="<NoValue>"&&(h=void 0),!(h instanceof Ql)&&h!==void 0&&(h=Bc.fromObject(h));let m=l;return m==="<NoValue>"&&(m=void 0),!(m instanceof Ql)&&m!==void 0&&(m=Bc.fromObject(m)),{preview:h,full:m}}),updateValueStore:u=>{n.valuestore.setState(d=>(d.preview&&typeof d.preview.dispose=="function"&&d.preview.dispose(),d.full&&typeof d.full.dispose=="function"&&d.full.dispose(),u.preview!==void 0&&u.full===void 0&&(u.full=void 0,d.full=void 0),u.preview!==void 0&&!(u.preview instanceof Ql)&&(u.preview=Bc.fromObject(u.preview)),u.full!==void 0&&!(u.full instanceof Ql)&&(u.full=Bc.fromObject(u.full)),{...d,...u}))},node:e,serialize:()=>{const u=n.io_state.getState(),d=n.valuestore.getState();return{...u,value:d.preview,fullvalue:d.full,render_options:u.render_options,valuepreview_type:u.valuepreview_type,emit_value_set:u.emit_value_set}}},n},lme=e=>{const t={use:l=>l?r.node_state(l):r.node_state(),useShallow:l=>r.node_state(zO(l)),io_stores:new Map,getState:()=>r.node_state.getState(),setState:l=>{r.node_state.setState(l)},update:l=>{rme(r,l)},serialize:()=>({...r.node_state.getState(),io:Object.fromEntries(Array.from(r.io_stores.entries()).map(([d,h])=>[d,h.serialize()]))})},n=oV(e),r={...t,node_state:rV((l,u)=>nme(n))},a=n.io;return Object.entries(a).forEach(([l,u])=>{u!==void 0&&r.io_stores.set(l,ime(n.id,u))}),r},sme=()=>{const e=Qt();return{onSelectionChange:Q.useCallback(({nodes:n,edges:r})=>{const{group_nodes:a,default_nodes:l}=YO(n),u=e.local_state.getState();e.local_state.setState({...u,selected_nodes:l.map(d=>d.id),selected_edges:r.map(d=>d.id),selected_groups:a.map(d=>d.id)})},[e])}},ume=()=>{const e=Yp(),t=Qt();return t.rf_instance=e,T.jsx(T.Fragment,{})},cme=()=>{const e=Qt(),{getEdges:t}=Yp(),{getSelectedNodes:n}=tV();return{copySelectedNodes:Q.useCallback(()=>{const a=t(),l=n();if(l.length===0)return;const u={nodes:[],edges:[]};for(const m of l){const y=e.nodespace.get_node(m.id,!1);y&&u.nodes.push(y.serialize())}const d=new Set(l.map(m=>m.id)),h=a.filter(m=>d.has(m.source)&&d.has(m.target));for(const m of h)!m.sourceHandle||!m.targetHandle||u.edges.push({src_nid:m.source,src_ioid:m.sourceHandle,trg_nid:m.target,trg_ioid:m.targetHandle});navigator.clipboard.writeText(JSON.stringify(u))},[n,t,e])}},fme=()=>{const e=Pc("Delete"),t=Pc(["Meta+c","Control+c","Strg+c"]),n=Pc(["Control+g","Meta+g"]),r=Pc(["Control+Alt+g","Meta+Alt+g"]),a=dhe(),{getEdges:l}=Yp(),{getNodes:u,getSelectedNodes:d,getSplitNodes:h}=tV(),{copySelectedNodes:m}=cme(),{node:y,group:v,edge:S}=jo();return Q.useEffect(()=>{if(e){const w=l().filter(k=>k.selected);for(const k of w)!k.source||!k.target||!k.sourceHandle||!k.targetHandle||S?.remove_edge({src_nid:k.source,src_ioid:k.sourceHandle,trg_nid:k.target,trg_ioid:k.targetHandle});const A=d(),{group_nodes:E,default_nodes:R}=h(A);for(const k of R)y?.remove_node(k.id);for(const k of E)v?.remove_group(k.id)}},[e,u,l,y,v,S]),Q.useEffect(()=>{t&&m()},[t,m]),Q.useEffect(()=>{if(n){const w=d(),{group_nodes:A,default_nodes:E}=h(w);w.length>0&&a(E.map(R=>R.id),A.map(R=>R.id))}},[n,u]),Q.useEffect(()=>{if(r){console.log("ungroupPressed");const w=d(),{group_nodes:A}=h(w);A.forEach(E=>{v?.remove_group(E.id)})}},[r,u]),T.jsx(T.Fragment,{})},dme=()=>{const{node:e,edge:t}=jo(),n=Qt();return z.useCallback(async(a,l)=>{try{if(!a||!e||!t)return;const u=JSON.parse(a);if(!u||!n.worker||!u.nodes)return;const d=[0,0];for(const m of u.nodes)d[0]+=m.properties["frontend:pos"][0],d[1]+=m.properties["frontend:pos"][1];d[0]/=u.nodes.length,d[1]/=u.nodes.length;const h=[];for(const m of u.nodes){const y={id:m.node_id,src_id:m.id,position:[m.properties["frontend:pos"][0]-d[0],m.properties["frontend:pos"][1]-d[1]]};h.push(y)}for(const m of h){const y=await e.add_node(m.id);!y||!n.nodespace.get_node(y.id,!1)||(m.new_id=y.id,l([{id:y.id,type:"position",position:{x:m.position[0]+y.properties["frontend:pos"][0],y:m.position[1]+y.properties["frontend:pos"][1]}}]))}for(const m of u.edges){const y=h.find(S=>S.src_id===m.src_nid),v=h.find(S=>S.src_id===m.trg_nid);!y||!v||!y.new_id||!v.new_id||t.add_edge({src_nid:y.new_id,src_ioid:m.src_ioid,trg_nid:v.new_id,trg_ioid:m.trg_ioid})}}catch(u){console.error("Failed to process pasted data:",u)}},[e,t,n])},hme=(e,t)=>{const n=e.properties||{};n["frontend:size"]||(n["frontend:size"]=[200,100]);const r=n["frontend:pos"];if(!r||r.length!==2||isNaN(r[0])||r[0]===null||isNaN(r[1])||r[1]===null)if(!t||!t.rf_instance||t.reactflowRef===null)n["frontend:pos"]=[0,0];else{const l=t.reactflowRef.getBoundingClientRect(),u=l.left+l.width/2,d=l.top+l.height/2,h=t.rf_instance.screenToFlowPosition({x:u,y:d});n["frontend:pos"]=[h.x-n["frontend:size"][0]/2,h.y-n["frontend:size"][0]/2]}n["frontend:collapsed"]||(n["frontend:collapsed"]=!1),e.properties=n},pme=(e,t)=>{const n=e.getState();if(hme(n,t),n.id===void 0)throw new Error("Node must have an id");const r={nodestore:e};return{position:{x:n.properties["frontend:pos"][0],y:n.properties["frontend:pos"][1]},data:r,type:"default",zIndex:1003,...n}},V5={default:ea.Dots,metal:ea.Cross,light:ea.Dots,solarized:ea.Dots,midnight:ea.Dots,forest:ea.Dots,scientific:ea.Lines},mme=e=>{const t=Qt(),n=Q.useRef(null),{colorTheme:r}=f6(),{onSelectionChange:a}=sme(),l=foe();z.useEffect(()=>{t.getStateManager().toaster=l},[]),Q.useEffect(()=>{t.reactflowRef=n.current},[n]);const{nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y}=t.useReactFlowStore(zO(Wpe)),v=dme(),S=Q.useCallback(w=>{const A=n.current;if(!A)return;let E=w.target,R=0;for(;E&&E.parentElement&&E!==A;)R++,E=E.parentElement;t.logger.debug(`onPasteCapture: ${R} steps to reactflow`),R<=2&&v(w.clipboardData.getData("text/plain"),h)},[v,h,t.logger]);return T.jsx("div",{className:"reactflowlayer",children:T.jsxs(jde,{onPasteCapture:S,nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y,nodeTypes:Ype,edgeTypes:Zpe,minZoom:e.minZoom,maxZoom:e.maxZoom,fitView:!0,onSelectionChange:a,ref:n,panOnDrag:!e.static,children:[T.jsx(ume,{}),T.jsx(fme,{}),T.jsx(Vde,{color:"#888",gap:24,size:2,variant:V5[r]||V5.default,patternClassName:"fn-background-pattern"}),e.minimap&&T.jsx(ihe,{nodeStrokeWidth:3,pannable:!e.static,zoomable:!e.static,zoomStep:3})]})})},gme=({on_node_change:e,on_edge_change:t,on_connect:n})=>{const r=e||(d=>{}),a=t||(d=>{}),l=n||(d=>{});return fl((d,h)=>({_nodes:[],_edges:[],_nodes_map:new Map,update_nodes:m=>{m=ZO(m),d({_nodes:m,_nodes_map:new Map(m.map(y=>[y.id,y]))})},partial_update_nodes:m=>{const y=h(),v=y._nodes,S=new Map(v.map(w=>[w.id,w]));for(const w of m)S.set(w.id,w);y.update_nodes(Array.from(S.values()))},update_edges:m=>{d({_edges:m})},onNodesChange:m=>{const y=h();y.update_nodes(DO(m,y._nodes)),r(m)},onEdgesChange:m=>{d({_edges:zP(m,h()._edges)}),a(m)},onConnect:m=>{m.source==null||m.target==null||l(m)},getNode:m=>h()._nodes_map.get(m),getNodes:()=>h()._nodes,getEdges:()=>h()._edges}))},yme=()=>{const t=Qt().progress_state();return T.jsxs("div",{className:"statusbar",children:[T.jsx("span",{className:"statusbar-progressbar",style:{width:Math.min(100,100*t.progress)+"%"}}),T.jsx("span",{className:"statusbar-message",children:t.message})]})},wE=!1;var GR=["Enter"," "],vme=["ArrowDown","PageUp","Home"],aV=["ArrowUp","PageDown","End"],bme=[...vme,...aV],xme={ltr:[...GR,"ArrowRight"],rtl:[...GR,"ArrowLeft"]},Sme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Lx="Menu",[sx,wme,Eme]=mC(Lx),[qp,iV]=bu(Lx,[Eme,dC,PC]),Px=dC(),lV=PC(),[sV,Jp]=qp(Lx),[Cme,Hx]=qp(Lx),uV=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:l,modal:u=!0}=e,d=Px(t),[h,m]=z.useState(null),y=z.useRef(!1),v=ka(l),S=jC(a);return z.useEffect(()=>{const w=()=>{y.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>y.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),T.jsx(Qk,{...d,children:T.jsx(sV,{scope:t,open:n,onOpenChange:v,content:h,onContentChange:m,children:T.jsx(Cme,{scope:t,onClose:z.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:S,modal:u,children:r})})})};uV.displayName=Lx;var _me="MenuAnchor",WO=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Px(n);return T.jsx(Kk,{...a,...r,ref:t})});WO.displayName=_me;var Ame="MenuPortal",[rwe,cV]=qp(Ame,{forceMount:void 0}),dl="MenuContent",[Tme,qO]=qp(dl),fV=z.forwardRef((e,t)=>{const n=cV(dl,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=Jp(dl,e.__scopeMenu),u=Hx(dl,e.__scopeMenu);return T.jsx(sx.Provider,{scope:e.__scopeMenu,children:T.jsx(as,{present:r||l.open,children:T.jsx(sx.Slot,{scope:e.__scopeMenu,children:u.modal?T.jsx(Rme,{...a,ref:t}):T.jsx(kme,{...a,ref:t})})})})}),Rme=z.forwardRef((e,t)=>{const n=Jp(dl,e.__scopeMenu),r=z.useRef(null),a=En(t,r);return z.useEffect(()=>{const l=r.current;if(l)return _k(l)},[]),T.jsx(JO,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ke(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),kme=z.forwardRef((e,t)=>{const n=Jp(dl,e.__scopeMenu);return T.jsx(JO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ome=Jy("MenuContent.ScrollLock"),JO=z.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,disableOutsideScroll:A,...E}=e,R=Jp(dl,n),k=Hx(dl,n),D=Px(n),M=lV(n),I=wme(n),[L,P]=z.useState(null),G=z.useRef(null),$=En(t,G,R.onContentChange),Z=z.useRef(0),j=z.useRef(""),X=z.useRef(0),ee=z.useRef(null),ae=z.useRef("right"),U=z.useRef(0),te=A?tC:z.Fragment,V=A?{as:Ome,allowPinchZoom:!0}:void 0,W=ne=>{const B=j.current+ne,oe=I().filter(Ee=>!Ee.disabled),se=document.activeElement,Y=oe.find(Ee=>Ee.ref.current===se)?.textValue,he=oe.map(Ee=>Ee.textValue),Te=Fme(he,B,Y),me=oe.find(Ee=>Ee.textValue===Te)?.ref.current;(function Ee(xe){j.current=xe,window.clearTimeout(Z.current),xe!==""&&(Z.current=window.setTimeout(()=>Ee(""),1e3))})(B),me&&setTimeout(()=>me.focus())};z.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Ck();const J=z.useCallback(ne=>ae.current===ee.current?.side&&Ume(ne,ee.current?.area),[]);return T.jsx(Tme,{scope:n,searchRef:j,onItemEnter:z.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),onItemLeave:z.useCallback(ne=>{J(ne)||(G.current?.focus(),P(null))},[J]),onTriggerLeave:z.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),pointerGraceTimerRef:X,onPointerGraceIntentChange:z.useCallback(ne=>{ee.current=ne},[]),children:T.jsx(te,{...V,children:T.jsx(QE,{asChild:!0,trapped:a,onMountAutoFocus:Ke(l,ne=>{ne.preventDefault(),G.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:T.jsx(yx,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,children:T.jsx(GH,{asChild:!0,...M,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:P,onEntryFocus:Ke(h,ne=>{k.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:T.jsx(j6,{role:"menu","aria-orientation":"vertical","data-state":RV(R.open),"data-radix-menu-content":"",dir:k.dir,...D,...E,ref:$,style:{outline:"none",...E.style},onKeyDown:Ke(E.onKeyDown,ne=>{const oe=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,se=ne.ctrlKey||ne.altKey||ne.metaKey,Y=ne.key.length===1;oe&&(ne.key==="Tab"&&ne.preventDefault(),!se&&Y&&W(ne.key));const he=G.current;if(ne.target!==he||!bme.includes(ne.key))return;ne.preventDefault();const me=I().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);aV.includes(ne.key)&&me.reverse(),Hme(me)}),onBlur:Ke(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(Z.current),j.current="")}),onPointerMove:Ke(e.onPointerMove,ux(ne=>{const B=ne.target,oe=U.current!==ne.clientX;if(ne.currentTarget.contains(B)&&oe){const se=ne.clientX>U.current?"right":"left";ae.current=se,U.current=ne.clientX}}))})})})})})})});fV.displayName=dl;var Mme="MenuGroup",QO=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(zt.div,{role:"group",...r,ref:t})});QO.displayName=Mme;var Nme="MenuLabel",dV=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(zt.div,{...r,ref:t})});dV.displayName=Nme;var EE="MenuItem",F5="menu.itemSelect",VC=z.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,l=z.useRef(null),u=Hx(EE,e.__scopeMenu),d=qO(EE,e.__scopeMenu),h=En(t,l),m=z.useRef(!1),y=()=>{const v=l.current;if(!n&&v){const S=new CustomEvent(F5,{bubbles:!0,cancelable:!0});v.addEventListener(F5,w=>r?.(w),{once:!0}),Ek(v,S),S.defaultPrevented?m.current=!1:u.onClose()}};return T.jsx(hV,{...a,ref:h,disabled:n,onClick:Ke(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),m.current=!0},onPointerUp:Ke(e.onPointerUp,v=>{m.current||v.currentTarget?.click()}),onKeyDown:Ke(e.onKeyDown,v=>{const S=d.searchRef.current!=="";n||S&&v.key===" "||GR.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});VC.displayName=EE;var hV=z.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...l}=e,u=qO(EE,n),d=lV(n),h=z.useRef(null),m=En(t,h),[y,v]=z.useState(!1),[S,w]=z.useState("");return z.useEffect(()=>{const A=h.current;A&&w((A.textContent??"").trim())},[l.children]),T.jsx(sx.ItemSlot,{scope:n,disabled:r,textValue:a??S,children:T.jsx(UH,{asChild:!0,...d,focusable:!r,children:T.jsx(zt.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:m,onPointerMove:Ke(e.onPointerMove,ux(A=>{r?u.onItemLeave(A):(u.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ke(e.onPointerLeave,ux(A=>u.onItemLeave(A))),onFocus:Ke(e.onFocus,()=>v(!0)),onBlur:Ke(e.onBlur,()=>v(!1))})})})}),Dme="MenuCheckboxItem",pV=z.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return T.jsx(bV,{scope:e.__scopeMenu,checked:n,children:T.jsx(VC,{role:"menuitemcheckbox","aria-checked":CE(n)?"mixed":n,...a,ref:t,"data-state":tM(n),onSelect:Ke(a.onSelect,()=>r?.(CE(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pV.displayName=Dme;var mV="MenuRadioGroup",[Ime,zme]=qp(mV,{value:void 0,onValueChange:()=>{}}),gV=z.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,l=ka(r);return T.jsx(Ime,{scope:e.__scopeMenu,value:n,onValueChange:l,children:T.jsx(QO,{...a,ref:t})})});gV.displayName=mV;var yV="MenuRadioItem",vV=z.forwardRef((e,t)=>{const{value:n,...r}=e,a=zme(yV,e.__scopeMenu),l=n===a.value;return T.jsx(bV,{scope:e.__scopeMenu,checked:l,children:T.jsx(VC,{role:"menuitemradio","aria-checked":l,...r,ref:t,"data-state":tM(l),onSelect:Ke(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});vV.displayName=yV;var KO="MenuItemIndicator",[bV,jme]=qp(KO,{checked:!1}),xV=z.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,l=jme(KO,n);return T.jsx(as,{present:r||CE(l.checked)||l.checked===!0,children:T.jsx(zt.span,{...a,ref:t,"data-state":tM(l.checked)})})});xV.displayName=KO;var Bme="MenuSeparator",SV=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});SV.displayName=Bme;var Lme="MenuArrow",wV=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Px(n);return T.jsx(B6,{...a,...r,ref:t})});wV.displayName=Lme;var eM="MenuSub",[Pme,EV]=qp(eM),CV=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,l=Jp(eM,t),u=Px(t),[d,h]=z.useState(null),[m,y]=z.useState(null),v=ka(a);return z.useEffect(()=>(l.open===!1&&v(!1),()=>v(!1)),[l.open,v]),T.jsx(Qk,{...u,children:T.jsx(sV,{scope:t,open:r,onOpenChange:v,content:m,onContentChange:y,children:T.jsx(Pme,{scope:t,contentId:hu(),triggerId:hu(),trigger:d,onTriggerChange:h,children:n})})})};CV.displayName=eM;var k1="MenuSubTrigger",_V=z.forwardRef((e,t)=>{const n=Jp(k1,e.__scopeMenu),r=Hx(k1,e.__scopeMenu),a=EV(k1,e.__scopeMenu),l=qO(k1,e.__scopeMenu),u=z.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},y=z.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return z.useEffect(()=>y,[y]),z.useEffect(()=>{const v=d.current;return()=>{window.clearTimeout(v),h(null)}},[d,h]),T.jsx(WO,{asChild:!0,...m,children:T.jsx(hV,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":RV(n.open),...e,ref:JE(t,a.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ke(e.onPointerMove,ux(v=>{l.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),y()},100))})),onPointerLeave:Ke(e.onPointerLeave,ux(v=>{y();const S=n.content?.getBoundingClientRect();if(S){const w=n.content?.dataset.side,A=w==="right",E=A?-5:5,R=S[A?"left":"right"],k=S[A?"right":"left"];l.onPointerGraceIntentChange({area:[{x:v.clientX+E,y:v.clientY},{x:R,y:S.top},{x:k,y:S.top},{x:k,y:S.bottom},{x:R,y:S.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(v),v.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Ke(e.onKeyDown,v=>{const S=l.searchRef.current!=="";e.disabled||S&&v.key===" "||xme[r.dir].includes(v.key)&&(n.onOpenChange(!0),n.content?.focus(),v.preventDefault())})})})});_V.displayName=k1;var AV="MenuSubContent",TV=z.forwardRef((e,t)=>{const n=cV(dl,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=Jp(dl,e.__scopeMenu),u=Hx(dl,e.__scopeMenu),d=EV(AV,e.__scopeMenu),h=z.useRef(null),m=En(t,h);return T.jsx(sx.Provider,{scope:e.__scopeMenu,children:T.jsx(as,{present:r||l.open,children:T.jsx(sx.Slot,{scope:e.__scopeMenu,children:T.jsx(JO,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&h.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:Ke(e.onFocusOutside,y=>{y.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Ke(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:Ke(e.onKeyDown,y=>{const v=y.currentTarget.contains(y.target),S=Sme[u.dir].includes(y.key);v&&S&&(l.onOpenChange(!1),d.trigger?.focus(),y.preventDefault())})})})})})});TV.displayName=AV;function RV(e){return e?"open":"closed"}function CE(e){return e==="indeterminate"}function tM(e){return CE(e)?"indeterminate":e?"checked":"unchecked"}function Hme(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Vme(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Fme(e,t,n){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=Vme(e,Math.max(l,0));a.length===1&&(u=u.filter(m=>m!==n));const h=u.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function Gme(e,t){const{x:n,y:r}=e;let a=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],m=d.x,y=d.y,v=h.x,S=h.y;y>r!=S>r&&n<(v-m)*(r-y)/(S-y)+m&&(a=!a)}return a}function Ume(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Gme(n,t)}function ux(e){return t=>t.pointerType==="mouse"?e(t):void 0}var $me=uV,Xme=WO,Yme=fV,Zme=QO,Wme=dV,qme=VC,Jme=pV,Qme=gV,Kme=vV,ege=xV,tge=SV,nge=wV,rge=CV,oge=_V,age=TV,FC="DropdownMenu",[ige,owe]=bu(FC,[iV]),na=iV(),[lge,kV]=ige(FC),OV=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=na(t),m=z.useRef(null),[y,v]=Hd({prop:a,defaultProp:l??!1,onChange:u,caller:FC});return T.jsx(lge,{scope:t,triggerId:hu(),triggerRef:m,contentId:hu(),open:y,onOpenChange:v,onOpenToggle:z.useCallback(()=>v(S=>!S),[v]),modal:d,children:T.jsx($me,{...h,open:y,onOpenChange:v,dir:r,modal:d,children:n})})};OV.displayName=FC;var MV="DropdownMenuTrigger",NV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,l=kV(MV,n),u=na(n);return T.jsx(Xme,{asChild:!0,...u,children:T.jsx(zt.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:JE(t,l.triggerRef),onPointerDown:Ke(e.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Ke(e.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});NV.displayName=MV;var DV="DropdownMenuContent",IV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=kV(DV,n),l=na(n),u=z.useRef(!1);return T.jsx(Yme,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...r,ref:t,onCloseAutoFocus:Ke(e.onCloseAutoFocus,d=>{u.current||a.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Ke(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,y=h.button===2||m;(!a.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});IV.displayName=DV;var sge="DropdownMenuGroup",zV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Zme,{...a,...r,ref:t})});zV.displayName=sge;var uge="DropdownMenuLabel",cge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Wme,{...a,...r,ref:t})});cge.displayName=uge;var fge="DropdownMenuItem",jV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(qme,{...a,...r,ref:t})});jV.displayName=fge;var dge="DropdownMenuCheckboxItem",hge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Jme,{...a,...r,ref:t})});hge.displayName=dge;var pge="DropdownMenuRadioGroup",BV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Qme,{...a,...r,ref:t})});BV.displayName=pge;var mge="DropdownMenuRadioItem",LV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Kme,{...a,...r,ref:t})});LV.displayName=mge;var gge="DropdownMenuItemIndicator",yge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(ege,{...a,...r,ref:t})});yge.displayName=gge;var vge="DropdownMenuSeparator",bge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(tge,{...a,...r,ref:t})});bge.displayName=vge;var xge="DropdownMenuArrow",Sge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(nge,{...a,...r,ref:t})});Sge.displayName=xge;var wge=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:a,defaultOpen:l}=e,u=na(t),[d,h]=Hd({prop:r,defaultProp:l??!1,onChange:a,caller:"DropdownMenuSub"});return T.jsx(rge,{...u,open:d,onOpenChange:h,children:n})},Ege="DropdownMenuSubTrigger",PV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(oge,{...a,...r,ref:t})});PV.displayName=Ege;var Cge="DropdownMenuSubContent",HV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(age,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});HV.displayName=Cge;var nM=OV,rM=NV,oM=IV,aM=zV,jc=jV,_ge=BV,Age=LV,Tge=wge,Rge=PV,kge=HV;const Oge=({trigger:e,setOpen:t,open:n})=>{const[r,a]=Q.useState(""),[l,u]=Q.useState(!0),d=Qt();return d.options.useWorkerManager?T.jsxs(Jc,{setOpen:t,open:n,trigger:e,title:"New Worker",description:"Create a new worker",children:[T.jsxs("div",{children:["Name:",T.jsx("br",{}),T.jsx("input",{className:"styledinput",onChange:h=>{a(h.currentTarget.value)},value:r}),T.jsxs("div",{style:{marginTop:8},children:[T.jsx("input",{type:"checkbox",id:"inVenvCheckbox",checked:l,onChange:h=>u(h.currentTarget.checked)}),T.jsx("label",{htmlFor:"inVenvCheckbox",style:{marginLeft:4},children:"Create in new virtual environment"})]})]}),T.jsx("div",{children:r&&T.jsx("div",{children:T.jsx("button",{className:"styledbtn",onClick:()=>{d.workermanager?.new_worker({name:r,in_venv:l}),t(!1)},children:"Create"})})})]}):null},Mge=({trigger:e,setOpen:t,open:n})=>{const r=Qt(),[a,l]=Q.useState(!1),u=r.workers(),d=r.worker?.uuid,h=(d?u[d]?.name:void 0)||d||"worker",m=async()=>{if(!r.worker)return;const y=await r.worker.export({withFiles:a});gF(y,h+".fnw","application/zip"),t(!1)};return T.jsx(Jc,{setOpen:t,open:n,trigger:e,title:"Export Worker",description:"Export the worker as a .fnw file",children:T.jsxs("div",{children:[T.jsxs("div",{children:[T.jsx("input",{type:"checkbox",className:"styledcheckbox",checked:a,onChange:y=>{l(y.currentTarget.checked)}}),"Include Files"]}),T.jsx("button",{className:"styledbtn",onClick:m,children:"Export"})]})})},Nge=()=>{const e=Qt(),t=e.workers(),[n,r]=Q.useState(!1),[a,l]=Q.useState(!1),u=w=>{w!=="__select__"&&e.workers&&e.workermanager&&t[w]&&(!t[w].active&&!window.confirm("this is an inactive worker, selecting it will start it, continue?")||e.workermanager.set_active(w))},d=async()=>{if(!e.worker||!window.confirm("Updateing the worker might replace the current nodespace, continue?"))return;const A=await bF(".fnw");e.worker.update_from_export(A)},h=e.options.useWorkerManager&&e.workermanager&&e.workermanager.open||wE,m=h&&Object.keys(t).length>0,y=e.worker&&e.worker.is_open,v=y&&h;return h||y?T.jsxs(T.Fragment,{children:[T.jsxs(nM,{children:[T.jsx(rM,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Od,{direction:"row",children:["Worker ",T.jsx(Vk,{className:"m-x-s"})]})})}),T.jsx(oM,{className:"headermenucontent funcnodescontainer",children:T.jsxs(aM,{children:[m&&T.jsxs(Tge,{children:[T.jsx(Rge,{className:"headermenuitem submenuitem",children:T.jsxs(Od,{direction:"row",children:["Select",T.jsx(X1,{})]})}),T.jsx(kge,{className:"headermenucontent funcnodescontainer",sideOffset:2,alignOffset:-5,children:T.jsx(_ge,{value:e.worker?.uuid,onValueChange:w=>{u(w)},children:Object.keys(t).sort((w,A)=>{if(t[w].active&&!t[A].active)return-1;if(!t[w].active&&t[A].active)return 1;const E=t[w].name||w,R=t[A].name||A;return E.localeCompare(R)}).map(w=>T.jsx(Age,{className:"headermenuitem workerselectoption"+(t[w]?.active?" active":" inactive")+" headermenuitem",value:w,disabled:w===e.worker?.uuid,children:t[w]?.name||w},w))})})]}),y&&T.jsxs(T.Fragment,{children:[v&&T.jsx(jc,{className:"headermenuitem",onClick:()=>{if(e.worker){if(!e.workermanager)return e.logger.error("no workermanager");e.workermanager?.restart_worker(e.worker.uuid)}},children:"Restart"}),T.jsx(jc,{className:"headermenuitem",onClick:()=>{e.worker&&e.worker.stop()},children:"Stop"}),T.jsx(jc,{className:"headermenuitem",onClick:()=>l(!0),children:"Export"}),T.jsx(jc,{className:"headermenuitem",onClick:d,children:"Update"})]}),h&&T.jsx(T.Fragment,{children:T.jsx(jc,{className:"headermenuitem",onClick:()=>r(!0),children:"New"})})]})})]}),T.jsx(Oge,{open:n,setOpen:r}),T.jsx(Mge,{open:a,setOpen:l})]}):null},Dge=()=>{const e=Qt(),t=()=>{window.confirm("Are you sure you want to start a new flow?")&&e.worker?.clear()},n=async()=>{const a=await e.worker?.save();if(!a)return;const l=new Blob([JSON.stringify(a)],{type:"application/json"}),u=URL.createObjectURL(l),d=document.createElement("a");d.href=u,d.download="flow.json",d.click(),URL.revokeObjectURL(u),d.remove()},r=async()=>{const a=document.createElement("input");a.type="file",a.accept=".json",a.onchange=async l=>{const u=l.target.files?.[0];if(!u)return;const d=new FileReader;d.onload=async h=>{const m=h.target?.result;if(!m)return;const y=JSON.parse(m);await e.worker?.load(y)},d.readAsText(u)},a.click()};return T.jsx(T.Fragment,{children:T.jsxs(nM,{children:[T.jsx(rM,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Od,{direction:"row",children:["Nodespace ",T.jsx(Vk,{className:"m-x-s"})]})})}),T.jsx(oM,{className:"headermenucontent funcnodescontainer",children:T.jsxs(aM,{children:[T.jsx(jc,{className:"headermenuitem",onClick:t,children:"New"}),T.jsx(jc,{className:"headermenuitem",onClick:n,children:"Save"}),T.jsx(jc,{className:"headermenuitem",onClick:r,children:"Load"})]})})]})})},Ige=({theme:e,selected:t})=>T.jsxs("div",{style:{width:80,height:54,borderRadius:"var(--fn-border-radius-s, 8px)",border:t?"2.5px solid #1976d2":"1.5px solid #bbb",boxShadow:t?"0 0 0 2px #1976d2":"0 1px 4px #0002",background:"var(--fn-app-background)",display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-start",position:"relative",overflow:"hidden",transition:"border 0.2s, box-shadow 0.2s"},"fn-data-color-theme":e,children:[T.jsx("div",{style:{height:10,background:"var(--fn-primary-color)",borderBottom:"1px solid var(--fn-neutral-element-border)"}}),T.jsxs("div",{style:{display:"flex",flex:1},children:[T.jsx("div",{style:{width:12,background:"var(--fn-surface-elevation-low, var(--fn-container-background))",borderRight:"1px solid var(--fn-neutral-element-border)"}}),T.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--fn-container-background)"},children:T.jsxs("div",{style:{width:22,height:14,borderRadius:"var(--fn-border-radius-xs, 4px)",background:"var(--fn-node-background)",border:"1px solid var(--fn-node-header-color)",boxShadow:"0 1px 2px #0002",display:"flex",flexDirection:"column"},children:[T.jsx("div",{style:{height:5,background:"var(--fn-node-header-color)",borderTopLeftRadius:"var(--fn-border-radius-xs, 4px)",borderTopRightRadius:"var(--fn-border-radius-xs, 4px)"}}),T.jsx("div",{style:{flex:1,background:"transparent"}})]})})]}),T.jsx("span",{style:{position:"absolute",bottom:2,right:4,fontSize:9,color:"var(--fn-text-color-neutral)",opacity:.7,textTransform:"capitalize",fontWeight:600,pointerEvents:"none"},children:e}),t&&T.jsx("span",{style:{position:"absolute",top:2,left:6,fontSize:14,color:"#1976d2",fontWeight:900,pointerEvents:"none"},"aria-label":"Selected",children:"✓"})]}),zge=()=>{const{colorTheme:e,setColorTheme:t}=f6(),[n,r]=z.useState(null),[a,l]=z.useState(null),u=h=>{h!==e&&(l(e),t(h),r(h))},d=h=>{n===h&&a&&a!==h&&t(a),r(null),l(null)};return T.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[T.jsx("div",{style:{marginBottom:8,fontWeight:500},children:"Theme:"}),T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(80px, 1fr))",gap:16,justifyItems:"center"},children:CL.map(h=>T.jsx("button",{onClick:()=>{t(h),r(null),l(null)},onMouseEnter:()=>u(h),onMouseLeave:()=>d(h),style:{background:"none",border:"none",padding:0,cursor:"pointer",outline:"none",borderRadius:8},"aria-label":`Select ${h} theme`,children:T.jsx(Ige,{theme:h,selected:e===h})},h))})]})},jge=()=>{const[e,t]=z.useState(!1),n=()=>{t(!0)};return T.jsxs(T.Fragment,{children:[T.jsxs(nM,{children:[T.jsx(rM,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Od,{direction:"row",children:["Settings ",T.jsx(Vk,{className:"m-x-s"})]})})}),T.jsx(oM,{className:"headermenucontent funcnodescontainer",children:T.jsx(aM,{children:T.jsx(jc,{className:"headermenuitem",onClick:n,children:"Appearance"})})})]}),T.jsx(Jc,{open:e,setOpen:t,title:"Appearance",description:"Change the color theme.",closebutton:!0,children:T.jsx(zge,{})})]})},Bge=({...e})=>{const t=Qt(),n=t.workerstate();return Object.keys(e).length>0&&t.logger.debug("headerprops",e),T.jsxs(Od,{className:"funcnodesreactflowheader",direction:"row",wrap:!0,children:[T.jsx(Od,{className:"headerelement m-w-6",grow:{"":!0,m:!1},children:T.jsx(yme,{})}),(e.showmenu||wE)&&T.jsxs(Od,{direction:"row",wrap:!0,children:[T.jsx("div",{className:"headerelement",children:T.jsx(Nge,{})}),(t.worker&&n.is_open||wE)&&T.jsx("div",{className:"headerelement",children:T.jsx(Dge,{})}),T.jsx("div",{className:"headerelement",children:T.jsx(jge,{})})]})]})},VV=({item:e})=>{const{node:t}=jo(),n=z.useCallback(()=>{t?.add_node(e.node_id)},[e.node_id,t]),r=z.useCallback(a=>{a.detail===2&&n()},[n]);return T.jsx("div",{className:"libnodeentry",onClick:r,title:e.description,children:e.node_name||e.node_id})},FV=(e,t)=>{const n=e.nodes?.some(a=>a.node_id.toLowerCase().includes(t.toLowerCase()))??!1,r=e.subshelves?.some(a=>FV(a,t))??!1;return n||r},iM=({item:e,filter:t,parentkey:n})=>{const[r,a]=Q.useState(!1),l=()=>a(!r),u=e.nodes?.filter(h=>h.node_id.toLowerCase().includes(t.toLowerCase())),d=r||t.length>0;return FV(e,t)?T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:l,style:{cursor:"pointer"},title:e.description,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(d?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(d?"open":"close"),children:T.jsxs("div",{className:"libnodecontainer_inner",children:[u&&T.jsx(T.Fragment,{children:u.map(h=>T.jsx(VV,{item:h},h.node_id))}),e.subshelves&&T.jsx(T.Fragment,{children:e.subshelves.map(h=>T.jsx(iM,{item:h,filter:t,parentkey:n+h.name},n+h.name))})]})}),T.jsx("hr",{})]}):T.jsx(T.Fragment,{})},Lge=({filter:e,setFilter:t})=>T.jsxs("div",{className:"libfilter",children:[T.jsx(EQ,{fontSize:"inherit"}),T.jsx("input",{type:"text",placeholder:"Filter",value:e,onChange:n=>{t(n.target.value)}}),e&&T.jsx(sC,{fontSize:"inherit",onClick:()=>{t("")}})]}),Pge=({children:e})=>{const[t,n]=Q.useState(""),r=Qt(),[a,l]=Q.useState(!0),[u,d]=Q.useState(!0),[h,m]=Q.useState(!0),[y,v]=Q.useState({installed:[],available:[],active:[]}),[S,w]=Q.useState(!1),{lib:A}=jo(),E=$=>{$&&(r.worker===void 0||!r.worker.is_open||A?.get_available_modules().then(Z=>{v(Z)}))};if(!r.worker)return T.jsx(T.Fragment,{});const R=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),k=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),D=z.useCallback($=>{w(!1),A?.remove_lib($.name)},[A]),M=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),I=z.useCallback($=>$.filter(Z=>Z.name.toLowerCase().includes(t.toLowerCase())||Z.description.toLowerCase().includes(t.toLowerCase())),[t]),L=I(y.available),P=I(y.installed),G=I(y.active);return T.jsxs(Jc,{title:"Manage Library",trigger:e,description:"Add or remove libraries to the current worker.",onOpenChange:E,open:S,setOpen:w,children:[T.jsx("input",{className:"filter-input styledinput",type:"text",placeholder:"Filter modules...",value:t,onChange:$=>n($.target.value)}),T.jsxs("div",{className:"packagelist",style:{maxHeight:"70%",overflow:"auto"},children:[P.length>0&&T.jsx("h3",{onClick:()=>{m(!h)},children:"Installed"}),h&&P.map($=>T.jsx(fSe,{availableModule:$,on_add:R},$.name+$.source)),L.length>0&&T.jsx("h3",{onClick:()=>{d(!u)},children:"Available"}),u&&L.map($=>T.jsx(dSe,{availableModule:$,on_add:k},$.name+$.source)),G.length>0&&T.jsx("h3",{onClick:()=>{l(!a)},children:"Active"}),a&&G.map($=>T.jsx(cSe,{availableModule:$,on_remove:D,on_update:M},$.name+$.source))]})]})},lM=({availableModule:e})=>T.jsxs("div",{className:"module-links",children:[e.homepage&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",children:"Homepage"})}),e.source&&e.homepage&&" | ",e.source&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.source,target:"_blank",rel:"noopener noreferrer",children:"Source"})})]});function Hge(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Vge=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Fge=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gge={};function G5(e,t){return(Gge.jsx?Fge:Vge).test(e)}const Uge=/[ \t\n\f\r]/g;function $ge(e){return typeof e=="object"?e.type==="text"?U5(e.value):!1:U5(e)}function U5(e){return e.replace(Uge,"")===""}class Vx{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Vx.prototype.normal={};Vx.prototype.property={};Vx.prototype.space=void 0;function GV(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Vx(n,r,t)}function UR(e){return e.toLowerCase()}class Ma{constructor(t,n){this.attribute=n,this.property=t}}Ma.prototype.attribute="";Ma.prototype.booleanish=!1;Ma.prototype.boolean=!1;Ma.prototype.commaOrSpaceSeparated=!1;Ma.prototype.commaSeparated=!1;Ma.prototype.defined=!1;Ma.prototype.mustUseProperty=!1;Ma.prototype.number=!1;Ma.prototype.overloadedBoolean=!1;Ma.prototype.property="";Ma.prototype.spaceSeparated=!1;Ma.prototype.space=void 0;let Xge=0;const kt=Qp(),Ar=Qp(),$R=Qp(),Ve=Qp(),kn=Qp(),Zy=Qp(),Qa=Qp();function Qp(){return 2**++Xge}const XR=Object.freeze(Object.defineProperty({__proto__:null,boolean:kt,booleanish:Ar,commaOrSpaceSeparated:Qa,commaSeparated:Zy,number:Ve,overloadedBoolean:$R,spaceSeparated:kn},Symbol.toStringTag,{value:"Module"})),mT=Object.keys(XR);class sM extends Ma{constructor(t,n,r,a){let l=-1;if(super(t,n),$5(this,"space",a),typeof r=="number")for(;++l<mT.length;){const u=mT[l];$5(this,mT[l],(r&XR[u])===XR[u])}}}sM.prototype.defined=!0;function $5(e,t,n){n&&(e[t]=n)}function v0(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const l=new sM(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[UR(r)]=r,n[UR(l.attribute)]=r}return new Vx(t,n,e.space)}const UV=v0({properties:{ariaActiveDescendant:null,ariaAtomic:Ar,ariaAutoComplete:null,ariaBusy:Ar,ariaChecked:Ar,ariaColCount:Ve,ariaColIndex:Ve,ariaColSpan:Ve,ariaControls:kn,ariaCurrent:null,ariaDescribedBy:kn,ariaDetails:null,ariaDisabled:Ar,ariaDropEffect:kn,ariaErrorMessage:null,ariaExpanded:Ar,ariaFlowTo:kn,ariaGrabbed:Ar,ariaHasPopup:null,ariaHidden:Ar,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kn,ariaLevel:Ve,ariaLive:null,ariaModal:Ar,ariaMultiLine:Ar,ariaMultiSelectable:Ar,ariaOrientation:null,ariaOwns:kn,ariaPlaceholder:null,ariaPosInSet:Ve,ariaPressed:Ar,ariaReadOnly:Ar,ariaRelevant:null,ariaRequired:Ar,ariaRoleDescription:kn,ariaRowCount:Ve,ariaRowIndex:Ve,ariaRowSpan:Ve,ariaSelected:Ar,ariaSetSize:Ve,ariaSort:null,ariaValueMax:Ve,ariaValueMin:Ve,ariaValueNow:Ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $V(e,t){return t in e?e[t]:t}function XV(e,t){return $V(e,t.toLowerCase())}const Yge=v0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Zy,acceptCharset:kn,accessKey:kn,action:null,allow:null,allowFullScreen:kt,allowPaymentRequest:kt,allowUserMedia:kt,alt:null,as:null,async:kt,autoCapitalize:null,autoComplete:kn,autoFocus:kt,autoPlay:kt,blocking:kn,capture:null,charSet:null,checked:kt,cite:null,className:kn,cols:Ve,colSpan:null,content:null,contentEditable:Ar,controls:kt,controlsList:kn,coords:Ve|Zy,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kt,defer:kt,dir:null,dirName:null,disabled:kt,download:$R,draggable:Ar,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kt,formTarget:null,headers:kn,height:Ve,hidden:$R,high:Ve,href:null,hrefLang:null,htmlFor:kn,httpEquiv:kn,id:null,imageSizes:null,imageSrcSet:null,inert:kt,inputMode:null,integrity:null,is:null,isMap:kt,itemId:null,itemProp:kn,itemRef:kn,itemScope:kt,itemType:kn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kt,low:Ve,manifest:null,max:null,maxLength:Ve,media:null,method:null,min:null,minLength:Ve,multiple:kt,muted:kt,name:null,nonce:null,noModule:kt,noValidate:kt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kt,optimum:Ve,pattern:null,ping:kn,placeholder:null,playsInline:kt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kt,referrerPolicy:null,rel:kn,required:kt,reversed:kt,rows:Ve,rowSpan:Ve,sandbox:kn,scope:null,scoped:kt,seamless:kt,selected:kt,shadowRootClonable:kt,shadowRootDelegatesFocus:kt,shadowRootMode:null,shape:null,size:Ve,sizes:null,slot:null,span:Ve,spellCheck:Ar,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ve,step:null,style:null,tabIndex:Ve,target:null,title:null,translate:null,type:null,typeMustMatch:kt,useMap:null,value:Ar,width:Ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kn,axis:null,background:null,bgColor:null,border:Ve,borderColor:null,bottomMargin:Ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kt,declare:kt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ve,leftMargin:Ve,link:null,longDesc:null,lowSrc:null,marginHeight:Ve,marginWidth:Ve,noResize:kt,noHref:kt,noShade:kt,noWrap:kt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ve,rules:null,scheme:null,scrolling:Ar,standby:null,summary:null,text:null,topMargin:Ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ve,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kt,disableRemotePlayback:kt,prefix:null,property:null,results:Ve,security:null,unselectable:null},space:"html",transform:XV}),Zge=v0({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qa,accentHeight:Ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ve,amplitude:Ve,arabicForm:null,ascent:Ve,attributeName:null,attributeType:null,azimuth:Ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ve,by:null,calcMode:null,capHeight:Ve,className:kn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ve,diffuseConstant:Ve,direction:null,display:null,dur:null,divisor:Ve,dominantBaseline:null,download:kt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ve,enableBackground:null,end:null,event:null,exponent:Ve,externalResourcesRequired:null,fill:null,fillOpacity:Ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Zy,g2:Zy,glyphName:Zy,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ve,horizOriginX:Ve,horizOriginY:Ve,id:null,ideographic:Ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ve,k:Ve,k1:Ve,k2:Ve,k3:Ve,k4:Ve,kernelMatrix:Qa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ve,overlineThickness:Ve,paintOrder:null,panose1:null,path:null,pathLength:Ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:kn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ve,pointsAtY:Ve,pointsAtZ:Ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qa,rev:Qa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qa,requiredFeatures:Qa,requiredFonts:Qa,requiredFormats:Qa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ve,specularExponent:Ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ve,strikethroughThickness:Ve,string:null,stroke:null,strokeDashArray:Qa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ve,strokeOpacity:Ve,strokeWidth:null,style:null,surfaceScale:Ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qa,tabIndex:Ve,tableValues:null,target:null,targetX:Ve,targetY:Ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ve,underlineThickness:Ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ve,values:null,vAlphabetic:Ve,vMathematical:Ve,vectorEffect:null,vHanging:Ve,vIdeographic:Ve,version:null,vertAdvY:Ve,vertOriginX:Ve,vertOriginY:Ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$V}),YV=v0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ZV=v0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XV}),WV=v0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Wge={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},qge=/[A-Z]/g,X5=/-[a-z]/g,Jge=/^data[-\w.:]+$/i;function Qge(e,t){const n=UR(t);let r=t,a=Ma;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Jge.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(X5,eye);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!X5.test(l)){let u=l.replace(qge,Kge);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=sM}return new a(r,t)}function Kge(e){return"-"+e.toLowerCase()}function eye(e){return e.charAt(1).toUpperCase()}const tye=GV([UV,Yge,YV,ZV,WV],"html"),uM=GV([UV,Zge,YV,ZV,WV],"svg");function nye(e){return e.join(" ").trim()}var My={},gT,Y5;function rye(){if(Y5)return gT;Y5=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,h=`
|
|
1085
|
+
`).map(w=>w.length),0);return T.jsx("textarea",{className:"nodedatainput styledinput stringinput",value:y,onChange:w=>h(w.target.value),onBlur:w=>{m(w)},disabled:a.connected,rows:v+1,cols:S+1})},Khe={float:Xhe,int:Yhe,bool:whe,string:L5,str:L5,color:Ehe,select:lx,enum:lx,bytes:PO(jO,"")},epe={},tpe={},nu={Inputrenderer:Khe,Outputrenderer:She,HandlePreviewRenderer:bhe,DataOverlayRenderer:vhe,DataPreviewViewRenderer:dH,DataViewRenderer:BO,InLineRenderer:yhe,NodeRenderer:epe,NodeHooks:tpe},npe=(e,t)=>{const n=t.options||{},r=n.overwrite===void 0?!0:n.overwrite;switch(t.type){case"EXTEND_INPUT_RENDER":return!r&&e.Inputrenderer[t.payload.type]?e:{...e,Inputrenderer:{...e.Inputrenderer,[t.payload.type]:t.payload.component}};case"EXTEND_FROM_PLUGIN":{let u=!1;const d=[[t.payload.plugin.input_renderers||{},e.Inputrenderer],[t.payload.plugin.output_renderers||{},e.Outputrenderer],[t.payload.plugin.handle_preview_renderers||{},e.HandlePreviewRenderer],[t.payload.plugin.data_overlay_renderers||{},e.DataOverlayRenderer],[t.payload.plugin.data_preview_renderers||{},e.DataPreviewViewRenderer],[t.payload.plugin.data_view_renderers||{},e.DataViewRenderer],[t.payload.plugin.node_renderers||{},e.NodeRenderer],[t.payload.plugin.node_hooks||{},e.NodeHooks]];for(const[m,y]of d){if(Object.keys(m).length>0){if(r)u=!0;else for(const v in m)if(!y[v]){u=!0;break}}if(u)break}if(!u)return e;const h={...e};return d.forEach(([m,y])=>{Object.assign(y,m)}),h}default:const l={EXTEND_OUTPUT_RENDER:"Outputrenderer",EXTEND_HANDLE_PREVIEW_RENDER:"HandlePreviewRenderer",EXTEND_DATA_OVERLAY_RENDER:"DataOverlayRenderer",EXTEND_DATA_PREVIEW_RENDER:"DataPreviewViewRenderer",EXTEND_DATA_VIEW_RENDER:"DataViewRenderer",EXTEND_NODE_CONTEXT_EXTENDER:"NodeContextExtenders",EXTEND_NODE_RENDERER:"NodeRenderer",EXTEND_NODE_HOOKS:"NodeHooks"}[t.type];if(l){const u=e[l];return!r&&u[t.payload.type]?e:{...e,[l]:{...u,[t.payload.type]:t.payload.component}}}return e}},rpe=({children:e,plugins:t,fnrf_zst:n})=>{const[r,a]=Q.useReducer(npe,nu),l=(A,E,R)=>{a({type:"EXTEND_INPUT_RENDER",payload:{type:A,component:E},options:R})},u=(A,E,R)=>{a({type:"EXTEND_OUTPUT_RENDER",payload:{type:A,component:E},options:R})},d=(A,E,R)=>{a({type:"EXTEND_HANDLE_PREVIEW_RENDER",payload:{type:A,component:E},options:R})},h=(A,E,R)=>{a({type:"EXTEND_DATA_OVERLAY_RENDER",payload:{type:A,component:E},options:R})},m=(A,E,R)=>{a({type:"EXTEND_DATA_PREVIEW_RENDER",payload:{type:A,component:E},options:R})},y=(A,E,R)=>{a({type:"EXTEND_DATA_VIEW_RENDER",payload:{type:A,component:E},options:R})},v=(A,E,R)=>{a({type:"EXTEND_NODE_RENDERER",payload:{type:A,component:E},options:R})},S=(A,E,R)=>{a({type:"EXTEND_NODE_HOOKS",payload:{type:A,component:E},options:R})},w=(A,E)=>{a({type:"EXTEND_FROM_PLUGIN",payload:{plugin:A},options:E})};return Q.useEffect(()=>{for(const A in t){const E=t[A];if(!E)continue;const R=E.renderpluginfactory;R&&w(R({React:z,fnrf_zst:n,NodeContext:LC}))}},[t]),T.jsx(tf.Provider,{value:{Inputrenderer:r.Inputrenderer,Outputrenderer:r.Outputrenderer,HandlePreviewRenderer:r.HandlePreviewRenderer,DataOverlayRenderer:r.DataOverlayRenderer,DataPreviewViewRenderer:r.DataPreviewViewRenderer,DataViewRenderer:r.DataViewRenderer,InLineRenderer:r.InLineRenderer,NodeRenderer:r.NodeRenderer,NodeHooks:r.NodeHooks,extendNodeRenderer:v,extendInputRenderMapping:l,extendOutputRenderMapping:u,extendHandlePreviewRenderMapping:d,extendDataOverlayRenderMapping:h,extendDataPreviewRenderMapping:m,extendDataViewRenderMapping:y,extendNodeHooks:S,extendFromPlugin:w},children:e})},tf=Q.createContext({Inputrenderer:nu.Inputrenderer,Outputrenderer:nu.Outputrenderer,HandlePreviewRenderer:nu.HandlePreviewRenderer,DataOverlayRenderer:nu.DataOverlayRenderer,DataPreviewViewRenderer:nu.DataPreviewViewRenderer,DataViewRenderer:nu.DataViewRenderer,InLineRenderer:nu.InLineRenderer,NodeRenderer:nu.NodeRenderer,NodeHooks:nu.NodeHooks,extendInputRenderMapping:(e,t,n)=>{},extendOutputRenderMapping:(e,t,n)=>{},extendHandlePreviewRenderMapping:(e,t,n)=>{},extendDataOverlayRenderMapping:(e,t,n)=>{},extendDataPreviewRenderMapping:(e,t,n)=>{},extendDataViewRenderMapping:(e,t,n)=>{},extendNodeRenderer:(e,t,n)=>{},extendNodeHooks:(e,t,n)=>{},extendFromPlugin:(e,t)=>{}}),kH=e=>{const t=Qt(),{DataOverlayRenderer:n,DataViewRenderer:r}=Q.useContext(tf);if(e===void 0)return;const a=t.render_options(),[l]=Wp(e,a.typemap||{});return l?n[l]?n[l]:r[l]?zx(r[l]):B5:B5},ope=e=>{const t=Qt(),n=kH(e),{DataPreviewViewRenderer:r,DataViewRenderer:a}=Q.useContext(tf),l=t.render_options();if(e===void 0)return[void 0,n];const[u]=Wp(e,l.typemap||{});return u?r[u]?[r[u],n]:a[u]?[Ko(a[u]),n]:[Ko(SE),n]:[Ko(SE),n]},ape=e=>{const n=Qt().render_options(),{HandlePreviewRenderer:r,DataPreviewViewRenderer:a}=Q.useContext(tf),l=kH(e);let u;if(e){const[d]=Wp(e,n.typemap||{});d?r[d]?u=r[d]:a[d]?u=a[d]:u=Ko(SE):u=Ko(SE)}return[u,l]},ipe=e=>{const[t,n]=Q.useState(!1),r=e.use(a=>a.in_trigger);return Q.useEffect(()=>{let a;return r&&!t?n(!0):t&&(a=setTimeout(()=>n(!1),200)),()=>clearTimeout(a)},[r,t]),{visualTrigger:t,nodestore:e}},LC=z.createContext({}),Oa=()=>Q.useContext(LC),Ld=z.createContext(void 0);function Gn(e){if(e)return Oa().io_stores.get(e);{const t=Q.useContext(Ld);if(!t)throw new Error("IOContext not set");return t}}function Zp(e){const{node:t}=jo();if(e||(e=Gn().use()),typeof e=="string"&&(e=Gn(e)?.use(),!e))throw new Error(`No IO found for ${e}`);if(!e)throw new Error("No IO found");return z.useCallback((r,a)=>{t?.set_io_value({nid:e.node,ioid:e.id,value:r,set_default:a??e.render_options.set_default})},[e,t])}function OH(e){const{node:t}=jo();let n,r;if(!e){const u=Gn().useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}if(typeof e=="string"){const l=Gn(e);if(!l)throw new Error(`No IO found for ${e}`);const u=l.useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}else{if(!e)throw new Error("No IO found");n=e.id,r=e.node}return z.useCallback(l=>{t?.set_io_value_options({nid:r,ioid:n,values:l.values??l.keys,keys:l.keys,nullable:l.nullable??!1})},[t,n,r])}function MH(e){return Gn(e)?.valuestore()}function jx(e){const t=Gn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=jo();return z.useCallback(()=>a?.get_io_full_value({nid:n,ioid:r}),[a,n,r])}function VO(e){const t=Gn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=jo();return z.useCallback(u=>{a?.update_io_options({nid:n,ioid:r,options:{hidden:u}})},[a,n,r])}const NH=({iostore:e,Component:t})=>{const[n,r]=z.useState(void 0),[a,l]=z.useState(void 0),{full:u}=e.valuestore(),d=jx();z.useEffect(()=>{u===void 0?d?.():l(u.value)},[u,d]);const h=()=>{a!==void 0&&r(a)};return T.jsx(t,{value:a,preValue:n,onLoaded:h})},DH=({Component:e})=>T.jsx(e,{}),Wp=(e,t)=>IH(e.render_options?.type??"any",t),IH=(e,t)=>{if(typeof e=="string")return e in t?[t[e],e]:[e,e];if("allOf"in e&&e.allOf!==void 0)return[void 0,void 0];if("anyOf"in e&&e.anyOf!==void 0){const n=e.anyOf.map(r=>IH(r||"any",t));for(const r of n)switch(r[0]){case"bool":return["bool",r[1]];case"enum":return["enum",r[1]];case"float":return["float",r[1]];case"int":return["int",r[1]];case"string":return["string",r[1]];case"str":return["string",r[1]]}return[void 0,void 0]}return!("type"in e)||e.type===void 0?[void 0,void 0]:e.type==="enum"?["enum","enum"]:[void 0,void 0]},HR=({typestring:e,preview:t,...n})=>{const[r,a]=Q.useState(!1),[l,u]=Q.useState(!1),d=Qt(),h=Gn(),m=h.use(),y=jx(),[v,S]=ape(m),w=d.local_state(()=>d.reactflowRef);return T.jsxs(W6,{open:r||l,onOpenChange:u,children:[T.jsx(q6,{asChild:!0,children:T.jsx(ix,{id:m.id,"data-type":e,...n})}),T.jsx(J6,{container:w,children:T.jsxs(Q6,{className:"iotooltipcontent",sideOffset:5,avoidCollisions:!0,collisionBoundary:w,collisionPadding:10,onOpenAutoFocus:A=>A.preventDefault(),onCloseAutoFocus:A=>A.preventDefault(),children:[T.jsxs("div",{className:"iotooltip_container",children:[T.jsxs("div",{className:"iotooltip_header",children:[r?T.jsx(xQ,{onClick:()=>a(!1)}):T.jsx(bQ,{onClick:()=>a(!0)}),S&&T.jsx(Jc,{title:m.full_id,trigger:T.jsx(l6,{}),onOpenChange:A=>{A&&y?.(),a(A)},children:T.jsx(NH,{Component:S,iostore:h})})]}),v?T.jsx(DH,{Component:v}):`no preview available for "${e}"`]}),T.jsx(tee,{className:"iotooltipcontentarrow"})]})})]})},s0={"":[e=>e,e=>e],str_to_json:[e=>JSON.parse(e),e=>typeof e=="string"?e:JSON.stringify(e)],str_to_list:[e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{try{return JSON.parse("["+e+"]")}catch{}}throw new Error("Invalid list")},e=>JSON.stringify(e)]},lpe=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Qt().render_options(),l=Gn().use(),[u,d]=Wp(l,r.typemap||{}),{Inputrenderer:h}=Q.useContext(tf),m=u?l.value_options?.options?lx:h[u]:void 0,y=s0[(d&&r.inputconverter?.[d])??""]||s0[""],{keys:v}=Fk(),S=w=>{v.has("s")&&(e&&e("inputs/"+l.id),t&&t(!0),w.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeinput","data-type":u,onClick:S,children:[T.jsx(HR,{typestring:u,position:at.Left,type:"target"}),T.jsxs("div",{className:"inner_nodeio",children:[m&&T.jsx("div",{className:"iovaluefield nodrag","data-type":u,children:T.jsx(m,{inputconverter:y})}),T.jsx("div",{className:"ioname",children:l.name})]}),T.jsx(HR,{typestring:u,position:at.Right,type:"source"})]})},spe=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Qt().render_options(),l=Gn().use(),[u]=Wp(l,r.typemap||{}),{Outputrenderer:d}=Q.useContext(tf),{keys:h}=Fk(),m=u?d[u]:void 0,y=v=>{h.has("s")&&(e&&e("outputs/"+l.id),t&&t(!0),v.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeoutput","data-type":u,onClick:y,children:[T.jsx(HR,{typestring:u,position:at.Right,type:"source"}),T.jsxs("div",{className:"inner_nodeio",children:[T.jsx("div",{className:"ioname",children:l.name}),m?T.jsx("div",{className:"iovaluefield nodrag",children:T.jsx(m,{})}):T.jsx("div",{className:"iovaluefield",children:T.jsx(xhe,{})})]})]})},upe=()=>{const t=Qt().render_options(),r=Gn().use(),a=VO(),[l,u]=Wp(r,t.typemap||{}),{Inputrenderer:d}=z.useContext(tf),h=l?r.value_options?.options?lx:d[l]:void 0,m=s0[(u&&t.inputconverter?.[u])??""]||s0[""];return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:r.name}),h&&T.jsx(h,{inputconverter:m}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:r.connected,onChange:y=>{a?.(y.target.checked)},checked:r.hidden})]})})]})},cpe=()=>{const t=Gn().use(),n=VO();return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:t.name}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:t.connected,onChange:r=>{n?.(r.target.checked)},checked:t.hidden})]})})]})},zH=({})=>{const e=Qt(),{node:t}=jo(),r=Gn().use(),a=e.render_options(),l=VO(),[u,d]=z.useState(r.name);z.useEffect(()=>d(r.name),[r.name]);const h=z.useCallback(E=>d(E.target.value),[]),m=z.useCallback(()=>{u!==r.name&&t?.update_io_options({nid:r.node,ioid:r.id,options:{name:u}})},[r,t,u]),[y,v]=Wp(r,a.typemap||{}),S=s0[(v&&a.inputconverter?.[v])??""]||s0[""],{Inputrenderer:w}=z.useContext(tf),A=y?r.value_options?.options?lx:w[y]:void 0;return T.jsxs("div",{className:"nodesettings-io-entry funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-name-${r.id}`,children:"Name:"}),T.jsx("input",{id:`io-name-${r.id}`,type:"text",value:u,onChange:h,onBlur:m,className:"styledinput"})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"ID:"}),T.jsx("span",{children:r.id})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value:"}),A&&T.jsx(A,{inputconverter:S})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Type:"}),T.jsx("pre",{children:JSON.stringify(r.type,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-hidden-${r.id}`,children:"Hidden:"}),T.jsx("input",{id:`io-hidden-${r.id}`,type:"checkbox",checked:r.hidden,onChange:E=>l?.(E.target.checked),className:"styledcheckbox",disabled:r.connected&&r.is_input})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value Options:"}),T.jsx("pre",{children:JSON.stringify(r.value_options,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Render Options:"}),T.jsx("pre",{className:"code-display",children:JSON.stringify(r.render_options,null,2)})]}),r.is_input&&T.jsxs(T.Fragment,{children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Does Trigger:"}),T.jsx("span",{children:String(r.does_trigger)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Required:"}),T.jsx("span",{children:String(r.required)})]})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Emit Value Set:"}),T.jsx("span",{children:String(r.emit_value_set)})]}),T.jsx("hr",{})]})},VR={xxs:0,xs:320,s:480,m:768,l:960,xl:1280,xxl:1920},fpe=Object.entries(VR).sort(([,e],[,t])=>t-e),jH=z.createContext(void 0),dpe=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},hpe=e=>{for(const[t,n]of fpe)if(e>=n)return t;return"xxs"},BH=z.memo(z.forwardRef((e,t)=>{const{className:n,children:r,...a}=e,[l,u]=z.useState({wKey:"m",w:0,h:0}),d=z.useRef(null);z.useImperativeHandle(t,()=>d.current,[]);const h=z.useCallback(y=>{const v=y.width,S=y.height,w=hpe(v);u(A=>A.wKey===w&&A.w===v&&A.h===S?A:{wKey:w,w:v,h:S})},[]),m=z.useMemo(()=>dpe(h,16),[h]);return z.useEffect(()=>{const y=d.current;if(!y)return;const v=new ResizeObserver(S=>{const w=S[0];w&&m(w.contentRect)});return h(y.getBoundingClientRect()),v.observe(y),()=>{v.disconnect()}},[h,m]),T.jsx(jH.Provider,{value:l,children:T.jsx("div",{ref:d,className:`size-context w-${l.wKey} ${n||""}`.trim(),...a,children:r})})}));BH.displayName="SizeContextContainer";const ppe=()=>{const e=z.useContext(jH);if(!e)throw new Error("useSizeContext must be used within a SizeContextContainerContext");return e},mpe=(e,t)=>e===t?!1:e===""?!0:VR[e]<VR[t],gpe=e=>{const{wKey:t}=ppe();return mpe(t,e)},P5=(e,t,n="",r="")=>{const a=[];return typeof e=="string"?a.push(`${t}-${e}`):typeof e=="boolean"?a.push(e?n:r):e&&typeof e=="object"&&Object.entries(e).forEach(([l,u])=>{if(typeof u=="string")a.push(l===""?`${t}-${u}`:`${l}-${t}-${u}`);else if(typeof u=="boolean"){const d=u?n:r;d&&a.push(l===""?d:`${l}-${d}`)}}),a.filter(Boolean).join(" ")},Od=z.memo(({direction:e,className:t="",children:n,wrap:r=!1,grow:a=!1,...l})=>{const u="float-container",d=P5(e,"direction"),h=P5(a,"","grow","no-grow"),y=[u,d,h,typeof r=="boolean"&&r?"flex-wrap":"",t].filter(Boolean).join(" ");return T.jsx("div",{className:y,...l,children:n})});Od.displayName="FloatContainer";const ype={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"◀"}),right:e=>T.jsx(T.Fragment,{children:"▶"})},vpe={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"▶"}),right:e=>T.jsx(T.Fragment,{children:"◀"})},FO=z.memo(({direction:e,expanded:t=!0,children:n,className:r,maxSize:a="18.75rem",expanderSize:l="2rem",containerStyle:u,style:d,containerClassName:h,expandIcons:m,collapseIcons:y,onExpandChange:v,...S})=>{const[w,A]=z.useState(t);z.useEffect(()=>{A(t)},[t]);const E=z.useCallback(()=>{A(j=>{const X=!j;return v?.(X),X})},[v]),R=z.useCallback(j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),E())},[E]),k=e==="right"||e==="left",D=e==="left"||e==="up",M=w?y?.[e]||vpe[e]:m?.[e]||ype[e],I=`${e} ${w?"expanded":"collapsed"}`,L=z.useMemo(()=>({[k?"width":"height"]:w?a:l}),[k,w,a,l]),P=z.useMemo(()=>({[k?"width":"height"]:w?a:0}),[k,w,a]),G=z.useMemo(()=>({[k?"width":"height"]:l}),[k,l]),$=T.jsx("div",{className:`expanding_container_content ${I} ${r||""}`.trim(),style:{...d,...P},...S,children:n}),Z=T.jsx("div",{className:`expanding_container_expander ${I}`,onClick:E,onKeyDown:R,style:G,role:"button",tabIndex:0,"aria-label":`${w?"Collapse":"Expand"} ${e}`,children:T.jsx(M,{})});return T.jsxs("div",{className:`expanding_container ${I} ${h||""}`,style:{...u,...L},children:[D?Z:$,D?$:Z]})});FO.displayName="ExpandingContainer";const bpe=({nodestore:e})=>{const t=e.use();return T.jsx(LC.Provider,{value:e,children:T.jsxs("div",{className:"nodesettings_content",children:[T.jsx("div",{className:"nodesettings_section",children:T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:"Name"}),T.jsx("div",{children:T.jsx(XO,{})})]})}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Inputs"}),t.inputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ld.Provider,{value:r,children:T.jsx(upe,{})},n)})]}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Outputs"}),t.outputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ld.Provider,{value:r,children:T.jsx(cpe,{})},n)})]})]})})},xpe=()=>{const e=Qt(),t=e.local_state(r=>r.selected_nodes);if(t.length===0)return T.jsx("div",{children:"Node Settings"});if(t.length>1)return T.jsx("div",{children:"Multiple Nodes Selected"});const n=e.nodespace.get_node(t[0]);return n?T.jsx(bpe,{nodestore:n}):T.jsx("div",{children:"Node not found"})},Spe=()=>{const e=Qt(),t=e.local_settings(r=>r.view_settings.expand_node_props),n=r=>{e.update_view_settings({expand_node_props:r})};return T.jsx(FO,{direction:"left",expanded:t===void 0?!1:t,containerClassName:"pos-right pos-top bg1 h-12",className:"nodesettings_content",onExpandChange:n,collapseIcons:{up:q2,down:Y1,left:X1,right:W2},expandIcons:{up:Y1,down:q2,left:W2,right:X1},children:T.jsx(xpe,{})})};var pT="rovingFocusGroup.onEntryFocus",wpe={bubbles:!1,cancelable:!0},Bx="RovingFocusGroup",[FR,LH,Epe]=mC(Bx),[Cpe,PC]=bu(Bx,[Epe]),[_pe,Ape]=Cpe(Bx),PH=z.forwardRef((e,t)=>T.jsx(FR.Provider,{scope:e.__scopeRovingFocusGroup,children:T.jsx(FR.Slot,{scope:e.__scopeRovingFocusGroup,children:T.jsx(Tpe,{...e,ref:t})})}));PH.displayName=Bx;var Tpe=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=e,S=z.useRef(null),w=En(t,S),A=jC(l),[E,R]=Hd({prop:u,defaultProp:d??null,onChange:h,caller:Bx}),[k,D]=z.useState(!1),M=ka(m),I=LH(n),L=z.useRef(!1),[P,G]=z.useState(0);return z.useEffect(()=>{const $=S.current;if($)return $.addEventListener(pT,M),()=>$.removeEventListener(pT,M)},[M]),T.jsx(_pe,{scope:n,orientation:r,dir:A,loop:a,currentTabStopId:E,onItemFocus:z.useCallback($=>R($),[R]),onItemShiftTab:z.useCallback(()=>D(!0),[]),onFocusableItemAdd:z.useCallback(()=>G($=>$+1),[]),onFocusableItemRemove:z.useCallback(()=>G($=>$-1),[]),children:T.jsx(zt.div,{tabIndex:k||P===0?-1:0,"data-orientation":r,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:Ke(e.onMouseDown,()=>{L.current=!0}),onFocus:Ke(e.onFocus,$=>{const Z=!L.current;if($.target===$.currentTarget&&Z&&!k){const j=new CustomEvent(pT,wpe);if($.currentTarget.dispatchEvent(j),!j.defaultPrevented){const X=I().filter(V=>V.focusable),ee=X.find(V=>V.active),ae=X.find(V=>V.id===E),te=[ee,ae,...X].filter(Boolean).map(V=>V.ref.current);FH(te,y)}}L.current=!1}),onBlur:Ke(e.onBlur,()=>D(!1))})})}),HH="RovingFocusGroupItem",VH=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:l,children:u,...d}=e,h=hu(),m=l||h,y=Ape(HH,n),v=y.currentTabStopId===m,S=LH(n),{onFocusableItemAdd:w,onFocusableItemRemove:A,currentTabStopId:E}=y;return z.useEffect(()=>{if(r)return w(),()=>A()},[r,w,A]),T.jsx(FR.ItemSlot,{scope:n,id:m,focusable:r,active:a,children:T.jsx(zt.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:t,onMouseDown:Ke(e.onMouseDown,R=>{r?y.onItemFocus(m):R.preventDefault()}),onFocus:Ke(e.onFocus,()=>y.onItemFocus(m)),onKeyDown:Ke(e.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){y.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const k=Ope(R,y.orientation,y.dir);if(k!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let M=S().filter(I=>I.focusable).map(I=>I.ref.current);if(k==="last")M.reverse();else if(k==="prev"||k==="next"){k==="prev"&&M.reverse();const I=M.indexOf(R.currentTarget);M=y.loop?Mpe(M,I+1):M.slice(I+1)}setTimeout(()=>FH(M))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:E!=null}):u})})});VH.displayName=HH;var Rpe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function kpe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ope(e,t,n){const r=kpe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Rpe[r]}function FH(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Mpe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var GH=PH,UH=VH,HC="Tabs",[Npe,nwe]=bu(HC,[PC]),$H=PC(),[Dpe,GO]=Npe(HC),XH=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:h="automatic",...m}=e,y=jC(d),[v,S]=Hd({prop:r,onChange:a,defaultProp:l??"",caller:HC});return T.jsx(Dpe,{scope:n,baseId:hu(),value:v,onValueChange:S,orientation:u,dir:y,activationMode:h,children:T.jsx(zt.div,{dir:y,"data-orientation":u,...m,ref:t})})});XH.displayName=HC;var YH="TabsList",ZH=z.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,l=GO(YH,n),u=$H(n);return T.jsx(GH,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:r,children:T.jsx(zt.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});ZH.displayName=YH;var WH="TabsTrigger",qH=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...l}=e,u=GO(WH,n),d=$H(n),h=KH(u.baseId,r),m=eV(u.baseId,r),y=r===u.value;return T.jsx(UH,{asChild:!0,...d,focusable:!a,active:y,children:T.jsx(zt.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":m,"data-state":y?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:h,...l,ref:t,onMouseDown:Ke(e.onMouseDown,v=>{!a&&v.button===0&&v.ctrlKey===!1?u.onValueChange(r):v.preventDefault()}),onKeyDown:Ke(e.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&u.onValueChange(r)}),onFocus:Ke(e.onFocus,()=>{const v=u.activationMode!=="manual";!y&&!a&&v&&u.onValueChange(r)})})})});qH.displayName=WH;var JH="TabsContent",QH=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:l,...u}=e,d=GO(JH,n),h=KH(d.baseId,r),m=eV(d.baseId,r),y=r===d.value,v=z.useRef(y);return z.useEffect(()=>{const S=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(S)},[]),T.jsx(as,{present:a||y,children:({present:S})=>T.jsx(zt.div,{"data-state":y?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!S,id:m,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:v.current?"0s":void 0},children:S&&l})})});QH.displayName=JH;function KH(e,t){return`${e}-trigger-${t}`}function eV(e,t){return`${e}-content-${t}`}var UO=XH,$O=ZH,z1=qH,j1=QH;const Ipe=({})=>{const e=Qt(),t=Oa(),{description:n,id:r,node_id:a,node_name:l,reset_inputs_on_trigger:u}=t.useShallow(v=>({description:v.description,id:v.id,node_id:v.node_id,node_name:v.node_name,reset_inputs_on_trigger:v.reset_inputs_on_trigger})),[d,h]=z.useState(n||"");z.useEffect(()=>h(n||""),[n]);const m=v=>h(v.target.value),y=()=>{d!==(n||"")&&e.on_node_action({type:"update",from_remote:!1,id:r,node:{description:d}})};return T.jsxs("div",{className:"nodesettings-section funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-name-${r}`,children:"Name:"}),T.jsx(XO,{})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Instance ID:"}),T.jsx("span",{children:r})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type ID:"}),T.jsx("span",{children:a})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type Name:"}),T.jsx("span",{children:l})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-desc-${r}`,children:"Description:"}),T.jsx("textarea",{id:`node-desc-${r}`,value:d,onChange:m,onBlur:y,className:"styledinput",rows:3})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Reset Inputs on Trigger:"}),T.jsx("input",{type:"checkbox",checked:u,onChange:v=>{e.on_node_action({type:"update",from_remote:!1,id:r,node:{reset_inputs_on_trigger:v.target.checked}})},className:"styledcheckbox"})]})]})},zpe=({splitnodesettingsPath:e=[]})=>{const t=Oa(),n=t.use(r=>r.inputs);return T.jsxs(UO,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx($O,{className:"nodesettings-tabs-list","aria-label":"Manage node inputs",children:n.map(r=>T.jsx(z1,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(j1,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ld.Provider,{value:a,children:T.jsx(zH,{})})},r)})]})},jpe=({splitnodesettingsPath:e=[]})=>{const t=Oa(),n=t.use(r=>r.outputs);return T.jsxs(UO,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx($O,{className:"nodesettings-tabs-list","aria-label":"Manage node outputs",children:n.map(r=>T.jsx(z1,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(j1,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ld.Provider,{value:a,children:T.jsx(zH,{})})},r)})]})},Bpe=({nodeSettingsPath:e})=>{const t=e.split("/")||["general"];return T.jsxs(UO,{defaultValue:t[0]||"general",className:"nodesettings-tabs funcnodes-control-root",children:[T.jsxs($O,{className:"nodesettings-tabs-list","aria-label":"Manage node settings",children:[T.jsx(z1,{value:"general",className:"nodesettings-tabs-trigger",children:"General"}),T.jsx(z1,{value:"inputs",className:"nodesettings-tabs-trigger",children:"Inputs"}),T.jsx(z1,{value:"outputs",className:"nodesettings-tabs-trigger",children:"Outputs"})]}),T.jsx(j1,{value:"general",className:"nodesettings-tabs-content",children:T.jsx(Ipe,{})}),T.jsx(j1,{value:"inputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(zpe,{splitnodesettingsPath:t.slice(1)})}),T.jsx(j1,{value:"outputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(jpe,{splitnodesettingsPath:t.slice(1)})})]})},Lpe=z.memo(({isOpen:e,onOpenChange:t,nodeSettingsPath:n})=>{const a=Oa().use(l=>l.id);return T.jsx(Jc,{title:`Node Settings: ${a}`,open:e,onOpenChange:t,dialogClassName:"nodesettings-dialog",children:T.jsx(Bpe,{nodeSettingsPath:n})})}),Ppe=z.memo(({toogleShowSettings:e})=>{const t=Qt(),{node:n}=jo(),r=Oa(),{id:a,description:l,node_name:u}=r.useShallow(h=>({id:h.id,description:h.description,node_name:h.node_name})),d=z.useCallback(()=>{t.on_node_action({type:"trigger",from_remote:!1,id:a})},[t,a]);return T.jsxs("div",{className:"nodeheader",title:l||u,children:[T.jsxs("div",{className:"nodeheader_element",children:[T.jsx(wQ,{fontSize:"inherit",className:"triggerbutton nodeheaderbutton ",onClick:d}),T.jsx(SQ,{fontSize:"inherit",className:"nodestatusbutton nodeheaderbutton",onClick:async()=>{n&&console.log("nodestatus",await n.get_node_status(a))}}),T.jsx(CQ,{fontSize:"inherit",className:"nodesettingsbutton nodeheaderbutton",onClick:()=>{e?.()}})]}),T.jsx("div",{className:"nodeheader_element nodeheader_title",children:T.jsx("div",{className:"nodeheader_title_text",children:u})}),T.jsx("div",{className:"nodeheader_element",children:T.jsx(Sx,{fontSize:"inherit"})})]})}),Hpe=z.memo(({iostore:e})=>{const t=e.use(),r=Oa().use(d=>d.render_options),a=jx(t.id),[l,u]=ope(t);return T.jsx("div",{className:"nodrag nodedatabody","data-src":r?.data?.src||"",children:l&&t&&T.jsx(Ld.Provider,{value:e,children:T.jsx(Jc,{title:t.full_id,trigger:T.jsx("div",{className:"nodedatabutton",children:T.jsx(DH,{Component:l})}),onOpenChange:d=>{d&&a?.()},children:u&&T.jsx(NH,{Component:u,iostore:e})})})})}),Vpe=z.memo(({setShowSettings:e,setNodeSettingsPath:t})=>{const n=Oa(),{render_options:r,outputs:a,inputs:l}=n.useShallow(d=>({render_options:d.render_options,outputs:d.outputs,inputs:d.inputs})),u=r?.data?.src?n.io_stores.get(r?.data?.src):void 0;return T.jsxs("div",{className:"nodebody nowheel ",children:[a.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ld.Provider,{value:h,children:T.jsx(spe,{setNodeSettingsPath:t,setShowSettings:e})},d)}),u&&T.jsx(Hpe,{iostore:u}),l.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ld.Provider,{value:h,children:T.jsx(lpe,{setNodeSettingsPath:t,setShowSettings:e})},d)})]})}),XO=()=>{const e=Oa(),{original_name:t,id:n}=e.useShallow(h=>({original_name:h.name,id:h.id})),[r,a]=Q.useState(t);Q.useEffect(()=>{a(t)},[t]);const l=Qt(),u=h=>{a(h.target.value)},d=h=>{const m=h.target.value;m!==t&&l.on_node_action({type:"update",from_remote:!1,id:n,node:{name:m}})};return T.jsx("input",{className:"nodename_input",value:r,onChange:u,onBlur:d})},Fpe=()=>{const t=Oa().use(n=>n.progress);return t?T.jsx(yre,{state:t,className:"nodeprogress"}):null},Gpe=z.memo(()=>{const t=Oa().use(n=>n.error);return T.jsxs("div",{className:"nodefooter",children:[t&&T.jsx("div",{className:"nodeerror",children:t}),T.jsx(Fpe,{})]})}),Upe=()=>{const e=Oa(),{collapsed:t,error:n,node_id:r}=e.useShallow(A=>({collapsed:A.properties["frontend:collapsed"]||!1,error:A.error,node_id:A.node_id})),{visualTrigger:a}=ipe(e),[l,u]=Q.useState(!1),[d,h]=Q.useState(""),{keys:m}=Fk(),v=z.useContext(tf).NodeHooks[r]??[],S=z.useCallback(()=>{u(A=>!A)},[]),w=A=>{m.has("s")&&!l&&(h(""),u(!0),A.stopPropagation())};return T.jsxs("div",{className:"innernode"+(a?" intrigger":"")+(n?" error":""),onClick:w,children:[T.jsx(Ppe,{toogleShowSettings:S}),T.jsx(XO,{}),t?null:T.jsx(Vpe,{setNodeSettingsPath:h,setShowSettings:u}),T.jsx(Gpe,{}),T.jsx(Lpe,{isOpen:l,onOpenChange:u,nodeSettingsPath:d}),v.map((A,E)=>T.jsx(z.Fragment,{children:T.jsx(A,{})},E))]})},$pe=z.memo(({data:e})=>T.jsx(LC.Provider,{value:e.nodestore,children:T.jsx(Upe,{})}),(e,t)=>e.data.nodestore===t.data.nodestore),Xpe=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:a,sourcePosition:l,targetPosition:u,data:d,...h})=>{const[m]=RO({sourceX:t,sourceY:n,sourcePosition:l,targetX:r,targetY:a,targetPosition:u});return T.jsx(T.Fragment,{children:T.jsx(Ix,{id:e,path:m,...h})})},Ype={default:$pe,group:phe},Zpe={default:Xpe},Wpe=e=>({nodes:e.getNodes(),edges:e.getEdges(),onNodesChange:e.onNodesChange,onEdgesChange:e.onEdgesChange,onConnect:e.onConnect}),YO=e=>{const t=new Set,n=e.filter(a=>a.type==="group");n.forEach(a=>{t.add(a.id)});const r=e.filter(a=>!t.has(a.id));return{group_nodes:n,default_nodes:r}};function ZO(e){const t=new Map(e.map(u=>[u.id,u])),n=new Map,r=[];for(const u of e)if(n.has(u.id)||n.set(u.id,[]),u.parentId&&t.has(u.parentId)){const d=t.get(u.parentId);if(d){const h=n.get(d.id)||[];h.push(u),n.set(d.id,h)}else r.push(u)}else r.push(u);const a=[];function l(u){a.push(u);const d=n.get(u.id)||[];for(const h of d)l(h)}for(const u of r)l(u);if(a.length!==e.length){console.warn("Sorting mismatch: Not all nodes could be placed. Check for circular dependencies or missing parents.");const u=new Set(a.map(d=>d.id));e.forEach(d=>{u.has(d.id)||a.push(d)})}return a}const tV=()=>{const{getNodes:e}=Yp();return{getNodes:e,getSelectedNodes:a=>(a===void 0&&(a=e()),a.filter(l=>l.selected)),getSplitNodes:a=>{a===void 0&&(a=e());const{group_nodes:l,default_nodes:u}=YO(a);return{group_nodes:l,default_nodes:u}},getSortedNodes:a=>(a===void 0&&(a=e()),ZO(a))}},nV=(e,t)=>{const n=e.getState(),{new_obj:r,change:a}=jp(n,t);a&&e.setState(r)},rV=e=>fl(e);function H5(e){return e!=null&&typeof e=="object"&&"id"in e&&typeof e.id=="string"}const oV=e=>{let t=e.io??{},n=e.io_order,r=[];const a={};if(n===void 0)if(Array.isArray(t)){const l=t.filter(H5);r=l.map(u=>u.id);for(const u of l)a[u.id]=u}else{r=Object.keys(t);for(const l in t)t[l]!==void 0&&(a[l]=t[l])}else if(r=n,Array.isArray(t)){const l=t.filter(H5);for(const u of l)a[u.id]=u,r.includes(u.id)||r.push(u.id)}else for(const l in t)t[l]!==void 0&&(a[l]=t[l]),r.includes(l)||r.push(l);return{...e,io_order:r,io:a}},qpe={id:"dummy",node_id:"dummy",node_name:"dummy",properties:{"frontend:size":[200,100],"frontend:pos":[NaN,NaN],"frontend:collapsed":!1},io:{},io_order:[],name:"dummy",in_trigger:!1,reset_inputs_on_trigger:!1,progress:{ascii:!1,elapsed:0,initial:0,n:0,prefix:"idle",unit:"it",unit_divisor:1e3,unit_scale:!1}},Jpe={id:"dummy",name:"dummy",node:"dummy",full_id:"dummy",type:"any",value:void 0,is_input:!1,connected:!1,does_trigger:!0,fullvalue:void 0,render_options:{set_default:!0,type:"any"},hidden:!1,emit_value_set:!0,required:!1},Qpe=ak(qpe),Kpe=ak(Jpe),eme=e=>{const t=e.io_order;if(t===void 0)throw new Error("Node must have io_order");return{...e,inputs:Object.keys(e.io).filter(r=>e.io[r].is_input),outputs:Object.keys(e.io).filter(r=>!e.io[r].is_input),io_order:t}},tme=e=>(e.value==="<NoValue>"&&(e.value=void 0),e.fullvalue==="<NoValue>"&&(e.fullvalue=void 0),e.hidden===void 0&&(e.hidden=!1),[{...e},e.value,e.fullvalue]),nme=e=>{if(!e.id)throw new Error("Node must have an id");const t=Qpe(e);return eme(t)},rme=(e,t)=>{const n=e.getState(),r={},a=oV(t),l=Object.keys(a);for(const u of l)switch(u){case"id":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"node_id":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"node_name":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"name":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"in_trigger":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}case"error":{a[u]!==n[u]&&(r[u]=a[u]);break}case"render_options":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"io_order":{const[d,h]=((m,y)=>y===void 0?[m,!1]:[y,!ok(m,y)])(n[u],a[u]);h&&(r[u]=d.filter(m=>m!==void 0));break}case"io":{const d=a[u];if(d===void 0)break;for(const h in d){const m=e.io_stores.get(h);if(!m){console.error("io key not found in oldvalue:",h);continue}m.update(d[h])}break}case"progress":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"description":{r[u]=a[u];break}case"properties":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"status":{const[d,h]=zy(n[u],a[u]);h&&(r[u]=d);break}case"reset_inputs_on_trigger":{const[d,h]=sl(n[u],a[u]);h&&(r[u]=d);break}default:try{Lz(u,a[u])}catch(d){console.error(d)}}Object.keys(r).length>0&&e.setState(r)},ome=(e,t)=>{const n=e.getState(),r={},a={},l=Object.keys(t);for(const u of l)switch(u){case"name":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"id":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"connected":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"does_trigger":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"hidden":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"full_id":{const[d,h]=sl(n[u],t[u]);h&&(r[u]=d);break}case"is_input":break;case"node":break;case"type":break;case"value":{a.preview=t[u];break}case"fullvalue":{a.full=t[u];break}case"render_options":{const[d,h]=zy(n[u],t[u]);h&&(r[u]=d);break}case"value_options":{const[d,h]=zy(n[u],t[u]);h&&(r[u]=d);break}case"valuepreview_type":{r[u]=t[u];break}case"emit_value_set":{r[u]=t[u];break}case"default":{r[u]=t[u];break}case"required":{r[u]=t[u];break}default:try{Lz(u,t[u])}catch(d){console.error(d)}}Object.keys(a).length>0&&e.updateValueStore(a),Object.keys(r).length>0&&e.setState(r)},ame=e=>{if(!e.id)throw new Error("IO must have an id but is missing for "+JSON.stringify(e));e.name===void 0&&(e.name=e.id);const t=Kpe(e);return(t.render_options.type==="any"||t.render_options.type===void 0)&&(t.render_options.type=t.type),tme(t)},ime=(e,t)=>{let n;const[r,a,l]=ame(t);return n={io_state:rV((u,d)=>r),use:u=>u?n.io_state(u):n.io_state(),useShallow:u=>n.io_state(zO(u)),getState:()=>n.io_state.getState(),setState:u=>{n.io_state.setState(u)},update:u=>{ome(n,u)},valuestore:fl((u,d)=>{let h=a;h==="<NoValue>"&&(h=void 0),!(h instanceof Ql)&&h!==void 0&&(h=Bc.fromObject(h));let m=l;return m==="<NoValue>"&&(m=void 0),!(m instanceof Ql)&&m!==void 0&&(m=Bc.fromObject(m)),{preview:h,full:m}}),updateValueStore:u=>{n.valuestore.setState(d=>(d.preview&&typeof d.preview.dispose=="function"&&d.preview.dispose(),d.full&&typeof d.full.dispose=="function"&&d.full.dispose(),u.preview!==void 0&&u.full===void 0&&(u.full=void 0,d.full=void 0),u.preview!==void 0&&!(u.preview instanceof Ql)&&(u.preview=Bc.fromObject(u.preview)),u.full!==void 0&&!(u.full instanceof Ql)&&(u.full=Bc.fromObject(u.full)),{...d,...u}))},node:e,serialize:()=>{const u=n.io_state.getState(),d=n.valuestore.getState();return{...u,value:d.preview,fullvalue:d.full,render_options:u.render_options,valuepreview_type:u.valuepreview_type,emit_value_set:u.emit_value_set}}},n},lme=e=>{const t={use:l=>l?r.node_state(l):r.node_state(),useShallow:l=>r.node_state(zO(l)),io_stores:new Map,getState:()=>r.node_state.getState(),setState:l=>{r.node_state.setState(l)},update:l=>{rme(r,l)},serialize:()=>({...r.node_state.getState(),io:Object.fromEntries(Array.from(r.io_stores.entries()).map(([d,h])=>[d,h.serialize()]))})},n=oV(e),r={...t,node_state:rV((l,u)=>nme(n))},a=n.io;return Object.entries(a).forEach(([l,u])=>{u!==void 0&&r.io_stores.set(l,ime(n.id,u))}),r},sme=()=>{const e=Qt();return{onSelectionChange:Q.useCallback(({nodes:n,edges:r})=>{const{group_nodes:a,default_nodes:l}=YO(n),u=e.local_state.getState();e.local_state.setState({...u,selected_nodes:l.map(d=>d.id),selected_edges:r.map(d=>d.id),selected_groups:a.map(d=>d.id)})},[e])}},ume=()=>{const e=Yp(),t=Qt();return t.rf_instance=e,T.jsx(T.Fragment,{})},cme=()=>{const e=Qt(),{getEdges:t}=Yp(),{getSelectedNodes:n}=tV();return{copySelectedNodes:Q.useCallback(()=>{const a=t(),l=n();if(l.length===0)return;const u={nodes:[],edges:[]};for(const m of l){const y=e.nodespace.get_node(m.id,!1);y&&u.nodes.push(y.serialize())}const d=new Set(l.map(m=>m.id)),h=a.filter(m=>d.has(m.source)&&d.has(m.target));for(const m of h)!m.sourceHandle||!m.targetHandle||u.edges.push({src_nid:m.source,src_ioid:m.sourceHandle,trg_nid:m.target,trg_ioid:m.targetHandle});navigator.clipboard.writeText(JSON.stringify(u))},[n,t,e])}},fme=()=>{const e=Pc("Delete"),t=Pc(["Meta+c","Control+c","Strg+c"]),n=Pc(["Control+g","Meta+g"]),r=Pc(["Control+Alt+g","Meta+Alt+g"]),a=dhe(),{getEdges:l}=Yp(),{getNodes:u,getSelectedNodes:d,getSplitNodes:h}=tV(),{copySelectedNodes:m}=cme(),{node:y,group:v,edge:S}=jo();return Q.useEffect(()=>{if(e){const w=l().filter(k=>k.selected);for(const k of w)!k.source||!k.target||!k.sourceHandle||!k.targetHandle||S?.remove_edge({src_nid:k.source,src_ioid:k.sourceHandle,trg_nid:k.target,trg_ioid:k.targetHandle});const A=d(),{group_nodes:E,default_nodes:R}=h(A);for(const k of R)y?.remove_node(k.id);for(const k of E)v?.remove_group(k.id)}},[e,u,l,y,v,S]),Q.useEffect(()=>{t&&m()},[t,m]),Q.useEffect(()=>{if(n){const w=d(),{group_nodes:A,default_nodes:E}=h(w);w.length>0&&a(E.map(R=>R.id),A.map(R=>R.id))}},[n,u]),Q.useEffect(()=>{if(r){const w=d(),{group_nodes:A}=h(w);A.forEach(E=>{v?.remove_group(E.id)})}},[r,u]),T.jsx(T.Fragment,{})},dme=()=>{const{node:e,edge:t}=jo(),n=Qt();return z.useCallback(async(a,l)=>{try{if(!a||!e||!t)return;const u=JSON.parse(a);if(!u||!n.worker||!u.nodes)return;const d=[0,0];for(const m of u.nodes)d[0]+=m.properties["frontend:pos"][0],d[1]+=m.properties["frontend:pos"][1];d[0]/=u.nodes.length,d[1]/=u.nodes.length;const h=[];for(const m of u.nodes){const y={id:m.node_id,src_id:m.id,position:[m.properties["frontend:pos"][0]-d[0],m.properties["frontend:pos"][1]-d[1]]};h.push(y)}for(const m of h){const y=await e.add_node(m.id);!y||!n.nodespace.get_node(y.id,!1)||(m.new_id=y.id,l([{id:y.id,type:"position",position:{x:m.position[0]+y.properties["frontend:pos"][0],y:m.position[1]+y.properties["frontend:pos"][1]}}]))}for(const m of u.edges){const y=h.find(S=>S.src_id===m.src_nid),v=h.find(S=>S.src_id===m.trg_nid);!y||!v||!y.new_id||!v.new_id||t.add_edge({src_nid:y.new_id,src_ioid:m.src_ioid,trg_nid:v.new_id,trg_ioid:m.trg_ioid})}}catch(u){console.error("Failed to process pasted data:",u)}},[e,t,n])},hme=(e,t)=>{const n=e.properties||{};n["frontend:size"]||(n["frontend:size"]=[200,100]);const r=n["frontend:pos"];if(!r||r.length!==2||isNaN(r[0])||r[0]===null||isNaN(r[1])||r[1]===null)if(!t||!t.rf_instance||t.reactflowRef===null)n["frontend:pos"]=[0,0];else{const l=t.reactflowRef.getBoundingClientRect(),u=l.left+l.width/2,d=l.top+l.height/2,h=t.rf_instance.screenToFlowPosition({x:u,y:d});n["frontend:pos"]=[h.x-n["frontend:size"][0]/2,h.y-n["frontend:size"][0]/2]}n["frontend:collapsed"]||(n["frontend:collapsed"]=!1),e.properties=n},pme=(e,t)=>{const n=e.getState();if(hme(n,t),n.id===void 0)throw new Error("Node must have an id");const r={nodestore:e};return{position:{x:n.properties["frontend:pos"][0],y:n.properties["frontend:pos"][1]},data:r,type:"default",zIndex:1003,...n}},V5={default:ea.Dots,metal:ea.Cross,light:ea.Dots,solarized:ea.Dots,midnight:ea.Dots,forest:ea.Dots,scientific:ea.Lines},mme=e=>{const t=Qt(),n=Q.useRef(null),{colorTheme:r}=f6(),{onSelectionChange:a}=sme(),l=foe();z.useEffect(()=>{t.getStateManager().toaster=l},[]),Q.useEffect(()=>{t.reactflowRef=n.current},[n]);const{nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y}=t.useReactFlowStore(zO(Wpe)),v=dme(),S=Q.useCallback(w=>{const A=n.current;if(!A)return;let E=w.target,R=0;for(;E&&E.parentElement&&E!==A;)R++,E=E.parentElement;t.logger.debug(`onPasteCapture: ${R} steps to reactflow`),R<=2&&v(w.clipboardData.getData("text/plain"),h)},[v,h,t.logger]);return T.jsx("div",{className:"reactflowlayer",children:T.jsxs(jde,{onPasteCapture:S,nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y,nodeTypes:Ype,edgeTypes:Zpe,minZoom:e.minZoom,maxZoom:e.maxZoom,fitView:!0,onSelectionChange:a,ref:n,panOnDrag:!e.static,children:[T.jsx(ume,{}),T.jsx(fme,{}),T.jsx(Vde,{color:"#888",gap:24,size:2,variant:V5[r]||V5.default,patternClassName:"fn-background-pattern"}),e.minimap&&T.jsx(ihe,{nodeStrokeWidth:3,pannable:!e.static,zoomable:!e.static,zoomStep:3})]})})},gme=({on_node_change:e,on_edge_change:t,on_connect:n})=>{const r=e||(d=>{}),a=t||(d=>{}),l=n||(d=>{});return fl((d,h)=>({_nodes:[],_edges:[],_nodes_map:new Map,update_nodes:m=>{m=ZO(m),d({_nodes:m,_nodes_map:new Map(m.map(y=>[y.id,y]))})},partial_update_nodes:m=>{const y=h(),v=y._nodes,S=new Map(v.map(w=>[w.id,w]));for(const w of m)S.set(w.id,w);y.update_nodes(Array.from(S.values()))},update_edges:m=>{d({_edges:m})},onNodesChange:m=>{const y=h();y.update_nodes(DO(m,y._nodes)),r(m)},onEdgesChange:m=>{d({_edges:zP(m,h()._edges)}),a(m)},onConnect:m=>{m.source==null||m.target==null||l(m)},getNode:m=>h()._nodes_map.get(m),getNodes:()=>h()._nodes,getEdges:()=>h()._edges}))},yme=()=>{const t=Qt().progress_state();return T.jsxs("div",{className:"statusbar",children:[T.jsx("span",{className:"statusbar-progressbar",style:{width:Math.min(100,100*t.progress)+"%"}}),T.jsx("span",{className:"statusbar-message",children:t.message})]})},wE=!1;var GR=["Enter"," "],vme=["ArrowDown","PageUp","Home"],aV=["ArrowUp","PageDown","End"],bme=[...vme,...aV],xme={ltr:[...GR,"ArrowRight"],rtl:[...GR,"ArrowLeft"]},Sme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Lx="Menu",[sx,wme,Eme]=mC(Lx),[qp,iV]=bu(Lx,[Eme,dC,PC]),Px=dC(),lV=PC(),[sV,Jp]=qp(Lx),[Cme,Hx]=qp(Lx),uV=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:l,modal:u=!0}=e,d=Px(t),[h,m]=z.useState(null),y=z.useRef(!1),v=ka(l),S=jC(a);return z.useEffect(()=>{const w=()=>{y.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>y.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),T.jsx(Qk,{...d,children:T.jsx(sV,{scope:t,open:n,onOpenChange:v,content:h,onContentChange:m,children:T.jsx(Cme,{scope:t,onClose:z.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:S,modal:u,children:r})})})};uV.displayName=Lx;var _me="MenuAnchor",WO=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Px(n);return T.jsx(Kk,{...a,...r,ref:t})});WO.displayName=_me;var Ame="MenuPortal",[rwe,cV]=qp(Ame,{forceMount:void 0}),dl="MenuContent",[Tme,qO]=qp(dl),fV=z.forwardRef((e,t)=>{const n=cV(dl,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=Jp(dl,e.__scopeMenu),u=Hx(dl,e.__scopeMenu);return T.jsx(sx.Provider,{scope:e.__scopeMenu,children:T.jsx(as,{present:r||l.open,children:T.jsx(sx.Slot,{scope:e.__scopeMenu,children:u.modal?T.jsx(Rme,{...a,ref:t}):T.jsx(kme,{...a,ref:t})})})})}),Rme=z.forwardRef((e,t)=>{const n=Jp(dl,e.__scopeMenu),r=z.useRef(null),a=En(t,r);return z.useEffect(()=>{const l=r.current;if(l)return _k(l)},[]),T.jsx(JO,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ke(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),kme=z.forwardRef((e,t)=>{const n=Jp(dl,e.__scopeMenu);return T.jsx(JO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ome=Jy("MenuContent.ScrollLock"),JO=z.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,disableOutsideScroll:A,...E}=e,R=Jp(dl,n),k=Hx(dl,n),D=Px(n),M=lV(n),I=wme(n),[L,P]=z.useState(null),G=z.useRef(null),$=En(t,G,R.onContentChange),Z=z.useRef(0),j=z.useRef(""),X=z.useRef(0),ee=z.useRef(null),ae=z.useRef("right"),U=z.useRef(0),te=A?tC:z.Fragment,V=A?{as:Ome,allowPinchZoom:!0}:void 0,W=ne=>{const B=j.current+ne,oe=I().filter(Ee=>!Ee.disabled),se=document.activeElement,Y=oe.find(Ee=>Ee.ref.current===se)?.textValue,he=oe.map(Ee=>Ee.textValue),Te=Fme(he,B,Y),me=oe.find(Ee=>Ee.textValue===Te)?.ref.current;(function Ee(xe){j.current=xe,window.clearTimeout(Z.current),xe!==""&&(Z.current=window.setTimeout(()=>Ee(""),1e3))})(B),me&&setTimeout(()=>me.focus())};z.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Ck();const J=z.useCallback(ne=>ae.current===ee.current?.side&&Ume(ne,ee.current?.area),[]);return T.jsx(Tme,{scope:n,searchRef:j,onItemEnter:z.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),onItemLeave:z.useCallback(ne=>{J(ne)||(G.current?.focus(),P(null))},[J]),onTriggerLeave:z.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),pointerGraceTimerRef:X,onPointerGraceIntentChange:z.useCallback(ne=>{ee.current=ne},[]),children:T.jsx(te,{...V,children:T.jsx(QE,{asChild:!0,trapped:a,onMountAutoFocus:Ke(l,ne=>{ne.preventDefault(),G.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:T.jsx(yx,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,children:T.jsx(GH,{asChild:!0,...M,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:P,onEntryFocus:Ke(h,ne=>{k.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:T.jsx(j6,{role:"menu","aria-orientation":"vertical","data-state":RV(R.open),"data-radix-menu-content":"",dir:k.dir,...D,...E,ref:$,style:{outline:"none",...E.style},onKeyDown:Ke(E.onKeyDown,ne=>{const oe=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,se=ne.ctrlKey||ne.altKey||ne.metaKey,Y=ne.key.length===1;oe&&(ne.key==="Tab"&&ne.preventDefault(),!se&&Y&&W(ne.key));const he=G.current;if(ne.target!==he||!bme.includes(ne.key))return;ne.preventDefault();const me=I().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);aV.includes(ne.key)&&me.reverse(),Hme(me)}),onBlur:Ke(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(Z.current),j.current="")}),onPointerMove:Ke(e.onPointerMove,ux(ne=>{const B=ne.target,oe=U.current!==ne.clientX;if(ne.currentTarget.contains(B)&&oe){const se=ne.clientX>U.current?"right":"left";ae.current=se,U.current=ne.clientX}}))})})})})})})});fV.displayName=dl;var Mme="MenuGroup",QO=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(zt.div,{role:"group",...r,ref:t})});QO.displayName=Mme;var Nme="MenuLabel",dV=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(zt.div,{...r,ref:t})});dV.displayName=Nme;var EE="MenuItem",F5="menu.itemSelect",VC=z.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,l=z.useRef(null),u=Hx(EE,e.__scopeMenu),d=qO(EE,e.__scopeMenu),h=En(t,l),m=z.useRef(!1),y=()=>{const v=l.current;if(!n&&v){const S=new CustomEvent(F5,{bubbles:!0,cancelable:!0});v.addEventListener(F5,w=>r?.(w),{once:!0}),Ek(v,S),S.defaultPrevented?m.current=!1:u.onClose()}};return T.jsx(hV,{...a,ref:h,disabled:n,onClick:Ke(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),m.current=!0},onPointerUp:Ke(e.onPointerUp,v=>{m.current||v.currentTarget?.click()}),onKeyDown:Ke(e.onKeyDown,v=>{const S=d.searchRef.current!=="";n||S&&v.key===" "||GR.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});VC.displayName=EE;var hV=z.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...l}=e,u=qO(EE,n),d=lV(n),h=z.useRef(null),m=En(t,h),[y,v]=z.useState(!1),[S,w]=z.useState("");return z.useEffect(()=>{const A=h.current;A&&w((A.textContent??"").trim())},[l.children]),T.jsx(sx.ItemSlot,{scope:n,disabled:r,textValue:a??S,children:T.jsx(UH,{asChild:!0,...d,focusable:!r,children:T.jsx(zt.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:m,onPointerMove:Ke(e.onPointerMove,ux(A=>{r?u.onItemLeave(A):(u.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ke(e.onPointerLeave,ux(A=>u.onItemLeave(A))),onFocus:Ke(e.onFocus,()=>v(!0)),onBlur:Ke(e.onBlur,()=>v(!1))})})})}),Dme="MenuCheckboxItem",pV=z.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return T.jsx(bV,{scope:e.__scopeMenu,checked:n,children:T.jsx(VC,{role:"menuitemcheckbox","aria-checked":CE(n)?"mixed":n,...a,ref:t,"data-state":tM(n),onSelect:Ke(a.onSelect,()=>r?.(CE(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pV.displayName=Dme;var mV="MenuRadioGroup",[Ime,zme]=qp(mV,{value:void 0,onValueChange:()=>{}}),gV=z.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,l=ka(r);return T.jsx(Ime,{scope:e.__scopeMenu,value:n,onValueChange:l,children:T.jsx(QO,{...a,ref:t})})});gV.displayName=mV;var yV="MenuRadioItem",vV=z.forwardRef((e,t)=>{const{value:n,...r}=e,a=zme(yV,e.__scopeMenu),l=n===a.value;return T.jsx(bV,{scope:e.__scopeMenu,checked:l,children:T.jsx(VC,{role:"menuitemradio","aria-checked":l,...r,ref:t,"data-state":tM(l),onSelect:Ke(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});vV.displayName=yV;var KO="MenuItemIndicator",[bV,jme]=qp(KO,{checked:!1}),xV=z.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,l=jme(KO,n);return T.jsx(as,{present:r||CE(l.checked)||l.checked===!0,children:T.jsx(zt.span,{...a,ref:t,"data-state":tM(l.checked)})})});xV.displayName=KO;var Bme="MenuSeparator",SV=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});SV.displayName=Bme;var Lme="MenuArrow",wV=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Px(n);return T.jsx(B6,{...a,...r,ref:t})});wV.displayName=Lme;var eM="MenuSub",[Pme,EV]=qp(eM),CV=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,l=Jp(eM,t),u=Px(t),[d,h]=z.useState(null),[m,y]=z.useState(null),v=ka(a);return z.useEffect(()=>(l.open===!1&&v(!1),()=>v(!1)),[l.open,v]),T.jsx(Qk,{...u,children:T.jsx(sV,{scope:t,open:r,onOpenChange:v,content:m,onContentChange:y,children:T.jsx(Pme,{scope:t,contentId:hu(),triggerId:hu(),trigger:d,onTriggerChange:h,children:n})})})};CV.displayName=eM;var k1="MenuSubTrigger",_V=z.forwardRef((e,t)=>{const n=Jp(k1,e.__scopeMenu),r=Hx(k1,e.__scopeMenu),a=EV(k1,e.__scopeMenu),l=qO(k1,e.__scopeMenu),u=z.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},y=z.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return z.useEffect(()=>y,[y]),z.useEffect(()=>{const v=d.current;return()=>{window.clearTimeout(v),h(null)}},[d,h]),T.jsx(WO,{asChild:!0,...m,children:T.jsx(hV,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":RV(n.open),...e,ref:JE(t,a.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ke(e.onPointerMove,ux(v=>{l.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),y()},100))})),onPointerLeave:Ke(e.onPointerLeave,ux(v=>{y();const S=n.content?.getBoundingClientRect();if(S){const w=n.content?.dataset.side,A=w==="right",E=A?-5:5,R=S[A?"left":"right"],k=S[A?"right":"left"];l.onPointerGraceIntentChange({area:[{x:v.clientX+E,y:v.clientY},{x:R,y:S.top},{x:k,y:S.top},{x:k,y:S.bottom},{x:R,y:S.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(v),v.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Ke(e.onKeyDown,v=>{const S=l.searchRef.current!=="";e.disabled||S&&v.key===" "||xme[r.dir].includes(v.key)&&(n.onOpenChange(!0),n.content?.focus(),v.preventDefault())})})})});_V.displayName=k1;var AV="MenuSubContent",TV=z.forwardRef((e,t)=>{const n=cV(dl,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=Jp(dl,e.__scopeMenu),u=Hx(dl,e.__scopeMenu),d=EV(AV,e.__scopeMenu),h=z.useRef(null),m=En(t,h);return T.jsx(sx.Provider,{scope:e.__scopeMenu,children:T.jsx(as,{present:r||l.open,children:T.jsx(sx.Slot,{scope:e.__scopeMenu,children:T.jsx(JO,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&h.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:Ke(e.onFocusOutside,y=>{y.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Ke(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:Ke(e.onKeyDown,y=>{const v=y.currentTarget.contains(y.target),S=Sme[u.dir].includes(y.key);v&&S&&(l.onOpenChange(!1),d.trigger?.focus(),y.preventDefault())})})})})})});TV.displayName=AV;function RV(e){return e?"open":"closed"}function CE(e){return e==="indeterminate"}function tM(e){return CE(e)?"indeterminate":e?"checked":"unchecked"}function Hme(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Vme(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Fme(e,t,n){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=Vme(e,Math.max(l,0));a.length===1&&(u=u.filter(m=>m!==n));const h=u.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function Gme(e,t){const{x:n,y:r}=e;let a=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],m=d.x,y=d.y,v=h.x,S=h.y;y>r!=S>r&&n<(v-m)*(r-y)/(S-y)+m&&(a=!a)}return a}function Ume(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Gme(n,t)}function ux(e){return t=>t.pointerType==="mouse"?e(t):void 0}var $me=uV,Xme=WO,Yme=fV,Zme=QO,Wme=dV,qme=VC,Jme=pV,Qme=gV,Kme=vV,ege=xV,tge=SV,nge=wV,rge=CV,oge=_V,age=TV,FC="DropdownMenu",[ige,owe]=bu(FC,[iV]),na=iV(),[lge,kV]=ige(FC),OV=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=na(t),m=z.useRef(null),[y,v]=Hd({prop:a,defaultProp:l??!1,onChange:u,caller:FC});return T.jsx(lge,{scope:t,triggerId:hu(),triggerRef:m,contentId:hu(),open:y,onOpenChange:v,onOpenToggle:z.useCallback(()=>v(S=>!S),[v]),modal:d,children:T.jsx($me,{...h,open:y,onOpenChange:v,dir:r,modal:d,children:n})})};OV.displayName=FC;var MV="DropdownMenuTrigger",NV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,l=kV(MV,n),u=na(n);return T.jsx(Xme,{asChild:!0,...u,children:T.jsx(zt.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:JE(t,l.triggerRef),onPointerDown:Ke(e.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Ke(e.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});NV.displayName=MV;var DV="DropdownMenuContent",IV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=kV(DV,n),l=na(n),u=z.useRef(!1);return T.jsx(Yme,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...r,ref:t,onCloseAutoFocus:Ke(e.onCloseAutoFocus,d=>{u.current||a.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Ke(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,y=h.button===2||m;(!a.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});IV.displayName=DV;var sge="DropdownMenuGroup",zV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Zme,{...a,...r,ref:t})});zV.displayName=sge;var uge="DropdownMenuLabel",cge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Wme,{...a,...r,ref:t})});cge.displayName=uge;var fge="DropdownMenuItem",jV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(qme,{...a,...r,ref:t})});jV.displayName=fge;var dge="DropdownMenuCheckboxItem",hge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Jme,{...a,...r,ref:t})});hge.displayName=dge;var pge="DropdownMenuRadioGroup",BV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Qme,{...a,...r,ref:t})});BV.displayName=pge;var mge="DropdownMenuRadioItem",LV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(Kme,{...a,...r,ref:t})});LV.displayName=mge;var gge="DropdownMenuItemIndicator",yge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(ege,{...a,...r,ref:t})});yge.displayName=gge;var vge="DropdownMenuSeparator",bge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(tge,{...a,...r,ref:t})});bge.displayName=vge;var xge="DropdownMenuArrow",Sge=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(nge,{...a,...r,ref:t})});Sge.displayName=xge;var wge=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:a,defaultOpen:l}=e,u=na(t),[d,h]=Hd({prop:r,defaultProp:l??!1,onChange:a,caller:"DropdownMenuSub"});return T.jsx(rge,{...u,open:d,onOpenChange:h,children:n})},Ege="DropdownMenuSubTrigger",PV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(oge,{...a,...r,ref:t})});PV.displayName=Ege;var Cge="DropdownMenuSubContent",HV=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=na(n);return T.jsx(age,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});HV.displayName=Cge;var nM=OV,rM=NV,oM=IV,aM=zV,jc=jV,_ge=BV,Age=LV,Tge=wge,Rge=PV,kge=HV;const Oge=({trigger:e,setOpen:t,open:n})=>{const[r,a]=Q.useState(""),[l,u]=Q.useState(!0),d=Qt();return d.options.useWorkerManager?T.jsxs(Jc,{setOpen:t,open:n,trigger:e,title:"New Worker",description:"Create a new worker",children:[T.jsxs("div",{children:["Name:",T.jsx("br",{}),T.jsx("input",{className:"styledinput",onChange:h=>{a(h.currentTarget.value)},value:r}),T.jsxs("div",{style:{marginTop:8},children:[T.jsx("input",{type:"checkbox",id:"inVenvCheckbox",checked:l,onChange:h=>u(h.currentTarget.checked)}),T.jsx("label",{htmlFor:"inVenvCheckbox",style:{marginLeft:4},children:"Create in new virtual environment"})]})]}),T.jsx("div",{children:r&&T.jsx("div",{children:T.jsx("button",{className:"styledbtn",onClick:()=>{d.workermanager?.new_worker({name:r,in_venv:l}),t(!1)},children:"Create"})})})]}):null},Mge=({trigger:e,setOpen:t,open:n})=>{const r=Qt(),[a,l]=Q.useState(!1),u=r.workers(),d=r.worker?.uuid,h=(d?u[d]?.name:void 0)||d||"worker",m=async()=>{if(!r.worker)return;const y=await r.worker.export({withFiles:a});gF(y,h+".fnw","application/zip"),t(!1)};return T.jsx(Jc,{setOpen:t,open:n,trigger:e,title:"Export Worker",description:"Export the worker as a .fnw file",children:T.jsxs("div",{children:[T.jsxs("div",{children:[T.jsx("input",{type:"checkbox",className:"styledcheckbox",checked:a,onChange:y=>{l(y.currentTarget.checked)}}),"Include Files"]}),T.jsx("button",{className:"styledbtn",onClick:m,children:"Export"})]})})},Nge=()=>{const e=Qt(),t=e.workers(),[n,r]=Q.useState(!1),[a,l]=Q.useState(!1),u=w=>{w!=="__select__"&&e.workers&&e.workermanager&&t[w]&&(!t[w].active&&!window.confirm("this is an inactive worker, selecting it will start it, continue?")||e.workermanager.set_active(w))},d=async()=>{if(!e.worker||!window.confirm("Updateing the worker might replace the current nodespace, continue?"))return;const A=await bF(".fnw");e.worker.update_from_export(A)},h=e.options.useWorkerManager&&e.workermanager&&e.workermanager.open||wE,m=h&&Object.keys(t).length>0,y=e.worker&&e.worker.is_open,v=y&&h;return h||y?T.jsxs(T.Fragment,{children:[T.jsxs(nM,{children:[T.jsx(rM,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Od,{direction:"row",children:["Worker ",T.jsx(Vk,{className:"m-x-s"})]})})}),T.jsx(oM,{className:"headermenucontent funcnodescontainer",children:T.jsxs(aM,{children:[m&&T.jsxs(Tge,{children:[T.jsx(Rge,{className:"headermenuitem submenuitem",children:T.jsxs(Od,{direction:"row",children:["Select",T.jsx(X1,{})]})}),T.jsx(kge,{className:"headermenucontent funcnodescontainer",sideOffset:2,alignOffset:-5,children:T.jsx(_ge,{value:e.worker?.uuid,onValueChange:w=>{u(w)},children:Object.keys(t).sort((w,A)=>{if(t[w].active&&!t[A].active)return-1;if(!t[w].active&&t[A].active)return 1;const E=t[w].name||w,R=t[A].name||A;return E.localeCompare(R)}).map(w=>T.jsx(Age,{className:"headermenuitem workerselectoption"+(t[w]?.active?" active":" inactive")+" headermenuitem",value:w,disabled:w===e.worker?.uuid,children:t[w]?.name||w},w))})})]}),y&&T.jsxs(T.Fragment,{children:[v&&T.jsx(jc,{className:"headermenuitem",onClick:()=>{if(e.worker){if(!e.workermanager)return e.logger.error("no workermanager");e.workermanager?.restart_worker(e.worker.uuid)}},children:"Restart"}),T.jsx(jc,{className:"headermenuitem",onClick:()=>{e.worker&&e.worker.stop()},children:"Stop"}),T.jsx(jc,{className:"headermenuitem",onClick:()=>l(!0),children:"Export"}),T.jsx(jc,{className:"headermenuitem",onClick:d,children:"Update"})]}),h&&T.jsx(T.Fragment,{children:T.jsx(jc,{className:"headermenuitem",onClick:()=>r(!0),children:"New"})})]})})]}),T.jsx(Oge,{open:n,setOpen:r}),T.jsx(Mge,{open:a,setOpen:l})]}):null},Dge=()=>{const e=Qt(),t=()=>{window.confirm("Are you sure you want to start a new flow?")&&e.worker?.clear()},n=async()=>{const a=await e.worker?.save();if(!a)return;const l=new Blob([JSON.stringify(a)],{type:"application/json"}),u=URL.createObjectURL(l),d=document.createElement("a");d.href=u,d.download="flow.json",d.click(),URL.revokeObjectURL(u),d.remove()},r=async()=>{const a=document.createElement("input");a.type="file",a.accept=".json",a.onchange=async l=>{const u=l.target.files?.[0];if(!u)return;const d=new FileReader;d.onload=async h=>{const m=h.target?.result;if(!m)return;const y=JSON.parse(m);await e.worker?.load(y)},d.readAsText(u)},a.click()};return T.jsx(T.Fragment,{children:T.jsxs(nM,{children:[T.jsx(rM,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Od,{direction:"row",children:["Nodespace ",T.jsx(Vk,{className:"m-x-s"})]})})}),T.jsx(oM,{className:"headermenucontent funcnodescontainer",children:T.jsxs(aM,{children:[T.jsx(jc,{className:"headermenuitem",onClick:t,children:"New"}),T.jsx(jc,{className:"headermenuitem",onClick:n,children:"Save"}),T.jsx(jc,{className:"headermenuitem",onClick:r,children:"Load"})]})})]})})},Ige=({theme:e,selected:t})=>T.jsxs("div",{style:{width:80,height:54,borderRadius:"var(--fn-border-radius-s, 8px)",border:t?"2.5px solid #1976d2":"1.5px solid #bbb",boxShadow:t?"0 0 0 2px #1976d2":"0 1px 4px #0002",background:"var(--fn-app-background)",display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-start",position:"relative",overflow:"hidden",transition:"border 0.2s, box-shadow 0.2s"},"fn-data-color-theme":e,children:[T.jsx("div",{style:{height:10,background:"var(--fn-primary-color)",borderBottom:"1px solid var(--fn-neutral-element-border)"}}),T.jsxs("div",{style:{display:"flex",flex:1},children:[T.jsx("div",{style:{width:12,background:"var(--fn-surface-elevation-low, var(--fn-container-background))",borderRight:"1px solid var(--fn-neutral-element-border)"}}),T.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--fn-container-background)"},children:T.jsxs("div",{style:{width:22,height:14,borderRadius:"var(--fn-border-radius-xs, 4px)",background:"var(--fn-node-background)",border:"1px solid var(--fn-node-header-color)",boxShadow:"0 1px 2px #0002",display:"flex",flexDirection:"column"},children:[T.jsx("div",{style:{height:5,background:"var(--fn-node-header-color)",borderTopLeftRadius:"var(--fn-border-radius-xs, 4px)",borderTopRightRadius:"var(--fn-border-radius-xs, 4px)"}}),T.jsx("div",{style:{flex:1,background:"transparent"}})]})})]}),T.jsx("span",{style:{position:"absolute",bottom:2,right:4,fontSize:9,color:"var(--fn-text-color-neutral)",opacity:.7,textTransform:"capitalize",fontWeight:600,pointerEvents:"none"},children:e}),t&&T.jsx("span",{style:{position:"absolute",top:2,left:6,fontSize:14,color:"#1976d2",fontWeight:900,pointerEvents:"none"},"aria-label":"Selected",children:"✓"})]}),zge=()=>{const{colorTheme:e,setColorTheme:t}=f6(),[n,r]=z.useState(null),[a,l]=z.useState(null),u=h=>{h!==e&&(l(e),t(h),r(h))},d=h=>{n===h&&a&&a!==h&&t(a),r(null),l(null)};return T.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[T.jsx("div",{style:{marginBottom:8,fontWeight:500},children:"Theme:"}),T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(80px, 1fr))",gap:16,justifyItems:"center"},children:CL.map(h=>T.jsx("button",{onClick:()=>{t(h),r(null),l(null)},onMouseEnter:()=>u(h),onMouseLeave:()=>d(h),style:{background:"none",border:"none",padding:0,cursor:"pointer",outline:"none",borderRadius:8},"aria-label":`Select ${h} theme`,children:T.jsx(Ige,{theme:h,selected:e===h})},h))})]})},jge=()=>{const[e,t]=z.useState(!1),n=()=>{t(!0)};return T.jsxs(T.Fragment,{children:[T.jsxs(nM,{children:[T.jsx(rM,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Od,{direction:"row",children:["Settings ",T.jsx(Vk,{className:"m-x-s"})]})})}),T.jsx(oM,{className:"headermenucontent funcnodescontainer",children:T.jsx(aM,{children:T.jsx(jc,{className:"headermenuitem",onClick:n,children:"Appearance"})})})]}),T.jsx(Jc,{open:e,setOpen:t,title:"Appearance",description:"Change the color theme.",closebutton:!0,children:T.jsx(zge,{})})]})},Bge=({...e})=>{const t=Qt(),n=t.workerstate();return Object.keys(e).length>0&&t.logger.debug("headerprops",e),T.jsxs(Od,{className:"funcnodesreactflowheader",direction:"row",wrap:!0,children:[T.jsx(Od,{className:"headerelement m-w-6",grow:{"":!0,m:!1},children:T.jsx(yme,{})}),(e.showmenu||wE)&&T.jsxs(Od,{direction:"row",wrap:!0,children:[T.jsx("div",{className:"headerelement",children:T.jsx(Nge,{})}),(t.worker&&n.is_open||wE)&&T.jsx("div",{className:"headerelement",children:T.jsx(Dge,{})}),T.jsx("div",{className:"headerelement",children:T.jsx(jge,{})})]})]})},VV=({item:e})=>{const{node:t}=jo(),n=z.useCallback(()=>{t?.add_node(e.node_id)},[e.node_id,t]),r=z.useCallback(a=>{a.detail===2&&n()},[n]);return T.jsx("div",{className:"libnodeentry",onClick:r,title:e.description,children:e.node_name||e.node_id})},FV=(e,t)=>{const n=e.nodes?.some(a=>a.node_id.toLowerCase().includes(t.toLowerCase()))??!1,r=e.subshelves?.some(a=>FV(a,t))??!1;return n||r},iM=({item:e,filter:t,parentkey:n})=>{const[r,a]=Q.useState(!1),l=()=>a(!r),u=e.nodes?.filter(h=>h.node_id.toLowerCase().includes(t.toLowerCase())),d=r||t.length>0;return FV(e,t)?T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:l,style:{cursor:"pointer"},title:e.description,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(d?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(d?"open":"close"),children:T.jsxs("div",{className:"libnodecontainer_inner",children:[u&&T.jsx(T.Fragment,{children:u.map(h=>T.jsx(VV,{item:h},h.node_id))}),e.subshelves&&T.jsx(T.Fragment,{children:e.subshelves.map(h=>T.jsx(iM,{item:h,filter:t,parentkey:n+h.name},n+h.name))})]})}),T.jsx("hr",{})]}):T.jsx(T.Fragment,{})},Lge=({filter:e,setFilter:t})=>T.jsxs("div",{className:"libfilter",children:[T.jsx(EQ,{fontSize:"inherit"}),T.jsx("input",{type:"text",placeholder:"Filter",value:e,onChange:n=>{t(n.target.value)}}),e&&T.jsx(sC,{fontSize:"inherit",onClick:()=>{t("")}})]}),Pge=({children:e})=>{const[t,n]=Q.useState(""),r=Qt(),[a,l]=Q.useState(!0),[u,d]=Q.useState(!0),[h,m]=Q.useState(!0),[y,v]=Q.useState({installed:[],available:[],active:[]}),[S,w]=Q.useState(!1),{lib:A}=jo(),E=$=>{$&&(r.worker===void 0||!r.worker.is_open||A?.get_available_modules().then(Z=>{v(Z)}))};if(!r.worker)return T.jsx(T.Fragment,{});const R=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),k=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),D=z.useCallback($=>{w(!1),A?.remove_lib($.name)},[A]),M=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),I=z.useCallback($=>$.filter(Z=>Z.name.toLowerCase().includes(t.toLowerCase())||Z.description.toLowerCase().includes(t.toLowerCase())),[t]),L=I(y.available),P=I(y.installed),G=I(y.active);return T.jsxs(Jc,{title:"Manage Library",trigger:e,description:"Add or remove libraries to the current worker.",onOpenChange:E,open:S,setOpen:w,children:[T.jsx("input",{className:"filter-input styledinput",type:"text",placeholder:"Filter modules...",value:t,onChange:$=>n($.target.value)}),T.jsxs("div",{className:"packagelist",style:{maxHeight:"70%",overflow:"auto"},children:[P.length>0&&T.jsx("h3",{onClick:()=>{m(!h)},children:"Installed"}),h&&P.map($=>T.jsx(fSe,{availableModule:$,on_add:R},$.name+$.source)),L.length>0&&T.jsx("h3",{onClick:()=>{d(!u)},children:"Available"}),u&&L.map($=>T.jsx(dSe,{availableModule:$,on_add:k},$.name+$.source)),G.length>0&&T.jsx("h3",{onClick:()=>{l(!a)},children:"Active"}),a&&G.map($=>T.jsx(cSe,{availableModule:$,on_remove:D,on_update:M},$.name+$.source))]})]})},lM=({availableModule:e})=>T.jsxs("div",{className:"module-links",children:[e.homepage&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",children:"Homepage"})}),e.source&&e.homepage&&" | ",e.source&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.source,target:"_blank",rel:"noopener noreferrer",children:"Source"})})]});function Hge(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Vge=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Fge=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gge={};function G5(e,t){return(Gge.jsx?Fge:Vge).test(e)}const Uge=/[ \t\n\f\r]/g;function $ge(e){return typeof e=="object"?e.type==="text"?U5(e.value):!1:U5(e)}function U5(e){return e.replace(Uge,"")===""}class Vx{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Vx.prototype.normal={};Vx.prototype.property={};Vx.prototype.space=void 0;function GV(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Vx(n,r,t)}function UR(e){return e.toLowerCase()}class Ma{constructor(t,n){this.attribute=n,this.property=t}}Ma.prototype.attribute="";Ma.prototype.booleanish=!1;Ma.prototype.boolean=!1;Ma.prototype.commaOrSpaceSeparated=!1;Ma.prototype.commaSeparated=!1;Ma.prototype.defined=!1;Ma.prototype.mustUseProperty=!1;Ma.prototype.number=!1;Ma.prototype.overloadedBoolean=!1;Ma.prototype.property="";Ma.prototype.spaceSeparated=!1;Ma.prototype.space=void 0;let Xge=0;const kt=Qp(),Ar=Qp(),$R=Qp(),Ve=Qp(),kn=Qp(),Zy=Qp(),Qa=Qp();function Qp(){return 2**++Xge}const XR=Object.freeze(Object.defineProperty({__proto__:null,boolean:kt,booleanish:Ar,commaOrSpaceSeparated:Qa,commaSeparated:Zy,number:Ve,overloadedBoolean:$R,spaceSeparated:kn},Symbol.toStringTag,{value:"Module"})),mT=Object.keys(XR);class sM extends Ma{constructor(t,n,r,a){let l=-1;if(super(t,n),$5(this,"space",a),typeof r=="number")for(;++l<mT.length;){const u=mT[l];$5(this,mT[l],(r&XR[u])===XR[u])}}}sM.prototype.defined=!0;function $5(e,t,n){n&&(e[t]=n)}function v0(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const l=new sM(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[UR(r)]=r,n[UR(l.attribute)]=r}return new Vx(t,n,e.space)}const UV=v0({properties:{ariaActiveDescendant:null,ariaAtomic:Ar,ariaAutoComplete:null,ariaBusy:Ar,ariaChecked:Ar,ariaColCount:Ve,ariaColIndex:Ve,ariaColSpan:Ve,ariaControls:kn,ariaCurrent:null,ariaDescribedBy:kn,ariaDetails:null,ariaDisabled:Ar,ariaDropEffect:kn,ariaErrorMessage:null,ariaExpanded:Ar,ariaFlowTo:kn,ariaGrabbed:Ar,ariaHasPopup:null,ariaHidden:Ar,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kn,ariaLevel:Ve,ariaLive:null,ariaModal:Ar,ariaMultiLine:Ar,ariaMultiSelectable:Ar,ariaOrientation:null,ariaOwns:kn,ariaPlaceholder:null,ariaPosInSet:Ve,ariaPressed:Ar,ariaReadOnly:Ar,ariaRelevant:null,ariaRequired:Ar,ariaRoleDescription:kn,ariaRowCount:Ve,ariaRowIndex:Ve,ariaRowSpan:Ve,ariaSelected:Ar,ariaSetSize:Ve,ariaSort:null,ariaValueMax:Ve,ariaValueMin:Ve,ariaValueNow:Ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $V(e,t){return t in e?e[t]:t}function XV(e,t){return $V(e,t.toLowerCase())}const Yge=v0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Zy,acceptCharset:kn,accessKey:kn,action:null,allow:null,allowFullScreen:kt,allowPaymentRequest:kt,allowUserMedia:kt,alt:null,as:null,async:kt,autoCapitalize:null,autoComplete:kn,autoFocus:kt,autoPlay:kt,blocking:kn,capture:null,charSet:null,checked:kt,cite:null,className:kn,cols:Ve,colSpan:null,content:null,contentEditable:Ar,controls:kt,controlsList:kn,coords:Ve|Zy,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kt,defer:kt,dir:null,dirName:null,disabled:kt,download:$R,draggable:Ar,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kt,formTarget:null,headers:kn,height:Ve,hidden:$R,high:Ve,href:null,hrefLang:null,htmlFor:kn,httpEquiv:kn,id:null,imageSizes:null,imageSrcSet:null,inert:kt,inputMode:null,integrity:null,is:null,isMap:kt,itemId:null,itemProp:kn,itemRef:kn,itemScope:kt,itemType:kn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kt,low:Ve,manifest:null,max:null,maxLength:Ve,media:null,method:null,min:null,minLength:Ve,multiple:kt,muted:kt,name:null,nonce:null,noModule:kt,noValidate:kt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kt,optimum:Ve,pattern:null,ping:kn,placeholder:null,playsInline:kt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kt,referrerPolicy:null,rel:kn,required:kt,reversed:kt,rows:Ve,rowSpan:Ve,sandbox:kn,scope:null,scoped:kt,seamless:kt,selected:kt,shadowRootClonable:kt,shadowRootDelegatesFocus:kt,shadowRootMode:null,shape:null,size:Ve,sizes:null,slot:null,span:Ve,spellCheck:Ar,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ve,step:null,style:null,tabIndex:Ve,target:null,title:null,translate:null,type:null,typeMustMatch:kt,useMap:null,value:Ar,width:Ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kn,axis:null,background:null,bgColor:null,border:Ve,borderColor:null,bottomMargin:Ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kt,declare:kt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ve,leftMargin:Ve,link:null,longDesc:null,lowSrc:null,marginHeight:Ve,marginWidth:Ve,noResize:kt,noHref:kt,noShade:kt,noWrap:kt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ve,rules:null,scheme:null,scrolling:Ar,standby:null,summary:null,text:null,topMargin:Ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ve,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kt,disableRemotePlayback:kt,prefix:null,property:null,results:Ve,security:null,unselectable:null},space:"html",transform:XV}),Zge=v0({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qa,accentHeight:Ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ve,amplitude:Ve,arabicForm:null,ascent:Ve,attributeName:null,attributeType:null,azimuth:Ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ve,by:null,calcMode:null,capHeight:Ve,className:kn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ve,diffuseConstant:Ve,direction:null,display:null,dur:null,divisor:Ve,dominantBaseline:null,download:kt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ve,enableBackground:null,end:null,event:null,exponent:Ve,externalResourcesRequired:null,fill:null,fillOpacity:Ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Zy,g2:Zy,glyphName:Zy,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ve,horizOriginX:Ve,horizOriginY:Ve,id:null,ideographic:Ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ve,k:Ve,k1:Ve,k2:Ve,k3:Ve,k4:Ve,kernelMatrix:Qa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ve,overlineThickness:Ve,paintOrder:null,panose1:null,path:null,pathLength:Ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:kn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ve,pointsAtY:Ve,pointsAtZ:Ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qa,rev:Qa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qa,requiredFeatures:Qa,requiredFonts:Qa,requiredFormats:Qa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ve,specularExponent:Ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ve,strikethroughThickness:Ve,string:null,stroke:null,strokeDashArray:Qa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ve,strokeOpacity:Ve,strokeWidth:null,style:null,surfaceScale:Ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qa,tabIndex:Ve,tableValues:null,target:null,targetX:Ve,targetY:Ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ve,underlineThickness:Ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ve,values:null,vAlphabetic:Ve,vMathematical:Ve,vectorEffect:null,vHanging:Ve,vIdeographic:Ve,version:null,vertAdvY:Ve,vertOriginX:Ve,vertOriginY:Ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$V}),YV=v0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ZV=v0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XV}),WV=v0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Wge={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},qge=/[A-Z]/g,X5=/-[a-z]/g,Jge=/^data[-\w.:]+$/i;function Qge(e,t){const n=UR(t);let r=t,a=Ma;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Jge.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(X5,eye);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!X5.test(l)){let u=l.replace(qge,Kge);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=sM}return new a(r,t)}function Kge(e){return"-"+e.toLowerCase()}function eye(e){return e.charAt(1).toUpperCase()}const tye=GV([UV,Yge,YV,ZV,WV],"html"),uM=GV([UV,Zge,YV,ZV,WV],"svg");function nye(e){return e.join(" ").trim()}var My={},gT,Y5;function rye(){if(Y5)return gT;Y5=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,h=`
|
|
1086
1086
|
`,m="/",y="*",v="",S="comment",w="declaration";gT=function(E,R){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];R=R||{};var k=1,D=1;function M(ae){var U=ae.match(t);U&&(k+=U.length);var te=ae.lastIndexOf(h);D=~te?ae.length-te:D+ae.length}function I(){var ae={line:k,column:D};return function(U){return U.position=new L(ae),$(),U}}function L(ae){this.start=ae,this.end={line:k,column:D},this.source=R.source}L.prototype.content=E;function P(ae){var U=new Error(R.source+":"+k+":"+D+": "+ae);if(U.reason=ae,U.filename=R.source,U.line=k,U.column=D,U.source=E,!R.silent)throw U}function G(ae){var U=ae.exec(E);if(U){var te=U[0];return M(te),E=E.slice(te.length),U}}function $(){G(n)}function Z(ae){var U;for(ae=ae||[];U=j();)U!==!1&&ae.push(U);return ae}function j(){var ae=I();if(!(m!=E.charAt(0)||y!=E.charAt(1))){for(var U=2;v!=E.charAt(U)&&(y!=E.charAt(U)||m!=E.charAt(U+1));)++U;if(U+=2,v===E.charAt(U-1))return P("End of comment missing");var te=E.slice(2,U-2);return D+=2,M(te),E=E.slice(U),D+=2,ae({type:S,comment:te})}}function X(){var ae=I(),U=G(r);if(U){if(j(),!G(a))return P("property missing ':'");var te=G(l),V=ae({type:w,property:A(U[0].replace(e,v)),value:te?A(te[0].replace(e,v)):v});return G(u),V}}function ee(){var ae=[];Z(ae);for(var U;U=X();)U!==!1&&(ae.push(U),Z(ae));return ae}return $(),ee()};function A(E){return E?E.replace(d,v):v}return gT}var Z5;function oye(){if(Z5)return My;Z5=1;var e=My&&My.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(My,"__esModule",{value:!0}),My.default=n;var t=e(rye());function n(r,a){var l=null;if(!r||typeof r!="string")return l;var u=(0,t.default)(r),d=typeof a=="function";return u.forEach(function(h){if(h.type==="declaration"){var m=h.property,y=h.value;d?a(m,y,h):y&&(l=l||{},l[m]=y)}}),l}return My}var y1={},W5;function aye(){if(W5)return y1;W5=1,Object.defineProperty(y1,"__esModule",{value:!0}),y1.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},u=function(m,y){return y.toUpperCase()},d=function(m,y){return"".concat(y,"-")},h=function(m,y){return y===void 0&&(y={}),l(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(a,d):m=m.replace(r,d),m.replace(t,u))};return y1.camelCase=h,y1}var v1,q5;function iye(){if(q5)return v1;q5=1;var e=v1&&v1.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(oye()),n=aye();function r(a,l){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(d,h){d&&h&&(u[(0,n.camelCase)(d,l)]=h)}),u}return r.default=r,v1=r,v1}var lye=iye();const sye=OE(lye),qV=JV("end"),cM=JV("start");function JV(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function uye(e){const t=cM(e),n=qV(e);if(t&&n)return{start:t,end:n}}function B1(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?J5(e.position):"start"in e||"end"in e?J5(e):"line"in e||"column"in e?YR(e):""}function YR(e){return Q5(e&&e.line)+":"+Q5(e&&e.column)}function J5(e){return YR(e&&e.start)+"-"+YR(e&&e.end)}function Q5(e){return e&&typeof e=="number"?e:1}class Bo extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(u=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?l.ruleId=r:(l.source=r.slice(0,h),l.ruleId=r.slice(h+1))}if(!l.place&&l.ancestors&&l.ancestors){const h=l.ancestors[l.ancestors.length-1];h&&(l.place=h.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=d?d.line:void 0,this.name=B1(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual,this.expected,this.note,this.url}}Bo.prototype.file="";Bo.prototype.name="";Bo.prototype.reason="";Bo.prototype.message="";Bo.prototype.stack="";Bo.prototype.column=void 0;Bo.prototype.line=void 0;Bo.prototype.ancestors=void 0;Bo.prototype.cause=void 0;Bo.prototype.fatal=void 0;Bo.prototype.place=void 0;Bo.prototype.ruleId=void 0;Bo.prototype.source=void 0;const fM={}.hasOwnProperty,cye=new Map,fye=/[A-Z]/g,dye=new Set(["table","tbody","thead","tfoot","tr"]),hye=new Set(["td","th"]),QV="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pye(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=wye(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Sye(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?uM:tye,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=KV(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function KV(e,t,n){if(t.type==="element")return mye(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gye(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return vye(e,t,n);if(t.type==="mdxjsEsm")return yye(e,t);if(t.type==="root")return bye(e,t,n);if(t.type==="text")return xye(e,t)}function mye(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=uM,e.schema=a),e.ancestors.push(t);const l=t8(e,t.tagName,!1),u=Eye(e,t);let d=hM(e,t);return dye.has(t.tagName)&&(d=d.filter(function(h){return typeof h=="string"?!$ge(h):!0})),e8(e,u,l,t),dM(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function gye(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}cx(e,t.position)}function yye(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cx(e,t.position)}function vye(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=uM,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:t8(e,t.name,!0),u=Cye(e,t),d=hM(e,t);return e8(e,u,l,t),dM(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function bye(e,t,n){const r={};return dM(r,hM(e,t)),e.create(t,e.Fragment,r,n)}function xye(e,t){return t.value}function e8(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function dM(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Sye(e,t,n){return r;function r(a,l,u,d){const m=Array.isArray(u.children)?n:t;return d?m(l,u,d):m(l,u)}}function wye(e,t){return n;function n(r,a,l,u){const d=Array.isArray(l.children),h=cM(r);return t(a,l,u,d,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function Eye(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&fM.call(t.properties,a)){const l=_ye(e,a,t.properties[a]);if(l){const[u,d]=l;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&hye.has(t.tagName)?r=d:n[u]=d}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Cye(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else cx(e,t.position);else{const a=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else cx(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function hM(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:cye;for(;++r<t.children.length;){const l=t.children[r];let u;if(e.passKeys){const h=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(h){const m=a.get(h)||0;u=h+"-"+m,a.set(h,m+1)}}const d=KV(e,l,u);d!==void 0&&n.push(d)}return n}function _ye(e,t,n){const r=Qge(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Hge(n):nye(n)),r.property==="style"){let a=typeof n=="object"?n:Aye(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Tye(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?Wge[r.property]||r.property:r.attribute,n]}}function Aye(e,t){try{return sye(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Bo("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=QV+"#cannot-parse-style-attribute",a}}function t8(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let l=-1,u;for(;++l<a.length;){const d=G5(a[l])?{type:"Identifier",name:a[l]}:{type:"Literal",value:a[l]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}r=u}else r=G5(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return fM.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);cx(e)}function cx(e,t){const n=new Bo("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=QV+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Tye(e){const t={};let n;for(n in e)fM.call(e,n)&&(t[Rye(n)]=e[n]);return t}function Rye(e){let t=e.replace(fye,kye);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function kye(e){return"-"+e.toLowerCase()}const yT={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Oye={};function pM(e,t){const n=Oye,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return n8(e,r,a)}function n8(e,t,n){if(Mye(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return K5(e.children,t,n)}return Array.isArray(e)?K5(e,t,n):""}function K5(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=n8(e[a],t,n);return r.join("")}function Mye(e){return!!(e&&typeof e=="object")}const ez=document.createElement("i");function mM(e){const t="&"+e+";";ez.innerHTML=t;const n=ez.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ai(e,t,n,r){const a=e.length;let l=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l<r.length;)u=r.slice(l,l+1e4),u.unshift(t,0),e.splice(...u),l+=1e4,t+=1e4}function cl(e,t){return e.length>0?(ai(e,e.length,0,t),e):t}const tz={}.hasOwnProperty;function r8(e){const t={};let n=-1;for(;++n<e.length;)Nye(t,e[n]);return t}function Nye(e,t){let n;for(n in t){const a=(tz.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let u;if(l)for(u in l){tz.call(a,u)||(a[u]=[]);const d=l[u];Dye(a[u],Array.isArray(d)?d:d?[d]:[])}}}function Dye(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ai(e,0,0,r)}function o8(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function es(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ta=Fd(/[A-Za-z]/),Do=Fd(/[\dA-Za-z]/),Iye=Fd(/[#-'*+\--9=?A-Z^-~]/);function _E(e){return e!==null&&(e<32||e===127)}const ZR=Fd(/\d/),zye=Fd(/[\dA-Fa-f]/),jye=Fd(/[!-/:-@[-`{-~]/);function ht(e){return e!==null&&e<-2}function wn(e){return e!==null&&(e<0||e===32)}function Pt(e){return e===-2||e===-1||e===32}const GC=Fd(new RegExp("\\p{P}|\\p{S}","u")),Xp=Fd(/\s/);function Fd(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function b0(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let u="";if(l===37&&Do(e.charCodeAt(n+1))&&Do(e.charCodeAt(n+2)))a=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(u=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(u=String.fromCharCode(l,d),a=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Yt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(h){return Pt(h)?(e.enter(n),d(h)):t(h)}function d(h){return Pt(h)&&l++<a?(e.consume(h),d):(e.exit(n),t(h))}}const Bye={tokenize:Lye};function Lye(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Yt(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),l(d)}function l(d){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return ht(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),u)}}const Pye={tokenize:Hye},nz={tokenize:Vye};function Hye(e){const t=this,n=[];let r=0,a,l,u;return d;function d(M){if(r<n.length){const I=n[r];return t.containerState=I[1],e.attempt(I[0].continuation,h,m)(M)}return m(M)}function h(M){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&D();const I=t.events.length;let L=I,P;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){P=t.events[L][1].end;break}k(r);let G=I;for(;G<t.events.length;)t.events[G][1].end={...P},G++;return ai(t.events,L+1,0,t.events.slice(I)),t.events.length=G,m(M)}return d(M)}function m(M){if(r===n.length){if(!a)return S(M);if(a.currentConstruct&&a.currentConstruct.concrete)return A(M);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nz,y,v)(M)}function y(M){return a&&D(),k(r),S(M)}function v(M){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,A(M)}function S(M){return t.containerState={},e.attempt(nz,w,A)(M)}function w(M){return r++,n.push([t.currentConstruct,t.containerState]),S(M)}function A(M){if(M===null){a&&D(),k(0),e.consume(M);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),E(M)}function E(M){if(M===null){R(e.exit("chunkFlow"),!0),k(0),e.consume(M);return}return ht(M)?(e.consume(M),R(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(M),E)}function R(M,I){const L=t.sliceStream(M);if(I&&L.push(null),M.previous=l,l&&(l.next=M),l=M,a.defineSkip(M.start),a.write(L),t.parser.lazy[M.start.line]){let P=a.events.length;for(;P--;)if(a.events[P][1].start.offset<u&&(!a.events[P][1].end||a.events[P][1].end.offset>u))return;const G=t.events.length;let $=G,Z,j;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(Z){j=t.events[$][1].end;break}Z=!0}for(k(r),P=G;P<t.events.length;)t.events[P][1].end={...j},P++;ai(t.events,$+1,0,t.events.slice(G)),t.events.length=P}}function k(M){let I=n.length;for(;I-- >M;){const L=n[I];t.containerState=L[1],L[0].exit.call(t,e)}n.length=M}function D(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Vye(e,t,n){return Yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function u0(e){if(e===null||wn(e)||Xp(e))return 1;if(GC(e))return 2}function UC(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const l=e[a].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const WR={name:"attention",resolveAll:Fye,tokenize:Gye};function Fye(e,t){let n=-1,r,a,l,u,d,h,m,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[r][1].end},S={...e[n][1].start};rz(v,-h),rz(S,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,end:{...e[r][1].end}},d={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:S},l={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[r][1].end={...u.start},e[n][1].start={...d.end},m=[],e[r][1].end.offset-e[r][1].start.offset&&(m=cl(m,[["enter",e[r][1],t],["exit",e[r][1],t]])),m=cl(m,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",l,t]]),m=cl(m,UC(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),m=cl(m,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,m=cl(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,ai(e,r-1,n-r+3,m),n=r+m.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Gye(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=u0(r);let l;return u;function u(h){return l=h,e.enter("attentionSequence"),d(h)}function d(h){if(h===l)return e.consume(h),d;const m=e.exit("attentionSequence"),y=u0(h),v=!y||y===2&&a||n.includes(h),S=!a||a===2&&y||n.includes(r);return m._open=!!(l===42?v:v&&(a||!S)),m._close=!!(l===42?S:S&&(y||!v)),t(h)}}function rz(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Uye={name:"autolink",tokenize:$ye};function $ye(e,t,n){let r=0;return a;function a(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(w){return ta(w)?(e.consume(w),u):w===64?n(w):m(w)}function u(w){return w===43||w===45||w===46||Do(w)?(r=1,d(w)):m(w)}function d(w){return w===58?(e.consume(w),r=0,h):(w===43||w===45||w===46||Do(w))&&r++<32?(e.consume(w),d):(r=0,m(w))}function h(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||_E(w)?n(w):(e.consume(w),h)}function m(w){return w===64?(e.consume(w),y):Iye(w)?(e.consume(w),m):n(w)}function y(w){return Do(w)?v(w):n(w)}function v(w){return w===46?(e.consume(w),r=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):S(w)}function S(w){if((w===45||Do(w))&&r++<63){const A=w===45?S:v;return e.consume(w),A}return n(w)}}const Fx={partial:!0,tokenize:Xye};function Xye(e,t,n){return r;function r(l){return Pt(l)?Yt(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||ht(l)?t(l):n(l)}}const a8={continuation:{tokenize:Zye},exit:Wye,name:"blockQuote",tokenize:Yye};function Yye(e,t,n){const r=this;return a;function a(u){if(u===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),l}return n(u)}function l(u){return Pt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function Zye(e,t,n){const r=this;return a;function a(u){return Pt(u)?Yt(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):l(u)}function l(u){return e.attempt(a8,t,n)(u)}}function Wye(e){e.exit("blockQuote")}const i8={name:"characterEscape",tokenize:qye};function qye(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),a}function a(l){return jye(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const l8={name:"characterReference",tokenize:Jye};function Jye(e,t,n){const r=this;let a=0,l,u;return d;function d(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,u=Do,y(v))}function m(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,u=zye,y):(e.enter("characterReferenceValue"),l=7,u=ZR,y(v))}function y(v){if(v===59&&a){const S=e.exit("characterReferenceValue");return u===Do&&!mM(r.sliceSerialize(S))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<l?(e.consume(v),y):n(v)}}const oz={partial:!0,tokenize:Kye},az={concrete:!0,name:"codeFenced",tokenize:Qye};function Qye(e,t,n){const r=this,a={partial:!0,tokenize:L};let l=0,u=0,d;return h;function h(P){return m(P)}function m(P){const G=r.events[r.events.length-1];return l=G&&G[1].type==="linePrefix"?G[2].sliceSerialize(G[1],!0).length:0,d=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(P)}function y(P){return P===d?(u++,e.consume(P),y):u<3?n(P):(e.exit("codeFencedFenceSequence"),Pt(P)?Yt(e,v,"whitespace")(P):v(P))}function v(P){return P===null||ht(P)?(e.exit("codeFencedFence"),r.interrupt?t(P):e.check(oz,E,I)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(P))}function S(P){return P===null||ht(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(P)):Pt(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Yt(e,w,"whitespace")(P)):P===96&&P===d?n(P):(e.consume(P),S)}function w(P){return P===null||ht(P)?v(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),A(P))}function A(P){return P===null||ht(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(P)):P===96&&P===d?n(P):(e.consume(P),A)}function E(P){return e.attempt(a,I,R)(P)}function R(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),k}function k(P){return l>0&&Pt(P)?Yt(e,D,"linePrefix",l+1)(P):D(P)}function D(P){return P===null||ht(P)?e.check(oz,E,I)(P):(e.enter("codeFlowValue"),M(P))}function M(P){return P===null||ht(P)?(e.exit("codeFlowValue"),D(P)):(e.consume(P),M)}function I(P){return e.exit("codeFenced"),t(P)}function L(P,G,$){let Z=0;return j;function j(te){return P.enter("lineEnding"),P.consume(te),P.exit("lineEnding"),X}function X(te){return P.enter("codeFencedFence"),Pt(te)?Yt(P,ee,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):ee(te)}function ee(te){return te===d?(P.enter("codeFencedFenceSequence"),ae(te)):$(te)}function ae(te){return te===d?(Z++,P.consume(te),ae):Z>=u?(P.exit("codeFencedFenceSequence"),Pt(te)?Yt(P,U,"whitespace")(te):U(te)):$(te)}function U(te){return te===null||ht(te)?(P.exit("codeFencedFence"),G(te)):$(te)}}}function Kye(e,t,n){const r=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const vT={name:"codeIndented",tokenize:t0e},e0e={partial:!0,tokenize:n0e};function t0e(e,t,n){const r=this;return a;function a(m){return e.enter("codeIndented"),Yt(e,l,"linePrefix",5)(m)}function l(m){const y=r.events[r.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?u(m):n(m)}function u(m){return m===null?h(m):ht(m)?e.attempt(e0e,u,h)(m):(e.enter("codeFlowValue"),d(m))}function d(m){return m===null||ht(m)?(e.exit("codeFlowValue"),u(m)):(e.consume(m),d)}function h(m){return e.exit("codeIndented"),t(m)}}function n0e(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):ht(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):Yt(e,l,"linePrefix",5)(u)}function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):ht(u)?a(u):n(u)}}const r0e={name:"codeText",previous:a0e,resolve:o0e,tokenize:i0e};function o0e(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function a0e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function i0e(e,t,n){let r=0,a,l;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),d(v)}function d(v){return v===96?(e.consume(v),r++,d):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(l=e.enter("codeTextSequence"),a=0,y(v)):ht(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),m(v))}function m(v){return v===null||v===32||v===96||ht(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),m)}function y(v){return v===96?(e.consume(v),a++,y):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(l.type="codeTextData",m(v))}}class l0e{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&b1(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),b1(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),b1(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);b1(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);b1(this.left,n.reverse())}}}function b1(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function s8(e){const t={};let n=-1,r,a,l,u,d,h,m;const y=new l0e(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(r=y.get(n),n&&r[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,l=0,l<h.length&&h[l][1].type==="lineEndingBlank"&&(l+=2),l<h.length&&h[l][1].type==="content"))for(;++l<h.length&&h[l][1].type!=="content";)h[l][1].type==="chunkText"&&(h[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,s0e(y,n)),n=t[n],m=!0);else if(r[1]._container){for(l=n,a=void 0;l--;)if(u=y.get(l),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(y.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=l);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(r[1].end={...y.get(a)[1].start},d=y.slice(a,n),d.unshift(r),y.splice(a,n-a+1,d))}}return ai(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function s0e(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const l=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,h=[],m={};let y,v,S=-1,w=n,A=0,E=0;const R=[E];for(;w;){for(;e.get(++a)[1]!==w;);l.push(a),w._tokenizer||(y=r.sliceStream(w),w.next||y.push(null),v&&u.defineSkip(w.start),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(y),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=w,w=w.next}for(w=n;++S<d.length;)d[S][0]==="exit"&&d[S-1][0]==="enter"&&d[S][1].type===d[S-1][1].type&&d[S][1].start.line!==d[S][1].end.line&&(E=S+1,R.push(E),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(u.events=[],w?(w._tokenizer=void 0,w.previous=void 0):R.pop(),S=R.length;S--;){const k=d.slice(R[S],R[S+1]),D=l.pop();h.push([D,D+k.length-1]),e.splice(D,2,k)}for(h.reverse(),S=-1;++S<h.length;)m[A+h[S][0]]=A+h[S][1],A+=h[S][1]-h[S][0]-1;return m}const u0e={resolve:f0e,tokenize:d0e},c0e={partial:!0,tokenize:h0e};function f0e(e){return s8(e),e}function d0e(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(d)}function a(d){return d===null?l(d):ht(d)?e.check(c0e,u,l)(d):(e.consume(d),a)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function u(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function h0e(e,t,n){const r=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Yt(e,l,"linePrefix")}function l(u){if(u===null||ht(u))return n(u);const d=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function u8(e,t,n,r,a,l,u,d,h){const m=h||Number.POSITIVE_INFINITY;let y=0;return v;function v(k){return k===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(k),e.exit(l),S):k===null||k===32||k===41||_E(k)?n(k):(e.enter(r),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),E(k))}function S(k){return k===62?(e.enter(l),e.consume(k),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),w(k))}function w(k){return k===62?(e.exit("chunkString"),e.exit(d),S(k)):k===null||k===60||ht(k)?n(k):(e.consume(k),k===92?A:w)}function A(k){return k===60||k===62||k===92?(e.consume(k),w):w(k)}function E(k){return!y&&(k===null||k===41||wn(k))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(r),t(k)):y<m&&k===40?(e.consume(k),y++,E):k===41?(e.consume(k),y--,E):k===null||k===32||k===40||_E(k)?n(k):(e.consume(k),k===92?R:E)}function R(k){return k===40||k===41||k===92?(e.consume(k),E):E(k)}}function c8(e,t,n,r,a,l){const u=this;let d=0,h;return m;function m(w){return e.enter(r),e.enter(a),e.consume(w),e.exit(a),e.enter(l),y}function y(w){return d>999||w===null||w===91||w===93&&!h||w===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(w):w===93?(e.exit(l),e.enter(a),e.consume(w),e.exit(a),e.exit(r),t):ht(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),v(w))}function v(w){return w===null||w===91||w===93||ht(w)||d++>999?(e.exit("chunkString"),y(w)):(e.consume(w),h||(h=!Pt(w)),w===92?S:v)}function S(w){return w===91||w===92||w===93?(e.consume(w),d++,v):v(w)}}function f8(e,t,n,r,a,l){let u;return d;function d(S){return S===34||S===39||S===40?(e.enter(r),e.enter(a),e.consume(S),e.exit(a),u=S===40?41:S,h):n(S)}function h(S){return S===u?(e.enter(a),e.consume(S),e.exit(a),e.exit(r),t):(e.enter(l),m(S))}function m(S){return S===u?(e.exit(l),h(u)):S===null?n(S):ht(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),Yt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===u||S===null||ht(S)?(e.exit("chunkString"),m(S)):(e.consume(S),S===92?v:y)}function v(S){return S===u||S===92?(e.consume(S),y):y(S)}}function L1(e,t){let n;return r;function r(a){return ht(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Pt(a)?Yt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const p0e={name:"definition",tokenize:g0e},m0e={partial:!0,tokenize:y0e};function g0e(e,t,n){const r=this;let a;return l;function l(w){return e.enter("definition"),u(w)}function u(w){return c8.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function d(w){return a=es(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),h):n(w)}function h(w){return wn(w)?L1(e,m)(w):m(w)}function m(w){return u8(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(m0e,v,v)(w)}function v(w){return Pt(w)?Yt(e,S,"whitespace")(w):S(w)}function S(w){return w===null||ht(w)?(e.exit("definition"),r.parser.defined.push(a),t(w)):n(w)}}function y0e(e,t,n){return r;function r(d){return wn(d)?L1(e,a)(d):n(d)}function a(d){return f8(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return Pt(d)?Yt(e,u,"whitespace")(d):u(d)}function u(d){return d===null||ht(d)?t(d):n(d)}}const v0e={name:"hardBreakEscape",tokenize:b0e};function b0e(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return ht(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const x0e={name:"headingAtx",resolve:S0e,tokenize:w0e};function S0e(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ai(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function w0e(e,t,n){let r=0;return a;function a(y){return e.enter("atxHeading"),l(y)}function l(y){return e.enter("atxHeadingSequence"),u(y)}function u(y){return y===35&&r++<6?(e.consume(y),u):y===null||wn(y)?(e.exit("atxHeadingSequence"),d(y)):n(y)}function d(y){return y===35?(e.enter("atxHeadingSequence"),h(y)):y===null||ht(y)?(e.exit("atxHeading"),t(y)):Pt(y)?Yt(e,d,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function h(y){return y===35?(e.consume(y),h):(e.exit("atxHeadingSequence"),d(y))}function m(y){return y===null||y===35||wn(y)?(e.exit("atxHeadingText"),d(y)):(e.consume(y),m)}}const E0e=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],iz=["pre","script","style","textarea"],C0e={concrete:!0,name:"htmlFlow",resolveTo:T0e,tokenize:R0e},_0e={partial:!0,tokenize:O0e},A0e={partial:!0,tokenize:k0e};function T0e(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function R0e(e,t,n){const r=this;let a,l,u,d,h;return m;function m(Y){return y(Y)}function y(Y){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(Y),v}function v(Y){return Y===33?(e.consume(Y),S):Y===47?(e.consume(Y),l=!0,E):Y===63?(e.consume(Y),a=3,r.interrupt?t:B):ta(Y)?(e.consume(Y),u=String.fromCharCode(Y),R):n(Y)}function S(Y){return Y===45?(e.consume(Y),a=2,w):Y===91?(e.consume(Y),a=5,d=0,A):ta(Y)?(e.consume(Y),a=4,r.interrupt?t:B):n(Y)}function w(Y){return Y===45?(e.consume(Y),r.interrupt?t:B):n(Y)}function A(Y){const he="CDATA[";return Y===he.charCodeAt(d++)?(e.consume(Y),d===he.length?r.interrupt?t:ee:A):n(Y)}function E(Y){return ta(Y)?(e.consume(Y),u=String.fromCharCode(Y),R):n(Y)}function R(Y){if(Y===null||Y===47||Y===62||wn(Y)){const he=Y===47,Te=u.toLowerCase();return!he&&!l&&iz.includes(Te)?(a=1,r.interrupt?t(Y):ee(Y)):E0e.includes(u.toLowerCase())?(a=6,he?(e.consume(Y),k):r.interrupt?t(Y):ee(Y)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(Y):l?D(Y):M(Y))}return Y===45||Do(Y)?(e.consume(Y),u+=String.fromCharCode(Y),R):n(Y)}function k(Y){return Y===62?(e.consume(Y),r.interrupt?t:ee):n(Y)}function D(Y){return Pt(Y)?(e.consume(Y),D):j(Y)}function M(Y){return Y===47?(e.consume(Y),j):Y===58||Y===95||ta(Y)?(e.consume(Y),I):Pt(Y)?(e.consume(Y),M):j(Y)}function I(Y){return Y===45||Y===46||Y===58||Y===95||Do(Y)?(e.consume(Y),I):L(Y)}function L(Y){return Y===61?(e.consume(Y),P):Pt(Y)?(e.consume(Y),L):M(Y)}function P(Y){return Y===null||Y===60||Y===61||Y===62||Y===96?n(Y):Y===34||Y===39?(e.consume(Y),h=Y,G):Pt(Y)?(e.consume(Y),P):$(Y)}function G(Y){return Y===h?(e.consume(Y),h=null,Z):Y===null||ht(Y)?n(Y):(e.consume(Y),G)}function $(Y){return Y===null||Y===34||Y===39||Y===47||Y===60||Y===61||Y===62||Y===96||wn(Y)?L(Y):(e.consume(Y),$)}function Z(Y){return Y===47||Y===62||Pt(Y)?M(Y):n(Y)}function j(Y){return Y===62?(e.consume(Y),X):n(Y)}function X(Y){return Y===null||ht(Y)?ee(Y):Pt(Y)?(e.consume(Y),X):n(Y)}function ee(Y){return Y===45&&a===2?(e.consume(Y),V):Y===60&&a===1?(e.consume(Y),W):Y===62&&a===4?(e.consume(Y),oe):Y===63&&a===3?(e.consume(Y),B):Y===93&&a===5?(e.consume(Y),ne):ht(Y)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(_0e,se,ae)(Y)):Y===null||ht(Y)?(e.exit("htmlFlowData"),ae(Y)):(e.consume(Y),ee)}function ae(Y){return e.check(A0e,U,se)(Y)}function U(Y){return e.enter("lineEnding"),e.consume(Y),e.exit("lineEnding"),te}function te(Y){return Y===null||ht(Y)?ae(Y):(e.enter("htmlFlowData"),ee(Y))}function V(Y){return Y===45?(e.consume(Y),B):ee(Y)}function W(Y){return Y===47?(e.consume(Y),u="",J):ee(Y)}function J(Y){if(Y===62){const he=u.toLowerCase();return iz.includes(he)?(e.consume(Y),oe):ee(Y)}return ta(Y)&&u.length<8?(e.consume(Y),u+=String.fromCharCode(Y),J):ee(Y)}function ne(Y){return Y===93?(e.consume(Y),B):ee(Y)}function B(Y){return Y===62?(e.consume(Y),oe):Y===45&&a===2?(e.consume(Y),B):ee(Y)}function oe(Y){return Y===null||ht(Y)?(e.exit("htmlFlowData"),se(Y)):(e.consume(Y),oe)}function se(Y){return e.exit("htmlFlow"),t(Y)}}function k0e(e,t,n){const r=this;return a;function a(u){return ht(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function O0e(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Fx,t,n)}}const M0e={name:"htmlText",tokenize:N0e};function N0e(e,t,n){const r=this;let a,l,u;return d;function d(B){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(B),h}function h(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),L):B===63?(e.consume(B),M):ta(B)?(e.consume(B),$):n(B)}function m(B){return B===45?(e.consume(B),y):B===91?(e.consume(B),l=0,A):ta(B)?(e.consume(B),D):n(B)}function y(B){return B===45?(e.consume(B),w):n(B)}function v(B){return B===null?n(B):B===45?(e.consume(B),S):ht(B)?(u=v,W(B)):(e.consume(B),v)}function S(B){return B===45?(e.consume(B),w):v(B)}function w(B){return B===62?V(B):B===45?S(B):v(B)}function A(B){const oe="CDATA[";return B===oe.charCodeAt(l++)?(e.consume(B),l===oe.length?E:A):n(B)}function E(B){return B===null?n(B):B===93?(e.consume(B),R):ht(B)?(u=E,W(B)):(e.consume(B),E)}function R(B){return B===93?(e.consume(B),k):E(B)}function k(B){return B===62?V(B):B===93?(e.consume(B),k):E(B)}function D(B){return B===null||B===62?V(B):ht(B)?(u=D,W(B)):(e.consume(B),D)}function M(B){return B===null?n(B):B===63?(e.consume(B),I):ht(B)?(u=M,W(B)):(e.consume(B),M)}function I(B){return B===62?V(B):M(B)}function L(B){return ta(B)?(e.consume(B),P):n(B)}function P(B){return B===45||Do(B)?(e.consume(B),P):G(B)}function G(B){return ht(B)?(u=G,W(B)):Pt(B)?(e.consume(B),G):V(B)}function $(B){return B===45||Do(B)?(e.consume(B),$):B===47||B===62||wn(B)?Z(B):n(B)}function Z(B){return B===47?(e.consume(B),V):B===58||B===95||ta(B)?(e.consume(B),j):ht(B)?(u=Z,W(B)):Pt(B)?(e.consume(B),Z):V(B)}function j(B){return B===45||B===46||B===58||B===95||Do(B)?(e.consume(B),j):X(B)}function X(B){return B===61?(e.consume(B),ee):ht(B)?(u=X,W(B)):Pt(B)?(e.consume(B),X):Z(B)}function ee(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),a=B,ae):ht(B)?(u=ee,W(B)):Pt(B)?(e.consume(B),ee):(e.consume(B),U)}function ae(B){return B===a?(e.consume(B),a=void 0,te):B===null?n(B):ht(B)?(u=ae,W(B)):(e.consume(B),ae)}function U(B){return B===null||B===34||B===39||B===60||B===61||B===96?n(B):B===47||B===62||wn(B)?Z(B):(e.consume(B),U)}function te(B){return B===47||B===62||wn(B)?Z(B):n(B)}function V(B){return B===62?(e.consume(B),e.exit("htmlTextData"),e.exit("htmlText"),t):n(B)}function W(B){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),J}function J(B){return Pt(B)?Yt(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):ne(B)}function ne(B){return e.enter("htmlTextData"),u(B)}}const gM={name:"labelEnd",resolveAll:j0e,resolveTo:B0e,tokenize:L0e},D0e={tokenize:P0e},I0e={tokenize:H0e},z0e={tokenize:V0e};function j0e(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&ai(e,0,e.length,n),e}function B0e(e,t){let n=e.length,r=0,a,l,u,d;for(;n--;)if(a=e[n][1],l){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(l=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(u=n);const h={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[l][1].start},end:{...e[u][1].end}},y={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",h,t],["enter",m,t]],d=cl(d,e.slice(l+1,l+r+3)),d=cl(d,[["enter",y,t]]),d=cl(d,UC(t.parser.constructs.insideSpan.null,e.slice(l+r+4,u-3),t)),d=cl(d,[["exit",y,t],e[u-2],e[u-1],["exit",m,t]]),d=cl(d,e.slice(u+1)),d=cl(d,[["exit",h,t]]),ai(e,l,e.length,d),e}function L0e(e,t,n){const r=this;let a=r.events.length,l,u;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){l=r.events[a][1];break}return d;function d(S){return l?l._inactive?v(S):(u=r.parser.defined.includes(es(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),h):n(S)}function h(S){return S===40?e.attempt(D0e,y,u?y:v)(S):S===91?e.attempt(I0e,y,u?m:v)(S):u?y(S):v(S)}function m(S){return e.attempt(z0e,y,v)(S)}function y(S){return t(S)}function v(S){return l._balanced=!0,n(S)}}function P0e(e,t,n){return r;function r(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return wn(v)?L1(e,l)(v):l(v)}function l(v){return v===41?y(v):u8(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return wn(v)?L1(e,h)(v):y(v)}function d(v){return n(v)}function h(v){return v===34||v===39||v===40?f8(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):y(v)}function m(v){return wn(v)?L1(e,y)(v):y(v)}function y(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function H0e(e,t,n){const r=this;return a;function a(d){return c8.call(r,e,l,u,"reference","referenceMarker","referenceString")(d)}function l(d){return r.parser.defined.includes(es(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function V0e(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),a}function a(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const F0e={name:"labelStartImage",resolveAll:gM.resolveAll,tokenize:G0e};function G0e(e,t,n){const r=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const U0e={name:"labelStartLink",resolveAll:gM.resolveAll,tokenize:$0e};function $0e(e,t,n){const r=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const bT={name:"lineEnding",tokenize:X0e};function X0e(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Yt(e,t,"linePrefix")}}const B2={name:"thematicBreak",tokenize:Y0e};function Y0e(e,t,n){let r=0,a;return l;function l(m){return e.enter("thematicBreak"),u(m)}function u(m){return a=m,d(m)}function d(m){return m===a?(e.enter("thematicBreakSequence"),h(m)):r>=3&&(m===null||ht(m))?(e.exit("thematicBreak"),t(m)):n(m)}function h(m){return m===a?(e.consume(m),r++,h):(e.exit("thematicBreakSequence"),Pt(m)?Yt(e,d,"whitespace")(m):d(m))}}const Ca={continuation:{tokenize:J0e},exit:K0e,name:"list",tokenize:q0e},Z0e={partial:!0,tokenize:eve},W0e={partial:!0,tokenize:Q0e};function q0e(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return d;function d(w){const A=r.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(A==="listUnordered"?!r.containerState.marker||w===r.containerState.marker:ZR(w)){if(r.containerState.type||(r.containerState.type=A,e.enter(A,{_container:!0})),A==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(B2,n,m)(w):m(w);if(!r.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(w)}return n(w)}function h(w){return ZR(w)&&++u<10?(e.consume(w),h):(!r.interrupt||u<2)&&(r.containerState.marker?w===r.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),m(w)):n(w)}function m(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||w,e.check(Fx,r.interrupt?n:y,e.attempt(Z0e,S,v))}function y(w){return r.containerState.initialBlankLine=!0,l++,S(w)}function v(w){return Pt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),S):n(w)}function S(w){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function J0e(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Fx,a,l);function a(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Yt(e,t,"listItemIndent",r.containerState.size+1)(d)}function l(d){return r.containerState.furtherBlankLines||!Pt(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(W0e,t,u)(d))}function u(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,Yt(e,e.attempt(Ca,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function Q0e(e,t,n){const r=this;return Yt(e,a,"listItemIndent",r.containerState.size+1);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function K0e(e){e.exit(this.containerState.type)}function eve(e,t,n){const r=this;return Yt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const u=r.events[r.events.length-1];return!Pt(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const lz={name:"setextUnderline",resolveTo:tve,tokenize:nve};function tve(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",u,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function nve(e,t,n){const r=this;let a;return l;function l(m){let y=r.events.length,v;for(;y--;)if(r.events[y][1].type!=="lineEnding"&&r.events[y][1].type!=="linePrefix"&&r.events[y][1].type!=="content"){v=r.events[y][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||v)?(e.enter("setextHeadingLine"),a=m,u(m)):n(m)}function u(m){return e.enter("setextHeadingLineSequence"),d(m)}function d(m){return m===a?(e.consume(m),d):(e.exit("setextHeadingLineSequence"),Pt(m)?Yt(e,h,"lineSuffix")(m):h(m))}function h(m){return m===null||ht(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const rve={tokenize:ove};function ove(e){const t=this,n=e.attempt(Fx,r,e.attempt(this.parser.constructs.flowInitial,a,Yt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(u0e,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ave={resolveAll:h8()},ive=d8("string"),lve=d8("text");function d8(e){return{resolveAll:h8(e==="text"?sve:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,u,d);return u;function u(y){return m(y)?l(y):d(y)}function d(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),h}function h(y){return m(y)?(n.exit("data"),l(y)):(n.consume(y),h)}function m(y){if(y===null)return!0;const v=a[y];let S=-1;if(v)for(;++S<v.length;){const w=v[S];if(!w.previous||w.previous.call(r,r.previous))return!0}return!1}}}function h8(e){return t;function t(n,r){let a=-1,l;for(;++a<=n.length;)l===void 0?n[a]&&n[a][1].type==="data"&&(l=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==l+2&&(n[l][1].end=n[a-1][1].end,n.splice(l+2,a-l-2),a=l+2),l=void 0);return e?e(n,r):n}}function sve(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let l=a.length,u=-1,d=0,h;for(;l--;){const m=a[l];if(typeof m=="string"){for(u=m.length;m.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(m===-2)h=!0,d++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const m={type:n===e.length||h||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:r.start._bufferIndex+u,_index:r.start._index+l,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...m.start},r.start.offset===r.end.offset?Object.assign(r,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const uve={42:Ca,43:Ca,45:Ca,48:Ca,49:Ca,50:Ca,51:Ca,52:Ca,53:Ca,54:Ca,55:Ca,56:Ca,57:Ca,62:a8},cve={91:p0e},fve={[-2]:vT,[-1]:vT,32:vT},dve={35:x0e,42:B2,45:[lz,B2],60:C0e,61:lz,95:B2,96:az,126:az},hve={38:l8,92:i8},pve={[-5]:bT,[-4]:bT,[-3]:bT,33:F0e,38:l8,42:WR,60:[Uye,M0e],91:U0e,92:[v0e,i8],93:gM,95:WR,96:r0e},mve={null:[WR,ave]},gve={null:[42,95]},yve={null:[]},vve=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gve,contentInitial:cve,disable:yve,document:uve,flow:dve,flowInitial:fve,insideSpan:mve,string:hve,text:pve},Symbol.toStringTag,{value:"Module"}));function bve(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},l=[];let u=[],d=[];const h={attempt:G(L),check:G(P),consume:D,enter:M,exit:I,interrupt:G(P,{interrupt:!0})},m={code:null,containerState:{},defineSkip:E,events:[],now:A,parser:e,previous:null,sliceSerialize:S,sliceStream:w,write:v};let y=t.tokenize.call(m,h);return t.resolveAll&&l.push(t),m;function v(X){return u=cl(u,X),R(),u[u.length-1]!==null?[]:($(t,0),m.events=UC(l,m.events,m),m.events)}function S(X,ee){return Sve(w(X),ee)}function w(X){return xve(u,X)}function A(){const{_bufferIndex:X,_index:ee,line:ae,column:U,offset:te}=r;return{_bufferIndex:X,_index:ee,line:ae,column:U,offset:te}}function E(X){a[X.line]=X.column,j()}function R(){let X;for(;r._index<u.length;){const ee=u[r._index];if(typeof ee=="string")for(X=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===X&&r._bufferIndex<ee.length;)k(ee.charCodeAt(r._bufferIndex));else k(ee)}}function k(X){y=y(X)}function D(X){ht(X)?(r.line++,r.column=1,r.offset+=X===-3?2:1,j()):X!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),m.previous=X}function M(X,ee){const ae=ee||{};return ae.type=X,ae.start=A(),m.events.push(["enter",ae,m]),d.push(ae),ae}function I(X){const ee=d.pop();return ee.end=A(),m.events.push(["exit",ee,m]),ee}function L(X,ee){$(X,ee.from)}function P(X,ee){ee.restore()}function G(X,ee){return ae;function ae(U,te,V){let W,J,ne,B;return Array.isArray(U)?se(U):"tokenize"in U?se([U]):oe(U);function oe(me){return Ee;function Ee(xe){const Be=xe!==null&&me[xe],He=xe!==null&&me.null,Ye=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(He)?He:He?[He]:[]];return se(Ye)(xe)}}function se(me){return W=me,J=0,me.length===0?V:Y(me[J])}function Y(me){return Ee;function Ee(xe){return B=Z(),ne=me,me.partial||(m.currentConstruct=me),me.name&&m.parser.constructs.disable.null.includes(me.name)?Te():me.tokenize.call(ee?Object.assign(Object.create(m),ee):m,h,he,Te)(xe)}}function he(me){return X(ne,B),te}function Te(me){return B.restore(),++J<W.length?Y(W[J]):V}}}function $(X,ee){X.resolveAll&&!l.includes(X)&&l.push(X),X.resolve&&ai(m.events,ee,m.events.length-ee,X.resolve(m.events.slice(ee),m)),X.resolveTo&&(m.events=X.resolveTo(m.events,m))}function Z(){const X=A(),ee=m.previous,ae=m.currentConstruct,U=m.events.length,te=Array.from(d);return{from:U,restore:V};function V(){r=X,m.previous=ee,m.currentConstruct=ae,m.events.length=U,d=te,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function xve(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,l=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(r,l)];else{if(u=e.slice(n,a),r>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(r):u.shift()}l>0&&u.push(e[a].slice(0,l))}return u}function Sve(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const l=e[n];let u;if(typeof l=="string")u=l;else switch(l){case-5:{u="\r";break}case-4:{u=`
|
|
1087
1087
|
`;break}case-3:{u=`\r
|
|
1088
1088
|
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(l)}a=l===-2,r.push(u)}return r.join("")}function wve(e){const r={constructs:r8([vve,...(e||{}).extensions||[]]),content:a(Bye),defined:[],document:a(Pye),flow:a(rve),lazy:{},string:a(ive),text:a(lve)};return r;function a(l){return u;function u(d){return bve(r,l,d)}}}function Eve(e){for(;!s8(e););return e}const sz=/[\0\t\n\r]/g;function Cve(){let e=1,t="",n=!0,r;return a;function a(l,u,d){const h=[];let m,y,v,S,w;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(u||void 0).decode(l)),v=0,t="",n&&(l.charCodeAt(0)===65279&&v++,n=void 0);v<l.length;){if(sz.lastIndex=v,m=sz.exec(l),S=m&&m.index!==void 0?m.index:l.length,w=l.charCodeAt(S),!m){t=l.slice(v);break}if(w===10&&v===S&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),v<S&&(h.push(l.slice(v,S)),e+=S-v),w){case 0:{h.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,h.push(-2);e++<y;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}v=S+1}return d&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const _ve=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ave(e){return e.replace(_ve,Tve)}function Tve(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return o8(n.slice(l?2:1),l?16:10)}return mM(n)||e}const p8={}.hasOwnProperty;function Rve(e,t,n){return typeof t!="string"&&(n=t,t=void 0),kve(n)(Eve(wve(n).document().write(Cve()(e,t,!0))))}function kve(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(ra),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:l(_t),blockQuote:l(He),characterEscape:Z,characterReference:Z,codeFenced:l(Ye),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(Ye,u),codeText:l(ke,u),codeTextData:Z,data:Z,codeFlowValue:Z,definition:l(Xe),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(We),hardBreakEscape:l(Kt),hardBreakTrailing:l(Kt),htmlFlow:l(Wt,u),htmlFlowData:Z,htmlText:l(Wt,u),htmlTextData:Z,image:l(qn),label:u,link:l(ra),listItem:l(fo),listItemValue:S,listOrdered:l(co,v),listUnordered:l(co),paragraph:l(ut),reference:Y,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(_t),strong:l(ho),thematicBreak:l(ml)},exit:{atxHeading:h(),atxHeadingSequence:L,autolink:h(),autolinkEmail:Be,autolinkProtocol:xe,blockQuote:h(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:me,characterReference:Ee,codeFenced:h(R),codeFencedFence:E,codeFencedFenceInfo:w,codeFencedFenceMeta:A,codeFlowValue:j,codeIndented:h(k),codeText:h(te),codeTextData:j,data:j,definition:h(),definitionDestinationString:I,definitionLabelString:D,definitionTitleString:M,emphasis:h(),hardBreakEscape:h(ee),hardBreakTrailing:h(ee),htmlFlow:h(ae),htmlFlowData:j,htmlText:h(U),htmlTextData:j,image:h(W),label:ne,labelText:J,lineEnding:X,link:h(V),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:he,resourceDestinationString:B,resourceTitleString:oe,resource:se,setextHeading:h($),setextHeadingLineSequence:G,setextHeadingText:P,strong:h(),thematicBreak:h()}};m8(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Oe){let Le={type:"root",children:[]};const tt={stack:[Le],tokenStack:[],config:t,enter:d,exit:m,buffer:u,resume:y,data:n},lt=[];let jt=-1;for(;++jt<Oe.length;)if(Oe[jt][1].type==="listOrdered"||Oe[jt][1].type==="listUnordered")if(Oe[jt][0]==="enter")lt.push(jt);else{const Ur=lt.pop();jt=a(Oe,Ur,jt)}for(jt=-1;++jt<Oe.length;){const Ur=t[Oe[jt][0]];p8.call(Ur,Oe[jt][1].type)&&Ur[Oe[jt][1].type].call(Object.assign({sliceSerialize:Oe[jt][2].sliceSerialize},tt),Oe[jt][1])}if(tt.tokenStack.length>0){const Ur=tt.tokenStack[tt.tokenStack.length-1];(Ur[1]||uz).call(tt,void 0,Ur[0])}for(Le.position={start:Ed(Oe.length>0?Oe[0][1].start:{line:1,column:1,offset:0}),end:Ed(Oe.length>0?Oe[Oe.length-2][1].end:{line:1,column:1,offset:0})},jt=-1;++jt<t.transforms.length;)Le=t.transforms[jt](Le)||Le;return Le}function a(Oe,Le,tt){let lt=Le-1,jt=-1,Ur=!1,Na,mr,kr,$n;for(;++lt<=tt;){const Cn=Oe[lt];switch(Cn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Cn[0]==="enter"?jt++:jt--,$n=void 0;break}case"lineEndingBlank":{Cn[0]==="enter"&&(Na&&!$n&&!jt&&!kr&&(kr=lt),$n=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$n=void 0}if(!jt&&Cn[0]==="enter"&&Cn[1].type==="listItemPrefix"||jt===-1&&Cn[0]==="exit"&&(Cn[1].type==="listUnordered"||Cn[1].type==="listOrdered")){if(Na){let or=lt;for(mr=void 0;or--;){const en=Oe[or];if(en[1].type==="lineEnding"||en[1].type==="lineEndingBlank"){if(en[0]==="exit")continue;mr&&(Oe[mr][1].type="lineEndingBlank",Ur=!0),en[1].type="lineEnding",mr=or}else if(!(en[1].type==="linePrefix"||en[1].type==="blockQuotePrefix"||en[1].type==="blockQuotePrefixWhitespace"||en[1].type==="blockQuoteMarker"||en[1].type==="listItemIndent"))break}kr&&(!mr||kr<mr)&&(Na._spread=!0),Na.end=Object.assign({},mr?Oe[mr][1].start:Cn[1].end),Oe.splice(mr||lt,0,["exit",Na,Cn[2]]),lt++,tt++}if(Cn[1].type==="listItemPrefix"){const or={type:"listItem",_spread:!1,start:Object.assign({},Cn[1].start),end:void 0};Na=or,Oe.splice(lt,0,["enter",or,Cn[2]]),lt++,tt++,kr=void 0,$n=!0}}}return Oe[Le][1]._spread=Ur,tt}function l(Oe,Le){return tt;function tt(lt){d.call(this,Oe(lt),lt),Le&&Le.call(this,lt)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(Oe,Le,tt){this.stack[this.stack.length-1].children.push(Oe),this.stack.push(Oe),this.tokenStack.push([Le,tt||void 0]),Oe.position={start:Ed(Le.start),end:void 0}}function h(Oe){return Le;function Le(tt){Oe&&Oe.call(this,tt),m.call(this,tt)}}function m(Oe,Le){const tt=this.stack.pop(),lt=this.tokenStack.pop();if(lt)lt[0].type!==Oe.type&&(Le?Le.call(this,Oe,lt[0]):(lt[1]||uz).call(this,Oe,lt[0]));else throw new Error("Cannot close `"+Oe.type+"` ("+B1({start:Oe.start,end:Oe.end})+"): it’s not open");tt.position.end=Ed(Oe.end)}function y(){return pM(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function S(Oe){if(this.data.expectingFirstListItemValue){const Le=this.stack[this.stack.length-2];Le.start=Number.parseInt(this.sliceSerialize(Oe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.lang=Oe}function A(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.meta=Oe}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function R(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe.replace(/(\r?\n|\r)$/g,"")}function D(Oe){const Le=this.resume(),tt=this.stack[this.stack.length-1];tt.label=Le,tt.identifier=es(this.sliceSerialize(Oe)).toLowerCase()}function M(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.title=Oe}function I(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.url=Oe}function L(Oe){const Le=this.stack[this.stack.length-1];if(!Le.depth){const tt=this.sliceSerialize(Oe).length;Le.depth=tt}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function G(Oe){const Le=this.stack[this.stack.length-1];Le.depth=this.sliceSerialize(Oe).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(Oe){const tt=this.stack[this.stack.length-1].children;let lt=tt[tt.length-1];(!lt||lt.type!=="text")&&(lt=Eu(),lt.position={start:Ed(Oe.start),end:void 0},tt.push(lt)),this.stack.push(lt)}function j(Oe){const Le=this.stack.pop();Le.value+=this.sliceSerialize(Oe),Le.position.end=Ed(Oe.end)}function X(Oe){const Le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const tt=Le.children[Le.children.length-1];tt.position.end=Ed(Oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Le.type)&&(Z.call(this,Oe),j.call(this,Oe))}function ee(){this.data.atHardBreak=!0}function ae(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe}function U(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe}function te(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe}function V(){const Oe=this.stack[this.stack.length-1];if(this.data.inReference){const Le=this.data.referenceType||"shortcut";Oe.type+="Reference",Oe.referenceType=Le,delete Oe.url,delete Oe.title}else delete Oe.identifier,delete Oe.label;this.data.referenceType=void 0}function W(){const Oe=this.stack[this.stack.length-1];if(this.data.inReference){const Le=this.data.referenceType||"shortcut";Oe.type+="Reference",Oe.referenceType=Le,delete Oe.url,delete Oe.title}else delete Oe.identifier,delete Oe.label;this.data.referenceType=void 0}function J(Oe){const Le=this.sliceSerialize(Oe),tt=this.stack[this.stack.length-2];tt.label=Ave(Le),tt.identifier=es(Le).toLowerCase()}function ne(){const Oe=this.stack[this.stack.length-1],Le=this.resume(),tt=this.stack[this.stack.length-1];if(this.data.inReference=!0,tt.type==="link"){const lt=Oe.children;tt.children=lt}else tt.alt=Le}function B(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.url=Oe}function oe(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.title=Oe}function se(){this.data.inReference=void 0}function Y(){this.data.referenceType="collapsed"}function he(Oe){const Le=this.resume(),tt=this.stack[this.stack.length-1];tt.label=Le,tt.identifier=es(this.sliceSerialize(Oe)).toLowerCase(),this.data.referenceType="full"}function Te(Oe){this.data.characterReferenceType=Oe.type}function me(Oe){const Le=this.sliceSerialize(Oe),tt=this.data.characterReferenceType;let lt;tt?(lt=o8(Le,tt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):lt=mM(Le);const jt=this.stack[this.stack.length-1];jt.value+=lt}function Ee(Oe){const Le=this.stack.pop();Le.position.end=Ed(Oe.end)}function xe(Oe){j.call(this,Oe);const Le=this.stack[this.stack.length-1];Le.url=this.sliceSerialize(Oe)}function Be(Oe){j.call(this,Oe);const Le=this.stack[this.stack.length-1];Le.url="mailto:"+this.sliceSerialize(Oe)}function He(){return{type:"blockquote",children:[]}}function Ye(){return{type:"code",lang:null,meta:null,value:""}}function ke(){return{type:"inlineCode",value:""}}function Xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function We(){return{type:"emphasis",children:[]}}function _t(){return{type:"heading",depth:0,children:[]}}function Kt(){return{type:"break"}}function Wt(){return{type:"html",value:""}}function qn(){return{type:"image",title:null,url:"",alt:null}}function ra(){return{type:"link",title:null,url:"",children:[]}}function co(Oe){return{type:"list",ordered:Oe.type==="listOrdered",start:null,spread:Oe._spread,children:[]}}function fo(Oe){return{type:"listItem",spread:Oe._spread,checked:null,children:[]}}function ut(){return{type:"paragraph",children:[]}}function ho(){return{type:"strong",children:[]}}function Eu(){return{type:"text",value:""}}function ml(){return{type:"thematicBreak"}}}function Ed(e){return{line:e.line,column:e.column,offset:e.offset}}function m8(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?m8(e,r):Ove(e,r)}}function Ove(e,t){let n;for(n in t)if(p8.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function uz(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+B1({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+B1({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+B1({start:t.start,end:t.end})+") is still open")}function Mve(e){const t=this;t.parser=n;function n(r){return Rve(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Nve(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Dve(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -1112,7 +1112,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1112
1112
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:S,table:u,tableCell:h,tableRow:d}};function u(w,A,E,R){return m(y(w,E,R),w.align)}function d(w,A,E,R){const k=v(w,E,R),D=m([k]);return D.slice(0,D.indexOf(`
|
|
1113
1113
|
`))}function h(w,A,E,R){const k=E.enter("tableCell"),D=E.enter("phrasing"),M=E.containerPhrasing(w,{...R,before:l,after:l});return D(),k(),M}function m(w,A){return B1e(w,{align:A,alignDelimiters:r,padding:n,stringLength:a})}function y(w,A,E){const R=w.children;let k=-1;const D=[],M=A.enter("table");for(;++k<R.length;)D[k]=v(R[k],A,E);return M(),D}function v(w,A,E){const R=w.children;let k=-1;const D=[],M=A.enter("tableRow");for(;++k<R.length;)D[k]=h(R[k],w,A,E);return M(),D}function S(w,A,E){let R=L8.inlineCode(w,A,E);return E.stack.includes("tableCell")&&(R=R.replace(/\|/g,"\\$&")),R}}function Cxe(){return{exit:{taskListCheckValueChecked:Oz,taskListCheckValueUnchecked:Oz,paragraph:Axe}}}function _xe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Txe}}}function Oz(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Axe(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let l=-1,u;for(;++l<a.length;){const d=a[l];if(d.type==="paragraph"){u=d;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Txe(e,t,n,r){const a=e.children[0],l=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);l&&d.move(u);let h=L8.listItem(e,t,n,{...r,...d.current()});return l&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),h;function m(y){return y+u}}function Rxe(){return[i1e(),T1e(),M1e(),yxe(),Cxe()]}function kxe(e){return{extensions:[l1e(),R1e(e),N1e(),Exe(e),_xe()]}}const Oxe={tokenize:jxe,partial:!0},P8={tokenize:Bxe,partial:!0},H8={tokenize:Lxe,partial:!0},V8={tokenize:Pxe,partial:!0},Mxe={tokenize:Hxe,partial:!0},F8={name:"wwwAutolink",tokenize:Ixe,previous:U8},G8={name:"protocolAutolink",tokenize:zxe,previous:$8},nf={name:"emailAutolink",tokenize:Dxe,previous:X8},wu={};function Nxe(){return{text:wu}}let Cp=48;for(;Cp<123;)wu[Cp]=nf,Cp++,Cp===58?Cp=65:Cp===91&&(Cp=97);wu[43]=nf;wu[45]=nf;wu[46]=nf;wu[95]=nf;wu[72]=[nf,G8];wu[104]=[nf,G8];wu[87]=[nf,F8];wu[119]=[nf,F8];function Dxe(e,t,n){const r=this;let a,l;return u;function u(v){return!ek(v)||!X8.call(r,r.previous)||_M(r.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(v))}function d(v){return ek(v)?(e.consume(v),d):v===64?(e.consume(v),h):n(v)}function h(v){return v===46?e.check(Mxe,y,m)(v):v===45||v===95||Do(v)?(l=!0,e.consume(v),h):y(v)}function m(v){return e.consume(v),a=!0,h}function y(v){return l&&a&&ta(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function Ixe(e,t,n){const r=this;return a;function a(u){return u!==87&&u!==119||!U8.call(r,r.previous)||_M(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Oxe,e.attempt(P8,e.attempt(H8,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function zxe(e,t,n){const r=this;let a="",l=!1;return u;function u(v){return(v===72||v===104)&&$8.call(r,r.previous)&&!_M(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),d):n(v)}function d(v){if(ta(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),d;if(v===58){const S=a.toLowerCase();if(S==="http"||S==="https")return e.consume(v),h}return n(v)}function h(v){return v===47?(e.consume(v),l?m:(l=!0,h)):n(v)}function m(v){return v===null||_E(v)||wn(v)||Xp(v)||GC(v)?n(v):e.attempt(P8,e.attempt(H8,y),n)(v)}function y(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function jxe(e,t,n){let r=0;return a;function a(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),a):u===46&&r===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function Bxe(e,t,n){let r,a,l;return u;function u(m){return m===46||m===95?e.check(V8,h,d)(m):m===null||wn(m)||Xp(m)||m!==45&&GC(m)?h(m):(l=!0,e.consume(m),u)}function d(m){return m===95?r=!0:(a=r,r=void 0),e.consume(m),u}function h(m){return a||r||!l?n(m):t(m)}}function Lxe(e,t){let n=0,r=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&r<n?l(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(V8,t,l)(u):u===null||wn(u)||Xp(u)?t(u):(e.consume(u),a)}function l(u){return u===41&&r++,e.consume(u),a}}function Pxe(e,t,n){return r;function r(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),r):d===38?(e.consume(d),l):d===93?(e.consume(d),a):d===60||d===null||wn(d)||Xp(d)?t(d):n(d)}function a(d){return d===null||d===40||d===91||wn(d)||Xp(d)?t(d):r(d)}function l(d){return ta(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),r):ta(d)?(e.consume(d),u):n(d)}}function Hxe(e,t,n){return r;function r(l){return e.consume(l),a}function a(l){return Do(l)?n(l):t(l)}}function U8(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||wn(e)}function $8(e){return!ta(e)}function X8(e){return!(e===47||ek(e))}function ek(e){return e===43||e===45||e===46||e===95||Do(e)}function _M(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Vxe={tokenize:Wxe,partial:!0};function Fxe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Xxe,continuation:{tokenize:Yxe},exit:Zxe}},text:{91:{name:"gfmFootnoteCall",tokenize:$xe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Gxe,resolveTo:Uxe}}}}function Gxe(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const h=r.events[a][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return d;function d(h){if(!u||!u._balanced)return n(h);const m=es(r.sliceSerialize({start:u.end,end:r.now()}));return m.codePointAt(0)!==94||!l.includes(m.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function Uxe(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...d),e}function $xe(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,u;return d;function d(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),h}function h(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(v){if(l>999||v===93&&!u||v===null||v===91||wn(v))return n(v);if(v===93){e.exit("chunkString");const S=e.exit("gfmFootnoteCallString");return a.includes(es(r.sliceSerialize(S)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return wn(v)||(u=!0),l++,e.consume(v),v===92?y:m}function y(v){return v===91||v===92||v===93?(e.consume(v),l++,m):m(v)}}function Xxe(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,u=0,d;return h;function h(A){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(A),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(A){return A===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(A),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(A)}function y(A){if(u>999||A===93&&!d||A===null||A===91||wn(A))return n(A);if(A===93){e.exit("chunkString");const E=e.exit("gfmFootnoteDefinitionLabelString");return l=es(r.sliceSerialize(E)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(A),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return wn(A)||(d=!0),u++,e.consume(A),A===92?v:y}function v(A){return A===91||A===92||A===93?(e.consume(A),u++,y):y(A)}function S(A){return A===58?(e.enter("definitionMarker"),e.consume(A),e.exit("definitionMarker"),a.includes(l)||a.push(l),Yt(e,w,"gfmFootnoteDefinitionWhitespace")):n(A)}function w(A){return t(A)}}function Yxe(e,t,n){return e.check(Fx,t,e.attempt(Vxe,t,n))}function Zxe(e){e.exit("gfmFootnoteDefinition")}function Wxe(e,t,n){const r=this;return Yt(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function qxe(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,d){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let m=h;for(;m--;)if(u[m][0]==="exit"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[m][1].end.offset-u[m][1].start.offset){u[h][1].type="strikethroughSequence",u[m][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},u[m][1].start),end:Object.assign({},u[h][1].end)},v={type:"strikethroughText",start:Object.assign({},u[m][1].end),end:Object.assign({},u[h][1].start)},S=[["enter",y,d],["enter",u[m][1],d],["exit",u[m][1],d],["enter",v,d]],w=d.parser.constructs.insideSpan.null;w&&ai(S,S.length,0,UC(w,u.slice(m+1,h),d)),ai(S,S.length,0,[["exit",v,d],["enter",u[h][1],d],["exit",u[h][1],d],["exit",y,d]]),ai(u,m-1,h-m+3,S),h=m+S.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function l(u,d,h){const m=this.previous,y=this.events;let v=0;return S;function S(A){return m===126&&y[y.length-1][1].type!=="characterEscape"?h(A):(u.enter("strikethroughSequenceTemporary"),w(A))}function w(A){const E=u0(m);if(A===126)return v>1?h(A):(u.consume(A),v++,w);if(v<2&&!n)return h(A);const R=u.exit("strikethroughSequenceTemporary"),k=u0(A);return R._open=!k||k===2&&!!E,R._close=!E||E===2&&!!k,d(A)}}}class Jxe{constructor(){this.map=[]}add(t,n,r){Qxe(this,t,n,r)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function Qxe(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function Kxe(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function eSe(){return{flow:{null:{name:"table",tokenize:tSe,resolveAll:nSe}}}}function tSe(e,t,n){const r=this;let a=0,l=0,u;return d;function d(j){let X=r.events.length-1;for(;X>-1;){const U=r.events[X][1].type;if(U==="lineEnding"||U==="linePrefix")X--;else break}const ee=X>-1?r.events[X][1].type:null,ae=ee==="tableHead"||ee==="tableRow"?P:h;return ae===P&&r.parser.lazy[r.now().line]?n(j):ae(j)}function h(j){return e.enter("tableHead"),e.enter("tableRow"),m(j)}function m(j){return j===124||(u=!0,l+=1),y(j)}function y(j){return j===null?n(j):ht(j)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),w):n(j):Pt(j)?Yt(e,y,"whitespace")(j):(l+=1,u&&(u=!1,a+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),u=!0,y):(e.enter("data"),v(j)))}function v(j){return j===null||j===124||wn(j)?(e.exit("data"),y(j)):(e.consume(j),j===92?S:v)}function S(j){return j===92||j===124?(e.consume(j),v):v(j)}function w(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(j):(e.enter("tableDelimiterRow"),u=!1,Pt(j)?Yt(e,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):A(j))}function A(j){return j===45||j===58?R(j):j===124?(u=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),E):L(j)}function E(j){return Pt(j)?Yt(e,R,"whitespace")(j):R(j)}function R(j){return j===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),k):j===45?(l+=1,k(j)):j===null||ht(j)?I(j):L(j)}function k(j){return j===45?(e.enter("tableDelimiterFiller"),D(j)):L(j)}function D(j){return j===45?(e.consume(j),D):j===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),M):(e.exit("tableDelimiterFiller"),M(j))}function M(j){return Pt(j)?Yt(e,I,"whitespace")(j):I(j)}function I(j){return j===124?A(j):j===null||ht(j)?!u||a!==l?L(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):L(j)}function L(j){return n(j)}function P(j){return e.enter("tableRow"),G(j)}function G(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),G):j===null||ht(j)?(e.exit("tableRow"),t(j)):Pt(j)?Yt(e,G,"whitespace")(j):(e.enter("data"),$(j))}function $(j){return j===null||j===124||wn(j)?(e.exit("data"),G(j)):(e.consume(j),j===92?Z:$)}function Z(j){return j===92||j===124?(e.consume(j),$):$(j)}}function nSe(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],d=!1,h=0,m,y,v;const S=new Jxe;for(;++n<e.length;){const w=e[n],A=w[1];w[0]==="enter"?A.type==="tableHead"?(d=!1,h!==0&&(Mz(S,t,h,m,y),y=void 0,h=0),m={type:"table",start:Object.assign({},A.start),end:Object.assign({},A.end)},S.add(n,0,[["enter",m,t]])):A.type==="tableRow"||A.type==="tableDelimiterRow"?(r=!0,v=void 0,l=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,y={type:"tableBody",start:Object.assign({},A.start),end:Object.assign({},A.end)},S.add(n,0,[["enter",y,t]])),a=A.type==="tableDelimiterRow"?2:y?3:1):a&&(A.type==="data"||A.type==="tableDelimiterMarker"||A.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],v=m2(S,t,l,a,void 0,v),l=[0,0,0,0]),u[2]=n)):A.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(u[0]=u[1],v=m2(S,t,l,a,void 0,v)),l=u,u=[l[1],n,0,0])):A.type==="tableHead"?(d=!0,h=n):A.type==="tableRow"||A.type==="tableDelimiterRow"?(h=n,l[1]!==0?(u[0]=u[1],v=m2(S,t,l,a,n,v)):u[1]!==0&&(v=m2(S,t,u,a,n,v)),a=0):a&&(A.type==="data"||A.type==="tableDelimiterMarker"||A.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&Mz(S,t,h,m,y),S.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=Kxe(t.events,n))}return e}function m2(e,t,n,r,a,l){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(l.end=Object.assign({},Iy(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const h=Iy(t.events,n[1]);if(l={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const m=Iy(t.events,n[2]),y=Iy(t.events,n[3]),v={type:d,start:Object.assign({},m),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",v,t]]),r!==2){const S=t.events[n[2]],w=t.events[n[3]];if(S[1].end=Object.assign({},w[1].end),S[1].type="chunkText",S[1].contentType="text",n[3]>n[2]+1){const A=n[2]+1,E=n[3]-n[2]-1;e.add(A,E,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return a!==void 0&&(l.end=Object.assign({},Iy(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function Mz(e,t,n,r,a){const l=[],u=Iy(t.events,n);a&&(a.end=Object.assign({},u),l.push(["exit",a,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function Iy(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const rSe={name:"tasklistCheck",tokenize:aSe};function oSe(){return{text:{91:rSe}}}function aSe(e,t,n){const r=this;return a;function a(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),l)}function l(h){return wn(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(h)}function d(h){return ht(h)?t(h):Pt(h)?e.check({tokenize:iSe},t,n)(h):n(h)}}function iSe(e,t,n){return Yt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function lSe(e){return r8([Nxe(),Fxe(),qxe(e),eSe(),oSe()])}const sSe={};function uSe(e){const t=this,n=e||sSe,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(lSe(n)),l.push(Rxe()),u.push(kxe(n))}const AM=({availableModule:e})=>{const[t,n]=Q.useState(!1),r=()=>n(!t),a=150,l=e.description.length>a?e.description.substring(0,a)+"...":e.description;return T.jsxs("div",{className:"module-description",children:[T.jsx(qbe,{remarkPlugins:[uSe],children:t?e.description.replace(/\\n/g,`
|
|
1114
1114
|
`):l.replace(/\\n/g,`
|
|
1115
|
-
`)}),e.description.length>a&&T.jsx("button",{onClick:r,className:"toggle-description",children:t?"Show less":"Show more"})]})},Nz=[">=","==","<=","<",">"],ZC=">=",TM=({availableModule:e,on_change:t})=>{const[n,r]=Q.useState(e.version||"latest"),[a,l]=Q.useState(ZC),u=h=>{const m=h.target.value;r(m),t(m!=="latest"?a+m:m)},d=h=>{h.target.value!==a&&Nz.includes(h.target.value)&&(l(h.target.value),n!=="latest"&&t(h.target.value+n))};return e.releases&&!e.releases.includes(n)&&e.releases.unshift(n),T.jsxs(T.Fragment,{children:[T.jsx("select",{value:a,onChange:d,children:Nz.map(h=>T.jsx("option",{value:h,children:h},h))}),T.jsx("select",{onChange:u,value:n,children:e.releases&&e.releases.map(h=>T.jsx("option",{value:h,children:h},h))})]})},cSe=({availableModule:e,on_remove:t,on_update:n})=>{const[r,a]=Q.useState(ZC+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(lM,{availableModule:e}),T.jsx(AM,{availableModule:e}),T.jsxs("div",{children:[T.jsx(TM,{availableModule:e,on_change:a}),T.jsx("button",{className:"update-button",disabled:r===e.version,onClick:()=>{n(e,r)},children:"Update"}),T.jsx("button",{className:"remove-button",onClick:()=>{t(e)},children:"Remove"})]})]})},fSe=({availableModule:e,on_add:t})=>{const[n,r]=Q.useState(ZC+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(lM,{availableModule:e}),T.jsx(AM,{availableModule:e}),T.jsxs("div",{children:[T.jsx(TM,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},dSe=({availableModule:e,on_add:t})=>{const[n,r]=Q.useState(ZC+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name}),T.jsx(lM,{availableModule:e}),T.jsx(AM,{availableModule:e}),T.jsxs("div",{children:[T.jsx(TM,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},hSe=({ins:e})=>{const[t,n]=Q.useState(e.name),r=Qt(),{lib:a}=jo(),l=()=>{r.worker&&a?.remove_external_worker(e.uuid,e.nodeclassid)},u=()=>{r.worker&&(r.worker.update_external_worker(e.uuid,e.nodeclassid,{name:t}),e.name=t)};return T.jsx(T.Fragment,{children:T.jsx(Jc,{title:e.name,description:"Settings for"+e.name,trigger:T.jsx("div",{children:"Settings"}),buttons:[{text:"Save",onClick:u,close:!0},{text:"Delete",onClick:l,close:!0}],children:T.jsx("div",{children:T.jsxs("div",{children:[T.jsx("label",{htmlFor:"name",children:"Name: "}),T.jsx("input",{type:"text",name:"name",value:t,onChange:d=>n(d.target.value),className:"styledinput"})]})})})})},pSe=({ins:e,lib:t,filter:n="",parentkey:r})=>{const[a,l]=Q.useState(!1),u=()=>l(!a),d=t?.nodes?.filter(h=>h.node_id.toLowerCase().includes(n.toLowerCase()));return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:e.name,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",title:e.uuid,children:T.jsx(hSe,{ins:e})}),t&&T.jsxs(T.Fragment,{children:[d&&T.jsx(T.Fragment,{children:d.map(h=>T.jsx(VV,{item:h},r+h.node_id))}),t.subshelves.map(h=>T.jsx(iM,{item:h,filter:n,parentkey:r+h.name},r+h.name))]})]})})})]})},mSe=({item:e,mod:t,lib:n})=>{const{lib:r}=jo(),[a,l]=Q.useState(!1),u=()=>l(!a),d=z.useCallback(()=>{r?.add_external_worker({module:t,cls_module:e.module,cls_name:e.class_name})},[r,t,e]),h=y=>{y.detail===2&&d()},m=e.name||e.module+"."+e.class_name;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:m,children:[T.jsx("div",{className:"shelftitle_text",children:m}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",onClick:h,title:e.name,children:"New Instance"}),e.instances.map(y=>T.jsx(pSe,{ins:y,lib:n?.subshelves.find(v=>v.name===y.uuid),parentkey:y.uuid},y.uuid))]})})})]})},gSe=({externalworkermod:e,lib:t})=>{const[n,r]=Q.useState(!1),a=()=>r(!n),l=n;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:a,style:{cursor:"pointer"},title:e.module,children:[T.jsx("div",{className:"shelftitle_text",children:e.module}),T.jsx("div",{className:"expandicon "+(l?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(l?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:e.worker_classes.map(u=>T.jsx(mSe,{item:u,mod:e.module,lib:t},u.module+u.class_name))})}),T.jsx("hr",{})]})},ySe=()=>{const e=Qt(),t=e.lib.libstate(),n=Qt(),r=n.local_settings(m=>m.view_settings.expand_lib),a=m=>{n.update_view_settings({expand_lib:m})},l=gpe("m"),[u,d]=Q.useState(""),h=e.worker?.state(m=>m.is_open)??!1;return T.jsx(FO,{maxSize:l?"100%":"18.75rem",direction:l?"down":"right",containerClassName:"pos-left pos-top bg1 h-12",onExpandChange:a,expanded:r===void 0?!0:r,collapseIcons:{up:q2,down:Y1,left:X1,right:W2},expandIcons:{up:Y1,down:q2,left:W2,right:X1},children:T.jsxs("div",{className:"libcontainer",children:[T.jsxs("div",{className:"library",children:[T.jsx("div",{className:"libtitle",children:"Lib"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx(Lge,{filter:u,setFilter:d}),T.jsx("div",{className:"vscrollcontainer",children:t.lib.shelves.filter(m=>m.name!=="_external_worker").map(m=>T.jsx(iM,{item:m,filter:u,parentkey:m.name},m.name))}),T.jsx("hr",{}),T.jsx("div",{className:"libtitle",children:"External Worker"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx("div",{className:"vscrollcontainer",children:t.external_worker?.map(m=>T.jsx(gSe,{externalworkermod:m,lib:t.lib.shelves.find(y=>y.name==="_external_worker")},m.module))}),T.jsx("hr",{})]}),h&&T.jsx("div",{className:"addlib",children:T.jsx(Pge,{children:T.jsx("button",{children:"Manage Libraries"})})})]})})},vSe=({fnrf_zst:e,header:t,flow:n,library:r})=>{const[a,l]=Q.useState(e.options.worker),u=z.useRef(null);e.workermanager&&(e.workermanager.on_setWorker=l),e.set_worker(a),z.useEffect(()=>{e.auto_progress()},[]),z.useEffect(()=>{e.local_state.setState({funcnodescontainerRef:u.current})},[u]);const d=e.plugins();return T.jsx(rpe,{plugins:d,fnrf_zst:e,children:T.jsx(TQ,{children:T.jsx(s6.Provider,{value:e,children:T.jsx(kd,{asChild:!0,children:T.jsx(Ic,{asChild:!0,children:T.jsx(BH,{style:{height:"100%",width:"100%",display:"flex",flexDirection:"column",flex:1},children:T.jsxs("div",{ref:u,className:"funcnodesreactflowcontainer funcnodescontainer",children:[t.show&&T.jsx(Bge,{...t}),T.jsxs("div",{className:"funcnodesreactflowbody",children:[T.jsx(mme,{...n}),a&&r.show&&T.jsx(ySe,{}),a&&n.showNodeSettings&&T.jsx(Spe,{})]}),T.jsxs("div",{className:"funcnodesflaotingmenu",children:[T.jsx(Ic.OutFullScreen,{children:n.allowExpand&&T.jsxs(kd.Trigger,{children:[T.jsx(kd.Expanded,{children:T.jsx(yQ,{size:"xl",style:{padding:"4px"}})}),T.jsx(kd.Collapsed,{children:T.jsx(vQ,{size:"xl",style:{padding:"4px"}})})]})}),n.allowFullScreen&&T.jsxs(Ic.Trigger,{children:[T.jsx(Ic.OutFullScreen,{children:T.jsx(l6,{size:"xl",style:{padding:"4px"}})}),T.jsx(Ic.InFullScreen,{children:T.jsx(gQ,{size:"xl",style:{padding:"4px"}})})]})]})]})})})})})})})};class x0{constructor(t){this.context=t}get nodespaceManager(){return this.context.rf.getNodespaceManager()}get libManager(){return this.context.rf.getLibManager()}get workerManager(){return this.context.rf.getWorkerManager()}get stateManager(){return this.context.rf.getStateManager()}get pluginManager(){return this.context.rf.getPluginManager()}get reactFlowManager(){return this.context.rf.getReactFlowManager()}}const Dz=({src_nid:e,src_ioid:t,trg_nid:n,trg_ioid:r})=>[`${e}:${t}`,`${n}:${r}`].sort().join("--"),bSe=({})=>{const e=new Map;return{nodesstates:e,get_node:(t,n=!0)=>{const r=e.get(t);if(!r&&n){const a=e.keys();throw new Error(`Node ${t} not found, available nodes: ${Array.from(a)}`)}return r}}};class xSe extends x0{constructor(t){super(t),this.on_node_action=n=>{switch(n.type){case"add":return this._add_node(n);case"update":return this._update_node(n);case"delete":return this._delete_node(n);case"error":return this._error_action(n);case"trigger":return this._trigger_action(n);default:this.context.rf.logger.error("Unknown node action",n);return}},this.on_edge_action=n=>{const r=this.reactFlowManager.useReactFlowStore.getState();switch(n.type){case"add":if(n.from_remote){const a=r.getEdges(),l=Dz(n);if(a.some(d=>d.id===l))return;const u={id:l,source:n.src_nid,target:n.trg_nid,sourceHandle:n.src_ioid,targetHandle:n.trg_ioid,className:"funcnodes-edge animated",zIndex:1003};this.context.rf.logger.info("Adding edge",u),r.update_edges([...a,u]),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;case"delete":if(n.from_remote){const a=r.getEdges(),l=Dz(n);this.context.rf.logger.info("Deleting edge",l);const u=a.filter(d=>d.id!==l);r.update_edges(u),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;default:this.context.rf.logger.error("Unknown edge action",n)}},this.on_group_action=n=>{switch(n.type){case"set":return this._set_groups(n.groups);case"update":return this._update_group(n);default:this.context.rf.logger.error("Unknown group action",n)}},this.clear_all=()=>{this.workerManager.worker?.disconnect(),this.workerManager.set_worker(void 0),this.workerManager.workermanager?.setWorker(void 0),this.libManager.lib.libstate.getState().set({lib:{shelves:[]},external_worker:[]}),this.nodespace.nodesstates.clear(),this.reactFlowManager.useReactFlowStore.getState().update_nodes([]),this.reactFlowManager.useReactFlowStore.getState().update_edges([]),this.stateManager.auto_progress()},this.center_node=n=>{if(!this.reactFlowManager.rf_instance)return;n=Array.isArray(n)?n:[n];const r=this.reactFlowManager.useReactFlowStore.getState().getNodes().filter(a=>n.includes(a.id));r.length>0&&this.reactFlowManager.rf_instance?.fitView({padding:.2,nodes:r})},this.auto_resize_group=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n);if(a===void 0||a.type!=="group")return;const l=a.data.group.node_ids.map(y=>r.getNode(y)).filter(y=>y!==void 0),u=a.data.group.child_groups.map(y=>r.getNode(y)).filter(y=>y!==void 0),d=[...l,...u],h=this.reactFlowManager.rf_instance?.getNodesBounds(d);if(h===void 0)return;const m={...a,position:{x:h.x,y:h.y},height:h.height,width:h.width};m.data.group.position=[h.x,h.y],r.partial_update_nodes([m])},this.change_group_position=n=>{if(n.position===void 0)return;const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const l=[...a.data.group.node_ids,...a.data.group.child_groups],u=this.reactFlowManager.rf_instance?.getNodesBounds(l);if(u===void 0)return;const d=n.position.x-u?.x,h=n.position.y-u?.y,m=[];for(const y of l){const v=r.getNode(y);v!==void 0&&m.push({id:y,type:"position",position:{x:v.position.x+d,y:v.position.y+h}})}r.onNodesChange(m)},this.change_fn_node_position=n=>{n.position!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:pos":[n.position.x,n.position.y]}},from_remote:!1})},this.change_group_dimensions=n=>{if(n.dimensions===void 0)return;const a=this.reactFlowManager.useReactFlowStore.getState().getNode(n.id);a!==void 0&&this.reactFlowManager.useReactFlowStore.getState().partial_update_nodes(DO([n],[a]))},this.change_fn_node_dimensions=n=>{n.dimensions!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:size":[n.dimensions.width,n.dimensions.height]}},from_remote:!1})},this._update_group=n=>{if(n.from_remote){const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const{new_obj:l,change:u}=jp(a.data.group,n.group);u&&(a.data.group=l),r.partial_update_nodes([a])}else this.workerManager.worker&&this.workerManager.worker.api.group.locally_update_group(n)},this._set_groups=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),{default_nodes:a}=YO(r.getNodes()),l=[...a],u={};for(const h in n){const m=n[h];for(const v of m.node_ids)u[v]=h;for(const v of m.child_groups)u[v]=h;m.position===void 0&&(m.position=[0,0]);const y={id:h,type:"group",data:{group:n[h],id:h},position:{x:m.position[0],y:m.position[1]},zIndex:2};m.parent_group&&(y.data.groupID=m.parent_group),l.push(y)}for(const h of l)h.id in u?h.data.groupID=u[h.id]:h.data.groupID=void 0;const d=ZO(l);r.update_nodes(d);for(const h of d.reverse())h.type==="group"&&this.auto_resize_group(h.id)},this._add_node=n=>{this.context.rf.logger.info("add node",n);const r=this.reactFlowManager.useReactFlowStore.getState();if(n.from_remote){let a=this.nodespace.get_node(n.node.id,!1);if(a)return;if(!a)try{a=lme(n.node),this.nodespace.nodesstates.set(n.node.id,a)}catch(h){this.context.rf.logger.error(`Failed to create node store ${h}`);return}const l=a.getState();this.context.rf.logger.info("Add node",l.id,l.name);const u=pme(a,this.context.rf),d=[...r.getNodes(),u];this.reactFlowManager.useReactFlowStore.getState().update_nodes(d);for(const h of u.io_order)this.workerManager.worker?.api.node.get_io_value({nid:u.id,ioid:h});return setTimeout(()=>{this.workerManager.worker?.api.hooks.call_hooks("node_added",{node:l.id})},0),l}},this._update_node=n=>{if(Object.keys(n.node).length===0){this.context.rf.logger.error("Node update is empty",new Error(JSON.stringify(n)));return}if(n.node.in_trigger&&(n.node.error=void 0),n.from_remote){const r=this.nodespace.get_node(n.id,!1);if(!r){console.error("Node not found to update",n.id);return}return r.update(n.node),r.getState()}else this.workerManager.worker&&this.workerManager.worker.api.node.locally_update_node(n)},this._delete_node=n=>{this.context.rf.logger.info("Deleting node",n.id),n.from_remote?this.reactFlowManager.useReactFlowStore.getState().onNodesChange([{type:"remove",id:n.id}]):this.workerManager.worker?.api.node.remove_node(n.id)},this._error_action=n=>(this.context.rf.logger.error("Error",new Error(JSON.stringify(n))),this.on_node_action({type:"update",id:n.id,node:{in_trigger:!1,error:n.error},from_remote:!0})),this._trigger_action=n=>{if(n.from_remote)return this.on_node_action({type:"update",id:n.id,node:{in_trigger:!0,error:void 0},from_remote:!0});this.workerManager.worker?.api.node.trigger_node(n.id)},this.nodespace=bSe({})}center_all(){this.reactFlowManager.rf_instance?.fitView({padding:.2})}}const SSe=()=>({libstate:fl((e,t)=>({lib:{shelves:[]},external_worker:[],set:n=>e(r=>({...r,...n})),get_lib:()=>t().lib,get_external_worker:()=>t().external_worker}))});class wSe extends x0{constructor(t){super(t),this.lib=SSe()}}class ESe extends x0{constructor(t){super(t),this.workers=fl((n,r)=>({})),this.workerstate=fl((n,r)=>({is_open:!1}))}set_worker(t){t!==this.worker&&(this._unsubscribeFromWorker&&(this._unsubscribeFromWorker(),this._unsubscribeFromWorker=void 0),t&&(this._unsubscribeFromWorker=t.state.subscribe(n=>{this.workerstate.setState(n)}),this.workerstate.setState(t.state.getState())),this.worker=t,t?.set_zustand(this.context.rf))}}class CSe extends x0{constructor(t){super(t),this.progress_state=fl((n,r)=>({message:"please select worker",status:"info",progress:0,blocking:!1})),this.local_settings=fl((n,r)=>({view_settings:{expand_node_props:!1,expand_lib:!1}})),this.local_state=fl((n,r)=>({selected_nodes:[],selected_edges:[],selected_groups:[],funcnodescontainerRef:null}))}set_progress(t){if(t.message==="")return this.auto_progress();const n=this.progress_state.getState(),{new_obj:r,change:a}=jp(n,t);a&&this.progress_state.setState(r)}auto_progress(){const t=this.workerManager.workermanager,n=this.workerManager.worker;if(t!==void 0&&!t.open)return this.set_progress({progress:0,message:"connecting to worker manager",status:"error",blocking:!1});if(n===void 0)return this.set_progress({progress:0,message:"please select worker",status:"error",blocking:!1});if(!n.is_open)return this.set_progress({progress:0,message:"connecting to worker",status:"info",blocking:!0});this.set_progress({progress:1,message:"running",status:"info",blocking:!1})}update_view_settings(t){nV(this.local_settings,{view_settings:t})}}const RM="1.0.0",_Se=["1"],ASe=e=>{if(!e.v.toString().includes(".")||!_Se.includes(e.v.toString().split(".")[0]))throw new Error(`Unsupported version: ${e.v}`);return{...e,v:RM}};class TSe extends x0{constructor(t){super(t),this.plugins=fl((n,r)=>({})),this.render_options=fl((n,r)=>({}))}add_plugin(t,n){if(console.log("add_plugin",t,n),n!==void 0)try{const r=ASe(n);this.plugins.setState(a=>({...a,[t]:r}))}catch(r){r instanceof Error?this.context.rf.logger.error(`Error loading plugin ${t}`,r):this.context.rf.logger.error(`Error loading plugin ${t}`,new Error(String(r))),this.stateManager.toaster?.error({title:"Error",description:`Error loading plugin ${t}: ${r instanceof Error?r.message:String(r)}`,duration:5e3})}}update_render_options(t){nV(this.render_options,t)}async add_packed_plugin(t,n){if(n.js)for(const r of n.js){const a=document.createElement("script");a.text=atob(r),document.body.appendChild(a)}if(n.css)for(const r of n.css){const a=document.createElement("style");a.innerHTML=atob(r),document.head.appendChild(a)}if(n.module!==void 0){const r=atob(n.module);try{const l=await new Function("React","FuncNodesReactFlow",`
|
|
1115
|
+
`)}),e.description.length>a&&T.jsx("button",{onClick:r,className:"toggle-description",children:t?"Show less":"Show more"})]})},Nz=[">=","==","<=","<",">"],ZC=">=",TM=({availableModule:e,on_change:t})=>{const[n,r]=Q.useState(e.version||"latest"),[a,l]=Q.useState(ZC),u=h=>{const m=h.target.value;r(m),t(m!=="latest"?a+m:m)},d=h=>{h.target.value!==a&&Nz.includes(h.target.value)&&(l(h.target.value),n!=="latest"&&t(h.target.value+n))};return e.releases&&!e.releases.includes(n)&&e.releases.unshift(n),T.jsxs(T.Fragment,{children:[T.jsx("select",{value:a,onChange:d,children:Nz.map(h=>T.jsx("option",{value:h,children:h},h))}),T.jsx("select",{onChange:u,value:n,children:e.releases&&e.releases.map(h=>T.jsx("option",{value:h,children:h},h))})]})},cSe=({availableModule:e,on_remove:t,on_update:n})=>{const[r,a]=Q.useState(ZC+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(lM,{availableModule:e}),T.jsx(AM,{availableModule:e}),T.jsxs("div",{children:[T.jsx(TM,{availableModule:e,on_change:a}),T.jsx("button",{className:"update-button",disabled:r===e.version,onClick:()=>{n(e,r)},children:"Update"}),T.jsx("button",{className:"remove-button",onClick:()=>{t(e)},children:"Remove"})]})]})},fSe=({availableModule:e,on_add:t})=>{const[n,r]=Q.useState(ZC+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(lM,{availableModule:e}),T.jsx(AM,{availableModule:e}),T.jsxs("div",{children:[T.jsx(TM,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},dSe=({availableModule:e,on_add:t})=>{const[n,r]=Q.useState(ZC+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name}),T.jsx(lM,{availableModule:e}),T.jsx(AM,{availableModule:e}),T.jsxs("div",{children:[T.jsx(TM,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},hSe=({ins:e})=>{const[t,n]=Q.useState(e.name),r=Qt(),{lib:a}=jo(),l=()=>{r.worker&&a?.remove_external_worker(e.uuid,e.nodeclassid)},u=()=>{r.worker&&(r.worker.update_external_worker(e.uuid,e.nodeclassid,{name:t}),e.name=t)};return T.jsx(T.Fragment,{children:T.jsx(Jc,{title:e.name,description:"Settings for"+e.name,trigger:T.jsx("div",{children:"Settings"}),buttons:[{text:"Save",onClick:u,close:!0},{text:"Delete",onClick:l,close:!0}],children:T.jsx("div",{children:T.jsxs("div",{children:[T.jsx("label",{htmlFor:"name",children:"Name: "}),T.jsx("input",{type:"text",name:"name",value:t,onChange:d=>n(d.target.value),className:"styledinput"})]})})})})},pSe=({ins:e,lib:t,filter:n="",parentkey:r})=>{const[a,l]=Q.useState(!1),u=()=>l(!a),d=t?.nodes?.filter(h=>h.node_id.toLowerCase().includes(n.toLowerCase()));return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:e.name,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",title:e.uuid,children:T.jsx(hSe,{ins:e})}),t&&T.jsxs(T.Fragment,{children:[d&&T.jsx(T.Fragment,{children:d.map(h=>T.jsx(VV,{item:h},r+h.node_id))}),t.subshelves.map(h=>T.jsx(iM,{item:h,filter:n,parentkey:r+h.name},r+h.name))]})]})})})]})},mSe=({item:e,mod:t,lib:n})=>{const{lib:r}=jo(),[a,l]=Q.useState(!1),u=()=>l(!a),d=z.useCallback(()=>{r?.add_external_worker({module:t,cls_module:e.module,cls_name:e.class_name})},[r,t,e]),h=y=>{y.detail===2&&d()},m=e.name||e.module+"."+e.class_name;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:m,children:[T.jsx("div",{className:"shelftitle_text",children:m}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",onClick:h,title:e.name,children:"New Instance"}),e.instances.map(y=>T.jsx(pSe,{ins:y,lib:n?.subshelves.find(v=>v.name===y.uuid),parentkey:y.uuid},y.uuid))]})})})]})},gSe=({externalworkermod:e,lib:t})=>{const[n,r]=Q.useState(!1),a=()=>r(!n),l=n;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:a,style:{cursor:"pointer"},title:e.module,children:[T.jsx("div",{className:"shelftitle_text",children:e.module}),T.jsx("div",{className:"expandicon "+(l?"open":"close"),children:T.jsx(Sx,{})})]}),T.jsx("div",{className:"libnodecontainer "+(l?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:e.worker_classes.map(u=>T.jsx(mSe,{item:u,mod:e.module,lib:t},u.module+u.class_name))})}),T.jsx("hr",{})]})},ySe=()=>{const e=Qt(),t=e.lib.libstate(),n=Qt(),r=n.local_settings(m=>m.view_settings.expand_lib),a=m=>{n.update_view_settings({expand_lib:m})},l=gpe("m"),[u,d]=Q.useState(""),h=e.worker?.state(m=>m.is_open)??!1;return T.jsx(FO,{maxSize:l?"100%":"18.75rem",direction:l?"down":"right",containerClassName:"pos-left pos-top bg1 h-12",onExpandChange:a,expanded:r===void 0?!0:r,collapseIcons:{up:q2,down:Y1,left:X1,right:W2},expandIcons:{up:Y1,down:q2,left:W2,right:X1},children:T.jsxs("div",{className:"libcontainer",children:[T.jsxs("div",{className:"library",children:[T.jsx("div",{className:"libtitle",children:"Lib"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx(Lge,{filter:u,setFilter:d}),T.jsx("div",{className:"vscrollcontainer",children:t.lib.shelves.filter(m=>m.name!=="_external_worker").map(m=>T.jsx(iM,{item:m,filter:u,parentkey:m.name},m.name))}),T.jsx("hr",{}),T.jsx("div",{className:"libtitle",children:"External Worker"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx("div",{className:"vscrollcontainer",children:t.external_worker?.map(m=>T.jsx(gSe,{externalworkermod:m,lib:t.lib.shelves.find(y=>y.name==="_external_worker")},m.module))}),T.jsx("hr",{})]}),h&&T.jsx("div",{className:"addlib",children:T.jsx(Pge,{children:T.jsx("button",{children:"Manage Libraries"})})})]})})},vSe=({fnrf_zst:e,header:t,flow:n,library:r})=>{const[a,l]=Q.useState(e.options.worker||e.getWorkerManager().worker),u=z.useRef(null);e.workermanager&&(e.workermanager.on_setWorker=l),z.useEffect(()=>{e.auto_progress()},[]),z.useEffect(()=>{e.local_state.setState({funcnodescontainerRef:u.current})},[u]);const d=e.plugins();return T.jsx(rpe,{plugins:d,fnrf_zst:e,children:T.jsx(TQ,{children:T.jsx(s6.Provider,{value:e,children:T.jsx(kd,{asChild:!0,children:T.jsx(Ic,{asChild:!0,children:T.jsx(BH,{style:{height:"100%",width:"100%",display:"flex",flexDirection:"column",flex:1},children:T.jsxs("div",{ref:u,className:"funcnodesreactflowcontainer funcnodescontainer",children:[t.show&&T.jsx(Bge,{...t}),T.jsxs("div",{className:"funcnodesreactflowbody",children:[T.jsx(mme,{...n}),a&&r.show&&T.jsx(ySe,{}),a&&n.showNodeSettings&&T.jsx(Spe,{})]}),T.jsxs("div",{className:"funcnodesflaotingmenu",children:[T.jsx(Ic.OutFullScreen,{children:n.allowExpand&&T.jsxs(kd.Trigger,{children:[T.jsx(kd.Expanded,{children:T.jsx(yQ,{size:"xl",style:{padding:"4px"}})}),T.jsx(kd.Collapsed,{children:T.jsx(vQ,{size:"xl",style:{padding:"4px"}})})]})}),n.allowFullScreen&&T.jsxs(Ic.Trigger,{children:[T.jsx(Ic.OutFullScreen,{children:T.jsx(l6,{size:"xl",style:{padding:"4px"}})}),T.jsx(Ic.InFullScreen,{children:T.jsx(gQ,{size:"xl",style:{padding:"4px"}})})]})]})]})})})})})})})};class x0{constructor(t){this.context=t}get nodespaceManager(){return this.context.rf.getNodespaceManager()}get libManager(){return this.context.rf.getLibManager()}get workerManager(){return this.context.rf.getWorkerManager()}get stateManager(){return this.context.rf.getStateManager()}get pluginManager(){return this.context.rf.getPluginManager()}get reactFlowManager(){return this.context.rf.getReactFlowManager()}}const Dz=({src_nid:e,src_ioid:t,trg_nid:n,trg_ioid:r})=>[`${e}:${t}`,`${n}:${r}`].sort().join("--"),bSe=({})=>{const e=new Map;return{nodesstates:e,get_node:(t,n=!0)=>{const r=e.get(t);if(!r&&n){const a=e.keys();throw new Error(`Node ${t} not found, available nodes: ${Array.from(a)}`)}return r}}};class xSe extends x0{constructor(t){super(t),this.on_node_action=n=>{switch(n.type){case"add":return this._add_node(n);case"update":return this._update_node(n);case"delete":return this._delete_node(n);case"error":return this._error_action(n);case"trigger":return this._trigger_action(n);default:this.context.rf.logger.error("Unknown node action",n);return}},this.on_edge_action=n=>{const r=this.reactFlowManager.useReactFlowStore.getState();switch(n.type){case"add":if(n.from_remote){const a=r.getEdges(),l=Dz(n);if(a.some(d=>d.id===l))return;const u={id:l,source:n.src_nid,target:n.trg_nid,sourceHandle:n.src_ioid,targetHandle:n.trg_ioid,className:"funcnodes-edge animated",zIndex:1003};this.context.rf.logger.info("Adding edge",u),r.update_edges([...a,u]),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;case"delete":if(n.from_remote){const a=r.getEdges(),l=Dz(n);this.context.rf.logger.info("Deleting edge",l);const u=a.filter(d=>d.id!==l);r.update_edges(u),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;default:this.context.rf.logger.error("Unknown edge action",n)}},this.on_group_action=n=>{switch(n.type){case"set":return this._set_groups(n.groups);case"update":return this._update_group(n);default:this.context.rf.logger.error("Unknown group action",n)}},this.clear_all=()=>{this.context.rf.logger.debug("Clearing all nodespace"),this.workerManager.worker?.disconnect(),this.workerManager.set_worker(void 0),this.workerManager.workermanager?.setWorker(void 0),this.libManager.lib.libstate.getState().set({lib:{shelves:[]},external_worker:[]}),this.nodespace.nodesstates.clear(),this.reactFlowManager.useReactFlowStore.getState().update_nodes([]),this.reactFlowManager.useReactFlowStore.getState().update_edges([]),this.stateManager.auto_progress()},this.center_node=n=>{if(!this.reactFlowManager.rf_instance)return;n=Array.isArray(n)?n:[n];const r=this.reactFlowManager.useReactFlowStore.getState().getNodes().filter(a=>n.includes(a.id));r.length>0&&this.reactFlowManager.rf_instance?.fitView({padding:.2,nodes:r})},this.auto_resize_group=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n);if(a===void 0||a.type!=="group")return;const l=a.data.group.node_ids.map(y=>r.getNode(y)).filter(y=>y!==void 0),u=a.data.group.child_groups.map(y=>r.getNode(y)).filter(y=>y!==void 0),d=[...l,...u],h=this.reactFlowManager.rf_instance?.getNodesBounds(d);if(h===void 0)return;const m={...a,position:{x:h.x,y:h.y},height:h.height,width:h.width};m.data.group.position=[h.x,h.y],r.partial_update_nodes([m])},this.change_group_position=n=>{if(n.position===void 0)return;const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const l=[...a.data.group.node_ids,...a.data.group.child_groups],u=this.reactFlowManager.rf_instance?.getNodesBounds(l);if(u===void 0)return;const d=n.position.x-u?.x,h=n.position.y-u?.y,m=[];for(const y of l){const v=r.getNode(y);v!==void 0&&m.push({id:y,type:"position",position:{x:v.position.x+d,y:v.position.y+h}})}r.onNodesChange(m)},this.change_fn_node_position=n=>{n.position!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:pos":[n.position.x,n.position.y]}},from_remote:!1})},this.change_group_dimensions=n=>{if(n.dimensions===void 0)return;const a=this.reactFlowManager.useReactFlowStore.getState().getNode(n.id);a!==void 0&&this.reactFlowManager.useReactFlowStore.getState().partial_update_nodes(DO([n],[a]))},this.change_fn_node_dimensions=n=>{n.dimensions!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:size":[n.dimensions.width,n.dimensions.height]}},from_remote:!1})},this._update_group=n=>{if(n.from_remote){const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const{new_obj:l,change:u}=jp(a.data.group,n.group);u&&(a.data.group=l),r.partial_update_nodes([a])}else this.workerManager.worker&&this.workerManager.worker.api.group.locally_update_group(n)},this._set_groups=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),{default_nodes:a}=YO(r.getNodes()),l=[...a],u={};for(const h in n){const m=n[h];for(const v of m.node_ids)u[v]=h;for(const v of m.child_groups)u[v]=h;m.position===void 0&&(m.position=[0,0]);const y={id:h,type:"group",data:{group:n[h],id:h},position:{x:m.position[0],y:m.position[1]},zIndex:2};m.parent_group&&(y.data.groupID=m.parent_group),l.push(y)}for(const h of l)h.id in u?h.data.groupID=u[h.id]:h.data.groupID=void 0;const d=ZO(l);r.update_nodes(d);for(const h of d.reverse())h.type==="group"&&this.auto_resize_group(h.id)},this._add_node=n=>{this.context.rf.logger.info("add node",n);const r=this.reactFlowManager.useReactFlowStore.getState();if(n.from_remote){let a=this.nodespace.get_node(n.node.id,!1);if(a)return;if(!a)try{a=lme(n.node),this.nodespace.nodesstates.set(n.node.id,a)}catch(h){this.context.rf.logger.error(`Failed to create node store ${h}`);return}const l=a.getState();this.context.rf.logger.info("Add node",l.id,l.name);const u=pme(a,this.context.rf),d=[...r.getNodes(),u];this.reactFlowManager.useReactFlowStore.getState().update_nodes(d);for(const h of u.io_order)this.workerManager.worker?.api.node.get_io_value({nid:u.id,ioid:h});return setTimeout(()=>{this.workerManager.worker?.api.hooks.call_hooks("node_added",{node:l.id})},0),l}},this._update_node=n=>{if(Object.keys(n.node).length===0){this.context.rf.logger.error("Node update is empty",new Error(JSON.stringify(n)));return}if(n.node.in_trigger&&(n.node.error=void 0),n.from_remote){const r=this.nodespace.get_node(n.id,!1);if(!r){console.error("Node not found to update",n.id);return}return r.update(n.node),r.getState()}else this.workerManager.worker&&this.workerManager.worker.api.node.locally_update_node(n)},this._sync_nodes=()=>{const n=this.reactFlowManager.useReactFlowStore.getState().getNodes(),r=this.nodespace.nodesstates;for(const a of r.keys())n.some(l=>l.id===a)||r.delete(a)},this._delete_node=n=>{this.context.rf.logger.info("Deleting node",n.id),n.from_remote?(this.reactFlowManager.useReactFlowStore.getState().onNodesChange([{type:"remove",id:n.id}]),this._sync_nodes()):this.workerManager.worker?.api.node.remove_node(n.id)},this._error_action=n=>(this.context.rf.logger.error("Error",new Error(JSON.stringify(n))),this.on_node_action({type:"update",id:n.id,node:{in_trigger:!1,error:n.error},from_remote:!0})),this._trigger_action=n=>{if(n.from_remote)return this.on_node_action({type:"update",id:n.id,node:{in_trigger:!0,error:void 0},from_remote:!0});this.workerManager.worker?.api.node.trigger_node(n.id)},this.nodespace=bSe({})}center_all(){this.reactFlowManager.rf_instance?.fitView({padding:.2})}}const SSe=()=>({libstate:fl((e,t)=>({lib:{shelves:[]},external_worker:[],set:n=>e(r=>({...r,...n})),get_lib:()=>t().lib,get_external_worker:()=>t().external_worker}))});class wSe extends x0{constructor(t){super(t),this.lib=SSe()}}class ESe extends x0{constructor(t){super(t),t.rf.logger.debug("Initializing worker manager handler"),this.workers=fl((n,r)=>({})),this.workerstate=fl((n,r)=>({is_open:!1}))}set_worker(t){t!==this.worker&&(this._unsubscribeFromWorker&&(this._unsubscribeFromWorker(),this._unsubscribeFromWorker=void 0),t?(this.context.rf.logger.debug("Setting worker in worker manager"),this._unsubscribeFromWorker=t.state.subscribe(n=>{this.workerstate.setState(n)}),this.workerstate.setState(t.state.getState())):this.context.rf.logger.debug("Removing worker in worker manager"),this.worker=t,t?.set_zustand(this.context.rf))}}class CSe extends x0{constructor(t){super(t),this.progress_state=fl((n,r)=>({message:"please select worker",status:"info",progress:0,blocking:!1})),this.local_settings=fl((n,r)=>({view_settings:{expand_node_props:!1,expand_lib:!1}})),this.local_state=fl((n,r)=>({selected_nodes:[],selected_edges:[],selected_groups:[],funcnodescontainerRef:null}))}set_progress(t){if(t.message==="")return this.auto_progress();const n=this.progress_state.getState(),{new_obj:r,change:a}=jp(n,t);a&&this.progress_state.setState(r)}auto_progress(){const t=this.workerManager.workermanager,n=this.workerManager.worker;if(t!==void 0&&!t.open)return this.set_progress({progress:0,message:"connecting to worker manager",status:"error",blocking:!1});if(n===void 0)return this.set_progress({progress:0,message:"please select worker",status:"error",blocking:!1});if(!n.is_open)return this.set_progress({progress:0,message:"connecting to worker",status:"info",blocking:!0});this.set_progress({progress:1,message:"running",status:"info",blocking:!1})}update_view_settings(t){nV(this.local_settings,{view_settings:t})}}const RM="1.0.0",_Se=["1"],ASe=e=>{if(!e.v.toString().includes(".")||!_Se.includes(e.v.toString().split(".")[0]))throw new Error(`Unsupported version: ${e.v}`);return{...e,v:RM}};class TSe extends x0{constructor(t){super(t),this.plugins=fl((n,r)=>({})),this.render_options=fl((n,r)=>({}))}add_plugin(t,n){if(n!==void 0)try{const r=ASe(n);this.plugins.setState(a=>({...a,[t]:r}))}catch(r){r instanceof Error?this.context.rf.logger.error(`Error loading plugin ${t}`,r):this.context.rf.logger.error(`Error loading plugin ${t}`,new Error(String(r))),this.stateManager.toaster?.error({title:"Error",description:`Error loading plugin ${t}: ${r instanceof Error?r.message:String(r)}`,duration:5e3})}}update_render_options(t){nV(this.render_options,t)}async add_packed_plugin(t,n){if(n.js)for(const r of n.js){const a=document.createElement("script");a.text=atob(r),document.body.appendChild(a)}if(n.css)for(const r of n.css){const a=document.createElement("style");a.innerHTML=atob(r),document.head.appendChild(a)}if(n.module!==void 0){const r=atob(n.module);try{const l=await new Function("React","FuncNodesReactFlow",`
|
|
1116
1116
|
return (async () => {
|
|
1117
1117
|
${r}
|
|
1118
1118
|
return FuncNodesPlugin;
|