@synnaxlabs/pluto 0.50.0 → 0.50.1

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.
Files changed (96) hide show
  1. package/dist/{Animated-eavjaVoD.js → Animated-BbeJdao0.js} +2 -2
  2. package/dist/{Animated-DxBr38YY.js → Animated-C4xrEVd-.js} +3 -3
  3. package/dist/{Animated-DpzwlYqX.cjs → Animated-Dvm2k_z_.cjs} +1 -1
  4. package/dist/{Animated-Bm-WM4BW.cjs → Animated-umWjgTzy.cjs} +1 -1
  5. package/dist/{Button-Cj2hR9EM.cjs → Button-BSek5HG5.cjs} +1 -1
  6. package/dist/{Button-DulIBpNI.js → Button-DLtxKGH5.js} +4 -4
  7. package/dist/{Dialog-DJJQBUgw.cjs → Dialog-BpjxXSmw.cjs} +1 -1
  8. package/dist/{Dialog-CwTHvHHD.js → Dialog-BspO7uo8.js} +1 -1
  9. package/dist/{Haul-CofQrOeX.js → Haul-DBy-2ds_.js} +1 -1
  10. package/dist/{Haul-gTF4QDh3.cjs → Haul-WgPKptr9.cjs} +1 -1
  11. package/dist/{Items-DjAwxhhi.cjs → Items-07R286kW.cjs} +2 -2
  12. package/dist/{Items-B5aeU-Pt.js → Items-CX11yLMf.js} +7 -5
  13. package/dist/{Menu-BqfIul2o.cjs → Menu-58O-OOPJ.cjs} +1 -1
  14. package/dist/{Menu-Bjfeoaln.js → Menu-GBo3ayoP.js} +4 -4
  15. package/dist/Provider-BA3zQVbv.cjs +1 -0
  16. package/dist/{Provider-BoQtgQtU.js → Provider-BkxUzTWS.js} +54 -51
  17. package/dist/Tags-DWsEZD9t.cjs +1 -0
  18. package/dist/{Tags-C38F7I5z.js → Tags-V7sNuGZv.js} +41 -36
  19. package/dist/{Text-IFQH97iK.cjs → Text-DW5FpCk9.cjs} +1 -1
  20. package/dist/{Text-TzKJ38En.js → Text-XeD58Fq8.js} +444 -439
  21. package/dist/button.cjs +1 -1
  22. package/dist/button.js +1 -1
  23. package/dist/color.cjs +1 -1
  24. package/dist/color.js +1 -1
  25. package/dist/dialog.cjs +1 -1
  26. package/dist/dialog.js +1 -1
  27. package/dist/{eraser-DZxY0pWe.cjs → eraser-Bocga8Eb.cjs} +1 -1
  28. package/dist/{eraser-Bd14L_5k.js → eraser-DuAfpO0P.js} +1 -1
  29. package/dist/ether.cjs +1 -1
  30. package/dist/ether.js +6 -6
  31. package/dist/{external-D4rp1QBE.cjs → external-5_uHky7w.cjs} +1 -1
  32. package/dist/{external-6HkYP0wd.js → external-B-JsNciM.js} +4 -4
  33. package/dist/{external-BIW55htp.cjs → external-B9omdiDK.cjs} +1 -1
  34. package/dist/{external-CkwpcNCW.cjs → external-BIbdeWQE.cjs} +1 -1
  35. package/dist/{external-D7qXEQQM.cjs → external-BRA_zA83.cjs} +1 -1
  36. package/dist/{external-BWI-FZRf.cjs → external-Bjh6lsVm.cjs} +1 -1
  37. package/dist/{external-DPow1FDR.cjs → external-BwRkgEyo.cjs} +1 -1
  38. package/dist/{external-BKkDVUP_.js → external-CLQdSLv0.js} +2 -2
  39. package/dist/{external-CVzhqlPH.js → external-CdHyPhLI.js} +1 -1
  40. package/dist/{external-DKc3PiyN.js → external-Ct1k30Nd.js} +3 -3
  41. package/dist/{external-DlHNhR1y.cjs → external-Ct2A_YCT.cjs} +1 -1
  42. package/dist/{external-Bl8zTvKt.js → external-DNbIzfVy.js} +43 -42
  43. package/dist/{external-CUHCzUJE.cjs → external-DT82RBon.cjs} +1 -1
  44. package/dist/{external-gDa9Z0SY.js → external-DXWEyk9d.js} +2 -2
  45. package/dist/{external-BU5fnKG8.cjs → external-DojNoICL.cjs} +1 -1
  46. package/dist/{external-DqaHmzvp.js → external-Dp5OkGYV.js} +5 -5
  47. package/dist/{external-BoAcV4dI.js → external-DxmgAHkn.js} +3 -3
  48. package/dist/{external-DAmwuDsu.cjs → external-DyTk_hS7.cjs} +1 -1
  49. package/dist/{external-B0R_yw6F.cjs → external-PXU0gc_j.cjs} +1 -1
  50. package/dist/{external-BsdKmL37.js → external-g_vt4Lku.js} +10 -10
  51. package/dist/{external-DCZMzNZX.js → external-sYHm9OG8.js} +3 -3
  52. package/dist/{external-DrcMI5oa.js → external-xfkS0zGI.js} +8 -8
  53. package/dist/{fontString-BtjO8Met.js → fontString-CSWLcJcC.js} +1 -1
  54. package/dist/{fontString-CeR_vHX_.cjs → fontString-TocVNWmy.cjs} +1 -1
  55. package/dist/header.cjs +1 -1
  56. package/dist/header.js +1 -1
  57. package/dist/{hooks-Ddqh5NVY.js → hooks-BeSuo_di.js} +1 -1
  58. package/dist/{hooks-Dxvxse16.cjs → hooks-Eb94kuDd.cjs} +1 -1
  59. package/dist/index.cjs +2 -2
  60. package/dist/index.js +2718 -2713
  61. package/dist/input.cjs +1 -1
  62. package/dist/input.js +1 -1
  63. package/dist/list.cjs +1 -1
  64. package/dist/list.js +1 -1
  65. package/dist/menu.cjs +1 -1
  66. package/dist/menu.js +1 -1
  67. package/dist/pluto.css +1 -1
  68. package/dist/{provider-CfFukcDe.js → provider-D0K9E52u.js} +88 -79
  69. package/dist/{provider-BmDwHwF4.cjs → provider-DksyuJua.cjs} +6 -6
  70. package/dist/src/flux/list.d.ts.map +1 -1
  71. package/dist/src/form/useField.d.ts.map +1 -1
  72. package/dist/src/icon/registry.d.ts +1 -0
  73. package/dist/src/icon/registry.d.ts.map +1 -1
  74. package/dist/src/list/Frame.d.ts.map +1 -1
  75. package/dist/src/select/Frame.d.ts.map +1 -1
  76. package/dist/src/theming/aether/provider.d.ts +63 -0
  77. package/dist/src/theming/aether/provider.d.ts.map +1 -1
  78. package/dist/src/theming/base/theme.d.ts +39 -0
  79. package/dist/src/theming/base/theme.d.ts.map +1 -1
  80. package/dist/src/theming/css.d.ts.map +1 -1
  81. package/dist/src/tree/external.d.ts +1 -0
  82. package/dist/src/tree/external.d.ts.map +1 -1
  83. package/dist/tabs.cjs +1 -1
  84. package/dist/tabs.js +1 -1
  85. package/dist/theme.css +135 -123
  86. package/dist/theming.cjs +1 -1
  87. package/dist/theming.js +2 -2
  88. package/dist/tree.cjs +1 -1
  89. package/dist/tree.js +1 -1
  90. package/dist/triggers.cjs +1 -1
  91. package/dist/triggers.js +1 -1
  92. package/dist/{value-C-e017qO.js → value-BmuhX6zs.js} +3 -3
  93. package/dist/{value-0g5Cxim9.cjs → value-CZfzRi_x.cjs} +1 -1
  94. package/package.json +7 -7
  95. package/dist/Provider-CKROy_xK.cjs +0 -1
  96. package/dist/Tags-B3m_Kzbp.cjs +0 -1
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("./Text-IFQH97iK.cjs"),S=require("./provider-BmDwHwF4.cjs"),d=require("./css-D3NdC2sx.cjs"),le=require("zod"),I=require("./value-0g5Cxim9.cjs"),v=require("react"),a=require("./jsx-runtime-nZSsnGb7.cjs"),ie=require("./Provider-CKROy_xK.cjs"),J=require("./Editable-C-z-stcD.cjs"),he=require("./types-C0tUDfsz.cjs"),te=require("./Box-D27bV7QJ.cjs"),ue=require("./Tags-B3m_Kzbp.cjs"),je=require("./Button-Cj2hR9EM.cjs"),we=require("./external-B0R_yw6F.cjs"),bt=require("./Items-DjAwxhhi.cjs"),it=require("./Animated-DpzwlYqX.cjs"),Gp=require("react-dom"),De=require("./Haul-gTF4QDh3.cjs"),yt=require("./external-DPow1FDR.cjs"),_R=require("./useStaticData-BTwIe0Il.cjs"),rl=require("./external-BIW55htp.cjs"),Kp=require("./Animated-Bm-WM4BW.cjs"),Je=require("./external-D4rp1QBE.cjs"),Ft=require("./event-BxvV3arE.cjs"),Bs=require("./external-DAmwuDsu.cjs"),dr=require("./hooks-Dxvxse16.cjs"),Yp=require("./external-CkwpcNCW.cjs"),fd=require("./dimensions-C7b02rFi.cjs"),Vs=require("./external-BU5fnKG8.cjs"),xd=require("./Menu-BqfIul2o.cjs");;/* empty css */const Xr=require("./external-DlHNhR1y.cjs"),qp=require("./units-Bd_mf9Ye.cjs"),CR=require("./external-CUHCzUJE.cjs"),We=require("./external-D7qXEQQM.cjs"),fs=require("./eraser-DZxY0pWe.cjs"),kR=require("./external-B3o5P8Yw.cjs"),$R=require("./external-BWI-FZRf.cjs"),IR=require("./Video-CBPTBLTB.cjs"),NR=Object.freeze(Object.defineProperty({__proto__:null,Access:R.Access,Acquire:R.Acquire,Add:R.Add,Align:R.Align,Analyze:R.Analyze,Annotate:R.Annotate,Annotation:R.Annotation,Arc:R.Arc,Array:R.Array,Arrow:R.Arrow,Attachment:R.Attachment,Auto:R.Auto,AutoFitWidth:R.AutoFitWidth,Binary:R.Binary,Bolt:R.Bolt,Boolean:R.Boolean,Box:R.Box,Bridge:R.Bridge,CPlusPlus:R.CPlusPlus,CSV:R.CSV,Calculation:R.Calculation,Calendar:R.Calendar,Caret:R.Caret,Channel:R.Channel,Check:R.Check,Circle:R.Circle,Click:R.Click,Close:R.Close,Cluster:R.Cluster,Commit:R.Commit,Completed:R.Completed,Concepts:R.Concepts,Connect:R.Connect,Constant:R.Constant,Control:R.Control,Copy:R.Copy,Cut:R.Cut,DarkMode:R.DarkMode,Decimal:R.Decimal,Delete:R.Delete,Details:R.Details,Device:R.Device,Disable:R.Disable,Disconnect:R.Disconnect,Distribute:R.Distribute,Download:R.Download,Downsample:R.Downsample,Drag:R.Drag,Dynamic:R.Dynamic,Edit:R.Edit,EditOff:R.EditOff,Enable:R.Enable,Err:R.Err,Expand:R.Expand,Explore:R.Explore,Export:R.Export,False:R.False,Feedback:R.Feedback,FillColor:R.FillColor,Filter:R.Filter,Fitting:R.Fitting,Focus:R.Focus,Function:R.Function,Group:R.Group,Guide:R.Guide,Hardware:R.Hardware,Heart:R.Heart,Hidden:R.Hidden,Import:R.Import,InProgress:R.InProgress,Index:R.Index,Info:R.Info,JSON:R.JSON,KebabMenu:R.KebabMenu,Keyboard:R.Keyboard,Label:R.Label,LightMode:R.LightMode,LinePlot:R.LinePlot,Linear:R.Linear,Link:R.Link,LinkExternal:R.LinkExternal,Loading:R.Loading,Log:R.Log,Logo:R.Logo,Logout:R.Logout,Map:R.Map,Menu:R.Menu,MoveToMainWindow:R.MoveToMainWindow,NPM:R.NPM,Node:R.Node,None:R.None,Notification:R.Notification,OpenExternal:R.OpenExternal,OpenInNewWindow:R.OpenInNewWindow,PNPM:R.PNPM,Pan:R.Pan,Paste:R.Paste,Pause:R.Pause,Play:R.Play,Policy:R.Policy,Process:R.Process,Pump:R.Pump,Python:R.Python,QuestionMark:R.QuestionMark,Rack:R.Rack,Range:R.Range,Reference:R.Reference,Refresh:R.Refresh,Release:R.Release,Rename:R.Rename,Reset:R.Reset,Resources:R.Resources,Role:R.Role,Rotate:R.Rotate,RotateAroundCenter:R.RotateAroundCenter,RotateGroup:R.RotateGroup,Rule:R.Rule,Safety:R.Safety,Save:R.Save,Schematic:R.Schematic,Search:R.Search,Select:R.Select,Selection:R.Selection,Settings:R.Settings,Snapshot:R.Snapshot,Snooze:R.Snooze,Sound:R.Sound,SplitX:R.SplitX,SplitY:R.SplitY,StarFilled:R.StarFilled,StarOutlined:R.StarOutlined,Status:R.Status,String:R.String,StrokeColor:R.StrokeColor,StrokeWidth:R.StrokeWidth,Subtract:R.Subtract,Sync:R.Sync,Table:R.Table,Tank:R.Tank,Tare:R.Tare,Task:R.Task,Terminal:R.Terminal,Text:R.Text$1,TextAlign:R.TextAlign,Time:R.Time,ToDo:R.ToDo,Tooltip:R.Tooltip,True:R.True,Type:R.Type,TypeScript:R.TypeScript,Units:R.Units,User:R.User,Value:R.Value,Valve:R.Valve,Variable:R.Variable,View:R.View,Virtual:R.Virtual,Visible:R.Visible,Visualize:R.Visualize,Warning:R.Warning,Wave:R.Wave,Workspace:R.Workspace,Yarn:R.Yarn,Zoom:R.Zoom,createComposite:R.createComposite,resolve:R.resolve,wrapSVGIcon:R.wrapSVGIcon},Symbol.toStringTag,{value:"Module"})),AR=R.createComposite(R.Policy,{topRight:R.Add}),ot={present:"rename",past:"renamed",participle:"renaming"},Xe={present:"delete",past:"deleted",participle:"deleting"},ol={present:"update",past:"updated",participle:"updating"},Vt={present:"create",past:"created",participle:"creating"},sl={present:"snapshot",past:"snapshotted",participle:"snapshotting"},Wp={present:"copy",past:"copied",participle:"copying"},Xp={present:"set",past:"set",participle:"setting"},PR={present:"save",past:"saved",participle:"saving"},Jp=Symbol(),il=Symbol(),Mr="a",is="w";let TR=(e,t)=>new Proxy(e,t);const ba=Object.getPrototypeOf,hd=new WeakMap,al=e=>e&&(hd.has(e)?hd.get(e):ba(e)===Object.prototype||ba(e)===Array.prototype),gd=e=>typeof e=="object"&&e!==null,yd=new WeakMap,Qp=e=>e[il]||e,ef=(e,t,r)=>{if(!al(e))return e;const o=Qp(e),n=(i=>Object.isFrozen(i)||Object.values(Object.getOwnPropertyDescriptors(i)).some(l=>!l.writable))(o);let s=r&&r.get(o);return s&&s[1].f===n||(s=((i,l)=>{const c={f:l};let u=!1;const m=(f,h)=>{if(!u){let x=c[Mr].get(i);if(x||(x={},c[Mr].set(i,x)),f===is)x[is]=!0;else{let g=x[f];g||(g=new Set,x[f]=g),g.add(h)}}},p={get:(f,h)=>h===il?i:(m("k",h),ef(Reflect.get(f,h),c[Mr],c.c)),has:(f,h)=>h===Jp?(u=!0,c[Mr].delete(i),!0):(m("h",h),Reflect.has(f,h)),getOwnPropertyDescriptor:(f,h)=>(m("o",h),Reflect.getOwnPropertyDescriptor(f,h)),ownKeys:f=>(m(is),Reflect.ownKeys(f))};return l&&(p.set=p.deleteProperty=()=>!1),[p,c]})(o,n),s[1].p=TR(n?(i=>{let l=yd.get(i);if(!l){if(Array.isArray(i))l=Array.from(i);else{const c=Object.getOwnPropertyDescriptors(i);Object.values(c).forEach(u=>{u.configurable=!0}),l=Object.create(ba(i),c)}yd.set(i,l)}return l})(o):o,s[0]),r&&r.set(o,s)),s[1][Mr]=t,s[1].c=r,s[1].p},tf=(e,t,r,o)=>{if(Object.is(e,t))return!1;if(!gd(e)||!gd(t))return!0;const n=r.get(Qp(e));if(!n)return!0;if(o){const i=o.get(e);if(i&&i.n===t)return i.g;o.set(e,{n:t,g:!1})}let s=null;try{for(const i of n.h||[])if(s=Reflect.has(e,i)!==Reflect.has(t,i),s)return s;if(n[is]===!0){if(s=((i,l)=>{const c=Reflect.ownKeys(i),u=Reflect.ownKeys(l);return c.length!==u.length||c.some((m,p)=>m!==u[p])})(e,t),s)return s}else for(const i of n.o||[])if(s=!!Reflect.getOwnPropertyDescriptor(e,i)!=!!Reflect.getOwnPropertyDescriptor(t,i),s)return s;for(const i of n.k||[])if(s=tf(e[i],t[i],r,o),s)return s;return s===null&&(s=!0),s}finally{o&&o.set(e,{n:t,g:s})}},OR=e=>!!al(e)&&Jp in e,nf=e=>al(e)&&e[il]||null,LR="h",zR="w",MR="o",DR="k",Ra=e=>typeof e=="object"&&e!==null,rf=(e,t)=>{if(!Ra(e))return e;const r=nf(e);return r!==null?(OR(e),r):(t.has(e)||(t.add(e),Object.entries(e).forEach(([o,n])=>{const s=rf(n,t);Object.is(s,n)||(e[o]=s)})),e)},wa=(e,t,r)=>{var o,n,s;if(!Ra(e)||!Ra(t))return;const i=r.get(nf(t)||t);i&&((o=i[LR])==null||o.forEach(l=>{Reflect.has(e,l)}),i[zR]===!0&&Reflect.ownKeys(e),(n=i[MR])==null||n.forEach(l=>{Reflect.getOwnPropertyDescriptor(e,l)}),(s=i[DR])==null||s.forEach(l=>{wa(e[l],t[l],r)}))},ta="o",na="r",ra="a";function UR(e,t){var r;let o=0;const n=(r=t?.size)!=null?r:1,s=[],i=t!=null&&t.noWeakMap?null:new WeakMap;return c=>{const u=i?.get(c);if(u)return u[na];for(let x=0;x<n;x+=1){const g=s[(o+x)%n];if(!g)break;if(!tf(g[ta],c,g[ra],new WeakMap))return wa(c,g[ta],g[ra]),i?.set(c,g),g[na]}const m=new WeakMap,p=ef(c,m),f=rf(e(p),new Set);wa(c,c,m);const h={[ta]:c,[na]:f,[ra]:m};return o=(o-1+n)%n,s[o]=h,i?.set(c,h),f}}const ZR=(e,t)=>d.rl.RUNTIME==="browser"?UR(e,t):e,po=(e,t)=>{v.useEffect(()=>{const r=new AbortController,o=r.signal,s=(async()=>(await d.sl.flushTaskQueue(),await e(o)))().catch(console.error);return()=>{r.abort(),s.then(i=>i?.()).catch(console.error)}},t)},FR=ie.useVirtualCursorDragWebKit,Hs=()=>{const e=v.useRef([]),t=v.useMemo(()=>({cleanup:()=>{e.current.forEach(r=>r()),e.current=[]},set:r=>{r!=null&&e.current.push(...d.du.toArray(r))}}),[]);return v.useEffect(()=>t.cleanup,[t.cleanup]),t},ll={info:"var(--pluto-text-color)",error:"var(--pluto-error-z)",warning:"var(--pluto-warning-m1)",success:"var(--pluto-primary-z)",loading:"var(--pluto-text-color)",disabled:"var(--pluto-gray-l8)"},vn=({variant:e,...t})=>e==="loading"?a.jsxRuntimeExports.jsx(R.Loading,{...t}):a.jsxRuntimeExports.jsx(R.Circle,{color:e!=null?ll[e]:void 0,...t}),BR=Object.freeze(Object.defineProperty({__proto__:null,Config:je.Config,Dialog:je.Dialog,chooseLocation:je.chooseLocation,formatTip:je.formatTip,useConfig:je.useConfig,wrap:je.wrap},Symbol.toStringTag,{value:"Module"})),VR=(e,t)=>{const r=new d.E(e).makeValid();if(r.start.equals(d.d.MAX))return null;const o=r.start.isToday?"time":"dateTime";let n=new d.d(r.start).toString(o,t);if(r.start.isToday&&(n=`Today ${n}`),r.end.equals(d.d.MAX))return r.start.before(d.d.now())?`Started ${n}`:`Starts ${n}`;const s=r.end.span(r.start)<d.g.DAY?"time":"dateTime",i=new d.d(r.end).toString(s,t);return[n,i]},of=({children:e,level:t="p",color:r=9,displayTZ:o="local",weight:n=450,...s})=>{const i=VR(e,o);return i==null?null:a.jsxRuntimeExports.jsx(te.Box$1,{x:!0,gap:"small",align:"center",...s,children:a.jsxRuntimeExports.jsx(J.Text,{level:t,color:r,weight:n,gap:"tiny",children:typeof i=="string"?i:a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[i[0],a.jsxRuntimeExports.jsx(R.Arrow.Right,{color:9,size:"1em"}),i[1]]})})})},sf=({children:e,format:t,...r})=>a.jsxRuntimeExports.jsx(J.Text,{...r,children:new d.g(e).toString(t)}),af=e=>{const[,t]=v.useState(0);return v.useEffect(()=>{const r=setInterval(()=>{t(o=>o+1)},1e3);return()=>clearInterval(r)},[]),d.d.since(e)},HR=({children:e,...t})=>{const r=af(e);return a.jsxRuntimeExports.jsx(sf,{...t,children:r})},GR=Object.freeze(Object.defineProperty({__proto__:null,TimeRange:of,TimeSpan:sf,TimeSpanSince:HR,TimeStamp:we.TimeStamp,useTimeSpanSince:af},Symbol.toStringTag,{value:"Module"})),KR=({action:e})=>v.isValidElement(e)?e:v.createElement(je.Button,{...e,key:e.key,size:"tiny"}),YR=({status:{key:e,time:t,count:r,message:o,description:n,variant:s,name:i},silence:l,actions:c,className:u,children:m,...p})=>{const f=v.useRef(null);return a.jsxRuntimeExports.jsxs(te.Box$1,{className:d.CSS(d.CSS.B("notification"),u),y:!0,empty:!0,ref:f,...p,children:[a.jsxRuntimeExports.jsxs(te.Box$1,{x:!0,justify:"between",grow:!0,className:d.CSS(d.CSS.BE("notification","header")),children:[a.jsxRuntimeExports.jsxs(te.Box$1,{x:!0,align:"center",gap:"small",children:[a.jsxRuntimeExports.jsxs(J.Text,{level:"small",status:s,gap:"tiny",className:d.CSS(d.CSS.BE("notification","name")),children:[a.jsxRuntimeExports.jsx(vn,{variant:s}),a.jsxRuntimeExports.jsx(J.Text,{el:"span",overflow:"ellipsis",status:s,children:d.pu.isNonZero(i)&&i})]}),a.jsxRuntimeExports.jsx(J.Text,{level:"small",children:`x${r}`}),a.jsxRuntimeExports.jsx(we.TimeStamp,{className:d.CSS(d.CSS.BE("notification","time")),level:"small",format:"time",children:t})]}),a.jsxRuntimeExports.jsx(je.Button,{className:d.CSS(d.CSS.BE("notification","silence")),variant:"outlined",size:"small",onClick:()=>l(e),children:a.jsxRuntimeExports.jsx(R.Close,{})})]}),a.jsxRuntimeExports.jsxs(te.Box$1,{y:!0,align:"start",className:d.CSS(d.CSS.BE("notification","content")),gap:"small",children:[m??a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS(d.CSS.BE("notification","message")),lineClamp:3,grow:!0,children:o}),n!=null&&a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS(d.CSS.BE("notification","description")),level:"small",lineClamp:8,grow:!0,children:n})]}),c!=null&&a.jsxRuntimeExports.jsx(te.Box$1,{x:!0,align:"center",justify:"end",className:d.CSS(d.CSS.BE("notification","actions")),children:d.du.toArray(c).map(h=>a.jsxRuntimeExports.jsx(KR,{action:h},h.key))})]},t.toString())},Yr={...I.ZERO_CONTEXT_VALUE,state:S.Hk.connectivity.DEFAULT},qR={maxRetries:4,baseInterval:S.g$1.seconds(1),scale:2},[lf,cf]=R.create({defaultValue:Yr,displayName:"Synnax.Context"}),Ir=()=>cf().client,WR=()=>cf().state,_a={connected:"success",connecting:"loading",disconnected:"disabled",failed:"error"},uf="serverVersionMismatch",XR=le.object({type:le.string(),oldServer:le.boolean(),nodeVersion:le.string().optional(),clientVersion:le.string()}),JR=(e,t,r)=>`Core version ${r!=null?`${r} `:""}is ${e?"older":"newer"} than client version ${t}. Compatibility issues may arise.`,QR=({children:e,client:t})=>{const{path:r}=ie.useUnidirectional({type:I.Provider.TYPE,schema:I.Provider.stateZ,state:{props:null,state:null}}),o=v.useMemo(()=>({...Yr,client:t}),[t]);return a.jsxRuntimeExports.jsx(lf,{value:o,children:a.jsxRuntimeExports.jsx(ie.Composite,{path:r,children:e})})},df=({children:e,connParams:t})=>{const[r,o,n]=J.useCombinedStateAndRef(Yr),{path:s}=ie.useUnidirectional({type:I.Provider.TYPE,schema:I.Provider.stateZ,state:{props:t??null,state:null}}),i=ue.useAdder(),l=v.useCallback(c=>{n.current.state.status!==c.status&&i({variant:_a[c.status],message:c.message??d.gu.capitalize(c.status)}),o(u=>({...u,state:c}))},[i]);return po(async c=>{if(r.client!=null&&r.client.close(),t==null)return o(Yr);const u=new S.Hk({retry:qR,...t,connectivityPollFrequency:S.g$1.seconds(2)});o({client:u,state:{clusterKey:"",status:"connecting",message:"Connecting...",clientServerCompatible:!1,clientVersion:u.clientVersion}});const m=await u.connectivity.check();if(!c.aborted){if(o({client:u,state:m}),i({variant:_a[m.status],message:m.message??m.status.toUpperCase()}),m.status==="connected"&&!m.clientServerCompatible){const p=m.nodeVersion==null||d.Ku.semVerOlder(m.nodeVersion,m.clientVersion),f=JR(p,m.clientVersion,m.nodeVersion);i({variant:"warning",message:"Incompatible Core version",description:f,details:{type:uf,oldServer:p,nodeVersion:m.nodeVersion,clientVersion:m.clientVersion}})}return u.connectivity.onChange(l),()=>{u.close(),o(Yr)}}},[t,l]),a.jsxRuntimeExports.jsx(lf,{value:r,children:a.jsxRuntimeExports.jsx(ie.Composite,{path:s,children:e})})},e4=Object.freeze(Object.defineProperty({__proto__:null,CONNECTION_STATE_VARIANTS:_a,Provider:df,SERVER_VERSION_MISMATCH:uf,TestProvider:QR,statusDetailsSchema:XR,use:Ir,useConnectionState:WR},Symbol.toStringTag,{value:"Module"})),[t4,n4]=R.create({displayName:"Flux.Context",providerName:"Flux.Provider"}),dt=e=>{const t=n4("Flux.useStore"),r=ie.useUniqueKey(e);return v.useMemo(()=>t.scopedStore(r),[t,r])},mf=({children:e,...t})=>{const r=Ir(),o=ue.useErrorHandler(),n=ue.useAsyncErrorHandler(),{path:s}=ie.useLifecycle({type:I.PROVIDER_TYPE,schema:I.providerStateZ,initialState:{}}),i=()=>"client"in t?t.client:new I.Client({client:r,storeConfig:t.storeConfig,handleError:o,handleAsyncError:n}),l=J.useInitializerRef(i),c=v.useRef(null);return r?.key!==c.current?.key&&(c.current=r,l.current=i()),a.jsxRuntimeExports.jsx(ie.Composite,{path:s,children:a.jsxRuntimeExports.jsx(t4,{value:l.current,children:e})})},pf=e=>{if("initialStatusDetails"in e)return e.initialStatusDetails},as=e=>{if("details"in e.status)return e.status.details},on=((e,t,r)=>({variant:"loading",status:d.ol.create({variant:"loading",message:`${d.gu.capitalize(e)}`,details:r}),data:t})),gt=((e,t,r)=>({variant:"success",status:d.ol.create({variant:"success",message:`Successfully ${e}`,details:r}),data:t})),zn=(e,t)=>({variant:"error",status:d.ol.fromException(t,`Failed to ${e}`),data:void 0}),xr=((e,t)=>({variant:"disabled",status:d.ol.create({variant:"disabled",message:`Failed to ${e}`,description:`Cannot ${e} because no Core is connected.`,details:t}),data:void 0})),[ff,r4]=R.create({defaultValue:null,displayName:"Form.Context"}),ln=(e,t="Form.useContext")=>{const r=r4();if(r==null&&e==null)throw new Error(`${t} must be used within a Form context value`);return e??r},cn=((e,t={})=>{const{optional:r=!1,onChange:o,defaultValue:n}=t,s=ln(t?.ctx,`useField(${e})`),{get:i,bind:l,set:c,setStatus:u}=s,m=v.useCallback(x=>{o?.(x,{...s,path:e}),c(e,x)},[e,c,o]),p=v.useCallback(x=>u(e,x),[e,u]),f=v.useSyncExternalStore(l,v.useCallback(()=>i(e,{optional:r,defaultValue:n}),[e,i,r,n]));if(f==null){if(!r)throw new Error(`Field state is null: ${e}`);return null}const h=s.mode==="preview"?"preview":void 0;return{onChange:m,setStatus:p,variant:h,...f}}),cl=((e,t)=>{const{get:r,bind:o}=ln(t?.ctx);return v.useSyncExternalStore(o,v.useCallback(()=>r(e,t),[e,r,t]))}),Mn=((e,t)=>cl(e,t)?.value??null),o4=e=>cl(e,{optional:!0})?.status?.variant==="success",ul=(e,t)=>({value:()=>e.get(t).value,add:(r,o)=>{const n=d.il.copy(e.get(t).value);n.splice(o,0,...d.du.toArray(r)),e.set(t,n)},push:(r,o)=>{const n=d.il.copy(e.get(t).value);n.push(...d.du.toArray(r)),o!=null&&n.sort(o),e.set(t,n)},remove:r=>{const o=e.get(t).value,n=new Set(d.du.toArray(r)),s=o.filter(({key:i})=>!n.has(i));return e.set(t,s),s.map(({key:i})=>i)},keepOnly:r=>{const o=e.get(t).value,n=new Set(d.du.toArray(r)),s=o.filter(({key:i})=>n.has(i));return e.set(t,s),s.map(({key:i})=>i)},set:r=>e.set(t,he.executeSetter(r,e.get(t).value)),sort:r=>{const o=d.il.copy(e.get(t).value);o.sort(r),e.set(t,o)}}),s4=(e,t)=>ul(ln(t?.ctx),e),dl=(e,t={})=>{const r=ln(t?.ctx),o=Mn(e,t);return v.useMemo(()=>({data:o.map(({key:n})=>n),...ul(r,e)}),[o,r,e])},i4=()=>a.jsxRuntimeExports.jsx(R.Caret.Right,{className:d.CSS.BE("breadcrumb","separator")}),Dn=({children:e,...t})=>a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS.BE("breadcrumb","segment"),...t,defaultEl:"span",children:e}),Gs=({children:e,highlightVariant:t,...r})=>a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS(d.CSS.B("breadcrumb"),t!=null&&d.CSS.BM("breadcrumb","highlight",t)),x:!0,align:"center",gap:"small",...r,children:v.Children.map(e,(o,n)=>o==null||typeof o=="boolean"?null:a.jsxRuntimeExports.jsxs(v.Fragment,{children:[n>0&&a.jsxRuntimeExports.jsx(i4,{}),typeof o=="string"?a.jsxRuntimeExports.jsx(Dn,{children:o}):o]},n))}),a4=(e,t)=>{const r=e.split("/");return r.map((o,n)=>t({href:r.slice(0,n+1).join("/"),segment:o,index:n}))},l4=Object.freeze(Object.defineProperty({__proto__:null,Breadcrumb:Gs,Segment:Dn,mapURLSegments:a4},Symbol.toStringTag,{value:"Module"})),xf=({error:e,componentStack:t,resetErrorBoundary:r,children:o=a.jsxRuntimeExports.jsx(c4,{resetErrorBoundary:r}),extraInfo:n})=>{const[s,i]=v.useState(!1),l=v.useCallback(()=>{(async()=>{try{const c=[];c.push(`Error: ${e.name}`),c.push(`Message: ${e.message}`),e.stack&&c.push(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("./Text-DW5FpCk9.cjs"),S=require("./provider-DksyuJua.cjs"),d=require("./css-D3NdC2sx.cjs"),le=require("zod"),I=require("./value-CZfzRi_x.cjs"),v=require("react"),a=require("./jsx-runtime-nZSsnGb7.cjs"),ie=require("./Provider-BA3zQVbv.cjs"),J=require("./Editable-C-z-stcD.cjs"),he=require("./types-C0tUDfsz.cjs"),te=require("./Box-D27bV7QJ.cjs"),ue=require("./Tags-DWsEZD9t.cjs"),je=require("./Button-BSek5HG5.cjs"),we=require("./external-PXU0gc_j.cjs"),bt=require("./Items-07R286kW.cjs"),it=require("./Animated-Dvm2k_z_.cjs"),Gp=require("react-dom"),De=require("./Haul-WgPKptr9.cjs"),yt=require("./external-BwRkgEyo.cjs"),_R=require("./useStaticData-BTwIe0Il.cjs"),rl=require("./external-B9omdiDK.cjs"),Kp=require("./Animated-umWjgTzy.cjs"),Je=require("./external-5_uHky7w.cjs"),Ft=require("./event-BxvV3arE.cjs"),Bs=require("./external-DyTk_hS7.cjs"),dr=require("./hooks-Eb94kuDd.cjs"),Yp=require("./external-BIbdeWQE.cjs"),fd=require("./dimensions-C7b02rFi.cjs"),Vs=require("./external-DojNoICL.cjs"),xd=require("./Menu-58O-OOPJ.cjs");;/* empty css */const Xr=require("./external-Ct2A_YCT.cjs"),qp=require("./units-Bd_mf9Ye.cjs"),CR=require("./external-DT82RBon.cjs"),We=require("./external-BRA_zA83.cjs"),fs=require("./eraser-Bocga8Eb.cjs"),kR=require("./external-B3o5P8Yw.cjs"),$R=require("./external-Bjh6lsVm.cjs"),IR=require("./Video-CBPTBLTB.cjs"),NR=Object.freeze(Object.defineProperty({__proto__:null,Access:R.Access,Acquire:R.Acquire,Add:R.Add,Align:R.Align,Analyze:R.Analyze,Annotate:R.Annotate,Annotation:R.Annotation,Arc:R.Arc,Array:R.Array,Arrow:R.Arrow,Attachment:R.Attachment,Auto:R.Auto,AutoFitWidth:R.AutoFitWidth,Binary:R.Binary,Bolt:R.Bolt,Boolean:R.Boolean,Box:R.Box,Bridge:R.Bridge,CPlusPlus:R.CPlusPlus,CSV:R.CSV,Calculation:R.Calculation,Calendar:R.Calendar,Caret:R.Caret,Channel:R.Channel,Check:R.Check,Circle:R.Circle,Click:R.Click,Close:R.Close,Cluster:R.Cluster,Commit:R.Commit,Completed:R.Completed,Concepts:R.Concepts,Connect:R.Connect,Constant:R.Constant,Control:R.Control,Copy:R.Copy,Cut:R.Cut,DarkMode:R.DarkMode,Dashboard:R.Dashboard,Decimal:R.Decimal,Delete:R.Delete,Details:R.Details,Device:R.Device,Disable:R.Disable,Disconnect:R.Disconnect,Distribute:R.Distribute,Download:R.Download,Downsample:R.Downsample,Drag:R.Drag,Dynamic:R.Dynamic,Edit:R.Edit,EditOff:R.EditOff,Enable:R.Enable,Err:R.Err,Expand:R.Expand,Explore:R.Explore,Export:R.Export,False:R.False,Feedback:R.Feedback,FillColor:R.FillColor,Filter:R.Filter,Fitting:R.Fitting,Focus:R.Focus,Function:R.Function,Group:R.Group,Guide:R.Guide,Hardware:R.Hardware,Heart:R.Heart,Hidden:R.Hidden,Import:R.Import,InProgress:R.InProgress,Index:R.Index,Info:R.Info,JSON:R.JSON,KebabMenu:R.KebabMenu,Keyboard:R.Keyboard,Label:R.Label,LightMode:R.LightMode,LinePlot:R.LinePlot,Linear:R.Linear,Link:R.Link,LinkExternal:R.LinkExternal,Loading:R.Loading,Log:R.Log,Logo:R.Logo,Logout:R.Logout,Map:R.Map,Menu:R.Menu,MoveToMainWindow:R.MoveToMainWindow,NPM:R.NPM,Node:R.Node,None:R.None,Notification:R.Notification,OpenExternal:R.OpenExternal,OpenInNewWindow:R.OpenInNewWindow,PNPM:R.PNPM,Pan:R.Pan,Paste:R.Paste,Pause:R.Pause,Play:R.Play,Policy:R.Policy,Process:R.Process,Pump:R.Pump,Python:R.Python,QuestionMark:R.QuestionMark,Rack:R.Rack,Range:R.Range,Reference:R.Reference,Refresh:R.Refresh,Release:R.Release,Rename:R.Rename,Reset:R.Reset,Resources:R.Resources,Role:R.Role,Rotate:R.Rotate,RotateAroundCenter:R.RotateAroundCenter,RotateGroup:R.RotateGroup,Rule:R.Rule,Safety:R.Safety,Save:R.Save,Schematic:R.Schematic,Search:R.Search,Select:R.Select,Selection:R.Selection,Settings:R.Settings,Snapshot:R.Snapshot,Snooze:R.Snooze,Sound:R.Sound,SplitX:R.SplitX,SplitY:R.SplitY,StarFilled:R.StarFilled,StarOutlined:R.StarOutlined,Status:R.Status,String:R.String,StrokeColor:R.StrokeColor,StrokeWidth:R.StrokeWidth,Subtract:R.Subtract,Sync:R.Sync,Table:R.Table,Tank:R.Tank,Tare:R.Tare,Task:R.Task,Terminal:R.Terminal,Text:R.Text$1,TextAlign:R.TextAlign,Time:R.Time,ToDo:R.ToDo,Tooltip:R.Tooltip,True:R.True,Type:R.Type,TypeScript:R.TypeScript,Units:R.Units,User:R.User,Value:R.Value,Valve:R.Valve,Variable:R.Variable,View:R.View,Virtual:R.Virtual,Visible:R.Visible,Visualize:R.Visualize,Warning:R.Warning,Wave:R.Wave,Workspace:R.Workspace,Yarn:R.Yarn,Zoom:R.Zoom,createComposite:R.createComposite,resolve:R.resolve,wrapSVGIcon:R.wrapSVGIcon},Symbol.toStringTag,{value:"Module"})),AR=R.createComposite(R.Policy,{topRight:R.Add}),ot={present:"rename",past:"renamed",participle:"renaming"},Xe={present:"delete",past:"deleted",participle:"deleting"},ol={present:"update",past:"updated",participle:"updating"},Vt={present:"create",past:"created",participle:"creating"},sl={present:"snapshot",past:"snapshotted",participle:"snapshotting"},Wp={present:"copy",past:"copied",participle:"copying"},Xp={present:"set",past:"set",participle:"setting"},PR={present:"save",past:"saved",participle:"saving"},Jp=Symbol(),il=Symbol(),Mr="a",is="w";let TR=(e,t)=>new Proxy(e,t);const ba=Object.getPrototypeOf,hd=new WeakMap,al=e=>e&&(hd.has(e)?hd.get(e):ba(e)===Object.prototype||ba(e)===Array.prototype),gd=e=>typeof e=="object"&&e!==null,yd=new WeakMap,Qp=e=>e[il]||e,ef=(e,t,r)=>{if(!al(e))return e;const o=Qp(e),n=(i=>Object.isFrozen(i)||Object.values(Object.getOwnPropertyDescriptors(i)).some(l=>!l.writable))(o);let s=r&&r.get(o);return s&&s[1].f===n||(s=((i,l)=>{const c={f:l};let u=!1;const m=(f,h)=>{if(!u){let x=c[Mr].get(i);if(x||(x={},c[Mr].set(i,x)),f===is)x[is]=!0;else{let g=x[f];g||(g=new Set,x[f]=g),g.add(h)}}},p={get:(f,h)=>h===il?i:(m("k",h),ef(Reflect.get(f,h),c[Mr],c.c)),has:(f,h)=>h===Jp?(u=!0,c[Mr].delete(i),!0):(m("h",h),Reflect.has(f,h)),getOwnPropertyDescriptor:(f,h)=>(m("o",h),Reflect.getOwnPropertyDescriptor(f,h)),ownKeys:f=>(m(is),Reflect.ownKeys(f))};return l&&(p.set=p.deleteProperty=()=>!1),[p,c]})(o,n),s[1].p=TR(n?(i=>{let l=yd.get(i);if(!l){if(Array.isArray(i))l=Array.from(i);else{const c=Object.getOwnPropertyDescriptors(i);Object.values(c).forEach(u=>{u.configurable=!0}),l=Object.create(ba(i),c)}yd.set(i,l)}return l})(o):o,s[0]),r&&r.set(o,s)),s[1][Mr]=t,s[1].c=r,s[1].p},tf=(e,t,r,o)=>{if(Object.is(e,t))return!1;if(!gd(e)||!gd(t))return!0;const n=r.get(Qp(e));if(!n)return!0;if(o){const i=o.get(e);if(i&&i.n===t)return i.g;o.set(e,{n:t,g:!1})}let s=null;try{for(const i of n.h||[])if(s=Reflect.has(e,i)!==Reflect.has(t,i),s)return s;if(n[is]===!0){if(s=((i,l)=>{const c=Reflect.ownKeys(i),u=Reflect.ownKeys(l);return c.length!==u.length||c.some((m,p)=>m!==u[p])})(e,t),s)return s}else for(const i of n.o||[])if(s=!!Reflect.getOwnPropertyDescriptor(e,i)!=!!Reflect.getOwnPropertyDescriptor(t,i),s)return s;for(const i of n.k||[])if(s=tf(e[i],t[i],r,o),s)return s;return s===null&&(s=!0),s}finally{o&&o.set(e,{n:t,g:s})}},OR=e=>!!al(e)&&Jp in e,nf=e=>al(e)&&e[il]||null,LR="h",zR="w",MR="o",DR="k",Ra=e=>typeof e=="object"&&e!==null,rf=(e,t)=>{if(!Ra(e))return e;const r=nf(e);return r!==null?(OR(e),r):(t.has(e)||(t.add(e),Object.entries(e).forEach(([o,n])=>{const s=rf(n,t);Object.is(s,n)||(e[o]=s)})),e)},wa=(e,t,r)=>{var o,n,s;if(!Ra(e)||!Ra(t))return;const i=r.get(nf(t)||t);i&&((o=i[LR])==null||o.forEach(l=>{Reflect.has(e,l)}),i[zR]===!0&&Reflect.ownKeys(e),(n=i[MR])==null||n.forEach(l=>{Reflect.getOwnPropertyDescriptor(e,l)}),(s=i[DR])==null||s.forEach(l=>{wa(e[l],t[l],r)}))},ta="o",na="r",ra="a";function UR(e,t){var r;let o=0;const n=(r=t?.size)!=null?r:1,s=[],i=t!=null&&t.noWeakMap?null:new WeakMap;return c=>{const u=i?.get(c);if(u)return u[na];for(let x=0;x<n;x+=1){const g=s[(o+x)%n];if(!g)break;if(!tf(g[ta],c,g[ra],new WeakMap))return wa(c,g[ta],g[ra]),i?.set(c,g),g[na]}const m=new WeakMap,p=ef(c,m),f=rf(e(p),new Set);wa(c,c,m);const h={[ta]:c,[na]:f,[ra]:m};return o=(o-1+n)%n,s[o]=h,i?.set(c,h),f}}const ZR=(e,t)=>d.rl.RUNTIME==="browser"?UR(e,t):e,po=(e,t)=>{v.useEffect(()=>{const r=new AbortController,o=r.signal,s=(async()=>(await d.sl.flushTaskQueue(),await e(o)))().catch(console.error);return()=>{r.abort(),s.then(i=>i?.()).catch(console.error)}},t)},FR=ie.useVirtualCursorDragWebKit,Hs=()=>{const e=v.useRef([]),t=v.useMemo(()=>({cleanup:()=>{e.current.forEach(r=>r()),e.current=[]},set:r=>{r!=null&&e.current.push(...d.du.toArray(r))}}),[]);return v.useEffect(()=>t.cleanup,[t.cleanup]),t},ll={info:"var(--pluto-text-color)",error:"var(--pluto-error-z)",warning:"var(--pluto-warning-m1)",success:"var(--pluto-primary-z)",loading:"var(--pluto-text-color)",disabled:"var(--pluto-gray-l8)"},vn=({variant:e,...t})=>e==="loading"?a.jsxRuntimeExports.jsx(R.Loading,{...t}):a.jsxRuntimeExports.jsx(R.Circle,{color:e!=null?ll[e]:void 0,...t}),BR=Object.freeze(Object.defineProperty({__proto__:null,Config:je.Config,Dialog:je.Dialog,chooseLocation:je.chooseLocation,formatTip:je.formatTip,useConfig:je.useConfig,wrap:je.wrap},Symbol.toStringTag,{value:"Module"})),VR=(e,t)=>{const r=new d.E(e).makeValid();if(r.start.equals(d.d.MAX))return null;const o=r.start.isToday?"time":"dateTime";let n=new d.d(r.start).toString(o,t);if(r.start.isToday&&(n=`Today ${n}`),r.end.equals(d.d.MAX))return r.start.before(d.d.now())?`Started ${n}`:`Starts ${n}`;const s=r.end.span(r.start)<d.g.DAY?"time":"dateTime",i=new d.d(r.end).toString(s,t);return[n,i]},of=({children:e,level:t="p",color:r=9,displayTZ:o="local",weight:n=450,...s})=>{const i=VR(e,o);return i==null?null:a.jsxRuntimeExports.jsx(te.Box$1,{x:!0,gap:"small",align:"center",...s,children:a.jsxRuntimeExports.jsx(J.Text,{level:t,color:r,weight:n,gap:"tiny",children:typeof i=="string"?i:a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[i[0],a.jsxRuntimeExports.jsx(R.Arrow.Right,{color:9,size:"1em"}),i[1]]})})})},sf=({children:e,format:t,...r})=>a.jsxRuntimeExports.jsx(J.Text,{...r,children:new d.g(e).toString(t)}),af=e=>{const[,t]=v.useState(0);return v.useEffect(()=>{const r=setInterval(()=>{t(o=>o+1)},1e3);return()=>clearInterval(r)},[]),d.d.since(e)},HR=({children:e,...t})=>{const r=af(e);return a.jsxRuntimeExports.jsx(sf,{...t,children:r})},GR=Object.freeze(Object.defineProperty({__proto__:null,TimeRange:of,TimeSpan:sf,TimeSpanSince:HR,TimeStamp:we.TimeStamp,useTimeSpanSince:af},Symbol.toStringTag,{value:"Module"})),KR=({action:e})=>v.isValidElement(e)?e:v.createElement(je.Button,{...e,key:e.key,size:"tiny"}),YR=({status:{key:e,time:t,count:r,message:o,description:n,variant:s,name:i},silence:l,actions:c,className:u,children:m,...p})=>{const f=v.useRef(null);return a.jsxRuntimeExports.jsxs(te.Box$1,{className:d.CSS(d.CSS.B("notification"),u),y:!0,empty:!0,ref:f,...p,children:[a.jsxRuntimeExports.jsxs(te.Box$1,{x:!0,justify:"between",grow:!0,className:d.CSS(d.CSS.BE("notification","header")),children:[a.jsxRuntimeExports.jsxs(te.Box$1,{x:!0,align:"center",gap:"small",children:[a.jsxRuntimeExports.jsxs(J.Text,{level:"small",status:s,gap:"tiny",className:d.CSS(d.CSS.BE("notification","name")),children:[a.jsxRuntimeExports.jsx(vn,{variant:s}),a.jsxRuntimeExports.jsx(J.Text,{el:"span",overflow:"ellipsis",status:s,children:d.pu.isNonZero(i)&&i})]}),a.jsxRuntimeExports.jsx(J.Text,{level:"small",children:`x${r}`}),a.jsxRuntimeExports.jsx(we.TimeStamp,{className:d.CSS(d.CSS.BE("notification","time")),level:"small",format:"time",children:t})]}),a.jsxRuntimeExports.jsx(je.Button,{className:d.CSS(d.CSS.BE("notification","silence")),variant:"outlined",size:"small",onClick:()=>l(e),children:a.jsxRuntimeExports.jsx(R.Close,{})})]}),a.jsxRuntimeExports.jsxs(te.Box$1,{y:!0,align:"start",className:d.CSS(d.CSS.BE("notification","content")),gap:"small",children:[m??a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS(d.CSS.BE("notification","message")),lineClamp:3,grow:!0,children:o}),n!=null&&a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS(d.CSS.BE("notification","description")),level:"small",lineClamp:8,grow:!0,children:n})]}),c!=null&&a.jsxRuntimeExports.jsx(te.Box$1,{x:!0,align:"center",justify:"end",className:d.CSS(d.CSS.BE("notification","actions")),children:d.du.toArray(c).map(h=>a.jsxRuntimeExports.jsx(KR,{action:h},h.key))})]},t.toString())},Yr={...I.ZERO_CONTEXT_VALUE,state:S.Hk.connectivity.DEFAULT},qR={maxRetries:4,baseInterval:S.g$1.seconds(1),scale:2},[lf,cf]=R.create({defaultValue:Yr,displayName:"Synnax.Context"}),Ir=()=>cf().client,WR=()=>cf().state,_a={connected:"success",connecting:"loading",disconnected:"disabled",failed:"error"},uf="serverVersionMismatch",XR=le.object({type:le.string(),oldServer:le.boolean(),nodeVersion:le.string().optional(),clientVersion:le.string()}),JR=(e,t,r)=>`Core version ${r!=null?`${r} `:""}is ${e?"older":"newer"} than client version ${t}. Compatibility issues may arise.`,QR=({children:e,client:t})=>{const{path:r}=ie.useUnidirectional({type:I.Provider.TYPE,schema:I.Provider.stateZ,state:{props:null,state:null}}),o=v.useMemo(()=>({...Yr,client:t}),[t]);return a.jsxRuntimeExports.jsx(lf,{value:o,children:a.jsxRuntimeExports.jsx(ie.Composite,{path:r,children:e})})},df=({children:e,connParams:t})=>{const[r,o,n]=J.useCombinedStateAndRef(Yr),{path:s}=ie.useUnidirectional({type:I.Provider.TYPE,schema:I.Provider.stateZ,state:{props:t??null,state:null}}),i=ue.useAdder(),l=v.useCallback(c=>{n.current.state.status!==c.status&&i({variant:_a[c.status],message:c.message??d.gu.capitalize(c.status)}),o(u=>({...u,state:c}))},[i]);return po(async c=>{if(r.client!=null&&r.client.close(),t==null)return o(Yr);const u=new S.Hk({retry:qR,...t,connectivityPollFrequency:S.g$1.seconds(2)});o({client:u,state:{clusterKey:"",status:"connecting",message:"Connecting...",clientServerCompatible:!1,clientVersion:u.clientVersion}});const m=await u.connectivity.check();if(!c.aborted){if(o({client:u,state:m}),i({variant:_a[m.status],message:m.message??m.status.toUpperCase()}),m.status==="connected"&&!m.clientServerCompatible){const p=m.nodeVersion==null||d.Ku.semVerOlder(m.nodeVersion,m.clientVersion),f=JR(p,m.clientVersion,m.nodeVersion);i({variant:"warning",message:"Incompatible Core version",description:f,details:{type:uf,oldServer:p,nodeVersion:m.nodeVersion,clientVersion:m.clientVersion}})}return u.connectivity.onChange(l),()=>{u.close(),o(Yr)}}},[t,l]),a.jsxRuntimeExports.jsx(lf,{value:r,children:a.jsxRuntimeExports.jsx(ie.Composite,{path:s,children:e})})},e4=Object.freeze(Object.defineProperty({__proto__:null,CONNECTION_STATE_VARIANTS:_a,Provider:df,SERVER_VERSION_MISMATCH:uf,TestProvider:QR,statusDetailsSchema:XR,use:Ir,useConnectionState:WR},Symbol.toStringTag,{value:"Module"})),[t4,n4]=R.create({displayName:"Flux.Context",providerName:"Flux.Provider"}),dt=e=>{const t=n4("Flux.useStore"),r=ie.useUniqueKey(e);return v.useMemo(()=>t.scopedStore(r),[t,r])},mf=({children:e,...t})=>{const r=Ir(),o=ue.useErrorHandler(),n=ue.useAsyncErrorHandler(),{path:s}=ie.useLifecycle({type:I.PROVIDER_TYPE,schema:I.providerStateZ,initialState:{}}),i=()=>"client"in t?t.client:new I.Client({client:r,storeConfig:t.storeConfig,handleError:o,handleAsyncError:n}),l=J.useInitializerRef(i),c=v.useRef(null);return r?.key!==c.current?.key&&(c.current=r,l.current=i()),a.jsxRuntimeExports.jsx(ie.Composite,{path:s,children:a.jsxRuntimeExports.jsx(t4,{value:l.current,children:e})})},pf=e=>{if("initialStatusDetails"in e)return e.initialStatusDetails},as=e=>{if("details"in e.status)return e.status.details},on=((e,t,r)=>({variant:"loading",status:d.ol.create({variant:"loading",message:`${d.gu.capitalize(e)}`,details:r}),data:t})),gt=((e,t,r)=>({variant:"success",status:d.ol.create({variant:"success",message:`Successfully ${e}`,details:r}),data:t})),zn=(e,t)=>({variant:"error",status:d.ol.fromException(t,`Failed to ${e}`),data:void 0}),xr=((e,t)=>({variant:"disabled",status:d.ol.create({variant:"disabled",message:`Failed to ${e}`,description:`Cannot ${e} because no Core is connected.`,details:t}),data:void 0})),[ff,r4]=R.create({defaultValue:null,displayName:"Form.Context"}),ln=(e,t="Form.useContext")=>{const r=r4();if(r==null&&e==null)throw new Error(`${t} must be used within a Form context value`);return e??r},cn=((e,t={})=>{const{optional:r=!1,onChange:o,defaultValue:n}=t,s=ln(t?.ctx,`useField(${e})`),{get:i,bind:l,set:c,setStatus:u}=s,m=v.useCallback(x=>{o?.(x,{...s,path:e}),c(e,x)},[e,c,o]),p=v.useCallback(x=>u(e,x),[e,u]),f=v.useSyncExternalStore(l,v.useCallback(()=>i(e,{optional:r,defaultValue:n}),[e,i,r,n]),()=>null);if(f==null){if(!r)throw new Error(`Field state is null: ${e}`);return null}const h=s.mode==="preview"?"preview":void 0;return{onChange:m,setStatus:p,variant:h,...f}}),cl=((e,t)=>{const{get:r,bind:o}=ln(t?.ctx);return v.useSyncExternalStore(o,v.useCallback(()=>r(e,t),[e,r,t]),()=>null)}),Mn=((e,t)=>cl(e,t)?.value??null),o4=e=>cl(e,{optional:!0})?.status?.variant==="success",ul=(e,t)=>({value:()=>e.get(t).value,add:(r,o)=>{const n=d.il.copy(e.get(t).value);n.splice(o,0,...d.du.toArray(r)),e.set(t,n)},push:(r,o)=>{const n=d.il.copy(e.get(t).value);n.push(...d.du.toArray(r)),o!=null&&n.sort(o),e.set(t,n)},remove:r=>{const o=e.get(t).value,n=new Set(d.du.toArray(r)),s=o.filter(({key:i})=>!n.has(i));return e.set(t,s),s.map(({key:i})=>i)},keepOnly:r=>{const o=e.get(t).value,n=new Set(d.du.toArray(r)),s=o.filter(({key:i})=>n.has(i));return e.set(t,s),s.map(({key:i})=>i)},set:r=>e.set(t,he.executeSetter(r,e.get(t).value)),sort:r=>{const o=d.il.copy(e.get(t).value);o.sort(r),e.set(t,o)}}),s4=(e,t)=>ul(ln(t?.ctx),e),dl=(e,t={})=>{const r=ln(t?.ctx),o=Mn(e,t);return v.useMemo(()=>({data:o.map(({key:n})=>n),...ul(r,e)}),[o,r,e])},i4=()=>a.jsxRuntimeExports.jsx(R.Caret.Right,{className:d.CSS.BE("breadcrumb","separator")}),Dn=({children:e,...t})=>a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS.BE("breadcrumb","segment"),...t,defaultEl:"span",children:e}),Gs=({children:e,highlightVariant:t,...r})=>a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS(d.CSS.B("breadcrumb"),t!=null&&d.CSS.BM("breadcrumb","highlight",t)),x:!0,align:"center",gap:"small",...r,children:v.Children.map(e,(o,n)=>o==null||typeof o=="boolean"?null:a.jsxRuntimeExports.jsxs(v.Fragment,{children:[n>0&&a.jsxRuntimeExports.jsx(i4,{}),typeof o=="string"?a.jsxRuntimeExports.jsx(Dn,{children:o}):o]},n))}),a4=(e,t)=>{const r=e.split("/");return r.map((o,n)=>t({href:r.slice(0,n+1).join("/"),segment:o,index:n}))},l4=Object.freeze(Object.defineProperty({__proto__:null,Breadcrumb:Gs,Segment:Dn,mapURLSegments:a4},Symbol.toStringTag,{value:"Module"})),xf=({error:e,componentStack:t,resetErrorBoundary:r,children:o=a.jsxRuntimeExports.jsx(c4,{resetErrorBoundary:r}),extraInfo:n})=>{const[s,i]=v.useState(!1),l=v.useCallback(()=>{(async()=>{try{const c=[];c.push(`Error: ${e.name}`),c.push(`Message: ${e.message}`),e.stack&&c.push(`
2
2
  Stack Trace:
3
3
  ${e.stack}
4
4
  `),t&&c.push(`
@@ -6,7 +6,7 @@ Component Stack:
6
6
  ${t}`),n&&Object.keys(n).length>0&&c.push(`
7
7
  Additional Info:
8
8
  ${JSON.stringify(n,null,2)}`),await navigator.clipboard.writeText(c.join(`
9
- `)),i(!0),setTimeout(()=>i(!1),3e3)}catch(c){console.error(c)}})()},[e,t,n]);return a.jsxRuntimeExports.jsx(te.Box$1,{className:d.CSS.BE("error-fallback","container"),y:!0,grow:!0,center:!0,children:a.jsxRuntimeExports.jsxs(te.Box$1,{background:2,rounded:!0,className:d.CSS.BE("error-fallback","content"),bordered:!0,borderColor:5,empty:!0,children:[a.jsxRuntimeExports.jsxs(we.Bar,{location:"top",bordered:!0,size:"6rem",children:[a.jsxRuntimeExports.jsx(we.Bar.Start,{className:d.CSS.BE("error-fallback","nav-start"),children:a.jsxRuntimeExports.jsxs(Gs,{gap:"tiny",children:[a.jsxRuntimeExports.jsx(Dn,{color:9,children:a.jsxRuntimeExports.jsx(R.Err,{})}),a.jsxRuntimeExports.jsx(Dn,{color:9,className:d.CSS.BE("error-fallback","header-text"),children:"Something went wrong"})]})}),a.jsxRuntimeExports.jsx(we.Bar.End,{className:d.CSS.BE("error-fallback","nav-end"),children:a.jsxRuntimeExports.jsx(we.de,{variant:"icon"})})]}),a.jsxRuntimeExports.jsxs(te.Box$1,{className:d.CSS.BE("error-fallback","body"),children:[a.jsxRuntimeExports.jsxs(te.Box$1,{children:[a.jsxRuntimeExports.jsx(J.Text,{level:"h3",status:"error",className:d.CSS.BE("error-fallback","name"),children:e.name}),a.jsxRuntimeExports.jsx(J.Text,{level:"h5",color:10,className:d.CSS.BE("error-fallback","message"),children:e.message})]}),a.jsxRuntimeExports.jsx(Xr.Divider,{x:!0}),a.jsxRuntimeExports.jsx(J.Text,{level:"h5",color:9,children:"Stack trace"}),a.jsxRuntimeExports.jsx(te.Box$1,{rounded:!0,className:d.CSS.BE("error-fallback","stack-container"),background:1,bordered:!0,children:d.pu.isNonZero(t||e.stack)&&a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS.BE("error-fallback","stack"),level:"small",color:9,children:t||e.stack})}),a.jsxRuntimeExports.jsx(Xr.Divider,{x:!0}),a.jsxRuntimeExports.jsxs(te.Box$1,{justify:"between",x:!0,children:[a.jsxRuntimeExports.jsxs(je.Button,{variant:"outlined",size:"small",onClick:l,children:[s?a.jsxRuntimeExports.jsx(R.Check,{}):a.jsxRuntimeExports.jsx(R.Copy,{}),"Copy diagnostics"]}),a.jsxRuntimeExports.jsx(te.Box$1,{x:!0,children:o})]})]})]})})},c4=({resetErrorBoundary:e})=>a.jsxRuntimeExports.jsx(je.Button,{variant:"filled",size:"small",onClick:e,children:"Reload"});class Ks extends v.Component{state={error:null,componentStack:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,r){this.setState({componentStack:r.componentStack??null}),this.props.onError?.(t,r)}resetErrorBoundary=()=>{this.props.onReset?.(),this.setState({error:null,componentStack:null})};render(){const{error:t,componentStack:r}=this.state,{children:o,FallbackComponent:n=xf}=this.props;return t!=null?a.jsxRuntimeExports.jsx(n,{error:t,componentStack:r,resetErrorBoundary:this.resetErrorBoundary}):o}}const u4=Object.freeze(Object.defineProperty({__proto__:null,Boundary:Ks,Fallback:xf},Symbol.toStringTag,{value:"Module"})),ml=({ref:e,location:t,style:r,size:o,className:n,children:s,onDragStart:i,sizeUnits:l="px",showHandle:c=!0,...u})=>{const m=d.Mu.construct(t),p=d.Mu.direction(m),f=d.vu.dimension(p);return a.jsxRuntimeExports.jsxs(te.Box$1,{className:d.CSS(d.CSS.B("resize"),d.CSS.loc(m),n),style:{[f]:`${o}${l}`,...r},ref:e,direction:p,empty:!0,...u,children:[s,c&&a.jsxRuntimeExports.jsx("div",{draggable:!0,className:d.CSS(d.CSS.BE("resize","handle"),d.CSS.bordered(d.Mu.swap(m))),onDragStart:i,onDrag:Ft.preventDefault,onDragEnd:Ft.preventDefault})]})},hf=({onResize:e,count:t,initialSizes:r=[],minSize:o=100,direction:n="x"})=>{const s=v.useRef(null),[i,l]=v.useState({sizeDistribution:d4(r,t),root:null}),c=v.useCallback((p,f,h)=>{if(s.current==null)return;const x=d.Eu.dim(d.Eu.construct(s.current),n);l(g=>sa(g,x,p,o,f,h))},[o,l,n]);v.useEffect(()=>e?.(i.sizeDistribution),[i.sizeDistribution,e]);const u=v.useCallback((p,f)=>{p.preventDefault();const h=n==="x"?"clientX":"clientY",x=y=>c(f,y[h]),g=()=>{l(y=>({...y,root:null})),document.removeEventListener("mousemove",x)};l(y=>({...y,root:p[h]})),document.addEventListener("mousemove",x),document.addEventListener("mouseup",g,{once:!0})},[l,n,sa]);return{setSize:v.useCallback((p,f)=>c(p,void 0,f),[sa]),props:{direction:n,sizeDistribution:i.sizeDistribution,onDragHandle:u,ref:s}}},gf=({ref:e,direction:t="x",children:r,sizeDistribution:o,onDragHandle:n,className:s,...i})=>{const l=d.vu.construct(t),c=v.Children.toArray(r);return o=m4(o),a.jsxRuntimeExports.jsx(te.Box$1,{...i,ref:e,direction:l,className:d.CSS(d.CSS.B("resize-multiple"),s),empty:!0,grow:!0,children:c.map((u,m)=>a.jsxRuntimeExports.jsx(ml,{onDragStart:p=>n(p,m),location:d.vu.location(l),size:o[m]*100,sizeUnits:"%",showHandle:m!==c.length-1,children:u},m))})},d4=(e,t)=>{const r=e.reduce((n,s)=>n+s,0),o=t-e.length;if(o<=0)return e.slice(0,t).map(n=>n/r);if(e.every(n=>n<=1)){const n=1-r;return[...e,...Array(o).fill(n/o)]}return e.map(()=>1/t)},oa=.001,m4=e=>e.every(t=>d.Nu.closeTo(t,1/e.length),oa)?e.map((t,r)=>r%2===0?t+oa:r===e.length-1?t:t-oa):e,sa=(e,t,r,o,n,s)=>{const i=yf(e,t,r,n,s),[l,c]=p4(e.sizeDistribution,r,i,o/t),u=c?n??null:e.root;return{...e,sizeDistribution:l,root:u}},yf=(e,t,r,o,n)=>{let s;if(n!=null)n>1&&(n/=t),s=n-e.sizeDistribution[r];else if(o!=null){if(e.root===null)throw new Error("resize root is null during handle drag");s=(o-e.root)/t}else throw new Error("must provide either a MouseEvent or a targetSize");return s},p4=(e,t,r,o)=>{let n=t;for(;n>0&&e[n]+r<=o;)n--;const s=e[n]+r,i=f4(n,e,o,r),l=e[i]-r;return s<o||l<o?[e,!1]:[e.map((c,u)=>u===n?s:u===i?l:c),!0]},f4=(e,t,r,o)=>(e===t.length-1?h4:x4)(e,t,r,o),x4=(e,t,r,o)=>{let n=e+1;for(;n<t.length-1&&t[n]-o<=r;)n++;return n},h4=(e,t,r,o)=>{let n=e-1;for(;n>0&&t[n]-o<=r;)n--;return n},ia=2,g4=100,vf=({onCollapse:e,onResize:t,location:r="left",minSize:o,maxSize:n,initialSize:s=200,collapseThreshold:i=1/0,className:l,...c})=>{const[u,m]=v.useState(d.vo(s,o,n)),p=v.useRef(null),f=d.Mu.construct(r),h=v.useCallback(j=>{if(p.current===null)return 0;const b=d.Eu.dim(j,d.Mu.direction(f),!0)*(1-2*Number(["bottom","right"].includes(f))),$=p.current+b,k=d.vo($,o,n);return(k-$)/(o??g4)>i?ia:k},[f,o,n,i]),x=v.useRef(null),g=v.useCallback(j=>{const b=h(j);m(b),x.current!=null&&t?.(b,d.Eu.construct(x.current))},[t,h]),y=v.useCallback(()=>m(j=>(p.current=j,j)),[m]),E=v.useCallback(j=>h(j)===ia&&e?.(),[e,h]);v.useEffect(()=>{o==null||n==null||m(j=>{const b=d.vo(j,o,n);return p.current=b,b})},[o,n]);const w=Je.useCursorDrag({onMove:g,onStart:y,onEnd:E});return a.jsxRuntimeExports.jsx(ml,{ref:x,location:f,size:u,onDragStart:w,className:d.clsx(l,d.CSS.expanded(u!==ia)),...c})},y4=Object.freeze(Object.defineProperty({__proto__:null,Base:ml,Multiple:gf,Single:vf,calculateDiffPercentage:yf,useMultiple:hf},Symbol.toStringTag,{value:"Module"})),pl=({aetherKey:e,enabled:t=!0})=>{const{setState:r}=ie.useLifecycle({aetherKey:e,type:fs.Eraser.TYPE,schema:fs.eraserStateZ,initialState:{region:d.Eu.ZERO,enabled:t}}),o=J.useSyncedRef(t);return{erase:v.useCallback(s=>{r({enabled:o.current,region:s})},[r,o])}},v4=({aetherKey:e,children:t})=>{const{erase:r}=pl({aetherKey:e}),o=it.useResize(r);return a.jsxRuntimeExports.jsx("div",{ref:o,className:d.CSS(d.CSS.inheritDims()),children:t})},j4=Object.freeze(Object.defineProperty({__proto__:null,Eraser:v4,use:pl},Symbol.toStringTag,{value:"Module"})),E4=({items:e,initialKey:t})=>{const[r,o]=v.useState(t),n=i=>o(i===r?void 0:i),s=e.find(i=>i.key===r);return{onSelect:n,activeItem:s}},S4=({activeItem:e,children:t,onSelect:r,location:o="left",collapseThreshold:n=.65,className:s,onResize:i,onCollapse:l,eraseEnabled:c,...u})=>{const m=d.Mu.direction(o);c??=e!=null;const p=v.useCallback(()=>{l?l():e!=null&&r?.(e.key)},[r,e?.key,l]),{erase:f}=pl({enabled:c}),h=v.useCallback((w,j)=>{i?.(w,j),f(j)},[i,f]),{content:x,minSize:g,maxSize:y,initialSize:E=0}=e??{};return a.jsxRuntimeExports.jsx(vf,{className:d.CSS(d.CSS.B("nav-drawer"),d.CSS.dir(m),d.CSS.visible(e!=null),s),collapseThreshold:n,onCollapse:p,location:o,onResize:h,minSize:g,maxSize:y,initialSize:E,...u,children:a.jsxRuntimeExports.jsx(Ks,{children:x})})},b4=Object.freeze(Object.defineProperty({__proto__:null,Bar:we.Bar,Drawer:S4,useDrawer:E4},Symbol.toStringTag,{value:"Module"})),Ht=({keys:e,value:t,onChange:r,allowNone:o,multiple:n,...s})=>{const i=yt.useKeysData(e);return a.jsxRuntimeExports.jsx(ue.Frame,{closeDialogOnSelect:!1,...i,allowNone:o,multiple:n,value:t,onChange:r,children:a.jsxRuntimeExports.jsx(te.Box$1,{pack:!0,...s})})},Ze=({itemKey:e,className:t,...r})=>{const{selected:o,onSelect:n}=ue.useItemState(e);return a.jsxRuntimeExports.jsx(Bs.Toggle,{...r,id:e.toString(),onChange:n,value:o,className:d.CSS(t,o&&it.CONTEXT_SELECTED,it.CONTEXT_TARGET)})},Ys=({value:e,...t})=>a.jsxRuntimeExports.jsxs(Ht,{...t,value:e,keys:te.ALIGNMENTS,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:"start",children:a.jsxRuntimeExports.jsx(R.TextAlign.Left,{})}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"center",children:a.jsxRuntimeExports.jsx(R.TextAlign.Center,{})}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"end",children:a.jsxRuntimeExports.jsx(R.TextAlign.Right,{})})]}),R4=Object.freeze(Object.defineProperty({__proto__:null,Alignment:Ys},Symbol.toStringTag,{value:"Module"})),qs=({children:e="",size:t="medium",color:r,icon:o,onClose:n,className:s,onDragStart:i,...l})=>{const c=d.Zu.cssString(r);o==null&&r!=null&&(o=a.jsxRuntimeExports.jsx(R.Circle,{color:c}));const u=n==null?void 0:a.jsxRuntimeExports.jsx(je.Button,{"aria-label":"close",size:t==="tiny"?"small":t,variant:"text",className:d.CSS.BE("tag","close"),sharp:!0,onClick:n,children:a.jsxRuntimeExports.jsx(R.Close,{})});return a.jsxRuntimeExports.jsxs(je.Button,{el:"div",className:d.CSS(s,d.CSS.B("tag"),n!=null&&d.CSS.BM("tag","closeable")),size:t,overflow:"nowrap",align:"center",gap:"small",onDragStart:i,...l,children:[o,u,a.jsxRuntimeExports.jsx(J.Text,{el:"span",overflow:"ellipsis",children:e})]})},jf=({children:e,onClick:t,variant:r="outlined",size:o="medium",className:n,...s})=>a.jsxRuntimeExports.jsx(je.Button,{className:d.CSS(d.CSS.B("tags"),n),el:"div",variant:r,size:o,x:!0,onClick:t,align:"center",gap:"small",rounded:!0,...s,children:e}),w4=Object.freeze(Object.defineProperty({__proto__:null,Tag:qs,Tags:jf},Symbol.toStringTag,{value:"Module"})),_4=({itemKey:e,icon:t,onDragStart:r})=>{const o=bt.useItem(e),{onSelect:n}=ue.useItemState(e);let s=e.toString();return d.pu.isNonZero(o?.alias)?s=o.alias:d.pu.isNonZero(o?.name)&&(s=o.name),a.jsxRuntimeExports.jsx(qs,{onClose:n,onDragStart:()=>r(e),draggable:!0,size:"small",status:o==null?"error":void 0,icon:o?.icon??t,color:o?.color,children:s})},C4=je.renderProp(_4),fl=({items:e},t,r,o)=>{if(t===""||o===!0)return!1;const n=De.filterByType(t,e);return n.length>0&&!n.every(s=>r.includes(s.key))},Ef=({haulType:e="",disabled:t,placeholder:r="Select...",variant:o="outlined",icon:n,hideTags:s=!1,children:i=C4})=>{const l=ue.useSelection(),c=J.useSyncedRef(l),{setSelected:u}=ue.useContext(),{toggle:m,visible:p}=it.useContext(),f=v.useCallback(j=>fl(j,e,d.du.toArray(l),t),[e,l,t]),{startDrag:h,...x}=De.useDragAndDrop({type:e,canDrop:f,onDrop:De.useFilterByTypeCallback(e,({items:j})=>{const b=d.du.toArray(c.current);return u(d.bu.unique([...d.du.toArray(b),...j.map($=>$.key)])),j},[u])}),g=v.useCallback(({dropped:j})=>{const b=l.filter($=>!j.some(k=>k.key===$));u(b)},[u,l]),y=v.useCallback(j=>{h([{key:j,type:e}],g)},[h,g,e]),E=De.useDraggingState(),w=o==="text"&&l.length!==0;return s?a.jsxRuntimeExports.jsxs(rl.Trigger,{variant:o,...x,children:[n,r]}):a.jsxRuntimeExports.jsxs(jf,{full:"x",onClick:()=>{w||m()},...x,className:d.CSS(d.CSS.dropRegion(f(E)),d.CSS.BE("dialog","trigger"),d.CSS.BM("variant",o)),variant:o,preventClick:w,grow:!0,children:[l.length===0&&a.jsxRuntimeExports.jsxs(J.Text,{color:8,weight:400,style:{padding:"0 1rem"},children:[n,r]}),l.map(j=>i({key:j,itemKey:j,onDragStart:y,icon:n})),o!=="text"&&a.jsxRuntimeExports.jsx(Kp.Animated,{className:d.CSS.level("p"),enabled:p,enabledLoc:"bottom",disabledLoc:"left",color:8}),w&&a.jsxRuntimeExports.jsx(je.Button,{variant:o,onClick:m,children:a.jsxRuntimeExports.jsx(R.Add,{color:8})})]})},Sf=e=>e==="preview"?"connected":e,bf=e=>e==="preview"?"preview":void 0,Ws=({resourceName:e,value:t,onChange:r,data:o,getItem:n,subscribe:s,haulType:i,icon:l,disabled:c,onSearch:u,emptyContent:m,status:p,onFetchMore:f,children:h,renderTag:x,actions:g,allowNone:y,replaceOnSingle:E,triggerProps:w,virtual:j=!0,dialogProps:b,variant:$="connected",...k})=>a.jsxRuntimeExports.jsx(it.Frame,{variant:Sf($),...k,children:a.jsxRuntimeExports.jsxs(ue.Frame,{multiple:!0,value:t,onChange:r,data:o,getItem:n,subscribe:s,onFetchMore:f,allowNone:y,replaceOnSingle:E,virtual:j,children:[a.jsxRuntimeExports.jsx(Ef,{haulType:i,icon:l,placeholder:`Select ${ue.pluralizeExports.plural(e)}`,disabled:c,variant:bf($),...w,children:x}),a.jsxRuntimeExports.jsx(ue.Dialog,{onSearch:u,emptyContent:m,status:p,actions:g,resourceName:e,...b,children:h})]})}),Rf=({haulType:e="",placeholder:t,icon:r,disabled:o,iconOnly:n=!1,hideCaret:s=!1,...i})=>{const l=ue.useSelection(),{setSelected:c}=ue.useContext(),[u]=l,m=bt.useItem(u),{name:p,icon:f}=m??{},h=v.useCallback(y=>fl(y,e,l,o),[e,l,o]),x=De.useDrop({type:e,canDrop:h,onDrop:De.useFilterByTypeCallback(e,({items:y})=>(y.length!==0&&c([y[0].key]),y),[c])}),g=De.useDraggingState();return a.jsxRuntimeExports.jsxs(rl.Trigger,{variant:"outlined",gap:"small",className:d.CSS(d.CSS.dropRegion(h(g))),disabled:o,...x,...i,hideCaret:s||n,textColor:p==null?8:void 0,children:[f??r,!n&&(p??t)]})},Wt=({resourceName:e,onChange:t,value:r,allowNone:o,emptyContent:n,haulType:s,data:i,getItem:l,subscribe:c,itemHeight:u,onFetchMore:m,disabled:p,onSearch:f,status:h,icon:x,children:g,variant:y="connected",actions:E,dialogProps:w,triggerProps:j,virtual:b=!0,closeDialogOnSelect:$=!0,...k})=>a.jsxRuntimeExports.jsx(it.Frame,{...k,variant:Sf(y),children:a.jsxRuntimeExports.jsxs(ue.Frame,{value:r,onChange:t,data:i,getItem:l,subscribe:c,allowNone:o,onFetchMore:m,itemHeight:u,virtual:b,closeDialogOnSelect:$,children:[a.jsxRuntimeExports.jsx(Rf,{haulType:s,icon:x,placeholder:`Select a ${e}`,disabled:p,variant:bf(y),...j}),a.jsxRuntimeExports.jsx(ue.Dialog,{onSearch:f,resourceName:e,emptyContent:n,status:h,actions:E,...w,children:g})]})}),Gt=(e,t)=>{const r={};t.forEach(n=>r[n]=void 0);const o=n=>{const{...s}={...n,...r};return a.jsxRuntimeExports.jsx(e,{...s})};return o.displayName=`RemoveProps(${e.displayName})`,o},xl=e=>a.jsxRuntimeExports.jsxs(Ht,{...e,keys:S.SIZES,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:"tiny",children:"S"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"small",children:"M"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"medium",children:"L"})]}),k4=Object.freeze(Object.defineProperty({__proto__:null,SIZES:S.SIZES,SelectSize:xl,isRenderProp:je.isRenderProp,isSize:S.isSize,removeProps:Gt,renderProp:je.renderProp,size:S.size},Symbol.toStringTag,{value:"Module"})),$4=je.renderProp(e=>{const{itemKey:t}=e,r=bt.useItem(t);if(r==null)return null;const{name:o,icon:n}=r;return a.jsxRuntimeExports.jsxs(ue.ListItem,{...e,children:[n,o]})}),Wn=({data:e,filter:t,children:r=$4,virtual:o=!1,...n})=>{const{retrieve:s,...i}=_R.useStaticData({data:e,filter:t}),{search:l}=yt.usePager({retrieve:s});return a.jsxRuntimeExports.jsx(Wt,{...n,...i,onSearch:l,virtual:o,children:r})},Xn=e=>a.jsxRuntimeExports.jsxs(Ht,{...e,keys:he.LEVELS,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:"h2",square:!0,children:"XL"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"h3",square:!0,children:"L"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"h4",square:!0,children:"M"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"h5",square:!0,children:"S"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"small",square:!0,children:"XS"})]}),I4=[250,400,500,600],wf=e=>a.jsxRuntimeExports.jsxs(Ht,{...e,keys:I4,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:250,children:"Light"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:400,children:"Normal"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:500,children:"Medium"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:600,children:"Bold"})]}),N4=Object.freeze(Object.defineProperty({__proto__:null,Level:Xn,Weight:wf},Symbol.toStringTag,{value:"Module"})),A4=Object.freeze(Object.defineProperty({__proto__:null,Button:Ze,Buttons:Ht,Dialog:ue.Dialog,Flex:R4,Frame:ue.Frame,ListItem:ue.ListItem,Multiple:Ws,MultipleTrigger:Ef,Single:Wt,SingleTrigger:Rf,Static:Wn,Text:N4,staticCanDrop:fl,useClear:ue.useClear,useContext:ue.useContext,useHover:ue.useHover,useItemState:ue.useItemState,useMultiple:ue.useMultiple,useSelection:ue.useSelection,useSingle:ue.useSingle},Symbol.toStringTag,{value:"Module"})),P4=je.renderProp(e=>a.jsxRuntimeExports.jsx(ue.Text,{...e})),_e=({path:e,children:t=P4,label:r,padHelpText:o=!0,visible:n=!0,hideIfNull:s=!0,optional:i,onChange:l,className:c,defaultValue:u,...m})=>{const p=cn(e,{optional:i??s,onChange:l,defaultValue:u}),f=ln(void 0,`Field(${e})`);if(p==null)return null;if(e==null)throw new Error("No path provided to Form Field");if(r??=d.gu.capitalize(d.Vu.element(e,-1)),n=typeof n=="function"?n(p,f):n,!n)return null;const h=p.status.message,{onChange:x,value:g}=p,y={onChange:x,value:g};return p.variant!=null&&(y.variant=p.variant),a.jsxRuntimeExports.jsx(we.Item,{padHelpText:o,helpText:h,status:p.status.variant,label:r,required:p.required,className:d.CSS(c,d.CSS.BE("field",e.split(".").join("-")),d.CSS.M(p.status.variant)),...m,children:t(y)})},fo=e=>({fieldKey:t,fieldProps:r,inputProps:o})=>{const n=({inputProps:s,path:i,fieldKey:l=t,optional:c,defaultValue:u,...m})=>a.jsxRuntimeExports.jsx(_e,{...r,...m,defaultValue:u,optional:c,path:l?`${i}.${l}`:i,children:p=>a.jsxRuntimeExports.jsx(e,{...p,...o,...s})});return n.displayName=e.displayName,n},_f=fo(we.Numeric),rt=_f({inputProps:{}}),Cf=fo(ue.Text),xo=Cf({inputProps:{}}),kf=fo(we.Switch),Xs=kf({inputProps:{}}),T4=e=>fo(Wn)(e),O4=({children:e,...t})=>a.jsxRuntimeExports.jsx(ff,{value:t,children:e}),L4=e=>e.code==="custom"&&e.params!=null&&"variant"in e.params?e.params.variant:"error";class z4 extends d.tl.Observer{schema;values;initialValues;statuses;touched;cachedRefs;constructor(t,r){super(),this.schema=r,this.values=d.Vu.copy(t),this.statuses=new Map,this.touched=new Set,this.cachedRefs=new Map,this.initialValues=d.Vu.copy(this.values)}setValue(t,r,o){t==""?this.values=d.Vu.copy(r):d.Vu.set(this.values,t,r),this.checkTouched(t,r,o),this.updateCachedRefs(t)}checkTouched(t,r,o={}){const{markTouched:n=!0}=o,s=d.Vu.get(this.initialValues,t,{optional:!0});d.Vu.equal(s,r)?(this.clearTouched(t),this.clearOrphanedTouchedPaths(t)):n&&this.setTouched(t)}clearOrphanedTouchedPaths(t){const r=new Set;this.touched.forEach(o=>{d.Vu.pathsMatch(o,t)&&o!==t&&!d.Vu.has(this.values,o)&&r.add(o)}),r.forEach(o=>{this.touched.delete(o),this.cachedRefs.delete(o)})}setStatus(t,r){this.statuses.set(t,r),this.updateCachedRefs(t)}clearStatus(t=""){this.statuses.delete(t),this.updateCachedRefs(t)}reset(t){if(d.Vu.equal(this.values,t??this.initialValues))return;t!=null&&(this.initialValues=d.Vu.copy(t));const r=d.Vu.copy(this.initialValues);this.statuses.clear(),this.touched.clear();const o=new Set;this.cachedRefs.forEach((n,s)=>{const i=d.Vu.get(this.values,s,{optional:!0}),l=d.Vu.get(r,s,{optional:!0});d.Vu.equal(i,l)||o.add(s)}),o.forEach(n=>this.cachedRefs.delete(n)),this.values=r}setCurrentStateAsInitialValues(){this.initialValues=d.Vu.copy(this.values),this.touched.clear(),this.cachedRefs.clear()}setTouched(t){this.touched.add(t),this.updateCachedRefs(t)}clearTouched(t=""){t===""?this.touched.clear():this.touched.delete(t),this.updateCachedRefs(t),this.notify()}remove(t){d.Vu.remove(this.values,t),this.statuses.delete(t),this.clearTouched(t),this.cachedRefs.delete(t)}validate(t,r){if(this.schema==null)return!0;const o=this.schema.safeParse(this.values);return this.processValidation(t,o,r)}async validateAsync(t,r){if(this.schema==null)return!0;const o=await this.schema.safeParseAsync(this.values);return this.processValidation(t,o,r)}errorsToStatuses(t,r,o){return t.forEach(n=>{const s=[...r,...n.path],i=d.Vu.resolvePath(s.join("."),this.values);if(o.push({key:i,variant:L4(n),message:n.message}),n.code==="invalid_union"&&n.errors!=null&&n.errors.length>0){const l=n.errors.map(u=>u.filter(m=>d.Vu.has(this.values,[...s,...m.path].join("."))));l.sort((u,m)=>u.length-m.length);const c=l.find(u=>u.length>0);if(c==null)return;this.errorsToStatuses(c,s,o)}}),o}processValidation(t=!1,r,o){if(this.schema==null)return!0;const n=new Set;if(this.statuses.forEach((l,c)=>{l.variant!=="success"&&n.add(c)}),n.forEach(l=>this.clearStatus(l)),r.success)return!0;let s=!0;return this.errorsToStatuses(r.error.issues,[],[]).forEach(l=>{const{key:c,message:u,variant:m}=l;if(c==null)return;const p=o==null||d.Vu.pathsMatch(c,o)||d.Vu.pathsMatch(o,c),f=t||this.touched.has(c);!p||!f||(m!=="warning"&&(s=!1),this.setStatus(c,{key:c,variant:m,message:u}))}),s}get hasBeenTouched(){return this.touched.size>0}getStatuses(){return Array.from(this.statuses.values()).filter(t=>t.variant!=="success")}getState(t,r={}){const{optional:o=!1,defaultValue:n=void 0}=r,s=d.Xu.getOrSetDefault(this.cachedRefs,t,{});let i=d.Vu.get(this.values,t,{optional:o||n!=null});if(i==null){if(n==null)return null;i=n,this.setValue(t,i)}if(s.value=i,s.required=!1,this.schema!=null){const l=d.hl.getFieldSchema(this.schema,t,{optional:!0});l!=null&&(s.required=!l.safeParse(void 0).success)}return s.status=d.Xu.getOrSetDefault(this.statuses,t,{key:t,variant:"success",message:""}),s.touched=this.touched.has(t),s}updateCachedRefs(t){this.cachedRefs.forEach((r,o)=>{(d.Vu.pathsMatch(o,t)||d.Vu.pathsMatch(t,o))&&this.cachedRefs.set(o,{})})}}const $f=({values:e,sync:t=!1,schema:r,mode:o="normal",onChange:n,onHasTouched:s})=>{const i=J.useInitializerRef(()=>new z4(e,r)),l=J.useSyncedRef(n),c=ue.useErrorHandler(),u=J.useSyncedRef(s),m=v.useCallback(()=>{i.current.setCurrentStateAsInitialValues(),u.current?.(!1)},[]),p=v.useCallback($=>i.current.onChange($),[]),f=v.useCallback(($,k)=>i.current.getState($,k),[]),h=v.useCallback($=>{i.current.remove($),i.current.notify()},[]),x=v.useCallback($=>{const k=i.current.values,A=i.current.hasBeenTouched;i.current.reset($),k!==i.current.values&&l.current?.({values:i.current.values,path:"",prev:k,valid:!0}),i.current.notify();const L=i.current.hasBeenTouched;L!==A&&u.current?.(L)},[]),g=v.useCallback(async $=>{const k=await i.current.validateAsync(!0,$);return i.current.notify(),k},[]),y=v.useCallback($=>{const k=i.current.validate(!0,$);return i.current.notify(),k},[]),E=v.useCallback(($,k,A)=>{const{notifyOnChange:U=!0,markTouched:L=!0}=A??{},V=d.Vu.get(i.current.values,$,{optional:!0}),M=i.current.hasBeenTouched;i.current.setValue($,k,{markTouched:L});const D=()=>{U&&l.current?.({values:i.current.values,path:$,prev:V,valid:!0}),i.current.notify();const B=i.current.hasBeenTouched;B!==M&&u.current?.(B)};try{i.current.validate()}catch{return c(async()=>{await i.current.validateAsync(),D()},"Failed to validate form")}D()},[]),w=v.useCallback($=>d.Vu.has(i.current.values,$),[]),j=v.useCallback(($,k)=>{const A=i.current.hasBeenTouched;i.current.setStatus($,k),i.current.notify();const U=i.current.hasBeenTouched;U!==A&&u.current?.(U)},[]),b=v.useCallback(()=>{i.current.clearStatus(),i.current.notify()},[]);return v.useEffect(()=>{t&&(i.current.reset(e),i.current.notify())},[t,e]),v.useMemo(()=>({bind:p,set:E,get:f,mode:o,validate:y,validateAsync:g,value:()=>i.current.values,has:w,remove:h,setStatus:j,clearStatuses:b,reset:x,setCurrentStateAsInitialValues:m,getStatuses:()=>i.current.getStatuses()}),[p,E,f,y,g,w,h,j,b,x,o,m])},M4=Object.freeze(Object.defineProperty({__proto__:null,Context:ff,Field:_e,Form:O4,NumericField:rt,SwitchField:Xs,TextField:xo,buildNumericField:_f,buildSelectField:T4,buildSwitchField:kf,buildTextField:Cf,fieldBuilder:fo,fieldListUtils:ul,use:$f,useContext:ln,useField:cn,useFieldList:dl,useFieldListUtils:s4,useFieldState:cl,useFieldValid:o4,useFieldValue:Mn},Symbol.toStringTag,{value:"Module"})),D4={markTouched:!1,notifyOnChange:!1},at=({name:e,schema:t,retrieve:r,mountListeners:o,update:n,initialValues:s})=>({query:i,initialValues:l,autoSave:c=!1,afterSave:u,beforeSave:m,beforeValidate:p,sync:f,onHasTouched:h,mode:x,scope:g})=>{const[y,E]=v.useState(on(`retrieving ${e}`)),w=ie.useUniqueKey(g),j=Ir(),b=dt(w),$=Hs(),k=ue.useAdder(),A=$f({schema:t,values:l??s,onChange:({path:B})=>{c&&B!==""&&D()},sync:f,onHasTouched:h,mode:x}),U=v.useCallback((B,C,O)=>A.set(B,C,{...O,...D4}),[A]),L=v.useCallback(async(B,C={})=>{const{signal:O}=C;try{if(j==null)return E(xr(`retrieve ${e}`));if(E(T=>on(`retrieving ${e}`,T.data)),O?.aborted)return;const N={client:j,query:B,store:b,...A,set:U};if(await r(N),O?.aborted)return;$.cleanup(),$.set(o?.(N)),E(gt(`retrieved ${e}`))}catch(N){if(O?.aborted)return;const T=zn(`retrieve ${e}`,N);k(T.status),E(T)}},[j,e,A,b,U]),V=R.useMemoDeepEqual(i);po(async B=>await L(V,{signal:B}),[L,V]);const M=v.useCallback(async(B={})=>{const{signal:C}=B,O=[];try{if(j==null)return E(xr(`update ${e}`)),!1;const N={client:j,query:i,store:b,rollbacks:O,...A,set:U};return p?.(N)===!1||!await A.validateAsync()?!1:(E(on(`updating ${e}`,void 0)),await m?.(N)===!1?(E(gt(`updated ${e}`,void 0)),!1):C?.aborted===!0?!1:(await n({...N,setStatus:P=>E(Z=>{const H=he.executeSetter(P,Z.status);return{...Z,status:H,variant:H.variant}})}),E(gt(`updated ${e}`,void 0)),u?.(N),!0))}catch(N){try{O.reverse().forEach(P=>P())}catch(P){console.error("Error rolling back changes:",P)}if(C?.aborted===!0)return!1;const T=zn(`update ${e}`,N);return k(T.status),E(T),!1}},[e,i,m,u,p]),D=v.useCallback(B=>void M(B),[M]);return{form:A,save:D,...y}},U4=(e,t,r)=>typeof e=="object"&&"key"in e?[e.key,e,t??{}]:[e,t,r??{}],Z4=()=>!0,F4=d.g.milliseconds(100),B4=({retrieveCached:e,queryRef:t,filterRef:r,sortRef:o,dataRef:n,store:s,useCachedList:i})=>{if(e==null||!i)return;let l=e({query:t.current??{},store:s});if(r.current!=null&&(l=l.filter(r.current)),o.current!=null&&(l=l.sort(o.current)),l.length!==0)return l.forEach(c=>n.current.set(c.key,c)),l.map(c=>c.key)},st=({name:e,mountListeners:t,retrieve:r,retrieveByKey:o,retrieveCached:n,sort:s})=>(i={})=>{const{filter:l=Z4,sort:c,initialQuery:u=null,retrieveDebounce:m=F4,useCachedList:p=!0}=i,f=J.useSyncedRef(l),h=J.useSyncedRef(c??s),x=Ir(),g=v.useRef(new Map),y=J.useInitializerRef(()=>new Map),E=dt(),w=v.useRef(u),[j,b,$]=J.useCombinedStateAndRef(()=>on(`retrieving ${e}`,B4({retrieveCached:n,queryRef:w,filterRef:f,sortRef:h,dataRef:g,store:E,useCachedList:p}))),k=v.useRef(!0),A=Hs(),U=v.useRef(!1),L=v.useCallback(T=>y.current.forEach((P,Z)=>{P===T&&Z()}),[y.current]),V=v.useCallback(T=>{if(h.current==null)return T;const P=T.map(Z=>g.current.get(Z)).filter(Z=>Z!=null);return P.sort(h.current),P.map(Z=>Z.key)},[h]),M=v.useCallback(()=>{x!=null&&(U.current=!0,A.cleanup(),A.set(t?.({client:x,store:E,query:w.current??{},onDelete:T=>{g.current.delete(T),b(P=>P.data==null?P:{...P,data:P.data.filter(Z=>Z!==T)})},onChange:(T,P,Z)=>{const[H,G,K]=U4(T,P,Z),{mode:se="append"}=K,ee=g.current.get(H)??null;if(ee!=null&&!f.current(ee))return;const fe=he.executeSetter(G,ee);fe==null||!f.current(fe)||(g.current.set(H,fe),b(xe=>{if(xe.data==null)return xe;let ae;if(ee==null)h.current!=null?ae=V([...xe.data,H]):ae=se==="prepend"?[H,...xe.data]:[...xe.data,H];else if(h.current!=null){const ne=xe.data.indexOf(H),ce=V(xe.data),Ce=ce.indexOf(H);ne!==Ce?ae=ce:ae=xe.data}else ae=xe.data;return{...xe,data:ae}}),L(H))}})))},[t,A]),D=v.useCallback(async(T,P={})=>{const{signal:Z,mode:H="replace"}=P,G=he.executeSetter(T,w.current??{});w.current=G;try{if(x==null)return b(xr(`retrieve ${e}`));if(b(ee=>on(`retrieving ${e}`,ee.data)),H==="replace")k.current=!0;else if(H==="append"&&!k.current)return b(ee=>gt(`retrieved ${e}`,ee.data??[]));let K=await r({client:x,query:G,store:E});if(Z?.aborted)return;K=K.filter(f.current),h.current!=null&&(K=K.sort(h.current)),K.length===0&&(k.current=!1);const se=K.map(ee=>ee.key);return M(),$.current.data!=null&&d.wu.primitiveArrays($.current.data,se)===d.wu.EQUAL?b(ee=>gt(`retrieved ${e}`,ee.data??[])):(K.forEach(ee=>g.current.set(ee.key,ee)),b(ee=>{if(H==="replace"||ee.data==null)return gt(`retrieved ${e}`,se);const fe=new Set(se);return gt(`retrieved ${e}`,[...ee.data.filter(xe=>!fe.has(xe)),...se])}))}catch(K){if(Z?.aborted)return;b(zn(`retrieve ${e}`,K))}},[x,e,E,f,M]),B=v.useCallback((T,P={})=>{const{signal:Z}=P;(async()=>{try{if(x==null||d.pu.isZero(T))return;const H=await o({client:x,key:T,query:w.current??{},store:E});if(Z?.aborted||H==null)return;if(!f.current(H)){g.current.set(T,null);return}g.current.set(T,H),L(T)}catch(H){if(Z?.aborted)return;g.current.set(T,null),b(zn(`retrieve ${e}`,H))}})()},[o,x,L,M]),C=v.useCallback((T=>{if(U.current||M(),Array.isArray(T))return T.map(Z=>C(Z)).filter(Z=>Z!=null);if(d.pu.isZero(T))return;const P=g.current.get(T);return P===void 0&&B(T),P}),[B,M]),O=v.useCallback((T,P)=>P==null?()=>{}:(y.current.set(T,P),()=>y.current.delete(T)),[]);return{retrieve:Je.useDebouncedCallback((T,P={})=>void D(T,P),new d.g(m).milliseconds,[D]),retrieveAsync:D,subscribe:O,getItem:C,...j,data:j?.data??[]}},V4=({key:e,subscribe:t,getItem:r})=>v.useSyncExternalStore(v.useCallback(o=>t(o,e),[t,e]),v.useCallback(()=>r(e),[r,e])),hl=e=>on(`Retrieving ${e}`,void 0),If=e=>{const[t,r]=v.useState(hl(e.name));return{...t,...gl({...e,onChange:r})}},gl=({retrieve:e,mountListeners:t,name:r,onChange:o,scope:n,beforeRetrieve:s,addStatusOnFailure:i=!0,allowDisconnected:l=!1})=>{const c=Ir(),u=v.useRef(null),m=dt(n),p=Hs(),f=ue.useAdder(),h=v.useCallback(y=>{u.current!=null&&o(E=>{const w=he.executeSetter(y,E.data);return w==null?E:gt(`retrieved ${r}`,w)},u.current)},[o,r]),x=v.useCallback(async(y,E={})=>{const{signal:w}=E,j=he.executeSetter(y,u.current??{});u.current=j;try{if(s!=null){const k=s({query:j});if(k==!1)return;if(k!==!0){o(gt(`retrieved ${r}`,k),j);return}}if(c==null&&!l)return o(xr(`retrieve ${r}`),j);if(o(k=>on(`retrieving ${r}`,k.data),j),w?.aborted)return;const b={client:c,query:j,store:m};p.cleanup(),p.set(t?.({...b,onChange:h}));const $=await e(b);if(w?.aborted)return;o(gt(`retrieved ${r}`,$),j)}catch(b){if(w?.aborted)return;const $=zn(`retrieve ${r}`,b);i&&f($.status),o($,j)}},[c,r,s,i,o]);return{retrieve:v.useCallback((y,E)=>void x(y,E),[x]),retrieveAsync:x}},H4=({query:e,...t})=>{const{retrieveAsync:r,retrieve:o,...n}=If(t),s=R.useMemoDeepEqual(e);return po(async i=>await r(s,{signal:i}),[r,s]),n},G4=({query:e,onChange:t,...r})=>{const o=v.useRef(hl(r.name)),{retrieveAsync:n}=gl({...r,onChange:v.useCallback((i,l)=>{o.current=he.executeSetter(i,o.current),t?.(o.current,l)},[t])}),s=R.useMemoDeepEqual(e);po(async i=>{s!=null&&await n(s,{signal:i})},[n,s])},Nf=({onChange:e,...t})=>{const r=v.useRef(hl(t.name)),o=v.useCallback((n,s)=>{r.current=he.executeSetter(n,r.current),e?.(r.current,s)},[e]);return gl({...t,onChange:o})},Oe=e=>({useRetrieve:(t,r)=>H4({...e,query:t,...r}),useRetrieveStateful:()=>If(e),useRetrieveEffect:t=>G4({...e,...t}),useRetrieveObservable:t=>Nf({...t,...e})}),Af=e=>{const{onChange:t,update:r,name:o,verbs:{present:n,past:s,participle:i},debounce:l=0,scope:c,beforeUpdate:u,afterSuccess:m,afterFailure:p,allowDisconnected:f=!1}=e,h=Ir(),x=dt(c),g=ue.useAdder(),y=Je.useDebouncedCallback(async(w,j={})=>{const{signal:b}=j,$=[],k=()=>{try{$.reverse().forEach(U=>U())}catch(U){console.error(`failed to rollback changes to ${o}`,U)}};if(h==null&&!f)return t(U=>xr(`${n} ${o}`,as(U))),!1;const A=h;try{if(t(V=>on(`${i} ${o}`,V.data,as(V))),u!=null){const V=await u({client:A,data:w,rollbacks:$,store:x});if(b?.aborted===!0)return!1;if(V===!1)return t(gt(`${s} ${o}`,w)),k(),!1;V!==!0&&(w=V)}const L=await r({client:A,data:w,store:x,rollbacks:$,setStatus:V=>t(M=>{const D=he.executeSetter(V,M.status);return{...M,status:D,variant:D.variant}})});return b?.aborted===!0||(t(V=>gt(`${s} ${o}`,w,as(V))),L===!1)?!1:(await m?.({client:A,data:L}),!0)}catch(U){if(k(),b?.aborted===!0)return!1;const L=zn(`${n} ${o}`,U),{status:V}=L;return t(L),g(V),await p?.({client:A,status:V,data:w}),!1}},l,[o,t,u,m,p]);return{update:v.useCallback((w,j)=>void y(w,j),[y]),updateAsync:y}},K4=e=>{const{name:t,verbs:r,...o}=e,n=pf(e),[s,i]=v.useState(gt(`${r.past} ${t}`,void 0,n)),l=Af({...o,verbs:r,name:t,onChange:i});return{...s,...l}},de=e=>({useObservableUpdate:t=>Af({...t,...e}),useUpdate:(t={})=>K4({...t,...e})}),Y4=Object.freeze(Object.defineProperty({__proto__:null,COPY_VERBS:Wp,CREATE_VERBS:Vt,Client:I.Client,DELETE_VERBS:Xe,Provider:mf,RENAME_VERBS:ot,SAVE_VERBS:PR,SET_VERBS:Xp,SNAPSHOT_VERBS:sl,ScopedUnaryStore:I.ScopedUnaryStore,UPDATE_VERBS:ol,createForm:at,createList:st,createRetrieve:Oe,createStore:I.createStore,createUpdate:de,errorResult:zn,loadingResult:on,nullClientResult:xr,parseInitialStatusDetails:pf,partialUpdate:I.partialUpdate,resultStatusDetails:as,scopeStore:I.scopeStore,successResult:gt,useListItem:V4,useObservableRetrieve:Nf,useStore:dt},Symbol.toStringTag,{value:"Module"})),Pf="resource",q4="resources",Tf="children",W4=e=>{const t=dt();v.useEffect(()=>t.resources.onSet(e),[t.resources])},X4=e=>{const t=dt();v.useEffect(()=>{const r=t.resources.onDelete(async o=>e(S.wA.idZ.parse(o)));return()=>r()},[t.resources])},J4=e=>{const t=dt();v.useEffect(()=>t.relationships.onSet(e),[t.relationships])},Q4=e=>{const t=dt();v.useEffect(()=>t.relationships.onDelete(r=>e(S.wA.relationshipZ.parse(r))),[t.relationships,e])},Of=(e,t)=>st({name:t,retrieve:async({client:r,query:{id:o}})=>o==null?[]:await r.ontology.retrieve([o],{children:e==="to",parents:e==="from"}),retrieveByKey:async({client:r,key:o})=>await r.ontology.retrieve(S.wA.idZ.parse(o)),mountListeners:({store:r,onChange:o,onDelete:n,client:s,query:{id:i}})=>[r.relationships.onSet(async l=>{if(S.wA.matchRelationship(l,{type:"parent",[S.wA.oppositeRelationshipDirection(e)]:i})){const c=await s.ontology.retrieve(l[e]);o(c.key,c)}}),r.relationships.onDelete(l=>{const c=S.wA.relationshipZ.parse(l);S.wA.matchRelationship(c,{type:"parent",[S.wA.oppositeRelationshipDirection(e)]:i})&&n(S.wA.idToString(c[e]))}),r.resources.onSet(l=>o(l.key,c=>c==null?null:{...c,...l})),r.resources.onDelete(async l=>n(l))]}),e3=Of("to",Tf),t3=st({name:q4,retrieveCached:({store:e})=>e.resources.list(),retrieve:async({client:e,query:t,store:r})=>{const o=await e.ontology.retrieve(t);return o.forEach(n=>r.resources.set(n.key,n)),o},retrieveByKey:async({client:e,key:t,store:r})=>{const o=await e.ontology.retrieve(S.wA.idZ.parse(t));return r.resources.set(t,o),o},mountListeners:({store:e,onChange:t,onDelete:r})=>[e.resources.onSet(async o=>t(o.key,o)),e.resources.onDelete(async o=>r(o))]}),Js=(e,t)=>{const r=e.relationships.get(o=>S.wA.matchRelationship(o,{type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:t}));return r.length===0?null:r[0].from},Lf=async({client:e,query:{id:t},store:r})=>{const o=Js(r,t);if(o!=null)return o;const n=await e.ontology.retrieveParents(t);r.resources.set(n);const s={from:n[0].id,type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:t};return r.relationships.set(S.wA.relationshipToString(s),s),n[0].id},vt=e=>t=>e.some(r=>S.wA.idsEqual(t.to,r)||S.wA.idsEqual(t.from,r)),n3={present:"move",participle:"moving",past:"moved"},{useUpdate:r3}=de({name:Tf,verbs:n3,update:async({client:e,data:t,store:r,rollbacks:o})=>{const{source:n,destination:s,ids:i}=t;return o.push(r.relationships.delete(l=>i.some(c=>S.wA.matchRelationship(l,{type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,from:n,to:c})))),i.forEach(l=>{const c={from:s,type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:l};o.push(r.relationships.set(S.wA.relationshipToString(c),c))}),await e.ontology.moveChildren(n,s,...i),t}}),jt=(e,t,r)=>I.partialUpdate(e.resources,S.wA.idToString(t),{name:r}),{useRetrieve:o3,useRetrieveObservable:s3}=Oe({name:Pf,retrieve:async({client:e,query:t,store:r})=>{const o=await e.ontology.retrieveChildren(t.id,t);return r.resources.set(o),o}}),{useRetrieve:i3,useRetrieveObservable:a3}=Oe({name:Pf,retrieve:async({client:e,query:{ids:t},store:r})=>{const o=r.resources.get(S.wA.idToString(t));if(o.length===t.length)return o;const n=await e.ontology.retrieve(t);return r.resources.set(n),n}}),l3=Object.freeze(Object.defineProperty({__proto__:null,RELATIONSHIPS_FLUX_STORE_KEY:I.RELATIONSHIPS_FLUX_STORE_KEY,RELATIONSHIP_FLUX_STORE_CONFIG:I.RELATIONSHIP_FLUX_STORE_CONFIG,RESOURCES_FLUX_STORE_KEY:I.RESOURCES_FLUX_STORE_KEY,RESOURCE_FLUX_STORE_CONFIG:I.RESOURCE_FLUX_STORE_CONFIG,createDependentsListHook:Of,filterRelationshipsThatHaveIDs:vt,renameFluxResource:jt,retrieveCachedParentID:Js,retrieveParentID:Lf,useListChildren:e3,useMoveChildren:r3,useRelationshipDeleteSynchronizer:Q4,useRelationshipSetSynchronizer:J4,useResourceDeleteSynchronizer:X4,useResourceList:t3,useResourceSetSynchronizer:W4,useRetrieveChildren:o3,useRetrieveObservableChildren:s3,useRetrieveObservableResource:a3,useRetrieveResource:i3},Symbol.toStringTag,{value:"Module"})),Qs="Policy",c3="Policies",zf=le.z.object({key:le.z.uuid().optional(),name:le.z.string().min(1,"Name is required"),objects:S.wA.idZ.array(),actions:S.SA.actionZ.array()}),ei=async({client:e,query:{key:t},store:r})=>{let o=r.policies.get(t);return o!=null||(o=await e.access.policies.retrieve({key:t}),r.policies.set(t,o)),o},{useRetrieve:u3}=Oe({name:Qs,retrieve:ei,mountListeners:({store:e,query:{key:t},onChange:r})=>[e.policies.onSet(r,t)]}),yl=st({name:c3,retrieveCached:({store:e})=>e.policies.list(),retrieve:async({client:e,query:t})=>await e.access.policies.retrieve(t),retrieveByKey:async({key:e,...t})=>await ei({...t,query:{key:e}}),mountListeners:({store:e,onChange:t,onDelete:r})=>[e.policies.onSet(o=>t(o.key,o)),e.policies.onDelete(r)]}),{useUpdate:d3}=de({name:Qs,verbs:Xe,update:async({client:e,data:t,store:r,rollbacks:o})=>{const n=d.du.toArray(t),s=S.SA.policy.ontologyID(n),i=vt(s);return o.push(r.relationships.delete(i)),o.push(r.resources.delete(n)),o.push(r.policies.delete(n)),await e.access.policies.delete(n),t}}),{useUpdate:m3}=de({name:Qs,verbs:ot,update:async({client:e,data:t,store:r,rollbacks:o})=>{const{key:n,name:s}=t,i=await ei({client:e,query:{key:n},store:r});o.push(I.partialUpdate(r.policies,n,{name:s})),o.push(jt(r,S.SA.policy.ontologyID(n),s));const l=await e.access.policies.create({...i,name:s});return r.policies.set(n,l),t}}),p3=at({name:Qs,schema:zf,initialValues:{key:void 0,name:"",objects:[],actions:[]},retrieve:async({client:e,query:t,store:r,reset:o})=>{if(t.key==null)return;const n=await ei({client:e,query:{key:t.key},store:r});o(n)},update:async({client:e,value:t,store:r,set:o,rollbacks:n})=>{const s=t(),i=await e.access.policies.create(s);n.push(r.policies.set(i.key,i)),o("key",i.key)}}),vl="policy",Mf=je.renderProp(({itemKey:e,...t})=>{const r=bt.useItem(e);if(r==null)return null;const{name:o}=r;return a.jsxRuntimeExports.jsx(ue.ListItem,{itemKey:e,y:!0,gap:"small",...t,children:a.jsxRuntimeExports.jsx(J.Text,{level:"p",weight:400,children:o})})}),f3=({initialQuery:e,filter:t,...r})=>{const{data:o,retrieve:n,getItem:s,subscribe:i,status:l}=yl({initialQuery:e,filter:t}),{fetchMore:c,search:u}=yt.usePager({retrieve:n});return a.jsxRuntimeExports.jsx(Ws,{haulType:vl,onFetchMore:c,onSearch:u,status:l,icon:a.jsxRuntimeExports.jsx(R.Policy,{}),...r,resourceName:"policy",data:o,getItem:s,subscribe:i,itemHeight:56,children:Mf})},x3=({initialQuery:e,filter:t,...r})=>{const{data:o,retrieve:n,getItem:s,subscribe:i,status:l}=yl({initialQuery:e,filter:t}),{fetchMore:c,search:u}=yt.usePager({retrieve:n});return a.jsxRuntimeExports.jsx(Wt,{onFetchMore:c,onSearch:u,status:l,haulType:vl,icon:a.jsxRuntimeExports.jsx(R.Policy,{}),...r,data:o,getItem:s,subscribe:i,resourceName:"policy",itemHeight:56,children:Mf})},h3=Object.freeze(Object.defineProperty({__proto__:null,CreateIcon:AR,HAUL_TYPE:vl,SelectMultiple:f3,SelectSingle:x3,formSchema:zf,useDelete:d3,useForm:p3,useList:yl,useRename:m3,useRetrieve:u3},Symbol.toStringTag,{value:"Module"})),Df="Permissions",g3=async e=>{const t=e.auth?.user;if(t==null){const r=await e.connectivity.check();if(r.error!=null)throw r.error;if(e.auth?.user==null)throw new S.St("Expected user to be available after successfully connecting to cluster");return e.auth.user}return t},Uf=async(e,t)=>{if(t!=null)return t;const r=await g3(e);return S.TA.ontologyID(r.key)},y3=(e,t)=>{if(t!=null)return t;const r=e?.auth?.user;return r==null?null:S.TA.ontologyID(r.key)},ho=({store:e,client:t,query:{subject:r,objects:o,action:n}})=>{if(t==null)return!1;const s=y3(t,r);if(s==null)return!1;const i=I.cachedRetrieveForSubject(e,s);return S.SA.allowRequest({subject:s,objects:o,action:n},i)},{useRetrieve:v3}=Oe({name:Df,retrieve:async({client:e,query:{subject:t,objects:r,action:o},store:n})=>{if(t=await Uf(e,t),t==null)return!1;const s=await I.retrieveForSubject({client:e,subject:t,store:n});return S.SA.allowRequest({subject:t,objects:r,action:o},s)}}),go=e=>v3(e)?.data??!1,j3=e=>go({objects:e,action:"retrieve"}),E3=e=>go({objects:e,action:"update"}),S3=e=>go({objects:e,action:"delete"}),b3=e=>go({objects:e,action:"create"}),R3=({id:e,...t})=>ho({...t,query:{objects:e,action:"retrieve"}}),w3=({id:e,...t})=>ho({...t,query:{objects:e,action:"update"}}),_3=({id:e,...t})=>ho({...t,query:{objects:e,action:"delete"}}),C3=({id:e,...t})=>ho({...t,query:{objects:e,action:"create"}}),{useRetrieve:k3}=Oe({name:Df,retrieve:async({client:e,query:t,store:r})=>{const o=await Uf(e,t.subject);return o==null?[]:await I.retrieveForSubject({client:e,subject:o,store:r})}}),$3=R.createComposite(R.Role,{topRight:R.Add}),Nr="Role",Zf="Roles",ti=async({client:e,query:{key:t},store:r})=>{let o=r.roles.get(t);return o!=null||(o=await e.access.roles.retrieve({key:t}),r.roles.set(t,o)),o},{useRetrieve:I3}=Oe({name:Nr,retrieve:ti,mountListeners:({store:e,query:{key:t},onChange:r})=>[e.roles.onSet(r,t)]}),Ff=st({name:Zf,retrieveCached:({store:e})=>e.roles.list(),retrieve:async({client:e,query:t})=>await e.access.roles.retrieve(t),retrieveByKey:async({key:e,...t})=>await ti({...t,query:{key:e}}),mountListeners:({store:e,onChange:t,onDelete:r})=>[e.roles.onSet(o=>t(o.key,o)),e.roles.onDelete(r)]}),{useUpdate:N3}=de({name:Nr,verbs:Xe,update:async({client:e,data:t,store:r,rollbacks:o})=>{const n=d.du.toArray(t),s=S.SA.role.ontologyID(n),i=vt(s);return o.push(r.relationships.delete(i)),o.push(r.resources.delete(S.wA.idToString(s))),o.push(r.roles.delete(n)),await e.access.roles.delete(n),t}}),{useUpdate:A3}=de({name:Nr,verbs:ot,update:async({client:e,data:t,rollbacks:r,store:o})=>{const{key:n,name:s}=t,l={...await ti({client:e,store:o,query:{key:n}}),name:s};return await e.access.roles.create(l),r.push(I.partialUpdate(o.roles,n,{name:s})),r.push(jt(o,S.SA.role.ontologyID(n),s)),t}}),Bf=le.z.object({key:S.TA.keyZ,role:S.SA.role.keyZ}),vd=async({client:e,store:t,query:{key:r}})=>{const o=S.TA.ontologyID(r),n=t.relationships.get(u=>S.wA.matchRelationship(u,{type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:o,from:{type:"role"}}));if(n.length>0)return n[0].from.key;const s=await e.ontology.retrieveParents(o,{types:["role"]});if(s.length===0)return;const i=s[0],l={from:i.id,type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:o};t.relationships.set(S.wA.relationshipToString(l),l);const c={key:i.id.key,name:i.name,...i.data};return t.roles.set(c.key,c),c.key},P3=at({name:Nr,schema:Bf,initialValues:{key:"",role:""},retrieve:async({client:e,query:{key:t},reset:r,store:o})=>{const n=await vd({client:e,store:o,query:{key:t}});r({key:t,role:n??""})},update:async({client:e,value:t,store:r,rollbacks:o})=>{const{key:n,role:s}=t(),i=S.TA.ontologyID(n),l=await vd({client:e,store:r,query:{key:n}});if(l===s)return;if(l!=null){const u={from:S.SA.role.ontologyID(l),type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:i};o.push(r.relationships.delete(S.wA.relationshipToString(u)))}const c={from:S.SA.role.ontologyID(s),type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:i};o.push(r.relationships.set(S.wA.relationshipToString(c),c)),l!=null&&await e.access.roles.unassign({user:n,role:l}),await e.access.roles.assign({user:n,role:s})}}),Vf=S.SA.role.newZ.extend({policies:S.SA.policy.keyZ.array()}),T3=at({name:Nr,schema:Vf,initialValues:{key:void 0,name:"",description:"",policies:[]},retrieve:async({client:e,query:t,store:r})=>{if(t.key==null)return;const o=await ti({client:e,query:{key:t.key},store:r});r.roles.set(t.key,o)},update:async({client:e,value:t,store:r,set:o,rollbacks:n})=>{const s=t();let i={key:d.Bu.create(),...s};const l=S.SA.role.ontologyID(i.key),c=S.wA.idToString(l);n.push(r.resources.set(c,{key:c,id:l,name:i.name,data:i})),n.push(r.roles.set(i.key,i)),s.policies.length>0&&(await e.ontology.addChildren(S.SA.role.ontologyID(i.key),...s.policies.map(m=>S.SA.policy.ontologyID(m))),s.policies.map(m=>({from:S.SA.role.ontologyID(i.key),to:S.SA.policy.ontologyID(m),type:S.wA.PARENT_OF_RELATIONSHIP_TYPE})).forEach(m=>n.push(r.relationships.set(S.wA.relationshipToString(m),m)))),i=await e.access.roles.create(i),o("key",i.key)}}),O3=je.renderProp(({itemKey:e,...t})=>{const r=bt.useItem(e);if(r==null)return null;const{name:o,description:n}=r;return a.jsxRuntimeExports.jsxs(ue.ListItem,{itemKey:e,y:!0,gap:"small",...t,style:{overflow:"hidden",maxWidth:"100%"},children:[a.jsxRuntimeExports.jsx(J.Text,{level:"p",weight:400,children:o}),r?.description!=null&&a.jsxRuntimeExports.jsx(J.Text,{level:"small",color:9,overflow:"wrap",children:n})]})}),L3=({initialQuery:e,filter:t,...r})=>{const{data:o,retrieve:n,getItem:s,subscribe:i,status:l}=Ff({initialQuery:e,filter:t}),{fetchMore:c,search:u}=yt.usePager({retrieve:n});return a.jsxRuntimeExports.jsx(Wt,{...r,data:o,getItem:s,subscribe:i,onFetchMore:c,onSearch:u,status:l,resourceName:"role",virtual:!1,children:O3})},z3=Object.freeze(Object.defineProperty({__proto__:null,CreateIcon:$3,PLURAL_RESOURCE_NAME:Zf,RESOURCE_NAME:Nr,Select:L3,changeRoleFormSchema:Bf,formSchema:Vf,useChangeRoleForm:P3,useDelete:N3,useForm:T3,useList:Ff,useRename:A3,useRetrieve:I3},Symbol.toStringTag,{value:"Module"})),M3=Object.freeze(Object.defineProperty({__proto__:null,Policy:h3,Role:z3,createGranted:C3,deleteGranted:_3,isGranted:ho,updateGranted:w3,useCreateGranted:b3,useDeleteGranted:S3,useGranted:go,useLoadPermissions:k3,useRetrieveGranted:j3,useUpdateGranted:E3,viewGranted:R3},Symbol.toStringTag,{value:"Module"}));function tt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,o;r<e.length;r++)(o=tt(e[r]))!==""&&(t+=(t&&" ")+o);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var D3={value:()=>{}};function ni(){for(var e=0,t=arguments.length,r={},o;e<t;++e){if(!(o=arguments[e]+"")||o in r||/[\s.]/.test(o))throw new Error("illegal type: "+o);r[o]=[]}return new ls(r)}function ls(e){this._=e}function U3(e,t){return e.trim().split(/^|\s+/).map(function(r){var o="",n=r.indexOf(".");if(n>=0&&(o=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:o}})}ls.prototype=ni.prototype={constructor:ls,on:function(e,t){var r=this._,o=U3(e+"",r),n,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((n=(e=o[s]).type)&&(n=Z3(r[n],e.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(n=(e=o[s]).type)r[n]=jd(r[n],e.name,t);else if(t==null)for(n in r)r[n]=jd(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new ls(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var r=new Array(n),o=0,n,s;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,n=s.length;o<n;++o)s[o].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],n=0,s=o.length;n<s;++n)o[n].value.apply(t,r)}};function Z3(e,t){for(var r=0,o=e.length,n;r<o;++r)if((n=e[r]).name===t)return n.value}function jd(e,t,r){for(var o=0,n=e.length;o<n;++o)if(e[o].name===t){e[o]=D3,e=e.slice(0,o).concat(e.slice(o+1));break}return r!=null&&e.push({name:t,value:r}),e}var Ca="http://www.w3.org/1999/xhtml";const Ed={svg:"http://www.w3.org/2000/svg",xhtml:Ca,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ri(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Ed.hasOwnProperty(t)?{space:Ed[t],local:e}:e}function F3(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Ca&&t.documentElement.namespaceURI===Ca?t.createElement(e):t.createElementNS(r,e)}}function B3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hf(e){var t=ri(e);return(t.local?B3:F3)(t)}function V3(){}function jl(e){return e==null?V3:function(){return this.querySelector(e)}}function H3(e){typeof e!="function"&&(e=jl(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=new Array(i),c,u,m=0;m<i;++m)(c=s[m])&&(u=e.call(c,c.__data__,m,s))&&("__data__"in c&&(u.__data__=c.__data__),l[m]=u);return new Rt(o,this._parents)}function G3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function K3(){return[]}function Gf(e){return e==null?K3:function(){return this.querySelectorAll(e)}}function Y3(e){return function(){return G3(e.apply(this,arguments))}}function q3(e){typeof e=="function"?e=Y3(e):e=Gf(e);for(var t=this._groups,r=t.length,o=[],n=[],s=0;s<r;++s)for(var i=t[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&(o.push(e.call(c,c.__data__,u,i)),n.push(c));return new Rt(o,n)}function Kf(e){return function(){return this.matches(e)}}function Yf(e){return function(t){return t.matches(e)}}var W3=Array.prototype.find;function X3(e){return function(){return W3.call(this.children,e)}}function J3(){return this.firstElementChild}function Q3(e){return this.select(e==null?J3:X3(typeof e=="function"?e:Yf(e)))}var ew=Array.prototype.filter;function tw(){return Array.from(this.children)}function nw(e){return function(){return ew.call(this.children,e)}}function rw(e){return this.selectAll(e==null?tw:nw(typeof e=="function"?e:Yf(e)))}function ow(e){typeof e!="function"&&(e=Kf(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Rt(o,this._parents)}function qf(e){return new Array(e.length)}function sw(){return new Rt(this._enter||this._groups.map(qf),this._parents)}function xs(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xs.prototype={constructor:xs,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 iw(e){return function(){return e}}function aw(e,t,r,o,n,s){for(var i=0,l,c=t.length,u=s.length;i<u;++i)(l=t[i])?(l.__data__=s[i],o[i]=l):r[i]=new xs(e,s[i]);for(;i<c;++i)(l=t[i])&&(n[i]=l)}function lw(e,t,r,o,n,s,i){var l,c,u=new Map,m=t.length,p=s.length,f=new Array(m),h;for(l=0;l<m;++l)(c=t[l])&&(f[l]=h=i.call(c,c.__data__,l,t)+"",u.has(h)?n[l]=c:u.set(h,c));for(l=0;l<p;++l)h=i.call(e,s[l],l,s)+"",(c=u.get(h))?(o[l]=c,c.__data__=s[l],u.delete(h)):r[l]=new xs(e,s[l]);for(l=0;l<m;++l)(c=t[l])&&u.get(f[l])===c&&(n[l]=c)}function cw(e){return e.__data__}function uw(e,t){if(!arguments.length)return Array.from(this,cw);var r=t?lw:aw,o=this._parents,n=this._groups;typeof e!="function"&&(e=iw(e));for(var s=n.length,i=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var m=o[u],p=n[u],f=p.length,h=dw(e.call(m,m&&m.__data__,u,o)),x=h.length,g=l[u]=new Array(x),y=i[u]=new Array(x),E=c[u]=new Array(f);r(m,p,g,y,E,h,t);for(var w=0,j=0,b,$;w<x;++w)if(b=g[w]){for(w>=j&&(j=w+1);!($=y[j])&&++j<x;);b._next=$||null}}return i=new Rt(i,o),i._enter=l,i._exit=c,i}function dw(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function mw(){return new Rt(this._exit||this._groups.map(qf),this._parents)}function pw(e,t,r){var o=this.enter(),n=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),r==null?s.remove():r(s),o&&n?o.merge(n).order():n}function fw(e){for(var t=e.selection?e.selection():e,r=this._groups,o=t._groups,n=r.length,s=o.length,i=Math.min(n,s),l=new Array(n),c=0;c<i;++c)for(var u=r[c],m=o[c],p=u.length,f=l[c]=new Array(p),h,x=0;x<p;++x)(h=u[x]||m[x])&&(f[x]=h);for(;c<n;++c)l[c]=r[c];return new Rt(l,this._parents)}function xw(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var o=e[t],n=o.length-1,s=o[n],i;--n>=0;)(i=o[n])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function hw(e){e||(e=gw);function t(p,f){return p&&f?e(p.__data__,f.__data__):!p-!f}for(var r=this._groups,o=r.length,n=new Array(o),s=0;s<o;++s){for(var i=r[s],l=i.length,c=n[s]=new Array(l),u,m=0;m<l;++m)(u=i[m])&&(c[m]=u);c.sort(t)}return new Rt(n,this._parents).order()}function gw(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function yw(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function vw(){return Array.from(this)}function jw(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length;n<s;++n){var i=o[n];if(i)return i}return null}function Ew(){let e=0;for(const t of this)++e;return e}function Sw(){return!this.node()}function bw(e){for(var t=this._groups,r=0,o=t.length;r<o;++r)for(var n=t[r],s=0,i=n.length,l;s<i;++s)(l=n[s])&&e.call(l,l.__data__,s,n);return this}function Rw(e){return function(){this.removeAttribute(e)}}function ww(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _w(e,t){return function(){this.setAttribute(e,t)}}function Cw(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function kw(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function $w(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function Iw(e,t){var r=ri(e);if(arguments.length<2){var o=this.node();return r.local?o.getAttributeNS(r.space,r.local):o.getAttribute(r)}return this.each((t==null?r.local?ww:Rw:typeof t=="function"?r.local?$w:kw:r.local?Cw:_w)(r,t))}function Wf(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Nw(e){return function(){this.style.removeProperty(e)}}function Aw(e,t,r){return function(){this.style.setProperty(e,t,r)}}function Pw(e,t,r){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,r)}}function Tw(e,t,r){return arguments.length>1?this.each((t==null?Nw:typeof t=="function"?Pw:Aw)(e,t,r??"")):hr(this.node(),e)}function hr(e,t){return e.style.getPropertyValue(t)||Wf(e).getComputedStyle(e,null).getPropertyValue(t)}function Ow(e){return function(){delete this[e]}}function Lw(e,t){return function(){this[e]=t}}function zw(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Mw(e,t){return arguments.length>1?this.each((t==null?Ow:typeof t=="function"?zw:Lw)(e,t)):this.node()[e]}function Xf(e){return e.trim().split(/^|\s+/)}function El(e){return e.classList||new Jf(e)}function Jf(e){this._node=e,this._names=Xf(e.getAttribute("class")||"")}Jf.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 Qf(e,t){for(var r=El(e),o=-1,n=t.length;++o<n;)r.add(t[o])}function ex(e,t){for(var r=El(e),o=-1,n=t.length;++o<n;)r.remove(t[o])}function Dw(e){return function(){Qf(this,e)}}function Uw(e){return function(){ex(this,e)}}function Zw(e,t){return function(){(t.apply(this,arguments)?Qf:ex)(this,e)}}function Fw(e,t){var r=Xf(e+"");if(arguments.length<2){for(var o=El(this.node()),n=-1,s=r.length;++n<s;)if(!o.contains(r[n]))return!1;return!0}return this.each((typeof t=="function"?Zw:t?Dw:Uw)(r,t))}function Bw(){this.textContent=""}function Vw(e){return function(){this.textContent=e}}function Hw(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Gw(e){return arguments.length?this.each(e==null?Bw:(typeof e=="function"?Hw:Vw)(e)):this.node().textContent}function Kw(){this.innerHTML=""}function Yw(e){return function(){this.innerHTML=e}}function qw(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ww(e){return arguments.length?this.each(e==null?Kw:(typeof e=="function"?qw:Yw)(e)):this.node().innerHTML}function Xw(){this.nextSibling&&this.parentNode.appendChild(this)}function Jw(){return this.each(Xw)}function Qw(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function e5(){return this.each(Qw)}function t5(e){var t=typeof e=="function"?e:Hf(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function n5(){return null}function r5(e,t){var r=typeof e=="function"?e:Hf(e),o=t==null?n5:typeof t=="function"?t:jl(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),o.apply(this,arguments)||null)})}function o5(){var e=this.parentNode;e&&e.removeChild(this)}function s5(){return this.each(o5)}function i5(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function a5(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function l5(e){return this.select(e?a5:i5)}function c5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function u5(e){return function(t){e.call(this,t,this.__data__)}}function d5(e){return e.trim().split(/^|\s+/).map(function(t){var r="",o=t.indexOf(".");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{type:t,name:r}})}function m5(e){return function(){var t=this.__on;if(t){for(var r=0,o=-1,n=t.length,s;r<n;++r)s=t[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function p5(e,t,r){return function(){var o=this.__on,n,s=u5(t);if(o){for(var i=0,l=o.length;i<l;++i)if((n=o[i]).type===e.type&&n.name===e.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),n.value=t;return}}this.addEventListener(e.type,s,r),n={type:e.type,name:e.name,value:t,listener:s,options:r},o?o.push(n):this.__on=[n]}}function f5(e,t,r){var o=d5(e+""),n,s=o.length,i;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,m;c<u;++c)for(n=0,m=l[c];n<s;++n)if((i=o[n]).type===m.type&&i.name===m.name)return m.value}return}for(l=t?p5:m5,n=0;n<s;++n)this.each(l(o[n],t,r));return this}function tx(e,t,r){var o=Wf(e),n=o.CustomEvent;typeof n=="function"?n=new n(t,r):(n=o.document.createEvent("Event"),r?(n.initEvent(t,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function x5(e,t){return function(){return tx(this,e,t)}}function h5(e,t){return function(){return tx(this,e,t.apply(this,arguments))}}function g5(e,t){return this.each((typeof t=="function"?h5:x5)(e,t))}function*y5(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length,i;n<s;++n)(i=o[n])&&(yield i)}var nx=[null];function Rt(e,t){this._groups=e,this._parents=t}function yo(){return new Rt([[document.documentElement]],nx)}function v5(){return this}Rt.prototype=yo.prototype={constructor:Rt,select:H3,selectAll:q3,selectChild:Q3,selectChildren:rw,filter:ow,data:uw,enter:sw,exit:mw,join:pw,merge:fw,selection:v5,order:xw,sort:hw,call:yw,nodes:vw,node:jw,size:Ew,empty:Sw,each:bw,attr:Iw,style:Tw,property:Mw,classed:Fw,text:Gw,html:Ww,raise:Jw,lower:e5,append:t5,insert:r5,remove:s5,clone:l5,datum:c5,on:f5,dispatch:g5,[Symbol.iterator]:y5};function Et(e){return typeof e=="string"?new Rt([[document.querySelector(e)]],[document.documentElement]):new Rt([[e]],nx)}function j5(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pt(e,t){if(e=j5(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var o=r.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[e.clientX-n.left-t.clientLeft,e.clientY-n.top-t.clientTop]}}return[e.pageX,e.pageY]}const E5={passive:!1},Jr={capture:!0,passive:!1};function aa(e){e.stopImmediatePropagation()}function mr(e){e.preventDefault(),e.stopImmediatePropagation()}function rx(e){var t=e.document.documentElement,r=Et(e).on("dragstart.drag",mr,Jr);"onselectstart"in t?r.on("selectstart.drag",mr,Jr):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ox(e,t){var r=e.document.documentElement,o=Et(e).on("dragstart.drag",null);t&&(o.on("click.drag",mr,Jr),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in r?o.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Go=e=>()=>e;function ka(e,{sourceEvent:t,subject:r,target:o,identifier:n,active:s,x:i,y:l,dx:c,dy:u,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:m}})}ka.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function S5(e){return!e.ctrlKey&&!e.button}function b5(){return this.parentNode}function R5(e,t){return t??{x:e.x,y:e.y}}function w5(){return navigator.maxTouchPoints||"ontouchstart"in this}function sx(){var e=S5,t=b5,r=R5,o=w5,n={},s=ni("start","drag","end"),i=0,l,c,u,m,p=0;function f(b){b.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",E,E5).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(b,$){if(!(m||!e.call(this,b,$))){var k=j(this,t.call(this,b,$),b,$,"mouse");k&&(Et(b.view).on("mousemove.drag",x,Jr).on("mouseup.drag",g,Jr),rx(b.view),aa(b),u=!1,l=b.clientX,c=b.clientY,k("start",b))}}function x(b){if(mr(b),!u){var $=b.clientX-l,k=b.clientY-c;u=$*$+k*k>p}n.mouse("drag",b)}function g(b){Et(b.view).on("mousemove.drag mouseup.drag",null),ox(b.view,u),mr(b),n.mouse("end",b)}function y(b,$){if(e.call(this,b,$)){var k=b.changedTouches,A=t.call(this,b,$),U=k.length,L,V;for(L=0;L<U;++L)(V=j(this,A,b,$,k[L].identifier,k[L]))&&(aa(b),V("start",b,k[L]))}}function E(b){var $=b.changedTouches,k=$.length,A,U;for(A=0;A<k;++A)(U=n[$[A].identifier])&&(mr(b),U("drag",b,$[A]))}function w(b){var $=b.changedTouches,k=$.length,A,U;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),A=0;A<k;++A)(U=n[$[A].identifier])&&(aa(b),U("end",b,$[A]))}function j(b,$,k,A,U,L){var V=s.copy(),M=Pt(L||k,$),D,B,C;if((C=r.call(b,new ka("beforestart",{sourceEvent:k,target:f,identifier:U,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:V}),A))!=null)return D=C.x-M[0]||0,B=C.y-M[1]||0,function O(N,T,P){var Z=M,H;switch(N){case"start":n[U]=O,H=i++;break;case"end":delete n[U],--i;case"drag":M=Pt(P||T,$),H=i;break}V.call(N,b,new ka(N,{sourceEvent:T,subject:C,target:f,identifier:U,active:H,x:M[0]+D,y:M[1]+B,dx:M[0]-Z[0],dy:M[1]-Z[1],dispatch:V}),A)}}return f.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Go(!!b),f):e},f.container=function(b){return arguments.length?(t=typeof b=="function"?b:Go(b),f):t},f.subject=function(b){return arguments.length?(r=typeof b=="function"?b:Go(b),f):r},f.touchable=function(b){return arguments.length?(o=typeof b=="function"?b:Go(!!b),f):o},f.on=function(){var b=s.on.apply(s,arguments);return b===s?f:b},f.clickDistance=function(b){return arguments.length?(p=(b=+b)*b,f):Math.sqrt(p)},f}var Sd=180/Math.PI,$a={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ix(e,t,r,o,n,s){var i,l,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*r+t*o)&&(r-=e*c,o-=t*c),(l=Math.sqrt(r*r+o*o))&&(r/=l,o/=l,c/=l),e*o<t*r&&(e=-e,t=-t,c=-c,i=-i),{translateX:n,translateY:s,rotate:Math.atan2(t,e)*Sd,skewX:Math.atan(c)*Sd,scaleX:i,scaleY:l}}var Ko;function _5(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$a:ix(t.a,t.b,t.c,t.d,t.e,t.f)}function C5(e){return e==null||(Ko||(Ko=document.createElementNS("http://www.w3.org/2000/svg","g")),Ko.setAttribute("transform",e),!(e=Ko.transform.baseVal.consolidate()))?$a:(e=e.matrix,ix(e.a,e.b,e.c,e.d,e.e,e.f))}function ax(e,t,r,o){function n(u){return u.length?u.pop()+" ":""}function s(u,m,p,f,h,x){if(u!==p||m!==f){var g=h.push("translate(",null,t,null,r);x.push({i:g-4,x:I.interpolateNumber(u,p)},{i:g-2,x:I.interpolateNumber(m,f)})}else(p||f)&&h.push("translate("+p+t+f+r)}function i(u,m,p,f){u!==m?(u-m>180?m+=360:m-u>180&&(u+=360),f.push({i:p.push(n(p)+"rotate(",null,o)-2,x:I.interpolateNumber(u,m)})):m&&p.push(n(p)+"rotate("+m+o)}function l(u,m,p,f){u!==m?f.push({i:p.push(n(p)+"skewX(",null,o)-2,x:I.interpolateNumber(u,m)}):m&&p.push(n(p)+"skewX("+m+o)}function c(u,m,p,f,h,x){if(u!==p||m!==f){var g=h.push(n(h)+"scale(",null,",",null,")");x.push({i:g-4,x:I.interpolateNumber(u,p)},{i:g-2,x:I.interpolateNumber(m,f)})}else(p!==1||f!==1)&&h.push(n(h)+"scale("+p+","+f+")")}return function(u,m){var p=[],f=[];return u=e(u),m=e(m),s(u.translateX,u.translateY,m.translateX,m.translateY,p,f),i(u.rotate,m.rotate,p,f),l(u.skewX,m.skewX,p,f),c(u.scaleX,u.scaleY,m.scaleX,m.scaleY,p,f),u=m=null,function(h){for(var x=-1,g=f.length,y;++x<g;)p[(y=f[x]).i]=y.x(h);return p.join("")}}}var k5=ax(_5,"px, ","px)","deg)"),$5=ax(C5,", ",")",")"),I5=1e-12;function bd(e){return((e=Math.exp(e))+1/e)/2}function N5(e){return((e=Math.exp(e))-1/e)/2}function A5(e){return((e=Math.exp(2*e))-1)/(e+1)}const cs=(function e(t,r,o){function n(s,i){var l=s[0],c=s[1],u=s[2],m=i[0],p=i[1],f=i[2],h=m-l,x=p-c,g=h*h+x*x,y,E;if(g<I5)E=Math.log(f/u)/t,y=function(A){return[l+A*h,c+A*x,u*Math.exp(t*A*E)]};else{var w=Math.sqrt(g),j=(f*f-u*u+o*g)/(2*u*r*w),b=(f*f-u*u-o*g)/(2*f*r*w),$=Math.log(Math.sqrt(j*j+1)-j),k=Math.log(Math.sqrt(b*b+1)-b);E=(k-$)/t,y=function(A){var U=A*E,L=bd($),V=u/(r*w)*(L*A5(t*U+$)-N5($));return[l+V*h,c+V*x,u*L/bd(t*U+$)]}}return y.duration=E*1e3*t/Math.SQRT2,y}return n.rho=function(s){var i=Math.max(.001,+s),l=i*i,c=l*l;return e(i,l,c)},n})(Math.SQRT2,2,4);var gr=0,Fr=0,Dr=0,lx=1e3,hs,Br,gs=0,Un=0,oi=0,Qr=typeof performance=="object"&&performance.now?performance:Date,cx=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Sl(){return Un||(cx(P5),Un=Qr.now()+oi)}function P5(){Un=0}function ys(){this._call=this._time=this._next=null}ys.prototype=ux.prototype={constructor:ys,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Sl():+r)+(t==null?0:+t),!this._next&&Br!==this&&(Br?Br._next=this:hs=this,Br=this),this._call=e,this._time=r,Ia()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ia())}};function ux(e,t,r){var o=new ys;return o.restart(e,t,r),o}function T5(){Sl(),++gr;for(var e=hs,t;e;)(t=Un-e._time)>=0&&e._call.call(void 0,t),e=e._next;--gr}function Rd(){Un=(gs=Qr.now())+oi,gr=Fr=0;try{T5()}finally{gr=0,L5(),Un=0}}function O5(){var e=Qr.now(),t=e-gs;t>lx&&(oi-=t,gs=e)}function L5(){for(var e,t=hs,r,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:hs=r);Br=e,Ia(o)}function Ia(e){if(!gr){Fr&&(Fr=clearTimeout(Fr));var t=e-Un;t>24?(e<1/0&&(Fr=setTimeout(Rd,e-Qr.now()-oi)),Dr&&(Dr=clearInterval(Dr))):(Dr||(gs=Qr.now(),Dr=setInterval(O5,lx)),gr=1,cx(Rd))}}function wd(e,t,r){var o=new ys;return t=t==null?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,r),o}var z5=ni("start","end","cancel","interrupt"),M5=[],dx=0,_d=1,Na=2,us=3,Cd=4,Aa=5,ds=6;function si(e,t,r,o,n,s){var i=e.__transition;if(!i)e.__transition={};else if(r in i)return;D5(e,r,{name:t,index:o,group:n,on:z5,tween:M5,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:dx})}function bl(e,t){var r=Kt(e,t);if(r.state>dx)throw new Error("too late; already scheduled");return r}function Xt(e,t){var r=Kt(e,t);if(r.state>us)throw new Error("too late; already running");return r}function Kt(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function D5(e,t,r){var o=e.__transition,n;o[t]=r,r.timer=ux(s,0,r.time);function s(u){r.state=_d,r.timer.restart(i,r.delay,r.time),r.delay<=u&&i(u-r.delay)}function i(u){var m,p,f,h;if(r.state!==_d)return c();for(m in o)if(h=o[m],h.name===r.name){if(h.state===us)return wd(i);h.state===Cd?(h.state=ds,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[m]):+m<t&&(h.state=ds,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[m])}if(wd(function(){r.state===us&&(r.state=Cd,r.timer.restart(l,r.delay,r.time),l(u))}),r.state=Na,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Na){for(r.state=us,n=new Array(f=r.tween.length),m=0,p=-1;m<f;++m)(h=r.tween[m].value.call(e,e.__data__,r.index,r.group))&&(n[++p]=h);n.length=p+1}}function l(u){for(var m=u<r.duration?r.ease.call(null,u/r.duration):(r.timer.restart(c),r.state=Aa,1),p=-1,f=n.length;++p<f;)n[p].call(e,m);r.state===Aa&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=ds,r.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function ms(e,t){var r=e.__transition,o,n,s=!0,i;if(r){t=t==null?null:t+"";for(i in r){if((o=r[i]).name!==t){s=!1;continue}n=o.state>Na&&o.state<Aa,o.state=ds,o.timer.stop(),o.on.call(n?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete r[i]}s&&delete e.__transition}}function U5(e){return this.each(function(){ms(this,e)})}function Z5(e,t){var r,o;return function(){var n=Xt(this,e),s=n.tween;if(s!==r){o=r=s;for(var i=0,l=o.length;i<l;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}n.tween=o}}function F5(e,t,r){var o,n;if(typeof r!="function")throw new Error;return function(){var s=Xt(this,e),i=s.tween;if(i!==o){n=(o=i).slice();for(var l={name:t,value:r},c=0,u=n.length;c<u;++c)if(n[c].name===t){n[c]=l;break}c===u&&n.push(l)}s.tween=n}}function B5(e,t){var r=this._id;if(e+="",arguments.length<2){for(var o=Kt(this.node(),r).tween,n=0,s=o.length,i;n<s;++n)if((i=o[n]).name===e)return i.value;return null}return this.each((t==null?Z5:F5)(r,e,t))}function Rl(e,t,r){var o=e._id;return e.each(function(){var n=Xt(this,o);(n.value||(n.value={}))[t]=r.apply(this,arguments)}),function(n){return Kt(n,o).value[t]}}function mx(e,t){var r;return(typeof t=="number"?I.interpolateNumber:t instanceof I.color?I.interpolateRgb:(r=I.color(t))?(t=r,I.interpolateRgb):I.interpolateString)(e,t)}function V5(e){return function(){this.removeAttribute(e)}}function H5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function G5(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttribute(e);return i===n?null:i===o?s:s=t(o=i,r)}}function K5(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===n?null:i===o?s:s=t(o=i,r)}}function Y5(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function q5(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function W5(e,t){var r=ri(e),o=r==="transform"?$5:mx;return this.attrTween(e,typeof t=="function"?(r.local?q5:Y5)(r,o,Rl(this,"attr."+e,t)):t==null?(r.local?H5:V5)(r):(r.local?K5:G5)(r,o,t))}function X5(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function J5(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function Q5(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&J5(e,s)),r}return n._value=t,n}function e_(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&X5(e,s)),r}return n._value=t,n}function t_(e,t){var r="attr."+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;var o=ri(e);return this.tween(r,(o.local?Q5:e_)(o,t))}function n_(e,t){return function(){bl(this,e).delay=+t.apply(this,arguments)}}function r_(e,t){return t=+t,function(){bl(this,e).delay=t}}function o_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?n_:r_)(t,e)):Kt(this.node(),t).delay}function s_(e,t){return function(){Xt(this,e).duration=+t.apply(this,arguments)}}function i_(e,t){return t=+t,function(){Xt(this,e).duration=t}}function a_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?s_:i_)(t,e)):Kt(this.node(),t).duration}function l_(e,t){if(typeof t!="function")throw new Error;return function(){Xt(this,e).ease=t}}function c_(e){var t=this._id;return arguments.length?this.each(l_(t,e)):Kt(this.node(),t).ease}function u_(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Xt(this,e).ease=r}}function d_(e){if(typeof e!="function")throw new Error;return this.each(u_(this._id,e))}function m_(e){typeof e!="function"&&(e=Kf(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new sn(o,this._parents,this._name,this._id)}function p_(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,o=t.length,n=r.length,s=Math.min(o,n),i=new Array(o),l=0;l<s;++l)for(var c=t[l],u=r[l],m=c.length,p=i[l]=new Array(m),f,h=0;h<m;++h)(f=c[h]||u[h])&&(p[h]=f);for(;l<o;++l)i[l]=t[l];return new sn(i,this._parents,this._name,this._id)}function f_(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function x_(e,t,r){var o,n,s=f_(t)?bl:Xt;return function(){var i=s(this,e),l=i.on;l!==o&&(n=(o=l).copy()).on(t,r),i.on=n}}function h_(e,t){var r=this._id;return arguments.length<2?Kt(this.node(),r).on.on(e):this.each(x_(r,e,t))}function g_(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function y_(){return this.on("end.remove",g_(this._id))}function v_(e){var t=this._name,r=this._id;typeof e!="function"&&(e=jl(e));for(var o=this._groups,n=o.length,s=new Array(n),i=0;i<n;++i)for(var l=o[i],c=l.length,u=s[i]=new Array(c),m,p,f=0;f<c;++f)(m=l[f])&&(p=e.call(m,m.__data__,f,l))&&("__data__"in m&&(p.__data__=m.__data__),u[f]=p,si(u[f],t,r,f,u,Kt(m,r)));return new sn(s,this._parents,t,r)}function j_(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Gf(e));for(var o=this._groups,n=o.length,s=[],i=[],l=0;l<n;++l)for(var c=o[l],u=c.length,m,p=0;p<u;++p)if(m=c[p]){for(var f=e.call(m,m.__data__,p,c),h,x=Kt(m,r),g=0,y=f.length;g<y;++g)(h=f[g])&&si(h,t,r,g,f,x);s.push(f),i.push(m)}return new sn(s,i,t,r)}var E_=yo.prototype.constructor;function S_(){return new E_(this._groups,this._parents)}function b_(e,t){var r,o,n;return function(){var s=hr(this,e),i=(this.style.removeProperty(e),hr(this,e));return s===i?null:s===r&&i===o?n:n=t(r=s,o=i)}}function px(e){return function(){this.style.removeProperty(e)}}function R_(e,t,r){var o,n=r+"",s;return function(){var i=hr(this,e);return i===n?null:i===o?s:s=t(o=i,r)}}function w_(e,t,r){var o,n,s;return function(){var i=hr(this,e),l=r(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),hr(this,e))),i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l))}}function __(e,t){var r,o,n,s="style."+t,i="end."+s,l;return function(){var c=Xt(this,e),u=c.on,m=c.value[s]==null?l||(l=px(t)):void 0;(u!==r||n!==m)&&(o=(r=u).copy()).on(i,n=m),c.on=o}}function C_(e,t,r){var o=(e+="")=="transform"?k5:mx;return t==null?this.styleTween(e,b_(e,o)).on("end.style."+e,px(e)):typeof t=="function"?this.styleTween(e,w_(e,o,Rl(this,"style."+e,t))).each(__(this._id,e)):this.styleTween(e,R_(e,o,t),r).on("end.style."+e,null)}function k_(e,t,r){return function(o){this.style.setProperty(e,t.call(this,o),r)}}function $_(e,t,r){var o,n;function s(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&k_(e,i,r)),o}return s._value=t,s}function I_(e,t,r){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,$_(e,t,r??""))}function N_(e){return function(){this.textContent=e}}function A_(e){return function(){var t=e(this);this.textContent=t??""}}function P_(e){return this.tween("text",typeof e=="function"?A_(Rl(this,"text",e)):N_(e==null?"":e+""))}function T_(e){return function(t){this.textContent=e.call(this,t)}}function O_(e){var t,r;function o(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&T_(n)),t}return o._value=e,o}function L_(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,O_(e))}function z_(){for(var e=this._name,t=this._id,r=fx(),o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)if(c=i[u]){var m=Kt(c,t);si(c,e,r,u,i,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new sn(o,this._parents,e,r)}function M_(){var e,t,r=this,o=r._id,n=r.size();return new Promise(function(s,i){var l={value:i},c={value:function(){--n===0&&s()}};r.each(function(){var u=Xt(this,o),m=u.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),n===0&&s()})}var D_=0;function sn(e,t,r,o){this._groups=e,this._parents=t,this._name=r,this._id=o}function fx(){return++D_}var en=yo.prototype;sn.prototype={constructor:sn,select:v_,selectAll:j_,selectChild:en.selectChild,selectChildren:en.selectChildren,filter:m_,merge:p_,selection:S_,transition:z_,call:en.call,nodes:en.nodes,node:en.node,size:en.size,empty:en.empty,each:en.each,on:h_,attr:W5,attrTween:t_,style:C_,styleTween:I_,text:P_,textTween:L_,remove:y_,tween:B5,delay:o_,duration:a_,ease:c_,easeVarying:d_,end:M_,[Symbol.iterator]:en[Symbol.iterator]};function U_(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Z_={time:null,delay:0,duration:250,ease:U_};function F_(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function B_(e){var t,r;e instanceof sn?(t=e._id,e=e._name):(t=fx(),(r=Z_).time=Sl(),e=e==null?null:e+"");for(var o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&si(c,e,t,u,i,r||F_(c,t));return new sn(o,this._parents,e,t)}yo.prototype.interrupt=U5;yo.prototype.transition=B_;const Yo=e=>()=>e;function V_(e,{sourceEvent:t,target:r,transform:o,dispatch:n}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:n}})}function nn(e,t,r){this.k=e,this.x=t,this.y=r}nn.prototype={constructor:nn,scale:function(e){return e===1?this:new nn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new nn(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 ii=new nn(1,0,0);xx.prototype=nn.prototype;function xx(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ii;return e.__zoom}function la(e){e.stopImmediatePropagation()}function Ur(e){e.preventDefault(),e.stopImmediatePropagation()}function H_(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function G_(){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 kd(){return this.__zoom||ii}function K_(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Y_(){return navigator.maxTouchPoints||"ontouchstart"in this}function q_(e,t,r){var o=e.invertX(t[0][0])-r[0][0],n=e.invertX(t[1][0])-r[1][0],s=e.invertY(t[0][1])-r[0][1],i=e.invertY(t[1][1])-r[1][1];return e.translate(n>o?(o+n)/2:Math.min(0,o)||Math.max(0,n),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function hx(){var e=H_,t=G_,r=q_,o=K_,n=Y_,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=cs,u=ni("start","zoom","end"),m,p,f,h=500,x=150,g=0,y=10;function E(C){C.property("__zoom",kd).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",V).filter(n).on("touchstart.zoom",M).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(C,O,N,T){var P=C.selection?C.selection():C;P.property("__zoom",kd),C!==P?$(C,O,N,T):P.interrupt().each(function(){k(this,arguments).event(T).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},E.scaleBy=function(C,O,N,T){E.scaleTo(C,function(){var P=this.__zoom.k,Z=typeof O=="function"?O.apply(this,arguments):O;return P*Z},N,T)},E.scaleTo=function(C,O,N,T){E.transform(C,function(){var P=t.apply(this,arguments),Z=this.__zoom,H=N==null?b(P):typeof N=="function"?N.apply(this,arguments):N,G=Z.invert(H),K=typeof O=="function"?O.apply(this,arguments):O;return r(j(w(Z,K),H,G),P,i)},N,T)},E.translateBy=function(C,O,N,T){E.transform(C,function(){return r(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,T)},E.translateTo=function(C,O,N,T,P){E.transform(C,function(){var Z=t.apply(this,arguments),H=this.__zoom,G=T==null?b(Z):typeof T=="function"?T.apply(this,arguments):T;return r(ii.translate(G[0],G[1]).scale(H.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof N=="function"?-N.apply(this,arguments):-N),Z,i)},T,P)};function w(C,O){return O=Math.max(s[0],Math.min(s[1],O)),O===C.k?C:new nn(O,C.x,C.y)}function j(C,O,N){var T=O[0]-N[0]*C.k,P=O[1]-N[1]*C.k;return T===C.x&&P===C.y?C:new nn(C.k,T,P)}function b(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function $(C,O,N,T){C.on("start.zoom",function(){k(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(T).end()}).tween("zoom",function(){var P=this,Z=arguments,H=k(P,Z).event(T),G=t.apply(P,Z),K=N==null?b(G):typeof N=="function"?N.apply(P,Z):N,se=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),ee=P.__zoom,fe=typeof O=="function"?O.apply(P,Z):O,xe=c(ee.invert(K).concat(se/ee.k),fe.invert(K).concat(se/fe.k));return function(ae){if(ae===1)ae=fe;else{var ne=xe(ae),ce=se/ne[2];ae=new nn(ce,K[0]-ne[0]*ce,K[1]-ne[1]*ce)}H.zoom(null,ae)}})}function k(C,O,N){return!N&&C.__zooming||new A(C,O)}function A(C,O){this.that=C,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,O),this.taps=0}A.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,O){return this.mouse&&C!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var O=Et(this.that).datum();u.call(C,this.that,new V_(C,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:u}),O)}};function U(C,...O){if(!e.apply(this,arguments))return;var N=k(this,O).event(C),T=this.__zoom,P=Math.max(s[0],Math.min(s[1],T.k*Math.pow(2,o.apply(this,arguments)))),Z=Pt(C);if(N.wheel)(N.mouse[0][0]!==Z[0]||N.mouse[0][1]!==Z[1])&&(N.mouse[1]=T.invert(N.mouse[0]=Z)),clearTimeout(N.wheel);else{if(T.k===P)return;N.mouse=[Z,T.invert(Z)],ms(this),N.start()}Ur(C),N.wheel=setTimeout(H,x),N.zoom("mouse",r(j(w(T,P),N.mouse[0],N.mouse[1]),N.extent,i));function H(){N.wheel=null,N.end()}}function L(C,...O){if(f||!e.apply(this,arguments))return;var N=C.currentTarget,T=k(this,O,!0).event(C),P=Et(C.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",se,!0),Z=Pt(C,N),H=C.clientX,G=C.clientY;rx(C.view),la(C),T.mouse=[Z,this.__zoom.invert(Z)],ms(this),T.start();function K(ee){if(Ur(ee),!T.moved){var fe=ee.clientX-H,xe=ee.clientY-G;T.moved=fe*fe+xe*xe>g}T.event(ee).zoom("mouse",r(j(T.that.__zoom,T.mouse[0]=Pt(ee,N),T.mouse[1]),T.extent,i))}function se(ee){P.on("mousemove.zoom mouseup.zoom",null),ox(ee.view,T.moved),Ur(ee),T.event(ee).end()}}function V(C,...O){if(e.apply(this,arguments)){var N=this.__zoom,T=Pt(C.changedTouches?C.changedTouches[0]:C,this),P=N.invert(T),Z=N.k*(C.shiftKey?.5:2),H=r(j(w(N,Z),T,P),t.apply(this,O),i);Ur(C),l>0?Et(this).transition().duration(l).call($,H,T,C):Et(this).call(E.transform,H,T,C)}}function M(C,...O){if(e.apply(this,arguments)){var N=C.touches,T=N.length,P=k(this,O,C.changedTouches.length===T).event(C),Z,H,G,K;for(la(C),H=0;H<T;++H)G=N[H],K=Pt(G,this),K=[K,this.__zoom.invert(K),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==K[2]&&(P.touch1=K,P.taps=0):(P.touch0=K,Z=!0,P.taps=1+!!m);m&&(m=clearTimeout(m)),Z&&(P.taps<2&&(p=K[0],m=setTimeout(function(){m=null},h)),ms(this),P.start())}}function D(C,...O){if(this.__zooming){var N=k(this,O).event(C),T=C.changedTouches,P=T.length,Z,H,G,K;for(Ur(C),Z=0;Z<P;++Z)H=T[Z],G=Pt(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=G:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=G);if(H=N.that.__zoom,N.touch1){var se=N.touch0[0],ee=N.touch0[1],fe=N.touch1[0],xe=N.touch1[1],ae=(ae=fe[0]-se[0])*ae+(ae=fe[1]-se[1])*ae,ne=(ne=xe[0]-ee[0])*ne+(ne=xe[1]-ee[1])*ne;H=w(H,Math.sqrt(ae/ne)),G=[(se[0]+fe[0])/2,(se[1]+fe[1])/2],K=[(ee[0]+xe[0])/2,(ee[1]+xe[1])/2]}else if(N.touch0)G=N.touch0[0],K=N.touch0[1];else return;N.zoom("touch",r(j(H,G,K),N.extent,i))}}function B(C,...O){if(this.__zooming){var N=k(this,O).event(C),T=C.changedTouches,P=T.length,Z,H;for(la(C),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),Z=0;Z<P;++Z)H=T[Z],N.touch0&&N.touch0[2]===H.identifier?delete N.touch0:N.touch1&&N.touch1[2]===H.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(H=Pt(H,this),Math.hypot(p[0]-H[0],p[1]-H[1])<y)){var G=Et(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return E.wheelDelta=function(C){return arguments.length?(o=typeof C=="function"?C:Yo(+C),E):o},E.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Yo(!!C),E):e},E.touchable=function(C){return arguments.length?(n=typeof C=="function"?C:Yo(!!C),E):n},E.extent=function(C){return arguments.length?(t=typeof C=="function"?C:Yo([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),E):t},E.scaleExtent=function(C){return arguments.length?(s[0]=+C[0],s[1]=+C[1],E):[s[0],s[1]]},E.translateExtent=function(C){return arguments.length?(i[0][0]=+C[0][0],i[1][0]=+C[1][0],i[0][1]=+C[0][1],i[1][1]=+C[1][1],E):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},E.constrain=function(C){return arguments.length?(r=C,E):r},E.duration=function(C){return arguments.length?(l=+C,E):l},E.interpolate=function(C){return arguments.length?(c=C,E):c},E.on=function(){var C=u.on.apply(u,arguments);return C===u?E:C},E.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,E):Math.sqrt(g)},E.tapDistance=function(C){return arguments.length?(y=+C,E):y},E}const pt={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:r,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:o}", 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."},eo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gx=["Enter"," ","Escape"],yx={"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:r})=>`Moved selected node ${e}. New position, x: ${t}, y: ${r}`,"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 Zn;(function(e){e.Strict="strict",e.Loose="loose"})(Zn||(Zn={}));var Pn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pn||(Pn={}));var yr;(function(e){e.Partial="partial",e.Full="full"})(yr||(yr={}));const vx={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var yn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(yn||(yn={}));var to;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(to||(to={}));var oe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(oe||(oe={}));const $d={[oe.Left]:oe.Right,[oe.Right]:oe.Left,[oe.Top]:oe.Bottom,[oe.Bottom]:oe.Top};function jx(e){return e===null?null:e?"valid":"invalid"}const Ex=e=>"id"in e&&"source"in e&&"target"in e,W_=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),wl=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),vo=(e,t=[0,0])=>{const{width:r,height:o}=un(e),n=e.origin??t,s=r*n[0],i=o*n[1];return{x:e.position.x-s,y:e.position.y-i}},X_=(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 r=e.reduce((o,n)=>{const s=typeof n=="string";let i=!t.nodeLookup&&!s?n:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(n):wl(n)?n:t.nodeLookup.get(n.id));const l=i?vs(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ai(o,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return li(r)},jo=(e,t={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(n=>{(t.filter===void 0||t.filter(n))&&(r=ai(r,vs(n)),o=!0)}),o?li(r):{x:0,y:0,width:0,height:0}},_l=(e,t,[r,o,n]=[0,0,1],s=!1,i=!1)=>{const l={...So(t,[r,o,n]),width:t.width/n,height:t.height/n},c=[];for(const u of e.values()){const{measured:m,selectable:p=!0,hidden:f=!1}=u;if(i&&!p||f)continue;const h=m.width??u.width??u.initialWidth??null,x=m.height??u.height??u.initialHeight??null,g=no(l,jr(u)),y=(h??0)*(x??0),E=s&&g>0;(!u.internals.handleBounds||E||g>=y||u.dragging)&&c.push(u)}return c},J_=(e,t)=>{const r=new Set;return e.forEach(o=>{r.add(o.id)}),t.filter(o=>r.has(o.source)||r.has(o.target))};function Q_(e,t){const r=new Map,o=t?.nodes?new Set(t.nodes.map(n=>n.id)):null;return e.forEach(n=>{n.measured.width&&n.measured.height&&(t?.includeHiddenNodes||!n.hidden)&&(!o||o.has(n.id))&&r.set(n.id,n)}),r}async function e6({nodes:e,width:t,height:r,panZoom:o,minZoom:n,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const l=Q_(e,i),c=jo(l),u=Cl(c,t,r,i?.minZoom??n,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(u,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Sx({nodeId:e,nextPosition:t,nodeLookup:r,nodeOrigin:o=[0,0],nodeExtent:n,onError:s}){const i=r.get(e),l=i.parentId?r.get(i.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},m=i.origin??o;let p=i.extent||n;if(i.extent==="parent"&&!i.expandParent)if(!l)s?.("005",pt.error005());else{const h=l.measured.width,x=l.measured.height;h&&x&&(p=[[c,u],[c+h,u+x]])}else l&&Er(i.extent)&&(p=[[i.extent[0][0]+c,i.extent[0][1]+u],[i.extent[1][0]+c,i.extent[1][1]+u]]);const f=Er(p)?Fn(t,p,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pt.error015()),{position:{x:f.x-c+(i.measured.width??0)*m[0],y:f.y-u+(i.measured.height??0)*m[1]},positionAbsolute:f}}async function t6({nodesToRemove:e=[],edgesToRemove:t=[],nodes:r,edges:o,onBeforeDelete:n}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of r){if(f.deletable===!1)continue;const h=s.has(f.id),x=!h&&f.parentId&&i.find(g=>g.id===f.parentId);(h||x)&&i.push(f)}const l=new Set(t.map(f=>f.id)),c=o.filter(f=>f.deletable!==!1),m=J_(i,c);for(const f of c)l.has(f.id)&&!m.find(x=>x.id===f.id)&&m.push(f);if(!n)return{edges:m,nodes:i};const p=await n({nodes:i,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:i}:{edges:[],nodes:[]}:p}const vr=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Fn=(e={x:0,y:0},t,r)=>({x:vr(e.x,t[0][0],t[1][0]-(r?.width??0)),y:vr(e.y,t[0][1],t[1][1]-(r?.height??0))});function bx(e,t,r){const{width:o,height:n}=un(r),{x:s,y:i}=r.internals.positionAbsolute;return Fn(e,[[s,i],[s+o,i+n]],t)}const Id=(e,t,r)=>e<t?vr(Math.abs(e-t),1,t)/t:e>r?-vr(Math.abs(e-r),1,t)/t:0,Rx=(e,t,r=15,o=40)=>{const n=Id(e.x,o,t.width-o)*r,s=Id(e.y,o,t.height-o)*r;return[n,s]},ai=(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)}),Pa=({x:e,y:t,width:r,height:o})=>({x:e,y:t,x2:e+r,y2:t+o}),li=({x:e,y:t,x2:r,y2:o})=>({x:e,y:t,width:r-e,height:o-t}),jr=(e,t=[0,0])=>{const{x:r,y:o}=wl(e)?e.internals.positionAbsolute:vo(e,t);return{x:r,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},vs=(e,t=[0,0])=>{const{x:r,y:o}=wl(e)?e.internals.positionAbsolute:vo(e,t);return{x:r,y:o,x2:r+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},wx=(e,t)=>li(ai(Pa(e),Pa(t))),no=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*o)},Nd=e=>Ot(e.width)&&Ot(e.height)&&Ot(e.x)&&Ot(e.y),Ot=e=>!isNaN(e)&&isFinite(e),js=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Eo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),So=({x:e,y:t},[r,o,n],s=!1,i=[1,1])=>{const l={x:(e-r)/n,y:(t-o)/n};return s?Eo(l,i):l},Es=({x:e,y:t},[r,o,n])=>({x:e*n+r,y:t*n+o});function ar(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(t*r*.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 n6(e,t,r){if(typeof e=="string"||typeof e=="number"){const o=ar(e,r),n=ar(e,t);return{top:o,right:n,bottom:o,left:n,x:n*2,y:o*2}}if(typeof e=="object"){const o=ar(e.top??e.y??0,r),n=ar(e.bottom??e.y??0,r),s=ar(e.left??e.x??0,t),i=ar(e.right??e.x??0,t);return{top:o,right:i,bottom:n,left:s,x:s+i,y:o+n}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function r6(e,t,r,o,n,s){const{x:i,y:l}=Es(e,[t,r,o]),{x:c,y:u}=Es({x:e.x+e.width,y:e.y+e.height},[t,r,o]),m=n-c,p=s-u;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(m),bottom:Math.floor(p)}}const Cl=(e,t,r,o,n,s)=>{const i=n6(s,t,r),l=(t-i.x)/e.width,c=(r-i.y)/e.height,u=Math.min(l,c),m=vr(u,o,n),p=e.x+e.width/2,f=e.y+e.height/2,h=t/2-p*m,x=r/2-f*m,g=r6(e,h,x,m,t,r),y={left:Math.min(g.left-i.left,0),top:Math.min(g.top-i.top,0),right:Math.min(g.right-i.right,0),bottom:Math.min(g.bottom-i.bottom,0)};return{x:h-y.left+y.right,y:x-y.top+y.bottom,zoom:m}},ro=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Er(e){return e!=null&&e!=="parent"}function un(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function _x(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Cx(e,t={width:0,height:0},r,o,n){const s={...e},i=o.get(r);if(i){const l=i.origin||n;s.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function Ad(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function o6(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function s6(e){return{...yx,...e||{}}}function qr(e,{snapGrid:t=[0,0],snapToGrid:r=!1,transform:o,containerBounds:n}){const{x:s,y:i}=Lt(e),l=So({x:s-(n?.left??0),y:i-(n?.top??0)},o),{x:c,y:u}=r?Eo(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const kl=e=>({width:e.offsetWidth,height:e.offsetHeight}),kx=e=>e?.getRootNode?.()||window?.document,i6=["INPUT","SELECT","TEXTAREA"];function $x(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:i6.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ix=e=>"clientX"in e,Lt=(e,t)=>{const r=Ix(e),o=r?e.clientX:e.touches?.[0].clientX,n=r?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:n-(t?.top??0)}},Pd=(e,t,r,o,n)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:n,position:i.getAttribute("data-handlepos"),x:(l.left-r.left)/o,y:(l.top-r.top)/o,...kl(i)}})};function Nx({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:n,sourceControlY:s,targetControlX:i,targetControlY:l}){const c=e*.125+n*.375+i*.375+r*.125,u=t*.125+s*.375+l*.375+o*.125,m=Math.abs(c-e),p=Math.abs(u-t);return[c,u,m,p]}function qo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Td({pos:e,x1:t,y1:r,x2:o,y2:n,c:s}){switch(e){case oe.Left:return[t-qo(t-o,s),r];case oe.Right:return[t+qo(o-t,s),r];case oe.Top:return[t,r-qo(r-n,s)];case oe.Bottom:return[t,r+qo(n-r,s)]}}function Ax({sourceX:e,sourceY:t,sourcePosition:r=oe.Bottom,targetX:o,targetY:n,targetPosition:s=oe.Top,curvature:i=.25}){const[l,c]=Td({pos:r,x1:e,y1:t,x2:o,y2:n,c:i}),[u,m]=Td({pos:s,x1:o,y1:n,x2:e,y2:t,c:i}),[p,f,h,x]=Nx({sourceX:e,sourceY:t,targetX:o,targetY:n,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:m});return[`M${e},${t} C${l},${c} ${u},${m} ${o},${n}`,p,f,h,x]}function Px({sourceX:e,sourceY:t,targetX:r,targetY:o}){const n=Math.abs(r-e)/2,s=r<e?r+n:r-n,i=Math.abs(o-t)/2,l=o<t?o+i:o-i;return[s,l,n,i]}function a6({sourceNode:e,targetNode:t,selected:r=!1,zIndex:o=0,elevateOnSelect:n=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=n&&r?o+1e3:o,l=Math.max(e.parentId||n&&e.selected?e.internals.z:0,t.parentId||n&&t.selected?t.internals.z:0);return i+l}function l6({sourceNode:e,targetNode:t,width:r,height:o,transform:n}){const s=ai(vs(e),vs(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-n[0]/n[2],y:-n[1]/n[2],width:r/n[2],height:o/n[2]};return no(i,li(s))>0}const Tx=({source:e,sourceHandle:t,target:r,targetHandle:o})=>`xy-edge__${e}${t||""}-${r}${o||""}`,c6=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),Ox=(e,t,r={})=>{if(!e.source||!e.target)return js("006",pt.error006()),t;const o=r.getEdgeId||Tx;let n;return Ex(e)?n={...e}:n={...e,id:o(e)},c6(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))},u6=(e,t,r,o={shouldReplaceId:!0})=>{const{id:n,...s}=e;if(!t.source||!t.target)return js("006",pt.error006()),r;if(!r.find(u=>u.id===e.id))return js("007",pt.error007(n)),r;const l=o.getEdgeId||Tx,c={...s,id:o.shouldReplaceId?l(t):n,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return r.filter(u=>u.id!==n).concat(c)};function Lx({sourceX:e,sourceY:t,targetX:r,targetY:o}){const[n,s,i,l]=Px({sourceX:e,sourceY:t,targetX:r,targetY:o});return[`M ${e},${t}L ${r},${o}`,n,s,i,l]}const Od={[oe.Left]:{x:-1,y:0},[oe.Right]:{x:1,y:0},[oe.Top]:{x:0,y:-1},[oe.Bottom]:{x:0,y:1}},d6=({source:e,sourcePosition:t=oe.Bottom,target:r})=>t===oe.Left||t===oe.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},Ld=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function m6({source:e,sourcePosition:t=oe.Bottom,target:r,targetPosition:o=oe.Top,center:n,offset:s,stepPosition:i}){const l=Od[t],c=Od[o],u={x:e.x+l.x*s,y:e.y+l.y*s},m={x:r.x+c.x*s,y:r.y+c.y*s},p=d6({source:u,sourcePosition:t,target:m}),f=p.x!==0?"x":"y",h=p[f];let x=[],g,y;const E={x:0,y:0},w={x:0,y:0},[,,j,b]=Px({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[f]*c[f]===-1){f==="x"?(g=n.x??u.x+(m.x-u.x)*i,y=n.y??(u.y+m.y)/2):(g=n.x??(u.x+m.x)/2,y=n.y??u.y+(m.y-u.y)*i);const k=[{x:g,y:u.y},{x:g,y:m.y}],A=[{x:u.x,y},{x:m.x,y}];l[f]===h?x=f==="x"?k:A:x=f==="x"?A:k}else{const k=[{x:u.x,y:m.y}],A=[{x:m.x,y:u.y}];if(f==="x"?x=l.x===h?A:k:x=l.y===h?k:A,t===o){const D=Math.abs(e[f]-r[f]);if(D<=s){const B=Math.min(s-1,s-D);l[f]===h?E[f]=(u[f]>e[f]?-1:1)*B:w[f]=(m[f]>r[f]?-1:1)*B}}if(t!==o){const D=f==="x"?"y":"x",B=l[f]===c[D],C=u[D]>m[D],O=u[D]<m[D];(l[f]===1&&(!B&&C||B&&O)||l[f]!==1&&(!B&&O||B&&C))&&(x=f==="x"?k:A)}const U={x:u.x+E.x,y:u.y+E.y},L={x:m.x+w.x,y:m.y+w.y},V=Math.max(Math.abs(U.x-x[0].x),Math.abs(L.x-x[0].x)),M=Math.max(Math.abs(U.y-x[0].y),Math.abs(L.y-x[0].y));V>=M?(g=(U.x+L.x)/2,y=x[0].y):(g=x[0].x,y=(U.y+L.y)/2)}return[[e,{x:u.x+E.x,y:u.y+E.y},...x,{x:m.x+w.x,y:m.y+w.y},r],g,y,j,b]}function p6(e,t,r,o){const n=Math.min(Ld(e,t)/2,Ld(t,r)/2,o),{x:s,y:i}=t;if(e.x===s&&s===r.x||e.y===i&&i===r.y)return`L${s} ${i}`;if(e.y===i){const u=e.x<r.x?-1:1,m=e.y<r.y?1:-1;return`L ${s+n*u},${i}Q ${s},${i} ${s},${i+n*m}`}const l=e.x<r.x?1:-1,c=e.y<r.y?-1:1;return`L ${s},${i+n*c}Q ${s},${i} ${s+n*l},${i}`}function Ta({sourceX:e,sourceY:t,sourcePosition:r=oe.Bottom,targetX:o,targetY:n,targetPosition:s=oe.Top,borderRadius:i=5,centerX:l,centerY:c,offset:u=20,stepPosition:m=.5}){const[p,f,h,x,g]=m6({source:{x:e,y:t},sourcePosition:r,target:{x:o,y:n},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:m});return[p.reduce((E,w,j)=>{let b="";return j>0&&j<p.length-1?b=p6(p[j-1],w,p[j+1],i):b=`${j===0?"M":"L"}${w.x} ${w.y}`,E+=b,E},""),f,h,x,g]}function zd(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function f6(e){const{sourceNode:t,targetNode:r}=e;if(!zd(t)||!zd(r))return null;const o=t.internals.handleBounds||Md(t.handles),n=r.internals.handleBounds||Md(r.handles),s=Dd(o?.source??[],e.sourceHandle),i=Dd(e.connectionMode===Zn.Strict?n?.target??[]:(n?.target??[]).concat(n?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pt.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=s?.position||oe.Bottom,c=i?.position||oe.Top,u=Bn(t,s,l),m=Bn(r,i,c);return{sourceX:u.x,sourceY:u.y,targetX:m.x,targetY:m.y,sourcePosition:l,targetPosition:c}}function Md(e){if(!e)return null;const t=[],r=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&r.push(o);return{source:t,target:r}}function Bn(e,t,r=oe.Left,o=!1){const n=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??un(e);if(o)return{x:n+i/2,y:s+l/2};switch(t?.position??r){case oe.Top:return{x:n+i/2,y:s};case oe.Right:return{x:n+i,y:s+l/2};case oe.Bottom:return{x:n+i/2,y:s+l};case oe.Left:return{x:n,y:s+l/2}}}function Dd(e,t){return e&&(t?e.find(r=>r.id===t):e[0])||null}function Oa(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function x6(e,{id:t,defaultColor:r,defaultMarkerStart:o,defaultMarkerEnd:n}){const s=new Set;return e.reduce((i,l)=>([l.markerStart||o,l.markerEnd||n].forEach(c=>{if(c&&typeof c=="object"){const u=Oa(c,t);s.has(u)||(i.push({id:u,color:c.color||r,...c}),s.add(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const zx=1e3,h6=10,$l={nodeOrigin:[0,0],nodeExtent:eo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},g6={...$l,checkEquality:!0};function Il(e,t){const r={...e};for(const o in t)t[o]!==void 0&&(r[o]=t[o]);return r}function y6(e,t,r){const o=Il($l,r);for(const n of e.values())if(n.parentId)Al(n,e,t,o);else{const s=vo(n,o.nodeOrigin),i=Er(n.extent)?n.extent:o.nodeExtent,l=Fn(s,i,un(n));n.internals.positionAbsolute=l}}function v6(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const r=[],o=[];for(const n of e.handles){const s={id:n.id,width:n.width??1,height:n.height??1,nodeId:e.id,x:n.x,y:n.y,position:n.position,type:n.type};n.type==="source"?r.push(s):n.type==="target"&&o.push(s)}return{source:r,target:o}}function Nl(e){return e==="manual"}function La(e,t,r,o={}){const n=Il(g6,o),s={i:0},i=new Map(t),l=n?.elevateNodesOnSelect&&!Nl(n.zIndexMode)?zx:0;let c=e.length>0;t.clear(),r.clear();for(const u of e){let m=i.get(u.id);if(n.checkEquality&&u===m?.internals.userNode)t.set(u.id,m);else{const p=vo(u,n.nodeOrigin),f=Er(u.extent)?u.extent:n.nodeExtent,h=Fn(p,f,un(u));m={...n.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:v6(u,m),z:Mx(u,l,n.zIndexMode),userNode:u}},t.set(u.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),u.parentId&&Al(m,t,r,o,s)}return c}function j6(e,t){if(!e.parentId)return;const r=t.get(e.parentId);r?r.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Al(e,t,r,o,n){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Il($l,o),u=e.parentId,m=t.get(u);if(!m){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}j6(e,r),n&&!m.parentId&&m.internals.rootParentIndex===void 0&&c==="auto"&&(m.internals.rootParentIndex=++n.i,m.internals.z=m.internals.z+n.i*h6),n&&m.internals.rootParentIndex!==void 0&&(n.i=m.internals.rootParentIndex);const p=s&&!Nl(c)?zx:0,{x:f,y:h,z:x}=E6(e,m,i,l,p,c),{positionAbsolute:g}=e.internals,y=f!==g.x||h!==g.y;(y||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:g,z:x}})}function Mx(e,t,r){const o=Ot(e.zIndex)?e.zIndex:0;return Nl(r)?o:o+(e.selected?t:0)}function E6(e,t,r,o,n,s){const{x:i,y:l}=t.internals.positionAbsolute,c=un(e),u=vo(e,r),m=Er(e.extent)?Fn(u,e.extent,c):u;let p=Fn({x:i+m.x,y:l+m.y},o,c);e.extent==="parent"&&(p=bx(p,c,t));const f=Mx(e,n,s),h=t.internals.z??0;return{x:p.x,y:p.y,z:h>=f?h+1:f}}function Pl(e,t,r,o=[0,0]){const n=[],s=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=s.get(i.parentId)?.expandedRect??jr(l),u=wx(c,i.rect);s.set(i.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:i,parent:l},c)=>{const u=l.internals.positionAbsolute,m=un(l),p=l.origin??o,f=i.x<u.x?Math.round(Math.abs(u.x-i.x)):0,h=i.y<u.y?Math.round(Math.abs(u.y-i.y)):0,x=Math.max(m.width,Math.round(i.width)),g=Math.max(m.height,Math.round(i.height)),y=(x-m.width)*p[0],E=(g-m.height)*p[1];(f>0||h>0||y||E)&&(n.push({id:c,type:"position",position:{x:l.position.x-f+y,y:l.position.y-h+E}}),r.get(c)?.forEach(w=>{e.some(j=>j.id===w.id)||n.push({id:w.id,type:"position",position:{x:w.position.x+f,y:w.position.y+h}})})),(m.width<i.width||m.height<i.height||f||h)&&n.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:x+(f?p[0]*f-y:0),height:g+(h?p[1]*h-E:0)}})}),n}function S6(e,t,r,o,n,s,i){const l=o?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],m=window.getComputedStyle(l),{m22:p}=new window.DOMMatrixReadOnly(m.transform),f=[];for(const h of e.values()){const x=t.get(h.id);if(!x)continue;if(x.hidden){t.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),c=!0;continue}const g=kl(h.nodeElement),y=x.measured.width!==g.width||x.measured.height!==g.height;if(!!(g.width&&g.height&&(y||!x.internals.handleBounds||h.force))){const w=h.nodeElement.getBoundingClientRect(),j=Er(x.extent)?x.extent:s;let{positionAbsolute:b}=x.internals;x.parentId&&x.extent==="parent"?b=bx(b,g,t.get(x.parentId)):j&&(b=Fn(b,j,g));const $={...x,measured:g,internals:{...x.internals,positionAbsolute:b,handleBounds:{source:Pd("source",h.nodeElement,w,p,x.id),target:Pd("target",h.nodeElement,w,p,x.id)}}};t.set(x.id,$),x.parentId&&Al($,t,r,{nodeOrigin:n,zIndexMode:i}),c=!0,y&&(u.push({id:x.id,type:"dimensions",dimensions:g}),x.expandParent&&x.parentId&&f.push({id:x.id,parentId:x.parentId,rect:jr($,n)}))}}if(f.length>0){const h=Pl(f,t,r,n);u.push(...h)}return{changes:u,updatedInternals:c}}async function b6({delta:e,panZoom:t,transform:r,translateExtent:o,width:n,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[n,s]],o),l=!!i&&(i.x!==r[0]||i.y!==r[1]||i.k!==r[2]);return Promise.resolve(l)}function Ud(e,t,r,o,n,s){let i=n;const l=o.get(i)||new Map;o.set(i,l.set(r,t)),i=`${n}-${e}`;const c=o.get(i)||new Map;if(o.set(i,c.set(r,t)),s){i=`${n}-${e}-${s}`;const u=o.get(i)||new Map;o.set(i,u.set(r,t))}}function Dx(e,t,r){e.clear(),t.clear();for(const o of r){const{source:n,target:s,sourceHandle:i=null,targetHandle:l=null}=o,c={edgeId:o.id,source:n,target:s,sourceHandle:i,targetHandle:l},u=`${n}-${i}--${s}-${l}`,m=`${s}-${l}--${n}-${i}`;Ud("source",c,m,e,n,i),Ud("target",c,u,e,s,l),t.set(o.id,o)}}function Ux(e,t){if(!e.parentId)return!1;const r=t.get(e.parentId);return r?r.selected?!0:Ux(r,t):!1}function Zd(e,t,r){let o=e;do{if(o?.matches?.(t))return!0;if(o===r)return!1;o=o?.parentElement}while(o);return!1}function R6(e,t,r,o){const n=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Ux(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(s);l&&n.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return n}function ca({nodeId:e,dragItems:t,nodeLookup:r,dragging:o=!0}){const n=[];for(const[i,l]of t){const c=r.get(i)?.internals.userNode;c&&n.push({...c,position:l.position,dragging:o})}if(!e)return[n[0],n];const s=r.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:n[0],n]}function w6({dragItems:e,snapGrid:t,x:r,y:o}){const n=e.values().next().value;if(!n)return null;const s={x:r-n.distance.x,y:o-n.distance.y},i=Eo(s,t);return{x:i.x-s.x,y:i.y-s.y}}function _6({onNodeMouseDown:e,getStoreItems:t,onDragStart:r,onDrag:o,onDragStop:n}){let s={x:null,y:null},i=0,l=new Map,c=!1,u={x:0,y:0},m=null,p=!1,f=null,h=!1,x=!1,g=null;function y({noDragClassName:w,handleSelector:j,domNode:b,isSelectable:$,nodeId:k,nodeClickDistance:A=0}){f=Et(b);function U({x:D,y:B}){const{nodeLookup:C,nodeExtent:O,snapGrid:N,snapToGrid:T,nodeOrigin:P,onNodeDrag:Z,onSelectionDrag:H,onError:G,updateNodePositions:K}=t();s={x:D,y:B};let se=!1;const ee=l.size>1,fe=ee&&O?Pa(jo(l)):null,xe=ee&&T?w6({dragItems:l,snapGrid:N,x:D,y:B}):null;for(const[ae,ne]of l){if(!C.has(ae))continue;let ce={x:D-ne.distance.x,y:B-ne.distance.y};T&&(ce=xe?{x:Math.round(ce.x+xe.x),y:Math.round(ce.y+xe.y)}:Eo(ce,N));let Ce=null;if(ee&&O&&!ne.extent&&fe){const{positionAbsolute:be}=ne.internals,Ue=be.x-fe.x+O[0][0],Ve=be.x+ne.measured.width-fe.x2+O[1][0],Fe=be.y-fe.y+O[0][1],nt=be.y+ne.measured.height-fe.y2+O[1][1];Ce=[[Ue,Fe],[Ve,nt]]}const{position:$e,positionAbsolute:ye}=Sx({nodeId:ae,nextPosition:ce,nodeLookup:C,nodeExtent:Ce||O,nodeOrigin:P,onError:G});se=se||ne.position.x!==$e.x||ne.position.y!==$e.y,ne.position=$e,ne.internals.positionAbsolute=ye}if(x=x||se,!!se&&(K(l,!0),g&&(o||Z||!k&&H))){const[ae,ne]=ca({nodeId:k,dragItems:l,nodeLookup:C});o?.(g,l,ae,ne),Z?.(g,ae,ne),k||H?.(g,ne)}}async function L(){if(!m)return;const{transform:D,panBy:B,autoPanSpeed:C,autoPanOnNodeDrag:O}=t();if(!O){c=!1,cancelAnimationFrame(i);return}const[N,T]=Rx(u,m,C);(N!==0||T!==0)&&(s.x=(s.x??0)-N/D[2],s.y=(s.y??0)-T/D[2],await B({x:N,y:T})&&U(s)),i=requestAnimationFrame(L)}function V(D){const{nodeLookup:B,multiSelectionActive:C,nodesDraggable:O,transform:N,snapGrid:T,snapToGrid:P,selectNodesOnDrag:Z,onNodeDragStart:H,onSelectionDragStart:G,unselectNodesAndEdges:K}=t();p=!0,(!Z||!$)&&!C&&k&&(B.get(k)?.selected||K()),$&&Z&&k&&e?.(k);const se=qr(D.sourceEvent,{transform:N,snapGrid:T,snapToGrid:P,containerBounds:m});if(s=se,l=R6(B,O,se,k),l.size>0&&(r||H||!k&&G)){const[ee,fe]=ca({nodeId:k,dragItems:l,nodeLookup:B});r?.(D.sourceEvent,l,ee,fe),H?.(D.sourceEvent,ee,fe),k||G?.(D.sourceEvent,fe)}}const M=sx().clickDistance(A).on("start",D=>{const{domNode:B,nodeDragThreshold:C,transform:O,snapGrid:N,snapToGrid:T}=t();m=B?.getBoundingClientRect()||null,h=!1,x=!1,g=D.sourceEvent,C===0&&V(D),s=qr(D.sourceEvent,{transform:O,snapGrid:N,snapToGrid:T,containerBounds:m}),u=Lt(D.sourceEvent,m)}).on("drag",D=>{const{autoPanOnNodeDrag:B,transform:C,snapGrid:O,snapToGrid:N,nodeDragThreshold:T,nodeLookup:P}=t(),Z=qr(D.sourceEvent,{transform:C,snapGrid:O,snapToGrid:N,containerBounds:m});if(g=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||k&&!P.has(k))&&(h=!0),!h){if(!c&&B&&p&&(c=!0,L()),!p){const H=Lt(D.sourceEvent,m),G=H.x-u.x,K=H.y-u.y;Math.sqrt(G*G+K*K)>T&&V(D)}(s.x!==Z.xSnapped||s.y!==Z.ySnapped)&&l&&p&&(u=Lt(D.sourceEvent,m),U(Z))}}).on("end",D=>{if(!(!p||h)&&(c=!1,p=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:B,updateNodePositions:C,onNodeDragStop:O,onSelectionDragStop:N}=t();if(x&&(C(l,!1),x=!1),n||O||!k&&N){const[T,P]=ca({nodeId:k,dragItems:l,nodeLookup:B,dragging:!1});n?.(D.sourceEvent,l,T,P),O?.(D.sourceEvent,T,P),k||N?.(D.sourceEvent,P)}}}).filter(D=>{const B=D.target;return!D.button&&(!w||!Zd(B,`.${w}`,b))&&(!j||Zd(B,j,b))});f.call(M)}function E(){f?.on(".drag",null)}return{update:y,destroy:E}}function C6(e,t,r){const o=[],n={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of t.values())no(n,jr(s))>0&&o.push(s);return o}const k6=250;function $6(e,t,r,o){let n=[],s=1/0;const i=C6(e,r,t+k6);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const u of c){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:m,y:p}=Bn(l,u,u.position,!0),f=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(p-e.y,2));f>t||(f<s?(n=[{...u,x:m,y:p}],s=f):f===s&&n.push({...u,x:m,y:p}))}}if(!n.length)return null;if(n.length>1){const l=o.type==="source"?"target":"source";return n.find(c=>c.type===l)??n[0]}return n[0]}function Zx(e,t,r,o,n,s=!1){const i=o.get(e);if(!i)return null;const l=n==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(r?l?.find(u=>u.id===r):l?.[0])??null;return c&&s?{...c,...Bn(i,c,c.position,!0)}:c}function Fx(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function I6(e,t){let r=null;return t?r=!0:e&&!t&&(r=!1),r}const Bx=()=>!0;function N6(e,{connectionMode:t,connectionRadius:r,handleId:o,nodeId:n,edgeUpdaterType:s,isTarget:i,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:m,flowId:p,panBy:f,cancelConnection:h,onConnectStart:x,onConnect:g,onConnectEnd:y,isValidConnection:E=Bx,onReconnectEnd:w,updateConnection:j,getTransform:b,getFromHandle:$,autoPanSpeed:k,dragThreshold:A=1,handleDomNode:U}){const L=kx(e.target);let V=0,M;const{x:D,y:B}=Lt(e),C=Fx(s,U),O=l?.getBoundingClientRect();let N=!1;if(!O||!C)return;const T=Zx(n,C,o,c,t);if(!T)return;let P=Lt(e,O),Z=!1,H=null,G=!1,K=null;function se(){if(!m||!O)return;const[$e,ye]=Rx(P,O,k);f({x:$e,y:ye}),V=requestAnimationFrame(se)}const ee={...T,nodeId:n,type:C,position:T.position},fe=c.get(n);let ae={inProgress:!0,isValid:null,from:Bn(fe,ee,oe.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:fe,to:P,toHandle:null,toPosition:$d[ee.position],toNode:null,pointer:P};function ne(){N=!0,j(ae),x?.(e,{nodeId:n,handleId:o,handleType:C})}A===0&&ne();function ce($e){if(!N){const{x:nt,y:At}=Lt($e),kt=nt-D,Jt=At-B;if(!(kt*kt+Jt*Jt>A*A))return;ne()}if(!$()||!ee){Ce($e);return}const ye=b();P=Lt($e,O),M=$6(So(P,ye,!1,[1,1]),r,c,ee),Z||(se(),Z=!0);const be=Vx($e,{handle:M,connectionMode:t,fromNodeId:n,fromHandleId:o,fromType:i?"target":"source",isValidConnection:E,doc:L,lib:u,flowId:p,nodeLookup:c});K=be.handleDomNode,H=be.connection,G=I6(!!M,be.isValid);const Ue=c.get(n),Ve=Ue?Bn(Ue,ee,oe.Left,!0):ae.from,Fe={...ae,from:Ve,isValid:G,to:be.toHandle&&G?Es({x:be.toHandle.x,y:be.toHandle.y},ye):P,toHandle:be.toHandle,toPosition:G&&be.toHandle?be.toHandle.position:$d[ee.position],toNode:be.toHandle?c.get(be.toHandle.nodeId):null,pointer:P};j(Fe),ae=Fe}function Ce($e){if(!("touches"in $e&&$e.touches.length>0)){if(N){(M||K)&&H&&G&&g?.(H);const{inProgress:ye,...be}=ae,Ue={...be,toPosition:ae.toHandle?ae.toPosition:null};y?.($e,Ue),s&&w?.($e,Ue)}h(),cancelAnimationFrame(V),Z=!1,G=!1,H=null,K=null,L.removeEventListener("mousemove",ce),L.removeEventListener("mouseup",Ce),L.removeEventListener("touchmove",ce),L.removeEventListener("touchend",Ce)}}L.addEventListener("mousemove",ce),L.addEventListener("mouseup",Ce),L.addEventListener("touchmove",ce),L.addEventListener("touchend",Ce)}function Vx(e,{handle:t,connectionMode:r,fromNodeId:o,fromHandleId:n,fromType:s,doc:i,lib:l,flowId:c,isValidConnection:u=Bx,nodeLookup:m}){const p=s==="target",f=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:x}=Lt(e),g=i.elementFromPoint(h,x),y=g?.classList.contains(`${l}-flow__handle`)?g:f,E={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const w=Fx(void 0,y),j=y.getAttribute("data-nodeid"),b=y.getAttribute("data-handleid"),$=y.classList.contains("connectable"),k=y.classList.contains("connectableend");if(!j||!w)return E;const A={source:p?j:o,sourceHandle:p?b:n,target:p?o:j,targetHandle:p?n:b};E.connection=A;const L=$&&k&&(r===Zn.Strict?p&&w==="source"||!p&&w==="target":j!==o||b!==n);E.isValid=L&&u(A),E.toHandle=Zx(j,w,b,m,r,!0)}return E}const za={onPointerDown:N6,isValid:Vx};function A6({domNode:e,panZoom:t,getTransform:r,getViewScale:o}){const n=Et(e);function s({translateExtent:l,width:c,height:u,zoomStep:m=1,pannable:p=!0,zoomable:f=!0,inversePan:h=!1}){const x=j=>{if(j.sourceEvent.type!=="wheel"||!t)return;const b=r(),$=j.sourceEvent.ctrlKey&&ro()?10:1,k=-j.sourceEvent.deltaY*(j.sourceEvent.deltaMode===1?.05:j.sourceEvent.deltaMode?1:.002)*m,A=b[2]*Math.pow(2,k*$);t.scaleTo(A)};let g=[0,0];const y=j=>{(j.sourceEvent.type==="mousedown"||j.sourceEvent.type==="touchstart")&&(g=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY])},E=j=>{const b=r();if(j.sourceEvent.type!=="mousemove"&&j.sourceEvent.type!=="touchmove"||!t)return;const $=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY],k=[$[0]-g[0],$[1]-g[1]];g=$;const A=o()*Math.max(b[2],Math.log(b[2]))*(h?-1:1),U={x:b[0]-k[0]*A,y:b[1]-k[1]*A},L=[[0,0],[c,u]];t.setViewportConstrained({x:U.x,y:U.y,zoom:b[2]},L,l)},w=hx().on("start",y).on("zoom",p?E:null).on("zoom.wheel",f?x:null);n.call(w,{})}function i(){n.on("zoom",null)}return{update:s,destroy:i,pointer:Pt}}const ci=e=>({x:e.x,y:e.y,zoom:e.k}),ua=({x:e,y:t,zoom:r})=>ii.translate(e,t).scale(r),cr=(e,t)=>e.target.closest(`.${t}`),Hx=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),P6=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,da=(e,t=0,r=P6,o=()=>{})=>{const n=typeof t=="number"&&t>0;return n||o(),n?e.transition().duration(t).ease(r).on("end",o):e},Gx=e=>{const t=e.ctrlKey&&ro()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function T6({zoomPanValues:e,noWheelClassName:t,d3Selection:r,d3Zoom:o,panOnScrollMode:n,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return m=>{if(cr(m,t))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=r.property("__zoom").k||1;if(m.ctrlKey&&i){const y=Pt(m),E=Gx(m),w=p*Math.pow(2,E);o.scaleTo(r,w,y,m);return}const f=m.deltaMode===1?20:1;let h=n===Pn.Vertical?0:m.deltaX*f,x=n===Pn.Horizontal?0:m.deltaY*f;!ro()&&m.shiftKey&&n!==Pn.Vertical&&(h=m.deltaY*f,x=0),o.translateBy(r,-(h/p)*s,-(x/p)*s,{internal:!0});const g=ci(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(m,g),e.panScrollTimeout=setTimeout(()=>{u?.(m,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(m,g))}}function O6({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:r}){return function(o,n){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,l=cr(o,e);if(o.ctrlKey&&s&&l&&o.preventDefault(),i||l)return null;o.preventDefault(),r.call(this,o,n)}}function L6({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:r}){return o=>{if(o.sourceEvent?.internal)return;const n=ci(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=n,o.sourceEvent?.type==="mousedown"&&t(!0),r&&r?.(o.sourceEvent,n)}}function z6({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:r,onTransformChange:o,onPanZoom:n}){return s=>{e.usedRightMouseButton=!!(r&&Hx(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),n&&!s.sourceEvent?.internal&&n?.(s.sourceEvent,ci(s.transform))}}function M6({zoomPanValues:e,panOnDrag:t,panOnScroll:r,onDraggingChange:o,onPanZoomEnd:n,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Hx(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),n)){const l=ci(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{n?.(i.sourceEvent,l)},r?150:0)}}}function D6({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:r,panOnDrag:o,panOnScroll:n,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:m}){return p=>{const f=e||t,h=r&&p.ctrlKey,x=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(cr(p,`${u}-flow__node`)||cr(p,`${u}-flow__edge`)))return!0;if(!o&&!f&&!n&&!s&&!r||i||m&&!x||cr(p,l)&&x||cr(p,c)&&(!x||n&&x&&!e)||!r&&p.ctrlKey&&x)return!1;if(!r&&p.type==="touchstart"&&p.touches?.length>1)return p.preventDefault(),!1;if(!f&&!n&&!h&&x||!o&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(o)&&!o.includes(p.button)&&p.type==="mousedown")return!1;const g=Array.isArray(o)&&o.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||x)&&g}}function U6({domNode:e,minZoom:t,maxZoom:r,translateExtent:o,viewport:n,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),p=hx().scaleExtent([t,r]).translateExtent(o),f=Et(e).call(p);w({x:n.x,y:n.y,zoom:vr(n.zoom,t,r)},[[0,0],[m.width,m.height]],o);const h=f.on("wheel.zoom"),x=f.on("dblclick.zoom");p.wheelDelta(Gx);function g(M,D){return f?new Promise(B=>{p?.interpolate(D?.interpolate==="linear"?I.interpolate:cs).transform(da(f,D?.duration,D?.ease,()=>B(!0)),M)}):Promise.resolve(!1)}function y({noWheelClassName:M,noPanClassName:D,onPaneContextMenu:B,userSelectionActive:C,panOnScroll:O,panOnDrag:N,panOnScrollMode:T,panOnScrollSpeed:P,preventScrolling:Z,zoomOnPinch:H,zoomOnScroll:G,zoomOnDoubleClick:K,zoomActivationKeyPressed:se,lib:ee,onTransformChange:fe,connectionInProgress:xe,paneClickDistance:ae,selectionOnDrag:ne}){C&&!u.isZoomingOrPanning&&E();const ce=O&&!se&&!C;p.clickDistance(ne?1/0:!Ot(ae)||ae<0?0:ae);const Ce=ce?T6({zoomPanValues:u,noWheelClassName:M,d3Selection:f,d3Zoom:p,panOnScrollMode:T,panOnScrollSpeed:P,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:l}):O6({noWheelClassName:M,preventScrolling:Z,d3ZoomHandler:h});if(f.on("wheel.zoom",Ce,{passive:!1}),!C){const ye=L6({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:i});p.on("start",ye);const be=z6({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!B,onPanZoom:s,onTransformChange:fe});p.on("zoom",be);const Ue=M6({zoomPanValues:u,panOnDrag:N,panOnScroll:O,onPaneContextMenu:B,onPanZoomEnd:l,onDraggingChange:c});p.on("end",Ue)}const $e=D6({zoomActivationKeyPressed:se,panOnDrag:N,zoomOnScroll:G,panOnScroll:O,zoomOnDoubleClick:K,zoomOnPinch:H,userSelectionActive:C,noPanClassName:D,noWheelClassName:M,lib:ee,connectionInProgress:xe});p.filter($e),K?f.on("dblclick.zoom",x):f.on("dblclick.zoom",null)}function E(){p.on("zoom",null)}async function w(M,D,B){const C=ua(M),O=p?.constrain()(C,D,B);return O&&await g(O),new Promise(N=>N(O))}async function j(M,D){const B=ua(M);return await g(B,D),new Promise(C=>C(B))}function b(M){if(f){const D=ua(M),B=f.property("__zoom");(B.k!==M.zoom||B.x!==M.x||B.y!==M.y)&&p?.transform(f,D,null,{sync:!0})}}function $(){const M=f?xx(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function k(M,D){return f?new Promise(B=>{p?.interpolate(D?.interpolate==="linear"?I.interpolate:cs).scaleTo(da(f,D?.duration,D?.ease,()=>B(!0)),M)}):Promise.resolve(!1)}function A(M,D){return f?new Promise(B=>{p?.interpolate(D?.interpolate==="linear"?I.interpolate:cs).scaleBy(da(f,D?.duration,D?.ease,()=>B(!0)),M)}):Promise.resolve(!1)}function U(M){p?.scaleExtent(M)}function L(M){p?.translateExtent(M)}function V(M){const D=!Ot(M)||M<0?0:M;p?.clickDistance(D)}return{update:y,destroy:E,setViewport:j,setViewportConstrained:w,getViewport:$,scaleTo:k,scaleBy:A,setScaleExtent:U,setTranslateExtent:L,syncViewport:b,setClickDistance:V}}var Sr;(function(e){e.Line="line",e.Handle="handle"})(Sr||(Sr={}));function Z6({width:e,prevWidth:t,height:r,prevHeight:o,affectsX:n,affectsY:s}){const i=e-t,l=r-o,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&n&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function Fd(e){const t=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),o=e.includes("left"),n=e.includes("top");return{isHorizontal:t,isVertical:r,affectsX:o,affectsY:n}}function xn(e,t){return Math.max(0,t-e)}function hn(e,t){return Math.max(0,e-t)}function Wo(e,t,r){return Math.max(0,t-e,e-r)}function Bd(e,t){return e?!t:t}function F6(e,t,r,o,n,s,i,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:m,isVertical:p}=t,f=m&&p,{xSnapped:h,ySnapped:x}=r,{minWidth:g,maxWidth:y,minHeight:E,maxHeight:w}=o,{x:j,y:b,width:$,height:k,aspectRatio:A}=e;let U=Math.floor(m?h-e.pointerX:0),L=Math.floor(p?x-e.pointerY:0);const V=$+(c?-U:U),M=k+(u?-L:L),D=-s[0]*$,B=-s[1]*k;let C=Wo(V,g,y),O=Wo(M,E,w);if(i){let P=0,Z=0;c&&U<0?P=xn(j+U+D,i[0][0]):!c&&U>0&&(P=hn(j+V+D,i[1][0])),u&&L<0?Z=xn(b+L+B,i[0][1]):!u&&L>0&&(Z=hn(b+M+B,i[1][1])),C=Math.max(C,P),O=Math.max(O,Z)}if(l){let P=0,Z=0;c&&U>0?P=hn(j+U,l[0][0]):!c&&U<0&&(P=xn(j+V,l[1][0])),u&&L>0?Z=hn(b+L,l[0][1]):!u&&L<0&&(Z=xn(b+M,l[1][1])),C=Math.max(C,P),O=Math.max(O,Z)}if(n){if(m){const P=Wo(V/A,E,w)*A;if(C=Math.max(C,P),i){let Z=0;!c&&!u||c&&!u&&f?Z=hn(b+B+V/A,i[1][1])*A:Z=xn(b+B+(c?U:-U)/A,i[0][1])*A,C=Math.max(C,Z)}if(l){let Z=0;!c&&!u||c&&!u&&f?Z=xn(b+V/A,l[1][1])*A:Z=hn(b+(c?U:-U)/A,l[0][1])*A,C=Math.max(C,Z)}}if(p){const P=Wo(M*A,g,y)/A;if(O=Math.max(O,P),i){let Z=0;!c&&!u||u&&!c&&f?Z=hn(j+M*A+D,i[1][0])/A:Z=xn(j+(u?L:-L)*A+D,i[0][0])/A,O=Math.max(O,Z)}if(l){let Z=0;!c&&!u||u&&!c&&f?Z=xn(j+M*A,l[1][0])/A:Z=hn(j+(u?L:-L)*A,l[0][0])/A,O=Math.max(O,Z)}}}L=L+(L<0?O:-O),U=U+(U<0?C:-C),n&&(f?V>M*A?L=(Bd(c,u)?-U:U)/A:U=(Bd(c,u)?-L:L)*A:m?(L=U/A,u=c):(U=L*A,c=u));const N=c?j+U:j,T=u?b+L:b;return{width:$+(c?-U:U),height:k+(u?-L:L),x:s[0]*U*(c?-1:1)+N,y:s[1]*L*(u?-1:1)+T}}const Kx={width:0,height:0,x:0,y:0},B6={...Kx,pointerX:0,pointerY:0,aspectRatio:1};function V6(e){return[[0,0],[e.measured.width,e.measured.height]]}function H6(e,t,r){const o=t.position.x+e.position.x,n=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,l=r[0]*s,c=r[1]*i;return[[o-l,n-c],[o+s-l,n+i-c]]}function G6({domNode:e,nodeId:t,getStoreItems:r,onChange:o,onEnd:n}){const s=Et(e);let i={controlDirection:Fd("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:m,keepAspectRatio:p,resizeDirection:f,onResizeStart:h,onResize:x,onResizeEnd:g,shouldResize:y}){let E={...Kx},w={...B6};i={boundaries:m,resizeDirection:f,keepAspectRatio:p,controlDirection:Fd(u)};let j,b=null,$=[],k,A,U,L=!1;const V=sx().on("start",M=>{const{nodeLookup:D,transform:B,snapGrid:C,snapToGrid:O,nodeOrigin:N,paneDomNode:T}=r();if(j=D.get(t),!j)return;b=T?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:Z}=qr(M.sourceEvent,{transform:B,snapGrid:C,snapToGrid:O,containerBounds:b});E={width:j.measured.width??0,height:j.measured.height??0,x:j.position.x??0,y:j.position.y??0},w={...E,pointerX:P,pointerY:Z,aspectRatio:E.width/E.height},k=void 0,j.parentId&&(j.extent==="parent"||j.expandParent)&&(k=D.get(j.parentId),A=k&&j.extent==="parent"?V6(k):void 0),$=[],U=void 0;for(const[H,G]of D)if(G.parentId===t&&($.push({id:H,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const K=H6(G,j,G.origin??N);U?U=[[Math.min(K[0][0],U[0][0]),Math.min(K[0][1],U[0][1])],[Math.max(K[1][0],U[1][0]),Math.max(K[1][1],U[1][1])]]:U=K}h?.(M,{...E})}).on("drag",M=>{const{transform:D,snapGrid:B,snapToGrid:C,nodeOrigin:O}=r(),N=qr(M.sourceEvent,{transform:D,snapGrid:B,snapToGrid:C,containerBounds:b}),T=[];if(!j)return;const{x:P,y:Z,width:H,height:G}=E,K={},se=j.origin??O,{width:ee,height:fe,x:xe,y:ae}=F6(w,i.controlDirection,N,i.boundaries,i.keepAspectRatio,se,A,U),ne=ee!==H,ce=fe!==G,Ce=xe!==P&&ne,$e=ae!==Z&&ce;if(!Ce&&!$e&&!ne&&!ce)return;if((Ce||$e||se[0]===1||se[1]===1)&&(K.x=Ce?xe:E.x,K.y=$e?ae:E.y,E.x=K.x,E.y=K.y,$.length>0)){const Ve=xe-P,Fe=ae-Z;for(const nt of $)nt.position={x:nt.position.x-Ve+se[0]*(ee-H),y:nt.position.y-Fe+se[1]*(fe-G)},T.push(nt)}if((ne||ce)&&(K.width=ne&&(!i.resizeDirection||i.resizeDirection==="horizontal")?ee:E.width,K.height=ce&&(!i.resizeDirection||i.resizeDirection==="vertical")?fe:E.height,E.width=K.width,E.height=K.height),k&&j.expandParent){const Ve=se[0]*(K.width??0);K.x&&K.x<Ve&&(E.x=Ve,w.x=w.x-(K.x-Ve));const Fe=se[1]*(K.height??0);K.y&&K.y<Fe&&(E.y=Fe,w.y=w.y-(K.y-Fe))}const ye=Z6({width:E.width,prevWidth:H,height:E.height,prevHeight:G,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),be={...E,direction:ye};y?.(M,be)!==!1&&(L=!0,x?.(M,be),o(K,T))}).on("end",M=>{L&&(g?.(M,{...E}),n?.({...E}),L=!1)});s.call(V)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var Xo={exports:{}},ma={},Jo={exports:{}},pa={};var Vd;function K6(){if(Vd)return pa;Vd=1;var e=v;function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,n=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function l(p,f){var h=f(),x=o({inst:{value:h,getSnapshot:f}}),g=x[0].inst,y=x[1];return s(function(){g.value=h,g.getSnapshot=f,c(g)&&y({inst:g})},[p,h,f]),n(function(){return c(g)&&y({inst:g}),p(function(){c(g)&&y({inst:g})})},[p]),i(h),h}function c(p){var f=p.getSnapshot;p=p.value;try{var h=f();return!r(p,h)}catch{return!0}}function u(p,f){return f()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:l;return pa.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,pa}var fa={};var Hd;function Y6(){return Hd||(Hd=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}function t(h,x){m||n.startTransition===void 0||(m=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=x();if(!p){var y=x();s(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}y=i({inst:{value:g,getSnapshot:x}});var E=y[0].inst,w=y[1];return c(function(){E.value=g,E.getSnapshot=x,r(E)&&w({inst:E})},[h,g,x]),l(function(){return r(E)&&w({inst:E}),h(function(){r(E)&&w({inst:E})})},[h]),u(g),g}function r(h){var x=h.getSnapshot;h=h.value;try{var g=x();return!s(h,g)}catch{return!0}}function o(h,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=v,s=typeof Object.is=="function"?Object.is:e,i=n.useState,l=n.useEffect,c=n.useLayoutEffect,u=n.useDebugValue,m=!1,p=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;fa.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),fa}var Gd;function Yx(){return Gd||(Gd=1,process.env.NODE_ENV==="production"?Jo.exports=K6():Jo.exports=Y6()),Jo.exports}var Kd;function q6(){if(Kd)return ma;Kd=1;var e=v,t=Yx();function r(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}var o=typeof Object.is=="function"?Object.is:r,n=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,l=e.useMemo,c=e.useDebugValue;return ma.useSyncExternalStoreWithSelector=function(u,m,p,f,h){var x=s(null);if(x.current===null){var g={hasValue:!1,value:null};x.current=g}else g=x.current;x=l(function(){function E(k){if(!w){if(w=!0,j=k,k=f(k),h!==void 0&&g.hasValue){var A=g.value;if(h(A,k))return b=A}return b=k}if(A=b,o(j,k))return A;var U=f(k);return h!==void 0&&h(A,U)?(j=k,A):(j=k,b=U)}var w=!1,j,b,$=p===void 0?null:p;return[function(){return E(m())},$===null?void 0:function(){return E($())}]},[m,p,f,h]);var y=n(u,x[0],x[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),c(y),y},ma}var xa={};var Yd;function W6(){return Yd||(Yd=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=v,r=Yx(),o=typeof Object.is=="function"?Object.is:e,n=r.useSyncExternalStore,s=t.useRef,i=t.useEffect,l=t.useMemo,c=t.useDebugValue;xa.useSyncExternalStoreWithSelector=function(u,m,p,f,h){var x=s(null);if(x.current===null){var g={hasValue:!1,value:null};x.current=g}else g=x.current;x=l(function(){function E(k){if(!w){if(w=!0,j=k,k=f(k),h!==void 0&&g.hasValue){var A=g.value;if(h(A,k))return b=A}return b=k}if(A=b,o(j,k))return A;var U=f(k);return h!==void 0&&h(A,U)?(j=k,A):(j=k,b=U)}var w=!1,j,b,$=p===void 0?null:p;return[function(){return E(m())},$===null?void 0:function(){return E($())}]},[m,p,f,h]);var y=n(u,x[0],x[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),xa}var qd;function X6(){return qd||(qd=1,process.env.NODE_ENV==="production"?Xo.exports=q6():Xo.exports=W6()),Xo.exports}var J6=X6();const Q6=Ft.getDefaultExportFromCjs(J6),eC={},Wd=e=>{let t;const r=new Set,o=(m,p)=>{const f=typeof m=="function"?m(t):m;if(!Object.is(f,t)){const h=t;t=p??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(x=>x(t,h))}},n=()=>t,c={setState:o,getState:n,getInitialState:()=>u,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(eC?"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."),r.clear()}},u=t=e(o,n,c);return c},tC=e=>e?Wd(e):Wd,{useDebugValue:nC}=v,{useSyncExternalStoreWithSelector:rC}=Q6,oC=e=>e;function qx(e,t=oC,r){const o=rC(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return nC(o),o}const Xd=(e,t)=>{const r=tC(e),o=(n,s=t)=>qx(r,n,s);return Object.assign(o,r),o},sC=(e,t)=>e?Xd(e,t):Xd;function Ye(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[o,n]of e)if(!Object.is(n,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const o of r)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ui=v.createContext(null),iC=ui.Provider,Wx=pt.error001();function Te(e,t){const r=v.useContext(ui);if(r===null)throw new Error(Wx);return qx(r,e,t)}function He(){const e=v.useContext(ui);if(e===null)throw new Error(Wx);return v.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Jd={display:"none"},aC={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Xx="react-flow__node-desc",Jx="react-flow__edge-desc",lC="react-flow__aria-live",cC=e=>e.ariaLiveMessage,uC=e=>e.ariaLabelConfig;function dC({rfId:e}){const t=Te(cC);return a.jsxRuntimeExports.jsx("div",{id:`${lC}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:aC,children:t})}function mC({rfId:e,disableKeyboardA11y:t}){const r=Te(uC);return a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[a.jsxRuntimeExports.jsx("div",{id:`${Xx}-${e}`,style:Jd,children:t?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),a.jsxRuntimeExports.jsx("div",{id:`${Jx}-${e}`,style:Jd,children:r["edge.a11yDescription.default"]}),!t&&a.jsxRuntimeExports.jsx(dC,{rfId:e})]})}const di=v.forwardRef(({position:e="top-left",children:t,className:r,style:o,...n},s)=>{const i=`${e}`.split("-");return a.jsxRuntimeExports.jsx("div",{className:tt(["react-flow__panel",r,...i]),style:o,ref:s,...n,children:t})});di.displayName="Panel";function pC({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:a.jsxRuntimeExports.jsx(di,{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:a.jsxRuntimeExports.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const fC=e=>{const t=[],r=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&r.push(o);return{selectedNodes:t,selectedEdges:r}},Qo=e=>e.id;function xC(e,t){return Ye(e.selectedNodes.map(Qo),t.selectedNodes.map(Qo))&&Ye(e.selectedEdges.map(Qo),t.selectedEdges.map(Qo))}function hC({onSelectionChange:e}){const t=He(),{selectedNodes:r,selectedEdges:o}=Te(fC,xC);return v.useEffect(()=>{const n={nodes:r,edges:o};e?.(n),t.getState().onSelectionChangeHandlers.forEach(s=>s(n))},[r,o,e]),null}const gC=e=>!!e.onSelectionChangeHandlers;function yC({onSelectionChange:e}){const t=Te(gC);return e||t?a.jsxRuntimeExports.jsx(hC,{onSelectionChange:e}):null}const Qx=[0,0],vC={x:0,y:0,zoom:1},jC=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Qd=[...jC,"rfId"],EC=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}),em={translateExtent:eo,nodeOrigin:Qx,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function SC(e){const{setNodes:t,setEdges:r,setMinZoom:o,setMaxZoom:n,setTranslateExtent:s,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Te(EC,Ye),u=He();v.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{m.current=em,l()}),[]);const m=v.useRef(em);return v.useEffect(()=>{for(const p of Qd){const f=e[p],h=m.current[p];f!==h&&(typeof e[p]>"u"||(p==="nodes"?t(f):p==="edges"?r(f):p==="minZoom"?o(f):p==="maxZoom"?n(f):p==="translateExtent"?s(f):p==="nodeExtent"?i(f):p==="ariaLabelConfig"?u.setState({ariaLabelConfig:s6(f)}):p==="fitView"?u.setState({fitViewQueued:f}):p==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[p]:f})))}m.current=e},Qd.map(p=>e[p])),null}function tm(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bC(e){const[t,r]=v.useState(e==="system"?null:e);return v.useEffect(()=>{if(e!=="system"){r(e);return}const o=tm(),n=()=>r(o?.matches?"dark":"light");return n(),o?.addEventListener("change",n),()=>{o?.removeEventListener("change",n)}},[e]),t!==null?t:tm()?.matches?"dark":"light"}const nm=typeof document<"u"?document:null;function oo(e=null,t={target:nm,actInsideInputWithModifier:!0}){const[r,o]=v.useState(!1),n=v.useRef(!1),s=v.useRef(new Set([])),[i,l]=v.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",`
9
+ `)),i(!0),setTimeout(()=>i(!1),3e3)}catch(c){console.error(c)}})()},[e,t,n]);return a.jsxRuntimeExports.jsx(te.Box$1,{className:d.CSS.BE("error-fallback","container"),y:!0,grow:!0,center:!0,children:a.jsxRuntimeExports.jsxs(te.Box$1,{background:2,rounded:!0,className:d.CSS.BE("error-fallback","content"),bordered:!0,borderColor:5,empty:!0,children:[a.jsxRuntimeExports.jsxs(we.Bar,{location:"top",bordered:!0,size:"6rem",children:[a.jsxRuntimeExports.jsx(we.Bar.Start,{className:d.CSS.BE("error-fallback","nav-start"),children:a.jsxRuntimeExports.jsxs(Gs,{gap:"tiny",children:[a.jsxRuntimeExports.jsx(Dn,{color:9,children:a.jsxRuntimeExports.jsx(R.Err,{})}),a.jsxRuntimeExports.jsx(Dn,{color:9,className:d.CSS.BE("error-fallback","header-text"),children:"Something went wrong"})]})}),a.jsxRuntimeExports.jsx(we.Bar.End,{className:d.CSS.BE("error-fallback","nav-end"),children:a.jsxRuntimeExports.jsx(we.de,{variant:"icon"})})]}),a.jsxRuntimeExports.jsxs(te.Box$1,{className:d.CSS.BE("error-fallback","body"),children:[a.jsxRuntimeExports.jsxs(te.Box$1,{children:[a.jsxRuntimeExports.jsx(J.Text,{level:"h3",status:"error",className:d.CSS.BE("error-fallback","name"),children:e.name}),a.jsxRuntimeExports.jsx(J.Text,{level:"h5",color:10,className:d.CSS.BE("error-fallback","message"),children:e.message})]}),a.jsxRuntimeExports.jsx(Xr.Divider,{x:!0}),a.jsxRuntimeExports.jsx(J.Text,{level:"h5",color:9,children:"Stack trace"}),a.jsxRuntimeExports.jsx(te.Box$1,{rounded:!0,className:d.CSS.BE("error-fallback","stack-container"),background:1,bordered:!0,children:d.pu.isNonZero(t||e.stack)&&a.jsxRuntimeExports.jsx(J.Text,{className:d.CSS.BE("error-fallback","stack"),level:"small",color:9,children:t||e.stack})}),a.jsxRuntimeExports.jsx(Xr.Divider,{x:!0}),a.jsxRuntimeExports.jsxs(te.Box$1,{justify:"between",x:!0,children:[a.jsxRuntimeExports.jsxs(je.Button,{variant:"outlined",size:"small",onClick:l,children:[s?a.jsxRuntimeExports.jsx(R.Check,{}):a.jsxRuntimeExports.jsx(R.Copy,{}),"Copy diagnostics"]}),a.jsxRuntimeExports.jsx(te.Box$1,{x:!0,children:o})]})]})]})})},c4=({resetErrorBoundary:e})=>a.jsxRuntimeExports.jsx(je.Button,{variant:"filled",size:"small",onClick:e,children:"Reload"});class Ks extends v.Component{state={error:null,componentStack:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,r){this.setState({componentStack:r.componentStack??null}),this.props.onError?.(t,r)}resetErrorBoundary=()=>{this.props.onReset?.(),this.setState({error:null,componentStack:null})};render(){const{error:t,componentStack:r}=this.state,{children:o,FallbackComponent:n=xf}=this.props;return t!=null?a.jsxRuntimeExports.jsx(n,{error:t,componentStack:r,resetErrorBoundary:this.resetErrorBoundary}):o}}const u4=Object.freeze(Object.defineProperty({__proto__:null,Boundary:Ks,Fallback:xf},Symbol.toStringTag,{value:"Module"})),ml=({ref:e,location:t,style:r,size:o,className:n,children:s,onDragStart:i,sizeUnits:l="px",showHandle:c=!0,...u})=>{const m=d.Mu.construct(t),p=d.Mu.direction(m),f=d.vu.dimension(p);return a.jsxRuntimeExports.jsxs(te.Box$1,{className:d.CSS(d.CSS.B("resize"),d.CSS.loc(m),n),style:{[f]:`${o}${l}`,...r},ref:e,direction:p,empty:!0,...u,children:[s,c&&a.jsxRuntimeExports.jsx("div",{draggable:!0,className:d.CSS(d.CSS.BE("resize","handle"),d.CSS.bordered(d.Mu.swap(m))),onDragStart:i,onDrag:Ft.preventDefault,onDragEnd:Ft.preventDefault})]})},hf=({onResize:e,count:t,initialSizes:r=[],minSize:o=100,direction:n="x"})=>{const s=v.useRef(null),[i,l]=v.useState({sizeDistribution:d4(r,t),root:null}),c=v.useCallback((p,f,h)=>{if(s.current==null)return;const x=d.Eu.dim(d.Eu.construct(s.current),n);l(g=>sa(g,x,p,o,f,h))},[o,l,n]);v.useEffect(()=>e?.(i.sizeDistribution),[i.sizeDistribution,e]);const u=v.useCallback((p,f)=>{p.preventDefault();const h=n==="x"?"clientX":"clientY",x=y=>c(f,y[h]),g=()=>{l(y=>({...y,root:null})),document.removeEventListener("mousemove",x)};l(y=>({...y,root:p[h]})),document.addEventListener("mousemove",x),document.addEventListener("mouseup",g,{once:!0})},[l,n,sa]);return{setSize:v.useCallback((p,f)=>c(p,void 0,f),[sa]),props:{direction:n,sizeDistribution:i.sizeDistribution,onDragHandle:u,ref:s}}},gf=({ref:e,direction:t="x",children:r,sizeDistribution:o,onDragHandle:n,className:s,...i})=>{const l=d.vu.construct(t),c=v.Children.toArray(r);return o=m4(o),a.jsxRuntimeExports.jsx(te.Box$1,{...i,ref:e,direction:l,className:d.CSS(d.CSS.B("resize-multiple"),s),empty:!0,grow:!0,children:c.map((u,m)=>a.jsxRuntimeExports.jsx(ml,{onDragStart:p=>n(p,m),location:d.vu.location(l),size:o[m]*100,sizeUnits:"%",showHandle:m!==c.length-1,children:u},m))})},d4=(e,t)=>{const r=e.reduce((n,s)=>n+s,0),o=t-e.length;if(o<=0)return e.slice(0,t).map(n=>n/r);if(e.every(n=>n<=1)){const n=1-r;return[...e,...Array(o).fill(n/o)]}return e.map(()=>1/t)},oa=.001,m4=e=>e.every(t=>d.Nu.closeTo(t,1/e.length),oa)?e.map((t,r)=>r%2===0?t+oa:r===e.length-1?t:t-oa):e,sa=(e,t,r,o,n,s)=>{const i=yf(e,t,r,n,s),[l,c]=p4(e.sizeDistribution,r,i,o/t),u=c?n??null:e.root;return{...e,sizeDistribution:l,root:u}},yf=(e,t,r,o,n)=>{let s;if(n!=null)n>1&&(n/=t),s=n-e.sizeDistribution[r];else if(o!=null){if(e.root===null)throw new Error("resize root is null during handle drag");s=(o-e.root)/t}else throw new Error("must provide either a MouseEvent or a targetSize");return s},p4=(e,t,r,o)=>{let n=t;for(;n>0&&e[n]+r<=o;)n--;const s=e[n]+r,i=f4(n,e,o,r),l=e[i]-r;return s<o||l<o?[e,!1]:[e.map((c,u)=>u===n?s:u===i?l:c),!0]},f4=(e,t,r,o)=>(e===t.length-1?h4:x4)(e,t,r,o),x4=(e,t,r,o)=>{let n=e+1;for(;n<t.length-1&&t[n]-o<=r;)n++;return n},h4=(e,t,r,o)=>{let n=e-1;for(;n>0&&t[n]-o<=r;)n--;return n},ia=2,g4=100,vf=({onCollapse:e,onResize:t,location:r="left",minSize:o,maxSize:n,initialSize:s=200,collapseThreshold:i=1/0,className:l,...c})=>{const[u,m]=v.useState(d.vo(s,o,n)),p=v.useRef(null),f=d.Mu.construct(r),h=v.useCallback(j=>{if(p.current===null)return 0;const b=d.Eu.dim(j,d.Mu.direction(f),!0)*(1-2*Number(["bottom","right"].includes(f))),$=p.current+b,k=d.vo($,o,n);return(k-$)/(o??g4)>i?ia:k},[f,o,n,i]),x=v.useRef(null),g=v.useCallback(j=>{const b=h(j);m(b),x.current!=null&&t?.(b,d.Eu.construct(x.current))},[t,h]),y=v.useCallback(()=>m(j=>(p.current=j,j)),[m]),E=v.useCallback(j=>h(j)===ia&&e?.(),[e,h]);v.useEffect(()=>{o==null||n==null||m(j=>{const b=d.vo(j,o,n);return p.current=b,b})},[o,n]);const w=Je.useCursorDrag({onMove:g,onStart:y,onEnd:E});return a.jsxRuntimeExports.jsx(ml,{ref:x,location:f,size:u,onDragStart:w,className:d.clsx(l,d.CSS.expanded(u!==ia)),...c})},y4=Object.freeze(Object.defineProperty({__proto__:null,Base:ml,Multiple:gf,Single:vf,calculateDiffPercentage:yf,useMultiple:hf},Symbol.toStringTag,{value:"Module"})),pl=({aetherKey:e,enabled:t=!0})=>{const{setState:r}=ie.useLifecycle({aetherKey:e,type:fs.Eraser.TYPE,schema:fs.eraserStateZ,initialState:{region:d.Eu.ZERO,enabled:t}}),o=J.useSyncedRef(t);return{erase:v.useCallback(s=>{r({enabled:o.current,region:s})},[r,o])}},v4=({aetherKey:e,children:t})=>{const{erase:r}=pl({aetherKey:e}),o=it.useResize(r);return a.jsxRuntimeExports.jsx("div",{ref:o,className:d.CSS(d.CSS.inheritDims()),children:t})},j4=Object.freeze(Object.defineProperty({__proto__:null,Eraser:v4,use:pl},Symbol.toStringTag,{value:"Module"})),E4=({items:e,initialKey:t})=>{const[r,o]=v.useState(t),n=i=>o(i===r?void 0:i),s=e.find(i=>i.key===r);return{onSelect:n,activeItem:s}},S4=({activeItem:e,children:t,onSelect:r,location:o="left",collapseThreshold:n=.65,className:s,onResize:i,onCollapse:l,eraseEnabled:c,...u})=>{const m=d.Mu.direction(o);c??=e!=null;const p=v.useCallback(()=>{l?l():e!=null&&r?.(e.key)},[r,e?.key,l]),{erase:f}=pl({enabled:c}),h=v.useCallback((w,j)=>{i?.(w,j),f(j)},[i,f]),{content:x,minSize:g,maxSize:y,initialSize:E=0}=e??{};return a.jsxRuntimeExports.jsx(vf,{className:d.CSS(d.CSS.B("nav-drawer"),d.CSS.dir(m),d.CSS.visible(e!=null),s),collapseThreshold:n,onCollapse:p,location:o,onResize:h,minSize:g,maxSize:y,initialSize:E,...u,children:a.jsxRuntimeExports.jsx(Ks,{children:x})})},b4=Object.freeze(Object.defineProperty({__proto__:null,Bar:we.Bar,Drawer:S4,useDrawer:E4},Symbol.toStringTag,{value:"Module"})),Ht=({keys:e,value:t,onChange:r,allowNone:o,multiple:n,...s})=>{const i=yt.useKeysData(e);return a.jsxRuntimeExports.jsx(ue.Frame,{closeDialogOnSelect:!1,...i,allowNone:o,multiple:n,value:t,onChange:r,children:a.jsxRuntimeExports.jsx(te.Box$1,{pack:!0,...s})})},Ze=({itemKey:e,className:t,...r})=>{const{selected:o,onSelect:n}=ue.useItemState(e);return a.jsxRuntimeExports.jsx(Bs.Toggle,{...r,id:e.toString(),onChange:n,value:o,className:d.CSS(t,o&&it.CONTEXT_SELECTED,it.CONTEXT_TARGET)})},Ys=({value:e,...t})=>a.jsxRuntimeExports.jsxs(Ht,{...t,value:e,keys:te.ALIGNMENTS,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:"start",children:a.jsxRuntimeExports.jsx(R.TextAlign.Left,{})}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"center",children:a.jsxRuntimeExports.jsx(R.TextAlign.Center,{})}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"end",children:a.jsxRuntimeExports.jsx(R.TextAlign.Right,{})})]}),R4=Object.freeze(Object.defineProperty({__proto__:null,Alignment:Ys},Symbol.toStringTag,{value:"Module"})),qs=({children:e="",size:t="medium",color:r,icon:o,onClose:n,className:s,onDragStart:i,...l})=>{const c=d.Zu.cssString(r);o==null&&r!=null&&(o=a.jsxRuntimeExports.jsx(R.Circle,{color:c}));const u=n==null?void 0:a.jsxRuntimeExports.jsx(je.Button,{"aria-label":"close",size:t==="tiny"?"small":t,variant:"text",className:d.CSS.BE("tag","close"),sharp:!0,onClick:n,children:a.jsxRuntimeExports.jsx(R.Close,{})});return a.jsxRuntimeExports.jsxs(je.Button,{el:"div",className:d.CSS(s,d.CSS.B("tag"),n!=null&&d.CSS.BM("tag","closeable")),size:t,overflow:"nowrap",align:"center",gap:"small",onDragStart:i,...l,children:[o,u,a.jsxRuntimeExports.jsx(J.Text,{el:"span",overflow:"ellipsis",children:e})]})},jf=({children:e,onClick:t,variant:r="outlined",size:o="medium",className:n,...s})=>a.jsxRuntimeExports.jsx(je.Button,{className:d.CSS(d.CSS.B("tags"),n),el:"div",variant:r,size:o,x:!0,onClick:t,align:"center",gap:"small",rounded:!0,...s,children:e}),w4=Object.freeze(Object.defineProperty({__proto__:null,Tag:qs,Tags:jf},Symbol.toStringTag,{value:"Module"})),_4=({itemKey:e,icon:t,onDragStart:r})=>{const o=bt.useItem(e),{onSelect:n}=ue.useItemState(e);let s=e.toString();return d.pu.isNonZero(o?.alias)?s=o.alias:d.pu.isNonZero(o?.name)&&(s=o.name),a.jsxRuntimeExports.jsx(qs,{onClose:n,onDragStart:()=>r(e),draggable:!0,size:"small",status:o==null?"error":void 0,icon:o?.icon??t,color:o?.color,children:s})},C4=je.renderProp(_4),fl=({items:e},t,r,o)=>{if(t===""||o===!0)return!1;const n=De.filterByType(t,e);return n.length>0&&!n.every(s=>r.includes(s.key))},Ef=({haulType:e="",disabled:t,placeholder:r="Select...",variant:o="outlined",icon:n,hideTags:s=!1,children:i=C4})=>{const l=ue.useSelection(),c=J.useSyncedRef(l),{setSelected:u}=ue.useContext(),{toggle:m,visible:p}=it.useContext(),f=v.useCallback(j=>fl(j,e,d.du.toArray(l),t),[e,l,t]),{startDrag:h,...x}=De.useDragAndDrop({type:e,canDrop:f,onDrop:De.useFilterByTypeCallback(e,({items:j})=>{const b=d.du.toArray(c.current);return u(d.bu.unique([...d.du.toArray(b),...j.map($=>$.key)])),j},[u])}),g=v.useCallback(({dropped:j})=>{const b=l.filter($=>!j.some(k=>k.key===$));u(b)},[u,l]),y=v.useCallback(j=>{h([{key:j,type:e}],g)},[h,g,e]),E=De.useDraggingState(),w=o==="text"&&l.length!==0;return s?a.jsxRuntimeExports.jsxs(rl.Trigger,{variant:o,...x,children:[n,r]}):a.jsxRuntimeExports.jsxs(jf,{full:"x",onClick:()=>{w||m()},...x,className:d.CSS(d.CSS.dropRegion(f(E)),d.CSS.BE("dialog","trigger"),d.CSS.BM("variant",o)),variant:o,preventClick:w,grow:!0,children:[l.length===0&&a.jsxRuntimeExports.jsxs(J.Text,{color:8,weight:400,style:{padding:"0 1rem"},children:[n,r]}),l.map(j=>i({key:j,itemKey:j,onDragStart:y,icon:n})),o!=="text"&&a.jsxRuntimeExports.jsx(Kp.Animated,{className:d.CSS.level("p"),enabled:p,enabledLoc:"bottom",disabledLoc:"left",color:8}),w&&a.jsxRuntimeExports.jsx(je.Button,{variant:o,onClick:m,children:a.jsxRuntimeExports.jsx(R.Add,{color:8})})]})},Sf=e=>e==="preview"?"connected":e,bf=e=>e==="preview"?"preview":void 0,Ws=({resourceName:e,value:t,onChange:r,data:o,getItem:n,subscribe:s,haulType:i,icon:l,disabled:c,onSearch:u,emptyContent:m,status:p,onFetchMore:f,children:h,renderTag:x,actions:g,allowNone:y,replaceOnSingle:E,triggerProps:w,virtual:j=!0,dialogProps:b,variant:$="connected",...k})=>a.jsxRuntimeExports.jsx(it.Frame,{variant:Sf($),...k,children:a.jsxRuntimeExports.jsxs(ue.Frame,{multiple:!0,value:t,onChange:r,data:o,getItem:n,subscribe:s,onFetchMore:f,allowNone:y,replaceOnSingle:E,virtual:j,children:[a.jsxRuntimeExports.jsx(Ef,{haulType:i,icon:l,placeholder:`Select ${ue.pluralizeExports.plural(e)}`,disabled:c,variant:bf($),...w,children:x}),a.jsxRuntimeExports.jsx(ue.Dialog,{onSearch:u,emptyContent:m,status:p,actions:g,resourceName:e,...b,children:h})]})}),Rf=({haulType:e="",placeholder:t,icon:r,disabled:o,iconOnly:n=!1,hideCaret:s=!1,...i})=>{const l=ue.useSelection(),{setSelected:c}=ue.useContext(),[u]=l,m=bt.useItem(u),{name:p,icon:f}=m??{},h=v.useCallback(y=>fl(y,e,l,o),[e,l,o]),x=De.useDrop({type:e,canDrop:h,onDrop:De.useFilterByTypeCallback(e,({items:y})=>(y.length!==0&&c([y[0].key]),y),[c])}),g=De.useDraggingState();return a.jsxRuntimeExports.jsxs(rl.Trigger,{variant:"outlined",gap:"small",className:d.CSS(d.CSS.dropRegion(h(g))),disabled:o,...x,...i,hideCaret:s||n,textColor:p==null?8:void 0,children:[f??r,!n&&(p??t)]})},Wt=({resourceName:e,onChange:t,value:r,allowNone:o,emptyContent:n,haulType:s,data:i,getItem:l,subscribe:c,itemHeight:u,onFetchMore:m,disabled:p,onSearch:f,status:h,icon:x,children:g,variant:y="connected",actions:E,dialogProps:w,triggerProps:j,virtual:b=!0,closeDialogOnSelect:$=!0,...k})=>a.jsxRuntimeExports.jsx(it.Frame,{...k,variant:Sf(y),children:a.jsxRuntimeExports.jsxs(ue.Frame,{value:r,onChange:t,data:i,getItem:l,subscribe:c,allowNone:o,onFetchMore:m,itemHeight:u,virtual:b,closeDialogOnSelect:$,children:[a.jsxRuntimeExports.jsx(Rf,{haulType:s,icon:x,placeholder:`Select a ${e}`,disabled:p,variant:bf(y),...j}),a.jsxRuntimeExports.jsx(ue.Dialog,{onSearch:f,resourceName:e,emptyContent:n,status:h,actions:E,...w,children:g})]})}),Gt=(e,t)=>{const r={};t.forEach(n=>r[n]=void 0);const o=n=>{const{...s}={...n,...r};return a.jsxRuntimeExports.jsx(e,{...s})};return o.displayName=`RemoveProps(${e.displayName})`,o},xl=e=>a.jsxRuntimeExports.jsxs(Ht,{...e,keys:S.SIZES,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:"tiny",children:"S"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"small",children:"M"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"medium",children:"L"})]}),k4=Object.freeze(Object.defineProperty({__proto__:null,SIZES:S.SIZES,SelectSize:xl,isRenderProp:je.isRenderProp,isSize:S.isSize,removeProps:Gt,renderProp:je.renderProp,size:S.size},Symbol.toStringTag,{value:"Module"})),$4=je.renderProp(e=>{const{itemKey:t}=e,r=bt.useItem(t);if(r==null)return null;const{name:o,icon:n}=r;return a.jsxRuntimeExports.jsxs(ue.ListItem,{...e,children:[n,o]})}),Wn=({data:e,filter:t,children:r=$4,virtual:o=!1,...n})=>{const{retrieve:s,...i}=_R.useStaticData({data:e,filter:t}),{search:l}=yt.usePager({retrieve:s});return a.jsxRuntimeExports.jsx(Wt,{...n,...i,onSearch:l,virtual:o,children:r})},Xn=e=>a.jsxRuntimeExports.jsxs(Ht,{...e,keys:he.LEVELS,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:"h2",square:!0,children:"XL"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"h3",square:!0,children:"L"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"h4",square:!0,children:"M"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"h5",square:!0,children:"S"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:"small",square:!0,children:"XS"})]}),I4=[250,400,500,600],wf=e=>a.jsxRuntimeExports.jsxs(Ht,{...e,keys:I4,children:[a.jsxRuntimeExports.jsx(Ze,{itemKey:250,children:"Light"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:400,children:"Normal"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:500,children:"Medium"}),a.jsxRuntimeExports.jsx(Ze,{itemKey:600,children:"Bold"})]}),N4=Object.freeze(Object.defineProperty({__proto__:null,Level:Xn,Weight:wf},Symbol.toStringTag,{value:"Module"})),A4=Object.freeze(Object.defineProperty({__proto__:null,Button:Ze,Buttons:Ht,Dialog:ue.Dialog,Flex:R4,Frame:ue.Frame,ListItem:ue.ListItem,Multiple:Ws,MultipleTrigger:Ef,Single:Wt,SingleTrigger:Rf,Static:Wn,Text:N4,staticCanDrop:fl,useClear:ue.useClear,useContext:ue.useContext,useHover:ue.useHover,useItemState:ue.useItemState,useMultiple:ue.useMultiple,useSelection:ue.useSelection,useSingle:ue.useSingle},Symbol.toStringTag,{value:"Module"})),P4=je.renderProp(e=>a.jsxRuntimeExports.jsx(ue.Text,{...e})),_e=({path:e,children:t=P4,label:r,padHelpText:o=!0,visible:n=!0,hideIfNull:s=!0,optional:i,onChange:l,className:c,defaultValue:u,...m})=>{const p=cn(e,{optional:i??s,onChange:l,defaultValue:u}),f=ln(void 0,`Field(${e})`);if(p==null)return null;if(e==null)throw new Error("No path provided to Form Field");if(r??=d.gu.capitalize(d.Vu.element(e,-1)),n=typeof n=="function"?n(p,f):n,!n)return null;const h=p.status.message,{onChange:x,value:g}=p,y={onChange:x,value:g};return p.variant!=null&&(y.variant=p.variant),a.jsxRuntimeExports.jsx(we.Item,{padHelpText:o,helpText:h,status:p.status.variant,label:r,required:p.required,className:d.CSS(c,d.CSS.BE("field",e.split(".").join("-")),d.CSS.M(p.status.variant)),...m,children:t(y)})},fo=e=>({fieldKey:t,fieldProps:r,inputProps:o})=>{const n=({inputProps:s,path:i,fieldKey:l=t,optional:c,defaultValue:u,...m})=>a.jsxRuntimeExports.jsx(_e,{...r,...m,defaultValue:u,optional:c,path:l?`${i}.${l}`:i,children:p=>a.jsxRuntimeExports.jsx(e,{...p,...o,...s})});return n.displayName=e.displayName,n},_f=fo(we.Numeric),rt=_f({inputProps:{}}),Cf=fo(ue.Text),xo=Cf({inputProps:{}}),kf=fo(we.Switch),Xs=kf({inputProps:{}}),T4=e=>fo(Wn)(e),O4=({children:e,...t})=>a.jsxRuntimeExports.jsx(ff,{value:t,children:e}),L4=e=>e.code==="custom"&&e.params!=null&&"variant"in e.params?e.params.variant:"error";class z4 extends d.tl.Observer{schema;values;initialValues;statuses;touched;cachedRefs;constructor(t,r){super(),this.schema=r,this.values=d.Vu.copy(t),this.statuses=new Map,this.touched=new Set,this.cachedRefs=new Map,this.initialValues=d.Vu.copy(this.values)}setValue(t,r,o){t==""?this.values=d.Vu.copy(r):d.Vu.set(this.values,t,r),this.checkTouched(t,r,o),this.updateCachedRefs(t)}checkTouched(t,r,o={}){const{markTouched:n=!0}=o,s=d.Vu.get(this.initialValues,t,{optional:!0});d.Vu.equal(s,r)?(this.clearTouched(t),this.clearOrphanedTouchedPaths(t)):n&&this.setTouched(t)}clearOrphanedTouchedPaths(t){const r=new Set;this.touched.forEach(o=>{d.Vu.pathsMatch(o,t)&&o!==t&&!d.Vu.has(this.values,o)&&r.add(o)}),r.forEach(o=>{this.touched.delete(o),this.cachedRefs.delete(o)})}setStatus(t,r){this.statuses.set(t,r),this.updateCachedRefs(t)}clearStatus(t=""){this.statuses.delete(t),this.updateCachedRefs(t)}reset(t){if(d.Vu.equal(this.values,t??this.initialValues))return;t!=null&&(this.initialValues=d.Vu.copy(t));const r=d.Vu.copy(this.initialValues);this.statuses.clear(),this.touched.clear();const o=new Set;this.cachedRefs.forEach((n,s)=>{const i=d.Vu.get(this.values,s,{optional:!0}),l=d.Vu.get(r,s,{optional:!0});d.Vu.equal(i,l)||o.add(s)}),o.forEach(n=>this.cachedRefs.delete(n)),this.values=r}setCurrentStateAsInitialValues(){this.initialValues=d.Vu.copy(this.values),this.touched.clear(),this.cachedRefs.clear()}setTouched(t){this.touched.add(t),this.updateCachedRefs(t)}clearTouched(t=""){t===""?this.touched.clear():this.touched.delete(t),this.updateCachedRefs(t),this.notify()}remove(t){d.Vu.remove(this.values,t),this.statuses.delete(t),this.clearTouched(t),this.cachedRefs.delete(t)}validate(t,r){if(this.schema==null)return!0;const o=this.schema.safeParse(this.values);return this.processValidation(t,o,r)}async validateAsync(t,r){if(this.schema==null)return!0;const o=await this.schema.safeParseAsync(this.values);return this.processValidation(t,o,r)}errorsToStatuses(t,r,o){return t.forEach(n=>{const s=[...r,...n.path],i=d.Vu.resolvePath(s.join("."),this.values);if(o.push({key:i,variant:L4(n),message:n.message}),n.code==="invalid_union"&&n.errors!=null&&n.errors.length>0){const l=n.errors.map(u=>u.filter(m=>d.Vu.has(this.values,[...s,...m.path].join("."))));l.sort((u,m)=>u.length-m.length);const c=l.find(u=>u.length>0);if(c==null)return;this.errorsToStatuses(c,s,o)}}),o}processValidation(t=!1,r,o){if(this.schema==null)return!0;const n=new Set;if(this.statuses.forEach((l,c)=>{l.variant!=="success"&&n.add(c)}),n.forEach(l=>this.clearStatus(l)),r.success)return!0;let s=!0;return this.errorsToStatuses(r.error.issues,[],[]).forEach(l=>{const{key:c,message:u,variant:m}=l;if(c==null)return;const p=o==null||d.Vu.pathsMatch(c,o)||d.Vu.pathsMatch(o,c),f=t||this.touched.has(c);!p||!f||(m!=="warning"&&(s=!1),this.setStatus(c,{key:c,variant:m,message:u}))}),s}get hasBeenTouched(){return this.touched.size>0}getStatuses(){return Array.from(this.statuses.values()).filter(t=>t.variant!=="success")}getState(t,r={}){const{optional:o=!1,defaultValue:n=void 0}=r,s=d.Xu.getOrSetDefault(this.cachedRefs,t,{});let i=d.Vu.get(this.values,t,{optional:o||n!=null});if(i==null){if(n==null)return null;i=n,this.setValue(t,i)}if(s.value=i,s.required=!1,this.schema!=null){const l=d.hl.getFieldSchema(this.schema,t,{optional:!0});l!=null&&(s.required=!l.safeParse(void 0).success)}return s.status=d.Xu.getOrSetDefault(this.statuses,t,{key:t,variant:"success",message:""}),s.touched=this.touched.has(t),s}updateCachedRefs(t){this.cachedRefs.forEach((r,o)=>{(d.Vu.pathsMatch(o,t)||d.Vu.pathsMatch(t,o))&&this.cachedRefs.set(o,{})})}}const $f=({values:e,sync:t=!1,schema:r,mode:o="normal",onChange:n,onHasTouched:s})=>{const i=J.useInitializerRef(()=>new z4(e,r)),l=J.useSyncedRef(n),c=ue.useErrorHandler(),u=J.useSyncedRef(s),m=v.useCallback(()=>{i.current.setCurrentStateAsInitialValues(),u.current?.(!1)},[]),p=v.useCallback($=>i.current.onChange($),[]),f=v.useCallback(($,k)=>i.current.getState($,k),[]),h=v.useCallback($=>{i.current.remove($),i.current.notify()},[]),x=v.useCallback($=>{const k=i.current.values,A=i.current.hasBeenTouched;i.current.reset($),k!==i.current.values&&l.current?.({values:i.current.values,path:"",prev:k,valid:!0}),i.current.notify();const L=i.current.hasBeenTouched;L!==A&&u.current?.(L)},[]),g=v.useCallback(async $=>{const k=await i.current.validateAsync(!0,$);return i.current.notify(),k},[]),y=v.useCallback($=>{const k=i.current.validate(!0,$);return i.current.notify(),k},[]),E=v.useCallback(($,k,A)=>{const{notifyOnChange:U=!0,markTouched:L=!0}=A??{},V=d.Vu.get(i.current.values,$,{optional:!0}),M=i.current.hasBeenTouched;i.current.setValue($,k,{markTouched:L});const D=()=>{U&&l.current?.({values:i.current.values,path:$,prev:V,valid:!0}),i.current.notify();const B=i.current.hasBeenTouched;B!==M&&u.current?.(B)};try{i.current.validate()}catch{return c(async()=>{await i.current.validateAsync(),D()},"Failed to validate form")}D()},[]),w=v.useCallback($=>d.Vu.has(i.current.values,$),[]),j=v.useCallback(($,k)=>{const A=i.current.hasBeenTouched;i.current.setStatus($,k),i.current.notify();const U=i.current.hasBeenTouched;U!==A&&u.current?.(U)},[]),b=v.useCallback(()=>{i.current.clearStatus(),i.current.notify()},[]);return v.useEffect(()=>{t&&(i.current.reset(e),i.current.notify())},[t,e]),v.useMemo(()=>({bind:p,set:E,get:f,mode:o,validate:y,validateAsync:g,value:()=>i.current.values,has:w,remove:h,setStatus:j,clearStatuses:b,reset:x,setCurrentStateAsInitialValues:m,getStatuses:()=>i.current.getStatuses()}),[p,E,f,y,g,w,h,j,b,x,o,m])},M4=Object.freeze(Object.defineProperty({__proto__:null,Context:ff,Field:_e,Form:O4,NumericField:rt,SwitchField:Xs,TextField:xo,buildNumericField:_f,buildSelectField:T4,buildSwitchField:kf,buildTextField:Cf,fieldBuilder:fo,fieldListUtils:ul,use:$f,useContext:ln,useField:cn,useFieldList:dl,useFieldListUtils:s4,useFieldState:cl,useFieldValid:o4,useFieldValue:Mn},Symbol.toStringTag,{value:"Module"})),D4={markTouched:!1,notifyOnChange:!1},at=({name:e,schema:t,retrieve:r,mountListeners:o,update:n,initialValues:s})=>({query:i,initialValues:l,autoSave:c=!1,afterSave:u,beforeSave:m,beforeValidate:p,sync:f,onHasTouched:h,mode:x,scope:g})=>{const[y,E]=v.useState(on(`retrieving ${e}`)),w=ie.useUniqueKey(g),j=Ir(),b=dt(w),$=Hs(),k=ue.useAdder(),A=$f({schema:t,values:l??s,onChange:({path:B})=>{c&&B!==""&&D()},sync:f,onHasTouched:h,mode:x}),U=v.useCallback((B,C,O)=>A.set(B,C,{...O,...D4}),[A]),L=v.useCallback(async(B,C={})=>{const{signal:O}=C;try{if(j==null)return E(xr(`retrieve ${e}`));if(E(T=>on(`retrieving ${e}`,T.data)),O?.aborted)return;const N={client:j,query:B,store:b,...A,set:U};if(await r(N),O?.aborted)return;$.cleanup(),$.set(o?.(N)),E(gt(`retrieved ${e}`))}catch(N){if(O?.aborted)return;const T=zn(`retrieve ${e}`,N);k(T.status),E(T)}},[j,e,A,b,U]),V=R.useMemoDeepEqual(i);po(async B=>await L(V,{signal:B}),[L,V]);const M=v.useCallback(async(B={})=>{const{signal:C}=B,O=[];try{if(j==null)return E(xr(`update ${e}`)),!1;const N={client:j,query:i,store:b,rollbacks:O,...A,set:U};return p?.(N)===!1||!await A.validateAsync()?!1:(E(on(`updating ${e}`,void 0)),await m?.(N)===!1?(E(gt(`updated ${e}`,void 0)),!1):C?.aborted===!0?!1:(await n({...N,setStatus:P=>E(Z=>{const H=he.executeSetter(P,Z.status);return{...Z,status:H,variant:H.variant}})}),E(gt(`updated ${e}`,void 0)),u?.(N),!0))}catch(N){try{O.reverse().forEach(P=>P())}catch(P){console.error("Error rolling back changes:",P)}if(C?.aborted===!0)return!1;const T=zn(`update ${e}`,N);return k(T.status),E(T),!1}},[e,i,m,u,p]),D=v.useCallback(B=>void M(B),[M]);return{form:A,save:D,...y}},U4=(e,t,r)=>typeof e=="object"&&"key"in e?[e.key,e,t??{}]:[e,t,r??{}],Z4=()=>!0,F4=d.g.milliseconds(100),B4=({retrieveCached:e,queryRef:t,filterRef:r,sortRef:o,dataRef:n,store:s,useCachedList:i})=>{if(e==null||!i)return;let l=e({query:t.current??{},store:s});if(r.current!=null&&(l=l.filter(r.current)),o.current!=null&&(l=l.sort(o.current)),l.length!==0)return l.forEach(c=>n.current.set(c.key,c)),l.map(c=>c.key)},st=({name:e,mountListeners:t,retrieve:r,retrieveByKey:o,retrieveCached:n,sort:s})=>(i={})=>{const{filter:l=Z4,sort:c,initialQuery:u=null,retrieveDebounce:m=F4,useCachedList:p=!0}=i,f=J.useSyncedRef(l),h=J.useSyncedRef(c??s),x=Ir(),g=v.useRef(new Map),y=J.useInitializerRef(()=>new Map),E=dt(),w=v.useRef(u),[j,b,$]=J.useCombinedStateAndRef(()=>on(`retrieving ${e}`,B4({retrieveCached:n,queryRef:w,filterRef:f,sortRef:h,dataRef:g,store:E,useCachedList:p}))),k=v.useRef(!0),A=Hs(),U=v.useRef(!1),L=v.useCallback(T=>y.current.forEach((P,Z)=>{P===T&&Z()}),[y.current]),V=v.useCallback(T=>{if(h.current==null)return T;const P=T.map(Z=>g.current.get(Z)).filter(Z=>Z!=null);return P.sort(h.current),P.map(Z=>Z.key)},[h]),M=v.useCallback(()=>{x!=null&&(U.current=!0,A.cleanup(),A.set(t?.({client:x,store:E,query:w.current??{},onDelete:T=>{g.current.delete(T),b(P=>P.data==null?P:{...P,data:P.data.filter(Z=>Z!==T)})},onChange:(T,P,Z)=>{const[H,G,K]=U4(T,P,Z),{mode:se="append"}=K,ee=g.current.get(H)??null;if(ee!=null&&!f.current(ee))return;const fe=he.executeSetter(G,ee);fe==null||!f.current(fe)||(g.current.set(H,fe),b(xe=>{if(xe.data==null)return xe;let ae;if(ee==null)h.current!=null?ae=V([...xe.data,H]):ae=se==="prepend"?[H,...xe.data]:[...xe.data,H];else if(h.current!=null){const ne=xe.data.indexOf(H),ce=V(xe.data),Ce=ce.indexOf(H);ne!==Ce?ae=ce:ae=xe.data}else ae=xe.data;return{...xe,data:ae}}),L(H))}})))},[t,A]),D=v.useCallback(async(T,P={})=>{const{signal:Z,mode:H="replace"}=P,G=he.executeSetter(T,w.current??{});w.current=G;try{if(x==null)return b(xr(`retrieve ${e}`));if(b(ee=>on(`retrieving ${e}`,ee.data)),H==="replace")k.current=!0;else if(H==="append"&&!k.current)return b(ee=>gt(`retrieved ${e}`,ee.data??[]));let K=await r({client:x,query:G,store:E});if(Z?.aborted)return;K=K.filter(f.current),h.current!=null&&(K=K.sort(h.current)),K.length===0&&(k.current=!1);const se=K.map(ee=>ee.key);return M(),$.current.data!=null&&d.wu.primitiveArrays($.current.data,se)===d.wu.EQUAL?b(ee=>gt(`retrieved ${e}`,ee.data??[])):(K.forEach(ee=>g.current.set(ee.key,ee)),b(ee=>{if(H==="replace"||ee.data==null)return gt(`retrieved ${e}`,se);const fe=new Set(se);return gt(`retrieved ${e}`,[...ee.data.filter(xe=>!fe.has(xe)),...se])}))}catch(K){if(Z?.aborted)return;b(zn(`retrieve ${e}`,K))}},[x,e,E,f,M]),B=v.useCallback((T,P={})=>{const{signal:Z}=P;(async()=>{try{if(x==null||d.pu.isZero(T))return;const H=await o({client:x,key:T,query:w.current??{},store:E});if(Z?.aborted||H==null)return;if(!f.current(H)){g.current.set(T,null);return}g.current.set(T,H),L(T)}catch(H){if(Z?.aborted)return;g.current.set(T,null),b(zn(`retrieve ${e}`,H))}})()},[o,x,L,M]),C=v.useCallback((T=>{if(U.current||M(),Array.isArray(T))return T.map(Z=>C(Z)).filter(Z=>Z!=null);if(d.pu.isZero(T))return;const P=g.current.get(T);return P===void 0&&B(T),P}),[B,M]),O=v.useCallback((T,P)=>P==null?()=>{}:(y.current.set(T,P),()=>y.current.delete(T)),[]);return{retrieve:Je.useDebouncedCallback((T,P={})=>void D(T,P),new d.g(m).milliseconds,[D]),retrieveAsync:D,subscribe:O,getItem:C,...j,data:j?.data??[]}},V4=({key:e,subscribe:t,getItem:r})=>v.useSyncExternalStore(v.useCallback(o=>t(o,e),[t,e]),v.useCallback(()=>r(e),[r,e]),()=>{}),hl=e=>on(`Retrieving ${e}`,void 0),If=e=>{const[t,r]=v.useState(hl(e.name));return{...t,...gl({...e,onChange:r})}},gl=({retrieve:e,mountListeners:t,name:r,onChange:o,scope:n,beforeRetrieve:s,addStatusOnFailure:i=!0,allowDisconnected:l=!1})=>{const c=Ir(),u=v.useRef(null),m=dt(n),p=Hs(),f=ue.useAdder(),h=v.useCallback(y=>{u.current!=null&&o(E=>{const w=he.executeSetter(y,E.data);return w==null?E:gt(`retrieved ${r}`,w)},u.current)},[o,r]),x=v.useCallback(async(y,E={})=>{const{signal:w}=E,j=he.executeSetter(y,u.current??{});u.current=j;try{if(s!=null){const k=s({query:j});if(k==!1)return;if(k!==!0){o(gt(`retrieved ${r}`,k),j);return}}if(c==null&&!l)return o(xr(`retrieve ${r}`),j);if(o(k=>on(`retrieving ${r}`,k.data),j),w?.aborted)return;const b={client:c,query:j,store:m};p.cleanup(),p.set(t?.({...b,onChange:h}));const $=await e(b);if(w?.aborted)return;o(gt(`retrieved ${r}`,$),j)}catch(b){if(w?.aborted)return;const $=zn(`retrieve ${r}`,b);i&&f($.status),o($,j)}},[c,r,s,i,o]);return{retrieve:v.useCallback((y,E)=>void x(y,E),[x]),retrieveAsync:x}},H4=({query:e,...t})=>{const{retrieveAsync:r,retrieve:o,...n}=If(t),s=R.useMemoDeepEqual(e);return po(async i=>await r(s,{signal:i}),[r,s]),n},G4=({query:e,onChange:t,...r})=>{const o=v.useRef(hl(r.name)),{retrieveAsync:n}=gl({...r,onChange:v.useCallback((i,l)=>{o.current=he.executeSetter(i,o.current),t?.(o.current,l)},[t])}),s=R.useMemoDeepEqual(e);po(async i=>{s!=null&&await n(s,{signal:i})},[n,s])},Nf=({onChange:e,...t})=>{const r=v.useRef(hl(t.name)),o=v.useCallback((n,s)=>{r.current=he.executeSetter(n,r.current),e?.(r.current,s)},[e]);return gl({...t,onChange:o})},Oe=e=>({useRetrieve:(t,r)=>H4({...e,query:t,...r}),useRetrieveStateful:()=>If(e),useRetrieveEffect:t=>G4({...e,...t}),useRetrieveObservable:t=>Nf({...t,...e})}),Af=e=>{const{onChange:t,update:r,name:o,verbs:{present:n,past:s,participle:i},debounce:l=0,scope:c,beforeUpdate:u,afterSuccess:m,afterFailure:p,allowDisconnected:f=!1}=e,h=Ir(),x=dt(c),g=ue.useAdder(),y=Je.useDebouncedCallback(async(w,j={})=>{const{signal:b}=j,$=[],k=()=>{try{$.reverse().forEach(U=>U())}catch(U){console.error(`failed to rollback changes to ${o}`,U)}};if(h==null&&!f)return t(U=>xr(`${n} ${o}`,as(U))),!1;const A=h;try{if(t(V=>on(`${i} ${o}`,V.data,as(V))),u!=null){const V=await u({client:A,data:w,rollbacks:$,store:x});if(b?.aborted===!0)return!1;if(V===!1)return t(gt(`${s} ${o}`,w)),k(),!1;V!==!0&&(w=V)}const L=await r({client:A,data:w,store:x,rollbacks:$,setStatus:V=>t(M=>{const D=he.executeSetter(V,M.status);return{...M,status:D,variant:D.variant}})});return b?.aborted===!0||(t(V=>gt(`${s} ${o}`,w,as(V))),L===!1)?!1:(await m?.({client:A,data:L}),!0)}catch(U){if(k(),b?.aborted===!0)return!1;const L=zn(`${n} ${o}`,U),{status:V}=L;return t(L),g(V),await p?.({client:A,status:V,data:w}),!1}},l,[o,t,u,m,p]);return{update:v.useCallback((w,j)=>void y(w,j),[y]),updateAsync:y}},K4=e=>{const{name:t,verbs:r,...o}=e,n=pf(e),[s,i]=v.useState(gt(`${r.past} ${t}`,void 0,n)),l=Af({...o,verbs:r,name:t,onChange:i});return{...s,...l}},de=e=>({useObservableUpdate:t=>Af({...t,...e}),useUpdate:(t={})=>K4({...t,...e})}),Y4=Object.freeze(Object.defineProperty({__proto__:null,COPY_VERBS:Wp,CREATE_VERBS:Vt,Client:I.Client,DELETE_VERBS:Xe,Provider:mf,RENAME_VERBS:ot,SAVE_VERBS:PR,SET_VERBS:Xp,SNAPSHOT_VERBS:sl,ScopedUnaryStore:I.ScopedUnaryStore,UPDATE_VERBS:ol,createForm:at,createList:st,createRetrieve:Oe,createStore:I.createStore,createUpdate:de,errorResult:zn,loadingResult:on,nullClientResult:xr,parseInitialStatusDetails:pf,partialUpdate:I.partialUpdate,resultStatusDetails:as,scopeStore:I.scopeStore,successResult:gt,useListItem:V4,useObservableRetrieve:Nf,useStore:dt},Symbol.toStringTag,{value:"Module"})),Pf="resource",q4="resources",Tf="children",W4=e=>{const t=dt();v.useEffect(()=>t.resources.onSet(e),[t.resources])},X4=e=>{const t=dt();v.useEffect(()=>{const r=t.resources.onDelete(async o=>e(S.wA.idZ.parse(o)));return()=>r()},[t.resources])},J4=e=>{const t=dt();v.useEffect(()=>t.relationships.onSet(e),[t.relationships])},Q4=e=>{const t=dt();v.useEffect(()=>t.relationships.onDelete(r=>e(S.wA.relationshipZ.parse(r))),[t.relationships,e])},Of=(e,t)=>st({name:t,retrieve:async({client:r,query:{id:o}})=>o==null?[]:await r.ontology.retrieve([o],{children:e==="to",parents:e==="from"}),retrieveByKey:async({client:r,key:o})=>await r.ontology.retrieve(S.wA.idZ.parse(o)),mountListeners:({store:r,onChange:o,onDelete:n,client:s,query:{id:i}})=>[r.relationships.onSet(async l=>{if(S.wA.matchRelationship(l,{type:"parent",[S.wA.oppositeRelationshipDirection(e)]:i})){const c=await s.ontology.retrieve(l[e]);o(c.key,c)}}),r.relationships.onDelete(l=>{const c=S.wA.relationshipZ.parse(l);S.wA.matchRelationship(c,{type:"parent",[S.wA.oppositeRelationshipDirection(e)]:i})&&n(S.wA.idToString(c[e]))}),r.resources.onSet(l=>o(l.key,c=>c==null?null:{...c,...l})),r.resources.onDelete(async l=>n(l))]}),e3=Of("to",Tf),t3=st({name:q4,retrieveCached:({store:e})=>e.resources.list(),retrieve:async({client:e,query:t,store:r})=>{const o=await e.ontology.retrieve(t);return o.forEach(n=>r.resources.set(n.key,n)),o},retrieveByKey:async({client:e,key:t,store:r})=>{const o=await e.ontology.retrieve(S.wA.idZ.parse(t));return r.resources.set(t,o),o},mountListeners:({store:e,onChange:t,onDelete:r})=>[e.resources.onSet(async o=>t(o.key,o)),e.resources.onDelete(async o=>r(o))]}),Js=(e,t)=>{const r=e.relationships.get(o=>S.wA.matchRelationship(o,{type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:t}));return r.length===0?null:r[0].from},Lf=async({client:e,query:{id:t},store:r})=>{const o=Js(r,t);if(o!=null)return o;const n=await e.ontology.retrieveParents(t);r.resources.set(n);const s={from:n[0].id,type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:t};return r.relationships.set(S.wA.relationshipToString(s),s),n[0].id},vt=e=>t=>e.some(r=>S.wA.idsEqual(t.to,r)||S.wA.idsEqual(t.from,r)),n3={present:"move",participle:"moving",past:"moved"},{useUpdate:r3}=de({name:Tf,verbs:n3,update:async({client:e,data:t,store:r,rollbacks:o})=>{const{source:n,destination:s,ids:i}=t;return o.push(r.relationships.delete(l=>i.some(c=>S.wA.matchRelationship(l,{type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,from:n,to:c})))),i.forEach(l=>{const c={from:s,type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:l};o.push(r.relationships.set(S.wA.relationshipToString(c),c))}),await e.ontology.moveChildren(n,s,...i),t}}),jt=(e,t,r)=>I.partialUpdate(e.resources,S.wA.idToString(t),{name:r}),{useRetrieve:o3,useRetrieveObservable:s3}=Oe({name:Pf,retrieve:async({client:e,query:t,store:r})=>{const o=await e.ontology.retrieveChildren(t.id,t);return r.resources.set(o),o}}),{useRetrieve:i3,useRetrieveObservable:a3}=Oe({name:Pf,retrieve:async({client:e,query:{ids:t},store:r})=>{const o=r.resources.get(S.wA.idToString(t));if(o.length===t.length)return o;const n=await e.ontology.retrieve(t);return r.resources.set(n),n}}),l3=Object.freeze(Object.defineProperty({__proto__:null,RELATIONSHIPS_FLUX_STORE_KEY:I.RELATIONSHIPS_FLUX_STORE_KEY,RELATIONSHIP_FLUX_STORE_CONFIG:I.RELATIONSHIP_FLUX_STORE_CONFIG,RESOURCES_FLUX_STORE_KEY:I.RESOURCES_FLUX_STORE_KEY,RESOURCE_FLUX_STORE_CONFIG:I.RESOURCE_FLUX_STORE_CONFIG,createDependentsListHook:Of,filterRelationshipsThatHaveIDs:vt,renameFluxResource:jt,retrieveCachedParentID:Js,retrieveParentID:Lf,useListChildren:e3,useMoveChildren:r3,useRelationshipDeleteSynchronizer:Q4,useRelationshipSetSynchronizer:J4,useResourceDeleteSynchronizer:X4,useResourceList:t3,useResourceSetSynchronizer:W4,useRetrieveChildren:o3,useRetrieveObservableChildren:s3,useRetrieveObservableResource:a3,useRetrieveResource:i3},Symbol.toStringTag,{value:"Module"})),Qs="Policy",c3="Policies",zf=le.z.object({key:le.z.uuid().optional(),name:le.z.string().min(1,"Name is required"),objects:S.wA.idZ.array(),actions:S.SA.actionZ.array()}),ei=async({client:e,query:{key:t},store:r})=>{let o=r.policies.get(t);return o!=null||(o=await e.access.policies.retrieve({key:t}),r.policies.set(t,o)),o},{useRetrieve:u3}=Oe({name:Qs,retrieve:ei,mountListeners:({store:e,query:{key:t},onChange:r})=>[e.policies.onSet(r,t)]}),yl=st({name:c3,retrieveCached:({store:e})=>e.policies.list(),retrieve:async({client:e,query:t})=>await e.access.policies.retrieve(t),retrieveByKey:async({key:e,...t})=>await ei({...t,query:{key:e}}),mountListeners:({store:e,onChange:t,onDelete:r})=>[e.policies.onSet(o=>t(o.key,o)),e.policies.onDelete(r)]}),{useUpdate:d3}=de({name:Qs,verbs:Xe,update:async({client:e,data:t,store:r,rollbacks:o})=>{const n=d.du.toArray(t),s=S.SA.policy.ontologyID(n),i=vt(s);return o.push(r.relationships.delete(i)),o.push(r.resources.delete(n)),o.push(r.policies.delete(n)),await e.access.policies.delete(n),t}}),{useUpdate:m3}=de({name:Qs,verbs:ot,update:async({client:e,data:t,store:r,rollbacks:o})=>{const{key:n,name:s}=t,i=await ei({client:e,query:{key:n},store:r});o.push(I.partialUpdate(r.policies,n,{name:s})),o.push(jt(r,S.SA.policy.ontologyID(n),s));const l=await e.access.policies.create({...i,name:s});return r.policies.set(n,l),t}}),p3=at({name:Qs,schema:zf,initialValues:{key:void 0,name:"",objects:[],actions:[]},retrieve:async({client:e,query:t,store:r,reset:o})=>{if(t.key==null)return;const n=await ei({client:e,query:{key:t.key},store:r});o(n)},update:async({client:e,value:t,store:r,set:o,rollbacks:n})=>{const s=t(),i=await e.access.policies.create(s);n.push(r.policies.set(i.key,i)),o("key",i.key)}}),vl="policy",Mf=je.renderProp(({itemKey:e,...t})=>{const r=bt.useItem(e);if(r==null)return null;const{name:o}=r;return a.jsxRuntimeExports.jsx(ue.ListItem,{itemKey:e,y:!0,gap:"small",...t,children:a.jsxRuntimeExports.jsx(J.Text,{level:"p",weight:400,children:o})})}),f3=({initialQuery:e,filter:t,...r})=>{const{data:o,retrieve:n,getItem:s,subscribe:i,status:l}=yl({initialQuery:e,filter:t}),{fetchMore:c,search:u}=yt.usePager({retrieve:n});return a.jsxRuntimeExports.jsx(Ws,{haulType:vl,onFetchMore:c,onSearch:u,status:l,icon:a.jsxRuntimeExports.jsx(R.Policy,{}),...r,resourceName:"policy",data:o,getItem:s,subscribe:i,itemHeight:56,children:Mf})},x3=({initialQuery:e,filter:t,...r})=>{const{data:o,retrieve:n,getItem:s,subscribe:i,status:l}=yl({initialQuery:e,filter:t}),{fetchMore:c,search:u}=yt.usePager({retrieve:n});return a.jsxRuntimeExports.jsx(Wt,{onFetchMore:c,onSearch:u,status:l,haulType:vl,icon:a.jsxRuntimeExports.jsx(R.Policy,{}),...r,data:o,getItem:s,subscribe:i,resourceName:"policy",itemHeight:56,children:Mf})},h3=Object.freeze(Object.defineProperty({__proto__:null,CreateIcon:AR,HAUL_TYPE:vl,SelectMultiple:f3,SelectSingle:x3,formSchema:zf,useDelete:d3,useForm:p3,useList:yl,useRename:m3,useRetrieve:u3},Symbol.toStringTag,{value:"Module"})),Df="Permissions",g3=async e=>{const t=e.auth?.user;if(t==null){const r=await e.connectivity.check();if(r.error!=null)throw r.error;if(e.auth?.user==null)throw new S.St("Expected user to be available after successfully connecting to cluster");return e.auth.user}return t},Uf=async(e,t)=>{if(t!=null)return t;const r=await g3(e);return S.TA.ontologyID(r.key)},y3=(e,t)=>{if(t!=null)return t;const r=e?.auth?.user;return r==null?null:S.TA.ontologyID(r.key)},ho=({store:e,client:t,query:{subject:r,objects:o,action:n}})=>{if(t==null)return!1;const s=y3(t,r);if(s==null)return!1;const i=I.cachedRetrieveForSubject(e,s);return S.SA.allowRequest({subject:s,objects:o,action:n},i)},{useRetrieve:v3}=Oe({name:Df,retrieve:async({client:e,query:{subject:t,objects:r,action:o},store:n})=>{if(t=await Uf(e,t),t==null)return!1;const s=await I.retrieveForSubject({client:e,subject:t,store:n});return S.SA.allowRequest({subject:t,objects:r,action:o},s)}}),go=e=>v3(e)?.data??!1,j3=e=>go({objects:e,action:"retrieve"}),E3=e=>go({objects:e,action:"update"}),S3=e=>go({objects:e,action:"delete"}),b3=e=>go({objects:e,action:"create"}),R3=({id:e,...t})=>ho({...t,query:{objects:e,action:"retrieve"}}),w3=({id:e,...t})=>ho({...t,query:{objects:e,action:"update"}}),_3=({id:e,...t})=>ho({...t,query:{objects:e,action:"delete"}}),C3=({id:e,...t})=>ho({...t,query:{objects:e,action:"create"}}),{useRetrieve:k3}=Oe({name:Df,retrieve:async({client:e,query:t,store:r})=>{const o=await Uf(e,t.subject);return o==null?[]:await I.retrieveForSubject({client:e,subject:o,store:r})}}),$3=R.createComposite(R.Role,{topRight:R.Add}),Nr="Role",Zf="Roles",ti=async({client:e,query:{key:t},store:r})=>{let o=r.roles.get(t);return o!=null||(o=await e.access.roles.retrieve({key:t}),r.roles.set(t,o)),o},{useRetrieve:I3}=Oe({name:Nr,retrieve:ti,mountListeners:({store:e,query:{key:t},onChange:r})=>[e.roles.onSet(r,t)]}),Ff=st({name:Zf,retrieveCached:({store:e})=>e.roles.list(),retrieve:async({client:e,query:t})=>await e.access.roles.retrieve(t),retrieveByKey:async({key:e,...t})=>await ti({...t,query:{key:e}}),mountListeners:({store:e,onChange:t,onDelete:r})=>[e.roles.onSet(o=>t(o.key,o)),e.roles.onDelete(r)]}),{useUpdate:N3}=de({name:Nr,verbs:Xe,update:async({client:e,data:t,store:r,rollbacks:o})=>{const n=d.du.toArray(t),s=S.SA.role.ontologyID(n),i=vt(s);return o.push(r.relationships.delete(i)),o.push(r.resources.delete(S.wA.idToString(s))),o.push(r.roles.delete(n)),await e.access.roles.delete(n),t}}),{useUpdate:A3}=de({name:Nr,verbs:ot,update:async({client:e,data:t,rollbacks:r,store:o})=>{const{key:n,name:s}=t,l={...await ti({client:e,store:o,query:{key:n}}),name:s};return await e.access.roles.create(l),r.push(I.partialUpdate(o.roles,n,{name:s})),r.push(jt(o,S.SA.role.ontologyID(n),s)),t}}),Bf=le.z.object({key:S.TA.keyZ,role:S.SA.role.keyZ}),vd=async({client:e,store:t,query:{key:r}})=>{const o=S.TA.ontologyID(r),n=t.relationships.get(u=>S.wA.matchRelationship(u,{type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:o,from:{type:"role"}}));if(n.length>0)return n[0].from.key;const s=await e.ontology.retrieveParents(o,{types:["role"]});if(s.length===0)return;const i=s[0],l={from:i.id,type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:o};t.relationships.set(S.wA.relationshipToString(l),l);const c={key:i.id.key,name:i.name,...i.data};return t.roles.set(c.key,c),c.key},P3=at({name:Nr,schema:Bf,initialValues:{key:"",role:""},retrieve:async({client:e,query:{key:t},reset:r,store:o})=>{const n=await vd({client:e,store:o,query:{key:t}});r({key:t,role:n??""})},update:async({client:e,value:t,store:r,rollbacks:o})=>{const{key:n,role:s}=t(),i=S.TA.ontologyID(n),l=await vd({client:e,store:r,query:{key:n}});if(l===s)return;if(l!=null){const u={from:S.SA.role.ontologyID(l),type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:i};o.push(r.relationships.delete(S.wA.relationshipToString(u)))}const c={from:S.SA.role.ontologyID(s),type:S.wA.PARENT_OF_RELATIONSHIP_TYPE,to:i};o.push(r.relationships.set(S.wA.relationshipToString(c),c)),l!=null&&await e.access.roles.unassign({user:n,role:l}),await e.access.roles.assign({user:n,role:s})}}),Vf=S.SA.role.newZ.extend({policies:S.SA.policy.keyZ.array()}),T3=at({name:Nr,schema:Vf,initialValues:{key:void 0,name:"",description:"",policies:[]},retrieve:async({client:e,query:t,store:r})=>{if(t.key==null)return;const o=await ti({client:e,query:{key:t.key},store:r});r.roles.set(t.key,o)},update:async({client:e,value:t,store:r,set:o,rollbacks:n})=>{const s=t();let i={key:d.Bu.create(),...s};const l=S.SA.role.ontologyID(i.key),c=S.wA.idToString(l);n.push(r.resources.set(c,{key:c,id:l,name:i.name,data:i})),n.push(r.roles.set(i.key,i)),s.policies.length>0&&(await e.ontology.addChildren(S.SA.role.ontologyID(i.key),...s.policies.map(m=>S.SA.policy.ontologyID(m))),s.policies.map(m=>({from:S.SA.role.ontologyID(i.key),to:S.SA.policy.ontologyID(m),type:S.wA.PARENT_OF_RELATIONSHIP_TYPE})).forEach(m=>n.push(r.relationships.set(S.wA.relationshipToString(m),m)))),i=await e.access.roles.create(i),o("key",i.key)}}),O3=je.renderProp(({itemKey:e,...t})=>{const r=bt.useItem(e);if(r==null)return null;const{name:o,description:n}=r;return a.jsxRuntimeExports.jsxs(ue.ListItem,{itemKey:e,y:!0,gap:"small",...t,style:{overflow:"hidden",maxWidth:"100%"},children:[a.jsxRuntimeExports.jsx(J.Text,{level:"p",weight:400,children:o}),r?.description!=null&&a.jsxRuntimeExports.jsx(J.Text,{level:"small",color:9,overflow:"wrap",children:n})]})}),L3=({initialQuery:e,filter:t,...r})=>{const{data:o,retrieve:n,getItem:s,subscribe:i,status:l}=Ff({initialQuery:e,filter:t}),{fetchMore:c,search:u}=yt.usePager({retrieve:n});return a.jsxRuntimeExports.jsx(Wt,{...r,data:o,getItem:s,subscribe:i,onFetchMore:c,onSearch:u,status:l,resourceName:"role",virtual:!1,children:O3})},z3=Object.freeze(Object.defineProperty({__proto__:null,CreateIcon:$3,PLURAL_RESOURCE_NAME:Zf,RESOURCE_NAME:Nr,Select:L3,changeRoleFormSchema:Bf,formSchema:Vf,useChangeRoleForm:P3,useDelete:N3,useForm:T3,useList:Ff,useRename:A3,useRetrieve:I3},Symbol.toStringTag,{value:"Module"})),M3=Object.freeze(Object.defineProperty({__proto__:null,Policy:h3,Role:z3,createGranted:C3,deleteGranted:_3,isGranted:ho,updateGranted:w3,useCreateGranted:b3,useDeleteGranted:S3,useGranted:go,useLoadPermissions:k3,useRetrieveGranted:j3,useUpdateGranted:E3,viewGranted:R3},Symbol.toStringTag,{value:"Module"}));function tt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,o;r<e.length;r++)(o=tt(e[r]))!==""&&(t+=(t&&" ")+o);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var D3={value:()=>{}};function ni(){for(var e=0,t=arguments.length,r={},o;e<t;++e){if(!(o=arguments[e]+"")||o in r||/[\s.]/.test(o))throw new Error("illegal type: "+o);r[o]=[]}return new ls(r)}function ls(e){this._=e}function U3(e,t){return e.trim().split(/^|\s+/).map(function(r){var o="",n=r.indexOf(".");if(n>=0&&(o=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:o}})}ls.prototype=ni.prototype={constructor:ls,on:function(e,t){var r=this._,o=U3(e+"",r),n,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((n=(e=o[s]).type)&&(n=Z3(r[n],e.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(n=(e=o[s]).type)r[n]=jd(r[n],e.name,t);else if(t==null)for(n in r)r[n]=jd(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new ls(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var r=new Array(n),o=0,n,s;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,n=s.length;o<n;++o)s[o].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],n=0,s=o.length;n<s;++n)o[n].value.apply(t,r)}};function Z3(e,t){for(var r=0,o=e.length,n;r<o;++r)if((n=e[r]).name===t)return n.value}function jd(e,t,r){for(var o=0,n=e.length;o<n;++o)if(e[o].name===t){e[o]=D3,e=e.slice(0,o).concat(e.slice(o+1));break}return r!=null&&e.push({name:t,value:r}),e}var Ca="http://www.w3.org/1999/xhtml";const Ed={svg:"http://www.w3.org/2000/svg",xhtml:Ca,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ri(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Ed.hasOwnProperty(t)?{space:Ed[t],local:e}:e}function F3(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Ca&&t.documentElement.namespaceURI===Ca?t.createElement(e):t.createElementNS(r,e)}}function B3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hf(e){var t=ri(e);return(t.local?B3:F3)(t)}function V3(){}function jl(e){return e==null?V3:function(){return this.querySelector(e)}}function H3(e){typeof e!="function"&&(e=jl(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=new Array(i),c,u,m=0;m<i;++m)(c=s[m])&&(u=e.call(c,c.__data__,m,s))&&("__data__"in c&&(u.__data__=c.__data__),l[m]=u);return new Rt(o,this._parents)}function G3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function K3(){return[]}function Gf(e){return e==null?K3:function(){return this.querySelectorAll(e)}}function Y3(e){return function(){return G3(e.apply(this,arguments))}}function q3(e){typeof e=="function"?e=Y3(e):e=Gf(e);for(var t=this._groups,r=t.length,o=[],n=[],s=0;s<r;++s)for(var i=t[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&(o.push(e.call(c,c.__data__,u,i)),n.push(c));return new Rt(o,n)}function Kf(e){return function(){return this.matches(e)}}function Yf(e){return function(t){return t.matches(e)}}var W3=Array.prototype.find;function X3(e){return function(){return W3.call(this.children,e)}}function J3(){return this.firstElementChild}function Q3(e){return this.select(e==null?J3:X3(typeof e=="function"?e:Yf(e)))}var ew=Array.prototype.filter;function tw(){return Array.from(this.children)}function nw(e){return function(){return ew.call(this.children,e)}}function rw(e){return this.selectAll(e==null?tw:nw(typeof e=="function"?e:Yf(e)))}function ow(e){typeof e!="function"&&(e=Kf(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Rt(o,this._parents)}function qf(e){return new Array(e.length)}function sw(){return new Rt(this._enter||this._groups.map(qf),this._parents)}function xs(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xs.prototype={constructor:xs,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 iw(e){return function(){return e}}function aw(e,t,r,o,n,s){for(var i=0,l,c=t.length,u=s.length;i<u;++i)(l=t[i])?(l.__data__=s[i],o[i]=l):r[i]=new xs(e,s[i]);for(;i<c;++i)(l=t[i])&&(n[i]=l)}function lw(e,t,r,o,n,s,i){var l,c,u=new Map,m=t.length,p=s.length,f=new Array(m),h;for(l=0;l<m;++l)(c=t[l])&&(f[l]=h=i.call(c,c.__data__,l,t)+"",u.has(h)?n[l]=c:u.set(h,c));for(l=0;l<p;++l)h=i.call(e,s[l],l,s)+"",(c=u.get(h))?(o[l]=c,c.__data__=s[l],u.delete(h)):r[l]=new xs(e,s[l]);for(l=0;l<m;++l)(c=t[l])&&u.get(f[l])===c&&(n[l]=c)}function cw(e){return e.__data__}function uw(e,t){if(!arguments.length)return Array.from(this,cw);var r=t?lw:aw,o=this._parents,n=this._groups;typeof e!="function"&&(e=iw(e));for(var s=n.length,i=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var m=o[u],p=n[u],f=p.length,h=dw(e.call(m,m&&m.__data__,u,o)),x=h.length,g=l[u]=new Array(x),y=i[u]=new Array(x),E=c[u]=new Array(f);r(m,p,g,y,E,h,t);for(var w=0,j=0,b,$;w<x;++w)if(b=g[w]){for(w>=j&&(j=w+1);!($=y[j])&&++j<x;);b._next=$||null}}return i=new Rt(i,o),i._enter=l,i._exit=c,i}function dw(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function mw(){return new Rt(this._exit||this._groups.map(qf),this._parents)}function pw(e,t,r){var o=this.enter(),n=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),r==null?s.remove():r(s),o&&n?o.merge(n).order():n}function fw(e){for(var t=e.selection?e.selection():e,r=this._groups,o=t._groups,n=r.length,s=o.length,i=Math.min(n,s),l=new Array(n),c=0;c<i;++c)for(var u=r[c],m=o[c],p=u.length,f=l[c]=new Array(p),h,x=0;x<p;++x)(h=u[x]||m[x])&&(f[x]=h);for(;c<n;++c)l[c]=r[c];return new Rt(l,this._parents)}function xw(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var o=e[t],n=o.length-1,s=o[n],i;--n>=0;)(i=o[n])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function hw(e){e||(e=gw);function t(p,f){return p&&f?e(p.__data__,f.__data__):!p-!f}for(var r=this._groups,o=r.length,n=new Array(o),s=0;s<o;++s){for(var i=r[s],l=i.length,c=n[s]=new Array(l),u,m=0;m<l;++m)(u=i[m])&&(c[m]=u);c.sort(t)}return new Rt(n,this._parents).order()}function gw(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function yw(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function vw(){return Array.from(this)}function jw(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length;n<s;++n){var i=o[n];if(i)return i}return null}function Ew(){let e=0;for(const t of this)++e;return e}function Sw(){return!this.node()}function bw(e){for(var t=this._groups,r=0,o=t.length;r<o;++r)for(var n=t[r],s=0,i=n.length,l;s<i;++s)(l=n[s])&&e.call(l,l.__data__,s,n);return this}function Rw(e){return function(){this.removeAttribute(e)}}function ww(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _w(e,t){return function(){this.setAttribute(e,t)}}function Cw(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function kw(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function $w(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function Iw(e,t){var r=ri(e);if(arguments.length<2){var o=this.node();return r.local?o.getAttributeNS(r.space,r.local):o.getAttribute(r)}return this.each((t==null?r.local?ww:Rw:typeof t=="function"?r.local?$w:kw:r.local?Cw:_w)(r,t))}function Wf(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Nw(e){return function(){this.style.removeProperty(e)}}function Aw(e,t,r){return function(){this.style.setProperty(e,t,r)}}function Pw(e,t,r){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,r)}}function Tw(e,t,r){return arguments.length>1?this.each((t==null?Nw:typeof t=="function"?Pw:Aw)(e,t,r??"")):hr(this.node(),e)}function hr(e,t){return e.style.getPropertyValue(t)||Wf(e).getComputedStyle(e,null).getPropertyValue(t)}function Ow(e){return function(){delete this[e]}}function Lw(e,t){return function(){this[e]=t}}function zw(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Mw(e,t){return arguments.length>1?this.each((t==null?Ow:typeof t=="function"?zw:Lw)(e,t)):this.node()[e]}function Xf(e){return e.trim().split(/^|\s+/)}function El(e){return e.classList||new Jf(e)}function Jf(e){this._node=e,this._names=Xf(e.getAttribute("class")||"")}Jf.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 Qf(e,t){for(var r=El(e),o=-1,n=t.length;++o<n;)r.add(t[o])}function ex(e,t){for(var r=El(e),o=-1,n=t.length;++o<n;)r.remove(t[o])}function Dw(e){return function(){Qf(this,e)}}function Uw(e){return function(){ex(this,e)}}function Zw(e,t){return function(){(t.apply(this,arguments)?Qf:ex)(this,e)}}function Fw(e,t){var r=Xf(e+"");if(arguments.length<2){for(var o=El(this.node()),n=-1,s=r.length;++n<s;)if(!o.contains(r[n]))return!1;return!0}return this.each((typeof t=="function"?Zw:t?Dw:Uw)(r,t))}function Bw(){this.textContent=""}function Vw(e){return function(){this.textContent=e}}function Hw(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Gw(e){return arguments.length?this.each(e==null?Bw:(typeof e=="function"?Hw:Vw)(e)):this.node().textContent}function Kw(){this.innerHTML=""}function Yw(e){return function(){this.innerHTML=e}}function qw(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ww(e){return arguments.length?this.each(e==null?Kw:(typeof e=="function"?qw:Yw)(e)):this.node().innerHTML}function Xw(){this.nextSibling&&this.parentNode.appendChild(this)}function Jw(){return this.each(Xw)}function Qw(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function e5(){return this.each(Qw)}function t5(e){var t=typeof e=="function"?e:Hf(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function n5(){return null}function r5(e,t){var r=typeof e=="function"?e:Hf(e),o=t==null?n5:typeof t=="function"?t:jl(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),o.apply(this,arguments)||null)})}function o5(){var e=this.parentNode;e&&e.removeChild(this)}function s5(){return this.each(o5)}function i5(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function a5(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function l5(e){return this.select(e?a5:i5)}function c5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function u5(e){return function(t){e.call(this,t,this.__data__)}}function d5(e){return e.trim().split(/^|\s+/).map(function(t){var r="",o=t.indexOf(".");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{type:t,name:r}})}function m5(e){return function(){var t=this.__on;if(t){for(var r=0,o=-1,n=t.length,s;r<n;++r)s=t[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function p5(e,t,r){return function(){var o=this.__on,n,s=u5(t);if(o){for(var i=0,l=o.length;i<l;++i)if((n=o[i]).type===e.type&&n.name===e.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),n.value=t;return}}this.addEventListener(e.type,s,r),n={type:e.type,name:e.name,value:t,listener:s,options:r},o?o.push(n):this.__on=[n]}}function f5(e,t,r){var o=d5(e+""),n,s=o.length,i;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,m;c<u;++c)for(n=0,m=l[c];n<s;++n)if((i=o[n]).type===m.type&&i.name===m.name)return m.value}return}for(l=t?p5:m5,n=0;n<s;++n)this.each(l(o[n],t,r));return this}function tx(e,t,r){var o=Wf(e),n=o.CustomEvent;typeof n=="function"?n=new n(t,r):(n=o.document.createEvent("Event"),r?(n.initEvent(t,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function x5(e,t){return function(){return tx(this,e,t)}}function h5(e,t){return function(){return tx(this,e,t.apply(this,arguments))}}function g5(e,t){return this.each((typeof t=="function"?h5:x5)(e,t))}function*y5(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length,i;n<s;++n)(i=o[n])&&(yield i)}var nx=[null];function Rt(e,t){this._groups=e,this._parents=t}function yo(){return new Rt([[document.documentElement]],nx)}function v5(){return this}Rt.prototype=yo.prototype={constructor:Rt,select:H3,selectAll:q3,selectChild:Q3,selectChildren:rw,filter:ow,data:uw,enter:sw,exit:mw,join:pw,merge:fw,selection:v5,order:xw,sort:hw,call:yw,nodes:vw,node:jw,size:Ew,empty:Sw,each:bw,attr:Iw,style:Tw,property:Mw,classed:Fw,text:Gw,html:Ww,raise:Jw,lower:e5,append:t5,insert:r5,remove:s5,clone:l5,datum:c5,on:f5,dispatch:g5,[Symbol.iterator]:y5};function Et(e){return typeof e=="string"?new Rt([[document.querySelector(e)]],[document.documentElement]):new Rt([[e]],nx)}function j5(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pt(e,t){if(e=j5(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var o=r.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[e.clientX-n.left-t.clientLeft,e.clientY-n.top-t.clientTop]}}return[e.pageX,e.pageY]}const E5={passive:!1},Jr={capture:!0,passive:!1};function aa(e){e.stopImmediatePropagation()}function mr(e){e.preventDefault(),e.stopImmediatePropagation()}function rx(e){var t=e.document.documentElement,r=Et(e).on("dragstart.drag",mr,Jr);"onselectstart"in t?r.on("selectstart.drag",mr,Jr):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ox(e,t){var r=e.document.documentElement,o=Et(e).on("dragstart.drag",null);t&&(o.on("click.drag",mr,Jr),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in r?o.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Go=e=>()=>e;function ka(e,{sourceEvent:t,subject:r,target:o,identifier:n,active:s,x:i,y:l,dx:c,dy:u,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:m}})}ka.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function S5(e){return!e.ctrlKey&&!e.button}function b5(){return this.parentNode}function R5(e,t){return t??{x:e.x,y:e.y}}function w5(){return navigator.maxTouchPoints||"ontouchstart"in this}function sx(){var e=S5,t=b5,r=R5,o=w5,n={},s=ni("start","drag","end"),i=0,l,c,u,m,p=0;function f(b){b.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",E,E5).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(b,$){if(!(m||!e.call(this,b,$))){var k=j(this,t.call(this,b,$),b,$,"mouse");k&&(Et(b.view).on("mousemove.drag",x,Jr).on("mouseup.drag",g,Jr),rx(b.view),aa(b),u=!1,l=b.clientX,c=b.clientY,k("start",b))}}function x(b){if(mr(b),!u){var $=b.clientX-l,k=b.clientY-c;u=$*$+k*k>p}n.mouse("drag",b)}function g(b){Et(b.view).on("mousemove.drag mouseup.drag",null),ox(b.view,u),mr(b),n.mouse("end",b)}function y(b,$){if(e.call(this,b,$)){var k=b.changedTouches,A=t.call(this,b,$),U=k.length,L,V;for(L=0;L<U;++L)(V=j(this,A,b,$,k[L].identifier,k[L]))&&(aa(b),V("start",b,k[L]))}}function E(b){var $=b.changedTouches,k=$.length,A,U;for(A=0;A<k;++A)(U=n[$[A].identifier])&&(mr(b),U("drag",b,$[A]))}function w(b){var $=b.changedTouches,k=$.length,A,U;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),A=0;A<k;++A)(U=n[$[A].identifier])&&(aa(b),U("end",b,$[A]))}function j(b,$,k,A,U,L){var V=s.copy(),M=Pt(L||k,$),D,B,C;if((C=r.call(b,new ka("beforestart",{sourceEvent:k,target:f,identifier:U,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:V}),A))!=null)return D=C.x-M[0]||0,B=C.y-M[1]||0,function O(N,T,P){var Z=M,H;switch(N){case"start":n[U]=O,H=i++;break;case"end":delete n[U],--i;case"drag":M=Pt(P||T,$),H=i;break}V.call(N,b,new ka(N,{sourceEvent:T,subject:C,target:f,identifier:U,active:H,x:M[0]+D,y:M[1]+B,dx:M[0]-Z[0],dy:M[1]-Z[1],dispatch:V}),A)}}return f.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Go(!!b),f):e},f.container=function(b){return arguments.length?(t=typeof b=="function"?b:Go(b),f):t},f.subject=function(b){return arguments.length?(r=typeof b=="function"?b:Go(b),f):r},f.touchable=function(b){return arguments.length?(o=typeof b=="function"?b:Go(!!b),f):o},f.on=function(){var b=s.on.apply(s,arguments);return b===s?f:b},f.clickDistance=function(b){return arguments.length?(p=(b=+b)*b,f):Math.sqrt(p)},f}var Sd=180/Math.PI,$a={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ix(e,t,r,o,n,s){var i,l,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*r+t*o)&&(r-=e*c,o-=t*c),(l=Math.sqrt(r*r+o*o))&&(r/=l,o/=l,c/=l),e*o<t*r&&(e=-e,t=-t,c=-c,i=-i),{translateX:n,translateY:s,rotate:Math.atan2(t,e)*Sd,skewX:Math.atan(c)*Sd,scaleX:i,scaleY:l}}var Ko;function _5(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$a:ix(t.a,t.b,t.c,t.d,t.e,t.f)}function C5(e){return e==null||(Ko||(Ko=document.createElementNS("http://www.w3.org/2000/svg","g")),Ko.setAttribute("transform",e),!(e=Ko.transform.baseVal.consolidate()))?$a:(e=e.matrix,ix(e.a,e.b,e.c,e.d,e.e,e.f))}function ax(e,t,r,o){function n(u){return u.length?u.pop()+" ":""}function s(u,m,p,f,h,x){if(u!==p||m!==f){var g=h.push("translate(",null,t,null,r);x.push({i:g-4,x:I.interpolateNumber(u,p)},{i:g-2,x:I.interpolateNumber(m,f)})}else(p||f)&&h.push("translate("+p+t+f+r)}function i(u,m,p,f){u!==m?(u-m>180?m+=360:m-u>180&&(u+=360),f.push({i:p.push(n(p)+"rotate(",null,o)-2,x:I.interpolateNumber(u,m)})):m&&p.push(n(p)+"rotate("+m+o)}function l(u,m,p,f){u!==m?f.push({i:p.push(n(p)+"skewX(",null,o)-2,x:I.interpolateNumber(u,m)}):m&&p.push(n(p)+"skewX("+m+o)}function c(u,m,p,f,h,x){if(u!==p||m!==f){var g=h.push(n(h)+"scale(",null,",",null,")");x.push({i:g-4,x:I.interpolateNumber(u,p)},{i:g-2,x:I.interpolateNumber(m,f)})}else(p!==1||f!==1)&&h.push(n(h)+"scale("+p+","+f+")")}return function(u,m){var p=[],f=[];return u=e(u),m=e(m),s(u.translateX,u.translateY,m.translateX,m.translateY,p,f),i(u.rotate,m.rotate,p,f),l(u.skewX,m.skewX,p,f),c(u.scaleX,u.scaleY,m.scaleX,m.scaleY,p,f),u=m=null,function(h){for(var x=-1,g=f.length,y;++x<g;)p[(y=f[x]).i]=y.x(h);return p.join("")}}}var k5=ax(_5,"px, ","px)","deg)"),$5=ax(C5,", ",")",")"),I5=1e-12;function bd(e){return((e=Math.exp(e))+1/e)/2}function N5(e){return((e=Math.exp(e))-1/e)/2}function A5(e){return((e=Math.exp(2*e))-1)/(e+1)}const cs=(function e(t,r,o){function n(s,i){var l=s[0],c=s[1],u=s[2],m=i[0],p=i[1],f=i[2],h=m-l,x=p-c,g=h*h+x*x,y,E;if(g<I5)E=Math.log(f/u)/t,y=function(A){return[l+A*h,c+A*x,u*Math.exp(t*A*E)]};else{var w=Math.sqrt(g),j=(f*f-u*u+o*g)/(2*u*r*w),b=(f*f-u*u-o*g)/(2*f*r*w),$=Math.log(Math.sqrt(j*j+1)-j),k=Math.log(Math.sqrt(b*b+1)-b);E=(k-$)/t,y=function(A){var U=A*E,L=bd($),V=u/(r*w)*(L*A5(t*U+$)-N5($));return[l+V*h,c+V*x,u*L/bd(t*U+$)]}}return y.duration=E*1e3*t/Math.SQRT2,y}return n.rho=function(s){var i=Math.max(.001,+s),l=i*i,c=l*l;return e(i,l,c)},n})(Math.SQRT2,2,4);var gr=0,Fr=0,Dr=0,lx=1e3,hs,Br,gs=0,Un=0,oi=0,Qr=typeof performance=="object"&&performance.now?performance:Date,cx=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Sl(){return Un||(cx(P5),Un=Qr.now()+oi)}function P5(){Un=0}function ys(){this._call=this._time=this._next=null}ys.prototype=ux.prototype={constructor:ys,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Sl():+r)+(t==null?0:+t),!this._next&&Br!==this&&(Br?Br._next=this:hs=this,Br=this),this._call=e,this._time=r,Ia()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ia())}};function ux(e,t,r){var o=new ys;return o.restart(e,t,r),o}function T5(){Sl(),++gr;for(var e=hs,t;e;)(t=Un-e._time)>=0&&e._call.call(void 0,t),e=e._next;--gr}function Rd(){Un=(gs=Qr.now())+oi,gr=Fr=0;try{T5()}finally{gr=0,L5(),Un=0}}function O5(){var e=Qr.now(),t=e-gs;t>lx&&(oi-=t,gs=e)}function L5(){for(var e,t=hs,r,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:hs=r);Br=e,Ia(o)}function Ia(e){if(!gr){Fr&&(Fr=clearTimeout(Fr));var t=e-Un;t>24?(e<1/0&&(Fr=setTimeout(Rd,e-Qr.now()-oi)),Dr&&(Dr=clearInterval(Dr))):(Dr||(gs=Qr.now(),Dr=setInterval(O5,lx)),gr=1,cx(Rd))}}function wd(e,t,r){var o=new ys;return t=t==null?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,r),o}var z5=ni("start","end","cancel","interrupt"),M5=[],dx=0,_d=1,Na=2,us=3,Cd=4,Aa=5,ds=6;function si(e,t,r,o,n,s){var i=e.__transition;if(!i)e.__transition={};else if(r in i)return;D5(e,r,{name:t,index:o,group:n,on:z5,tween:M5,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:dx})}function bl(e,t){var r=Kt(e,t);if(r.state>dx)throw new Error("too late; already scheduled");return r}function Xt(e,t){var r=Kt(e,t);if(r.state>us)throw new Error("too late; already running");return r}function Kt(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function D5(e,t,r){var o=e.__transition,n;o[t]=r,r.timer=ux(s,0,r.time);function s(u){r.state=_d,r.timer.restart(i,r.delay,r.time),r.delay<=u&&i(u-r.delay)}function i(u){var m,p,f,h;if(r.state!==_d)return c();for(m in o)if(h=o[m],h.name===r.name){if(h.state===us)return wd(i);h.state===Cd?(h.state=ds,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[m]):+m<t&&(h.state=ds,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[m])}if(wd(function(){r.state===us&&(r.state=Cd,r.timer.restart(l,r.delay,r.time),l(u))}),r.state=Na,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Na){for(r.state=us,n=new Array(f=r.tween.length),m=0,p=-1;m<f;++m)(h=r.tween[m].value.call(e,e.__data__,r.index,r.group))&&(n[++p]=h);n.length=p+1}}function l(u){for(var m=u<r.duration?r.ease.call(null,u/r.duration):(r.timer.restart(c),r.state=Aa,1),p=-1,f=n.length;++p<f;)n[p].call(e,m);r.state===Aa&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=ds,r.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function ms(e,t){var r=e.__transition,o,n,s=!0,i;if(r){t=t==null?null:t+"";for(i in r){if((o=r[i]).name!==t){s=!1;continue}n=o.state>Na&&o.state<Aa,o.state=ds,o.timer.stop(),o.on.call(n?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete r[i]}s&&delete e.__transition}}function U5(e){return this.each(function(){ms(this,e)})}function Z5(e,t){var r,o;return function(){var n=Xt(this,e),s=n.tween;if(s!==r){o=r=s;for(var i=0,l=o.length;i<l;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}n.tween=o}}function F5(e,t,r){var o,n;if(typeof r!="function")throw new Error;return function(){var s=Xt(this,e),i=s.tween;if(i!==o){n=(o=i).slice();for(var l={name:t,value:r},c=0,u=n.length;c<u;++c)if(n[c].name===t){n[c]=l;break}c===u&&n.push(l)}s.tween=n}}function B5(e,t){var r=this._id;if(e+="",arguments.length<2){for(var o=Kt(this.node(),r).tween,n=0,s=o.length,i;n<s;++n)if((i=o[n]).name===e)return i.value;return null}return this.each((t==null?Z5:F5)(r,e,t))}function Rl(e,t,r){var o=e._id;return e.each(function(){var n=Xt(this,o);(n.value||(n.value={}))[t]=r.apply(this,arguments)}),function(n){return Kt(n,o).value[t]}}function mx(e,t){var r;return(typeof t=="number"?I.interpolateNumber:t instanceof I.color?I.interpolateRgb:(r=I.color(t))?(t=r,I.interpolateRgb):I.interpolateString)(e,t)}function V5(e){return function(){this.removeAttribute(e)}}function H5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function G5(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttribute(e);return i===n?null:i===o?s:s=t(o=i,r)}}function K5(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===n?null:i===o?s:s=t(o=i,r)}}function Y5(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function q5(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function W5(e,t){var r=ri(e),o=r==="transform"?$5:mx;return this.attrTween(e,typeof t=="function"?(r.local?q5:Y5)(r,o,Rl(this,"attr."+e,t)):t==null?(r.local?H5:V5)(r):(r.local?K5:G5)(r,o,t))}function X5(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function J5(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function Q5(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&J5(e,s)),r}return n._value=t,n}function e_(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&X5(e,s)),r}return n._value=t,n}function t_(e,t){var r="attr."+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;var o=ri(e);return this.tween(r,(o.local?Q5:e_)(o,t))}function n_(e,t){return function(){bl(this,e).delay=+t.apply(this,arguments)}}function r_(e,t){return t=+t,function(){bl(this,e).delay=t}}function o_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?n_:r_)(t,e)):Kt(this.node(),t).delay}function s_(e,t){return function(){Xt(this,e).duration=+t.apply(this,arguments)}}function i_(e,t){return t=+t,function(){Xt(this,e).duration=t}}function a_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?s_:i_)(t,e)):Kt(this.node(),t).duration}function l_(e,t){if(typeof t!="function")throw new Error;return function(){Xt(this,e).ease=t}}function c_(e){var t=this._id;return arguments.length?this.each(l_(t,e)):Kt(this.node(),t).ease}function u_(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Xt(this,e).ease=r}}function d_(e){if(typeof e!="function")throw new Error;return this.each(u_(this._id,e))}function m_(e){typeof e!="function"&&(e=Kf(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new sn(o,this._parents,this._name,this._id)}function p_(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,o=t.length,n=r.length,s=Math.min(o,n),i=new Array(o),l=0;l<s;++l)for(var c=t[l],u=r[l],m=c.length,p=i[l]=new Array(m),f,h=0;h<m;++h)(f=c[h]||u[h])&&(p[h]=f);for(;l<o;++l)i[l]=t[l];return new sn(i,this._parents,this._name,this._id)}function f_(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function x_(e,t,r){var o,n,s=f_(t)?bl:Xt;return function(){var i=s(this,e),l=i.on;l!==o&&(n=(o=l).copy()).on(t,r),i.on=n}}function h_(e,t){var r=this._id;return arguments.length<2?Kt(this.node(),r).on.on(e):this.each(x_(r,e,t))}function g_(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function y_(){return this.on("end.remove",g_(this._id))}function v_(e){var t=this._name,r=this._id;typeof e!="function"&&(e=jl(e));for(var o=this._groups,n=o.length,s=new Array(n),i=0;i<n;++i)for(var l=o[i],c=l.length,u=s[i]=new Array(c),m,p,f=0;f<c;++f)(m=l[f])&&(p=e.call(m,m.__data__,f,l))&&("__data__"in m&&(p.__data__=m.__data__),u[f]=p,si(u[f],t,r,f,u,Kt(m,r)));return new sn(s,this._parents,t,r)}function j_(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Gf(e));for(var o=this._groups,n=o.length,s=[],i=[],l=0;l<n;++l)for(var c=o[l],u=c.length,m,p=0;p<u;++p)if(m=c[p]){for(var f=e.call(m,m.__data__,p,c),h,x=Kt(m,r),g=0,y=f.length;g<y;++g)(h=f[g])&&si(h,t,r,g,f,x);s.push(f),i.push(m)}return new sn(s,i,t,r)}var E_=yo.prototype.constructor;function S_(){return new E_(this._groups,this._parents)}function b_(e,t){var r,o,n;return function(){var s=hr(this,e),i=(this.style.removeProperty(e),hr(this,e));return s===i?null:s===r&&i===o?n:n=t(r=s,o=i)}}function px(e){return function(){this.style.removeProperty(e)}}function R_(e,t,r){var o,n=r+"",s;return function(){var i=hr(this,e);return i===n?null:i===o?s:s=t(o=i,r)}}function w_(e,t,r){var o,n,s;return function(){var i=hr(this,e),l=r(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),hr(this,e))),i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l))}}function __(e,t){var r,o,n,s="style."+t,i="end."+s,l;return function(){var c=Xt(this,e),u=c.on,m=c.value[s]==null?l||(l=px(t)):void 0;(u!==r||n!==m)&&(o=(r=u).copy()).on(i,n=m),c.on=o}}function C_(e,t,r){var o=(e+="")=="transform"?k5:mx;return t==null?this.styleTween(e,b_(e,o)).on("end.style."+e,px(e)):typeof t=="function"?this.styleTween(e,w_(e,o,Rl(this,"style."+e,t))).each(__(this._id,e)):this.styleTween(e,R_(e,o,t),r).on("end.style."+e,null)}function k_(e,t,r){return function(o){this.style.setProperty(e,t.call(this,o),r)}}function $_(e,t,r){var o,n;function s(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&k_(e,i,r)),o}return s._value=t,s}function I_(e,t,r){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,$_(e,t,r??""))}function N_(e){return function(){this.textContent=e}}function A_(e){return function(){var t=e(this);this.textContent=t??""}}function P_(e){return this.tween("text",typeof e=="function"?A_(Rl(this,"text",e)):N_(e==null?"":e+""))}function T_(e){return function(t){this.textContent=e.call(this,t)}}function O_(e){var t,r;function o(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&T_(n)),t}return o._value=e,o}function L_(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,O_(e))}function z_(){for(var e=this._name,t=this._id,r=fx(),o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)if(c=i[u]){var m=Kt(c,t);si(c,e,r,u,i,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new sn(o,this._parents,e,r)}function M_(){var e,t,r=this,o=r._id,n=r.size();return new Promise(function(s,i){var l={value:i},c={value:function(){--n===0&&s()}};r.each(function(){var u=Xt(this,o),m=u.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),n===0&&s()})}var D_=0;function sn(e,t,r,o){this._groups=e,this._parents=t,this._name=r,this._id=o}function fx(){return++D_}var en=yo.prototype;sn.prototype={constructor:sn,select:v_,selectAll:j_,selectChild:en.selectChild,selectChildren:en.selectChildren,filter:m_,merge:p_,selection:S_,transition:z_,call:en.call,nodes:en.nodes,node:en.node,size:en.size,empty:en.empty,each:en.each,on:h_,attr:W5,attrTween:t_,style:C_,styleTween:I_,text:P_,textTween:L_,remove:y_,tween:B5,delay:o_,duration:a_,ease:c_,easeVarying:d_,end:M_,[Symbol.iterator]:en[Symbol.iterator]};function U_(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Z_={time:null,delay:0,duration:250,ease:U_};function F_(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function B_(e){var t,r;e instanceof sn?(t=e._id,e=e._name):(t=fx(),(r=Z_).time=Sl(),e=e==null?null:e+"");for(var o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&si(c,e,t,u,i,r||F_(c,t));return new sn(o,this._parents,e,t)}yo.prototype.interrupt=U5;yo.prototype.transition=B_;const Yo=e=>()=>e;function V_(e,{sourceEvent:t,target:r,transform:o,dispatch:n}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:n}})}function nn(e,t,r){this.k=e,this.x=t,this.y=r}nn.prototype={constructor:nn,scale:function(e){return e===1?this:new nn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new nn(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 ii=new nn(1,0,0);xx.prototype=nn.prototype;function xx(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ii;return e.__zoom}function la(e){e.stopImmediatePropagation()}function Ur(e){e.preventDefault(),e.stopImmediatePropagation()}function H_(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function G_(){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 kd(){return this.__zoom||ii}function K_(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Y_(){return navigator.maxTouchPoints||"ontouchstart"in this}function q_(e,t,r){var o=e.invertX(t[0][0])-r[0][0],n=e.invertX(t[1][0])-r[1][0],s=e.invertY(t[0][1])-r[0][1],i=e.invertY(t[1][1])-r[1][1];return e.translate(n>o?(o+n)/2:Math.min(0,o)||Math.max(0,n),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function hx(){var e=H_,t=G_,r=q_,o=K_,n=Y_,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=cs,u=ni("start","zoom","end"),m,p,f,h=500,x=150,g=0,y=10;function E(C){C.property("__zoom",kd).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",V).filter(n).on("touchstart.zoom",M).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(C,O,N,T){var P=C.selection?C.selection():C;P.property("__zoom",kd),C!==P?$(C,O,N,T):P.interrupt().each(function(){k(this,arguments).event(T).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},E.scaleBy=function(C,O,N,T){E.scaleTo(C,function(){var P=this.__zoom.k,Z=typeof O=="function"?O.apply(this,arguments):O;return P*Z},N,T)},E.scaleTo=function(C,O,N,T){E.transform(C,function(){var P=t.apply(this,arguments),Z=this.__zoom,H=N==null?b(P):typeof N=="function"?N.apply(this,arguments):N,G=Z.invert(H),K=typeof O=="function"?O.apply(this,arguments):O;return r(j(w(Z,K),H,G),P,i)},N,T)},E.translateBy=function(C,O,N,T){E.transform(C,function(){return r(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,T)},E.translateTo=function(C,O,N,T,P){E.transform(C,function(){var Z=t.apply(this,arguments),H=this.__zoom,G=T==null?b(Z):typeof T=="function"?T.apply(this,arguments):T;return r(ii.translate(G[0],G[1]).scale(H.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof N=="function"?-N.apply(this,arguments):-N),Z,i)},T,P)};function w(C,O){return O=Math.max(s[0],Math.min(s[1],O)),O===C.k?C:new nn(O,C.x,C.y)}function j(C,O,N){var T=O[0]-N[0]*C.k,P=O[1]-N[1]*C.k;return T===C.x&&P===C.y?C:new nn(C.k,T,P)}function b(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function $(C,O,N,T){C.on("start.zoom",function(){k(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(T).end()}).tween("zoom",function(){var P=this,Z=arguments,H=k(P,Z).event(T),G=t.apply(P,Z),K=N==null?b(G):typeof N=="function"?N.apply(P,Z):N,se=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),ee=P.__zoom,fe=typeof O=="function"?O.apply(P,Z):O,xe=c(ee.invert(K).concat(se/ee.k),fe.invert(K).concat(se/fe.k));return function(ae){if(ae===1)ae=fe;else{var ne=xe(ae),ce=se/ne[2];ae=new nn(ce,K[0]-ne[0]*ce,K[1]-ne[1]*ce)}H.zoom(null,ae)}})}function k(C,O,N){return!N&&C.__zooming||new A(C,O)}function A(C,O){this.that=C,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,O),this.taps=0}A.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,O){return this.mouse&&C!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var O=Et(this.that).datum();u.call(C,this.that,new V_(C,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:u}),O)}};function U(C,...O){if(!e.apply(this,arguments))return;var N=k(this,O).event(C),T=this.__zoom,P=Math.max(s[0],Math.min(s[1],T.k*Math.pow(2,o.apply(this,arguments)))),Z=Pt(C);if(N.wheel)(N.mouse[0][0]!==Z[0]||N.mouse[0][1]!==Z[1])&&(N.mouse[1]=T.invert(N.mouse[0]=Z)),clearTimeout(N.wheel);else{if(T.k===P)return;N.mouse=[Z,T.invert(Z)],ms(this),N.start()}Ur(C),N.wheel=setTimeout(H,x),N.zoom("mouse",r(j(w(T,P),N.mouse[0],N.mouse[1]),N.extent,i));function H(){N.wheel=null,N.end()}}function L(C,...O){if(f||!e.apply(this,arguments))return;var N=C.currentTarget,T=k(this,O,!0).event(C),P=Et(C.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",se,!0),Z=Pt(C,N),H=C.clientX,G=C.clientY;rx(C.view),la(C),T.mouse=[Z,this.__zoom.invert(Z)],ms(this),T.start();function K(ee){if(Ur(ee),!T.moved){var fe=ee.clientX-H,xe=ee.clientY-G;T.moved=fe*fe+xe*xe>g}T.event(ee).zoom("mouse",r(j(T.that.__zoom,T.mouse[0]=Pt(ee,N),T.mouse[1]),T.extent,i))}function se(ee){P.on("mousemove.zoom mouseup.zoom",null),ox(ee.view,T.moved),Ur(ee),T.event(ee).end()}}function V(C,...O){if(e.apply(this,arguments)){var N=this.__zoom,T=Pt(C.changedTouches?C.changedTouches[0]:C,this),P=N.invert(T),Z=N.k*(C.shiftKey?.5:2),H=r(j(w(N,Z),T,P),t.apply(this,O),i);Ur(C),l>0?Et(this).transition().duration(l).call($,H,T,C):Et(this).call(E.transform,H,T,C)}}function M(C,...O){if(e.apply(this,arguments)){var N=C.touches,T=N.length,P=k(this,O,C.changedTouches.length===T).event(C),Z,H,G,K;for(la(C),H=0;H<T;++H)G=N[H],K=Pt(G,this),K=[K,this.__zoom.invert(K),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==K[2]&&(P.touch1=K,P.taps=0):(P.touch0=K,Z=!0,P.taps=1+!!m);m&&(m=clearTimeout(m)),Z&&(P.taps<2&&(p=K[0],m=setTimeout(function(){m=null},h)),ms(this),P.start())}}function D(C,...O){if(this.__zooming){var N=k(this,O).event(C),T=C.changedTouches,P=T.length,Z,H,G,K;for(Ur(C),Z=0;Z<P;++Z)H=T[Z],G=Pt(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=G:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=G);if(H=N.that.__zoom,N.touch1){var se=N.touch0[0],ee=N.touch0[1],fe=N.touch1[0],xe=N.touch1[1],ae=(ae=fe[0]-se[0])*ae+(ae=fe[1]-se[1])*ae,ne=(ne=xe[0]-ee[0])*ne+(ne=xe[1]-ee[1])*ne;H=w(H,Math.sqrt(ae/ne)),G=[(se[0]+fe[0])/2,(se[1]+fe[1])/2],K=[(ee[0]+xe[0])/2,(ee[1]+xe[1])/2]}else if(N.touch0)G=N.touch0[0],K=N.touch0[1];else return;N.zoom("touch",r(j(H,G,K),N.extent,i))}}function B(C,...O){if(this.__zooming){var N=k(this,O).event(C),T=C.changedTouches,P=T.length,Z,H;for(la(C),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),Z=0;Z<P;++Z)H=T[Z],N.touch0&&N.touch0[2]===H.identifier?delete N.touch0:N.touch1&&N.touch1[2]===H.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(H=Pt(H,this),Math.hypot(p[0]-H[0],p[1]-H[1])<y)){var G=Et(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return E.wheelDelta=function(C){return arguments.length?(o=typeof C=="function"?C:Yo(+C),E):o},E.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Yo(!!C),E):e},E.touchable=function(C){return arguments.length?(n=typeof C=="function"?C:Yo(!!C),E):n},E.extent=function(C){return arguments.length?(t=typeof C=="function"?C:Yo([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),E):t},E.scaleExtent=function(C){return arguments.length?(s[0]=+C[0],s[1]=+C[1],E):[s[0],s[1]]},E.translateExtent=function(C){return arguments.length?(i[0][0]=+C[0][0],i[1][0]=+C[1][0],i[0][1]=+C[0][1],i[1][1]=+C[1][1],E):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},E.constrain=function(C){return arguments.length?(r=C,E):r},E.duration=function(C){return arguments.length?(l=+C,E):l},E.interpolate=function(C){return arguments.length?(c=C,E):c},E.on=function(){var C=u.on.apply(u,arguments);return C===u?E:C},E.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,E):Math.sqrt(g)},E.tapDistance=function(C){return arguments.length?(y=+C,E):y},E}const pt={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:r,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:o}", 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."},eo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gx=["Enter"," ","Escape"],yx={"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:r})=>`Moved selected node ${e}. New position, x: ${t}, y: ${r}`,"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 Zn;(function(e){e.Strict="strict",e.Loose="loose"})(Zn||(Zn={}));var Pn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pn||(Pn={}));var yr;(function(e){e.Partial="partial",e.Full="full"})(yr||(yr={}));const vx={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var yn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(yn||(yn={}));var to;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(to||(to={}));var oe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(oe||(oe={}));const $d={[oe.Left]:oe.Right,[oe.Right]:oe.Left,[oe.Top]:oe.Bottom,[oe.Bottom]:oe.Top};function jx(e){return e===null?null:e?"valid":"invalid"}const Ex=e=>"id"in e&&"source"in e&&"target"in e,W_=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),wl=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),vo=(e,t=[0,0])=>{const{width:r,height:o}=un(e),n=e.origin??t,s=r*n[0],i=o*n[1];return{x:e.position.x-s,y:e.position.y-i}},X_=(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 r=e.reduce((o,n)=>{const s=typeof n=="string";let i=!t.nodeLookup&&!s?n:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(n):wl(n)?n:t.nodeLookup.get(n.id));const l=i?vs(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ai(o,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return li(r)},jo=(e,t={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(n=>{(t.filter===void 0||t.filter(n))&&(r=ai(r,vs(n)),o=!0)}),o?li(r):{x:0,y:0,width:0,height:0}},_l=(e,t,[r,o,n]=[0,0,1],s=!1,i=!1)=>{const l={...So(t,[r,o,n]),width:t.width/n,height:t.height/n},c=[];for(const u of e.values()){const{measured:m,selectable:p=!0,hidden:f=!1}=u;if(i&&!p||f)continue;const h=m.width??u.width??u.initialWidth??null,x=m.height??u.height??u.initialHeight??null,g=no(l,jr(u)),y=(h??0)*(x??0),E=s&&g>0;(!u.internals.handleBounds||E||g>=y||u.dragging)&&c.push(u)}return c},J_=(e,t)=>{const r=new Set;return e.forEach(o=>{r.add(o.id)}),t.filter(o=>r.has(o.source)||r.has(o.target))};function Q_(e,t){const r=new Map,o=t?.nodes?new Set(t.nodes.map(n=>n.id)):null;return e.forEach(n=>{n.measured.width&&n.measured.height&&(t?.includeHiddenNodes||!n.hidden)&&(!o||o.has(n.id))&&r.set(n.id,n)}),r}async function e6({nodes:e,width:t,height:r,panZoom:o,minZoom:n,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const l=Q_(e,i),c=jo(l),u=Cl(c,t,r,i?.minZoom??n,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(u,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Sx({nodeId:e,nextPosition:t,nodeLookup:r,nodeOrigin:o=[0,0],nodeExtent:n,onError:s}){const i=r.get(e),l=i.parentId?r.get(i.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},m=i.origin??o;let p=i.extent||n;if(i.extent==="parent"&&!i.expandParent)if(!l)s?.("005",pt.error005());else{const h=l.measured.width,x=l.measured.height;h&&x&&(p=[[c,u],[c+h,u+x]])}else l&&Er(i.extent)&&(p=[[i.extent[0][0]+c,i.extent[0][1]+u],[i.extent[1][0]+c,i.extent[1][1]+u]]);const f=Er(p)?Fn(t,p,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pt.error015()),{position:{x:f.x-c+(i.measured.width??0)*m[0],y:f.y-u+(i.measured.height??0)*m[1]},positionAbsolute:f}}async function t6({nodesToRemove:e=[],edgesToRemove:t=[],nodes:r,edges:o,onBeforeDelete:n}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of r){if(f.deletable===!1)continue;const h=s.has(f.id),x=!h&&f.parentId&&i.find(g=>g.id===f.parentId);(h||x)&&i.push(f)}const l=new Set(t.map(f=>f.id)),c=o.filter(f=>f.deletable!==!1),m=J_(i,c);for(const f of c)l.has(f.id)&&!m.find(x=>x.id===f.id)&&m.push(f);if(!n)return{edges:m,nodes:i};const p=await n({nodes:i,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:i}:{edges:[],nodes:[]}:p}const vr=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Fn=(e={x:0,y:0},t,r)=>({x:vr(e.x,t[0][0],t[1][0]-(r?.width??0)),y:vr(e.y,t[0][1],t[1][1]-(r?.height??0))});function bx(e,t,r){const{width:o,height:n}=un(r),{x:s,y:i}=r.internals.positionAbsolute;return Fn(e,[[s,i],[s+o,i+n]],t)}const Id=(e,t,r)=>e<t?vr(Math.abs(e-t),1,t)/t:e>r?-vr(Math.abs(e-r),1,t)/t:0,Rx=(e,t,r=15,o=40)=>{const n=Id(e.x,o,t.width-o)*r,s=Id(e.y,o,t.height-o)*r;return[n,s]},ai=(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)}),Pa=({x:e,y:t,width:r,height:o})=>({x:e,y:t,x2:e+r,y2:t+o}),li=({x:e,y:t,x2:r,y2:o})=>({x:e,y:t,width:r-e,height:o-t}),jr=(e,t=[0,0])=>{const{x:r,y:o}=wl(e)?e.internals.positionAbsolute:vo(e,t);return{x:r,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},vs=(e,t=[0,0])=>{const{x:r,y:o}=wl(e)?e.internals.positionAbsolute:vo(e,t);return{x:r,y:o,x2:r+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},wx=(e,t)=>li(ai(Pa(e),Pa(t))),no=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*o)},Nd=e=>Ot(e.width)&&Ot(e.height)&&Ot(e.x)&&Ot(e.y),Ot=e=>!isNaN(e)&&isFinite(e),js=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Eo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),So=({x:e,y:t},[r,o,n],s=!1,i=[1,1])=>{const l={x:(e-r)/n,y:(t-o)/n};return s?Eo(l,i):l},Es=({x:e,y:t},[r,o,n])=>({x:e*n+r,y:t*n+o});function ar(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(t*r*.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 n6(e,t,r){if(typeof e=="string"||typeof e=="number"){const o=ar(e,r),n=ar(e,t);return{top:o,right:n,bottom:o,left:n,x:n*2,y:o*2}}if(typeof e=="object"){const o=ar(e.top??e.y??0,r),n=ar(e.bottom??e.y??0,r),s=ar(e.left??e.x??0,t),i=ar(e.right??e.x??0,t);return{top:o,right:i,bottom:n,left:s,x:s+i,y:o+n}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function r6(e,t,r,o,n,s){const{x:i,y:l}=Es(e,[t,r,o]),{x:c,y:u}=Es({x:e.x+e.width,y:e.y+e.height},[t,r,o]),m=n-c,p=s-u;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(m),bottom:Math.floor(p)}}const Cl=(e,t,r,o,n,s)=>{const i=n6(s,t,r),l=(t-i.x)/e.width,c=(r-i.y)/e.height,u=Math.min(l,c),m=vr(u,o,n),p=e.x+e.width/2,f=e.y+e.height/2,h=t/2-p*m,x=r/2-f*m,g=r6(e,h,x,m,t,r),y={left:Math.min(g.left-i.left,0),top:Math.min(g.top-i.top,0),right:Math.min(g.right-i.right,0),bottom:Math.min(g.bottom-i.bottom,0)};return{x:h-y.left+y.right,y:x-y.top+y.bottom,zoom:m}},ro=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Er(e){return e!=null&&e!=="parent"}function un(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function _x(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Cx(e,t={width:0,height:0},r,o,n){const s={...e},i=o.get(r);if(i){const l=i.origin||n;s.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function Ad(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function o6(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function s6(e){return{...yx,...e||{}}}function qr(e,{snapGrid:t=[0,0],snapToGrid:r=!1,transform:o,containerBounds:n}){const{x:s,y:i}=Lt(e),l=So({x:s-(n?.left??0),y:i-(n?.top??0)},o),{x:c,y:u}=r?Eo(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const kl=e=>({width:e.offsetWidth,height:e.offsetHeight}),kx=e=>e?.getRootNode?.()||window?.document,i6=["INPUT","SELECT","TEXTAREA"];function $x(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:i6.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ix=e=>"clientX"in e,Lt=(e,t)=>{const r=Ix(e),o=r?e.clientX:e.touches?.[0].clientX,n=r?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:n-(t?.top??0)}},Pd=(e,t,r,o,n)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:n,position:i.getAttribute("data-handlepos"),x:(l.left-r.left)/o,y:(l.top-r.top)/o,...kl(i)}})};function Nx({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:n,sourceControlY:s,targetControlX:i,targetControlY:l}){const c=e*.125+n*.375+i*.375+r*.125,u=t*.125+s*.375+l*.375+o*.125,m=Math.abs(c-e),p=Math.abs(u-t);return[c,u,m,p]}function qo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Td({pos:e,x1:t,y1:r,x2:o,y2:n,c:s}){switch(e){case oe.Left:return[t-qo(t-o,s),r];case oe.Right:return[t+qo(o-t,s),r];case oe.Top:return[t,r-qo(r-n,s)];case oe.Bottom:return[t,r+qo(n-r,s)]}}function Ax({sourceX:e,sourceY:t,sourcePosition:r=oe.Bottom,targetX:o,targetY:n,targetPosition:s=oe.Top,curvature:i=.25}){const[l,c]=Td({pos:r,x1:e,y1:t,x2:o,y2:n,c:i}),[u,m]=Td({pos:s,x1:o,y1:n,x2:e,y2:t,c:i}),[p,f,h,x]=Nx({sourceX:e,sourceY:t,targetX:o,targetY:n,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:m});return[`M${e},${t} C${l},${c} ${u},${m} ${o},${n}`,p,f,h,x]}function Px({sourceX:e,sourceY:t,targetX:r,targetY:o}){const n=Math.abs(r-e)/2,s=r<e?r+n:r-n,i=Math.abs(o-t)/2,l=o<t?o+i:o-i;return[s,l,n,i]}function a6({sourceNode:e,targetNode:t,selected:r=!1,zIndex:o=0,elevateOnSelect:n=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=n&&r?o+1e3:o,l=Math.max(e.parentId||n&&e.selected?e.internals.z:0,t.parentId||n&&t.selected?t.internals.z:0);return i+l}function l6({sourceNode:e,targetNode:t,width:r,height:o,transform:n}){const s=ai(vs(e),vs(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-n[0]/n[2],y:-n[1]/n[2],width:r/n[2],height:o/n[2]};return no(i,li(s))>0}const Tx=({source:e,sourceHandle:t,target:r,targetHandle:o})=>`xy-edge__${e}${t||""}-${r}${o||""}`,c6=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),Ox=(e,t,r={})=>{if(!e.source||!e.target)return js("006",pt.error006()),t;const o=r.getEdgeId||Tx;let n;return Ex(e)?n={...e}:n={...e,id:o(e)},c6(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))},u6=(e,t,r,o={shouldReplaceId:!0})=>{const{id:n,...s}=e;if(!t.source||!t.target)return js("006",pt.error006()),r;if(!r.find(u=>u.id===e.id))return js("007",pt.error007(n)),r;const l=o.getEdgeId||Tx,c={...s,id:o.shouldReplaceId?l(t):n,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return r.filter(u=>u.id!==n).concat(c)};function Lx({sourceX:e,sourceY:t,targetX:r,targetY:o}){const[n,s,i,l]=Px({sourceX:e,sourceY:t,targetX:r,targetY:o});return[`M ${e},${t}L ${r},${o}`,n,s,i,l]}const Od={[oe.Left]:{x:-1,y:0},[oe.Right]:{x:1,y:0},[oe.Top]:{x:0,y:-1},[oe.Bottom]:{x:0,y:1}},d6=({source:e,sourcePosition:t=oe.Bottom,target:r})=>t===oe.Left||t===oe.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},Ld=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function m6({source:e,sourcePosition:t=oe.Bottom,target:r,targetPosition:o=oe.Top,center:n,offset:s,stepPosition:i}){const l=Od[t],c=Od[o],u={x:e.x+l.x*s,y:e.y+l.y*s},m={x:r.x+c.x*s,y:r.y+c.y*s},p=d6({source:u,sourcePosition:t,target:m}),f=p.x!==0?"x":"y",h=p[f];let x=[],g,y;const E={x:0,y:0},w={x:0,y:0},[,,j,b]=Px({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[f]*c[f]===-1){f==="x"?(g=n.x??u.x+(m.x-u.x)*i,y=n.y??(u.y+m.y)/2):(g=n.x??(u.x+m.x)/2,y=n.y??u.y+(m.y-u.y)*i);const k=[{x:g,y:u.y},{x:g,y:m.y}],A=[{x:u.x,y},{x:m.x,y}];l[f]===h?x=f==="x"?k:A:x=f==="x"?A:k}else{const k=[{x:u.x,y:m.y}],A=[{x:m.x,y:u.y}];if(f==="x"?x=l.x===h?A:k:x=l.y===h?k:A,t===o){const D=Math.abs(e[f]-r[f]);if(D<=s){const B=Math.min(s-1,s-D);l[f]===h?E[f]=(u[f]>e[f]?-1:1)*B:w[f]=(m[f]>r[f]?-1:1)*B}}if(t!==o){const D=f==="x"?"y":"x",B=l[f]===c[D],C=u[D]>m[D],O=u[D]<m[D];(l[f]===1&&(!B&&C||B&&O)||l[f]!==1&&(!B&&O||B&&C))&&(x=f==="x"?k:A)}const U={x:u.x+E.x,y:u.y+E.y},L={x:m.x+w.x,y:m.y+w.y},V=Math.max(Math.abs(U.x-x[0].x),Math.abs(L.x-x[0].x)),M=Math.max(Math.abs(U.y-x[0].y),Math.abs(L.y-x[0].y));V>=M?(g=(U.x+L.x)/2,y=x[0].y):(g=x[0].x,y=(U.y+L.y)/2)}return[[e,{x:u.x+E.x,y:u.y+E.y},...x,{x:m.x+w.x,y:m.y+w.y},r],g,y,j,b]}function p6(e,t,r,o){const n=Math.min(Ld(e,t)/2,Ld(t,r)/2,o),{x:s,y:i}=t;if(e.x===s&&s===r.x||e.y===i&&i===r.y)return`L${s} ${i}`;if(e.y===i){const u=e.x<r.x?-1:1,m=e.y<r.y?1:-1;return`L ${s+n*u},${i}Q ${s},${i} ${s},${i+n*m}`}const l=e.x<r.x?1:-1,c=e.y<r.y?-1:1;return`L ${s},${i+n*c}Q ${s},${i} ${s+n*l},${i}`}function Ta({sourceX:e,sourceY:t,sourcePosition:r=oe.Bottom,targetX:o,targetY:n,targetPosition:s=oe.Top,borderRadius:i=5,centerX:l,centerY:c,offset:u=20,stepPosition:m=.5}){const[p,f,h,x,g]=m6({source:{x:e,y:t},sourcePosition:r,target:{x:o,y:n},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:m});return[p.reduce((E,w,j)=>{let b="";return j>0&&j<p.length-1?b=p6(p[j-1],w,p[j+1],i):b=`${j===0?"M":"L"}${w.x} ${w.y}`,E+=b,E},""),f,h,x,g]}function zd(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function f6(e){const{sourceNode:t,targetNode:r}=e;if(!zd(t)||!zd(r))return null;const o=t.internals.handleBounds||Md(t.handles),n=r.internals.handleBounds||Md(r.handles),s=Dd(o?.source??[],e.sourceHandle),i=Dd(e.connectionMode===Zn.Strict?n?.target??[]:(n?.target??[]).concat(n?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pt.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=s?.position||oe.Bottom,c=i?.position||oe.Top,u=Bn(t,s,l),m=Bn(r,i,c);return{sourceX:u.x,sourceY:u.y,targetX:m.x,targetY:m.y,sourcePosition:l,targetPosition:c}}function Md(e){if(!e)return null;const t=[],r=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&r.push(o);return{source:t,target:r}}function Bn(e,t,r=oe.Left,o=!1){const n=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??un(e);if(o)return{x:n+i/2,y:s+l/2};switch(t?.position??r){case oe.Top:return{x:n+i/2,y:s};case oe.Right:return{x:n+i,y:s+l/2};case oe.Bottom:return{x:n+i/2,y:s+l};case oe.Left:return{x:n,y:s+l/2}}}function Dd(e,t){return e&&(t?e.find(r=>r.id===t):e[0])||null}function Oa(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function x6(e,{id:t,defaultColor:r,defaultMarkerStart:o,defaultMarkerEnd:n}){const s=new Set;return e.reduce((i,l)=>([l.markerStart||o,l.markerEnd||n].forEach(c=>{if(c&&typeof c=="object"){const u=Oa(c,t);s.has(u)||(i.push({id:u,color:c.color||r,...c}),s.add(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const zx=1e3,h6=10,$l={nodeOrigin:[0,0],nodeExtent:eo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},g6={...$l,checkEquality:!0};function Il(e,t){const r={...e};for(const o in t)t[o]!==void 0&&(r[o]=t[o]);return r}function y6(e,t,r){const o=Il($l,r);for(const n of e.values())if(n.parentId)Al(n,e,t,o);else{const s=vo(n,o.nodeOrigin),i=Er(n.extent)?n.extent:o.nodeExtent,l=Fn(s,i,un(n));n.internals.positionAbsolute=l}}function v6(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const r=[],o=[];for(const n of e.handles){const s={id:n.id,width:n.width??1,height:n.height??1,nodeId:e.id,x:n.x,y:n.y,position:n.position,type:n.type};n.type==="source"?r.push(s):n.type==="target"&&o.push(s)}return{source:r,target:o}}function Nl(e){return e==="manual"}function La(e,t,r,o={}){const n=Il(g6,o),s={i:0},i=new Map(t),l=n?.elevateNodesOnSelect&&!Nl(n.zIndexMode)?zx:0;let c=e.length>0;t.clear(),r.clear();for(const u of e){let m=i.get(u.id);if(n.checkEquality&&u===m?.internals.userNode)t.set(u.id,m);else{const p=vo(u,n.nodeOrigin),f=Er(u.extent)?u.extent:n.nodeExtent,h=Fn(p,f,un(u));m={...n.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:v6(u,m),z:Mx(u,l,n.zIndexMode),userNode:u}},t.set(u.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),u.parentId&&Al(m,t,r,o,s)}return c}function j6(e,t){if(!e.parentId)return;const r=t.get(e.parentId);r?r.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Al(e,t,r,o,n){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Il($l,o),u=e.parentId,m=t.get(u);if(!m){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}j6(e,r),n&&!m.parentId&&m.internals.rootParentIndex===void 0&&c==="auto"&&(m.internals.rootParentIndex=++n.i,m.internals.z=m.internals.z+n.i*h6),n&&m.internals.rootParentIndex!==void 0&&(n.i=m.internals.rootParentIndex);const p=s&&!Nl(c)?zx:0,{x:f,y:h,z:x}=E6(e,m,i,l,p,c),{positionAbsolute:g}=e.internals,y=f!==g.x||h!==g.y;(y||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:g,z:x}})}function Mx(e,t,r){const o=Ot(e.zIndex)?e.zIndex:0;return Nl(r)?o:o+(e.selected?t:0)}function E6(e,t,r,o,n,s){const{x:i,y:l}=t.internals.positionAbsolute,c=un(e),u=vo(e,r),m=Er(e.extent)?Fn(u,e.extent,c):u;let p=Fn({x:i+m.x,y:l+m.y},o,c);e.extent==="parent"&&(p=bx(p,c,t));const f=Mx(e,n,s),h=t.internals.z??0;return{x:p.x,y:p.y,z:h>=f?h+1:f}}function Pl(e,t,r,o=[0,0]){const n=[],s=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=s.get(i.parentId)?.expandedRect??jr(l),u=wx(c,i.rect);s.set(i.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:i,parent:l},c)=>{const u=l.internals.positionAbsolute,m=un(l),p=l.origin??o,f=i.x<u.x?Math.round(Math.abs(u.x-i.x)):0,h=i.y<u.y?Math.round(Math.abs(u.y-i.y)):0,x=Math.max(m.width,Math.round(i.width)),g=Math.max(m.height,Math.round(i.height)),y=(x-m.width)*p[0],E=(g-m.height)*p[1];(f>0||h>0||y||E)&&(n.push({id:c,type:"position",position:{x:l.position.x-f+y,y:l.position.y-h+E}}),r.get(c)?.forEach(w=>{e.some(j=>j.id===w.id)||n.push({id:w.id,type:"position",position:{x:w.position.x+f,y:w.position.y+h}})})),(m.width<i.width||m.height<i.height||f||h)&&n.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:x+(f?p[0]*f-y:0),height:g+(h?p[1]*h-E:0)}})}),n}function S6(e,t,r,o,n,s,i){const l=o?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],m=window.getComputedStyle(l),{m22:p}=new window.DOMMatrixReadOnly(m.transform),f=[];for(const h of e.values()){const x=t.get(h.id);if(!x)continue;if(x.hidden){t.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),c=!0;continue}const g=kl(h.nodeElement),y=x.measured.width!==g.width||x.measured.height!==g.height;if(!!(g.width&&g.height&&(y||!x.internals.handleBounds||h.force))){const w=h.nodeElement.getBoundingClientRect(),j=Er(x.extent)?x.extent:s;let{positionAbsolute:b}=x.internals;x.parentId&&x.extent==="parent"?b=bx(b,g,t.get(x.parentId)):j&&(b=Fn(b,j,g));const $={...x,measured:g,internals:{...x.internals,positionAbsolute:b,handleBounds:{source:Pd("source",h.nodeElement,w,p,x.id),target:Pd("target",h.nodeElement,w,p,x.id)}}};t.set(x.id,$),x.parentId&&Al($,t,r,{nodeOrigin:n,zIndexMode:i}),c=!0,y&&(u.push({id:x.id,type:"dimensions",dimensions:g}),x.expandParent&&x.parentId&&f.push({id:x.id,parentId:x.parentId,rect:jr($,n)}))}}if(f.length>0){const h=Pl(f,t,r,n);u.push(...h)}return{changes:u,updatedInternals:c}}async function b6({delta:e,panZoom:t,transform:r,translateExtent:o,width:n,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[n,s]],o),l=!!i&&(i.x!==r[0]||i.y!==r[1]||i.k!==r[2]);return Promise.resolve(l)}function Ud(e,t,r,o,n,s){let i=n;const l=o.get(i)||new Map;o.set(i,l.set(r,t)),i=`${n}-${e}`;const c=o.get(i)||new Map;if(o.set(i,c.set(r,t)),s){i=`${n}-${e}-${s}`;const u=o.get(i)||new Map;o.set(i,u.set(r,t))}}function Dx(e,t,r){e.clear(),t.clear();for(const o of r){const{source:n,target:s,sourceHandle:i=null,targetHandle:l=null}=o,c={edgeId:o.id,source:n,target:s,sourceHandle:i,targetHandle:l},u=`${n}-${i}--${s}-${l}`,m=`${s}-${l}--${n}-${i}`;Ud("source",c,m,e,n,i),Ud("target",c,u,e,s,l),t.set(o.id,o)}}function Ux(e,t){if(!e.parentId)return!1;const r=t.get(e.parentId);return r?r.selected?!0:Ux(r,t):!1}function Zd(e,t,r){let o=e;do{if(o?.matches?.(t))return!0;if(o===r)return!1;o=o?.parentElement}while(o);return!1}function R6(e,t,r,o){const n=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Ux(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(s);l&&n.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return n}function ca({nodeId:e,dragItems:t,nodeLookup:r,dragging:o=!0}){const n=[];for(const[i,l]of t){const c=r.get(i)?.internals.userNode;c&&n.push({...c,position:l.position,dragging:o})}if(!e)return[n[0],n];const s=r.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:n[0],n]}function w6({dragItems:e,snapGrid:t,x:r,y:o}){const n=e.values().next().value;if(!n)return null;const s={x:r-n.distance.x,y:o-n.distance.y},i=Eo(s,t);return{x:i.x-s.x,y:i.y-s.y}}function _6({onNodeMouseDown:e,getStoreItems:t,onDragStart:r,onDrag:o,onDragStop:n}){let s={x:null,y:null},i=0,l=new Map,c=!1,u={x:0,y:0},m=null,p=!1,f=null,h=!1,x=!1,g=null;function y({noDragClassName:w,handleSelector:j,domNode:b,isSelectable:$,nodeId:k,nodeClickDistance:A=0}){f=Et(b);function U({x:D,y:B}){const{nodeLookup:C,nodeExtent:O,snapGrid:N,snapToGrid:T,nodeOrigin:P,onNodeDrag:Z,onSelectionDrag:H,onError:G,updateNodePositions:K}=t();s={x:D,y:B};let se=!1;const ee=l.size>1,fe=ee&&O?Pa(jo(l)):null,xe=ee&&T?w6({dragItems:l,snapGrid:N,x:D,y:B}):null;for(const[ae,ne]of l){if(!C.has(ae))continue;let ce={x:D-ne.distance.x,y:B-ne.distance.y};T&&(ce=xe?{x:Math.round(ce.x+xe.x),y:Math.round(ce.y+xe.y)}:Eo(ce,N));let Ce=null;if(ee&&O&&!ne.extent&&fe){const{positionAbsolute:be}=ne.internals,Ue=be.x-fe.x+O[0][0],Ve=be.x+ne.measured.width-fe.x2+O[1][0],Fe=be.y-fe.y+O[0][1],nt=be.y+ne.measured.height-fe.y2+O[1][1];Ce=[[Ue,Fe],[Ve,nt]]}const{position:$e,positionAbsolute:ye}=Sx({nodeId:ae,nextPosition:ce,nodeLookup:C,nodeExtent:Ce||O,nodeOrigin:P,onError:G});se=se||ne.position.x!==$e.x||ne.position.y!==$e.y,ne.position=$e,ne.internals.positionAbsolute=ye}if(x=x||se,!!se&&(K(l,!0),g&&(o||Z||!k&&H))){const[ae,ne]=ca({nodeId:k,dragItems:l,nodeLookup:C});o?.(g,l,ae,ne),Z?.(g,ae,ne),k||H?.(g,ne)}}async function L(){if(!m)return;const{transform:D,panBy:B,autoPanSpeed:C,autoPanOnNodeDrag:O}=t();if(!O){c=!1,cancelAnimationFrame(i);return}const[N,T]=Rx(u,m,C);(N!==0||T!==0)&&(s.x=(s.x??0)-N/D[2],s.y=(s.y??0)-T/D[2],await B({x:N,y:T})&&U(s)),i=requestAnimationFrame(L)}function V(D){const{nodeLookup:B,multiSelectionActive:C,nodesDraggable:O,transform:N,snapGrid:T,snapToGrid:P,selectNodesOnDrag:Z,onNodeDragStart:H,onSelectionDragStart:G,unselectNodesAndEdges:K}=t();p=!0,(!Z||!$)&&!C&&k&&(B.get(k)?.selected||K()),$&&Z&&k&&e?.(k);const se=qr(D.sourceEvent,{transform:N,snapGrid:T,snapToGrid:P,containerBounds:m});if(s=se,l=R6(B,O,se,k),l.size>0&&(r||H||!k&&G)){const[ee,fe]=ca({nodeId:k,dragItems:l,nodeLookup:B});r?.(D.sourceEvent,l,ee,fe),H?.(D.sourceEvent,ee,fe),k||G?.(D.sourceEvent,fe)}}const M=sx().clickDistance(A).on("start",D=>{const{domNode:B,nodeDragThreshold:C,transform:O,snapGrid:N,snapToGrid:T}=t();m=B?.getBoundingClientRect()||null,h=!1,x=!1,g=D.sourceEvent,C===0&&V(D),s=qr(D.sourceEvent,{transform:O,snapGrid:N,snapToGrid:T,containerBounds:m}),u=Lt(D.sourceEvent,m)}).on("drag",D=>{const{autoPanOnNodeDrag:B,transform:C,snapGrid:O,snapToGrid:N,nodeDragThreshold:T,nodeLookup:P}=t(),Z=qr(D.sourceEvent,{transform:C,snapGrid:O,snapToGrid:N,containerBounds:m});if(g=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||k&&!P.has(k))&&(h=!0),!h){if(!c&&B&&p&&(c=!0,L()),!p){const H=Lt(D.sourceEvent,m),G=H.x-u.x,K=H.y-u.y;Math.sqrt(G*G+K*K)>T&&V(D)}(s.x!==Z.xSnapped||s.y!==Z.ySnapped)&&l&&p&&(u=Lt(D.sourceEvent,m),U(Z))}}).on("end",D=>{if(!(!p||h)&&(c=!1,p=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:B,updateNodePositions:C,onNodeDragStop:O,onSelectionDragStop:N}=t();if(x&&(C(l,!1),x=!1),n||O||!k&&N){const[T,P]=ca({nodeId:k,dragItems:l,nodeLookup:B,dragging:!1});n?.(D.sourceEvent,l,T,P),O?.(D.sourceEvent,T,P),k||N?.(D.sourceEvent,P)}}}).filter(D=>{const B=D.target;return!D.button&&(!w||!Zd(B,`.${w}`,b))&&(!j||Zd(B,j,b))});f.call(M)}function E(){f?.on(".drag",null)}return{update:y,destroy:E}}function C6(e,t,r){const o=[],n={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of t.values())no(n,jr(s))>0&&o.push(s);return o}const k6=250;function $6(e,t,r,o){let n=[],s=1/0;const i=C6(e,r,t+k6);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const u of c){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:m,y:p}=Bn(l,u,u.position,!0),f=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(p-e.y,2));f>t||(f<s?(n=[{...u,x:m,y:p}],s=f):f===s&&n.push({...u,x:m,y:p}))}}if(!n.length)return null;if(n.length>1){const l=o.type==="source"?"target":"source";return n.find(c=>c.type===l)??n[0]}return n[0]}function Zx(e,t,r,o,n,s=!1){const i=o.get(e);if(!i)return null;const l=n==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(r?l?.find(u=>u.id===r):l?.[0])??null;return c&&s?{...c,...Bn(i,c,c.position,!0)}:c}function Fx(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function I6(e,t){let r=null;return t?r=!0:e&&!t&&(r=!1),r}const Bx=()=>!0;function N6(e,{connectionMode:t,connectionRadius:r,handleId:o,nodeId:n,edgeUpdaterType:s,isTarget:i,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:m,flowId:p,panBy:f,cancelConnection:h,onConnectStart:x,onConnect:g,onConnectEnd:y,isValidConnection:E=Bx,onReconnectEnd:w,updateConnection:j,getTransform:b,getFromHandle:$,autoPanSpeed:k,dragThreshold:A=1,handleDomNode:U}){const L=kx(e.target);let V=0,M;const{x:D,y:B}=Lt(e),C=Fx(s,U),O=l?.getBoundingClientRect();let N=!1;if(!O||!C)return;const T=Zx(n,C,o,c,t);if(!T)return;let P=Lt(e,O),Z=!1,H=null,G=!1,K=null;function se(){if(!m||!O)return;const[$e,ye]=Rx(P,O,k);f({x:$e,y:ye}),V=requestAnimationFrame(se)}const ee={...T,nodeId:n,type:C,position:T.position},fe=c.get(n);let ae={inProgress:!0,isValid:null,from:Bn(fe,ee,oe.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:fe,to:P,toHandle:null,toPosition:$d[ee.position],toNode:null,pointer:P};function ne(){N=!0,j(ae),x?.(e,{nodeId:n,handleId:o,handleType:C})}A===0&&ne();function ce($e){if(!N){const{x:nt,y:At}=Lt($e),kt=nt-D,Jt=At-B;if(!(kt*kt+Jt*Jt>A*A))return;ne()}if(!$()||!ee){Ce($e);return}const ye=b();P=Lt($e,O),M=$6(So(P,ye,!1,[1,1]),r,c,ee),Z||(se(),Z=!0);const be=Vx($e,{handle:M,connectionMode:t,fromNodeId:n,fromHandleId:o,fromType:i?"target":"source",isValidConnection:E,doc:L,lib:u,flowId:p,nodeLookup:c});K=be.handleDomNode,H=be.connection,G=I6(!!M,be.isValid);const Ue=c.get(n),Ve=Ue?Bn(Ue,ee,oe.Left,!0):ae.from,Fe={...ae,from:Ve,isValid:G,to:be.toHandle&&G?Es({x:be.toHandle.x,y:be.toHandle.y},ye):P,toHandle:be.toHandle,toPosition:G&&be.toHandle?be.toHandle.position:$d[ee.position],toNode:be.toHandle?c.get(be.toHandle.nodeId):null,pointer:P};j(Fe),ae=Fe}function Ce($e){if(!("touches"in $e&&$e.touches.length>0)){if(N){(M||K)&&H&&G&&g?.(H);const{inProgress:ye,...be}=ae,Ue={...be,toPosition:ae.toHandle?ae.toPosition:null};y?.($e,Ue),s&&w?.($e,Ue)}h(),cancelAnimationFrame(V),Z=!1,G=!1,H=null,K=null,L.removeEventListener("mousemove",ce),L.removeEventListener("mouseup",Ce),L.removeEventListener("touchmove",ce),L.removeEventListener("touchend",Ce)}}L.addEventListener("mousemove",ce),L.addEventListener("mouseup",Ce),L.addEventListener("touchmove",ce),L.addEventListener("touchend",Ce)}function Vx(e,{handle:t,connectionMode:r,fromNodeId:o,fromHandleId:n,fromType:s,doc:i,lib:l,flowId:c,isValidConnection:u=Bx,nodeLookup:m}){const p=s==="target",f=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:x}=Lt(e),g=i.elementFromPoint(h,x),y=g?.classList.contains(`${l}-flow__handle`)?g:f,E={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const w=Fx(void 0,y),j=y.getAttribute("data-nodeid"),b=y.getAttribute("data-handleid"),$=y.classList.contains("connectable"),k=y.classList.contains("connectableend");if(!j||!w)return E;const A={source:p?j:o,sourceHandle:p?b:n,target:p?o:j,targetHandle:p?n:b};E.connection=A;const L=$&&k&&(r===Zn.Strict?p&&w==="source"||!p&&w==="target":j!==o||b!==n);E.isValid=L&&u(A),E.toHandle=Zx(j,w,b,m,r,!0)}return E}const za={onPointerDown:N6,isValid:Vx};function A6({domNode:e,panZoom:t,getTransform:r,getViewScale:o}){const n=Et(e);function s({translateExtent:l,width:c,height:u,zoomStep:m=1,pannable:p=!0,zoomable:f=!0,inversePan:h=!1}){const x=j=>{if(j.sourceEvent.type!=="wheel"||!t)return;const b=r(),$=j.sourceEvent.ctrlKey&&ro()?10:1,k=-j.sourceEvent.deltaY*(j.sourceEvent.deltaMode===1?.05:j.sourceEvent.deltaMode?1:.002)*m,A=b[2]*Math.pow(2,k*$);t.scaleTo(A)};let g=[0,0];const y=j=>{(j.sourceEvent.type==="mousedown"||j.sourceEvent.type==="touchstart")&&(g=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY])},E=j=>{const b=r();if(j.sourceEvent.type!=="mousemove"&&j.sourceEvent.type!=="touchmove"||!t)return;const $=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY],k=[$[0]-g[0],$[1]-g[1]];g=$;const A=o()*Math.max(b[2],Math.log(b[2]))*(h?-1:1),U={x:b[0]-k[0]*A,y:b[1]-k[1]*A},L=[[0,0],[c,u]];t.setViewportConstrained({x:U.x,y:U.y,zoom:b[2]},L,l)},w=hx().on("start",y).on("zoom",p?E:null).on("zoom.wheel",f?x:null);n.call(w,{})}function i(){n.on("zoom",null)}return{update:s,destroy:i,pointer:Pt}}const ci=e=>({x:e.x,y:e.y,zoom:e.k}),ua=({x:e,y:t,zoom:r})=>ii.translate(e,t).scale(r),cr=(e,t)=>e.target.closest(`.${t}`),Hx=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),P6=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,da=(e,t=0,r=P6,o=()=>{})=>{const n=typeof t=="number"&&t>0;return n||o(),n?e.transition().duration(t).ease(r).on("end",o):e},Gx=e=>{const t=e.ctrlKey&&ro()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function T6({zoomPanValues:e,noWheelClassName:t,d3Selection:r,d3Zoom:o,panOnScrollMode:n,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return m=>{if(cr(m,t))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=r.property("__zoom").k||1;if(m.ctrlKey&&i){const y=Pt(m),E=Gx(m),w=p*Math.pow(2,E);o.scaleTo(r,w,y,m);return}const f=m.deltaMode===1?20:1;let h=n===Pn.Vertical?0:m.deltaX*f,x=n===Pn.Horizontal?0:m.deltaY*f;!ro()&&m.shiftKey&&n!==Pn.Vertical&&(h=m.deltaY*f,x=0),o.translateBy(r,-(h/p)*s,-(x/p)*s,{internal:!0});const g=ci(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(m,g),e.panScrollTimeout=setTimeout(()=>{u?.(m,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(m,g))}}function O6({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:r}){return function(o,n){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,l=cr(o,e);if(o.ctrlKey&&s&&l&&o.preventDefault(),i||l)return null;o.preventDefault(),r.call(this,o,n)}}function L6({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:r}){return o=>{if(o.sourceEvent?.internal)return;const n=ci(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=n,o.sourceEvent?.type==="mousedown"&&t(!0),r&&r?.(o.sourceEvent,n)}}function z6({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:r,onTransformChange:o,onPanZoom:n}){return s=>{e.usedRightMouseButton=!!(r&&Hx(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),n&&!s.sourceEvent?.internal&&n?.(s.sourceEvent,ci(s.transform))}}function M6({zoomPanValues:e,panOnDrag:t,panOnScroll:r,onDraggingChange:o,onPanZoomEnd:n,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Hx(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),n)){const l=ci(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{n?.(i.sourceEvent,l)},r?150:0)}}}function D6({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:r,panOnDrag:o,panOnScroll:n,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:m}){return p=>{const f=e||t,h=r&&p.ctrlKey,x=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(cr(p,`${u}-flow__node`)||cr(p,`${u}-flow__edge`)))return!0;if(!o&&!f&&!n&&!s&&!r||i||m&&!x||cr(p,l)&&x||cr(p,c)&&(!x||n&&x&&!e)||!r&&p.ctrlKey&&x)return!1;if(!r&&p.type==="touchstart"&&p.touches?.length>1)return p.preventDefault(),!1;if(!f&&!n&&!h&&x||!o&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(o)&&!o.includes(p.button)&&p.type==="mousedown")return!1;const g=Array.isArray(o)&&o.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||x)&&g}}function U6({domNode:e,minZoom:t,maxZoom:r,translateExtent:o,viewport:n,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),p=hx().scaleExtent([t,r]).translateExtent(o),f=Et(e).call(p);w({x:n.x,y:n.y,zoom:vr(n.zoom,t,r)},[[0,0],[m.width,m.height]],o);const h=f.on("wheel.zoom"),x=f.on("dblclick.zoom");p.wheelDelta(Gx);function g(M,D){return f?new Promise(B=>{p?.interpolate(D?.interpolate==="linear"?I.interpolate:cs).transform(da(f,D?.duration,D?.ease,()=>B(!0)),M)}):Promise.resolve(!1)}function y({noWheelClassName:M,noPanClassName:D,onPaneContextMenu:B,userSelectionActive:C,panOnScroll:O,panOnDrag:N,panOnScrollMode:T,panOnScrollSpeed:P,preventScrolling:Z,zoomOnPinch:H,zoomOnScroll:G,zoomOnDoubleClick:K,zoomActivationKeyPressed:se,lib:ee,onTransformChange:fe,connectionInProgress:xe,paneClickDistance:ae,selectionOnDrag:ne}){C&&!u.isZoomingOrPanning&&E();const ce=O&&!se&&!C;p.clickDistance(ne?1/0:!Ot(ae)||ae<0?0:ae);const Ce=ce?T6({zoomPanValues:u,noWheelClassName:M,d3Selection:f,d3Zoom:p,panOnScrollMode:T,panOnScrollSpeed:P,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:l}):O6({noWheelClassName:M,preventScrolling:Z,d3ZoomHandler:h});if(f.on("wheel.zoom",Ce,{passive:!1}),!C){const ye=L6({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:i});p.on("start",ye);const be=z6({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!B,onPanZoom:s,onTransformChange:fe});p.on("zoom",be);const Ue=M6({zoomPanValues:u,panOnDrag:N,panOnScroll:O,onPaneContextMenu:B,onPanZoomEnd:l,onDraggingChange:c});p.on("end",Ue)}const $e=D6({zoomActivationKeyPressed:se,panOnDrag:N,zoomOnScroll:G,panOnScroll:O,zoomOnDoubleClick:K,zoomOnPinch:H,userSelectionActive:C,noPanClassName:D,noWheelClassName:M,lib:ee,connectionInProgress:xe});p.filter($e),K?f.on("dblclick.zoom",x):f.on("dblclick.zoom",null)}function E(){p.on("zoom",null)}async function w(M,D,B){const C=ua(M),O=p?.constrain()(C,D,B);return O&&await g(O),new Promise(N=>N(O))}async function j(M,D){const B=ua(M);return await g(B,D),new Promise(C=>C(B))}function b(M){if(f){const D=ua(M),B=f.property("__zoom");(B.k!==M.zoom||B.x!==M.x||B.y!==M.y)&&p?.transform(f,D,null,{sync:!0})}}function $(){const M=f?xx(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function k(M,D){return f?new Promise(B=>{p?.interpolate(D?.interpolate==="linear"?I.interpolate:cs).scaleTo(da(f,D?.duration,D?.ease,()=>B(!0)),M)}):Promise.resolve(!1)}function A(M,D){return f?new Promise(B=>{p?.interpolate(D?.interpolate==="linear"?I.interpolate:cs).scaleBy(da(f,D?.duration,D?.ease,()=>B(!0)),M)}):Promise.resolve(!1)}function U(M){p?.scaleExtent(M)}function L(M){p?.translateExtent(M)}function V(M){const D=!Ot(M)||M<0?0:M;p?.clickDistance(D)}return{update:y,destroy:E,setViewport:j,setViewportConstrained:w,getViewport:$,scaleTo:k,scaleBy:A,setScaleExtent:U,setTranslateExtent:L,syncViewport:b,setClickDistance:V}}var Sr;(function(e){e.Line="line",e.Handle="handle"})(Sr||(Sr={}));function Z6({width:e,prevWidth:t,height:r,prevHeight:o,affectsX:n,affectsY:s}){const i=e-t,l=r-o,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&n&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function Fd(e){const t=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),o=e.includes("left"),n=e.includes("top");return{isHorizontal:t,isVertical:r,affectsX:o,affectsY:n}}function xn(e,t){return Math.max(0,t-e)}function hn(e,t){return Math.max(0,e-t)}function Wo(e,t,r){return Math.max(0,t-e,e-r)}function Bd(e,t){return e?!t:t}function F6(e,t,r,o,n,s,i,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:m,isVertical:p}=t,f=m&&p,{xSnapped:h,ySnapped:x}=r,{minWidth:g,maxWidth:y,minHeight:E,maxHeight:w}=o,{x:j,y:b,width:$,height:k,aspectRatio:A}=e;let U=Math.floor(m?h-e.pointerX:0),L=Math.floor(p?x-e.pointerY:0);const V=$+(c?-U:U),M=k+(u?-L:L),D=-s[0]*$,B=-s[1]*k;let C=Wo(V,g,y),O=Wo(M,E,w);if(i){let P=0,Z=0;c&&U<0?P=xn(j+U+D,i[0][0]):!c&&U>0&&(P=hn(j+V+D,i[1][0])),u&&L<0?Z=xn(b+L+B,i[0][1]):!u&&L>0&&(Z=hn(b+M+B,i[1][1])),C=Math.max(C,P),O=Math.max(O,Z)}if(l){let P=0,Z=0;c&&U>0?P=hn(j+U,l[0][0]):!c&&U<0&&(P=xn(j+V,l[1][0])),u&&L>0?Z=hn(b+L,l[0][1]):!u&&L<0&&(Z=xn(b+M,l[1][1])),C=Math.max(C,P),O=Math.max(O,Z)}if(n){if(m){const P=Wo(V/A,E,w)*A;if(C=Math.max(C,P),i){let Z=0;!c&&!u||c&&!u&&f?Z=hn(b+B+V/A,i[1][1])*A:Z=xn(b+B+(c?U:-U)/A,i[0][1])*A,C=Math.max(C,Z)}if(l){let Z=0;!c&&!u||c&&!u&&f?Z=xn(b+V/A,l[1][1])*A:Z=hn(b+(c?U:-U)/A,l[0][1])*A,C=Math.max(C,Z)}}if(p){const P=Wo(M*A,g,y)/A;if(O=Math.max(O,P),i){let Z=0;!c&&!u||u&&!c&&f?Z=hn(j+M*A+D,i[1][0])/A:Z=xn(j+(u?L:-L)*A+D,i[0][0])/A,O=Math.max(O,Z)}if(l){let Z=0;!c&&!u||u&&!c&&f?Z=xn(j+M*A,l[1][0])/A:Z=hn(j+(u?L:-L)*A,l[0][0])/A,O=Math.max(O,Z)}}}L=L+(L<0?O:-O),U=U+(U<0?C:-C),n&&(f?V>M*A?L=(Bd(c,u)?-U:U)/A:U=(Bd(c,u)?-L:L)*A:m?(L=U/A,u=c):(U=L*A,c=u));const N=c?j+U:j,T=u?b+L:b;return{width:$+(c?-U:U),height:k+(u?-L:L),x:s[0]*U*(c?-1:1)+N,y:s[1]*L*(u?-1:1)+T}}const Kx={width:0,height:0,x:0,y:0},B6={...Kx,pointerX:0,pointerY:0,aspectRatio:1};function V6(e){return[[0,0],[e.measured.width,e.measured.height]]}function H6(e,t,r){const o=t.position.x+e.position.x,n=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,l=r[0]*s,c=r[1]*i;return[[o-l,n-c],[o+s-l,n+i-c]]}function G6({domNode:e,nodeId:t,getStoreItems:r,onChange:o,onEnd:n}){const s=Et(e);let i={controlDirection:Fd("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:m,keepAspectRatio:p,resizeDirection:f,onResizeStart:h,onResize:x,onResizeEnd:g,shouldResize:y}){let E={...Kx},w={...B6};i={boundaries:m,resizeDirection:f,keepAspectRatio:p,controlDirection:Fd(u)};let j,b=null,$=[],k,A,U,L=!1;const V=sx().on("start",M=>{const{nodeLookup:D,transform:B,snapGrid:C,snapToGrid:O,nodeOrigin:N,paneDomNode:T}=r();if(j=D.get(t),!j)return;b=T?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:Z}=qr(M.sourceEvent,{transform:B,snapGrid:C,snapToGrid:O,containerBounds:b});E={width:j.measured.width??0,height:j.measured.height??0,x:j.position.x??0,y:j.position.y??0},w={...E,pointerX:P,pointerY:Z,aspectRatio:E.width/E.height},k=void 0,j.parentId&&(j.extent==="parent"||j.expandParent)&&(k=D.get(j.parentId),A=k&&j.extent==="parent"?V6(k):void 0),$=[],U=void 0;for(const[H,G]of D)if(G.parentId===t&&($.push({id:H,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const K=H6(G,j,G.origin??N);U?U=[[Math.min(K[0][0],U[0][0]),Math.min(K[0][1],U[0][1])],[Math.max(K[1][0],U[1][0]),Math.max(K[1][1],U[1][1])]]:U=K}h?.(M,{...E})}).on("drag",M=>{const{transform:D,snapGrid:B,snapToGrid:C,nodeOrigin:O}=r(),N=qr(M.sourceEvent,{transform:D,snapGrid:B,snapToGrid:C,containerBounds:b}),T=[];if(!j)return;const{x:P,y:Z,width:H,height:G}=E,K={},se=j.origin??O,{width:ee,height:fe,x:xe,y:ae}=F6(w,i.controlDirection,N,i.boundaries,i.keepAspectRatio,se,A,U),ne=ee!==H,ce=fe!==G,Ce=xe!==P&&ne,$e=ae!==Z&&ce;if(!Ce&&!$e&&!ne&&!ce)return;if((Ce||$e||se[0]===1||se[1]===1)&&(K.x=Ce?xe:E.x,K.y=$e?ae:E.y,E.x=K.x,E.y=K.y,$.length>0)){const Ve=xe-P,Fe=ae-Z;for(const nt of $)nt.position={x:nt.position.x-Ve+se[0]*(ee-H),y:nt.position.y-Fe+se[1]*(fe-G)},T.push(nt)}if((ne||ce)&&(K.width=ne&&(!i.resizeDirection||i.resizeDirection==="horizontal")?ee:E.width,K.height=ce&&(!i.resizeDirection||i.resizeDirection==="vertical")?fe:E.height,E.width=K.width,E.height=K.height),k&&j.expandParent){const Ve=se[0]*(K.width??0);K.x&&K.x<Ve&&(E.x=Ve,w.x=w.x-(K.x-Ve));const Fe=se[1]*(K.height??0);K.y&&K.y<Fe&&(E.y=Fe,w.y=w.y-(K.y-Fe))}const ye=Z6({width:E.width,prevWidth:H,height:E.height,prevHeight:G,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),be={...E,direction:ye};y?.(M,be)!==!1&&(L=!0,x?.(M,be),o(K,T))}).on("end",M=>{L&&(g?.(M,{...E}),n?.({...E}),L=!1)});s.call(V)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var Xo={exports:{}},ma={},Jo={exports:{}},pa={};var Vd;function K6(){if(Vd)return pa;Vd=1;var e=v;function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,n=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function l(p,f){var h=f(),x=o({inst:{value:h,getSnapshot:f}}),g=x[0].inst,y=x[1];return s(function(){g.value=h,g.getSnapshot=f,c(g)&&y({inst:g})},[p,h,f]),n(function(){return c(g)&&y({inst:g}),p(function(){c(g)&&y({inst:g})})},[p]),i(h),h}function c(p){var f=p.getSnapshot;p=p.value;try{var h=f();return!r(p,h)}catch{return!0}}function u(p,f){return f()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:l;return pa.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,pa}var fa={};var Hd;function Y6(){return Hd||(Hd=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}function t(h,x){m||n.startTransition===void 0||(m=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=x();if(!p){var y=x();s(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}y=i({inst:{value:g,getSnapshot:x}});var E=y[0].inst,w=y[1];return c(function(){E.value=g,E.getSnapshot=x,r(E)&&w({inst:E})},[h,g,x]),l(function(){return r(E)&&w({inst:E}),h(function(){r(E)&&w({inst:E})})},[h]),u(g),g}function r(h){var x=h.getSnapshot;h=h.value;try{var g=x();return!s(h,g)}catch{return!0}}function o(h,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=v,s=typeof Object.is=="function"?Object.is:e,i=n.useState,l=n.useEffect,c=n.useLayoutEffect,u=n.useDebugValue,m=!1,p=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;fa.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),fa}var Gd;function Yx(){return Gd||(Gd=1,process.env.NODE_ENV==="production"?Jo.exports=K6():Jo.exports=Y6()),Jo.exports}var Kd;function q6(){if(Kd)return ma;Kd=1;var e=v,t=Yx();function r(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}var o=typeof Object.is=="function"?Object.is:r,n=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,l=e.useMemo,c=e.useDebugValue;return ma.useSyncExternalStoreWithSelector=function(u,m,p,f,h){var x=s(null);if(x.current===null){var g={hasValue:!1,value:null};x.current=g}else g=x.current;x=l(function(){function E(k){if(!w){if(w=!0,j=k,k=f(k),h!==void 0&&g.hasValue){var A=g.value;if(h(A,k))return b=A}return b=k}if(A=b,o(j,k))return A;var U=f(k);return h!==void 0&&h(A,U)?(j=k,A):(j=k,b=U)}var w=!1,j,b,$=p===void 0?null:p;return[function(){return E(m())},$===null?void 0:function(){return E($())}]},[m,p,f,h]);var y=n(u,x[0],x[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),c(y),y},ma}var xa={};var Yd;function W6(){return Yd||(Yd=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=v,r=Yx(),o=typeof Object.is=="function"?Object.is:e,n=r.useSyncExternalStore,s=t.useRef,i=t.useEffect,l=t.useMemo,c=t.useDebugValue;xa.useSyncExternalStoreWithSelector=function(u,m,p,f,h){var x=s(null);if(x.current===null){var g={hasValue:!1,value:null};x.current=g}else g=x.current;x=l(function(){function E(k){if(!w){if(w=!0,j=k,k=f(k),h!==void 0&&g.hasValue){var A=g.value;if(h(A,k))return b=A}return b=k}if(A=b,o(j,k))return A;var U=f(k);return h!==void 0&&h(A,U)?(j=k,A):(j=k,b=U)}var w=!1,j,b,$=p===void 0?null:p;return[function(){return E(m())},$===null?void 0:function(){return E($())}]},[m,p,f,h]);var y=n(u,x[0],x[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),xa}var qd;function X6(){return qd||(qd=1,process.env.NODE_ENV==="production"?Xo.exports=q6():Xo.exports=W6()),Xo.exports}var J6=X6();const Q6=Ft.getDefaultExportFromCjs(J6),eC={},Wd=e=>{let t;const r=new Set,o=(m,p)=>{const f=typeof m=="function"?m(t):m;if(!Object.is(f,t)){const h=t;t=p??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(x=>x(t,h))}},n=()=>t,c={setState:o,getState:n,getInitialState:()=>u,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(eC?"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."),r.clear()}},u=t=e(o,n,c);return c},tC=e=>e?Wd(e):Wd,{useDebugValue:nC}=v,{useSyncExternalStoreWithSelector:rC}=Q6,oC=e=>e;function qx(e,t=oC,r){const o=rC(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return nC(o),o}const Xd=(e,t)=>{const r=tC(e),o=(n,s=t)=>qx(r,n,s);return Object.assign(o,r),o},sC=(e,t)=>e?Xd(e,t):Xd;function Ye(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[o,n]of e)if(!Object.is(n,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const o of r)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ui=v.createContext(null),iC=ui.Provider,Wx=pt.error001();function Te(e,t){const r=v.useContext(ui);if(r===null)throw new Error(Wx);return qx(r,e,t)}function He(){const e=v.useContext(ui);if(e===null)throw new Error(Wx);return v.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Jd={display:"none"},aC={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Xx="react-flow__node-desc",Jx="react-flow__edge-desc",lC="react-flow__aria-live",cC=e=>e.ariaLiveMessage,uC=e=>e.ariaLabelConfig;function dC({rfId:e}){const t=Te(cC);return a.jsxRuntimeExports.jsx("div",{id:`${lC}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:aC,children:t})}function mC({rfId:e,disableKeyboardA11y:t}){const r=Te(uC);return a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[a.jsxRuntimeExports.jsx("div",{id:`${Xx}-${e}`,style:Jd,children:t?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),a.jsxRuntimeExports.jsx("div",{id:`${Jx}-${e}`,style:Jd,children:r["edge.a11yDescription.default"]}),!t&&a.jsxRuntimeExports.jsx(dC,{rfId:e})]})}const di=v.forwardRef(({position:e="top-left",children:t,className:r,style:o,...n},s)=>{const i=`${e}`.split("-");return a.jsxRuntimeExports.jsx("div",{className:tt(["react-flow__panel",r,...i]),style:o,ref:s,...n,children:t})});di.displayName="Panel";function pC({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:a.jsxRuntimeExports.jsx(di,{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:a.jsxRuntimeExports.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const fC=e=>{const t=[],r=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&r.push(o);return{selectedNodes:t,selectedEdges:r}},Qo=e=>e.id;function xC(e,t){return Ye(e.selectedNodes.map(Qo),t.selectedNodes.map(Qo))&&Ye(e.selectedEdges.map(Qo),t.selectedEdges.map(Qo))}function hC({onSelectionChange:e}){const t=He(),{selectedNodes:r,selectedEdges:o}=Te(fC,xC);return v.useEffect(()=>{const n={nodes:r,edges:o};e?.(n),t.getState().onSelectionChangeHandlers.forEach(s=>s(n))},[r,o,e]),null}const gC=e=>!!e.onSelectionChangeHandlers;function yC({onSelectionChange:e}){const t=Te(gC);return e||t?a.jsxRuntimeExports.jsx(hC,{onSelectionChange:e}):null}const Qx=[0,0],vC={x:0,y:0,zoom:1},jC=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Qd=[...jC,"rfId"],EC=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}),em={translateExtent:eo,nodeOrigin:Qx,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function SC(e){const{setNodes:t,setEdges:r,setMinZoom:o,setMaxZoom:n,setTranslateExtent:s,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Te(EC,Ye),u=He();v.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{m.current=em,l()}),[]);const m=v.useRef(em);return v.useEffect(()=>{for(const p of Qd){const f=e[p],h=m.current[p];f!==h&&(typeof e[p]>"u"||(p==="nodes"?t(f):p==="edges"?r(f):p==="minZoom"?o(f):p==="maxZoom"?n(f):p==="translateExtent"?s(f):p==="nodeExtent"?i(f):p==="ariaLabelConfig"?u.setState({ariaLabelConfig:s6(f)}):p==="fitView"?u.setState({fitViewQueued:f}):p==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[p]:f})))}m.current=e},Qd.map(p=>e[p])),null}function tm(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bC(e){const[t,r]=v.useState(e==="system"?null:e);return v.useEffect(()=>{if(e!=="system"){r(e);return}const o=tm(),n=()=>r(o?.matches?"dark":"light");return n(),o?.addEventListener("change",n),()=>{o?.removeEventListener("change",n)}},[e]),t!==null?t:tm()?.matches?"dark":"light"}const nm=typeof document<"u"?document:null;function oo(e=null,t={target:nm,actInsideInputWithModifier:!0}){const[r,o]=v.useState(!1),n=v.useRef(!1),s=v.useRef(new Set([])),[i,l]=v.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",`
10
10
  `).replace(`
11
11
 
12
12
  `,`