showai-reader 0.10.0-reader.7ttebdmo → 0.10.0-reader.bewbunls

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 (37) hide show
  1. package/README.md +1 -1
  2. package/chunks/CardGrid-XIOKVIEI.js +2 -0
  3. package/chunks/CommandReference-7FQV6W44.js +3 -0
  4. package/chunks/{ExternalDiagram-B6TDNZM4.js → ExternalDiagram-HKK3NBZH.js} +1 -1
  5. package/chunks/{Flowchart-FDIMKFEA.js → Flowchart-VG42T332.js} +1 -1
  6. package/chunks/LayerDiagram-FHPQBNNP.js +2 -0
  7. package/chunks/{Mindmap-6NWSYUKU.js → Mindmap-E5X5CQBX.js} +1 -1
  8. package/chunks/{RichTextEditor-AC7S457D.js → RichTextEditor-BA5YF46E.js} +44 -44
  9. package/chunks/{SequenceDiagram-WA7DFSY3.js → SequenceDiagram-AG2F4GAU.js} +1 -1
  10. package/chunks/StepGuide-GUW3ELME.js +1 -0
  11. package/chunks/StructureBrowser-VZYKCSL6.js +3 -0
  12. package/chunks/chunk-5CTTY5BQ.js +2 -0
  13. package/chunks/chunk-5X5EO4YB.js +9 -0
  14. package/chunks/{chunk-NWWWOZDQ.js → chunk-BZT4BVM4.js} +1 -1
  15. package/chunks/chunk-GLP5VV7P.js +1 -0
  16. package/chunks/{chunk-NLCSXEUT.js → chunk-KQR52I3G.js} +8 -8
  17. package/chunks/chunk-L2ZHJIET.js +4 -0
  18. package/chunks/chunk-M5RCHTSV.js +1 -0
  19. package/chunks/{chunk-7ZRIRZ4A.js → chunk-RLCYUTAH.js} +1 -1
  20. package/chunks/chunk-UNH6G7NO.js +1 -0
  21. package/chunks/chunk-VSZNYGH7.js +1 -0
  22. package/index.js +1 -1
  23. package/manifest.json +5 -5
  24. package/package.json +1 -1
  25. package/{reader-7TTEBDMO.js → reader-BEWBUNLS.js} +33 -34
  26. package/chunks/CardGrid-6WXY2OUD.js +0 -2
  27. package/chunks/CommandReference-CKBSDW6N.js +0 -3
  28. package/chunks/LayerDiagram-HTH3JN4D.js +0 -2
  29. package/chunks/StepGuide-UE7JVBQD.js +0 -1
  30. package/chunks/StructureBrowser-DG3TSDJF.js +0 -3
  31. package/chunks/chunk-ECJLHLTK.js +0 -8
  32. package/chunks/chunk-GABDVURY.js +0 -1
  33. package/chunks/chunk-KYWOOES7.js +0 -2
  34. package/chunks/chunk-WLKJ25NO.js +0 -1
  35. package/chunks/chunk-YOGTJ6FI.js +0 -4
  36. /package/chunks/{chunk-KYWOOES7.js.LEGAL.txt → chunk-5CTTY5BQ.js.LEGAL.txt} +0 -0
  37. /package/{reader-7TTEBDMO.js.LEGAL.txt → reader-BEWBUNLS.js.LEGAL.txt} +0 -0
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The [ShowAI](https://showai.renaissancemind.ai) page reader, built from ShowAI 0.10.0 as code-split ES modules. Inline conversation pages written by `render-artifact --cdn` import it and load each component's code only when the page uses it.
4
4
 
5
5
  ```js
6
- const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.10.0-reader.7ttebdmo/index.js");
6
+ const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.10.0-reader.bewbunls/index.js");
7
7
  mount(document.getElementById("page"), { artifact });
8
8
  ```
9
9
 
@@ -0,0 +1,2 @@
1
+ import{a as w}from"./chunk-M5RCHTSV.js";import{d as f,e as m}from"./chunk-RLCYUTAH.js";import{a as d,b as k}from"./chunk-UNH6G7NO.js";import{b as n,d as v}from"./chunk-7K7GQKOA.js";import{Ab as h,a as b,mb as p}from"./chunk-WRXJZR6G.js";import{a as x}from"./chunk-J6IRWTF7.js";import{c as g}from"./chunk-DCANE7XH.js";b(`.sb-block.cg-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.cg-block li:not(svg){padding:0}.sb-block.cg-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.cg-block{--cg-text: var(--text, #222222);--cg-muted: var(--muted, #6a6a6a);--cg-faint: var(--subtle, #929292);--cg-line: var(--line, #dddddd);--cg-surface: var(--surface, #fafafa);--cg-accent: var(--accent, #120a8f);--cg-accent-soft: var(--accent-soft, #eeedf9);--cg-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);--cg-teal: #0d8579;--cg-teal-soft: #e6f4f2;--cg-warm: #bf6528;--cg-warm-soft: #fbefe6;--cg-violet: #7348d0;--cg-violet-soft: #f2edfc;--cg-rose: #c4415a;--cg-rose-soft: #fbebee;--cg-slate: #526476;--cg-slate-soft: #edf1f4;color:var(--cg-text);font-family:inherit;font-size:14px;line-height:1.7;padding:8px 0;container-type:inline-size}:root[data-theme=dark] .sb-block.cg-block,[data-theme=dark] .sb-block.cg-block{--cg-teal: #4fc4b6;--cg-teal-soft: #163734;--cg-warm: #e79c64;--cg-warm-soft: #3b2b1e;--cg-violet: #b497ff;--cg-violet-soft: #2e2648;--cg-rose: #f0839a;--cg-rose-soft: #3e222a;--cg-slate: #a2b2c2;--cg-slate-soft: #242d35}.sb-block.cg-block *{box-sizing:border-box}.sb-block.cg-block .cg-tone-brand{--tone: var(--cg-accent);--tone-soft: var(--cg-accent-soft)}.sb-block.cg-block .cg-tone-teal{--tone: var(--cg-teal);--tone-soft: var(--cg-teal-soft)}.sb-block.cg-block .cg-tone-warm{--tone: var(--cg-warm);--tone-soft: var(--cg-warm-soft)}.sb-block.cg-block .cg-tone-violet{--tone: var(--cg-violet);--tone-soft: var(--cg-violet-soft)}.sb-block.cg-block .cg-tone-rose{--tone: var(--cg-rose);--tone-soft: var(--cg-rose-soft)}.sb-block.cg-block .cg-tone-slate{--tone: var(--cg-slate);--tone-soft: var(--cg-slate-soft)}.sb-block.cg-block .cg-heading{margin:0 0 10px;font-size:17px;font-weight:700}.sb-block.cg-block .cg-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.sb-block.cg-block .cg-grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(var(--cg-columns, 3),minmax(0,1fr));gap:12px}.sb-block.cg-block .cg-item{display:flex;min-width:0;margin:0}.sb-block.cg-block .cg-card{position:relative;flex:1;min-width:0;display:flex;color:inherit;text-decoration:none;border:1px solid var(--cg-line);border-radius:10px;background:transparent;overflow-wrap:anywhere;transition:border-color .15s,background-color .15s}.sb-block.cg-block .cg-card.is-link{cursor:pointer}.sb-block.cg-block .cg-card.is-link:hover{border-color:color-mix(in srgb,var(--tone) 45%,var(--cg-line));background:var(--cg-surface)}.sb-block.cg-block .cg-card:focus-visible{outline:2px solid var(--cg-accent);outline-offset:2px}.sb-block.cg-block .cg-icon{flex:none;display:inline-grid;place-items:center;width:34px;height:34px;border-radius:8px;background:var(--tone-soft);font-size:17px;line-height:1;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}.sb-block.cg-block .cg-tag{flex:none;display:inline-block;font-size:11.5px;line-height:1;font-weight:600;color:var(--tone);background:var(--tone-soft);border-radius:4px;padding:4px 7px;white-space:nowrap}.sb-block.cg-block .cg-title{display:flex;align-items:center;gap:6px;min-width:0;font-size:16px;line-height:1.45;font-weight:600}.sb-block.cg-block .cg-body{display:block;font-size:13.5px;line-height:1.7;color:var(--cg-muted)}.sb-block.cg-block .cg-body strong{color:var(--cg-text);font-weight:600}.sb-block.cg-block .cg-body code{font-family:var(--cg-mono);font-size:.86em;color:var(--cg-text);background:var(--cg-surface);border:1px solid var(--cg-line);border-radius:4px;padding:0 4px;word-break:break-all}.sb-block.cg-block .cg-body a{color:var(--cg-accent);text-decoration:none;border-bottom:1px solid color-mix(in srgb,var(--cg-accent) 35%,transparent)}.sb-block.cg-block .cg-arrow{flex:none;width:15px;height:15px;fill:none;stroke:var(--tone);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:translate(-4px);transition:opacity .15s,transform .15s}.sb-block.cg-block .cg-card.is-link:hover .cg-arrow,.sb-block.cg-block .cg-card.is-link:focus-visible .cg-arrow{opacity:1;transform:none}@media(hover:none){.sb-block.cg-block .cg-arrow{opacity:.7;transform:none}}.sb-block.cg-block.cg-tile .cg-card{flex-direction:column;padding:18px 18px 16px}.sb-block.cg-block .cg-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:14px}.sb-block.cg-block.cg-tile .cg-body{margin-top:4px}.sb-block.cg-block.cg-row .cg-grid{gap:8px}.sb-block.cg-block.cg-row .cg-card{align-items:center;gap:14px;padding:12px 16px 12px 12px}.sb-block.cg-block.cg-row .cg-icon{width:36px;height:36px}.sb-block.cg-block.cg-row .cg-card:not(:has(.cg-icon)){padding-left:16px}.sb-block.cg-block .cg-text{flex:1;min-width:0;display:block}.sb-block.cg-block.cg-row .cg-title{font-size:15px;line-height:1.5;flex-wrap:wrap;gap:4px 8px}.sb-block.cg-block.cg-row .cg-tag{font-size:11px;padding:3px 6px}.sb-block.cg-block.cg-row .cg-body{font-size:13px;line-height:1.6}.sb-block.cg-block.cg-row .cg-arrow{opacity:.35;transform:none;stroke:var(--cg-faint)}.sb-block.cg-block.cg-row .cg-card.is-link:hover .cg-arrow,.sb-block.cg-block.cg-row .cg-card.is-link:focus-visible .cg-arrow{opacity:1;stroke:var(--tone);transform:translate(2px)}@container (max-width: 820px){.sb-block.cg-block[data-columns="4"] .cg-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@container (max-width: 560px){.sb-block.cg-block .cg-grid{grid-template-columns:minmax(0,1fr)}.sb-block.cg-block.cg-tile .cg-card{padding:14px 16px}.sb-block.cg-block.cg-tile .cg-card:has(.cg-icon){display:grid;grid-template-columns:34px minmax(0,1fr);grid-template-areas:"icon title" "icon body";column-gap:14px;align-items:start}.sb-block.cg-block.cg-tile .cg-card:has(.cg-icon) .cg-top{display:contents}.sb-block.cg-block.cg-tile .cg-card:has(.cg-icon) .cg-icon{grid-area:icon;margin-top:2px}.sb-block.cg-block.cg-tile .cg-card:has(.cg-icon) .cg-title{grid-area:title}.sb-block.cg-block.cg-tile .cg-card:has(.cg-icon) .cg-body{grid-area:body;margin-top:2px}.sb-block.cg-block.cg-tile .cg-card:has(.cg-icon) .cg-tag{position:absolute;top:15px;right:14px}.sb-block.cg-block.cg-tile .cg-card:has(.cg-icon):has(.cg-tag) .cg-title{padding-right:64px}.sb-block.cg-block.cg-tile .cg-top{margin-bottom:10px}}@media(prefers-reduced-motion:reduce){.sb-block.cg-block *{transition:none!important}}@media print{.sb-block.cg-block .cg-item{break-inside:avoid}.sb-block.cg-block .cg-arrow{display:none}.sb-block.cg-block.cg-row .cg-card.is-link{flex-wrap:wrap}.sb-block.cg-block .cg-card.is-link[href^=http]:after,.sb-block.cg-block .cg-card.is-link[href^="mailto:"]:after{content:attr(href);flex-basis:100%;color:var(--cg-faint);font-size:11px;overflow-wrap:anywhere}}
2
+ `);var u=x("cardGrid",{"zh-CN":{title:"\u5361\u7247\u5BFC\u822A",opensInNewTab:"\uFF08\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00\uFF09"},en:{title:"Card grid",opensInNewTab:"(opens in a new tab)"}});var c=g(p(),1),y=()=>(0,c.jsx)("svg",{className:"cg-arrow",viewBox:"0 0 16 16","aria-hidden":"true",children:(0,c.jsx)("path",{d:"M3.5 8h9M8.5 4l4 4-4 4"})});function z({card:t,tile:s,linked:o}){let l=(0,c.jsx)("span",{className:"cg-body",children:(0,c.jsx)(w,{source:t.body,links:!o})}),a=t.icon&&(0,c.jsx)("span",{className:"cg-icon","aria-hidden":"true",children:t.icon}),e=t.tag&&(0,c.jsx)("span",{className:"cg-tag",children:(0,c.jsx)(n,{text:t.tag,focusable:!o})});return s?(0,c.jsxs)(c.Fragment,{children:[(a||e)&&(0,c.jsxs)("span",{className:"cg-top",children:[a||(0,c.jsx)("span",{}),e]}),(0,c.jsxs)("span",{className:"cg-title",children:[(0,c.jsx)("span",{children:(0,c.jsx)(n,{text:t.title,focusable:!o})}),o&&(0,c.jsx)(y,{})]}),l]}):(0,c.jsxs)(c.Fragment,{children:[a,(0,c.jsxs)("span",{className:"cg-text",children:[(0,c.jsxs)("span",{className:"cg-title",children:[(0,c.jsx)("span",{children:(0,c.jsx)(n,{text:t.title,focusable:!o})}),e]}),l]}),o&&(0,c.jsx)(y,{})]})}function A({data:t}){let s=h(u),o=t,l=o.variant==="row"?"row":"tile",a=m(o);return(0,c.jsxs)("section",{className:`sb-block cg-block cg-${l}`,"aria-label":v(o.title,s("title")),"data-columns":a,style:{"--cg-columns":a},children:[o.title&&(0,c.jsx)("h3",{className:"cg-heading",children:(0,c.jsx)(n,{text:o.title})}),(0,c.jsx)("ul",{className:"cg-grid",children:o.cards.map((e,N)=>{let C=f.includes(e.tone)?e.tone:"brand",r=e.href&&d(e.href)?e.href:null,i=(0,c.jsx)(z,{card:e,tile:l==="tile",linked:!!r});return(0,c.jsx)("li",{className:`cg-item cg-tone-${C}`,children:r&&k(r)?(0,c.jsxs)("a",{className:"cg-card is-link",href:r,target:"_blank",rel:"noopener noreferrer",children:[i,(0,c.jsx)("span",{className:"cg-hidden",children:s("opensInNewTab")})]}):r?(0,c.jsx)("a",{className:"cg-card is-link",href:r,children:i}):(0,c.jsx)("div",{className:"cg-card",children:i})},N)})})]})}export{A as CardGridBlock};
@@ -0,0 +1,3 @@
1
+ import{a as F}from"./chunk-L2ZHJIET.js";import{a as M}from"./chunk-M5RCHTSV.js";import{d as G,e as _,f as I}from"./chunk-BZT4BVM4.js";import"./chunk-UNH6G7NO.js";import{b as U,d as V}from"./chunk-7K7GQKOA.js";import{Ab as O,a as P,c as tr,mb as Z}from"./chunk-WRXJZR6G.js";import{a as j}from"./chunk-J6IRWTF7.js";import{c as E}from"./chunk-DCANE7XH.js";var b=E(tr(),1);P(`.sb-block.cr-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.cr-block li:not(svg){padding:0}.sb-block.cr-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.cr-block{--cr-text: var(--text, #222222);--cr-muted: var(--muted, #6a6a6a);--cr-faint: var(--subtle, #929292);--cr-line: var(--line, #dddddd);--cr-paper: var(--paper, #ffffff);--cr-surface: var(--surface, #fafafa);--cr-hover: var(--hover, #f7f7f7);--cr-accent: var(--accent, #120a8f);--cr-accent-soft: var(--accent-soft, #eeedf9);--cr-mark: #f3d9a4;--cr-mono: var(--font-mono, ui-monospace, monospace);color:var(--cr-text);font-family:inherit;font-size:14px;line-height:1.7;padding:8px 0;container-type:inline-size}:root[data-theme=dark] .sb-block.cr-block,[data-theme=dark] .sb-block.cr-block{--cr-mark: #5c4520}.sb-block.cr-block *{box-sizing:border-box}.sb-block.cr-block .cr-head{margin-bottom:12px}.sb-block.cr-block .cr-heading{margin:0;font-size:17px;font-weight:700}.sb-block.cr-block .cr-sub{margin:2px 0 0;color:var(--cr-muted);font-size:13px}.sb-block.cr-block strong{font-weight:650}.sb-block.cr-block a{color:var(--cr-accent);text-decoration:none;border-bottom:1px solid color-mix(in srgb,var(--cr-accent) 35%,transparent)}.sb-block.cr-block a:hover{border-bottom-color:var(--cr-accent)}.sb-block.cr-block mark{background:var(--cr-mark);color:inherit;border-radius:2px;padding:0}.sb-block.cr-block .cr-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);margin:0}.sb-block.cr-block .cr-search{display:flex;align-items:center;gap:8px;height:42px;padding:0 8px 0 13px;border:1px solid var(--cr-line);border-radius:8px;background:var(--cr-surface);transition:border-color .15s}.sb-block.cr-block .cr-search:focus-within{border-color:var(--cr-accent);outline:2px solid color-mix(in srgb,var(--cr-accent) 22%,transparent);outline-offset:1px}.sb-block.cr-block .cr-glass{flex:none;width:16px;height:16px;fill:none;stroke:var(--cr-muted);stroke-width:1.5;stroke-linecap:round}.sb-block.cr-block .cr-search input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:0;background:transparent;color:var(--cr-text);font:inherit;font-size:14px}.sb-block.cr-block .cr-search input::placeholder{color:var(--cr-faint)}.sb-block.cr-block .cr-search input::-webkit-search-cancel-button{display:none}.sb-block.cr-block .cr-total{flex:none;padding-right:6px;font-size:12px;color:var(--cr-faint);font-variant-numeric:tabular-nums}.sb-block.cr-block .cr-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--cr-muted);cursor:pointer}.sb-block.cr-block .cr-clear:hover{background:var(--cr-hover);color:var(--cr-text)}.sb-block.cr-block .cr-clear svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}.sb-block.cr-block .cr-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}.sb-block.cr-block .cr-chips button,.sb-block.cr-block .cr-emptyactions button{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border:1px solid var(--cr-line);border-radius:6px;background:transparent;color:var(--cr-text);font:inherit;font-size:12.5px;line-height:1;white-space:nowrap;cursor:pointer}.sb-block.cr-block .cr-chips button span{font-size:11px;color:var(--cr-faint);font-variant-numeric:tabular-nums}.sb-block.cr-block .cr-chips button:hover,.sb-block.cr-block .cr-emptyactions button:hover{background:var(--cr-hover)}.sb-block.cr-block .cr-chips button[aria-pressed=true]{background:var(--cr-accent-soft);border-color:color-mix(in srgb,var(--cr-accent) 30%,transparent);color:var(--cr-accent);font-weight:650}.sb-block.cr-block .cr-chips button[aria-pressed=true] span{color:var(--cr-accent);opacity:.75}.sb-block.cr-block .cr-chips button.is-zero{color:var(--cr-faint)}.sb-block.cr-block button:focus-visible{outline:2px solid var(--cr-accent);outline-offset:2px}.sb-block.cr-block .cr-list{margin-top:14px;border:1px solid var(--cr-line);border-radius:10px;overflow:hidden}.sb-block.cr-block .cr-section+.cr-section{border-top:1px solid var(--cr-line)}.sb-block.cr-block .cr-grouphead{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:8px 16px;background:var(--cr-surface);border-bottom:1px solid var(--cr-line);font-size:12px;font-weight:650;letter-spacing:.04em;color:var(--cr-muted);line-height:1.5}.sb-block.cr-block .cr-groupcount{font-weight:400;letter-spacing:0;color:var(--cr-faint);font-variant-numeric:tabular-nums}.sb-block.cr-block .cr-section ul{list-style:none;margin:0;padding:0}.sb-block.cr-block .cr-item+.cr-item{border-top:1px solid var(--cr-line)}.sb-block.cr-block .cr-item.is-open{background:var(--cr-surface)}.sb-block.cr-block .cr-row{display:flex;align-items:flex-start;gap:12px;width:100%;padding:12px 16px;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.sb-block.cr-block .cr-row[data-static]{cursor:default}.sb-block.cr-block .cr-row:hover{background:var(--cr-hover)}.sb-block.cr-block .cr-row[data-static]:hover{background:none}.sb-block.cr-block .cr-row:focus-visible{outline-offset:-2px;border-radius:6px}.sb-block.cr-block .cr-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}.sb-block.cr-block .cr-cmd{display:block;padding:0;border-radius:0;background:none;color:inherit;font-family:var(--cr-mono);font-size:13px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.sb-block.cr-block .cr-cmd>span{white-space:nowrap}.sb-block.cr-block .cr-cmd>span.is-long{white-space:normal}.sb-block.cr-block .cr-verb{font-weight:700}.sb-block.cr-block .cr-prog,.sb-block.cr-block .cr-ph,.sb-block.cr-block .cr-arg{color:var(--cr-muted)}.sb-block.cr-block .cr-prog{color:var(--cr-faint)}.sb-block.cr-block .cr-summary{font-size:13px;line-height:1.55;color:var(--cr-muted)}.sb-block.cr-block .cr-paramhits{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px;margin-top:2px;font-size:11.5px;color:var(--cr-faint)}.sb-block.cr-block .cr-chev{flex:none;width:12px;height:12px;margin-top:6px;fill:none;stroke:var(--cr-faint);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s}.sb-block.cr-block .cr-row:hover .cr-chev{stroke:var(--cr-muted)}.sb-block.cr-block .is-open .cr-chev{transform:rotate(180deg)}.sb-block.cr-block .cr-more{display:flex;align-items:center;gap:6px;width:100%;padding:9px 16px;border:0;border-top:1px solid var(--cr-line);background:none;font:inherit;font-size:12.5px;color:var(--cr-accent);text-align:left;cursor:pointer}.sb-block.cr-block .cr-more:hover{background:var(--cr-hover)}.sb-block.cr-block .cr-more:focus-visible{outline-offset:-2px}.sb-block.cr-block .cr-more svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.sb-block.cr-block .cr-detail{padding:0 16px 18px;margin-right:24px}.sb-block.cr-block .cr-detail[hidden]{display:none}.sb-block.cr-block .cr-para{margin:8px 0 0;font-size:13.5px;line-height:1.75}.sb-block.cr-block ul.cr-para{padding-left:18px}.sb-block.cr-block .cr-params{width:100%;border-collapse:collapse;margin-top:12px;font-size:13px}.sb-block.cr-block .cr-params thead th{padding:0 0 6px;font-size:11.5px;font-weight:500;color:var(--cr-faint);text-align:left;border-bottom:1px solid var(--cr-line)}.sb-block.cr-block .cr-params tbody th,.sb-block.cr-block .cr-params tbody td{padding:8px 0;border-bottom:1px solid var(--cr-line);vertical-align:top;text-align:left;line-height:1.6}.sb-block.cr-block .cr-params tbody th{width:1%;padding-right:20px;white-space:nowrap;font-weight:400}.sb-block.cr-block .cr-params tbody th code{font-size:12.5px;background:none;border:0;padding:0}.sb-block.cr-block .cr-detail .sg-code{margin-top:14px}.sb-block.cr-block .cr-summary code,.sb-block.cr-block .cr-detail :not(pre)>code,.sb-block.cr-block .cr-paramhits code,.sb-block.cr-block .cr-emptyhint code{font-family:var(--cr-mono);font-size:.9em;background:var(--cr-surface);border:1px solid var(--cr-line);border-radius:4px;padding:0 4px;overflow-wrap:anywhere}.sb-block.cr-block .cr-empty{margin-top:14px;padding:34px 20px 30px;border:1px solid var(--cr-line);border-radius:10px;text-align:center}.sb-block.cr-block .cr-empty svg{width:40px;height:40px;fill:none;stroke:var(--cr-faint);stroke-width:1.6;stroke-linecap:round}.sb-block.cr-block .cr-emptytitle{margin:8px 0 0;font-size:14.5px;font-weight:500;overflow-wrap:anywhere}.sb-block.cr-block .cr-emptyhint{margin:4px 0 0;font-size:12.5px;color:var(--cr-muted)}.sb-block.cr-block .cr-emptyactions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:14px}.sb-block.cr-block .cr-emptyactions:empty{display:none}@container (max-width: 640px){.sb-block.cr-block .cr-row{padding:11px 12px;gap:8px}.sb-block.cr-block .cr-total{display:none}.sb-block.cr-block .cr-detail{padding:0 12px 16px;margin-right:0}.sb-block.cr-block .cr-grouphead{padding:8px 12px}.sb-block.cr-block .cr-cmd{font-size:12.5px}.sb-block.cr-block .cr-params,.sb-block.cr-block .cr-params tbody,.sb-block.cr-block .cr-params tr,.sb-block.cr-block .cr-params tbody th,.sb-block.cr-block .cr-params tbody td{display:block;width:auto}.sb-block.cr-block .cr-params thead{display:none}.sb-block.cr-block .cr-params tr{padding:8px 0;border-bottom:1px solid var(--cr-line)}.sb-block.cr-block .cr-params tbody th,.sb-block.cr-block .cr-params tbody td{padding:0;border:0;white-space:normal}}@media(prefers-reduced-motion:reduce){.sb-block.cr-block *,.sb-block.cr-block *:after{transition:none!important}}@media print{.sb-block.cr-block .cr-search,.sb-block.cr-block .cr-chips,.sb-block.cr-block .cr-more,.sb-block.cr-block .cr-chev,.sb-block.cr-block .cr-emptyactions{display:none}.sb-block.cr-block .cr-item[hidden],.sb-block.cr-block .cr-detail[hidden]{display:block}.sb-block.cr-block .cr-list{border:0}.sb-block.cr-block .cr-item,.sb-block.cr-block .cr-section{break-inside:avoid}}
2
+ `);var Q=j("commandReference",{"zh-CN":{title:"\u547D\u4EE4\u53C2\u8003",placeholder:"\u641C\u7D22\u547D\u4EE4\u3001\u53C2\u6570\u6216\u7528\u9014",search:"\u641C\u7D22\u547D\u4EE4",clear:"\u6E05\u9664\u641C\u7D22",total:"{count} \u6761\u547D\u4EE4",found:"\u627E\u5230 {count} \u6761\u547D\u4EE4",filter:"\u6309\u5206\u7EC4\u7B5B\u9009",all:"\u5168\u90E8",params:"\u53C2\u6570",paramName:"\u53C2\u6570",paramMeaning:"\u8BF4\u660E",example:"\u793A\u4F8B",exampleName:"{command} \u7684\u793A\u4F8B",groupCount:"{shown} / {total}",showMore:"\u663E\u793A\u5176\u4F59 {count} \u6761{group}\u547D\u4EE4",noMatch:"\u6CA1\u6709\u4E0E\u300C{query}\u300D\u5339\u914D\u7684\u547D\u4EE4",noMatchIn:"\u6CA1\u6709\u4E0E\u300C{query}\u300D\u5339\u914D\u7684\u547D\u4EE4\uFF08{group}\uFF09",emptyGroup:"\u300C{group}\u300D\u4E2D\u6CA1\u6709\u547D\u4EE4",emptyHint:"\u8BD5\u8BD5\u66F4\u77ED\u7684\u5173\u952E\u8BCD\uFF0C\u6216\u641C\u7D22\u53C2\u6570\u540D\u3002",viewAll:"\u5728\u5168\u90E8\u5206\u7EC4\u4E2D\u67E5\u770B\uFF08{count} \u6761\uFF09"},en:{title:"Command reference",placeholder:"Search commands, parameters or purposes",search:"Search commands",clear:"Clear search",total:{one:"{count} command",other:"{count} commands"},found:{one:"{count} command found",other:"{count} commands found"},filter:"Filter by group",all:"All",params:"Parameters",paramName:"Parameter",paramMeaning:"Meaning",example:"Example",exampleName:"example of {command}",groupCount:"{shown} / {total}",showMore:"Show {count} more in {group}",noMatch:"No command matches \u201C{query}\u201D",noMatchIn:"No command matches \u201C{query}\u201D in {group}",emptyGroup:"{group} has no commands",emptyHint:"Try a shorter keyword, or search for a parameter name.",viewAll:"View in all groups ({count})"}});var r=E(Z(),1),g="\0all",T=6;function J(l,c,t=0,m=l.length,s="h"){let n=[],d=t,i=0;for(let[f,y]of c){if(y<=d||f>=m)continue;let x=Math.max(f,d),v=Math.min(y,m);x>d&&n.push(l.slice(d,x)),n.push((0,r.jsx)("mark",{children:l.slice(x,v)},`${s}${i++}`)),d=v}return d<m&&n.push(l.slice(d,m)),n}var ar=l=>l.length?(c,t)=>(0,r.jsx)("span",{children:J(c,I(c,l),0,c.length,t)},t):void 0;function nr({text:l,terms:c,program:t}){let m=I(l,c),s=[],n=/\S+/g,d,i=0,f=!0,y=!1,x=!0,v=0;for(;d=n.exec(l);){let u=d[0],w=d.index,k=w+u.length;w>i&&s.push(l.slice(i,w));let h;f&&t&&u===t?h="prog":!y&&/^[A-Za-z_][\w.-]*$/.test(u)&&!/^[A-Z][A-Z0-9_]*$/.test(u)?(h="verb",y=!0,/[_.]/.test(u)&&(x=!1)):x&&/^[a-z][a-z0-9-]*$/.test(u)?h="verb":(x=!1,h=/^\[?-{1,2}[A-Za-z]/.test(u)?"flag":/^[[<(]?[A-Z][A-Z0-9_]*(?:[|,.][A-Z0-9_]+)*[\]>)]?\]?$|^[[<].*[\]>]$/.test(u)?"ph":"arg"),f=!1,s.push((0,r.jsx)("span",{className:`cr-${h}${u.length>32?" is-long":""}`,children:J(l,m,w,k,`t${v}.`)},v)),v++,i=k}return i<l.length&&s.push(l.slice(i)),(0,r.jsx)("code",{className:"cr-cmd",children:s})}function lr({source:l}){return(0,r.jsx)(r.Fragment,{children:l.trim().split(/\n\s*\n/).map((c,t)=>{let m=c.split(`
3
+ `);return m.every(s=>/^\s*[-•]\s+/.test(s))?(0,r.jsx)("ul",{className:"cr-para",children:m.map((s,n)=>(0,r.jsx)("li",{children:(0,r.jsx)(M,{source:s.replace(/^\s*[-•]\s+/,"")})},n))},t):(0,r.jsx)("p",{className:"cr-para",children:m.map((s,n)=>(0,r.jsxs)("span",{children:[n>0&&(0,r.jsx)("br",{}),(0,r.jsx)(M,{source:s})]},n))},t)})})}function xr({data:l}){let c=O(Q),t=l,m=(0,b.useId)(),s=(0,b.useMemo)(()=>t.commands.map((e,a)=>({...e,key:e.id??`#${a}`})),[t.commands]),[n,d]=(0,b.useState)(""),[i,f]=(0,b.useState)(g),[y,x]=(0,b.useState)(()=>new Set),[v,u]=(0,b.useState)(()=>new Set),w=(0,b.useDeferredValue)(n),k=(0,b.useMemo)(()=>G(w),[w]),h=ar(k),$=(0,b.useRef)(null),B=(0,b.useRef)(null),z=(0,b.useMemo)(()=>k.length?s.filter(e=>_(e,k)):s,[s,k]),A=t.groups.map(e=>({...e,total:s.filter(a=>a.group===e.id).length,items:z.filter(a=>a.group===e.id)})),L=A.filter(e=>(i===g||e.id===i)&&e.items.length),W=L.reduce((e,a)=>e+a.items.length,0),R=A.find(e=>e.id===i)?.label,X=L.length>1||i===g,Y=(e,a)=>i===g&&!k.length&&!v.has(e)&&a>T+2,rr=e=>x(a=>{let o=new Set(a);return o.has(e)?o.delete(e):o.add(e),o}),D=()=>{d(""),$.current?.focus()},H=()=>[...B.current?.querySelectorAll(".cr-row:not([hidden] *)")??[]],er=e=>{if(e.key==="Escape"&&n&&(e.preventDefault(),d("")),e.key==="ArrowDown"){let a=H()[0];if(!a)return;e.preventDefault(),a.focus()}},or=e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;let a=H(),o=a.indexOf(document.activeElement);o<0||(e.preventDefault(),e.key==="ArrowUp"&&o===0?$.current?.focus():a[Math.max(0,Math.min(a.length-1,o+(e.key==="ArrowDown"?1:-1)))]?.focus())};return(0,r.jsxs)("section",{className:"sb-block cr-block","aria-label":V(t.title,c("title")),children:[(t.title||t.description)&&(0,r.jsxs)("div",{className:"cr-head",children:[t.title&&(0,r.jsx)("h3",{className:"cr-heading",children:(0,r.jsx)(U,{text:t.title})}),t.description&&(0,r.jsx)("p",{className:"cr-sub",children:(0,r.jsx)(M,{source:t.description})})]}),(0,r.jsxs)("div",{className:"cr-search",children:[(0,r.jsxs)("svg",{className:"cr-glass",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"7",cy:"7",r:"4.6"}),(0,r.jsx)("path",{d:"M10.4 10.4l3.3 3.3"})]}),(0,r.jsx)("input",{ref:$,type:"search",value:n,placeholder:t.placeholder??c("placeholder"),"aria-label":c("search"),"aria-controls":`${m}-list`,spellCheck:!1,autoComplete:"off",onChange:e=>d(e.currentTarget.value),onKeyDown:er}),n?(0,r.jsx)("button",{type:"button",className:"cr-clear",onClick:D,"aria-label":c("clear"),children:(0,r.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M5 5l6 6M11 5l-6 6"})})}):(0,r.jsx)("span",{className:"cr-total",children:c("total",{count:s.length})})]}),(0,r.jsx)("p",{className:"cr-status",role:"status",children:k.length?c("found",{count:z.length}):""}),(0,r.jsxs)("div",{className:"cr-chips",role:"group","aria-label":c("filter"),children:[(0,r.jsxs)("button",{type:"button","aria-pressed":i===g,onClick:()=>f(g),children:[c("all"),(0,r.jsx)("span",{children:z.length})]}),A.map(e=>(0,r.jsxs)("button",{type:"button","aria-pressed":i===e.id,className:e.items.length?void 0:"is-zero",onClick:()=>f(a=>a===e.id?g:e.id),children:[e.label,(0,r.jsx)("span",{children:e.items.length})]},e.id))]}),W?(0,r.jsx)("div",{className:"cr-list",id:`${m}-list`,ref:B,onKeyDown:or,children:L.map(e=>{let a=Y(e.id,e.items.length);return(0,r.jsxs)("section",{className:"cr-section","aria-label":e.label,children:[X&&(0,r.jsxs)("div",{className:"cr-grouphead",children:[(0,r.jsx)("span",{children:e.label}),(0,r.jsx)("span",{className:"cr-groupcount",children:k.length?c("groupCount",{shown:e.items.length,total:e.total}):e.total})]}),(0,r.jsx)("ul",{children:e.items.map((o,cr)=>{let S=y.has(o.key),q=`${m}-d${o.key}`,N=!!(o.detail||o.params?.length||o.examples?.length),K=k.length?(o.params??[]).filter(p=>k.some(C=>!o.command.toLowerCase().includes(C)&&!o.summary.toLowerCase().includes(C)&&`${p.name} ${p.meaning}`.toLowerCase().includes(C))):[];return(0,r.jsxs)("li",{className:`cr-item${S?" is-open":""}`,hidden:a&&cr>=T,children:[(0,r.jsxs)("button",{type:"button",className:"cr-row","aria-expanded":N?S:void 0,"aria-controls":N?q:void 0,"data-static":N?void 0:"",onClick:()=>N&&rr(o.key),children:[(0,r.jsxs)("span",{className:"cr-main",children:[(0,r.jsx)(nr,{text:o.command,terms:k,program:t.program}),(0,r.jsx)("span",{className:"cr-summary",children:(0,r.jsx)(M,{source:o.summary,mark:h,links:!1})}),K.length>0&&(0,r.jsxs)("span",{className:"cr-paramhits",children:[c("params"),K.slice(0,4).map(p=>(0,r.jsx)("code",{children:h?h(p.name,p.name):p.name},p.name))]})]}),N&&(0,r.jsx)("svg",{className:"cr-chev",viewBox:"0 0 12 12","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M3 4.75L6 7.75 9 4.75"})})]}),N&&(0,r.jsxs)("div",{className:"cr-detail",id:q,hidden:!S,children:[o.detail&&(0,r.jsx)("div",{className:"cr-body",children:(0,r.jsx)(lr,{source:o.detail})}),o.params&&o.params.length>0&&(0,r.jsxs)("table",{className:"cr-params",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{scope:"col",children:c("paramName")}),(0,r.jsx)("th",{scope:"col",children:c("paramMeaning")})]})}),(0,r.jsx)("tbody",{children:o.params.map(p=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{scope:"row",children:(0,r.jsx)("code",{children:h?h(p.name,p.name):p.name})}),(0,r.jsx)("td",{children:(0,r.jsx)(M,{source:p.meaning})})]},p.name))})]}),o.examples&&o.examples.length>0&&(0,r.jsx)(F,{variants:o.examples.map((p,C)=>({label:p.label??(o.examples.length>1?`${c("example")} ${C+1}`:c("example")),code:p.code})),name:c("exampleName",{command:o.command})})]})]},o.key)})}),a&&(0,r.jsxs)("button",{type:"button",className:"cr-more",onClick:()=>u(o=>new Set(o).add(e.id)),children:[c("showMore",{count:e.items.length-T,group:e.label}),(0,r.jsx)("svg",{viewBox:"0 0 12 12","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M3 4.75L6 7.75 9 4.75"})})]})]},e.id)})}):(0,r.jsxs)("div",{className:"cr-empty",children:[(0,r.jsxs)("svg",{viewBox:"0 0 40 40","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"18",cy:"18",r:"10"}),(0,r.jsx)("path",{d:"M25.5 25.5l7 7"}),(0,r.jsx)("path",{d:"M14 18h8"})]}),(0,r.jsx)("p",{className:"cr-emptytitle",children:n.trim()?i!==g&&R?c("noMatchIn",{query:n.trim(),group:R}):c("noMatch",{query:n.trim()}):c("emptyGroup",{group:R??""})}),(0,r.jsx)("p",{className:"cr-emptyhint",children:c("emptyHint")}),(0,r.jsxs)("div",{className:"cr-emptyactions",children:[i!==g&&z.length>0&&(0,r.jsx)("button",{type:"button",onClick:()=>f(g),children:c("viewAll",{count:z.length})}),n&&(0,r.jsx)("button",{type:"button",onClick:D,children:c("clear")})]})]})]})}export{xr as CommandReferenceBlock};
@@ -1,4 +1,4 @@
1
- import{b as R,c as xe,d as ye}from"./chunk-GABDVURY.js";import"./chunk-NLCSXEUT.js";import{b as x,j as Q}from"./chunk-SNEZ3O5V.js";import{d as ke,e as Ae}from"./chunk-PTZCSSDG.js";import"./chunk-5AW2WUSZ.js";import{e as Le,g as S}from"./chunk-7K7GQKOA.js";import{Ab as ve,Db as Se,L as me,a as pe,c as dt,ib as ue,mb as ge}from"./chunk-WRXJZR6G.js";import{a as be,f as we}from"./chunk-J6IRWTF7.js";import{c as K}from"./chunk-DCANE7XH.js";var u=K(dt(),1);var Ee={html:`<!DOCTYPE html>
1
+ import{a as xe,b as ye}from"./chunk-VSZNYGH7.js";import{b as R}from"./chunk-KQR52I3G.js";import{b as x,j as Q}from"./chunk-SNEZ3O5V.js";import{d as ke,e as Ae}from"./chunk-PTZCSSDG.js";import"./chunk-5AW2WUSZ.js";import{e as Le,g as S}from"./chunk-7K7GQKOA.js";import{Ab as ve,Db as Se,L as me,a as pe,c as dt,ib as ue,mb as ge}from"./chunk-WRXJZR6G.js";import{a as be,f as we}from"./chunk-J6IRWTF7.js";import{c as K}from"./chunk-DCANE7XH.js";var u=K(dt(),1);var Ee={html:`<!DOCTYPE html>
2
2
  <html lang="en" data-theme="dark" data-preset="[VISUAL PRESET]">
3
3
  <head>
4
4
  <meta charset="UTF-8">
@@ -1,4 +1,4 @@
1
- import{a as st,b as Tn,e as On,g as Ko,h as Go,i as Vt,j as Uo,k as Qo,l as at,o as jo,p as Jo,q as $n}from"./chunk-P5ET5XMK.js";import{a as Ho,b as Lo,c as Yo,d as Xo}from"./chunk-KYWOOES7.js";import{d as Vo,e as Fo}from"./chunk-PTZCSSDG.js";import{b as Il}from"./chunk-JAQUAFGK.js";import"./chunk-5AW2WUSZ.js";import{d as Zo,e as Wo,f as qo}from"./chunk-7K7GQKOA.js";import{Ab as Me,B as zo,C as Po,Ca as To,Da as Oo,Ia as $o,a as Bt,c as Dn,lb as Ro,mb as An,nb as Ml,qa as Do,ta as Ao}from"./chunk-WRXJZR6G.js";import{a as Bo}from"./chunk-J6IRWTF7.js";import{c as Te}from"./chunk-DCANE7XH.js";var oe=Te(Dn(),1);var z=Te(An()),P=Te(Dn());function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ft="http://www.w3.org/1999/xhtml",Rn={svg:"http://www.w3.org/2000/svg",xhtml:Ft,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ie(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function zl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ft&&t.documentElement.namespaceURI===Ft?t.createElement(e):t.createElementNS(n,e)}}function Pl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yt(e){var t=Ie(e);return(t.local?Pl:zl)(t)}function Dl(){}function Ke(e){return e==null?Dl:function(){return this.querySelector(e)}}function er(e){typeof e!="function"&&(e=Ke(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function Hn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Al(){return[]}function kt(e){return e==null?Al:function(){return this.querySelectorAll(e)}}function Tl(e){return function(){return Hn(e.apply(this,arguments))}}function tr(e){typeof e=="function"?e=Tl(e):e=kt(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function _t(e){return function(){return this.matches(e)}}function Xt(e){return function(t){return t.matches(e)}}var Ol=Array.prototype.find;function $l(e){return function(){return Ol.call(this.children,e)}}function Rl(){return this.firstElementChild}function nr(e){return this.select(e==null?Rl:$l(typeof e=="function"?e:Xt(e)))}var Hl=Array.prototype.filter;function Ll(){return Array.from(this.children)}function Bl(e){return function(){return Hl.call(this.children,e)}}function or(e){return this.selectAll(e==null?Ll:Bl(typeof e=="function"?e:Xt(e)))}function rr(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Zt(e){return new Array(e.length)}function ir(){return new le(this._enter||this._groups.map(Zt),this._parents)}function St(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}St.prototype={constructor:St,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 sr(e){return function(){return e}}function Vl(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new St(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Fl(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,f=i.length,d=new Array(u),p;for(a=0;a<u;++a)(c=t[a])&&(d[a]=p=s.call(c,c.__data__,a,t)+"",l.has(p)?r[a]=c:l.set(p,c));for(a=0;a<f;++a)p=s.call(e,i[a],a,i)+"",(c=l.get(p))?(o[a]=c,c.__data__=i[a],l.delete(p)):n[a]=new St(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Yl(e){return e.__data__}function ar(e,t){if(!arguments.length)return Array.from(this,Yl);var n=t?Fl:Vl,o=this._parents,r=this._groups;typeof e!="function"&&(e=sr(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],f=r[l],d=f.length,p=Xl(e.call(u,u&&u.__data__,l,o)),h=p.length,w=a[l]=new Array(h),b=s[l]=new Array(h),m=c[l]=new Array(d);n(u,f,w,b,m,p,t);for(var k=0,g=0,x,E;k<h;++k)if(x=w[k]){for(k>=g&&(g=k+1);!(E=b[g])&&++g<h;);x._next=E||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function Xl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lr(){return new le(this._exit||this._groups.map(Zt),this._parents)}function cr(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function dr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],u=o[c],f=l.length,d=a[c]=new Array(f),p,h=0;h<f;++h)(p=l[h]||u[h])&&(d[h]=p);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function ur(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function fr(e){e||(e=Zl);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Zl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hr(){return Array.from(this)}function gr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function mr(){let e=0;for(let t of this)++e;return e}function yr(){return!this.node()}function br(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Wl(e){return function(){this.removeAttribute(e)}}function ql(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kl(e,t){return function(){this.setAttribute(e,t)}}function Gl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ql(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function xr(e,t){var n=Ie(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?ql:Wl:typeof t=="function"?n.local?Ql:Ul:n.local?Gl:Kl)(n,t))}function Wt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function jl(e){return function(){this.style.removeProperty(e)}}function Jl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ec(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function wr(e,t,n){return arguments.length>1?this.each((t==null?jl:typeof t=="function"?ec:Jl)(e,t,n??"")):Oe(this.node(),e)}function Oe(e,t){return e.style.getPropertyValue(t)||Wt(e).getComputedStyle(e,null).getPropertyValue(t)}function tc(e){return function(){delete this[e]}}function nc(e,t){return function(){this[e]=t}}function oc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function vr(e,t){return arguments.length>1?this.each((t==null?tc:typeof t=="function"?oc:nc)(e,t)):this.node()[e]}function kr(e){return e.trim().split(/^|\s+/)}function Ln(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=kr(e.getAttribute("class")||"")}_r.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 Sr(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Er(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function rc(e){return function(){Sr(this,e)}}function ic(e){return function(){Er(this,e)}}function sc(e,t){return function(){(t.apply(this,arguments)?Sr:Er)(this,e)}}function Nr(e,t){var n=kr(e+"");if(arguments.length<2){for(var o=Ln(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?sc:t?rc:ic)(n,t))}function ac(){this.textContent=""}function lc(e){return function(){this.textContent=e}}function cc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Cr(e){return arguments.length?this.each(e==null?ac:(typeof e=="function"?cc:lc)(e)):this.node().textContent}function dc(){this.innerHTML=""}function uc(e){return function(){this.innerHTML=e}}function fc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mr(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?fc:uc)(e)):this.node().innerHTML}function pc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ir(){return this.each(pc)}function hc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zr(){return this.each(hc)}function Pr(e){var t=typeof e=="function"?e:Yt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function gc(){return null}function Dr(e,t){var n=typeof e=="function"?e:Yt(e),o=t==null?gc:typeof t=="function"?t:Ke(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function mc(){var e=this.parentNode;e&&e.removeChild(this)}function Ar(){return this.each(mc)}function yc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tr(e){return this.select(e?bc:yc)}function Or(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xc(e){return function(t){e.call(this,t,this.__data__)}}function wc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function vc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function kc(e,t,n){return function(){var o=this.__on,r,i=xc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function $r(e,t,n){var o=wc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?kc:vc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Rr(e,t,n){var o=Wt(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function _c(e,t){return function(){return Rr(this,e,t)}}function Sc(e,t){return function(){return Rr(this,e,t.apply(this,arguments))}}function Hr(e,t){return this.each((typeof t=="function"?Sc:_c)(e,t))}function*Lr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Bn=[null];function le(e,t){this._groups=e,this._parents=t}function Br(){return new le([[document.documentElement]],Bn)}function Ec(){return this}le.prototype=Br.prototype={constructor:le,select:er,selectAll:tr,selectChild:nr,selectChildren:or,filter:rr,data:ar,enter:ir,exit:lr,join:cr,merge:dr,selection:Ec,order:ur,sort:fr,call:pr,nodes:hr,node:gr,size:mr,empty:yr,each:br,attr:xr,style:wr,property:vr,classed:Nr,text:Cr,html:Mr,raise:Ir,lower:zr,append:Pr,insert:Dr,remove:Ar,clone:Tr,datum:Or,on:$r,dispatch:Hr,[Symbol.iterator]:Lr};var ze=Br;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Bn)}function Vr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=Vr(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}var Fr={passive:!1},Ge={capture:!0,passive:!1};function qt(e){e.stopImmediatePropagation()}function $e(e){e.preventDefault(),e.stopImmediatePropagation()}function Et(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",$e,Ge);"onselectstart"in t?n.on("selectstart.drag",$e,Ge):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Nt(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",$e,Ge),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ct=e=>()=>e;function Mt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Mt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Nc(e){return!e.ctrlKey&&!e.button}function Cc(){return this.parentNode}function Mc(e,t){return t??{x:e.x,y:e.y}}function Ic(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kt(){var e=Nc,t=Cc,n=Mc,o=Ic,r={},i=st("start","drag","end"),s=0,a,c,l,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",m,Fr).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,E){if(!(u||!e.call(this,x,E))){var S=g(this,t.call(this,x,E),x,E,"mouse");S&&(de(x.view).on("mousemove.drag",h,Ge).on("mouseup.drag",w,Ge),Et(x.view),qt(x),l=!1,a=x.clientX,c=x.clientY,S("start",x))}}function h(x){if($e(x),!l){var E=x.clientX-a,S=x.clientY-c;l=E*E+S*S>f}r.mouse("drag",x)}function w(x){de(x.view).on("mousemove.drag mouseup.drag",null),Nt(x.view,l),$e(x),r.mouse("end",x)}function b(x,E){if(e.call(this,x,E)){var S=x.changedTouches,N=t.call(this,x,E),T=S.length,I,V;for(I=0;I<T;++I)(V=g(this,N,x,E,S[I].identifier,S[I]))&&(qt(x),V("start",x,S[I]))}}function m(x){var E=x.changedTouches,S=E.length,N,T;for(N=0;N<S;++N)(T=r[E[N].identifier])&&($e(x),T("drag",x,E[N]))}function k(x){var E=x.changedTouches,S=E.length,N,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(T=r[E[N].identifier])&&(qt(x),T("end",x,E[N]))}function g(x,E,S,N,T,I){var V=i.copy(),$=pe(I||S,E),B,M,y;if((y=n.call(x,new Mt("beforestart",{sourceEvent:S,target:d,identifier:T,active:s,x:$[0],y:$[1],dx:0,dy:0,dispatch:V}),N))!=null)return B=y.x-$[0]||0,M=y.y-$[1]||0,function v(_,C,D){var A=$,L;switch(_){case"start":r[T]=v,L=s++;break;case"end":delete r[T],--s;case"drag":$=pe(D||C,E),L=s;break}V.call(_,x,new Mt(_,{sourceEvent:C,subject:y,target:d,identifier:T,active:L,x:$[0]+B,y:$[1]+M,dx:$[0]-A[0],dy:$[1]-A[1],dispatch:V}),N)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Ct(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:Ct(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Ct(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:Ct(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var zc=st("start","end","cancel","interrupt"),Pc=[],Zr=0,Yr=1,Ut=2,Gt=3,Xr=4,Qt=5,It=6;function Re(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Dc(e,n,{name:t,index:o,group:r,on:zc,tween:Pc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zr})}function zt(e,t){var n=ce(e,t);if(n.state>Zr)throw new Error("too late; already scheduled");return n}function fe(e,t){var n=ce(e,t);if(n.state>Gt)throw new Error("too late; already running");return n}function ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Dc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Jo(i,0,n.time);function i(l){n.state=Yr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,p;if(n.state!==Yr)return c();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Gt)return $n(s);p.state===Xr?(p.state=It,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=It,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if($n(function(){n.state===Gt&&(n.state=Xr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ut,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ut){for(n.state=Gt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Qt,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===Qt&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=It,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Ue(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Ut&&o.state<Qt,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Wr(e){return this.each(function(){Ue(this,e)})}function Ac(e,t){var n,o;return function(){var r=fe(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Tc(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=fe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function qr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ce(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Ac:Tc)(n,e,t))}function lt(e,t,n){var o=e._id;return e.each(function(){var r=fe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ce(r,o).value[t]}}function jt(e,t){var n;return(typeof t=="number"?Ko:t instanceof Tn?On:(n=Tn(t))?(t=n,On):Go)(e,t)}function Oc(e){return function(){this.removeAttribute(e)}}function $c(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Rc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Hc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Lc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Bc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Kr(e,t){var n=Ie(e),o=n==="transform"?Qo:jt;return this.attrTween(e,typeof t=="function"?(n.local?Bc:Lc)(n,o,lt(this,"attr."+e,t)):t==null?(n.local?$c:Oc)(n):(n.local?Hc:Rc)(n,o,t))}function Vc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Fc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Fc(e,i)),n}return r._value=t,r}function Xc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(e,i)),n}return r._value=t,r}function Gr(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Ie(e);return this.tween(n,(o.local?Yc:Xc)(o,t))}function Zc(e,t){return function(){zt(this,e).delay=+t.apply(this,arguments)}}function Wc(e,t){return t=+t,function(){zt(this,e).delay=t}}function Ur(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zc:Wc)(t,e)):ce(this.node(),t).delay}function qc(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function Kc(e,t){return t=+t,function(){fe(this,e).duration=t}}function Qr(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qc:Kc)(t,e)):ce(this.node(),t).duration}function Gc(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function jr(e){var t=this._id;return arguments.length?this.each(Gc(t,e)):ce(this.node(),t).ease}function Uc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function Jr(e){if(typeof e!="function")throw new Error;return this.each(Uc(this._id,e))}function ei(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new he(o,this._parents,this._name,this._id)}function ti(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,p=0;p<u;++p)(d=c[p]||l[p])&&(f[p]=d);for(;a<o;++a)s[a]=t[a];return new he(s,this._parents,this._name,this._id)}function Qc(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function jc(e,t,n){var o,r,i=Qc(t)?zt:fe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ni(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(jc(n,e,t))}function Jc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function oi(){return this.on("end.remove",Jc(this._id))}function ri(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ke(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Re(l[d],t,n,d,l,ce(u,n)));return new he(i,this._parents,t,n)}function ii(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kt(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),p,h=ce(u,n),w=0,b=d.length;w<b;++w)(p=d[w])&&Re(p,t,n,w,d,h);i.push(d),s.push(u)}return new he(i,s,t,n)}var ed=ze.prototype.constructor;function si(){return new ed(this._groups,this._parents)}function td(e,t){var n,o,r;return function(){var i=Oe(this,e),s=(this.style.removeProperty(e),Oe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ai(e){return function(){this.style.removeProperty(e)}}function nd(e,t,n){var o,r=n+"",i;return function(){var s=Oe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function od(e,t,n){var o,r,i;return function(){var s=Oe(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oe(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function rd(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=fe(this,e),l=c.on,u=c.value[i]==null?a||(a=ai(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function li(e,t,n){var o=(e+="")=="transform"?Uo:jt;return t==null?this.styleTween(e,td(e,o)).on("end.style."+e,ai(e)):typeof t=="function"?this.styleTween(e,od(e,o,lt(this,"style."+e,t))).each(rd(this._id,e)):this.styleTween(e,nd(e,o,t),n).on("end.style."+e,null)}function id(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function sd(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&id(e,s,n)),o}return i._value=t,i}function ci(e,t,n){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,sd(e,t,n??""))}function ad(e){return function(){this.textContent=e}}function ld(e){return function(){var t=e(this);this.textContent=t??""}}function di(e){return this.tween("text",typeof e=="function"?ld(lt(this,"text",e)):ad(e==null?"":e+""))}function cd(e){return function(t){this.textContent=e.call(this,t)}}function dd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cd(r)),t}return o._value=e,o}function ui(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,dd(e))}function fi(){for(var e=this._name,t=this._id,n=Jt(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ce(c,t);Re(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new he(o,this._parents,e,n)}function pi(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=fe(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var ud=0;function he(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function hi(e){return ze().transition(e)}function Jt(){return++ud}var Pe=ze.prototype;he.prototype=hi.prototype={constructor:he,select:ri,selectAll:ii,selectChild:Pe.selectChild,selectChildren:Pe.selectChildren,filter:ei,merge:ti,selection:si,transition:fi,call:Pe.call,nodes:Pe.nodes,node:Pe.node,size:Pe.size,empty:Pe.empty,each:Pe.each,on:ni,attr:Kr,attrTween:Gr,style:li,styleTween:ci,text:di,textTween:ui,remove:oi,tween:qr,delay:Ur,duration:Qr,ease:jr,easeVarying:Jr,end:pi,[Symbol.iterator]:Pe[Symbol.iterator]};function en(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fd={time:null,delay:0,duration:250,ease:en};function pd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function gi(e){var t,n;e instanceof he?(t=e._id,e=e._name):(t=Jt(),(n=fd).time=jo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Re(c,e,t,l,s,n||pd(c,t));return new he(o,this._parents,e,t)}ze.prototype.interrupt=Wr;ze.prototype.transition=gi;var Pt=e=>()=>e;function Vn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(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 Qe=new we(1,0,0);Dt.prototype=we.prototype;function Dt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qe;return e.__zoom}function tn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function hd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gd(){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 mi(){return this.__zoom||Qe}function md(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yd(){return navigator.maxTouchPoints||"ontouchstart"in this}function bd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function nn(){var e=hd,t=gd,n=bd,o=md,r=yd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=at,l=st("start","zoom","end"),u,f,d,p=500,h=150,w=0,b=10;function m(y){y.property("__zoom",mi).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,v,_,C){var D=y.selection?y.selection():y;D.property("__zoom",mi),y!==D?E(y,v,_,C):D.interrupt().each(function(){S(this,arguments).event(C).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},m.scaleBy=function(y,v,_,C){m.scaleTo(y,function(){var D=this.__zoom.k,A=typeof v=="function"?v.apply(this,arguments):v;return D*A},_,C)},m.scaleTo=function(y,v,_,C){m.transform(y,function(){var D=t.apply(this,arguments),A=this.__zoom,L=_==null?x(D):typeof _=="function"?_.apply(this,arguments):_,H=A.invert(L),F=typeof v=="function"?v.apply(this,arguments):v;return n(g(k(A,F),L,H),D,s)},_,C)},m.translateBy=function(y,v,_,C){m.transform(y,function(){return n(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),s)},null,C)},m.translateTo=function(y,v,_,C,D){m.transform(y,function(){var A=t.apply(this,arguments),L=this.__zoom,H=C==null?x(A):typeof C=="function"?C.apply(this,arguments):C;return n(Qe.translate(H[0],H[1]).scale(L.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof _=="function"?-_.apply(this,arguments):-_),A,s)},C,D)};function k(y,v){return v=Math.max(i[0],Math.min(i[1],v)),v===y.k?y:new we(v,y.x,y.y)}function g(y,v,_){var C=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return C===y.x&&D===y.y?y:new we(y.k,C,D)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function E(y,v,_,C){y.on("start.zoom",function(){S(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(C).end()}).tween("zoom",function(){var D=this,A=arguments,L=S(D,A).event(C),H=t.apply(D,A),F=_==null?x(H):typeof _=="function"?_.apply(D,A):_,K=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),Y=D.__zoom,G=typeof v=="function"?v.apply(D,A):v,ee=c(Y.invert(F).concat(K/Y.k),G.invert(F).concat(K/G.k));return function(q){if(q===1)q=G;else{var R=ee(q),Z=K/R[2];q=new we(Z,F[0]-R[0]*Z,F[1]-R[1]*Z)}L.zoom(null,q)}})}function S(y,v,_){return!_&&y.__zooming||new N(y,v)}function N(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}N.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,v){return this.mouse&&y!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var v=de(this.that).datum();l.call(y,this.that,new Vn(y,{sourceEvent:this.sourceEvent,target:m,type:y,transform:this.that.__zoom,dispatch:l}),v)}};function T(y,...v){if(!e.apply(this,arguments))return;var _=S(this,v).event(y),C=this.__zoom,D=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,o.apply(this,arguments)))),A=pe(y);if(_.wheel)(_.mouse[0][0]!==A[0]||_.mouse[0][1]!==A[1])&&(_.mouse[1]=C.invert(_.mouse[0]=A)),clearTimeout(_.wheel);else{if(C.k===D)return;_.mouse=[A,C.invert(A)],Ue(this),_.start()}ct(y),_.wheel=setTimeout(L,h),_.zoom("mouse",n(g(k(C,D),_.mouse[0],_.mouse[1]),_.extent,s));function L(){_.wheel=null,_.end()}}function I(y,...v){if(d||!e.apply(this,arguments))return;var _=y.currentTarget,C=S(this,v,!0).event(y),D=de(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",K,!0),A=pe(y,_),L=y.clientX,H=y.clientY;Et(y.view),tn(y),C.mouse=[A,this.__zoom.invert(A)],Ue(this),C.start();function F(Y){if(ct(Y),!C.moved){var G=Y.clientX-L,ee=Y.clientY-H;C.moved=G*G+ee*ee>w}C.event(Y).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=pe(Y,_),C.mouse[1]),C.extent,s))}function K(Y){D.on("mousemove.zoom mouseup.zoom",null),Nt(Y.view,C.moved),ct(Y),C.event(Y).end()}}function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,C=pe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(C),A=_.k*(y.shiftKey?.5:2),L=n(g(k(_,A),C,D),t.apply(this,v),s);ct(y),a>0?de(this).transition().duration(a).call(E,L,C,y):de(this).call(m.transform,L,C,y)}}function $(y,...v){if(e.apply(this,arguments)){var _=y.touches,C=_.length,D=S(this,v,y.changedTouches.length===C).event(y),A,L,H,F;for(tn(y),L=0;L<C;++L)H=_[L],F=pe(H,this),F=[F,this.__zoom.invert(F),H.identifier],D.touch0?!D.touch1&&D.touch0[2]!==F[2]&&(D.touch1=F,D.taps=0):(D.touch0=F,A=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),A&&(D.taps<2&&(f=F[0],u=setTimeout(function(){u=null},p)),Ue(this),D.start())}}function B(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L,H,F;for(ct(y),A=0;A<D;++A)L=C[A],H=pe(L,this),_.touch0&&_.touch0[2]===L.identifier?_.touch0[0]=H:_.touch1&&_.touch1[2]===L.identifier&&(_.touch1[0]=H);if(L=_.that.__zoom,_.touch1){var K=_.touch0[0],Y=_.touch0[1],G=_.touch1[0],ee=_.touch1[1],q=(q=G[0]-K[0])*q+(q=G[1]-K[1])*q,R=(R=ee[0]-Y[0])*R+(R=ee[1]-Y[1])*R;L=k(L,Math.sqrt(q/R)),H=[(K[0]+G[0])/2,(K[1]+G[1])/2],F=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2]}else if(_.touch0)H=_.touch0[0],F=_.touch0[1];else return;_.zoom("touch",n(g(L,H,F),_.extent,s))}}function M(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L;for(tn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),A=0;A<D;++A)L=C[A],_.touch0&&_.touch0[2]===L.identifier?delete _.touch0:_.touch1&&_.touch1[2]===L.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(L=pe(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<b)){var H=de(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Pt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Pt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Pt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Pt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(b=+y,m):b},m}var ge={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n: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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},pt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wn=["Enter"," ","Escape"],qn={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var je;(function(e){e.Partial="partial",e.Full="full"})(je||(je={}));var Kn={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},_e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_e||(_e={}));var ut;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ut||(ut={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));var yi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Gn=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,zi=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Un=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Tt=(e,t=[0,0])=>{let{width:n,height:o}=be(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Qn=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,o=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):Un(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,cn(r,sn(a,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?dn(o):{x:0,y:0,width:0,height:0}},ht=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=cn(n,sn(r)),o=!0)}),o?dn(n):{x:0,y:0,width:0,height:0}},an=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{let a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,u=t.height/r,f=[];for(let d of e.values()){let{measured:p,selectable:h=!0,hidden:w=!1}=d;if(s&&!h||w)continue;let b=p.width??d.width??d.initialWidth??0,m=p.height??d.height??d.initialHeight??0,{x:k,y:g}=d.internals.positionAbsolute,x=Oi(a,c,l,u,k,g,b,m),E=b*m,S=i&&x>0;(!d.internals.handleBounds||S||x>=E||d.dragging)&&f.push(d)}return f},Pi=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function xd(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){let{width:s,height:a}=be(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Di({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=xd(e,s),c=ht(a),l=$t(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function jn({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){let s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o,f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ge.error005());else{let{width:p,height:h}=be(a);p&&h&&(f=[[c,l],[c+p,l+h]])}else a&&tt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);let d=tt(f)?Je(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ge.error015()),{position:{x:d.x-c+(s.measured.width??0)*u[0],y:d.y-l+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Ai({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let i=new Set(e.map(d=>d.id)),s=[];for(let d of n){if(d.deletable===!1)continue;let p=i.has(d.id),h=!p&&d.parentId&&s.find(w=>w.id===d.parentId);(p||h)&&s.push(d)}let a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=Pi(s,c);for(let d of c)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};let f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}var ft=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Je=(e={x:0,y:0},t,n)=>({x:ft(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ft(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ti(e,t,n){let{width:o,height:r}=be(n),{x:i,y:s}=n.internals.positionAbsolute;return Je(e,[[i,s],[i+o,s+r]],t)}var bi=(e,t,n)=>e<t?ft(Math.abs(e-t),1,t)/t:e>n?-ft(Math.abs(e-n),1,t)/t:0,ln=(e,t,n=15,o=40)=>{let r=bi(e.x,o,t.width-o)*n,i=bi(e.y,o,t.height-o)*n;return[r,i]},cn=(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)}),Zn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),dn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),gt=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},sn=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Jn=(e,t)=>dn(cn(Zn(e),Zn(t))),Oi=(e,t,n,o,r,i,s,a)=>{let c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},Ot=(e,t)=>Oi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),eo=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),to=(e,t)=>(n,o)=>{},mt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return i?mt(a,s):a},et=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function dt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wd(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=dt(e,n),r=dt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=dt(e.top??e.y??0,n),r=dt(e.bottom??e.y??0,n),i=dt(e.left??e.x??0,t),s=dt(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vd(e,t,n,o,r,i){let{x:s,y:a}=et(e,[t,n,o]),{x:c,y:l}=et({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}var $t=(e,t,n,o,r,i)=>{let s=wd(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=ft(l,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=vd(e,p,h,u,t,n),b={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:p-b.left+b.right,y:h-b.top+b.bottom,zoom:u}},bt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function tt(e){return e!=null&&e!=="parent"}function be(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function un(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function no(e,t={width:0,height:0},n,o,r){let i={...e},s=o.get(n);if(s){let a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function oo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function $i(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ri(e){return{...qn,...e||{}}}function ro(e){return e===null?null:e?"valid":"invalid"}function At(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:i,y:s}=ye(e),a=yt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?mt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}var fn=e=>({width:e.offsetWidth,height:e.offsetHeight}),io=e=>e?.getRootNode?.()||window?.document,kd=["INPUT","SELECT","TEXTAREA"];function so(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:kd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var ao=e=>"clientX"in e,ye=(e,t)=>{let n=ao(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},xi=(e,t,n,o,r)=>{let i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{let a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...fn(s)}})};function pn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){let c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),f=Math.abs(l-t);return[c,l,u,f]}function on(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-on(t-o,i),n];case X.Right:return[t+on(o-t,i),n];case X.Top:return[t,n-on(n-r,i)];case X.Bottom:return[t,n+on(r-n,i)]}}function hn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){let[a,c]=wi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=wi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,p,h]=pn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,f,d,p,h]}function lo({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Hi({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;let s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function Li({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let i=cn(sn(e),sn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);let s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ot(s,dn(i))>0}var _d=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Sd=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Bi=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||_d,r;return Gn(e)?r={...e}:r={...e,id:o(e)},Sd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gn({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,i,s,a]=lo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var vi={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Ed=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ki=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){let a=vi[t],c=vi[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},f=Ed({source:l,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d],h=[],w,b,m={x:0,y:0},k={x:0,y:0},[,,g,x]=lo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(w=r.x??l.x+(u.x-l.x)*s,b=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,b=r.y??l.y+(u.y-l.y)*s);let T=[{x:w,y:l.y},{x:w,y:u.y}],I=[{x:l.x,y:b},{x:u.x,y:b}];a[d]===p?h=d==="x"?T:I:h=d==="x"?I:T}else{let T=[{x:l.x,y:u.y}],I=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===p?I:T:h=a.y===p?T:I,t===o){let y=Math.abs(e[d]-n[d]);if(y<=i){let v=Math.min(i-1,i-y);a[d]===p?m[d]=(l[d]>e[d]?-1:1)*v:k[d]=(u[d]>n[d]?-1:1)*v}}if(t!==o){let y=d==="x"?"y":"x",v=a[d]===c[y],_=l[y]>u[y],C=l[y]<u[y];(a[d]===1&&(!v&&_||v&&C)||a[d]!==1&&(!v&&C||v&&_))&&(h=d==="x"?T:I)}let V={x:l.x+m.x,y:l.y+m.y},$={x:u.x+k.x,y:u.y+k.y},B=Math.max(Math.abs(V.x-h[0].x),Math.abs($.x-h[0].x)),M=Math.max(Math.abs(V.y-h[0].y),Math.abs($.y-h[0].y));B>=M?(w=(V.x+$.x)/2,b=h[0].y):(w=h[0].x,b=(V.y+$.y)/2)}let E={x:l.x+m.x,y:l.y+m.y},S={x:u.x+k.x,y:u.y+k.y};return[[e,...E.x!==h[0].x||E.y!==h[0].y?[E]:[],...h,...S.x!==h[h.length-1].x||S.y!==h[h.length-1].y?[S]:[],n],w,b,g,x]}function Cd(e,t,n,o){let r=Math.min(ki(e,t)/2,ki(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){let l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}let a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function nt({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){let[f,d,p,h,w]=Nd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u}),b=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)b+=Cd(f[m-1],f[m],f[m+1],s);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,d,p,h,w]}function _i(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Vi(e){let{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;let o=t.internals.handleBounds||Si(t.handles),r=n.internals.handleBounds||Si(n.handles),i=Ei(o?.source??[],e.sourceHandle),s=Ei(e.connectionMode===Ve.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ge.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=i?.position||X.Bottom,c=s?.position||X.Top,l=Fe(t,i,a),u=Fe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Si(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=X.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??be(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function Ei(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function mn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Fi(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){let l=mn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}var Yi=1e3,Md=10,co={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Id={...co,checkEquality:!0};function uo(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Xi(e,t,n){let o=uo(co,n);for(let r of e.values())if(r.parentId)po(r,e,t,o);else{let i=Tt(r,o.nodeOrigin),s=tt(r.extent)?r.extent:o.nodeExtent,a=Je(i,s,be(r));r.internals.positionAbsolute=a}}function zd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function fo(e){return e==="manual"}function yn(e,t,n,o={}){let r=uo(Id,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!fo(r.zIndexMode)?Yi:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let f=s.get(u.id);if(r.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{let d=Tt(u,r.nodeOrigin),p=tt(u.extent)?u.extent:r.nodeExtent,h=Je(d,p,be(u));f={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:zd(u,f),z:Zi(u,a,r.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&po(f,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Pd(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function po(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=uo(co,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Pd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Md),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);let f=i&&!fo(c)?Yi:0,{x:d,y:p,z:h}=Dd(e,u,s,a,f,c),{positionAbsolute:w}=e.internals,b=d!==w.x||p!==w.y;(b||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:d,y:p}:w,z:h}})}function Zi(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return fo(n)?o:o+(e.selected?t:0)}function Dd(e,t,n,o,r,i){let{x:s,y:a}=t.internals.positionAbsolute,c=be(e),l=Tt(e,n),u=tt(e.extent)?Je(l,e.extent,c):l,f=Je({x:s+u.x,y:a+u.y},o,c);e.extent==="parent"&&(f=Ti(f,c,t));let d=Zi(e,r,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function bn(e,t,n,o=[0,0]){let r=[],i=new Map;for(let s of e){let a=t.get(s.parentId);if(!a)continue;let c=i.get(s.parentId)?.expandedRect??gt(a),l=Jn(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{let l=a.internals.positionAbsolute,u=be(a),f=a.origin??o,d=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,p=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,h=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),b=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||b||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+b,y:a.position.y-p+m}}),n.get(c)?.forEach(k=>{e.some(g=>g.id===k.id)||r.push({id:k.id,type:"position",position:{x:k.position.x+d,y:k.position.y+p}})})),(u.width<s.width||u.height<s.height||d||p)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-b:0),height:w+(p?f[1]*p-m:0)}})}),r}function Wi(e,t,n,o,r,i,s){let a=o?.querySelector(".xyflow__viewport"),c=!1;if(!a)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(let p of e.values()){let h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),c=!0;continue}let w=fn(p.nodeElement),b=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(b||!h.internals.handleBounds||p.force))){let k=p.nodeElement.getBoundingClientRect(),g=tt(h.extent)?h.extent:i,{positionAbsolute:x}=h.internals;if(h.parentId&&h.extent==="parent"){let S=t.get(h.parentId);S&&(x=Ti(x,w,S))}else g&&(x=Je(x,g,w));let E={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:xi("source",p.nodeElement,k,f,h.id),target:xi("target",p.nodeElement,k,f,h.id)}}};t.set(h.id,E),h.parentId&&po(E,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,b&&(l.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:gt(E,r)}))}}if(d.length>0){let p=bn(d,t,n,r);l.push(...p)}return{changes:l,updatedInternals:c}}async function qi({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;let s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Ni(e,t,n,o,r,i){let s=r,a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;let c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;let l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function ho(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Ni("source",c,u,e,r,s),Ni("target",c,l,e,i,a),t.set(o.id,o)}}function Ki(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Ki(n,t):!1}function Ci(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Ad(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ki(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Fn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[s,a]of t){let c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Td({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let i={x:n-r.distance.x,y:o-r.distance.y},s=mt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Gi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function b({noDragClassName:k,handleSelector:g,domNode:x,isSelectable:E,nodeId:S,nodeClickDistance:N=0}){d=de(x);function T({x:B,y:M}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:C,nodeOrigin:D,onNodeDrag:A,onSelectionDrag:L,onError:H,updateNodePositions:F}=t();i={x:B,y:M};let K=!1,Y=a.size>1,G=Y&&v?Zn(ht(a)):null,ee=Y&&C?Td({dragItems:a,snapGrid:_,x:B,y:M}):null;for(let[q,R]of a){if(!y.has(q))continue;let Z={x:B-R.distance.x,y:M-R.distance.y};C&&(Z=ee?{x:Math.round(Z.x+ee.x),y:Math.round(Z.y+ee.y)}:mt(Z,_));let j=null;if(Y&&v&&!R.extent&&G){let{positionAbsolute:U}=R.internals,te=U.x-G.x+v[0][0],ne=U.x+R.measured.width-G.x2+v[1][0],re=U.y-G.y+v[0][1],ue=U.y+R.measured.height-G.y2+v[1][1];j=[[te,re],[ne,ue]]}let{position:Q,positionAbsolute:W}=jn({nodeId:q,nextPosition:Z,nodeLookup:y,nodeExtent:j||v,nodeOrigin:D,onError:H});K=K||R.position.x!==Q.x||R.position.y!==Q.y,R.position=Q,R.internals.positionAbsolute=W}if(h=h||K,!!K&&(F(a,!0),w&&(o||A||!S&&L))){let[q,R]=Fn({nodeId:S,dragItems:a,nodeLookup:y});o?.(w,a,q,R),A?.(w,q,R),S||L?.(w,R)}}async function I(){if(!u)return;let{transform:B,panBy:M,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){c=!1,cancelAnimationFrame(s);return}let[_,C]=ln(l,u,y);(_!==0||C!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-C/B[2],await M({x:_,y:C})&&T(i)),s=requestAnimationFrame(I)}function V(B){let{nodeLookup:M,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:C,snapToGrid:D,selectNodesOnDrag:A,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!A||!E)&&!y&&S&&(M.get(S)?.selected||F()),E&&A&&S&&e?.(S);let K=At(B.sourceEvent,{transform:_,snapGrid:C,snapToGrid:D,containerBounds:u});if(i=K,a=Ad(M,v,K,S),a.size>0&&(n||L||!S&&H)){let[Y,G]=Fn({nodeId:S,dragItems:a,nodeLookup:M});n?.(B.sourceEvent,a,Y,G),L?.(B.sourceEvent,Y,G),S||H?.(B.sourceEvent,G)}}let $=Kt().clickDistance(N).on("start",B=>{let{domNode:M,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:C}=t();u=M?.getBoundingClientRect()||null,p=!1,h=!1,w=B.sourceEvent,y===0&&V(B),i=At(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:C,containerBounds:u}),l=ye(B.sourceEvent,u)}).on("drag",B=>{let{autoPanOnNodeDrag:M,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:C,nodeLookup:D}=t(),A=At(B.sourceEvent,{transform:y,snapGrid:v,snapToGrid:_,containerBounds:u});if(w=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||S&&!D.has(S))&&(p=!0),!p){if(!c&&M&&f&&(c=!0,I()),!f){let L=ye(B.sourceEvent,u),H=L.x-l.x,F=L.y-l.y;Math.sqrt(H*H+F*F)>C&&V(B)}(i.x!==A.xSnapped||i.y!==A.ySnapped)&&a&&f&&(l=ye(B.sourceEvent,u),T(A))}}).on("end",B=>{if(!f||p){p&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){let{nodeLookup:M,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(h&&(y(a,!1),h=!1),r||v||!S&&_){let[C,D]=Fn({nodeId:S,dragItems:a,nodeLookup:M,dragging:!1});r?.(B.sourceEvent,a,C,D),v?.(B.sourceEvent,C,D),S||_?.(B.sourceEvent,D)}}}).filter(B=>{let M=B.target;return!B.button&&(!k||!Ci(M,`.${k}`,x))&&(!g||Ci(M,g,x))});d.call($)}function m(){d?.on(".drag",null)}return{update:b,destroy:m}}function Od(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let i of t.values())Ot(r,gt(i))>0&&o.push(i);return o}var $d=250;function Rd(e,t,n,o){let r=[],i=1/0,s=Od(e,n,t+$d);for(let a of s){let c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:u,y:f}=Fe(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...l,x:u,y:f}],i=d):d===i&&r.push({...l,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ui(e,t,n,o,r,i=!1){let s=o.get(e);if(!s)return null;let a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...Fe(s,c,c.position,!0)}:c}function Qi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Hd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var ji=()=>!0;function Ld(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:b,isValidConnection:m=ji,onReconnectEnd:k,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:T}){let I=io(e.target),V=0,$,{x:B,y:M}=ye(e),y=Qi(i,T),v=a?.getBoundingClientRect(),_=!1;if(!v||!y)return;let C=Ui(r,y,o,c,t);if(!C)return;let D=ye(e,v),A=!1,L=null,H=!1,F=null;function K(){if(!u||!v)return;let[Q,W]=ln(D,v,S);d({x:Q,y:W}),V=requestAnimationFrame(K)}let Y={...C,nodeId:r,type:y,position:C.position},G=c.get(r),q={inProgress:!0,isValid:null,from:Fe(G,Y,X.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:G,to:D,toHandle:null,toPosition:yi[Y.position],toNode:null,pointer:D};function R(){_=!0,g(q),h?.(e,{nodeId:r,handleId:o,handleType:y})}N===0&&R();function Z(Q){if(!_){let{x:ue,y:Se}=ye(Q),ve=ue-B,ke=Se-M;if(!(ve*ve+ke*ke>N*N))return;R()}if(!E()||!Y){j(Q);return}let W=x();D=ye(Q,v),$=Rd(yt(D,W,!1,[1,1]),n,c,Y),A||(K(),A=!0);let U=Ji(Q,{handle:$,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:f,nodeLookup:c});F=U.handleDomNode,L=U.connection,H=Hd(!!$,U.isValid);let te=c.get(r),ne=te?Fe(te,Y,X.Left,!0):q.from,re={...q,from:ne,isValid:H,to:U.toHandle&&H?et({x:U.toHandle.x,y:U.toHandle.y},W):D,toHandle:U.toHandle,toPosition:H&&U.toHandle?U.toHandle.position:yi[Y.position],toNode:U.toHandle?c.get(U.toHandle.nodeId):null,pointer:D};g(re),q=re}function j(Q){if(!("touches"in Q&&Q.touches.length>0)){if(_){($||F)&&L&&H&&w?.(L);let{inProgress:W,...U}=q,te={...U,toPosition:q.toHandle?q.toPosition:null};b?.(Q,te),i&&k?.(Q,te)}p(),cancelAnimationFrame(V),A=!1,H=!1,L=null,F=null,I.removeEventListener("mousemove",Z),I.removeEventListener("mouseup",j),I.removeEventListener("touchmove",Z),I.removeEventListener("touchend",j)}}I.addEventListener("mousemove",Z),I.addEventListener("mouseup",j),I.addEventListener("touchmove",Z),I.addEventListener("touchend",j)}function Ji(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=ji,nodeLookup:u}){let f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=ye(e),w=s.elementFromPoint(p,h),b=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let k=Qi(void 0,b),g=b.getAttribute("data-nodeid"),x=b.getAttribute("data-handleid"),E=b.classList.contains("connectable"),S=b.classList.contains("connectableend");if(!g||!k)return m;let N={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=N;let I=E&&S&&(n===Ve.Strict?f&&k==="source"||!f&&k==="target":g!==o||x!==r);m.isValid=I&&l(N),m.toHandle=Ui(g,k,x,u,n,!0)}return m}var xn={onPointerDown:Ld,isValid:Ji};function es({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=de(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){let h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let x=n(),E=g.sourceEvent.ctrlKey&&bt()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,N=x[2]*Math.pow(2,S*E);t.scaleTo(N)},w=[0,0],b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{let x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let E=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[E[0]-w[0],E[1]-w[1]];w=E;let N=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),T={x:x[0]-S[0]*N,y:x[1]-S[1]*N},I=[[0,0],[c,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},I,a)},k=nn().on("start",b).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(k,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:pe}}var wn=e=>({x:e.x,y:e.y,zoom:e.k}),Yn=({x:e,y:t,zoom:n})=>Qe.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),ts=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Bd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xn=(e,t=0,n=Bd,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ns=e=>{let t=e.ctrlKey&&bt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Vd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Be(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(u.ctrlKey&&s){let b=pe(u),m=ns(u),k=f*Math.pow(2,m);o.scaleTo(n,k,b,u);return}let d=u.deltaMode===1?20:1,p=r===De.Vertical?0:u.deltaX*d,h=r===De.Horizontal?0:u.deltaY*d;!bt()&&u.shiftKey&&r!==De.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*i,-(h/f)*i,{internal:!0});let w=wn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,w):(e.isPanScrolling=!0,a?.(u,w)),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)}}function Fd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Be(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Yd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=wn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Xd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&ts(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,wn(i.transform))}}function Zd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&ts(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=wn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Wd({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:f}){return d=>{let p=t||n,h=o&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Be(d,`${u}-flow__node`)||Be(d,`${u}-flow__edge`)||Be(d,`${u}-flow__selection`)||Be(d,`${u}-flow__nodesselection`)))return!0;if(!r&&!p&&!i&&!s&&!o||a||f&&!w||Be(d,c)&&w||Be(d,l)&&(!w||i&&w&&!t)||!o&&d.ctrlKey&&w)return!1;if(!o&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!p&&!i&&!h&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;let b=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w||e)&&b}}function os({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(M=>{let y=M[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let p=nn().extent(()=>f).scaleExtent([t,n]).translateExtent(o),h=de(e).call(p);x({x:r.x,y:r.y,zoom:ft(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);let w=h.on("wheel.zoom"),b=h.on("dblclick.zoom");p.wheelDelta(ns);async function m(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).transform(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function k({noWheelClassName:M,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:C,panOnDrag:D,panOnScrollMode:A,panOnScrollSpeed:L,preventScrolling:H,zoomOnPinch:F,zoomOnScroll:K,zoomOnDoubleClick:Y,panActivationKeyPressed:G=!1,zoomActivationKeyPressed:ee,lib:q,onTransformChange:R,connectionInProgress:Z,paneClickDistance:j,selectionOnDrag:Q}){_&&!l.isZoomingOrPanning&&g();let W=C&&!ee&&!_;p.clickDistance(Q?1/0:!me(j)||j<0?0:j);let U=W?Vd({zoomPanValues:l,noWheelClassName:M,d3Selection:h,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Fd({noWheelClassName:M,preventScrolling:H,d3ZoomHandler:w});h.on("wheel.zoom",U,{passive:!1});let te=Yd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});p.on("start",te);let ne=Xd({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:i,onTransformChange:R});p.on("zoom",ne);let re=Zd({zoomPanValues:l,panOnDrag:D,panOnScroll:C,onPaneContextMenu:v,onPanZoomEnd:a,onDraggingChange:c});p.on("end",re);let ue=Wd({panActivationKeyPressed:G,zoomActivationKeyPressed:ee,panOnDrag:D,zoomOnScroll:K,panOnScroll:C,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:M,lib:q,connectionInProgress:Z});p.filter(ue),Y?h.on("dblclick.zoom",b):h.on("dblclick.zoom",null)}function g(){p.on("zoom",null)}async function x(M,y,v){let _=Yn(M),C=p?.constrain()(_,y,v);return C&&await m(C),C}async function E(M,y){let v=Yn(M);return await m(v,y),v}function S(M){if(h){let y=Yn(M),v=h.property("__zoom");(v.k!==M.zoom||v.x!==M.x||v.y!==M.y)&&p?.transform(h,y,null,{sync:!0})}}function N(){let M=h?Dt(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function T(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleTo(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}async function I(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleBy(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function V(M){p?.scaleExtent(M)}function $(M){p?.translateExtent(M)}function B(M){let y=!me(M)||M<0?0:M;p?.clickDistance(y)}return{update:k,destroy:g,setViewport:E,setViewportConstrained:x,getViewport:N,scaleTo:T,scaleBy:I,setScaleExtent:V,setTranslateExtent:$,syncViewport:S,setClickDistance:B}}var Ye;(function(e){e.Line="line",e.Handle="handle"})(Ye||(Ye={}));function qd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){let s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Mi(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function He(e,t){return Math.max(0,t-e)}function Le(e,t){return Math.max(0,e-t)}function rn(e,t,n){return Math.max(0,t-e,e-n)}function Ii(e,t){return e?!t:t}function Kd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:b,minHeight:m,maxHeight:k}=o,{x:g,y:x,width:E,height:S,aspectRatio:N}=e,T=Math.floor(u?p-e.pointerX:0),I=Math.floor(f?h-e.pointerY:0),V=E+(c?-T:T),$=S+(l?-I:I),B=-i[0]*E,M=-i[1]*S,y=rn(V,w,b),v=rn($,m,k);if(s){let D=0,A=0;c&&T<0?D=He(g+T+B,s[0][0]):!c&&T>0&&(D=Le(g+V+B,s[1][0])),l&&I<0?A=He(x+I+M,s[0][1]):!l&&I>0&&(A=Le(x+$+M,s[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(a){let D=0,A=0;c&&T>0?D=Le(g+T,a[0][0]):!c&&T<0&&(D=He(g+V,a[1][0])),l&&I>0?A=Le(x+I,a[0][1]):!l&&I<0&&(A=He(x+$,a[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(r){if(u){let D=rn(V/N,m,k)*N;if(y=Math.max(y,D),s){let A=0;!c&&!l||c&&!l&&d?A=Le(x+M+V/N,s[1][1])*N:A=He(x+M+(c?T:-T)/N,s[0][1])*N,y=Math.max(y,A)}if(a){let A=0;!c&&!l||c&&!l&&d?A=He(x+V/N,a[1][1])*N:A=Le(x+(c?T:-T)/N,a[0][1])*N,y=Math.max(y,A)}}if(f){let D=rn($*N,w,b)/N;if(v=Math.max(v,D),s){let A=0;!c&&!l||l&&!c&&d?A=Le(g+$*N+B,s[1][0])/N:A=He(g+(l?I:-I)*N+B,s[0][0])/N,v=Math.max(v,A)}if(a){let A=0;!c&&!l||l&&!c&&d?A=He(g+$*N,a[1][0])/N:A=Le(g+(l?I:-I)*N,a[0][0])/N,v=Math.max(v,A)}}}I=I+(I<0?v:-v),T=T+(T<0?y:-y),r&&(d?V>$*N?I=(Ii(c,l)?-T:T)/N:T=(Ii(c,l)?-I:I)*N:u?(I=T/N,l=c):(T=I*N,c=l));let _=c?g+T:g,C=l?x+I:x;return{width:E+(c?-T:T),height:S+(l?-I:I),x:i[0]*T*(c?-1:1)+_,y:i[1]*I*(l?-1:1)+C}}var rs={width:0,height:0,x:0,y:0},Gd={...rs,pointerX:0,pointerY:0,aspectRatio:1};function Ud(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function is({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Mi("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:b}){let m={...rs},k={...Gd};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Mi(l)};let g,x=null,E=[],S,N,T,I=Kt().on("start",V=>{let{nodeLookup:$,transform:B,snapGrid:M,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(g=$.get(t),!g)return;x=_?.getBoundingClientRect()??null;let{xSnapped:C,ySnapped:D}=At(V.sourceEvent,{transform:B,snapGrid:M,snapToGrid:y,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},k={...m,pointerX:C,pointerY:D,aspectRatio:m.width/m.height},S=void 0,N=tt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId)),S&&g.extent==="parent"&&(N=[[0,0],[S.measured.width,S.measured.height]]),E=[],T=void 0;for(let[A,L]of $)if(L.parentId===t&&(E.push({id:A,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){let H=Ud(L,g,L.origin??v);T?T=[[Math.min(H[0][0],T[0][0]),Math.min(H[0][1],T[0][1])],[Math.max(H[1][0],T[1][0]),Math.max(H[1][1],T[1][1])]]:T=H}p?.(V,{...m})}).on("drag",V=>{let{transform:$,snapGrid:B,snapToGrid:M,nodeOrigin:y}=n(),v=At(V.sourceEvent,{transform:$,snapGrid:B,snapToGrid:M,containerBounds:x}),_=[];if(!g)return;let{x:C,y:D,width:A,height:L}=m,H={},F=g.origin??y,{width:K,height:Y,x:G,y:ee}=Kd(k,s.controlDirection,v,s.boundaries,s.keepAspectRatio,F,N,T),q=K!==A,R=Y!==L,Z=G!==C&&q,j=ee!==D&&R;if(!Z&&!j&&!q&&!R)return;let Q={prevValues:{...m},startX:k.x,startY:k.y,childNodes:E.map(ne=>({...ne,position:{...ne.position}}))};if((Z||j||F[0]===1||F[1]===1)&&(H.x=Z?G:m.x,H.y=j?ee:m.y,m.x=H.x,m.y=H.y,E.length>0)){let ne=G-C,re=ee-D;for(let ue of E)ue.position={x:ue.position.x-ne+F[0]*(K-A),y:ue.position.y-re+F[1]*(Y-L)},_.push(ue)}if((q||R)&&(H.width=q&&(!s.resizeDirection||s.resizeDirection==="horizontal")?K:m.width,H.height=R&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=H.width,m.height=H.height),S&&g.expandParent){let ne=F[0]*(H.width??0);H.x&&H.x<ne&&(m.x=ne,k.x=k.x-(H.x-ne));let re=F[1]*(H.height??0);H.y&&H.y<re&&(m.y=re,k.y=k.y-(H.y-re))}let W=qd({width:m.width,prevWidth:A,height:m.height,prevHeight:L,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),U={...m,direction:W};if(b?.(V,U)===!1){m=Q.prevValues,k.x=Q.startX,k.y=Q.startY,E.forEach((ne,re)=>{ne.position=Q.childNodes[re].position});return}h?.(V,U),o(H,_)}).on("end",V=>{w?.(V,{...m}),r?.({...m})});i.call(I)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var cs=Te(Dn(),1),ds=Te(Il(),1);var ss=e=>{let t,n=new Set,o=(u,f)=>{let d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){let p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},as=e=>e?ss(e):ss;var{useDebugValue:Qd}=cs.default,{useSyncExternalStoreWithSelector:jd}=ds.default,Jd=e=>e;function go(e,t=Jd,n){let o=jd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qd(o),o}var ls=(e,t)=>{let n=as(e),o=(r,i=t)=>go(n,r,i);return Object.assign(o,n),o},us=(e,t)=>e?ls(e,t):ls;function ie(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(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var eu=Te(Ml()),Sn=(0,P.createContext)(null),tu=Sn.Provider,Hs=ge.error001("react");function J(e,t){let n=(0,P.useContext)(Sn);if(n===null)throw new Error(Hs);return go(n,e,t)}function se(){let e=(0,P.useContext)(Sn);if(e===null)throw new Error(Hs);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var fs={display:"none"},nu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ls="react-flow__node-desc",Bs="react-flow__edge-desc",ou="react-flow__aria-live",ru=e=>e.ariaLiveMessage,iu=e=>e.ariaLabelConfig;function su({rfId:e}){let t=J(ru);return(0,z.jsx)("div",{id:`${ou}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:nu,children:t})}function au({rfId:e,disableKeyboardA11y:t}){let n=J(iu);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${Ls}-${e}`,style:fs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${Bs}-${e}`,style:fs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(su,{rfId:e})]})}var En=(0,P.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{let s=`${e}`.split("-");return(0,z.jsx)("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});En.displayName="Panel";var ps="https://reactflow.dev?utm_source=attribution";function lu({proOptions:e,position:t="bottom-right"}){return(0,P.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,z.jsx)(En,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ps}`,children:(0,z.jsx)("a",{href:ps,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var cu=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},vn=e=>e.id;function du(e,t){return ie(e.selectedNodes.map(vn),t.selectedNodes.map(vn))&&ie(e.selectedEdges.map(vn),t.selectedEdges.map(vn))}function uu({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(cu,du);return(0,P.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var fu=e=>!!e.onSelectionChangeHandlers;function pu({onSelectionChange:e}){let t=J(fu);return e||t?(0,z.jsx)(uu,{onSelectionChange:e}):null}var Vs=[0,0],hu={x:0,y:0,zoom:1},gu=["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"],hs=[...gu,"rfId"],mu=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}),gs={translateExtent:pt,nodeOrigin:Vs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yu(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(mu,ie),l=se();(0,P.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=gs,a()}),[]);let u=(0,P.useRef)(gs);return(0,P.useEffect)(()=>{for(let f of hs){let d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:Ri(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},hs.map(f=>e[f])),null}function ms(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bu(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let o=ms(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:ms()?.matches?"dark":"light"}var ys=typeof document<"u"?document:null;function Rt(e=null,t={target:ys,actInsideInputWithModifier:!0}){let[n,o]=(0,P.useState)(!1),r=(0,P.useRef)(!1),i=(0,P.useRef)(new Set([])),[s,a]=(0,P.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace(/\+/g,`
1
+ import{a as st,b as Tn,e as On,g as Ko,h as Go,i as Vt,j as Uo,k as Qo,l as at,o as jo,p as Jo,q as $n}from"./chunk-P5ET5XMK.js";import{a as Yo,b as Xo}from"./chunk-5CTTY5BQ.js";import{d as Vo,e as Fo}from"./chunk-PTZCSSDG.js";import{b as Il}from"./chunk-JAQUAFGK.js";import{a as Ho,b as Lo}from"./chunk-GLP5VV7P.js";import"./chunk-5AW2WUSZ.js";import{d as Zo,e as Wo,f as qo}from"./chunk-7K7GQKOA.js";import{Ab as Me,B as zo,C as Po,Ca as To,Da as Oo,Ia as $o,a as Bt,c as Dn,lb as Ro,mb as An,nb as Ml,qa as Do,ta as Ao}from"./chunk-WRXJZR6G.js";import{a as Bo}from"./chunk-J6IRWTF7.js";import{c as Te}from"./chunk-DCANE7XH.js";var oe=Te(Dn(),1);var z=Te(An()),P=Te(Dn());function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ft="http://www.w3.org/1999/xhtml",Rn={svg:"http://www.w3.org/2000/svg",xhtml:Ft,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ie(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function zl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ft&&t.documentElement.namespaceURI===Ft?t.createElement(e):t.createElementNS(n,e)}}function Pl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yt(e){var t=Ie(e);return(t.local?Pl:zl)(t)}function Dl(){}function Ke(e){return e==null?Dl:function(){return this.querySelector(e)}}function er(e){typeof e!="function"&&(e=Ke(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function Hn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Al(){return[]}function kt(e){return e==null?Al:function(){return this.querySelectorAll(e)}}function Tl(e){return function(){return Hn(e.apply(this,arguments))}}function tr(e){typeof e=="function"?e=Tl(e):e=kt(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function _t(e){return function(){return this.matches(e)}}function Xt(e){return function(t){return t.matches(e)}}var Ol=Array.prototype.find;function $l(e){return function(){return Ol.call(this.children,e)}}function Rl(){return this.firstElementChild}function nr(e){return this.select(e==null?Rl:$l(typeof e=="function"?e:Xt(e)))}var Hl=Array.prototype.filter;function Ll(){return Array.from(this.children)}function Bl(e){return function(){return Hl.call(this.children,e)}}function or(e){return this.selectAll(e==null?Ll:Bl(typeof e=="function"?e:Xt(e)))}function rr(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Zt(e){return new Array(e.length)}function ir(){return new le(this._enter||this._groups.map(Zt),this._parents)}function St(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}St.prototype={constructor:St,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 sr(e){return function(){return e}}function Vl(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new St(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Fl(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,f=i.length,d=new Array(u),p;for(a=0;a<u;++a)(c=t[a])&&(d[a]=p=s.call(c,c.__data__,a,t)+"",l.has(p)?r[a]=c:l.set(p,c));for(a=0;a<f;++a)p=s.call(e,i[a],a,i)+"",(c=l.get(p))?(o[a]=c,c.__data__=i[a],l.delete(p)):n[a]=new St(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Yl(e){return e.__data__}function ar(e,t){if(!arguments.length)return Array.from(this,Yl);var n=t?Fl:Vl,o=this._parents,r=this._groups;typeof e!="function"&&(e=sr(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],f=r[l],d=f.length,p=Xl(e.call(u,u&&u.__data__,l,o)),h=p.length,w=a[l]=new Array(h),b=s[l]=new Array(h),m=c[l]=new Array(d);n(u,f,w,b,m,p,t);for(var k=0,g=0,x,E;k<h;++k)if(x=w[k]){for(k>=g&&(g=k+1);!(E=b[g])&&++g<h;);x._next=E||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function Xl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lr(){return new le(this._exit||this._groups.map(Zt),this._parents)}function cr(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function dr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],u=o[c],f=l.length,d=a[c]=new Array(f),p,h=0;h<f;++h)(p=l[h]||u[h])&&(d[h]=p);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function ur(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function fr(e){e||(e=Zl);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Zl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hr(){return Array.from(this)}function gr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function mr(){let e=0;for(let t of this)++e;return e}function yr(){return!this.node()}function br(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Wl(e){return function(){this.removeAttribute(e)}}function ql(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kl(e,t){return function(){this.setAttribute(e,t)}}function Gl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ql(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function xr(e,t){var n=Ie(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?ql:Wl:typeof t=="function"?n.local?Ql:Ul:n.local?Gl:Kl)(n,t))}function Wt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function jl(e){return function(){this.style.removeProperty(e)}}function Jl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ec(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function wr(e,t,n){return arguments.length>1?this.each((t==null?jl:typeof t=="function"?ec:Jl)(e,t,n??"")):Oe(this.node(),e)}function Oe(e,t){return e.style.getPropertyValue(t)||Wt(e).getComputedStyle(e,null).getPropertyValue(t)}function tc(e){return function(){delete this[e]}}function nc(e,t){return function(){this[e]=t}}function oc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function vr(e,t){return arguments.length>1?this.each((t==null?tc:typeof t=="function"?oc:nc)(e,t)):this.node()[e]}function kr(e){return e.trim().split(/^|\s+/)}function Ln(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=kr(e.getAttribute("class")||"")}_r.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 Sr(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Er(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function rc(e){return function(){Sr(this,e)}}function ic(e){return function(){Er(this,e)}}function sc(e,t){return function(){(t.apply(this,arguments)?Sr:Er)(this,e)}}function Nr(e,t){var n=kr(e+"");if(arguments.length<2){for(var o=Ln(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?sc:t?rc:ic)(n,t))}function ac(){this.textContent=""}function lc(e){return function(){this.textContent=e}}function cc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Cr(e){return arguments.length?this.each(e==null?ac:(typeof e=="function"?cc:lc)(e)):this.node().textContent}function dc(){this.innerHTML=""}function uc(e){return function(){this.innerHTML=e}}function fc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mr(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?fc:uc)(e)):this.node().innerHTML}function pc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ir(){return this.each(pc)}function hc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zr(){return this.each(hc)}function Pr(e){var t=typeof e=="function"?e:Yt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function gc(){return null}function Dr(e,t){var n=typeof e=="function"?e:Yt(e),o=t==null?gc:typeof t=="function"?t:Ke(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function mc(){var e=this.parentNode;e&&e.removeChild(this)}function Ar(){return this.each(mc)}function yc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tr(e){return this.select(e?bc:yc)}function Or(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xc(e){return function(t){e.call(this,t,this.__data__)}}function wc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function vc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function kc(e,t,n){return function(){var o=this.__on,r,i=xc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function $r(e,t,n){var o=wc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?kc:vc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Rr(e,t,n){var o=Wt(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function _c(e,t){return function(){return Rr(this,e,t)}}function Sc(e,t){return function(){return Rr(this,e,t.apply(this,arguments))}}function Hr(e,t){return this.each((typeof t=="function"?Sc:_c)(e,t))}function*Lr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Bn=[null];function le(e,t){this._groups=e,this._parents=t}function Br(){return new le([[document.documentElement]],Bn)}function Ec(){return this}le.prototype=Br.prototype={constructor:le,select:er,selectAll:tr,selectChild:nr,selectChildren:or,filter:rr,data:ar,enter:ir,exit:lr,join:cr,merge:dr,selection:Ec,order:ur,sort:fr,call:pr,nodes:hr,node:gr,size:mr,empty:yr,each:br,attr:xr,style:wr,property:vr,classed:Nr,text:Cr,html:Mr,raise:Ir,lower:zr,append:Pr,insert:Dr,remove:Ar,clone:Tr,datum:Or,on:$r,dispatch:Hr,[Symbol.iterator]:Lr};var ze=Br;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Bn)}function Vr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=Vr(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}var Fr={passive:!1},Ge={capture:!0,passive:!1};function qt(e){e.stopImmediatePropagation()}function $e(e){e.preventDefault(),e.stopImmediatePropagation()}function Et(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",$e,Ge);"onselectstart"in t?n.on("selectstart.drag",$e,Ge):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Nt(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",$e,Ge),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ct=e=>()=>e;function Mt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Mt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Nc(e){return!e.ctrlKey&&!e.button}function Cc(){return this.parentNode}function Mc(e,t){return t??{x:e.x,y:e.y}}function Ic(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kt(){var e=Nc,t=Cc,n=Mc,o=Ic,r={},i=st("start","drag","end"),s=0,a,c,l,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",m,Fr).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,E){if(!(u||!e.call(this,x,E))){var S=g(this,t.call(this,x,E),x,E,"mouse");S&&(de(x.view).on("mousemove.drag",h,Ge).on("mouseup.drag",w,Ge),Et(x.view),qt(x),l=!1,a=x.clientX,c=x.clientY,S("start",x))}}function h(x){if($e(x),!l){var E=x.clientX-a,S=x.clientY-c;l=E*E+S*S>f}r.mouse("drag",x)}function w(x){de(x.view).on("mousemove.drag mouseup.drag",null),Nt(x.view,l),$e(x),r.mouse("end",x)}function b(x,E){if(e.call(this,x,E)){var S=x.changedTouches,N=t.call(this,x,E),T=S.length,I,V;for(I=0;I<T;++I)(V=g(this,N,x,E,S[I].identifier,S[I]))&&(qt(x),V("start",x,S[I]))}}function m(x){var E=x.changedTouches,S=E.length,N,T;for(N=0;N<S;++N)(T=r[E[N].identifier])&&($e(x),T("drag",x,E[N]))}function k(x){var E=x.changedTouches,S=E.length,N,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(T=r[E[N].identifier])&&(qt(x),T("end",x,E[N]))}function g(x,E,S,N,T,I){var V=i.copy(),$=pe(I||S,E),B,M,y;if((y=n.call(x,new Mt("beforestart",{sourceEvent:S,target:d,identifier:T,active:s,x:$[0],y:$[1],dx:0,dy:0,dispatch:V}),N))!=null)return B=y.x-$[0]||0,M=y.y-$[1]||0,function v(_,C,D){var A=$,L;switch(_){case"start":r[T]=v,L=s++;break;case"end":delete r[T],--s;case"drag":$=pe(D||C,E),L=s;break}V.call(_,x,new Mt(_,{sourceEvent:C,subject:y,target:d,identifier:T,active:L,x:$[0]+B,y:$[1]+M,dx:$[0]-A[0],dy:$[1]-A[1],dispatch:V}),N)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Ct(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:Ct(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Ct(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:Ct(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var zc=st("start","end","cancel","interrupt"),Pc=[],Zr=0,Yr=1,Ut=2,Gt=3,Xr=4,Qt=5,It=6;function Re(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Dc(e,n,{name:t,index:o,group:r,on:zc,tween:Pc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zr})}function zt(e,t){var n=ce(e,t);if(n.state>Zr)throw new Error("too late; already scheduled");return n}function fe(e,t){var n=ce(e,t);if(n.state>Gt)throw new Error("too late; already running");return n}function ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Dc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Jo(i,0,n.time);function i(l){n.state=Yr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,p;if(n.state!==Yr)return c();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Gt)return $n(s);p.state===Xr?(p.state=It,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=It,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if($n(function(){n.state===Gt&&(n.state=Xr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ut,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ut){for(n.state=Gt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Qt,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===Qt&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=It,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Ue(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Ut&&o.state<Qt,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Wr(e){return this.each(function(){Ue(this,e)})}function Ac(e,t){var n,o;return function(){var r=fe(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Tc(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=fe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function qr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ce(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Ac:Tc)(n,e,t))}function lt(e,t,n){var o=e._id;return e.each(function(){var r=fe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ce(r,o).value[t]}}function jt(e,t){var n;return(typeof t=="number"?Ko:t instanceof Tn?On:(n=Tn(t))?(t=n,On):Go)(e,t)}function Oc(e){return function(){this.removeAttribute(e)}}function $c(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Rc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Hc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Lc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Bc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Kr(e,t){var n=Ie(e),o=n==="transform"?Qo:jt;return this.attrTween(e,typeof t=="function"?(n.local?Bc:Lc)(n,o,lt(this,"attr."+e,t)):t==null?(n.local?$c:Oc)(n):(n.local?Hc:Rc)(n,o,t))}function Vc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Fc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Fc(e,i)),n}return r._value=t,r}function Xc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(e,i)),n}return r._value=t,r}function Gr(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Ie(e);return this.tween(n,(o.local?Yc:Xc)(o,t))}function Zc(e,t){return function(){zt(this,e).delay=+t.apply(this,arguments)}}function Wc(e,t){return t=+t,function(){zt(this,e).delay=t}}function Ur(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zc:Wc)(t,e)):ce(this.node(),t).delay}function qc(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function Kc(e,t){return t=+t,function(){fe(this,e).duration=t}}function Qr(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qc:Kc)(t,e)):ce(this.node(),t).duration}function Gc(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function jr(e){var t=this._id;return arguments.length?this.each(Gc(t,e)):ce(this.node(),t).ease}function Uc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function Jr(e){if(typeof e!="function")throw new Error;return this.each(Uc(this._id,e))}function ei(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new he(o,this._parents,this._name,this._id)}function ti(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,p=0;p<u;++p)(d=c[p]||l[p])&&(f[p]=d);for(;a<o;++a)s[a]=t[a];return new he(s,this._parents,this._name,this._id)}function Qc(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function jc(e,t,n){var o,r,i=Qc(t)?zt:fe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ni(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(jc(n,e,t))}function Jc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function oi(){return this.on("end.remove",Jc(this._id))}function ri(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ke(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Re(l[d],t,n,d,l,ce(u,n)));return new he(i,this._parents,t,n)}function ii(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kt(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),p,h=ce(u,n),w=0,b=d.length;w<b;++w)(p=d[w])&&Re(p,t,n,w,d,h);i.push(d),s.push(u)}return new he(i,s,t,n)}var ed=ze.prototype.constructor;function si(){return new ed(this._groups,this._parents)}function td(e,t){var n,o,r;return function(){var i=Oe(this,e),s=(this.style.removeProperty(e),Oe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ai(e){return function(){this.style.removeProperty(e)}}function nd(e,t,n){var o,r=n+"",i;return function(){var s=Oe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function od(e,t,n){var o,r,i;return function(){var s=Oe(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oe(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function rd(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=fe(this,e),l=c.on,u=c.value[i]==null?a||(a=ai(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function li(e,t,n){var o=(e+="")=="transform"?Uo:jt;return t==null?this.styleTween(e,td(e,o)).on("end.style."+e,ai(e)):typeof t=="function"?this.styleTween(e,od(e,o,lt(this,"style."+e,t))).each(rd(this._id,e)):this.styleTween(e,nd(e,o,t),n).on("end.style."+e,null)}function id(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function sd(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&id(e,s,n)),o}return i._value=t,i}function ci(e,t,n){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,sd(e,t,n??""))}function ad(e){return function(){this.textContent=e}}function ld(e){return function(){var t=e(this);this.textContent=t??""}}function di(e){return this.tween("text",typeof e=="function"?ld(lt(this,"text",e)):ad(e==null?"":e+""))}function cd(e){return function(t){this.textContent=e.call(this,t)}}function dd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cd(r)),t}return o._value=e,o}function ui(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,dd(e))}function fi(){for(var e=this._name,t=this._id,n=Jt(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ce(c,t);Re(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new he(o,this._parents,e,n)}function pi(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=fe(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var ud=0;function he(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function hi(e){return ze().transition(e)}function Jt(){return++ud}var Pe=ze.prototype;he.prototype=hi.prototype={constructor:he,select:ri,selectAll:ii,selectChild:Pe.selectChild,selectChildren:Pe.selectChildren,filter:ei,merge:ti,selection:si,transition:fi,call:Pe.call,nodes:Pe.nodes,node:Pe.node,size:Pe.size,empty:Pe.empty,each:Pe.each,on:ni,attr:Kr,attrTween:Gr,style:li,styleTween:ci,text:di,textTween:ui,remove:oi,tween:qr,delay:Ur,duration:Qr,ease:jr,easeVarying:Jr,end:pi,[Symbol.iterator]:Pe[Symbol.iterator]};function en(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fd={time:null,delay:0,duration:250,ease:en};function pd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function gi(e){var t,n;e instanceof he?(t=e._id,e=e._name):(t=Jt(),(n=fd).time=jo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Re(c,e,t,l,s,n||pd(c,t));return new he(o,this._parents,e,t)}ze.prototype.interrupt=Wr;ze.prototype.transition=gi;var Pt=e=>()=>e;function Vn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(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 Qe=new we(1,0,0);Dt.prototype=we.prototype;function Dt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qe;return e.__zoom}function tn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function hd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gd(){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 mi(){return this.__zoom||Qe}function md(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yd(){return navigator.maxTouchPoints||"ontouchstart"in this}function bd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function nn(){var e=hd,t=gd,n=bd,o=md,r=yd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=at,l=st("start","zoom","end"),u,f,d,p=500,h=150,w=0,b=10;function m(y){y.property("__zoom",mi).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,v,_,C){var D=y.selection?y.selection():y;D.property("__zoom",mi),y!==D?E(y,v,_,C):D.interrupt().each(function(){S(this,arguments).event(C).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},m.scaleBy=function(y,v,_,C){m.scaleTo(y,function(){var D=this.__zoom.k,A=typeof v=="function"?v.apply(this,arguments):v;return D*A},_,C)},m.scaleTo=function(y,v,_,C){m.transform(y,function(){var D=t.apply(this,arguments),A=this.__zoom,L=_==null?x(D):typeof _=="function"?_.apply(this,arguments):_,H=A.invert(L),F=typeof v=="function"?v.apply(this,arguments):v;return n(g(k(A,F),L,H),D,s)},_,C)},m.translateBy=function(y,v,_,C){m.transform(y,function(){return n(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),s)},null,C)},m.translateTo=function(y,v,_,C,D){m.transform(y,function(){var A=t.apply(this,arguments),L=this.__zoom,H=C==null?x(A):typeof C=="function"?C.apply(this,arguments):C;return n(Qe.translate(H[0],H[1]).scale(L.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof _=="function"?-_.apply(this,arguments):-_),A,s)},C,D)};function k(y,v){return v=Math.max(i[0],Math.min(i[1],v)),v===y.k?y:new we(v,y.x,y.y)}function g(y,v,_){var C=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return C===y.x&&D===y.y?y:new we(y.k,C,D)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function E(y,v,_,C){y.on("start.zoom",function(){S(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(C).end()}).tween("zoom",function(){var D=this,A=arguments,L=S(D,A).event(C),H=t.apply(D,A),F=_==null?x(H):typeof _=="function"?_.apply(D,A):_,K=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),Y=D.__zoom,G=typeof v=="function"?v.apply(D,A):v,ee=c(Y.invert(F).concat(K/Y.k),G.invert(F).concat(K/G.k));return function(q){if(q===1)q=G;else{var R=ee(q),Z=K/R[2];q=new we(Z,F[0]-R[0]*Z,F[1]-R[1]*Z)}L.zoom(null,q)}})}function S(y,v,_){return!_&&y.__zooming||new N(y,v)}function N(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}N.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,v){return this.mouse&&y!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var v=de(this.that).datum();l.call(y,this.that,new Vn(y,{sourceEvent:this.sourceEvent,target:m,type:y,transform:this.that.__zoom,dispatch:l}),v)}};function T(y,...v){if(!e.apply(this,arguments))return;var _=S(this,v).event(y),C=this.__zoom,D=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,o.apply(this,arguments)))),A=pe(y);if(_.wheel)(_.mouse[0][0]!==A[0]||_.mouse[0][1]!==A[1])&&(_.mouse[1]=C.invert(_.mouse[0]=A)),clearTimeout(_.wheel);else{if(C.k===D)return;_.mouse=[A,C.invert(A)],Ue(this),_.start()}ct(y),_.wheel=setTimeout(L,h),_.zoom("mouse",n(g(k(C,D),_.mouse[0],_.mouse[1]),_.extent,s));function L(){_.wheel=null,_.end()}}function I(y,...v){if(d||!e.apply(this,arguments))return;var _=y.currentTarget,C=S(this,v,!0).event(y),D=de(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",K,!0),A=pe(y,_),L=y.clientX,H=y.clientY;Et(y.view),tn(y),C.mouse=[A,this.__zoom.invert(A)],Ue(this),C.start();function F(Y){if(ct(Y),!C.moved){var G=Y.clientX-L,ee=Y.clientY-H;C.moved=G*G+ee*ee>w}C.event(Y).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=pe(Y,_),C.mouse[1]),C.extent,s))}function K(Y){D.on("mousemove.zoom mouseup.zoom",null),Nt(Y.view,C.moved),ct(Y),C.event(Y).end()}}function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,C=pe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(C),A=_.k*(y.shiftKey?.5:2),L=n(g(k(_,A),C,D),t.apply(this,v),s);ct(y),a>0?de(this).transition().duration(a).call(E,L,C,y):de(this).call(m.transform,L,C,y)}}function $(y,...v){if(e.apply(this,arguments)){var _=y.touches,C=_.length,D=S(this,v,y.changedTouches.length===C).event(y),A,L,H,F;for(tn(y),L=0;L<C;++L)H=_[L],F=pe(H,this),F=[F,this.__zoom.invert(F),H.identifier],D.touch0?!D.touch1&&D.touch0[2]!==F[2]&&(D.touch1=F,D.taps=0):(D.touch0=F,A=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),A&&(D.taps<2&&(f=F[0],u=setTimeout(function(){u=null},p)),Ue(this),D.start())}}function B(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L,H,F;for(ct(y),A=0;A<D;++A)L=C[A],H=pe(L,this),_.touch0&&_.touch0[2]===L.identifier?_.touch0[0]=H:_.touch1&&_.touch1[2]===L.identifier&&(_.touch1[0]=H);if(L=_.that.__zoom,_.touch1){var K=_.touch0[0],Y=_.touch0[1],G=_.touch1[0],ee=_.touch1[1],q=(q=G[0]-K[0])*q+(q=G[1]-K[1])*q,R=(R=ee[0]-Y[0])*R+(R=ee[1]-Y[1])*R;L=k(L,Math.sqrt(q/R)),H=[(K[0]+G[0])/2,(K[1]+G[1])/2],F=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2]}else if(_.touch0)H=_.touch0[0],F=_.touch0[1];else return;_.zoom("touch",n(g(L,H,F),_.extent,s))}}function M(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L;for(tn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),A=0;A<D;++A)L=C[A],_.touch0&&_.touch0[2]===L.identifier?delete _.touch0:_.touch1&&_.touch1[2]===L.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(L=pe(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<b)){var H=de(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Pt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Pt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Pt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Pt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(b=+y,m):b},m}var ge={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n: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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},pt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wn=["Enter"," ","Escape"],qn={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var je;(function(e){e.Partial="partial",e.Full="full"})(je||(je={}));var Kn={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},_e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_e||(_e={}));var ut;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ut||(ut={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));var yi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Gn=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,zi=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Un=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Tt=(e,t=[0,0])=>{let{width:n,height:o}=be(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Qn=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,o=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):Un(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,cn(r,sn(a,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?dn(o):{x:0,y:0,width:0,height:0}},ht=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=cn(n,sn(r)),o=!0)}),o?dn(n):{x:0,y:0,width:0,height:0}},an=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{let a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,u=t.height/r,f=[];for(let d of e.values()){let{measured:p,selectable:h=!0,hidden:w=!1}=d;if(s&&!h||w)continue;let b=p.width??d.width??d.initialWidth??0,m=p.height??d.height??d.initialHeight??0,{x:k,y:g}=d.internals.positionAbsolute,x=Oi(a,c,l,u,k,g,b,m),E=b*m,S=i&&x>0;(!d.internals.handleBounds||S||x>=E||d.dragging)&&f.push(d)}return f},Pi=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function xd(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){let{width:s,height:a}=be(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Di({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=xd(e,s),c=ht(a),l=$t(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function jn({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){let s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o,f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ge.error005());else{let{width:p,height:h}=be(a);p&&h&&(f=[[c,l],[c+p,l+h]])}else a&&tt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);let d=tt(f)?Je(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ge.error015()),{position:{x:d.x-c+(s.measured.width??0)*u[0],y:d.y-l+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Ai({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let i=new Set(e.map(d=>d.id)),s=[];for(let d of n){if(d.deletable===!1)continue;let p=i.has(d.id),h=!p&&d.parentId&&s.find(w=>w.id===d.parentId);(p||h)&&s.push(d)}let a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=Pi(s,c);for(let d of c)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};let f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}var ft=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Je=(e={x:0,y:0},t,n)=>({x:ft(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ft(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ti(e,t,n){let{width:o,height:r}=be(n),{x:i,y:s}=n.internals.positionAbsolute;return Je(e,[[i,s],[i+o,s+r]],t)}var bi=(e,t,n)=>e<t?ft(Math.abs(e-t),1,t)/t:e>n?-ft(Math.abs(e-n),1,t)/t:0,ln=(e,t,n=15,o=40)=>{let r=bi(e.x,o,t.width-o)*n,i=bi(e.y,o,t.height-o)*n;return[r,i]},cn=(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)}),Zn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),dn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),gt=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},sn=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Jn=(e,t)=>dn(cn(Zn(e),Zn(t))),Oi=(e,t,n,o,r,i,s,a)=>{let c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},Ot=(e,t)=>Oi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),eo=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),to=(e,t)=>(n,o)=>{},mt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return i?mt(a,s):a},et=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function dt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wd(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=dt(e,n),r=dt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=dt(e.top??e.y??0,n),r=dt(e.bottom??e.y??0,n),i=dt(e.left??e.x??0,t),s=dt(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vd(e,t,n,o,r,i){let{x:s,y:a}=et(e,[t,n,o]),{x:c,y:l}=et({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}var $t=(e,t,n,o,r,i)=>{let s=wd(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=ft(l,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=vd(e,p,h,u,t,n),b={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:p-b.left+b.right,y:h-b.top+b.bottom,zoom:u}},bt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function tt(e){return e!=null&&e!=="parent"}function be(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function un(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function no(e,t={width:0,height:0},n,o,r){let i={...e},s=o.get(n);if(s){let a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function oo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function $i(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ri(e){return{...qn,...e||{}}}function ro(e){return e===null?null:e?"valid":"invalid"}function At(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:i,y:s}=ye(e),a=yt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?mt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}var fn=e=>({width:e.offsetWidth,height:e.offsetHeight}),io=e=>e?.getRootNode?.()||window?.document,kd=["INPUT","SELECT","TEXTAREA"];function so(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:kd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var ao=e=>"clientX"in e,ye=(e,t)=>{let n=ao(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},xi=(e,t,n,o,r)=>{let i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{let a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...fn(s)}})};function pn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){let c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),f=Math.abs(l-t);return[c,l,u,f]}function on(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-on(t-o,i),n];case X.Right:return[t+on(o-t,i),n];case X.Top:return[t,n-on(n-r,i)];case X.Bottom:return[t,n+on(r-n,i)]}}function hn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){let[a,c]=wi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=wi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,p,h]=pn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,f,d,p,h]}function lo({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Hi({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;let s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function Li({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let i=cn(sn(e),sn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);let s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ot(s,dn(i))>0}var _d=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Sd=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Bi=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||_d,r;return Gn(e)?r={...e}:r={...e,id:o(e)},Sd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gn({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,i,s,a]=lo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var vi={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Ed=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ki=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){let a=vi[t],c=vi[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},f=Ed({source:l,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d],h=[],w,b,m={x:0,y:0},k={x:0,y:0},[,,g,x]=lo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(w=r.x??l.x+(u.x-l.x)*s,b=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,b=r.y??l.y+(u.y-l.y)*s);let T=[{x:w,y:l.y},{x:w,y:u.y}],I=[{x:l.x,y:b},{x:u.x,y:b}];a[d]===p?h=d==="x"?T:I:h=d==="x"?I:T}else{let T=[{x:l.x,y:u.y}],I=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===p?I:T:h=a.y===p?T:I,t===o){let y=Math.abs(e[d]-n[d]);if(y<=i){let v=Math.min(i-1,i-y);a[d]===p?m[d]=(l[d]>e[d]?-1:1)*v:k[d]=(u[d]>n[d]?-1:1)*v}}if(t!==o){let y=d==="x"?"y":"x",v=a[d]===c[y],_=l[y]>u[y],C=l[y]<u[y];(a[d]===1&&(!v&&_||v&&C)||a[d]!==1&&(!v&&C||v&&_))&&(h=d==="x"?T:I)}let V={x:l.x+m.x,y:l.y+m.y},$={x:u.x+k.x,y:u.y+k.y},B=Math.max(Math.abs(V.x-h[0].x),Math.abs($.x-h[0].x)),M=Math.max(Math.abs(V.y-h[0].y),Math.abs($.y-h[0].y));B>=M?(w=(V.x+$.x)/2,b=h[0].y):(w=h[0].x,b=(V.y+$.y)/2)}let E={x:l.x+m.x,y:l.y+m.y},S={x:u.x+k.x,y:u.y+k.y};return[[e,...E.x!==h[0].x||E.y!==h[0].y?[E]:[],...h,...S.x!==h[h.length-1].x||S.y!==h[h.length-1].y?[S]:[],n],w,b,g,x]}function Cd(e,t,n,o){let r=Math.min(ki(e,t)/2,ki(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){let l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}let a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function nt({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){let[f,d,p,h,w]=Nd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u}),b=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)b+=Cd(f[m-1],f[m],f[m+1],s);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,d,p,h,w]}function _i(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Vi(e){let{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;let o=t.internals.handleBounds||Si(t.handles),r=n.internals.handleBounds||Si(n.handles),i=Ei(o?.source??[],e.sourceHandle),s=Ei(e.connectionMode===Ve.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ge.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=i?.position||X.Bottom,c=s?.position||X.Top,l=Fe(t,i,a),u=Fe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Si(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=X.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??be(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function Ei(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function mn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Fi(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){let l=mn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}var Yi=1e3,Md=10,co={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Id={...co,checkEquality:!0};function uo(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Xi(e,t,n){let o=uo(co,n);for(let r of e.values())if(r.parentId)po(r,e,t,o);else{let i=Tt(r,o.nodeOrigin),s=tt(r.extent)?r.extent:o.nodeExtent,a=Je(i,s,be(r));r.internals.positionAbsolute=a}}function zd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function fo(e){return e==="manual"}function yn(e,t,n,o={}){let r=uo(Id,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!fo(r.zIndexMode)?Yi:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let f=s.get(u.id);if(r.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{let d=Tt(u,r.nodeOrigin),p=tt(u.extent)?u.extent:r.nodeExtent,h=Je(d,p,be(u));f={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:zd(u,f),z:Zi(u,a,r.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&po(f,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Pd(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function po(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=uo(co,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Pd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Md),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);let f=i&&!fo(c)?Yi:0,{x:d,y:p,z:h}=Dd(e,u,s,a,f,c),{positionAbsolute:w}=e.internals,b=d!==w.x||p!==w.y;(b||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:d,y:p}:w,z:h}})}function Zi(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return fo(n)?o:o+(e.selected?t:0)}function Dd(e,t,n,o,r,i){let{x:s,y:a}=t.internals.positionAbsolute,c=be(e),l=Tt(e,n),u=tt(e.extent)?Je(l,e.extent,c):l,f=Je({x:s+u.x,y:a+u.y},o,c);e.extent==="parent"&&(f=Ti(f,c,t));let d=Zi(e,r,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function bn(e,t,n,o=[0,0]){let r=[],i=new Map;for(let s of e){let a=t.get(s.parentId);if(!a)continue;let c=i.get(s.parentId)?.expandedRect??gt(a),l=Jn(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{let l=a.internals.positionAbsolute,u=be(a),f=a.origin??o,d=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,p=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,h=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),b=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||b||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+b,y:a.position.y-p+m}}),n.get(c)?.forEach(k=>{e.some(g=>g.id===k.id)||r.push({id:k.id,type:"position",position:{x:k.position.x+d,y:k.position.y+p}})})),(u.width<s.width||u.height<s.height||d||p)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-b:0),height:w+(p?f[1]*p-m:0)}})}),r}function Wi(e,t,n,o,r,i,s){let a=o?.querySelector(".xyflow__viewport"),c=!1;if(!a)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(let p of e.values()){let h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),c=!0;continue}let w=fn(p.nodeElement),b=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(b||!h.internals.handleBounds||p.force))){let k=p.nodeElement.getBoundingClientRect(),g=tt(h.extent)?h.extent:i,{positionAbsolute:x}=h.internals;if(h.parentId&&h.extent==="parent"){let S=t.get(h.parentId);S&&(x=Ti(x,w,S))}else g&&(x=Je(x,g,w));let E={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:xi("source",p.nodeElement,k,f,h.id),target:xi("target",p.nodeElement,k,f,h.id)}}};t.set(h.id,E),h.parentId&&po(E,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,b&&(l.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:gt(E,r)}))}}if(d.length>0){let p=bn(d,t,n,r);l.push(...p)}return{changes:l,updatedInternals:c}}async function qi({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;let s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Ni(e,t,n,o,r,i){let s=r,a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;let c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;let l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function ho(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Ni("source",c,u,e,r,s),Ni("target",c,l,e,i,a),t.set(o.id,o)}}function Ki(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Ki(n,t):!1}function Ci(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Ad(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ki(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Fn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[s,a]of t){let c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Td({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let i={x:n-r.distance.x,y:o-r.distance.y},s=mt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Gi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function b({noDragClassName:k,handleSelector:g,domNode:x,isSelectable:E,nodeId:S,nodeClickDistance:N=0}){d=de(x);function T({x:B,y:M}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:C,nodeOrigin:D,onNodeDrag:A,onSelectionDrag:L,onError:H,updateNodePositions:F}=t();i={x:B,y:M};let K=!1,Y=a.size>1,G=Y&&v?Zn(ht(a)):null,ee=Y&&C?Td({dragItems:a,snapGrid:_,x:B,y:M}):null;for(let[q,R]of a){if(!y.has(q))continue;let Z={x:B-R.distance.x,y:M-R.distance.y};C&&(Z=ee?{x:Math.round(Z.x+ee.x),y:Math.round(Z.y+ee.y)}:mt(Z,_));let j=null;if(Y&&v&&!R.extent&&G){let{positionAbsolute:U}=R.internals,te=U.x-G.x+v[0][0],ne=U.x+R.measured.width-G.x2+v[1][0],re=U.y-G.y+v[0][1],ue=U.y+R.measured.height-G.y2+v[1][1];j=[[te,re],[ne,ue]]}let{position:Q,positionAbsolute:W}=jn({nodeId:q,nextPosition:Z,nodeLookup:y,nodeExtent:j||v,nodeOrigin:D,onError:H});K=K||R.position.x!==Q.x||R.position.y!==Q.y,R.position=Q,R.internals.positionAbsolute=W}if(h=h||K,!!K&&(F(a,!0),w&&(o||A||!S&&L))){let[q,R]=Fn({nodeId:S,dragItems:a,nodeLookup:y});o?.(w,a,q,R),A?.(w,q,R),S||L?.(w,R)}}async function I(){if(!u)return;let{transform:B,panBy:M,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){c=!1,cancelAnimationFrame(s);return}let[_,C]=ln(l,u,y);(_!==0||C!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-C/B[2],await M({x:_,y:C})&&T(i)),s=requestAnimationFrame(I)}function V(B){let{nodeLookup:M,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:C,snapToGrid:D,selectNodesOnDrag:A,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!A||!E)&&!y&&S&&(M.get(S)?.selected||F()),E&&A&&S&&e?.(S);let K=At(B.sourceEvent,{transform:_,snapGrid:C,snapToGrid:D,containerBounds:u});if(i=K,a=Ad(M,v,K,S),a.size>0&&(n||L||!S&&H)){let[Y,G]=Fn({nodeId:S,dragItems:a,nodeLookup:M});n?.(B.sourceEvent,a,Y,G),L?.(B.sourceEvent,Y,G),S||H?.(B.sourceEvent,G)}}let $=Kt().clickDistance(N).on("start",B=>{let{domNode:M,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:C}=t();u=M?.getBoundingClientRect()||null,p=!1,h=!1,w=B.sourceEvent,y===0&&V(B),i=At(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:C,containerBounds:u}),l=ye(B.sourceEvent,u)}).on("drag",B=>{let{autoPanOnNodeDrag:M,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:C,nodeLookup:D}=t(),A=At(B.sourceEvent,{transform:y,snapGrid:v,snapToGrid:_,containerBounds:u});if(w=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||S&&!D.has(S))&&(p=!0),!p){if(!c&&M&&f&&(c=!0,I()),!f){let L=ye(B.sourceEvent,u),H=L.x-l.x,F=L.y-l.y;Math.sqrt(H*H+F*F)>C&&V(B)}(i.x!==A.xSnapped||i.y!==A.ySnapped)&&a&&f&&(l=ye(B.sourceEvent,u),T(A))}}).on("end",B=>{if(!f||p){p&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){let{nodeLookup:M,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(h&&(y(a,!1),h=!1),r||v||!S&&_){let[C,D]=Fn({nodeId:S,dragItems:a,nodeLookup:M,dragging:!1});r?.(B.sourceEvent,a,C,D),v?.(B.sourceEvent,C,D),S||_?.(B.sourceEvent,D)}}}).filter(B=>{let M=B.target;return!B.button&&(!k||!Ci(M,`.${k}`,x))&&(!g||Ci(M,g,x))});d.call($)}function m(){d?.on(".drag",null)}return{update:b,destroy:m}}function Od(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let i of t.values())Ot(r,gt(i))>0&&o.push(i);return o}var $d=250;function Rd(e,t,n,o){let r=[],i=1/0,s=Od(e,n,t+$d);for(let a of s){let c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:u,y:f}=Fe(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...l,x:u,y:f}],i=d):d===i&&r.push({...l,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ui(e,t,n,o,r,i=!1){let s=o.get(e);if(!s)return null;let a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...Fe(s,c,c.position,!0)}:c}function Qi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Hd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var ji=()=>!0;function Ld(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:b,isValidConnection:m=ji,onReconnectEnd:k,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:T}){let I=io(e.target),V=0,$,{x:B,y:M}=ye(e),y=Qi(i,T),v=a?.getBoundingClientRect(),_=!1;if(!v||!y)return;let C=Ui(r,y,o,c,t);if(!C)return;let D=ye(e,v),A=!1,L=null,H=!1,F=null;function K(){if(!u||!v)return;let[Q,W]=ln(D,v,S);d({x:Q,y:W}),V=requestAnimationFrame(K)}let Y={...C,nodeId:r,type:y,position:C.position},G=c.get(r),q={inProgress:!0,isValid:null,from:Fe(G,Y,X.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:G,to:D,toHandle:null,toPosition:yi[Y.position],toNode:null,pointer:D};function R(){_=!0,g(q),h?.(e,{nodeId:r,handleId:o,handleType:y})}N===0&&R();function Z(Q){if(!_){let{x:ue,y:Se}=ye(Q),ve=ue-B,ke=Se-M;if(!(ve*ve+ke*ke>N*N))return;R()}if(!E()||!Y){j(Q);return}let W=x();D=ye(Q,v),$=Rd(yt(D,W,!1,[1,1]),n,c,Y),A||(K(),A=!0);let U=Ji(Q,{handle:$,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:f,nodeLookup:c});F=U.handleDomNode,L=U.connection,H=Hd(!!$,U.isValid);let te=c.get(r),ne=te?Fe(te,Y,X.Left,!0):q.from,re={...q,from:ne,isValid:H,to:U.toHandle&&H?et({x:U.toHandle.x,y:U.toHandle.y},W):D,toHandle:U.toHandle,toPosition:H&&U.toHandle?U.toHandle.position:yi[Y.position],toNode:U.toHandle?c.get(U.toHandle.nodeId):null,pointer:D};g(re),q=re}function j(Q){if(!("touches"in Q&&Q.touches.length>0)){if(_){($||F)&&L&&H&&w?.(L);let{inProgress:W,...U}=q,te={...U,toPosition:q.toHandle?q.toPosition:null};b?.(Q,te),i&&k?.(Q,te)}p(),cancelAnimationFrame(V),A=!1,H=!1,L=null,F=null,I.removeEventListener("mousemove",Z),I.removeEventListener("mouseup",j),I.removeEventListener("touchmove",Z),I.removeEventListener("touchend",j)}}I.addEventListener("mousemove",Z),I.addEventListener("mouseup",j),I.addEventListener("touchmove",Z),I.addEventListener("touchend",j)}function Ji(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=ji,nodeLookup:u}){let f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=ye(e),w=s.elementFromPoint(p,h),b=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let k=Qi(void 0,b),g=b.getAttribute("data-nodeid"),x=b.getAttribute("data-handleid"),E=b.classList.contains("connectable"),S=b.classList.contains("connectableend");if(!g||!k)return m;let N={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=N;let I=E&&S&&(n===Ve.Strict?f&&k==="source"||!f&&k==="target":g!==o||x!==r);m.isValid=I&&l(N),m.toHandle=Ui(g,k,x,u,n,!0)}return m}var xn={onPointerDown:Ld,isValid:Ji};function es({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=de(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){let h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let x=n(),E=g.sourceEvent.ctrlKey&&bt()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,N=x[2]*Math.pow(2,S*E);t.scaleTo(N)},w=[0,0],b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{let x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let E=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[E[0]-w[0],E[1]-w[1]];w=E;let N=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),T={x:x[0]-S[0]*N,y:x[1]-S[1]*N},I=[[0,0],[c,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},I,a)},k=nn().on("start",b).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(k,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:pe}}var wn=e=>({x:e.x,y:e.y,zoom:e.k}),Yn=({x:e,y:t,zoom:n})=>Qe.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),ts=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Bd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xn=(e,t=0,n=Bd,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ns=e=>{let t=e.ctrlKey&&bt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Vd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Be(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(u.ctrlKey&&s){let b=pe(u),m=ns(u),k=f*Math.pow(2,m);o.scaleTo(n,k,b,u);return}let d=u.deltaMode===1?20:1,p=r===De.Vertical?0:u.deltaX*d,h=r===De.Horizontal?0:u.deltaY*d;!bt()&&u.shiftKey&&r!==De.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*i,-(h/f)*i,{internal:!0});let w=wn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,w):(e.isPanScrolling=!0,a?.(u,w)),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)}}function Fd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Be(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Yd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=wn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Xd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&ts(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,wn(i.transform))}}function Zd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&ts(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=wn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Wd({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:f}){return d=>{let p=t||n,h=o&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Be(d,`${u}-flow__node`)||Be(d,`${u}-flow__edge`)||Be(d,`${u}-flow__selection`)||Be(d,`${u}-flow__nodesselection`)))return!0;if(!r&&!p&&!i&&!s&&!o||a||f&&!w||Be(d,c)&&w||Be(d,l)&&(!w||i&&w&&!t)||!o&&d.ctrlKey&&w)return!1;if(!o&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!p&&!i&&!h&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;let b=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w||e)&&b}}function os({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(M=>{let y=M[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let p=nn().extent(()=>f).scaleExtent([t,n]).translateExtent(o),h=de(e).call(p);x({x:r.x,y:r.y,zoom:ft(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);let w=h.on("wheel.zoom"),b=h.on("dblclick.zoom");p.wheelDelta(ns);async function m(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).transform(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function k({noWheelClassName:M,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:C,panOnDrag:D,panOnScrollMode:A,panOnScrollSpeed:L,preventScrolling:H,zoomOnPinch:F,zoomOnScroll:K,zoomOnDoubleClick:Y,panActivationKeyPressed:G=!1,zoomActivationKeyPressed:ee,lib:q,onTransformChange:R,connectionInProgress:Z,paneClickDistance:j,selectionOnDrag:Q}){_&&!l.isZoomingOrPanning&&g();let W=C&&!ee&&!_;p.clickDistance(Q?1/0:!me(j)||j<0?0:j);let U=W?Vd({zoomPanValues:l,noWheelClassName:M,d3Selection:h,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Fd({noWheelClassName:M,preventScrolling:H,d3ZoomHandler:w});h.on("wheel.zoom",U,{passive:!1});let te=Yd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});p.on("start",te);let ne=Xd({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:i,onTransformChange:R});p.on("zoom",ne);let re=Zd({zoomPanValues:l,panOnDrag:D,panOnScroll:C,onPaneContextMenu:v,onPanZoomEnd:a,onDraggingChange:c});p.on("end",re);let ue=Wd({panActivationKeyPressed:G,zoomActivationKeyPressed:ee,panOnDrag:D,zoomOnScroll:K,panOnScroll:C,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:M,lib:q,connectionInProgress:Z});p.filter(ue),Y?h.on("dblclick.zoom",b):h.on("dblclick.zoom",null)}function g(){p.on("zoom",null)}async function x(M,y,v){let _=Yn(M),C=p?.constrain()(_,y,v);return C&&await m(C),C}async function E(M,y){let v=Yn(M);return await m(v,y),v}function S(M){if(h){let y=Yn(M),v=h.property("__zoom");(v.k!==M.zoom||v.x!==M.x||v.y!==M.y)&&p?.transform(h,y,null,{sync:!0})}}function N(){let M=h?Dt(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function T(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleTo(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}async function I(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleBy(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function V(M){p?.scaleExtent(M)}function $(M){p?.translateExtent(M)}function B(M){let y=!me(M)||M<0?0:M;p?.clickDistance(y)}return{update:k,destroy:g,setViewport:E,setViewportConstrained:x,getViewport:N,scaleTo:T,scaleBy:I,setScaleExtent:V,setTranslateExtent:$,syncViewport:S,setClickDistance:B}}var Ye;(function(e){e.Line="line",e.Handle="handle"})(Ye||(Ye={}));function qd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){let s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Mi(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function He(e,t){return Math.max(0,t-e)}function Le(e,t){return Math.max(0,e-t)}function rn(e,t,n){return Math.max(0,t-e,e-n)}function Ii(e,t){return e?!t:t}function Kd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:b,minHeight:m,maxHeight:k}=o,{x:g,y:x,width:E,height:S,aspectRatio:N}=e,T=Math.floor(u?p-e.pointerX:0),I=Math.floor(f?h-e.pointerY:0),V=E+(c?-T:T),$=S+(l?-I:I),B=-i[0]*E,M=-i[1]*S,y=rn(V,w,b),v=rn($,m,k);if(s){let D=0,A=0;c&&T<0?D=He(g+T+B,s[0][0]):!c&&T>0&&(D=Le(g+V+B,s[1][0])),l&&I<0?A=He(x+I+M,s[0][1]):!l&&I>0&&(A=Le(x+$+M,s[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(a){let D=0,A=0;c&&T>0?D=Le(g+T,a[0][0]):!c&&T<0&&(D=He(g+V,a[1][0])),l&&I>0?A=Le(x+I,a[0][1]):!l&&I<0&&(A=He(x+$,a[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(r){if(u){let D=rn(V/N,m,k)*N;if(y=Math.max(y,D),s){let A=0;!c&&!l||c&&!l&&d?A=Le(x+M+V/N,s[1][1])*N:A=He(x+M+(c?T:-T)/N,s[0][1])*N,y=Math.max(y,A)}if(a){let A=0;!c&&!l||c&&!l&&d?A=He(x+V/N,a[1][1])*N:A=Le(x+(c?T:-T)/N,a[0][1])*N,y=Math.max(y,A)}}if(f){let D=rn($*N,w,b)/N;if(v=Math.max(v,D),s){let A=0;!c&&!l||l&&!c&&d?A=Le(g+$*N+B,s[1][0])/N:A=He(g+(l?I:-I)*N+B,s[0][0])/N,v=Math.max(v,A)}if(a){let A=0;!c&&!l||l&&!c&&d?A=He(g+$*N,a[1][0])/N:A=Le(g+(l?I:-I)*N,a[0][0])/N,v=Math.max(v,A)}}}I=I+(I<0?v:-v),T=T+(T<0?y:-y),r&&(d?V>$*N?I=(Ii(c,l)?-T:T)/N:T=(Ii(c,l)?-I:I)*N:u?(I=T/N,l=c):(T=I*N,c=l));let _=c?g+T:g,C=l?x+I:x;return{width:E+(c?-T:T),height:S+(l?-I:I),x:i[0]*T*(c?-1:1)+_,y:i[1]*I*(l?-1:1)+C}}var rs={width:0,height:0,x:0,y:0},Gd={...rs,pointerX:0,pointerY:0,aspectRatio:1};function Ud(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function is({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Mi("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:b}){let m={...rs},k={...Gd};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Mi(l)};let g,x=null,E=[],S,N,T,I=Kt().on("start",V=>{let{nodeLookup:$,transform:B,snapGrid:M,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(g=$.get(t),!g)return;x=_?.getBoundingClientRect()??null;let{xSnapped:C,ySnapped:D}=At(V.sourceEvent,{transform:B,snapGrid:M,snapToGrid:y,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},k={...m,pointerX:C,pointerY:D,aspectRatio:m.width/m.height},S=void 0,N=tt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId)),S&&g.extent==="parent"&&(N=[[0,0],[S.measured.width,S.measured.height]]),E=[],T=void 0;for(let[A,L]of $)if(L.parentId===t&&(E.push({id:A,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){let H=Ud(L,g,L.origin??v);T?T=[[Math.min(H[0][0],T[0][0]),Math.min(H[0][1],T[0][1])],[Math.max(H[1][0],T[1][0]),Math.max(H[1][1],T[1][1])]]:T=H}p?.(V,{...m})}).on("drag",V=>{let{transform:$,snapGrid:B,snapToGrid:M,nodeOrigin:y}=n(),v=At(V.sourceEvent,{transform:$,snapGrid:B,snapToGrid:M,containerBounds:x}),_=[];if(!g)return;let{x:C,y:D,width:A,height:L}=m,H={},F=g.origin??y,{width:K,height:Y,x:G,y:ee}=Kd(k,s.controlDirection,v,s.boundaries,s.keepAspectRatio,F,N,T),q=K!==A,R=Y!==L,Z=G!==C&&q,j=ee!==D&&R;if(!Z&&!j&&!q&&!R)return;let Q={prevValues:{...m},startX:k.x,startY:k.y,childNodes:E.map(ne=>({...ne,position:{...ne.position}}))};if((Z||j||F[0]===1||F[1]===1)&&(H.x=Z?G:m.x,H.y=j?ee:m.y,m.x=H.x,m.y=H.y,E.length>0)){let ne=G-C,re=ee-D;for(let ue of E)ue.position={x:ue.position.x-ne+F[0]*(K-A),y:ue.position.y-re+F[1]*(Y-L)},_.push(ue)}if((q||R)&&(H.width=q&&(!s.resizeDirection||s.resizeDirection==="horizontal")?K:m.width,H.height=R&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=H.width,m.height=H.height),S&&g.expandParent){let ne=F[0]*(H.width??0);H.x&&H.x<ne&&(m.x=ne,k.x=k.x-(H.x-ne));let re=F[1]*(H.height??0);H.y&&H.y<re&&(m.y=re,k.y=k.y-(H.y-re))}let W=qd({width:m.width,prevWidth:A,height:m.height,prevHeight:L,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),U={...m,direction:W};if(b?.(V,U)===!1){m=Q.prevValues,k.x=Q.startX,k.y=Q.startY,E.forEach((ne,re)=>{ne.position=Q.childNodes[re].position});return}h?.(V,U),o(H,_)}).on("end",V=>{w?.(V,{...m}),r?.({...m})});i.call(I)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var cs=Te(Dn(),1),ds=Te(Il(),1);var ss=e=>{let t,n=new Set,o=(u,f)=>{let d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){let p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},as=e=>e?ss(e):ss;var{useDebugValue:Qd}=cs.default,{useSyncExternalStoreWithSelector:jd}=ds.default,Jd=e=>e;function go(e,t=Jd,n){let o=jd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qd(o),o}var ls=(e,t)=>{let n=as(e),o=(r,i=t)=>go(n,r,i);return Object.assign(o,n),o},us=(e,t)=>e?ls(e,t):ls;function ie(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(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var eu=Te(Ml()),Sn=(0,P.createContext)(null),tu=Sn.Provider,Hs=ge.error001("react");function J(e,t){let n=(0,P.useContext)(Sn);if(n===null)throw new Error(Hs);return go(n,e,t)}function se(){let e=(0,P.useContext)(Sn);if(e===null)throw new Error(Hs);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var fs={display:"none"},nu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ls="react-flow__node-desc",Bs="react-flow__edge-desc",ou="react-flow__aria-live",ru=e=>e.ariaLiveMessage,iu=e=>e.ariaLabelConfig;function su({rfId:e}){let t=J(ru);return(0,z.jsx)("div",{id:`${ou}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:nu,children:t})}function au({rfId:e,disableKeyboardA11y:t}){let n=J(iu);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${Ls}-${e}`,style:fs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${Bs}-${e}`,style:fs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(su,{rfId:e})]})}var En=(0,P.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{let s=`${e}`.split("-");return(0,z.jsx)("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});En.displayName="Panel";var ps="https://reactflow.dev?utm_source=attribution";function lu({proOptions:e,position:t="bottom-right"}){return(0,P.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,z.jsx)(En,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ps}`,children:(0,z.jsx)("a",{href:ps,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var cu=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},vn=e=>e.id;function du(e,t){return ie(e.selectedNodes.map(vn),t.selectedNodes.map(vn))&&ie(e.selectedEdges.map(vn),t.selectedEdges.map(vn))}function uu({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(cu,du);return(0,P.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var fu=e=>!!e.onSelectionChangeHandlers;function pu({onSelectionChange:e}){let t=J(fu);return e||t?(0,z.jsx)(uu,{onSelectionChange:e}):null}var Vs=[0,0],hu={x:0,y:0,zoom:1},gu=["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"],hs=[...gu,"rfId"],mu=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}),gs={translateExtent:pt,nodeOrigin:Vs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yu(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(mu,ie),l=se();(0,P.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=gs,a()}),[]);let u=(0,P.useRef)(gs);return(0,P.useEffect)(()=>{for(let f of hs){let d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:Ri(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},hs.map(f=>e[f])),null}function ms(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bu(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let o=ms(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:ms()?.matches?"dark":"light"}var ys=typeof document<"u"?document:null;function Rt(e=null,t={target:ys,actInsideInputWithModifier:!0}){let[n,o]=(0,P.useState)(!1),r=(0,P.useRef)(!1),i=(0,P.useRef)(new Set([])),[s,a]=(0,P.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace(/\+/g,`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -0,0 +1,2 @@
1
+ import{a as w}from"./chunk-M5RCHTSV.js";import{a as A,b as v,d as L}from"./chunk-AIBH6MTQ.js";import"./chunk-UNH6G7NO.js";import{b as R,d as S}from"./chunk-7K7GQKOA.js";import{Ab as E,a as M,c as F,mb as D}from"./chunk-WRXJZR6G.js";import{a as T}from"./chunk-J6IRWTF7.js";import{c as x}from"./chunk-DCANE7XH.js";var n=x(F(),1);M(`.sb-block.ly-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.ly-block li:not(svg){padding:0}.sb-block.ly-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.ly-block{--ly-text: var(--sb-text);--ly-muted: var(--sb-muted);--ly-faint: color-mix(in srgb, var(--sb-muted) 70%, transparent);--ly-line: var(--sb-line);--ly-paper: var(--sb-surface);--ly-soft: var(--sb-soft);--ly-accent: var(--sb-accent);--ly-accent-soft: var(--sb-accent-soft);--ly-teal: #0d8579;--ly-teal-soft: #e6f4f2;--ly-orange: #bf6528;--ly-orange-soft: #fbefe6;--ly-violet: #7348d0;--ly-violet-soft: #f2edfc;--ly-rose: #c4415a;--ly-rose-soft: #fbebee;--ly-slate: #526476;--ly-slate-soft: #edf1f4;--t: var(--ly-accent);--ts: var(--ly-accent-soft);color:var(--ly-text);font-family:inherit;font-size:14px;line-height:1.65;padding:8px 0;container-type:inline-size;overflow-wrap:anywhere}:root[data-theme=dark] .sb-block.ly-block,[data-theme=dark] .sb-block.ly-block{--ly-teal: #4fc4b6;--ly-teal-soft: #163734;--ly-orange: #e79c64;--ly-orange-soft: #3b2b1e;--ly-violet: #b497ff;--ly-violet-soft: #2e2648;--ly-rose: #f0839a;--ly-rose-soft: #3e222a;--ly-slate: #a2b2c2;--ly-slate-soft: #242d35}.sb-block.ly-block *{box-sizing:border-box}.sb-block.ly-block [data-tone=accent]{--t: var(--ly-accent);--ts: var(--ly-accent-soft)}.sb-block.ly-block [data-tone=teal]{--t: var(--ly-teal);--ts: var(--ly-teal-soft)}.sb-block.ly-block [data-tone=orange]{--t: var(--ly-orange);--ts: var(--ly-orange-soft)}.sb-block.ly-block [data-tone=violet]{--t: var(--ly-violet);--ts: var(--ly-violet-soft)}.sb-block.ly-block [data-tone=rose]{--t: var(--ly-rose);--ts: var(--ly-rose-soft)}.sb-block.ly-block [data-tone=slate]{--t: var(--ly-slate);--ts: var(--ly-slate-soft)}.sb-block.ly-block .ly-top{display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin:0 0 10px}.sb-block.ly-block .ly-title{margin:0;font-size:16px;line-height:1.5;font-weight:650}.sb-block.ly-block .ly-caption{margin:0;font-size:13px;color:var(--ly-muted);line-height:1.6}.sb-block.ly-block .ly-hint{flex:none;font-size:12px;color:var(--ly-faint);white-space:nowrap}.sb-block.ly-block code{font-family:var(--mono, ui-monospace, Menlo, Consolas, monospace);font-size:.88em;background:var(--ly-soft);border-radius:4px;padding:1px 5px}.sb-block.ly-block .ly-band{display:grid;grid-template-columns:minmax(150px,200px) minmax(0,1fr);align-items:center;gap:20px;padding:14px 16px;border:1px solid var(--ly-line);border-radius:10px;background:var(--ly-soft);transition:border-color .18s ease}.sb-block.ly-block .ly-band[data-active]{border-color:color-mix(in srgb,var(--t) 45%,var(--ly-line))}.sb-block.ly-block .ly-head{display:flex;align-items:flex-start;gap:12px;min-width:0}.sb-block.ly-block .ly-index{flex:none;width:24px;height:24px;margin-top:1px;border-radius:6px;background:var(--ts);color:var(--t);font-size:12px;font-weight:650;line-height:24px;text-align:center;font-variant-numeric:tabular-nums}.sb-block.ly-block .ly-head h4{margin:0;font-size:15px;line-height:1.6;font-weight:650}.sb-block.ly-block .ly-head small{display:block;font-size:12px;line-height:1.5;color:var(--ly-muted)}.sb-block.ly-block .ly-modules{display:flex;flex-wrap:wrap;gap:8px}.sb-block.ly-block .ly-chip{display:inline-flex;align-items:center;gap:8px;font:inherit;font-size:13px;line-height:1.4;color:var(--ly-text);background:var(--ly-paper);border:1px solid var(--ly-line);border-radius:6px;padding:6px 12px;cursor:pointer;transition:border-color .15s ease,background-color .15s ease}.sb-block.ly-block .ly-chip i{width:6px;height:6px;border-radius:50%;background:var(--t);opacity:.75;flex:none}.sb-block.ly-block .ly-chip:hover{border-color:color-mix(in srgb,var(--t) 55%,var(--ly-line))}.sb-block.ly-block .ly-chip[aria-pressed=true]{background:var(--ts);border-color:var(--t);box-shadow:0 0 0 1px var(--t) inset;font-weight:650}.sb-block.ly-block .ly-chip[aria-pressed=true] i{opacity:1}.sb-block.ly-block .ly-chip:focus-visible,.sb-block.ly-block a:focus-visible{outline:2px solid var(--ly-accent);outline-offset:2px}.sb-block.ly-block .ly-none{font-size:13px;color:var(--ly-faint)}.sb-block.ly-block .ly-link{height:22px;padding-left:23px;display:flex;align-items:center}.sb-block.ly-block .ly-link svg{display:block;fill:none;stroke:var(--ly-faint);stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.sb-block.ly-block .ly-panel{margin-top:14px;border:1px solid var(--ly-line);border-radius:10px;background:var(--ly-paper);padding:16px 20px;min-height:76px}.sb-block.ly-block .ly-panel[data-empty]{display:flex;align-items:center;border-style:dashed}.sb-block.ly-block .ly-panel>p{margin:0;color:var(--ly-muted);font-size:13px}.sb-block.ly-block .ly-crumb{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ly-muted);line-height:1.5}.sb-block.ly-block .ly-crumb span:first-child{color:var(--t);font-weight:650}.sb-block.ly-block .ly-crumb b{font-weight:400;color:var(--ly-faint)}.sb-block.ly-block .ly-panel h4{margin:2px 0 6px;font-size:15px;line-height:1.5;font-weight:650}.sb-block.ly-block .ly-path{display:inline-block;margin:0 0 8px;font-size:12px;padding:3px 8px;border-radius:6px;border:1px solid var(--ly-line);word-break:break-all}.sb-block.ly-block .ly-md p{margin:0 0 6px;font-size:14px;line-height:1.7}.sb-block.ly-block .ly-md p:last-child{margin-bottom:0}.sb-block.ly-block .ly-md strong{font-weight:650}.sb-block.ly-block .ly-md a{color:var(--ly-accent);text-underline-offset:3px}.sb-block.ly-block .ly-static{display:none}@container (max-width: 640px){.sb-block.ly-block .ly-hint{display:none}.sb-block.ly-block .ly-band{grid-template-columns:minmax(0,1fr);gap:10px;padding:12px 14px}.sb-block.ly-block .ly-link{padding-left:21px}.sb-block.ly-block .ly-panel{padding:14px 16px}}@media(prefers-reduced-motion:reduce){.sb-block.ly-block .ly-band,.sb-block.ly-block .ly-chip{transition:none}}@media print{.sb-block.ly-block .ly-hint,.sb-block.ly-block .ly-panel{display:none}.sb-block.ly-block .ly-band{break-inside:avoid}.sb-block.ly-block .ly-static{display:block;margin-top:12px;font-size:13px}.sb-block.ly-block .ly-static-layer{margin-bottom:8px}.sb-block.ly-block .ly-static ul{margin:4px 0 0;padding-left:20px}.sb-block.ly-block .ly-static li{break-inside:avoid;margin-bottom:4px}.sb-block.ly-block .ly-static code{margin-left:6px}}
2
+ `);var I=T("layerDiagram",{"zh-CN":{title:"\u5206\u5C42\u67B6\u6784\u56FE",hint:"\u70B9\u9009\u6A21\u5757\u67E5\u770B\u8BF4\u660E",modules:"{layer}\u7684\u6A21\u5757",empty:"\u6682\u65E0\u6A21\u5757",prompt:"\u9009\u62E9\u4E0A\u65B9\u4EFB\u4E00\u6A21\u5757\uFF0C\u67E5\u770B\u5B83\u7684\u804C\u8D23\u548C\u4F4D\u7F6E\u3002",path:"\u4F4D\u7F6E"},en:{title:"Layer diagram",hint:"Select a module to see its details",modules:"Modules in {layer}",empty:"No modules",prompt:"Select any module above to see what it does and where it lives.",path:"Location"}});var l=x(D(),1);function N({source:d,inline:s}){return(0,l.jsx)(l.Fragment,{children:L(d).map((a,t)=>s?(0,l.jsxs)(n.Fragment,{children:[t>0&&" ",(0,l.jsx)(w,{source:a})]},t):(0,l.jsx)("p",{children:(0,l.jsx)(w,{source:a})},t))})}var K=(d,s)=>A.includes(d.tone)?d.tone:v[s%v.length];function V({data:d}){let s=E(I),a=d,t=(0,n.useMemo)(()=>(Array.isArray(a.layers)?a.layers:[]).map((e,o)=>({...e,tone:K(e,o),modules:Array.isArray(e.modules)?e.modules:[]})),[a.layers]),p=t.some(e=>e.modules.some(o=>o.id===a.initial))?a.initial:null,[g,k]=(0,n.useState)(p),[B,O]=(0,n.useState)(p);B!==p&&(O(p),k(p));let u=(0,n.useRef)(new Map),z=t.findIndex(e=>e.modules.some(o=>o.id===g)),m=t[z],r=m?.modules.find(e=>e.id===g),C=(e,o,i)=>{if(e.key==="Escape")return k(null);let c,y=t[o].modules;if(e.key==="ArrowRight")c=y[Math.min(y.length-1,i+1)];else if(e.key==="ArrowLeft")c=y[Math.max(0,i-1)];else if(e.key==="ArrowDown"||e.key==="ArrowUp"){let b=e.key==="ArrowDown"?1:-1;for(let f=o+b;f>=0&&f<t.length;f+=b){let h=t[f].modules;if(h.length){c=h[Math.min(i,h.length-1)];break}}}c&&(e.preventDefault(),u.current.get(c.id)?.focus(),k(c.id))};return(0,l.jsxs)("section",{className:"sb-block ly-block","aria-label":S(a.title,s("title")),children:[(0,l.jsxs)("div",{className:"ly-top",children:[(0,l.jsxs)("div",{children:[a.title&&(0,l.jsx)("h3",{className:"ly-title",children:(0,l.jsx)(R,{text:a.title})}),a.caption&&(0,l.jsx)("p",{className:"ly-caption",children:(0,l.jsx)(N,{source:a.caption,inline:!0})})]}),(0,l.jsx)("span",{className:"ly-hint",children:s("hint")})]}),(0,l.jsx)("div",{className:"ly-stack",children:t.map((e,o)=>(0,l.jsxs)(n.Fragment,{children:[o>0&&(0,l.jsx)("div",{className:"ly-link","aria-hidden":"true",children:(0,l.jsxs)("svg",{width:"12",height:"20",viewBox:"0 0 12 20",children:[(0,l.jsx)("path",{d:"M6 1v15"}),(0,l.jsx)("path",{d:"M2.5 12.5 6 16.5l3.5-4"})]})}),(0,l.jsxs)("section",{className:"ly-band","data-tone":e.tone,"data-active":o===z?"":void 0,"aria-label":e.name,children:[(0,l.jsxs)("header",{className:"ly-head",children:[(0,l.jsx)("span",{className:"ly-index",children:o+1}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h4",{children:e.name}),e.sub&&(0,l.jsx)("small",{children:e.sub})]})]}),(0,l.jsx)("div",{className:"ly-modules",role:"group","aria-label":s("modules",{layer:e.name}),children:e.modules.length?e.modules.map((i,c)=>{let y=i.id===g;return(0,l.jsxs)("button",{type:"button",className:"ly-chip",ref:b=>{b?u.current.set(i.id,b):u.current.delete(i.id)},"aria-pressed":y,onClick:()=>k(y?null:i.id),onKeyDown:b=>C(b,o,c),children:[(0,l.jsx)("i",{"aria-hidden":"true"}),i.name]},i.id)}):(0,l.jsx)("span",{className:"ly-none",children:s("empty")})})]})]},e.id))}),(0,l.jsx)("div",{className:"ly-panel","data-tone":m?.tone,"data-empty":r?void 0:"","aria-live":"polite",children:r&&m?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"ly-crumb",children:[(0,l.jsx)("span",{children:m.name}),(0,l.jsx)("b",{"aria-hidden":"true",children:"/"}),(0,l.jsx)("span",{children:r.name})]}),(0,l.jsx)("h4",{children:r.name}),r.path&&(0,l.jsx)("code",{className:"ly-path",title:s("path"),children:r.path}),r.detail&&(0,l.jsx)("div",{className:"ly-md",children:(0,l.jsx)(N,{source:r.detail})})]}):(0,l.jsx)("p",{children:s("prompt")})}),(0,l.jsx)("div",{className:"ly-static",children:t.map(e=>(0,l.jsxs)("div",{className:"ly-static-layer",children:[(0,l.jsx)("b",{children:e.name}),e.sub&&(0,l.jsxs)("span",{children:[" \xB7 ",e.sub]}),(0,l.jsx)("ul",{children:e.modules.map(o=>(0,l.jsxs)("li",{children:[(0,l.jsx)("b",{children:o.name}),o.path&&(0,l.jsx)("code",{children:o.path}),o.detail&&(0,l.jsx)("div",{className:"ly-md",children:(0,l.jsx)(N,{source:o.detail})})]},o.id))})]},e.id))})]})}export{V as LayerDiagramBlock};