@zombie-mermaid/svg-renderer 5.14.1 → 5.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
- import{DEFAULTS as e,LINE_HEIGHT_RATIO as t,applyThemeVariables as n,buildStyleBlock as r,checkGraphSize as i,checkLimit as a,checkLineLength as o,detectDiagramType as s,dropInvalidColors as c,escapeAttr as l,escapeXml as u,extractAccessibility as d,f,findBackEdgeIndexes as p,findBackEdges as m,formatCssColor as h,getReadableTextColor as g,isMonospaceFont as _,measureMultilineText as v,measureTextWidth as y,mixSrgb as b,niceTickValues as x,niceTickValues as S,parseCssColor as C,renderMultilineText as w,renderMultilineTextWithBackground as T,resolveNodeStyle as E,safeHref as D,sanitizeClassName as O,setMonospaceMetrics as k,splitStatements as ee,styleOpenTag as A,subgraphDirectionIsHonored as j,subgraphFeedbackEdges as te,subgraphsTied as ne,svgOpenTag as M,themeStyleDeclarations as re,withDirectionOverride as N,withoutOwnClusterEdges as ie}from"@zombie-mermaid/core";import{CHART_ACCENT_FALLBACK as ae,architectureToGraph as oe,c4BoundaryTypeLine as se,c4RelLabelLines as P,c4TypeLine as F,formatClassMember as ce,getSeriesColor as le,parseArchitecture as ue,parseC4Diagram as de,parseClassDiagram as fe,parseErDiagram as pe,parseMermaid as me,parsePieChart as he,parseQuadrantChart as ge,parseSequenceDiagram as _e,parseXYChart as ve}from"@zombie-mermaid/mermaid-parser";import{decodeXML as ye}from"entities";var be;async function xe(){if(be)return;let e=await import(`./inter-font-subset-DT2grXy3.js`);be={family:e.INTER_FONT_FAMILY,faceCss:e.INTER_FONT_FACE_CSS}}function Se(e){if(e.embedFont===`subset`){if(!be)throw Error("embedFont: 'subset' needs its font data loaded first: use renderMermaidSVGAsync(), or `await loadEmbeddedFont()` before renderMermaidSVG().");return be}}function Ce(e){return f`M ${e.x} ${e.y}`}function we(e){return Ce(e[0])+e.slice(1).map(e=>f` L ${e.x} ${e.y}`).join(``)}function Te(e){if(e.length<3)return we(e);let t=e[e.length-1],n=[Ce(e[0])],r=(e,t,n)=>f` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+f` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+f` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(f` L ${(5*e[0].x+e[1].x)/6}`+f` ${(5*e[0].y+e[1].y)/6}`);for(let t=2;t<e.length;t++)n.push(r(e[t-2],e[t-1],e[t]));return n.push(r(e[e.length-2],t,t)),n.push(f` L ${t.x} ${t.y}`),n.join(``)}function Ee(e){if(e.length<3)return we(e);let t=[Ce(e[0])];for(let n=1;n<e.length-1;n++){let r=e[n-1],i=e[n],a=e[n+1],o=Math.hypot(i.x-r.x,i.y-r.y),s=Math.hypot(a.x-i.x,a.y-i.y);if(o===0||s===0){t.push(f` L ${i.x} ${i.y}`);continue}let c=Math.min(12,o/2,s/2),l=i.x-(i.x-r.x)/o*c,u=i.y-(i.y-r.y)/o*c,d=i.x+(a.x-i.x)/s*c,p=i.y+(a.y-i.y)/s*c;t.push(f` L ${l} ${u}`),t.push(f` Q ${i.x} ${i.y}, ${d} ${p}`)}let n=e[e.length-1];return t.push(f` L ${n.x} ${n.y}`),t.join(``)}function De(e,t){let n=[Ce(e[0])],r=e.length-1;for(let i=0;i<r;i++){let a=e[i],o=e[i+1];if(i===r-1){n.push(f` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(f` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(f` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(f` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function Oe(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return Ce(e[0]);switch(t){case`basis`:return Te(e);case`natural`:return Ee(e);case`step`:return De(e,`mid`);case`stepBefore`:return De(e,`before`);case`stepAfter`:return De(e,`after`);default:return we(e)}}function ke(e){let t=e?.worker?.worker;return typeof t==`object`&&!!t&&`dispatcher`in t}var Ae=null,je=null,Me=null,Ne=class extends Error{constructor(){super("zombie-mermaid: rendering a flowchart, state, class, ER or architecture diagram needs the optional peer dependency \"elkjs\". Install it (npm i elkjs) and call registerElk(ELK) once at startup with `import ELK from 'elkjs/lib/elk.bundled.js'`. Sequence, pie, xychart, C4 and ASCII output do not need it. A flowchart can also pass `layout: 'simple'` to skip elkjs."),this.name=`ElkNotRegisteredError`}};function Pe(e){Ae=e,je=null,Me=null}function Fe(){let e=globalThis.process;if(!e?.versions?.node||typeof e.getBuiltinModule!=`function`)return null;let t=e.getBuiltinModule(`node:module`);if(!t)return null;let n=[`elkjs`,`lib`,`elk.bundled.js`].join(`/`),r=[typeof __filename==`string`?__filename:import.meta.url,new URL(`file://${Ie(e)}/`).href];for(let e of r)try{let r=t.createRequire(e)(n),i=typeof r==`function`?r:r.default;if(typeof i==`function`)return i}catch{}return null}function Ie(e){let t=e.cwd;return typeof t==`function`?t.call(e):`/`}var Le=20;function Re(e=Le){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function ze(e){if(Array.isArray(e))return`[${e.map(ze).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${ze(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function Be(){if(je&&Me)return Me;let e=Ae??=Fe();if(!e)throw new Ne;let t=[],n=globalThis.setTimeout;globalThis.setTimeout=(e,r)=>r===0?(t.push(e),0):n(e,r);let r=globalThis,i=Object.getOwnPropertyDescriptor(r,`self`),a=`self`in r&&r.document===void 0&&i?.configurable!==!1,o=a&&r.global===void 0;a&&(Object.defineProperty(r,"self",{value:void 0,configurable:!0,writable:!0}),o&&(r.global=globalThis));let s;try{s=new e}finally{a&&(i?Object.defineProperty(r,"self",i):delete r.self,o&&delete r.global),globalThis.setTimeout=n}if(!ke(s))throw Error(`zombie-mermaid: registerElk() needs the ELK class from 'elkjs/lib/elk.bundled.js' (or 'elkjs/lib/main.js'), whose synchronous worker this renderer drives directly.`);return je=s,t.forEach(e=>e()),Me=je.worker.worker,Me}function Ve(e,t){let n=t,r=n?ze(e):void 0;if(n&&r!==void 0){let e=n.map.get(r);if(e)return n.map.delete(r),n.map.set(r,e),e}let i=Be(),a=e=>{let t,n,r=i.onmessage;return i.onmessage=e=>{e.data.error?n=e.data.error:t=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=r,{result:t,error:n}},{result:o,error:s}=a(e);if(String(s?.message??s).includes(`Invalid hitboxes`)&&({result:o,error:s}=a({...e,layoutOptions:{...e.layoutOptions,"elk.layered.compaction.postCompaction.strategy":`NONE`}})),s)throw s;if(!o)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,o),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return o}var He=`JetBrains Mono NL`,Ue=`@font-face {
1
+ import{DEFAULTS as e,LINE_HEIGHT_RATIO as t,applyThemeVariables as n,buildStyleBlock as r,checkGraphSize as i,checkLimit as a,checkLineLength as o,detectDiagramType as s,dropInvalidColors as c,escapeAttr as l,escapeXml as u,extractAccessibility as d,f,findBackEdgeIndexes as p,findBackEdges as m,formatCssColor as h,getReadableTextColor as g,groupStyle as _,isMonospaceFont as v,measureMultilineText as y,measureTextWidth as b,mixSrgb as x,niceTickValues as S,niceTickValues as C,parseCssColor as w,renderMultilineText as T,renderMultilineTextWithBackground as E,resolveNodeStyle as D,safeHref as O,sanitizeClassName as k,setMonospaceMetrics as A,splitStatements as j,styleOpenTag as ee,subgraphDirectionIsHonored as te,subgraphFeedbackEdges as ne,subgraphsTied as re,svgOpenTag as M,themeStyleDeclarations as N,withDirectionOverride as P,withoutOwnClusterEdges as ie}from"@zombie-mermaid/core";import{CHART_ACCENT_FALLBACK as ae,architectureToGraph as oe,c4BoundaryTypeLine as se,c4RelLabelLines as ce,c4TypeLine as le,formatClassMember as ue,getSeriesColor as de,parseArchitecture as fe,parseC4Diagram as pe,parseClassDiagram as me,parseErDiagram as he,parseMermaid as F,parsePieChart as ge,parseQuadrantChart as _e,parseSequenceDiagram as ve,parseXYChart as ye}from"@zombie-mermaid/mermaid-parser";import{decodeXML as be}from"entities";var xe;async function Se(){if(xe)return;let e=await import(`./inter-font-subset-DT2grXy3.js`);xe={family:e.INTER_FONT_FAMILY,faceCss:e.INTER_FONT_FACE_CSS}}function Ce(e){if(e.embedFont===`subset`){if(!xe)throw Error("embedFont: 'subset' needs its font data loaded first: use renderMermaidSVGAsync(), or `await loadEmbeddedFont()` before renderMermaidSVG().");return xe}}function we(e){return f`M ${e.x} ${e.y}`}function Te(e){return we(e[0])+e.slice(1).map(e=>f` L ${e.x} ${e.y}`).join(``)}function Ee(e){if(e.length<3)return Te(e);let t=e[e.length-1],n=[we(e[0])],r=(e,t,n)=>f` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+f` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+f` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(f` L ${(5*e[0].x+e[1].x)/6}`+f` ${(5*e[0].y+e[1].y)/6}`);for(let t=2;t<e.length;t++)n.push(r(e[t-2],e[t-1],e[t]));return n.push(r(e[e.length-2],t,t)),n.push(f` L ${t.x} ${t.y}`),n.join(``)}function De(e){if(e.length<3)return Te(e);let t=[we(e[0])];for(let n=1;n<e.length-1;n++){let r=e[n-1],i=e[n],a=e[n+1],o=Math.hypot(i.x-r.x,i.y-r.y),s=Math.hypot(a.x-i.x,a.y-i.y);if(o===0||s===0){t.push(f` L ${i.x} ${i.y}`);continue}let c=Math.min(12,o/2,s/2),l=i.x-(i.x-r.x)/o*c,u=i.y-(i.y-r.y)/o*c,d=i.x+(a.x-i.x)/s*c,p=i.y+(a.y-i.y)/s*c;t.push(f` L ${l} ${u}`),t.push(f` Q ${i.x} ${i.y}, ${d} ${p}`)}let n=e[e.length-1];return t.push(f` L ${n.x} ${n.y}`),t.join(``)}function Oe(e,t){let n=[we(e[0])],r=e.length-1;for(let i=0;i<r;i++){let a=e[i],o=e[i+1];if(i===r-1){n.push(f` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(f` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(f` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(f` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function ke(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return we(e[0]);switch(t){case`basis`:return Ee(e);case`natural`:return De(e);case`step`:return Oe(e,`mid`);case`stepBefore`:return Oe(e,`before`);case`stepAfter`:return Oe(e,`after`);default:return Te(e)}}function Ae(e){let t=e?.worker?.worker;return typeof t==`object`&&!!t&&`dispatcher`in t}var je=null,Me=null,Ne=null,Pe=class extends Error{constructor(){super("zombie-mermaid: rendering a flowchart, state, class, ER or architecture diagram needs the optional peer dependency \"elkjs\". Install it (npm i elkjs) and call registerElk(ELK) once at startup with `import ELK from 'elkjs/lib/elk.bundled.js'`. Sequence, pie, xychart, C4 and ASCII output do not need it. A flowchart can also pass `layout: 'simple'` to skip elkjs."),this.name=`ElkNotRegisteredError`}};function Fe(e){je=e,Me=null,Ne=null}function Ie(){let e=globalThis.process;if(!e?.versions?.node||typeof e.getBuiltinModule!=`function`)return null;let t=e.getBuiltinModule(`node:module`);if(!t)return null;let n=[`elkjs`,`lib`,`elk.bundled.js`].join(`/`),r=[typeof __filename==`string`?__filename:import.meta.url,new URL(`file://${Le(e)}/`).href];for(let e of r)try{let r=t.createRequire(e)(n),i=typeof r==`function`?r:r.default;if(typeof i==`function`)return i}catch{}return null}function Le(e){let t=e.cwd;return typeof t==`function`?t.call(e):`/`}var Re=20;function ze(e=Re){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function Be(e){if(Array.isArray(e))return`[${e.map(Be).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Be(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function Ve(){if(Me&&Ne)return Ne;let e=je??=Ie();if(!e)throw new Pe;let t=[],n=globalThis.setTimeout;globalThis.setTimeout=(e,r)=>r===0?(t.push(e),0):n(e,r);let r=globalThis,i=Object.getOwnPropertyDescriptor(r,`self`),a=`self`in r&&r.document===void 0&&i?.configurable!==!1,o=a&&r.global===void 0;a&&(Object.defineProperty(r,"self",{value:void 0,configurable:!0,writable:!0}),o&&(r.global=globalThis));let s;try{s=new e}finally{a&&(i?Object.defineProperty(r,"self",i):delete r.self,o&&delete r.global),globalThis.setTimeout=n}if(!Ae(s))throw Error(`zombie-mermaid: registerElk() needs the ELK class from 'elkjs/lib/elk.bundled.js' (or 'elkjs/lib/main.js'), whose synchronous worker this renderer drives directly.`);return Me=s,t.forEach(e=>e()),Ne=Me.worker.worker,Ne}function He(e,t){let n=t,r=n?Be(e):void 0;if(n&&r!==void 0){let e=n.map.get(r);if(e)return n.map.delete(r),n.map.set(r,e),e}let i=Ve(),a=e=>{let t,n,r=i.onmessage;return i.onmessage=e=>{e.data.error?n=e.data.error:t=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=r,{result:t,error:n}},{result:o,error:s}=a(e);if(String(s?.message??s).includes(`Invalid hitboxes`)&&({result:o,error:s}=a({...e,layoutOptions:{...e.layoutOptions,"elk.layered.compaction.postCompaction.strategy":`NONE`}})),s)throw s;if(!o)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,o),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return o}var Ue=`JetBrains Mono NL`,We=`@font-face {
2
2
  font-family: 'JetBrains Mono NL';
3
3
  font-style: normal;
4
4
  font-weight: 400;
5
5
  font-display: swap;
6
6
  src: url(data:font/woff2;base64,d09GMgABAAAAABZoAAwAAAAAMiwAABYWAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjQGYACCfhEICtBIv3MLgmIAATYCJAOFNgQgBYREByAboCdFBDYOABG0i4mo4AwURYmYtNn/ZQI3hkD/MDOMAipCbeSAiA/e0E7k5P52NehVqIa1Ws5wnlXDxHfybGfD5bMhLn7xIYDX23j/Rz5CY5/kwkd/mG/3/6sFK7YCklopc4CZmEawA6YLdIro3fC0zX8HFmsX7m9GgjYleXDcEQeS59FHSSpYlHP+r/7NWDn/XLX7We5Hh/zcflRIYLtfFFHgaQRdxolEHFjGyf5+bqOug4dK5jpHFM9JLar//W2oPbmphNegKjf6hSubuicHd6XOxFTSwetPRm4TfrdSCA2AYZje1KaqotJySXs/aDjvWFNNY64WjJjzP5fan2JuSKqb2ptR+PyMnJA//yfZT3J3zcG6XMtJiXI3Kv9y2iHosZoE+jcCUkRqc3NErkLJGaEGz9fS2XtXZk5GIks1Mp9kfJRGbeib8Gmud13rHnRVHZZBeAZlqsIoJIOwipc5DyJWp2JEaq8NYpKrDGTj3jo1VvT022N4TQ/5qiHx95wgkAcAliRdkD41yC4zyDkbyIUYyKUsSCyLmCMf3l4AHE32rYkX64CRMZkgoM/hwHrSsUT/dwmozlotHaDzx3DzJ+goAC6l1EFTt29eXB04L82iCYlx85Y6bA9xSFnsozV3gNWvoFviuv853gNcm7TfDoedMe+A3faYdsQ2+1xup+0mnHTcCVPOgmRk5RXVrLdBiVJlylWoVK1Bk2YtWrXhaycgJDZrlyucNucGEhglNZyBkYmZjYOTi5tHSERUTI+4AYOSUrJmnLPXKfksSImS0nKqVisrttlGl9hkpQ6mGrXq1TmKhYeNg0ukUTc5KZiCDAKloqel08GK0ImkQQnw8gnyO6ZLv4RefdLCMiDKJSUAjwBoAdwA2YtiB/hDDwA4FV+0osA5WQmaaByUu1TZ7oKozVvRvimvwYFHN3aWx63vcmq+Kx0dIRNrY9cg08wcCxqIZZ3B0HmijHjBDgceRM2UYyWTaUzz2XIxn+3k82XEkroE2jQVAtVw9M5K23rHs/xJGrw7aINDe6oWNAzDrTE60YTmZv361HJAsIPKsOjcKq2qyGsUQhTd67852KOyvD2yzJjXNNMUqLPNZrsl6FKfuBmBklR4x+2lDhW1UQtK5JrkAvk+gXBqcwCCgCbYOTqEV6jTC6FBNbxG9oUb8jBLwiid8LObmCdblBBhTwBreN2c6CkvGOiu4g2Xp1PIKqn+y9fPoNgWVMQUPNTFN9Ubz5YHqdmPIRDe51TYgcCoW8sYulQGBQuok8lVwsNEdcEKLAKJW0jw1lPmti0ZTjSVELsq/GtNVJh8FmWUhF9CC/9+QjxB+A8vX6jWEcUeORZZSC9RO5+L41XEt3/BxhbhbTZ9ENQWWMpqW+n5GOZyFlIFRhwkYv2zdGexrYXUi5GkUiGLRaCIZEHRvZErT6U/mXySxKxm5AgsWTloiKRCF1EP5JzHgEmO0uQ6dWuZni+s7XyKLmydocAXEOwibZJ42fd5PgxS6mTIiYHvk54/J69SH+fLWp9GkN6zjfiws4p+Bwg3PbXFVN2PYDwTzgrGpyTU1gfaF4IrosGwHWAGQmaBhUBYYnVLOyun0CnQKMQoIGKg80bHHiIRsBM4LZIgg434M+YPAPGtsVFL4AK9wTJYIYqOrbyFADqnmtlIBElGhRt/0khQoEPSxSk8A+jZJFVypiRVKODi+wRDJQPRbOWeAOztcWGTTcd3HD5YPQRaUwJc+F8k2rpLnAOkRZAoxPFcph4HgOevdtmm/GKNEdUEwYKRTE8IDwNF3aYiOFxSjbeWIIL16u+38z9DjlJdYODsnRGg6ZZk7mStNGIsvUAd5JHhKuL7CvhSWLmy7Hrjp7YGFniM9XSt+Dcy9ooClHk3JC4SeNGJrZplh7Ka0BvNfAGQWWWrPQnIO0nPyD/WCm+TInDihZEPaCFxoshODj8Uc9XfFYSU4ICjxLenSJaox9rE8sUpx6NIh87YO/nplqsThu5iXoIguRCwjznR7t/0N/inpR4VP/5ZeSJFby5UK+mX3IVHdxMJrqlBJeXesPEtmGuwVuk1Z8YUyXzi9oh+yZvhtxU4d6RdkU912UGAn+jhgzo45YW6gSgDlXmFfa4vyWfsWZoMn8o903SYmPSwQyTz9MP8immCVnfsidOEd3DiFm59sxf81gh9xXTDyxOJJoHctABrJzQZfY9O4yZ9Egc+dL0q72olF1/G9DsorYtULawavt9xqSb3SSunWKnE8jVmos2YYDX9V+9xSvClQ/S6ESC4nDADX+j+pJDtuhPvDsijUnS2trhOVzqu0dWOFGYp+AUOH3FSI9gZqzr/VLITOVtKLWp05cpIeRpZ9vwIEfPATzCcTz0pLez2HSoXuO4PRanZFyL6EZgTM9cuwn+MXhfAPleGW1u/ZQ4IOlqfSUYHOyVJ1rfGK1ZbuyOcoMDxXy4IJlE5tFqYw159Wv7+VUGur2I+8X5QTUo2C9XIRYPUg8oti37ktNJOl6NY1+rS79kitpN1wFgn64L2pZn303lMhwr2mtfPd+vksTFFB/P25X4jmR5Aa3KiOVH3fVL1N7TuH8UWhAd2Y4j6tUcC0LidLnru4hgHTvm5zwvRQYcTFWX4awD1N19HMD37xoKGgPhVqnSk3hv8wO6ofqGIC5Tln0B6gkqmp3XFReoPgjvxNsagXZIYVMTJECgd7mXFcM1o8sjWIyzR6t5sqICgB/+U9bp8FudzrYXtcU2SuKaIX6t1/K4xMj9bVz9ZOs34YGBgjneBf0uFCPapx+6/ijnLc2iRd386TZ4Gd5MrXpitf16w4fK0GPhyr0SSYbcYd++hX41y64xt/nRfZPrKLVKlXCDA5NJh8ahCp5TKdHrFKOAzIpnBkD6kSAQOkgxSCKqEYaUS0SPKFaA6Fcx9R8Brz4vwkmtXFsd5G1HdajJOgi8gRId2HchYN9dgHCHw5h7SxgTioKpWJQ5hFG3IElbqO5S12LhNw8BrIQ0k+vMv/7HP0AciuatJw8UGoiHPQIJA7lbS8bOMlKoBm/Y+GGLgVOEqJHKI/P5u+tm+HCX+WkzlKOJrAuiSw8LD5I4DG6xkxIeHYpQK16GofpxURVRRbOsQ8OYoad85Seh84OGR7huIeCeYyJm79CTQ5aa9cBc8nVNuLm08fzt/aKs5OVjYkX9b2A2o3NYPk5fk6WhE3QnnMfSD5EY6i3kCNDNCqVRCmAhKqHHFRWaQgBGVAcQvVeRQnBKoN0z3yfWh1GDIm1xm04wWCQx30eyJBp1UIv9o78d1z/wjRVjsxsXtfwBv7pvY1mwoRA8mtr9lbD+M6+QIroX3AypHHTmu7OIK3DLPUF/4+Pm841IMFYmVCslxcM1C7Ma8ufzolqCjoaBFzyegkoR12Ucv/AXjHXIUwXUwLAwElbM3FvhyF7Bgu8Cn0Bvinx5CwlcIRoQ7d4lVuBRWacS7AJuRGBsMUXKTGkU6tNKWNvSBgQr1OnMMl/KdPo4c8XMEDgnFUyECAYbwGq5PpCp164gBY9dICiztujR9TT67CzQzYr3J4FpqrUyqkctgjczewFBiEHz/wKJr9Mcn1jiFwrWuJ4Z/8D24CL2ORau4lEPH89YX4BxtaRAzSYX4+vV5D15aanEtpjAml44WF9NRDGeChtdST3f3JN/ZxqL0rG3pd8JPB18b7h79YhvLYGBuG/sSLBW/92zXbPO9r/ttvHhvQ3yiajGwU7pWNXm2+udaSfAPwx72m/iths4mwY3NvUPtvxVTeeiAzRtJBByXuiO0tF3KMShNCpFpviXS0vYkuIOBdfoMeiul6jQ0yqoqHVUWTE/IuCqOVoty2jCLSzv34WCDsapKW2XDLJ1YM8odHtZws6Y9xnpTVaWv/qi5ur8+Yam0tjRPAgMDsciiUJzKUfPQKJQl5Ig12B845w/2J02Sf1Tz6r8lIlSDHEFQTTiD4T5HQsPMQDZKc1J1mFgM4+qjjyK4ChZjklqK5sxGwasDYG8dfLkAnba41OUMMtTvPxcI9lsRQp6FoNF5KkfFoahFVmkSKyiB44MWS/5Wz6v+AU0MdbdIHFWp2kN+oaLlmnOrJL+eR6krDcSwSBvqeeSgmohzTMlH2mdRXNITk2gsqNGCYTKIIqeZQTMjuCXbPdGNT3sQ6+ILfGjI1S7X4FIeyuqiitQZ4m0DKMOUuFyuxDHwzu55cj6Ddep158hzqDRzgbywG8wvkCfZtlYe5KYnTe2wPdjrz/qD/XbYJErSAm6WNdblXlNHd2y8EMHEY2JAaeCNLIdiBlhhDUZdaSqMIEqhGNWgfmAnn5i4jWS8eR8J3AvkKKJWye/KI/2FweFUFARz1NH48Yt9t+ffXxk/+2vvb2C0w2HDv3uYvERR46i6kQQylrmDpl7Jqtt0FRRmsASIWXGl7arq38tKf6u+Wr+6SsvWBV4WFe+6d0jBbC4MZzM94/FMOhIhIz7ew2YKWWAlhh5AQyosVZ0hhINWInW76kgSqW7kfuSxDl3QHr27SsK+m/1ZcesLlb9zZEoVMr5RplTLj2zgvVL3N/AsmLEUsQb7AgYeapFH6Asd/sPZVu64YcolNauzrnTd8HdA37kFPZAeseQHQn2kZc/32h8u89r+hd6I/gWSLCpOixjkqMMbC7Ap9tYhWK5C/WBDoTdCGikWxW3h9TZo0aKjG4blRoUu1OlsISJmhaeM2djSJqmTamfXzaybM0VsXuAtkbd7/XyFwtfW3imCUbeMnjN162QiT4ivlJIcxKiVSrU0qoRoEygxwc0VKjXiEhBWd5qVqjPkmZPUyQtNF1RltNJ5EjQxAqlk0E/5ZQpcJEZx2Y56GeZP9zODw6n5fzno+3MNCbADghE30yyaZNrAGrVAPUkNuiDSXLKNKZnU+5hh5DJ4YA0YN2CXAd7jm+9elui7IfGcqP65kn338sc2JYYWEi/qxN9eunQN4I4F4q0X6cHt1sx7bPZ74a3WQPEioCj+SAu5n5KMaEjQzEjoDEzQFWpXGmU6o9TlOpQHVeCfS1eWla4oHR552Upgkk9LnzrYffWll+26kgQO6890bbOzSabGYTmuQyhaaDgTjm5JhdrFGbX2yZeMJKhiRIeSQUqm0cgGKq/oEizmOx9qIQ/YbrvfXdA94OEFtyTB3Lx+lnFzbMOj9T/eSV0NmDin0CpTaaTPhKdJLvTwlmj/QLR1fKNaGHhCCvdoOLWRz69viyyIqx/lVmJdYmFYicOJHhi3YIRdoxEe7HSrwMP0nSVbqGdftUHToJmhiQukXQqNOYwto+9VuaQSgaOLo0ADPRCRcn0vvQTLukZxP3OPQHObWIUJBBQSi9QLhJGFftSil8kVFHi57BOBJxbE1WfJKoVfLAgrtXA8Dmu0cdo69bNRpZnBfKGW+RJzOJ3aF8BrZ4XcPg0XNJ9sPFpTc7RxMn/DNXchUH28z6m6sWq9EbZgjwS5kPb2clpiGC56b3PxZqOi/OP5j1u7Gbz09o08VI/DsB7HxuxjeKxdHFBK2JRNkA7I0G7C7TE1B/U+9gR/4SPfRH2pubc+f6S/A183Zhtb5+gYi2/ozcBslZKPFvhv3o56H56I7/bS++7bfAewsl5zYqHqhSDWtxHcqfOHpp8N7tp5XmUe6PtL+DcHaAq45TLzp8NXVJ56YeL8iQA9y/m/38obtZw388bWmf8H6WEnuspnPRnm85YcRIjJTuCJwAv9rm5HgXnVVepxLENksHF1Bc8wruxqJVrZUmlVqMdwfUFvYKYODzlh50LA359nJhKXXLVLYm6ol2h2bZAJ2cqtsIvV0pGFKtlbsTFiDH3YGpkWfeYwMHix/+bfiJMrThLgcP/yHfntZjBTTaAEgMOGjw0A3BU2xwqawdqZSV9hogeyU9xbHAXX6UuI3g4i1G0tnJJNkoXhbtBJsZc9/eeorsTSryd7ep1Fk8fuamVjL312d/6xFYUeTksb+tACWPK/PkI88oQxLISTO2v3dpVna2b3zs3VGjgT/okFml9gvltT8y6T9azf5LPfXW2YMzzzw0sVYDtO3Erc8oM/OWBDnYKjDStS28sLBceoW97uBjQUoZXe8WVFJwA0/+OwFpcyN5Vcu+jNFuH2IwvXwpMLAhbrndO226c7B6HMk42SNyfTEHixD9XrVmIrRw09A6TwhX0/Leqr2tgbFbWVWGVtxdyHvXtHkEexhhjEVKgrahauynL0P7aqBqgX7GO4esJl27nvxHh6YiK92myn9B0Opzar1xBoY2CGhtttboIKZ3pskUTaN2CoaWXNNQ+1nGGxzrZkm+fA20WuaMwlIdwBA31BgIu0AadJRLLbbBIXz9zC/I5V/+Tj/1CpyBW3zT0Y7rr8mk1kA5OQpPnY6NkKdoIv4d8I/u+/mboZPLirvLq8oqa8vKZiPf7PZAY076ruNCVkdTX5Rp1AOZWeifTPgMGp+ExwYAZ8PLVnxjozE+40WUygOSDEED6fVHhabisFZWVQaSmkfw/A/+4K28lscUVtBVbRWtxw9yQI0BvcrgfW85vaG9hIbxrcqljXNMj6vwcWw+zBz2wsAAEgBbZoIaAdyN2mueRG7ibN7O4k6y66qr6gL1p1PITcMBC43JLLkCWyRJa4lc5udQ2yWlbLalkt22SbbJNtrpBAcnOZ1h3IXaH55ELuEs3qribrGorXF4Qi/LgLuWAgMAcWXbwMtdQQpCLLjmR3IaBLqnYNrnfdFyU90iM90qMeApeMy7iMy7ibKnMsZfKIDxxpS07tCavnmlmDLnz8UGXcKxf/ZKMyDgCsD3qYl7yOfvc26Y5g58UkIhTtlO148ev1A513AGX/56Wupd8NdpPkO/CoWP/vwvaksloALEB117+hmCQGkTq1AvDYebvRyWDGDoCbeZO0sKeOLhn1BBRct9RYZ/Tnjm0SQ3WFJhVLJ0OWhEtG15AvfeV96FboOVoOXEmbhrL0YgABwKY3lrUQ+wOrZb8VraZ/CQD8fRkb4YXMPf9M/J+k/Re7oCwJbAAGBKAtR5ddN/GSvg0EZo2/S5aibHlU4Ev3sixThIC6rCfF0dayTKBTikwuatWlUBDqKxOJdhV4rKchqsWerYpKvJELJ3gm23HR5ZzFDkEqkEXeTDZq1ZalTkiqPQp7z9tESKXyji3a8pigMCoOBlBIVSo5XmeRl7jABHXUqgHu0wwasHGEvcjYx18KBB0YcSLpdnAIVtHKprIlYMlkFj1zVOK17VC4MssUjTbaaKP/CEAAeITuBQPAAvI+aA3/1QVzvyGPAYAPqK5bxUAkRKuyKazyaxUd6nxVHp6Jqnw2bbYAvg9wKCpLKS0obkCGyaABg8yMWpGiug3pE5TmEJWWEc8eV4XXKslyjIWZzfYbY4KGZA22OFqZVaXBFtxXKbG2PNUWaSUQeUxIo3tnVbdY1a2jaqfjc+opwTewM3BQb6uC3qSR2/m4bj2308YTjUsjrC0heuBb6CWkYT4hKlxDEXtMRpcPSss01myETbJeKXbf1y2emX8zG9ImbO7rx/Y5C/v2xxvRzeq3iuIBCAAA) format('woff2');
7
7
  unicode-range: U+0020-007E, U+00A0, U+00C0-00FF;
8
- }`;function I(e,t,n){return y(e,t,n)}function We(e,t){return e.length*t*.6}var Ge=`'JetBrains Mono'`,Ke=`${Ge}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,qe={nodeLabel:13,edgeLabel:11,groupHeader:12};function Je(e){return{nodeLabel:e?.nodeLabel??qe.nodeLabel,edgeLabel:e?.edgeLabel??qe.edgeLabel,groupHeader:e?.groupHeader??qe.groupHeader}}var L={nodeLabel:500,edgeLabel:400,groupHeader:600},Ye=12,Xe=12,Ze={horizontal:20,vertical:10,diamondExtra:24},R={outerBox:1,innerBox:.75,connector:1},z=`0.35em`,Qe={width:8,height:5};function $e(e,t,n,i){return r(e,t?{family:He,faceCss:Ue}:!1,n,i)}var B={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:qe},et={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function tt(e,t){switch(e){case`LR`:return`RIGHT`;case`RL`:return`LEFT`;case`BT`:return`UP`;case`TD`:case`TB`:return`DOWN`;default:return t}}function nt(e){let t=typeof e==`number`?{top:e,left:e,bottom:e,right:e}:e;return`[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`}function rt(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":nt(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function it(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var at={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function ot(e,t){let n=v(e,t.fontSize,L.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function st(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[ot(e.label,e.labelStyle)]),t}var ct={"state-start":`FIRST`},lt={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function ut(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var V={top:44,left:16,bottom:16,right:16},dt={top:16,left:16,bottom:16,right:16};function ft(e){let t=new Map;for(let n of e.edges){if(!n.label)continue;let e=`${n.source}\0${n.target}`,r=(t.get(e)??0)+1;if(r>=3)return!0;t.set(e,r)}return!1}var pt=new WeakMap;function mt(e,t){let n=pt.get(e);return n||(n=ut(e)||xt(e.subgraphs)?new Set:p(e,t?.walkOrder,t?.feedbackEdges??te(e)),pt.set(e,n)),n}function ht(e,t){for(let n=0;n<e.edges.length;n++){let r=e.edges[n];if(t.has(r.source)||t.has(r.target))return n}return 1/0}function gt(e){return tt(e,et.flowchart)}function _t(e){return{...rt(e),"elk.spacing.edgeEdge":`12`,"elk.layered.spacing.edgeEdgeBetweenLayers":`12`,"elk.layered.spacing.edgeNodeBetweenLayers":`12`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.contentAlignment":`H_CENTER V_CENTER`}}function vt(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:at}}function yt(e,t,n,r){let i=v(t,r,L.nodeLabel),a=i.width+Ze.horizontal*2,o=i.height+Ze.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+Ze.diamondExtra;a=e,o=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(a*a+o*o))+8;a=n===`doublecircle`?e+12:e,o=a}return n===`hexagon`&&(a+=Ze.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=Ze.horizontal),n===`asymmetric`&&(a+=12),n===`cylinder`&&(o+=14),n===`state-start`||n===`state-end`||t===``&&n===`diamond`?{width:28,height:28}:t===``&&n===`fork-join`?{width:70,height:10}:(a=Math.max(a,60),o=Math.max(o,36),{width:a,height:o})}var bt=` root`;function xt(e){for(let t of e)if(t.direction!==void 0||xt(t.children))return!0;return!1}function St(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)St(n,t)}function Ct(e){let t=new Map;function n(e,r){let i=[...r,e.id];t.set(e.id,i);for(let t of e.children)n(t,i)}for(let t of e)n(t,[]);return t}function wt(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function Tt(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),Dt(t,i,a);let o=Ot(e.subgraphs),s=Ct(e.subgraphs),c=e=>e?s.get(e)??[]:[],l=new Map;l.set(null,[]);let u=[];for(let t=0;t<e.edges.length;t++){let n=e.edges[t],r=o.get(n.source),i=o.get(n.target);if(r&&r===i){let e=l.get(r)??[];l.set(r,e),e.push({index:t,edge:n})}else!r&&!i?l.get(null).push({index:t,edge:n}):u.push({index:t,edge:n,srcChain:c(r),tgtChain:c(i)})}let d=xt(e.subgraphs),f=[],p=[],m={..._t({direction:gt(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(B.thoroughness),"elk.layered.highDegreeNodes.treatment":`false`,"elk.layered.compaction.postCompaction.strategy":(e.subgraphs.length===0||ft(e))&&!n?.forceNodeOrder?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...ft(e)?{"elk.spacing.edgeEdge":`40`}:{},...n?.forceNodeOrder?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...ut(e)?lt:{},"elk.layered.wrapping.strategy":`OFF`,"elk.hierarchyHandling":d?`SEPARATE`:`INCLUDE_CHILDREN`},h=new Map,g=new Map;function _(e,t){let n=h.get(e)??new Set;h.set(e,n),n.add(t)}function v(e,t){let n=g.get(e)??[];g.set(e,n),n.push(t)}if(d)for(let{index:e,edge:t,srcChain:n,tgtChain:i}of u){let a=wt(n,i),o=t.source;if(n.length>a){for(let r=n.length-1;r>=a;r--){let i=n[r],a=`${i}_out_${e}`;_(i,a);let o=r===n.length-1?t.source:`${n[r+1]}_out_${e}`;v(i,{id:`e${e}_s${r}`,sources:[o],targets:[a]})}o=`${n[a]}_out_${e}`}let s=t.target;if(i.length>a){for(let n=a;n<=i.length-1;n++){let r=i[n],a=`${r}_in_${e}`;_(r,a);let o=n===i.length-1?t.target:`${i[n+1]}_in_${e}`;v(r,{id:`e${e}_t${n}`,sources:[a],targets:[o]})}s=`${i[a]}_in_${e}`}v(a>0?n[a-1]:bt,st({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:vt(r)}))}for(let[t,o]of e.nodes)if(!i.has(t)&&!a.has(t)){let i=yt(t,o.label,o.shape,r.fontSizes.nodeLabel),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=it(t,i,o.label),c=ut(e)?ct[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),f.push(s)}let y=ut(e),b=f.length,x=y?e.subgraphs:[...e.subgraphs].reverse();for(let t of x)f.push(Et(t,e,r,l,h,g,e.direction));if(y&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<b)return ht(e,new Set([t.id]));let r=e.subgraphs[n-b],i=ht(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return St(r,a),ht(e,a)}),n=f.map((e,t)=>t).sort((e,n)=>t[e]-t[n]||e-n).map(e=>f[e]);f.splice(0,f.length,...n)}let S=mt(e,n),C=n?.feedbackEdges,w=l.get(null),T=C?.size?[...w.filter(e=>C.has(e.index)),...w.filter(e=>!C.has(e.index))]:w;for(let{index:e,edge:t}of T){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=st({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:vt(r)});n?.looseEdges?.has(e)&&(i.layoutOptions={...i.layoutOptions,"elk.layered.priority.straightness":`0`}),p.push(i)}if(d)for(let e of g.get(bt)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(st({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:vt(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function Et(e,t,n,r,i,a,o){let s=e.direction!==void 0&&j(e,t)?e.direction:o,c=_t({direction:gt(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:e.region?dt:V}),l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[];for(let r of e.nodeIds){let e=t.nodes.get(r);if(e){let t=yt(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(it(r,t,e.label))}}let f=e.children.some(e=>e.region)?e.children:[...e.children].reverse();for(let e of f)d.push(Et(e,t,n,r,i,a,s));let p=[],m=r.get(e.id)??[],h=mt(t);for(let{index:e,edge:t}of m)t.source!==t.target&&p.push(st({id:`e${e}`,source:h.has(e)?t.target:t.source,target:h.has(e)?t.source:t.target,label:t.label,labelStyle:vt(n)}));for(let t of a.get(e.id)??[])p.push(t);return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:p}}function Dt(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),Dt(r,t,n)}function Ot(e){let t=new Map;function n(e){for(let n of e.nodeIds)t.set(n,e.id);for(let t of e.children)n(t)}for(let t of e)n(t);return t}function kt(e,t,n){if(e.length<2||t.shape===`rectangle`||t.shape===`rounded`||t.shape===`stadium`)return e;let r=[...e];if(t.shape===`diamond`){if(n)r[0]=At(e[0],e[1],t);else{let n=e.length-1;r[n]=At(e[n],e[n-1],t)}}if(t.shape===`asymmetric`){let i=n?0:e.length-1,a=e[i],o=t.height/2,s=Math.abs(a.y-(t.y+o));Math.abs(a.x-t.x)<.5&&s<o&&(r[i]={x:t.x+12*(1-s/o),y:a.y})}return r}function At(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2,a={x:r,y:n.y},o={x:n.x+n.width,y:i},s={x:r,y:n.y+n.height},c={x:n.x,y:i},l=e.x-t.x,u=e.y-t.y;if(Math.abs(l)<Math.abs(u)){let t=e.x;return u>0?t<=r?Mt(t,c,a)??a:Mt(t,a,o)??a:t<=r?Mt(t,s,c)??s:Mt(t,o,s)??s}{let t=e.y;return l>0?t<=i?jt(t,a,c)??c:jt(t,c,s)??c:t<=i?jt(t,a,o)??o:jt(t,o,s)??o}}function jt(e,t,n){let r=n.y-t.y;if(Math.abs(r)<.001)return null;let i=(e-t.y)/r;return i<0||i>1?null:{x:t.x+i*(n.x-t.x),y:e}}function Mt(e,t,n){let r=n.x-t.x;if(Math.abs(r)<.001)return null;let i=(e-t.x)/r;return i<0||i>1?null:{x:e,y:t.y+i*(n.y-t.y)}}var Nt=12;function Pt(e,t,n){if(e.length===0)return;let r=n===`LR`||n===`RL`,i=new Set;for(let e of t)i.add(`${e.source}:${e.target}`),i.add(`${e.target}:${e.source}`);let a=B.layerSpacing*.6,o=[...e].sort((e,t)=>r?e.x-t.x:e.y-t.y),s=[],c=[o[0]];for(let e=1;e<o.length;e++){let t=(r?o[e].x:o[e].y)-(r?o[e-1].x:o[e-1].y),n=c.some(t=>i.has(`${t.id}:${o[e].id}`));t<=a&&!n?c.push(o[e]):(s.push(c),c=[o[e]])}s.push(c);let l=new Map;for(let e of s){if(e.length<=1)continue;let t=e.map(e=>r?e.x:e.y),n=Math.min(...t),i=Math.max(...t);if(i-n<=1)continue;let a=(n+i)/2;for(let t of e){let e=a-(r?t.x:t.y);Math.abs(e)>.5&&(r?t.x=a:t.y=a,l.set(t.id,e))}}if(l.size===0)return;let u=r?`x`:`y`,d=(e,t,n,r)=>{let i=e[t],a=i[u];i[u]+=r;let[o,s,c]=[1,2,3].map(r=>e[t+r*n]);if(o[u]===a)o[u]+=r;else if(s&&c&&s[u]===o[u]){let e=Math.sign(o[u]-a),t=o[u]+e*Math.max(0,Nt-e*(o[u]-i[u]));e*(c[u]-t)>0&&(o[u]=s[u]=t)}};for(let e of t){let{points:t}=e;if(t.length<2)continue;let n=l.get(e.source),r=l.get(e.target);n!=null&&d(t,0,1,n),r!=null&&d(t,t.length-1,-1,r)}}var Ft=.5;function It(e,t,n){for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=Math.min(i.x,a.x),s=Math.max(i.x,a.x),c=Math.min(i.y,a.y),l=Math.max(i.y,a.y);for(let e of t){if(n.has(e.id))continue;let t=e.x+Ft,r=e.x+e.width-Ft,i=e.y+Ft,a=e.y+e.height-Ft;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Lt(e,t,n){let r=[];for(let i of n)e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height&&(r.push(i),r.push(...Lt(e,t,i.children)));return r}function Rt(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Lt(t,n,r).map(e=>e.id)),u=Lt(c?e:t,c?n:e,r).find(e=>!l.has(e.id));return u?a?u.x-12:o?u.x+u.width+12:s?u.y+u.height+12:u.y-12:e}var zt=2;function Bt(e,t,n,r,i){for(let a of e){if(t.has(a)||a.source===a.target)continue;let e=a.source===n?a.points[0]:a.target===n?a.points[a.points.length-1]:void 0;if(e&&Math.abs((i?e.x:e.y)-r)<=zt)return!0}return!1}function Vt(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=new Map,s=e=>`${e.source}\0${e.target}`;for(let t of e)o.set(s(t),(o.get(s(t))??0)+1);let c=e=>o.get(s(e))>1,l=r===`LR`,u=r===`RL`,d=r===`BT`,f=l||u,p=new Map;for(let t of e){if(t.source===t.target||c(t))continue;let e=p.get(t.source)??[];p.set(t.source,e),e.push(t)}for(let[o,s]of p){if(s.length<2)continue;let c=s[0].style;if(s.some(e=>e.label||e.style!==c))continue;let p=i.get(o);if(!p)continue;let m=[];for(let e of s){let t=i.get(e.target);t&&(l?t.x>p.x+p.width:u?t.x+t.width<p.x:d?t.y+t.height<p.y:t.y>p.y+p.height)&&m.push({edge:e,node:t})}if(m.length<2)continue;let h=p.x+p.width/2,g=p.y+p.height/2;if(f){let i=l?p.x+p.width:p.x,s=g;if(Bt(e,new Set(m.map(e=>e.edge)),o,i,!0))continue;let c=i+((l?Math.min(...m.map(e=>e.node.x)):Math.max(...m.map(e=>e.node.x+e.node.width)))-i)/2;c=Rt(c,h,g,n,r);let u=[];for(let{edge:e,node:n}of m){let r=l?n.x:n.x+n.width,a=n.y+n.height/2,d=[{x:i,y:s},{x:c,y:s},{x:c,y:a},{x:r,y:a}];It(d,t,new Set([o,n.id]))&&u.push({edge:e,points:d})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t,a.add(e)}else{let i=h,s=d?p.y:p.y+p.height;if(Bt(e,new Set(m.map(e=>e.edge)),o,s,!1))continue;let c=s+((d?Math.max(...m.map(e=>e.node.y+e.node.height)):Math.min(...m.map(e=>e.node.y)))-s)/2;c=Rt(c,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=n.x+n.width/2,a=d?n.y+n.height:n.y,u=[{x:i,y:s},{x:i,y:c},{x:r,y:c},{x:r,y:a}];It(u,t,new Set([o,n.id]))&&l.push({edge:e,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let m=new Map;for(let t of e){if(a.has(t)||t.source===t.target||c(t))continue;let e=m.get(t.target)??[];m.set(t.target,e),e.push(t)}for(let[a,o]of m){if(o.length<2)continue;let s=o[0].style;if(o.some(e=>e.label||e.style!==s))continue;let c=i.get(a);if(!c)continue;let p=[];for(let e of o){let t=i.get(e.source);t&&(l?t.x+t.width<c.x:u?t.x>c.x+c.width:d?t.y>c.y+c.height:t.y+t.height<c.y)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=c.x+c.width/2,h=c.y+c.height/2;if(f){let i=l?c.x:c.x+c.width,o=h;if(Bt(e,new Set(p.map(e=>e.edge)),a,i,!0))continue;let s=l?Math.max(...p.map(e=>e.node.x+e.node.width)):Math.min(...p.map(e=>e.node.x)),u=s+(i-s)/2;u=Rt(u,m,h,n,r);let d=[];for(let{edge:e,node:n}of p){let r=l?n.x+n.width:n.x,s=n.y+n.height/2,c=[{x:r,y:s},{x:u,y:s},{x:u,y:o},{x:i,y:o}];It(c,t,new Set([n.id,a]))&&d.push({edge:e,points:c})}if(d.length<2)continue;for(let{edge:e,points:t}of d)e.points=t}else{let i=m,o=d?c.y+c.height:c.y;if(Bt(e,new Set(p.map(e=>e.edge)),a,o,!1))continue;let s=d?Math.min(...p.map(e=>e.node.y)):Math.max(...p.map(e=>e.node.y+e.node.height)),l=s+(o-s)/2;l=Rt(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=n.x+n.width/2,s=[{x:r,y:d?n.y:n.y+n.height},{x:r,y:l},{x:i,y:l},{x:i,y:o}];It(s,t,new Set([n.id,a]))&&u.push({edge:e,points:s})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}}}var Ht=1.5,Ut=.01;function Wt(e){let t=e.map(e=>({...e})),n=0;for(;n+3<t.length;){let[e,r,i,a]=[t[n],t[n+1],t[n+2],t[n+3]],o=Math.abs(e.x-r.x)<Ut&&Math.abs(i.x-a.x)<Ut&&Math.abs(r.y-i.y)<Ut&&Math.abs(r.x-i.x)<=Ht&&Math.abs(r.x-i.x)>=Ut,s=Math.abs(e.y-r.y)<Ut&&Math.abs(i.y-a.y)<Ut&&Math.abs(r.x-i.x)<Ut&&Math.abs(r.y-i.y)<=Ht&&Math.abs(r.y-i.y)>=Ut;if(o){let r=(e.x+a.x)/2;t.splice(n,4,{x:r,y:e.y},{x:r,y:a.y})}else if(s){let r=(e.y+a.y)/2;t.splice(n,4,{x:e.x,y:r},{x:a.x,y:r})}else n++}return t}function Gt(e,t=0,n=0){let r=[];if(!e.sections||e.sections.length===0)return r;let i=e.sections[0];if(r.push({x:i.startPoint.x+t,y:i.startPoint.y+n}),i.bendPoints)for(let e of i.bendPoints)r.push({x:e.x+t,y:e.y+n});return r.push({x:i.endPoint.x+t,y:i.endPoint.y+n}),r}function Kt(e,t=0,n=0){if(!e.labels||e.labels.length===0)return;let r=e.labels[0];if(r.x!=null&&r.y!=null)return{x:r.x+(r.width??0)/2+t,y:r.y+(r.height??0)/2+n}}var qt=16,Jt=28,Yt=18,Xt=28,Zt=10;function Qt(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(Xt,e.height*.6)/2,a=Jt+t*Yt,o=[];for(let e=0;e<=qt;e++){let t=Math.PI*e/qt;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Zt,y:r}}}function $t(e,t,n){let r=new Map;for(let i=0;i<e.edges.length;i++){let a=e.edges[i];if(a.source!==a.target)continue;let o=t.get(a.source);if(!o)continue;let s=r.get(o.id)??0;r.set(o.id,s+1);let{points:c,labelPosition:l}=Qt(o,s);n.push({source:a.source,target:a.target,label:a.label,style:a.style,hasArrowStart:a.hasArrowStart,hasArrowEnd:a.hasArrowEnd,points:c,labelPosition:a.label?l:void 0,inlineStyle:pn(i,e),headColor:fn(e),id:a.id,animate:a.animate})}}function en(e){let t=[];for(let n of e)t.push({x:n.x,y:n.y,right:n.x+n.width,bottom:n.y+n.height}),t.push(...en(n.children));return t}function tn(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)dn(e,o);nn(e,t,o,r,a,0,0);let s=en(a);on(e,t,i,0,0,s.length>0?{leftX:Math.min(...s.map(e=>e.x))-20,rightX:Math.max(...s.map(e=>e.right))+20}:void 0),Pt(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));$t(t,c,i),n&&Vt(i,r,a,t.direction);for(let e of i){e.points=Wt(e.points);let t=c.get(e.source),n=c.get(e.target);t&&(e.points=kt(e.points,t,!0)),n&&(e.points=kt(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=Qe.width,f=B.padding;for(let e of i){for(let t of e.points)l=Math.max(l,t.x+d+f),u=Math.max(u,t.y+d+f);e.labelPosition&&(l=Math.max(l,e.labelPosition.x+60+f),u=Math.max(u,e.labelPosition.y+20+f))}return{width:l,height:u,nodes:r,edges:i,groups:a}}function nn(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,c=(s.y??0)+o,l=s.width??0,u=s.height??0;if(n.has(s.id)){let a=[];nn(s,t,n,r,a,e,c);let o=un(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:c,width:l,height:u,children:a,...o?.region?{region:!0}:{}})}else{let a=t.nodes.get(s.id);if(a){let n=E(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.shape,x:e,y:c,width:l,height:u,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&nn(s,t,n,r,i,e,c)}}}function rn(e){let t=/^e(\d+)$/.exec(e);if(t)return{edgeIndex:parseInt(t[1],10),role:`bridge`};let n=/^e(\d+)_([st])(\d+)$/.exec(e);if(n)return{edgeIndex:parseInt(n[1],10),role:n[2]===`s`?`source`:`target`,level:parseInt(n[3],10)}}function an(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}let n=t/2;for(let t=1;t<e.length;t++){let r=e[t].x-e[t-1].x,i=e[t].y-e[t-1].y,a=Math.sqrt(r*r+i*i);if(n<=a){let o=n/a;return{x:e[t-1].x+o*r,y:e[t-1].y+o*i}}n-=a}return e[e.length-1]}function on(e,t,n,r,i,a){let o=new Map;sn(e,o,0,0);let s=new Map;ln(e,s,0,0,o);let c=0;for(let[e,r]of s){let i=t.edges[e];if(!i)continue;let o=[],s=e=>{!e||e.points.length===0||(o.length>0?o.push(...e.points.slice(1)):o.push(...e.points))},l=[...r.sourceHops.keys()].sort((e,t)=>t-e);for(let e of l)s(r.sourceHops.get(e));s(r.bridge);let u=[...r.targetHops.keys()].sort((e,t)=>e-t);for(let e of u)s(r.targetHops.get(e));let d;i.label&&o.length>=2&&(d=r.bridge?.labelPosition??an(o));let f=cn(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=an(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:mt(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:pn(e,t),headColor:fn(t),id:i.id,animate:i.animate})}}function sn(e,t,n,r){t.set(e.id,{x:n,y:r});for(let i of e.children??[]){let e=i.x??0,a=i.y??0;sn(i,t,n+e,r+a)}}function cn(e,t,n=0){if(e.length<2)return e;let r=!1;for(let t=1;t<e.length;t++){let n=Math.abs(e[t].x-e[t-1].x),i=Math.abs(e[t].y-e[t-1].y);if(n>1&&i>1){r=!0;break}}if(!r)return e;let i=[e[0]];for(let r=1;r<e.length;r++){let a=i[i.length-1],o=e[r],s=Math.abs(o.x-a.x),c=Math.abs(o.y-a.y);if(s>1&&c>1){if(t){let e=n%2==0,r=Math.floor(n/2)*12,s=e?t.rightX+r:t.leftX-r;i.push({x:s,y:a.y}),i.push({x:s,y:o.y})}else{let e=(a.y+o.y)/2;i.push({x:a.x,y:e}),i.push({x:o.x,y:e})}}i.push(o)}return i}function ln(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=rn(a.id);if(!e)continue;let{edgeIndex:o}=e,s=a.container,c=s?i.get(s):void 0,l=c?.x??n,u=c?.y??r,d=Gt(a,l,u),f=Kt(a,l,u),p=t.get(o)??{sourceHops:new Map,targetHops:new Map};t.set(o,p);let m={edgeIndex:o,points:d,labelPosition:f};e.role===`bridge`?p.bridge=m:e.role===`source`?p.sourceHops.set(e.level,m):p.targetHops.set(e.level,m)}if(e.children)for(let a of e.children)ln(a,t,n+(a.x??0),r+(a.y??0),i)}function un(e,t){for(let n of e){if(n.id===t)return n;let e=un(n.children,t);if(e)return e}}function dn(e,t){t.add(e.id);for(let n of e.children)dn(n,t)}function fn(e){return pn(-1,e)?.stroke}function pn(e,t){let n,r=t.linkStyles.get(`default`);r&&(n={...r});let i=t.linkStyles.get(e);return i&&(n=n?{...n,...i}:{...i}),n&&c(n)}var mn=10,hn=14,gn=14,_n=10,vn=24,yn=400,bn=new Set([`rectangle`,`rounded`,`subroutine`]);function xn(e){let t=e===`TD`||e===`TB`||e===`BT`,n=e===`BT`||e===`RL`?-1:1;return{span:e=>{let[r,i]=t?[e.y,e.y+e.height]:[e.x,e.x+e.width],a=n*r,o=n*i;return{a0:Math.min(a,o),a1:Math.max(a,o),c0:t?e.x:e.y,c1:t?e.x+e.width:e.y+e.height}},toPoint:({a:e,c:r})=>t?{x:r,y:n*e}:{x:n*e,y:r}}}function Sn(e,t,n){let r=Math.min(e.a,t.a),i=Math.max(e.a,t.a),a=Math.min(e.c,t.c),o=Math.max(e.c,t.c);return i>n.a0&&r<n.a1&&o>n.c0&&a<n.c1}var Cn=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function wn(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function Tn(e,t,n){let r=e.c===t.c;for(let i=1;i<n.length;i++){let a=n[i-1],o=n[i];if(a.c===o.c===r){if(r){let n=Math.abs(e.c-a.c),r=Math.min(Math.max(e.a,t.a),Math.max(a.a,o.a))-Math.max(Math.min(e.a,t.a),Math.min(a.a,o.a));if(n<hn&&r>0)return!0}else{let n=Math.abs(e.a-a.a),r=Math.min(Math.max(e.c,t.c),Math.max(a.c,o.c))-Math.max(Math.min(e.c,t.c),Math.min(a.c,o.c));if(n<hn&&r>0)return!0}}}return!1}function En(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.a===n.a&&e.c===n.c||t.push(n)}for(let e=t.length-2;e>0;e--){let n=t[e-1],r=t[e],i=t[e+1];(n.a===r.a&&r.a===i.a||n.c===r.c&&r.c===i.c)&&t.splice(e,1)}return t}var Dn=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.abs(e[n].a-e[n-1].a)+Math.abs(e[n].c-e[n-1].c);return t};function On(e,t,n,r,i,a=[]){let o=xn(i),s=o.span(e),c=o.span(t),l=s.a1<=c.a0,u=c.a1<=s.a0;if(!l&&!u)return;let d=o.span(r),f={a0:d.a0+_n,a1:d.a1-_n,c0:d.c0+_n,c1:d.c1-_n},p=a.map(e=>e.map(e=>wn(o,e))),m=n.map(e=>Cn(o.span(e),mn)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>bn.has(e.shape),v=e=>{for(let t of e)if(t.a<f.a0||t.a>f.a1||t.c<f.c0||t.c>f.c1)return!1;for(let t=1;t<e.length;t++){let n=e[t-1],r=e[t];if(n.a!==r.a&&n.c!==r.c||m.some(e=>Sn(n,r,e))||Sn(n,r,s)||Sn(n,r,c)||p.some(e=>Tn(n,r,e)))return!1}return!0},y=new Set([h(s),h(c),f.c0,f.c1]);for(let e of m)y.add(e.c0-1),y.add(e.c1+1);for(let e of[s,c])y.add(e.c0-mn),y.add(e.c1+mn);let b=(e,t,n)=>_(e)?n>=t.c0+4&&n<=t.c1-4:Math.abs(n-h(t))<.5,x=[];if(l){let n=(c.a0-s.a1)/2,r=s.a1+Math.min(gn,n),i=c.a0-Math.min(gn,n);for(let n of y){b(e,s,n)&&b(t,c,n)&&x.push([{a:s.a1,c:n},{a:c.a0,c:n}]),x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]),b(t,c,n)&&x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:c.a0,c:n}]),b(e,s,n)&&x.push([{a:s.a1,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]);let a=n>=s.c1?s.c1:n<=s.c0?s.c0:void 0;if(a!==void 0){let e=b(t,c,n)?[{a:c.a0,c:n}]:[{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}];x.push([{a:g(s),c:a},{a:g(s),c:n},...e])}}}else for(let t of y){let n=t>=c.c1?c.c1:t<=c.c0?c.c0:void 0;if(n===void 0)continue;b(e,s,t)&&x.push([{a:s.a0,c:t},{a:g(c),c:t},{a:g(c),c:n}]);let r=n===c.c1?s.c1:s.c0;x.push([{a:g(s),c:r},{a:g(s),c:t},{a:g(c),c:t},{a:g(c),c:n}])}let S,C=1/0;for(let t of x){let n=En(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?yn:0,i=Dn(n)+vn*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function kn(e){let t={x:e[0].x,y:e[0].y},n=-1;for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.abs(a.x-i.x)+Math.abs(a.y-i.y);o>n&&(n=o,t={x:(i.x+a.x)/2,y:(i.y+a.y)/2})}return t}var An=`__zm_spine__`,jn=8,Mn=6,Nn=12,Pn=4,Fn=4,In=.25,Ln=.02,Rn=40,zn=e=>e===`TD`||e===`TB`||e===`BT`,Bn=e=>e.startsWith(An);function Vn(e){return e.flatMap(e=>[e,...Vn(e.children)])}function H(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of H(n))t.add(e);return t}function Hn(e){if(e.subgraphs.length===0||ut(e)||xt(e.subgraphs))return!1;for(let t of e.nodes.keys())if(Bn(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=Vn(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...H(t)].some(t=>e.nodes.has(t)))}function Un(e,t){let n=zn(t),r=e=>n?[e.y,e.y+e.height]:[e.x,e.x+e.width],i=[...e].sort((e,t)=>{let[n,i]=r(e),[a,o]=r(t);return(n+i)/2-(a+o)/2}),a=[];for(let e of i){let[t,n]=r(e),i=a[a.length-1];i&&t<i.end?(i.end=Math.min(i.end,n),i.ids.push(e.id)):a.push({end:n,ids:[e.id]})}(t===`BT`||t===`RL`)&&a.reverse();let o=new Map;return a.forEach((e,t)=>e.ids.forEach(e=>o.set(e,t))),o}function Wn(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...H(i)].filter(e=>t.has(e));if(e.length===0)continue;let a=e.map(e=>t.get(e)),o=Math.min(...a),s=Math.max(...a),c=new Map;for(let a=o;a<=s;a++){let o=e.filter(e=>t.get(e)===a).sort((e,t)=>n(e)-n(t));if(o.length>0)c.set(a,o[0]);else{let e=`${An}${i.id}__${a}`;r.ghosts.push({id:e,subgraph:i.id}),c.set(a,e)}}for(let e=o;e<s;e++){let t=c.get(e),n=c.get(e+1);!Bn(t)&&!Bn(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function Gn(e,t,n,r=()=>!1,i=()=>!1){let a=e=>{let n=[...H(e)].filter(e=>t.has(e)).map(e=>t.get(e));return n.length>0?[Math.min(...n),Math.max(...n)]:void 0},o=e=>{let t=[...H(e)].filter(e=>n.has(e)).map(e=>n.get(e));return t.reduce((e,t)=>e+t,0)/t.length},s=e.map(e=>({sg:e,at:a(e)})).filter(e=>!!e.at).sort((e,t)=>e.at[0]-t.at[0]),c=[],l=-1/0;for(let{sg:e,at:t}of s){let n=c[c.length-1];n&&t[0]<=l?(n.push(e),l=Math.max(l,t[1])):(c.push([e]),l=t[1])}for(let t of c){if(t.length<2||t.some((e,n)=>t.slice(n+1).some(t=>r(e,t))))continue;let a=t.some(e=>e.region)||t.some((e,n)=>t.slice(n+1).some(t=>i(e,t)))?-1:1,s=[...t].sort((t,n)=>a*(e.indexOf(n)-e.indexOf(t))),c=t.map(o).sort((e,t)=>e-t),l=s.map((e,t)=>c[t]-o(e));s.forEach((e,t)=>{for(let r of H(e))n.has(r)&&n.set(r,n.get(r)+l[t])})}for(let a of e)Gn(a.children,t,n,r,i)}function Kn(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=H(t);for(let e of i.get(t.id)??[])r.add(e);let o=[...r].filter(e=>a.has(e)),s=o.filter(e=>n.has(e));if(s.length===0)continue;let c=Math.min(...s.map(e=>n.get(e))),l=Math.max(...s.map(e=>n.get(e))),u=o.map(e=>a.get(e)),d=Math.min(...u),f=Math.max(...u),p=(d+f)/2,m=0;for(let t of e){if(r.has(t)||Bn(t))continue;let e=n.get(t);if(e===void 0||e<c||e>l)continue;m++;let i=a.get(t);a.set(t,i<=p?Math.min(i,d)-1-m*.001:Math.max(i,f)+1+m*.001)}}let o=new Map(e.map((e,t)=>[e,t]));return[...e].sort((e,t)=>a.get(e)-a.get(t)||o.get(e)-o.get(t))}var qn=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function Jn(e,t,n){let r=e=>{let i=e.children.map(r),a=[...[...H(e)].flatMap(e=>{let n=t.get(e);return n?[n]:[]}),...i],o=e.region?dt:V,s=Math.min(...a.map(e=>e.x))-o.left,c=Math.min(...a.map(e=>e.y))-o.top,l=Math.max(...a.map(e=>e.x+e.width))+o.right,u=Math.max(...a.map(e=>e.y+e.height))+o.bottom,d=e.region?0:v(e.label,n.groupHeader,L.groupHeader).width+24;return{id:e.id,label:e.label,x:s,y:c,width:Math.max(l-s,d),height:u-c,children:i,...e.region?{region:!0}:{}}};return e.map(r)}var Yn=e=>e.flatMap(e=>[e,...Yn(e.children)]);function Xn(e,t,n,r,i,a){let o=zn(r),s=new Map(Vn(t).map(e=>[e.id,H(e)])),c=new Map,l=!1,u=[],d=e=>o?[e.x,e.x+e.width]:[e.y,e.y+e.height],f=e=>o?[e.y,e.y+e.height]:[e.x,e.x+e.width],p=([e,t],[n,r])=>Math.max(0,Math.min(t,r)-Math.max(e,n)),m=e=>({x:e.x-Rn,y:e.y-Rn,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=Yn(e),_=new Map(g.map(e=>[e,m(e)])),v=(e,t,n,r)=>{let i=p(d(e),d(t)),a=p(f(e),f(t));if(i<=0||a<=0)return;let s=i<=a,c=s===o,l=e=>c?e.x:e.y,m=e=>c?e.x+e.width:e.y+e.height,h=e=>(l(e)+m(e))/2,g=h(n)<=h(r)?n:r;u.push({axis:c?`x`:`y`,amount:s?i:a,after:m(g)})};for(let e of g){let t=s.get(e.id),r=[...t].filter(e=>a.has(e)).map(e=>a.get(e)),o=new Set(r);for(let[s,u]of n){if(t.has(s))continue;if(o.has(a.get(s))||!qn(r,a.get(s))){v(_.get(e),u,e,u);continue}let n=h(_.get(e),u);n<=0||(i.has(e.id)?c.set(e.id,Math.max(c.get(e.id)??0,n)):l=!0)}}let y=(e,t)=>Yn(e.children).includes(t);for(let e=0;e<g.length;e++)for(let t=e+1;t<g.length;t++){let n=g[e],r=g[t];y(n,r)||y(r,n)||v(_.get(n),r,n,r)}return{penetration:c,stuck:l,requests:u}}function Zn(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=te(e),o=t(i,{feedbackEdges:a}),s=Un(o.nodes,e.direction),c=zn(e.direction),l=new Map(o.nodes.map(e=>[e.id,e])),u=e=>{let t=l.get(e);return c?t.x:t.y},d=Vn(e.subgraphs),f=Wn(d,s,u),p=new Map;for(let e of f.ghosts)p.set(e.subgraph,[...p.get(e.subgraph)??[],e.id]);let m=new Map(o.nodes.map(e=>[e.id,u(e.id)]));Gn(e.subgraphs,s,m,(t,n)=>{let r=H(t),i=H(n),a=(t,n)=>e.edges.some(e=>t.has(e.source)&&n.has(e.target));return a(r,i)&&a(i,r)},(t,n)=>ne(e,t,n));for(let e of f.ghosts){let t=[...H(d.find(t=>t.id===e.subgraph))].filter(e=>m.has(e)).map(e=>m.get(e));m.set(e.id,t.reduce((e,t)=>e+t,0)/t.length)}let h=new Map(e.nodes);for(let e of f.ghosts)h.set(e.id,{id:e.id,label:` `,shape:`rectangle`});let g=Kn([...h.keys()],m,s,d,p),_={...i,nodes:new Map(g.map(e=>[e,h.get(e)])),edges:[...e.edges,...f.edges]},v=new Set(f.edges.map((t,n)=>e.edges.length+n)),y=i=>{let o=new Map,c=new Map;for(let l=0;;l++){let u=new Map(f.ghosts.map(e=>[e.id,jn+(o.get(e.subgraph)??0)])),m=t(_,{fixedWidths:u,looseEdges:v,detachedEdges:i,walkOrder:r,feedbackEdges:a,forceNodeOrder:!0}),h=new Map(m.nodes.filter(e=>!Bn(e.id)).map(e=>[e.id,e])),g=Jn(e.subgraphs,h,n),y=Xn(g,e.subgraphs,h,e.direction,new Set(p.keys()),s),{penetration:b,stuck:x}=y;if(x)return;if(b.size===0){for(let t=0;y.requests.length>0;t++){if(t===Nn)return;er(y.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...h.values()],m.edges),g=Jn(e.subgraphs,h,n),y=Xn(g,e.subgraphs,h,e.direction,new Set(p.keys()),s)}let t=$n(e,i,h,g,d);return t&&rr(m,[...h.values()],g,t,e.direction)}if(l===Mn)return;for(let[e,t]of b){let n=o.get(e)??0,r=c.get(e),i=r?(r.overlap-t)/(n-r.width):0,a=i>Ln?i:In;c.set(e,{width:n,overlap:t}),o.set(e,n+t/a+Fn)}}},b=Qn(e,f,s,d);return(b.size>0?y(b):void 0)??y(new Set)}function Qn(e,t,n,r){let i=r.map(e=>{let t=H(e);return{inside:t,layers:new Set([...t].filter(e=>n.has(e)).map(e=>n.get(e)))}}),a=e=>{let t=n.get(e.source),r=n.get(e.target);return t===void 0||r===void 0||e.source===e.target?!1:i.some(({inside:n,layers:i})=>n.has(e.source)&&n.has(e.target)&&Array.from({length:Math.max(0,Math.abs(r-t)-1)},(e,n)=>Math.min(t,r)+1+n).some(e=>!i.has(e)))},o=new Set;e.edges.forEach((e,t)=>{a(e)&&o.add(t)});let s=new Map,c=e=>{e.source!==e.target&&(s.set(e.source,(s.get(e.source)??0)+1),s.set(e.target,(s.get(e.target)??0)+1))};e.edges.forEach((e,t)=>{o.has(t)||c(e)}),t.edges.forEach(c);for(let t of[...o]){let n=e.edges[t];(!s.get(n.source)||!s.get(n.target))&&o.delete(t)}return o}function $n(e,t,n,r,i){let a=new Map(Yn(r).map(e=>[e.id,e])),o=[];for(let r of t){let t=e.edges[r],s=n.get(t.source),c=n.get(t.target),l=i.filter(e=>{let n=H(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>H(e).size-H(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=On(s,c,[...n.values()].filter(e=>e!==s&&e!==c),u,e.direction,o.map(e=>e.points));if(!d)return;o.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:t.label?kn(d):void 0,inlineStyle:pn(r,e),headColor:fn(e),id:t.id,animate:t.animate})}return o}function er(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+Pn,s=t.filter(e=>e[r]>=a),c=Math.min(...s.map(e=>e[r]));for(let e of s)e[r]+=o;let l=e=>{e[r]>=c&&(e[r]+=o)};for(let e of n)e.points.forEach(l),e.labelPosition&&l(e.labelPosition)}var tr=8;function nr(e,t,n,r){let i=zn(r)?`y`:`x`,a=i===`x`?`y`:`x`,o=i===`x`?`width`:`height`,s=i===`x`?`height`:`width`;for(let{points:r}of e)for(let e=1;e<r.length-1;){let c=e;for(;c+1<r.length-1&&r[c+1][i]===r[e][i];)c++;let l=r.slice(e,c+1),u=l[0],d=Math.min(...l.map(e=>e[a])),f=Math.max(...l.map(e=>e[a])),p=r[e-1][i],m=r[c+1][i],h=n.flatMap(e=>[e[i],e[i]+e[o]].map(t=>({g:e,s:t}))).find(({g:e,s:t})=>Math.abs(u[i]-t)<tr&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?tr:-8),n=(e-p)*(m-e)>0,r=t.every(t=>t[i]+t[o]<=e||t[i]>=e||t[a]+t[s]<=d||t[a]>=f);if(n&&r)for(let t of l)t[i]=e}e=c+1}}function rr(e,t,n,r,i){let a=[...e.edges.filter(e=>!Bn(e.source)&&!Bn(e.target)),...r],o=Yn(n);nr(a,t,o,i);let s=[...t.map(e=>e.x),...o.map(e=>e.x),...a.flatMap(e=>e.points.map(e=>e.x))],c=[...t.map(e=>e.y),...o.map(e=>e.y),...a.flatMap(e=>e.points.map(e=>e.y))],l=B.padding-Math.min(...s),u=B.padding-Math.min(...c);for(let e of t)e.x+=l,e.y+=u;for(let e of o)e.x+=l,e.y+=u;for(let e of a){for(let t of e.points)t.x+=l,t.y+=u;e.labelPosition&&(e.labelPosition.x+=l,e.labelPosition.y+=u)}let d=0,f=0;for(let e of t)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of o)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of a){for(let t of e.points)d=Math.max(d,t.x+Qe.width+B.padding),f=Math.max(f,t.y+Qe.width+B.padding);e.labelPosition&&(d=Math.max(d,e.labelPosition.x+60+B.padding),f=Math.max(f,e.labelPosition.y+20+B.padding))}return{...e,nodes:t,edges:a,groups:n,width:d,height:f}}var ir=12,ar=8,or=4;function sr(e,t,n){let r=e.map(e=>({axis:e.axis,cross:e.cross,after:e.after??0,rank:0,real:!0})),i=e.map(()=>[]),a=e.map(()=>[]),o=t.flatMap((e,t)=>e.from===e.to?[]:[t]),s=m(o.map(e=>({source:String(t[e].from),target:String(t[e].to)})),e.map((e,t)=>String(t))),c=o.map((e,n)=>{let r=t[e];return s.has(n)?{index:e,u:r.to,v:r.from,reversed:!0}:{index:e,u:r.from,v:r.to,reversed:!1}}),l=e.map(()=>[]),u=e.map(()=>0);for(let e of c)l[e.u].push(e.v),u[e.v]++;let d=u.flatMap((e,t)=>e===0?[t]:[]);for(let e=0;e<d.length;e++){let t=d[e];for(let e of l[t])r[e].rank=Math.max(r[e].rank,r[t].rank+2),--u[e]===0&&d.push(e)}let f=c.map(e=>{let n=(r[e.v].rank-r[e.u].rank)/2,o=r[e.u].rank+2*Math.floor(n/2)+1,s=t[e.index].label,c=[e.u];for(let t=r[e.u].rank+1;t<r[e.v].rank;t++){let e=r.length,n=t===o&&s!==void 0;r.push({axis:n?s.axis:0,cross:n?s.cross:0,after:0,rank:t,real:!1}),i.push([]),a.push([]),c.push(e)}c.push(e.v);for(let e=1;e<c.length;e++)a[c[e-1]].push(c[e]),i[c[e]].push(c[e-1]);return{chain:c,labelRank:o}}),p=r.map((e,t)=>t),h=e=>{let t=e;for(;p[t]!==t;)t=p[t]=p[p[t]];return t};for(let{chain:e}of f)for(let t of e)p[h(t)]=h(e[0]);let g=new Map;r.forEach((e,t)=>{let n=h(t);g.set(n,[...g.get(n)??[],t])});let _=r.map(()=>0),v=[],y=[];for(let e of g.values()){let t=cr(e,r,i,a,n),o=1/0,s=-1/0;for(let n of e)_[n]=t.get(n),o=Math.min(o,_[n]-r[n].cross/2),s=Math.max(s,_[n]+r[n].cross/2+r[n].after);v.push({min:o,max:s}),y.push(e)}let b=0;y.forEach((e,t)=>{let r=b-v[t].min;for(let t of e)_[t]=_[t]+r;b+=v[t].max-v[t].min+n.nodeSep});let x=Math.max(0,b-n.nodeSep),S=r.reduce((e,t)=>Math.max(e,t.rank),0),C=Array(S+1).fill(0);for(let e of r)C[e.rank]=Math.max(C[e.rank],e.axis);let w=Array(S+1).fill(0);for(let e=1;e<=S;e++)w[e]=w[e-1]+C[e-1]+n.rankSep/2;let T=e=>w[r[e].rank]+C[r[e].rank]/2,E=t.map(()=>[]),D=t.map(()=>void 0);return c.forEach((e,n)=>{let{chain:i,labelRank:a}=f[n],o=i.slice(1,-1),s=o.map(e=>({axis:T(e),cross:_[e]}));if(E[e.index]=e.reversed?s.reverse():s,t[e.index].label){let t=o.find(e=>r[e].rank===a);D[e.index]={axis:T(t),cross:_[t]}}}),{nodes:e.map((e,t)=>({axis:w[r[t].rank]+(C[r[t].rank]-e.axis)/2,cross:_[t]-e.cross/2})),paths:E,labels:D,axisSize:w[S]+C[S],crossSize:x}}function cr(e,t,n,r,i){let a=[],o=new Set,s=[...e].sort((e,n)=>t[e].rank-t[n].rank||e-n);for(let e of s){if(o.has(e))continue;let n=[{s:e,next:0}];for(o.add(e),(a[t[e].rank]??=[]).push(e);n.length>0;){let e=n[n.length-1],i=r[e.s][e.next++];i===void 0?n.pop():o.has(i)||(o.add(i),(a[t[i].rank]??=[]).push(i),n.push({s:i,next:0}))}}let c=a.filter(e=>e!==void 0),l=new Map,u=()=>c.forEach(e=>e.forEach((e,t)=>l.set(e,t))),d=()=>{let e=0;for(let t=0;t+1<c.length;t++){let n=c[t].flatMap(e=>r[e].map(t=>[l.get(e),l.get(t)]));for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let[i,a]=n[t],[o,s]=n[r];(i-o)*(a-s)<0&&e++}}return e};u();let f=c.map(e=>[...e]),p=d();for(let e=0;e<ar&&p>0;e++){let t=e%2==0,i=c.map((e,t)=>t);t||i.reverse();for(let e of i){let i=t?n:r,a=e=>{let t=i[e];return t.length===0?l.get(e):t.reduce((e,t)=>e+l.get(t),0)/t.length},o=new Map(c[e].map(e=>[e,a(e)]));c[e].sort((e,t)=>o.get(e)-o.get(t)||l.get(e)-l.get(t)),c[e].forEach((e,t)=>l.set(e,t))}let a=d();a<p&&(p=a,f=c.map(e=>[...e]))}f.forEach((e,t)=>c[t]=e);let m=new Map,h=(e,n)=>(t[e].cross+t[n].cross)/2+t[e].after+(t[e].real&&t[n].real?i.nodeSep:Math.min(i.nodeSep,ir)),g=(e,t)=>{let n=e.slice(1).map((t,n)=>h(e[n],t)),r=[0];n.forEach((e,t)=>r.push(r[t]+e)),lr(e.map((e,n)=>{let i=(t[e]??[]).filter(e=>m.has(e));return(i.length===0?m.get(e)??0:i.reduce((e,t)=>e+m.get(t),0)/i.length)-r[n]})).forEach((t,n)=>m.set(e[n],t+r[n]))};for(let e of c)g(e,[]);for(let e=0;e<or;e++){for(let e=1;e<c.length;e++)g(c[e],n);for(let e=c.length-2;e>=0;e--)g(c[e],r)}return m}function lr(e){let t=[];for(let n of e)for(t.push({sum:n,count:1});t.length>1;){let e=t[t.length-1],n=t[t.length-2];if(n.sum/n.count<=e.sum/e.count)break;t.splice(-2,2,{sum:n.sum+e.sum,count:n.count+e.count})}return t.flatMap(e=>Array(e.count).fill(e.sum/e.count))}var ur=28,dr=18,fr=10,pr=32;function mr(e,t={}){let n={...B,...t,fontSizes:Je(t.fontSizes)},r=e.direction===`TB`||e.direction===`TD`||e.direction===`BT`,i=e.direction===`BT`||e.direction===`RL`,a=new Map,o=new Map,s=(e,t)=>{a.set(e.id,e),t!==void 0&&o.set(e.id,t);for(let t of e.nodeIds)o.has(t)||o.set(t,e.id);for(let t of e.children)s(t,e.id)};e.subgraphs.forEach(e=>s(e));let c=[...e.nodes.keys()].filter(e=>!a.has(e)),l=new Map(c.map((e,t)=>[e,t])),u=e=>Math.min(...e.nodeIds.map(e=>l.get(e)??1/0),...e.children.map(u)),d=e=>{let t=a.get(e);return t?u(t):l.get(e)??1/0},f=t=>[...c.filter(e=>o.get(e)===t),...(t===void 0?e.subgraphs:a.get(t).children).map(e=>e.id)].map((e,t)=>({id:e,i:t})).sort((e,t)=>d(e.id)-d(t.id)||e.i-t.i).map(e=>e.id),p=e=>{let t=[e];for(let n=o.get(e);n!==void 0;n=o.get(n))t.unshift(n);return t},m=t=>{let i=e.edges[t].label;if(!i)return;let a=v(i,n.fontSizes.edgeLabel,L.edgeLabel),o=a.width+8,s=a.height+6;return r?{axis:s,cross:o}:{axis:o,cross:s}},h=new Map,g=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target){g.set(e.source,[...g.get(e.source)??[],t]);return}let n=p(e.source),r=p(e.target),i=0;for(;n[i]!==void 0&&n[i]===r[i];)i++;if(i>=n.length||i>=r.length)return;let a=i===0?``:n[i-1];h.set(a,[...h.get(a)??[],{index:t,from:n[i],to:r[i]}])});let _=r?i?{axisStart:V.bottom,axisEnd:V.top,crossStart:V.left,crossEnd:V.right}:{axisStart:V.top,axisEnd:V.bottom,crossStart:V.left,crossEnd:V.right}:{axisStart:i?V.right:V.left,axisEnd:i?V.left:V.right,crossStart:V.top,crossEnd:V.bottom},y=(e,t)=>r?{aSize:t,cSize:e}:{aSize:e,cSize:t},b=new Map;for(let t of c){let r=e.nodes.get(t),i=yt(t,r.label,r.shape,n.fontSizes.nodeLabel);b.set(t,y(i.width,i.height))}let x=e=>{let t=g.get(e);if(!r||!t)return 0;let n=Math.max(0,...t.map(e=>(m(e)?.cross??-10)+fr));return ur+(t.length-1)*dr+n},S=e=>{let t=f(e),i=new Map,o=new Map,s=new Map;for(let e of t){let t=a.get(e);if(!t){o.set(e,b.get(e));continue}let c=S(e);i.set(e,c);let l=v(t.label,n.fontSizes.groupHeader,L.groupHeader).width,u=c.axisSize+_.axisStart+_.axisEnd,d=c.crossSize+_.crossStart+_.crossEnd,f=r?0:l+pr,p=r?l+pr:0,m=Math.max(0,f-u),h=Math.max(0,p-d);u+=m,d+=h,o.set(e,{aSize:u,cSize:d}),s.set(e,{axis:_.axisStart+m/2,cross:_.crossStart+h/2})}let c=new Map(t.map((e,t)=>[e,t])),l=h.get(e??``)??[],u=sr(t.map(e=>({axis:o.get(e).aSize,cross:o.get(e).cSize,after:x(e)})),l.map(e=>({from:c.get(e.from),to:c.get(e.to),label:m(e.index)})),{nodeSep:n.nodeSpacing,rankSep:n.layerSpacing}),d=new Map;return l.forEach((e,t)=>d.set(e.index,{mids:u.paths[t],label:u.labels[t]})),{members:t,at:new Map(t.map((e,t)=>[e,u.nodes[t]])),sizes:o,inset:{axis:0,cross:0},axisSize:u.axisSize,crossSize:u.crossSize,routes:d,inner:new Map([...i].map(([e,t])=>[e,{...t,inset:s.get(e)}]))}},C=S(void 0),w=new Map,T=new Map,D=(e,t,n)=>{for(let[r,i]of e.routes)T.set(r,{mids:i.mids.map(e=>({axis:e.axis+t,cross:e.cross+n})),label:i.label&&{axis:i.label.axis+t,cross:i.label.cross+n}});let r=[];for(let i of e.members){let o=e.at.get(i),s=e.sizes.get(i),c={axis:t+o.axis,cross:n+o.cross,...s};w.set(i,c);let l=e.inner.get(i);if(l){let e=a.get(i),t=D(l,c.axis+l.inset.axis,c.cross+l.inset.cross);r.push({id:i,label:e.label,x:0,y:0,width:0,height:0,children:t,...e.region?{region:!0}:{}})}}return r},O=D(C,0,0),k=n.padding,ee=C.axisSize,A=e=>{let t=i?ee-e.axis:e.axis;return r?{x:e.cross+k,y:t+k}:{x:t+k,y:e.cross+k}},j=e=>{let t=i?ee-e.axis-e.aSize:e.axis;return r?{x:e.cross+k,y:t+k,width:e.cSize,height:e.aSize}:{x:t+k,y:e.cross+k,width:e.aSize,height:e.cSize}},te=e=>{for(let t of e)Object.assign(t,j(w.get(t.id))),te(t.children)};te(O);let ne=c.map(t=>{let n=e.nodes.get(t);return{id:t,label:n.label,shape:n.shape,...j(w.get(t)),inlineStyle:E(t,e),className:e.classAssignments.get(t),interaction:e.interactions.get(t)}}),M=new Map(ne.map(e=>[e.id,e])),re=[];e.edges.forEach((t,n)=>{let r=T.get(n);if(!r)return;let i=w.get(t.source),a=w.get(t.target),o=i.axis>a.axis,[s,c]=o?[a,i]:[i,a],l=[{axis:s.axis+s.aSize,cross:s.cross+s.cSize/2},...o?[...r.mids].reverse():r.mids,{axis:c.axis,cross:c.cross+c.cSize/2}],u=[l[0]];for(let e of l.slice(1)){let t=u[u.length-1];if(t.cross!==e.cross){let n=(t.axis+e.axis)/2;u.push({axis:n,cross:t.cross},{axis:n,cross:e.cross})}u.push(e)}let d=Wt(hr(u.map(A)));o&&d.reverse();let f=M.get(t.source),p=M.get(t.target);f&&(d=kt(d,f,!0)),p&&(d=kt(d,p,!1)),re.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:r.label&&A(r.label),inlineStyle:pn(n,e),headColor:fn(e),id:t.id,animate:t.animate})}),$t(e,M,re);let N=(r?C.crossSize:C.axisSize)+k*2,ie=(r?C.axisSize:C.crossSize)+k*2;for(let e of re){for(let t of e.points)N=Math.max(N,t.x+Qe.width+k),ie=Math.max(ie,t.y+Qe.width+k);e.labelPosition&&(N=Math.max(N,e.labelPosition.x+60+k),ie=Math.max(ie,e.labelPosition.y+20+k))}return{width:N,height:ie,nodes:ne,edges:re,groups:O}}function hr(e){return e.filter((t,n)=>{let r=e[n-1],i=e[n+1];return!r||!i||!(r.x===t.x&&t.x===i.x||r.y===t.y&&t.y===i.y)})}function gr(e,t={}){return _r(e,t)}function _r(e,t,n){let r={...B,...t,fontSizes:Je(t.fontSizes)};return tn(Ve(Tt(e,r,n),t.layoutCache),e,r.mergeEdges)}function vr(e,t={}){let n=ie(e);if(t.layout===`simple`&&!ut(n))return mr(n,t);if(t.layout!==void 0&&t.layout!==`elk`&&t.layout!==`simple`)throw Error(`zombie-mermaid: unknown layout ${JSON.stringify(t.layout)}; use 'elk' or 'simple'.`);if(Hn(n)){let e=Zn(n,(e,n)=>_r(e,t,n),Je(t.fontSizes));if(e)return e}return gr(n,t)}function yr(e,t={}){return Tt(e,{...B,...t,fontSizes:Je(t.fontSizes)})}var br=12,xr=2;function Sr(e){return e.flatMap(e=>[e,...Sr(e.children)])}function Cr(e,t){let n=t.groupHeader+16;return Sr(e).filter(e=>e.label!==``).map(e=>{let r=v(e.label,t.groupHeader,L.groupHeader);return{x:e.x+br-xr,y:e.y+n/2-r.height/2-xr,width:r.width+4,height:r.height+4}})}function wr(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=[-r,r,-i,i],o=[e.x-n.x,n.x+n.width-e.x,e.y-n.y,n.y+n.height-e.y],s=0,c=1;for(let e=0;e<4;e++){let t=a[e],n=o[e];if(t===0){if(n<0)return!1}else{let e=n/t;if(t<0?s=Math.max(s,e):c=Math.min(c,e),s>c)return!1}}return!0}function Tr(e){return{x:e.x+xr,y:e.y+xr,width:e.width-4,height:e.height-4}}function Er(e,t){let n=e.points,r=t.map(Tr);for(let e=0;e+1<n.length;e++)if(r.some(t=>wr(n[e],n[e+1],t)))return!0;return!1}function Dr(e){let t=2166136261;for(let n of e.map(e=>`${e.x},${e.y},${e.width},${e.height}`).join(`;`))t=Math.imul(t^n.charCodeAt(0),16777619);return(t>>>0).toString(36)}function Or(e,t,n){let r=`zm-title-gap-${Dr(e)}`;return{id:r,markup:` <mask id="${r}" maskUnits="userSpaceOnUse" x="0" y="0" width="${t}" height="${n}">\n <rect x="0" y="0" width="${t}" height="${n}" fill="#fff" />\n${e.map(e=>` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" fill="#000" />`).join(`
9
- `)}\n </mask>`}}function kr(e,t,n=`Inter`,i=!1,a=qe,o=`linear`,s,c=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!D(e.interaction?.href));p.push(Di(M(e.width,e.height,t,i,u,d,m,f.styleAttribute,f.description),s)),p.push(r(n,!1,f.nonce,f.bodyFont)),c&&e.edges.some(e=>e.animate)&&p.push(Ar(f.nonce)),p.push(`<defs>`),p.push(jr());let h=new Set;for(let t of e.edges)t.headColor&&h.add(t.headColor);for(let e of h)p.push(Mr(e));let g=Cr(e.groups,a),_=new Set(e.edges.filter(e=>Er(e,g))),v;if(_.size>0){let t=Or(g,e.width,e.height);v=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(Ir(t,n,a));for(let t of e.edges)p.push(Lr(t,o,c,_.has(t)?v:void 0));for(let t of e.edges)t.label&&p.push(zr(t,n,a));for(let t of e.nodes)p.push(Ur(t,n,a,l));return p.push(`</svg>`),p.join(`
10
- `)}function Ar(e){return[A(e),` @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }`,` .edge-animated { animation: zm-edge-dash 1s linear infinite; }`,` @media (prefers-reduced-motion: reduce) {`,` .edge-animated { animation: none; }`,` }`,`</style>`].join(`
11
- `)}function jr(){return Pr(`var(--_arrow)`,``)}function Mr(e){return Pr(l(e),f`-${Fr(e)}`)}var Nr=3.5;function Pr(e,t){let n=10.5,r=12.8,i=f`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,a=f`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${i} />`,o=(e,t)=>f` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${9.5}" refY="${r/2}" markerUnits="userSpaceOnUse" orient="${t}">`+f`\n ${a}`+`
8
+ }`;function I(e,t,n){return b(e,t,n)}function Ge(e,t){return e.length*t*.6}var Ke=`'JetBrains Mono'`,qe=`${Ke}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,Je={nodeLabel:13,edgeLabel:11,groupHeader:12};function Ye(e){return{nodeLabel:e?.nodeLabel??Je.nodeLabel,edgeLabel:e?.edgeLabel??Je.edgeLabel,groupHeader:e?.groupHeader??Je.groupHeader}}var L={nodeLabel:500,edgeLabel:400,groupHeader:600},Xe=12,Ze=12,Qe={horizontal:20,vertical:10,diamondExtra:24},R={outerBox:1,innerBox:.75,connector:1},z=`0.35em`,$e={width:8,height:5};function et(e,t,n,i){return r(e,t?{family:Ue,faceCss:We}:!1,n,i)}var B={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:Je},tt=`#087ebf`,nt={blank:``,database:`<path d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><path d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><path d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><ellipse cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line>`,disk:`<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></rect><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"></path>`,server:`<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></rect><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"></path><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"></path></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"></path><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"></path></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"></path><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"></path></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle></g>`,cloud:`<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path>`,internet:`<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></circle><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line>`},rt={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function it(e,t){switch(e){case`LR`:return`RIGHT`;case`RL`:return`LEFT`;case`BT`:return`UP`;case`TD`:case`TB`:return`DOWN`;default:return t}}function at(e){let t=typeof e==`number`?{top:e,left:e,bottom:e,right:e}:e;return`[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`}function ot(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":at(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function st(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var ct={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function lt(e,t){let n=y(e,t.fontSize,L.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function ut(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[lt(e.label,e.labelStyle)]),t}var dt={"state-start":`FIRST`},ft={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function pt(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var V={top:44,left:16,bottom:16,right:16},mt={top:16,left:16,bottom:16,right:16},ht={...V,bottom:30};function gt(e){let t=new Map;for(let n of e.edges){if(!n.label)continue;let e=`${n.source}\0${n.target}`,r=(t.get(e)??0)+1;if(r>=3)return!0;t.set(e,r)}return!1}var _t=new WeakMap;function vt(e,t){let n=_t.get(e);return n||(n=pt(e)||Tt(e.subgraphs)?new Set:p(e,t?.walkOrder,t?.feedbackEdges??ne(e)),_t.set(e,n)),n}function yt(e,t){for(let n=0;n<e.edges.length;n++){let r=e.edges[n];if(t.has(r.source)||t.has(r.target))return n}return 1/0}function bt(e){return it(e,rt.flowchart)}function xt(e){return{...ot(e),"elk.spacing.edgeEdge":`12`,"elk.layered.spacing.edgeEdgeBetweenLayers":`12`,"elk.layered.spacing.edgeNodeBetweenLayers":`12`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.contentAlignment":`H_CENTER V_CENTER`}}function St(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:ct}}function Ct(e,t,n,r,i,a){if(i!==void 0)return{width:80,height:80};let o=y(t,r,L.nodeLabel),s=o.width+Qe.horizontal*2,c=o.height+Qe.vertical*2;if(n===`diamond`){let e=Math.max(s,c)+Qe.diamondExtra;s=e,c=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(s*s+c*c))+8;s=n===`doublecircle`?e+12:e,c=s}if(n===`hexagon`&&(s+=Qe.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(s+=Qe.horizontal),n===`asymmetric`&&(s+=12),n===`cylinder`&&(c+=14),n===`cloud`){let e=Math.max(s,c*2.5);return{width:e*1.25,height:c+e*.48}}return n===`small-circle`?{width:14,height:14}:n===`fork-bar`?a===`LR`||a===`RL`?{width:10,height:70}:{width:70,height:10}:n===`state-start`||n===`state-end`?{width:28,height:28}:n===`junction`?{width:2,height:2}:t===``&&n===`diamond`?{width:28,height:28}:t===``&&n===`fork-join`?{width:70,height:10}:(s=Math.max(s,60),c=Math.max(c,36),{width:s,height:c})}var wt=` root`;function Tt(e){for(let t of e)if(t.direction!==void 0||Tt(t.children))return!0;return!1}function Et(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)Et(n,t)}function Dt(e){let t=new Map;function n(e,r){let i=[...r,e.id];t.set(e.id,i);for(let t of e.children)n(t,i)}for(let t of e)n(t,[]);return t}function Ot(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function kt(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),Pt(t,i,a);let o=Ft(e.subgraphs),s=Dt(e.subgraphs),c=e=>e?s.get(e)??[]:[],l=new Map;l.set(null,[]);let u=[];for(let t=0;t<e.edges.length;t++){let n=e.edges[t],r=o.get(n.source),i=o.get(n.target);if(!(n.acrossFlow&&!r&&!i)){if(r&&r===i){let e=l.get(r)??[];l.set(r,e),e.push({index:t,edge:n})}else!r&&!i?l.get(null).push({index:t,edge:n}):u.push({index:t,edge:n,srcChain:c(r),tgtChain:c(i)})}}let d=Tt(e.subgraphs),f=[],p=[],m={...xt({direction:bt(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(B.thoroughness),"elk.layered.highDegreeNodes.treatment":`false`,"elk.layered.compaction.postCompaction.strategy":(e.subgraphs.length===0||gt(e))&&!n?.forceNodeOrder?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...gt(e)?{"elk.spacing.edgeEdge":`40`}:{},...n?.forceNodeOrder||Mt(e)?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...pt(e)?ft:{},"elk.layered.wrapping.strategy":`OFF`,...Mt(e)?{"elk.partitioning.activate":`true`,"elk.layered.crossingMinimization.semiInteractive":`true`,"elk.layered.nodePlacement.bk.fixedAlignment":`LEFTUP`}:{},"elk.hierarchyHandling":d?`SEPARATE`:`INCLUDE_CHILDREN`},h=new Map,g=new Map;function _(e,t){let n=h.get(e)??new Set;h.set(e,n),n.add(t)}function v(e,t){let n=g.get(e)??[];g.set(e,n),n.push(t)}if(d)for(let{index:e,edge:t,srcChain:n,tgtChain:i}of u){let a=Ot(n,i),o=t.source;if(n.length>a){for(let r=n.length-1;r>=a;r--){let i=n[r],a=`${i}_out_${e}`;_(i,a);let o=r===n.length-1?t.source:`${n[r+1]}_out_${e}`;v(i,{id:`e${e}_s${r}`,sources:[o],targets:[a]})}o=`${n[a]}_out_${e}`}let s=t.target;if(i.length>a){for(let n=a;n<=i.length-1;n++){let r=i[n],a=`${r}_in_${e}`;_(r,a);let o=n===i.length-1?t.target:`${i[n+1]}_in_${e}`;v(r,{id:`e${e}_t${n}`,sources:[a],targets:[o]})}s=`${i[a]}_in_${e}`}v(a>0?n[a-1]:wt,ut({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:St(r)}))}let y=Mt(e)?[...e.nodes].sort((e,t)=>(e[1].gridOrder??0)-(t[1].gridOrder??0)):e.nodes;for(let[t,o]of y)if(!i.has(t)&&!a.has(t)){let i=Ct(t,o.label,o.shape,r.fontSizes.nodeLabel,o.icon,e.direction),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=st(t,i,o.label),c=pt(e)?dt[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),o.gridLayer!==void 0&&(s.layoutOptions={...s.layoutOptions,...jt(o,e.direction)}),f.push(s)}let b=pt(e),x=f.length,S=b?e.subgraphs:[...e.subgraphs].reverse();for(let t of S)f.push(At(t,e,r,l,h,g,e.direction));if(b&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<x)return yt(e,new Set([t.id]));let r=e.subgraphs[n-x],i=yt(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return Et(r,a),yt(e,a)}),n=f.map((e,t)=>t).sort((e,n)=>t[e]-t[n]||e-n).map(e=>f[e]);f.splice(0,f.length,...n)}let C=vt(e,n),w=n?.feedbackEdges,T=l.get(null),E=w?.size?[...T.filter(e=>w.has(e.index)),...T.filter(e=>!w.has(e.index))]:T;for(let{index:e,edge:t}of E){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=ut({id:`e${e}`,source:C.has(e)?t.target:t.source,target:C.has(e)?t.source:t.target,label:t.label,labelStyle:St(r)});n?.looseEdges?.has(e)&&(i.layoutOptions={...i.layoutOptions,"elk.layered.priority.straightness":`0`}),p.push(i)}if(d)for(let e of g.get(wt)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(ut({id:`e${e}`,source:C.has(e)?t.target:t.source,target:C.has(e)?t.source:t.target,label:t.label,labelStyle:St(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function At(e,t,n,r,i,a,o){let s=e.direction!==void 0&&te(e,t)?e.direction:o,c=xt({direction:bt(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:e.region?mt:Mt(t)?ht:V}),l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[],f=e=>t.nodes.get(e)?.gridOrder??0;for(let r of[...e.nodeIds].sort((e,t)=>f(e)-f(t))){let e=t.nodes.get(r);if(e){let i=st(r,Ct(r,e.label,e.shape,n.fontSizes.nodeLabel,e.icon,t.direction),e.label);e.gridLayer!==void 0&&(i.layoutOptions=jt(e,t.direction)),d.push(i)}}let p=e.children.some(e=>e.region)?e.children:[...e.children].reverse();for(let e of p)d.push(At(e,t,n,r,i,a,s));let m=[],h=r.get(e.id)??[],g=vt(t);for(let{index:e,edge:t}of h)t.source!==t.target&&m.push(ut({id:`e${e}`,source:g.has(e)?t.target:t.source,target:g.has(e)?t.source:t.target,label:t.label,labelStyle:St(n)}));for(let t of a.get(e.id)??[])m.push(t);if(Mt(t)){c[`elk.partitioning.activate`]=`true`;let n=Nt(e,t);n!==void 0&&(c[`elk.partitioning.partition`]=String(n))}return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:m}}function jt(e,t){let n=String((e.gridOrder??0)*100),r=t===`LR`||t===`RL`;return{"elk.partitioning.partition":String(e.gridLayer),"elk.position":r?`(0, ${n})`:`(${n}, 0)`}}function Mt(e){for(let t of e.nodes.values())if(t.gridLayer!==void 0)return!0;return!1}function Nt(e,t){let n=[...e.nodeIds.map(e=>t.nodes.get(e)?.gridLayer),...e.children.map(e=>Nt(e,t))].filter(e=>e!==void 0);return n.length>0?Math.min(...n):void 0}function Pt(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),Pt(r,t,n)}function Ft(e){let t=new Map;function n(e){for(let n of e.nodeIds)t.set(n,e.id);for(let t of e.children)n(t)}for(let t of e)n(t);return t}function It(e,t,n){if(e.length<2||t.shape===`rectangle`||t.shape===`rounded`||t.shape===`stadium`)return e;let r=[...e];if(t.shape===`diamond`){if(n)r[0]=Lt(e[0],e[1],t);else{let n=e.length-1;r[n]=Lt(e[n],e[n-1],t)}}if(t.shape===`asymmetric`){let i=n?0:e.length-1,a=e[i],o=t.height/2,s=Math.abs(a.y-(t.y+o));Math.abs(a.x-t.x)<.5&&s<o&&(r[i]={x:t.x+12*(1-s/o),y:a.y})}return r}function Lt(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2,a={x:r,y:n.y},o={x:n.x+n.width,y:i},s={x:r,y:n.y+n.height},c={x:n.x,y:i},l=e.x-t.x,u=e.y-t.y;if(Math.abs(l)<Math.abs(u)){let t=e.x;return u>0?t<=r?zt(t,c,a)??a:zt(t,a,o)??a:t<=r?zt(t,s,c)??s:zt(t,o,s)??s}{let t=e.y;return l>0?t<=i?Rt(t,a,c)??c:Rt(t,c,s)??c:t<=i?Rt(t,a,o)??o:Rt(t,o,s)??o}}function Rt(e,t,n){let r=n.y-t.y;if(Math.abs(r)<.001)return null;let i=(e-t.y)/r;return i<0||i>1?null:{x:t.x+i*(n.x-t.x),y:e}}function zt(e,t,n){let r=n.x-t.x;if(Math.abs(r)<.001)return null;let i=(e-t.x)/r;return i<0||i>1?null:{x:e,y:t.y+i*(n.y-t.y)}}var Bt=12;function Vt(e,t,n){if(e.length===0)return;let r=n===`LR`||n===`RL`,i=new Set;for(let e of t)i.add(`${e.source}:${e.target}`),i.add(`${e.target}:${e.source}`);let a=B.layerSpacing*.6,o=[...e].sort((e,t)=>r?e.x-t.x:e.y-t.y),s=[],c=[o[0]];for(let e=1;e<o.length;e++){let t=(r?o[e].x:o[e].y)-(r?o[e-1].x:o[e-1].y),n=c.some(t=>i.has(`${t.id}:${o[e].id}`));t<=a&&!n?c.push(o[e]):(s.push(c),c=[o[e]])}s.push(c);let l=new Map;for(let e of s){if(e.length<=1)continue;let t=e.map(e=>r?e.x:e.y),n=Math.min(...t),i=Math.max(...t);if(i-n<=1)continue;let a=(n+i)/2;for(let t of e){let e=a-(r?t.x:t.y);Math.abs(e)>.5&&(r?t.x=a:t.y=a,l.set(t.id,e))}}l.size!==0&&Ht(t,l,r?`x`:`y`)}function Ht(e,t,n){let r=(e,t,r,i)=>{let a=e[t],o=a[n];a[n]+=i;let[s,c,l]=[1,2,3].map(n=>e[t+n*r]);if(s[n]===o)s[n]+=i;else if(c&&l&&c[n]===s[n]){let e=Math.sign(s[n]-o),t=s[n]+e*Math.max(0,Bt-e*(s[n]-a[n]));e*(l[n]-t)>0&&(s[n]=c[n]=t)}};for(let n of e){let{points:e}=n;if(e.length<2)continue;let i=t.get(n.source),a=t.get(n.target);i!=null&&r(e,0,1,i),a!=null&&r(e,e.length-1,-1,a)}}var Ut=.5,Wt=(e,t)=>e.lo<t.hi&&t.lo<e.hi;function Gt(e,t,n,r){let i=e.direction===`LR`||e.direction===`RL`,a=i?`y`:`x`,o=i?`height`:`width`,s=new Map(t.map(e=>[e.id,e])),c=new Map,l=new Map,u=(e,t)=>{for(let n of e)c.set(n,t),l.set(n.id,n),u(n.children,n)};u(r);let d=i?`x`:`y`,f=i?`width`:`height`,p=(e,t=0)=>({lo:e[a]+t,hi:e[a]+t+e[o]}),m=e=>({lo:e[d],hi:e[d]+e[f]}),h=t=>e.nodes.get(t)?.gridOrder,g=!1,_=r=>{r.children.forEach(_);let i=l.get(r.id);if(!i)return;let c=new Set,u=new Set,d=e=>{e.nodeIds.forEach(e=>c.add(e));let t=l.get(e.id);t&&u.add(t),e.children.forEach(d)};d(r);let f=0;for(let t of e.edges)for(let[e,n]of[[t.source,t.target],[t.target,t.source]]){let t=s.get(e),r=s.get(n);if(f!==0||!t||!r||!c.has(e)||c.has(n))continue;let i=h(e);if(i===void 0||i!==h(n))continue;let l=r[a]+r[o]/2-(t[a]+t[o]/2);Math.abs(l)>Ut&&(f=l)}if(f===0)return;let y=p(i,f);if(y.lo<0)return;let b=e=>Wt(y,p(e))&&Wt(m(i),m(e));if(t.some(e=>!c.has(e.id)&&b(e))||[...l.values()].some(e=>!u.has(e)&&!v(i).includes(e)&&b(e)))return;let x=v(i).map(e=>({a:e,before:i[a]-e[a],after:e[a]+e[o]-(i[a]+i[o])}));for(let e of t)c.has(e.id)&&(e[a]+=f);for(let e of u)e[a]+=f;for(let{a:e,before:t,after:n}of x){let r=Math.min(e[a],i[a]-t),s=Math.max(e[a]+e[o],i[a]+i[o]+n);e[a]=r,e[o]=s-r}let S=new Map;for(let e of c)S.set(e,f);let C=[];for(let e of n){let t=c.has(e.source),n=c.has(e.target);if(t&&n)for(let t of e.points)t[a]+=f;else(t||n)&&C.push(e)}Ht(C,S,a),g=!0};e.subgraphs.forEach(_);function v(e){let t=[];for(let n=c.get(e);n;n=c.get(n))t.push(n);return t}return g}var Kt=16;function qt(e,t,n){let[r,i,a,o]=e.direction===`LR`||e.direction===`RL`?[`x`,`width`,`y`,`height`]:[`y`,`height`,`x`,`width`],s=new Map(t.map(e=>[e.id,e])),c=new Map,l=e=>{for(let t of e)c.set(t.id,t),l(t.children)};l(n);let u=new Map,d=(e,t)=>{let n=[e.id,...t];u.set(e.id,t);for(let t of e.nodeIds)u.set(t,n);e.children.forEach(e=>d(e,n))};e.subgraphs.forEach(e=>d(e,[]));let f=e=>e[r]+e[i]/2,p=(e,t)=>e[r]<t[r]+t[i]&&t[r]<e[r]+e[i]&&e[a]<t[a]+t[o]&&t[a]<e[a]+e[o],m=!1;for(let n of e.edges){let a=s.get(n.source),o=s.get(n.target);if(!n.acrossFlow||!a||!o)continue;let l=u.get(a.id)??[],d=u.get(o.id)??[],[h,g,_,v]=d[0]!==void 0&&!l.includes(d[0])?[o,a,d,l]:l[0]!==void 0&&!d.includes(l[0])?[a,o,l,d]:[];if(!h||!g||!_||!v)continue;let y=f(g)-f(h);if(Math.abs(y)<=Ut||e.edges.some(e=>e!==n&&(e.source===h.id||e.target===h.id)))continue;let b=_.filter(e=>!v.includes(e)),x=c.get(b[b.length-1]);if(!x)continue;let S=e=>(u.get(e)??[]).includes(x.id),C=e=>{let n=Math.min(x[r],h[r]+y-e),a=Math.max(x[r]+x[i],h[r]+y+h[i]+e),o={...x,[r]:n,[i]:a-n};return t.some(e=>e!==g&&!S(e.id)&&p(o,e))||[...c.values()].some(e=>e!==x&&!S(e.id)&&!(u.get(x.id)??[]).includes(e.id)&&p(o,e))},w=[Kt,Kt/2].find(e=>!C(e));if(w!==void 0){h[r]+=y;for(let e of _){let t=c.get(e);if(!t)continue;let n=Math.min(t[r],h[r]-w),a=Math.max(t[r]+t[i],h[r]+h[i]+w);t[r]=n,t[i]=a-n}m=!0}}return m}var Jt=8;function Yt(e,t,n){let[r,i]=e.direction===`LR`||e.direction===`RL`?[`y`,`height`]:[`x`,`width`],a=new Map(t.map(e=>[e.id,e]));for(let t of n){let n=t.points;for(let[o,s,c]of[[t.source,0,1],[t.target,n.length-1,-1]]){let t=a.get(o),l=n[s],u=n[s+c];if(!t||!l||!u||e.nodes.get(o)?.gridOrder===void 0)continue;let d=t[r]+t[i]/2,f=Math.abs(l[r]-d);f<Ut||f>Jt||u[r]!==l[r]||(l[r]=u[r]=d)}t.points=n.filter((e,t)=>{let r=n[t-1];return!r||r.x!==e.x||r.y!==e.y})}}var Xt=.5;function Zt(e,t,n){for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=Math.min(i.x,a.x),s=Math.max(i.x,a.x),c=Math.min(i.y,a.y),l=Math.max(i.y,a.y);for(let e of t){if(n.has(e.id))continue;let t=e.x+Xt,r=e.x+e.width-Xt,i=e.y+Xt,a=e.y+e.height-Xt;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Qt(e,t,n){let r=[];for(let i of n)e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height&&(r.push(i),r.push(...Qt(e,t,i.children)));return r}function $t(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Qt(t,n,r).map(e=>e.id)),u=Qt(c?e:t,c?n:e,r).find(e=>!l.has(e.id));return u?a?u.x-12:o?u.x+u.width+12:s?u.y+u.height+12:u.y-12:e}var en=2;function tn(e,t,n,r,i){for(let a of e){if(t.has(a)||a.source===a.target)continue;let e=a.source===n?a.points[0]:a.target===n?a.points[a.points.length-1]:void 0;if(e&&Math.abs((i?e.x:e.y)-r)<=en)return!0}return!1}function nn(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=new Map,s=e=>`${e.source}\0${e.target}`;for(let t of e)o.set(s(t),(o.get(s(t))??0)+1);let c=e=>o.get(s(e))>1,l=r===`LR`,u=r===`RL`,d=r===`BT`,f=l||u,p=new Map;for(let t of e){if(t.source===t.target||c(t))continue;let e=p.get(t.source)??[];p.set(t.source,e),e.push(t)}for(let[o,s]of p){if(s.length<2)continue;let c=s[0].style;if(s.some(e=>e.label||e.style!==c))continue;let p=i.get(o);if(!p)continue;let m=[];for(let e of s){let t=i.get(e.target);t&&(l?t.x>p.x+p.width:u?t.x+t.width<p.x:d?t.y+t.height<p.y:t.y>p.y+p.height)&&m.push({edge:e,node:t})}if(m.length<2)continue;let h=p.x+p.width/2,g=p.y+p.height/2;if(f){let i=l?p.x+p.width:p.x,s=g;if(tn(e,new Set(m.map(e=>e.edge)),o,i,!0))continue;let c=i+((l?Math.min(...m.map(e=>e.node.x)):Math.max(...m.map(e=>e.node.x+e.node.width)))-i)/2;c=$t(c,h,g,n,r);let u=[];for(let{edge:e,node:n}of m){let r=l?n.x:n.x+n.width,a=n.y+n.height/2,d=[{x:i,y:s},{x:c,y:s},{x:c,y:a},{x:r,y:a}];Zt(d,t,new Set([o,n.id]))&&u.push({edge:e,points:d})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t,a.add(e)}else{let i=h,s=d?p.y:p.y+p.height;if(tn(e,new Set(m.map(e=>e.edge)),o,s,!1))continue;let c=s+((d?Math.max(...m.map(e=>e.node.y+e.node.height)):Math.min(...m.map(e=>e.node.y)))-s)/2;c=$t(c,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=n.x+n.width/2,a=d?n.y+n.height:n.y,u=[{x:i,y:s},{x:i,y:c},{x:r,y:c},{x:r,y:a}];Zt(u,t,new Set([o,n.id]))&&l.push({edge:e,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let m=new Map;for(let t of e){if(a.has(t)||t.source===t.target||c(t))continue;let e=m.get(t.target)??[];m.set(t.target,e),e.push(t)}for(let[a,o]of m){if(o.length<2)continue;let s=o[0].style;if(o.some(e=>e.label||e.style!==s))continue;let c=i.get(a);if(!c)continue;let p=[];for(let e of o){let t=i.get(e.source);t&&(l?t.x+t.width<c.x:u?t.x>c.x+c.width:d?t.y>c.y+c.height:t.y+t.height<c.y)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=c.x+c.width/2,h=c.y+c.height/2;if(f){let i=l?c.x:c.x+c.width,o=h;if(tn(e,new Set(p.map(e=>e.edge)),a,i,!0))continue;let s=l?Math.max(...p.map(e=>e.node.x+e.node.width)):Math.min(...p.map(e=>e.node.x)),u=s+(i-s)/2;u=$t(u,m,h,n,r);let d=[];for(let{edge:e,node:n}of p){let r=l?n.x+n.width:n.x,s=n.y+n.height/2,c=[{x:r,y:s},{x:u,y:s},{x:u,y:o},{x:i,y:o}];Zt(c,t,new Set([n.id,a]))&&d.push({edge:e,points:c})}if(d.length<2)continue;for(let{edge:e,points:t}of d)e.points=t}else{let i=m,o=d?c.y+c.height:c.y;if(tn(e,new Set(p.map(e=>e.edge)),a,o,!1))continue;let s=d?Math.min(...p.map(e=>e.node.y)):Math.max(...p.map(e=>e.node.y+e.node.height)),l=s+(o-s)/2;l=$t(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=n.x+n.width/2,s=[{x:r,y:d?n.y:n.y+n.height},{x:r,y:l},{x:i,y:l},{x:i,y:o}];Zt(s,t,new Set([n.id,a]))&&u.push({edge:e,points:s})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}}}var rn=1.5,an=.01;function on(e){let t=e.map(e=>({...e})),n=0;for(;n+3<t.length;){let[e,r,i,a]=[t[n],t[n+1],t[n+2],t[n+3]],o=Math.abs(e.x-r.x)<an&&Math.abs(i.x-a.x)<an&&Math.abs(r.y-i.y)<an&&Math.abs(r.x-i.x)<=rn&&Math.abs(r.x-i.x)>=an,s=Math.abs(e.y-r.y)<an&&Math.abs(i.y-a.y)<an&&Math.abs(r.x-i.x)<an&&Math.abs(r.y-i.y)<=rn&&Math.abs(r.y-i.y)>=an;if(o){let r=(e.x+a.x)/2;t.splice(n,4,{x:r,y:e.y},{x:r,y:a.y})}else if(s){let r=(e.y+a.y)/2;t.splice(n,4,{x:e.x,y:r},{x:a.x,y:r})}else n++}return t}function sn(e,t=0,n=0){let r=[];if(!e.sections||e.sections.length===0)return r;let i=e.sections[0];if(r.push({x:i.startPoint.x+t,y:i.startPoint.y+n}),i.bendPoints)for(let e of i.bendPoints)r.push({x:e.x+t,y:e.y+n});return r.push({x:i.endPoint.x+t,y:i.endPoint.y+n}),r}function cn(e,t=0,n=0){if(!e.labels||e.labels.length===0)return;let r=e.labels[0];if(r.x!=null&&r.y!=null)return{x:r.x+(r.width??0)/2+t,y:r.y+(r.height??0)/2+n}}var ln=16,un=28,dn=18,fn=28,pn=10;function mn(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(fn,e.height*.6)/2,a=un+t*dn,o=[];for(let e=0;e<=ln;e++){let t=Math.PI*e/ln;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+pn,y:r}}}function hn(e,t,n){let r=new Map;for(let i=0;i<e.edges.length;i++){let a=e.edges[i];if(a.source!==a.target)continue;let o=t.get(a.source);if(!o)continue;let s=r.get(o.id)??0;r.set(o.id,s+1);let{points:c,labelPosition:l}=mn(o,s);n.push({source:a.source,target:a.target,label:a.label,style:a.style,hasArrowStart:a.hasArrowStart,hasArrowEnd:a.hasArrowEnd,points:c,labelPosition:a.label?l:void 0,inlineStyle:kn(i,e),headColor:On(e),id:a.id,animate:a.animate,startMarker:a.startMarker,endMarker:a.endMarker})}}function gn(e,t,n){let r=e.direction===`LR`||e.direction===`RL`;e.edges.forEach((i,a)=>{let o=t.get(i.source),s=t.get(i.target);if(!i.acrossFlow||!o||!s)return;let[c,l,u,d]=r?[`y`,`height`,`x`,`width`]:[`x`,`width`,`y`,`height`],f=o[c]<=s[c]?o:s,p=f===o?s:o,m=e=>e[u]+e[d]/2,h=(m(o)+m(s))/2,g=f[c]+f[l],_=p[c],v=e=>r?{x:h,y:e}:{x:e,y:h},y=f===o?[v(g),v(_)]:[v(_),v(g)];n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:y,inlineStyle:kn(a,e),headColor:On(e),id:i.id,animate:i.animate,startMarker:i.startMarker,endMarker:i.endMarker})})}function _n(e){let t=[];for(let n of e)t.push({x:n.x,y:n.y,right:n.x+n.width,bottom:n.y+n.height}),t.push(..._n(n.children));return t}function vn(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)Dn(e,o);yn(e,t,o,r,a,0,0);let s=_n(a);Sn(e,t,i,0,0,s.length>0?{leftX:Math.min(...s.map(e=>e.x))-20,rightX:Math.max(...s.map(e=>e.right))+20}:void 0),Vt(r,i,t.direction);let c=Gt(t,r,i,a),l=qt(t,r,a),u=c||l;Yt(t,r,i);let d=new Map(r.map(e=>[e.id,e]));hn(t,d,i);let f=t.edges.filter(e=>e.acrossFlow);for(let e=i.length-1;e>=0;e--){let t=i[e];f.some(e=>e.source===t.source&&e.target===t.target)&&i.splice(e,1)}gn(t,d,i),n&&nn(i,r,a,t.direction);for(let e of i){e.points=on(e.points);let t=d.get(e.source),n=d.get(e.target);t&&(e.points=It(e.points,t,!0)),n&&(e.points=It(e.points,n,!1))}let p=e.width??800,m=e.height??600,h=$e.width,g=B.padding;if(u)for(let e of _n(a))p=Math.max(p,e.right+g),m=Math.max(m,e.bottom+g);for(let e of i){for(let t of e.points)p=Math.max(p,t.x+h+g),m=Math.max(m,t.y+h+g);e.labelPosition&&(p=Math.max(p,e.labelPosition.x+60+g),m=Math.max(m,e.labelPosition.y+20+g))}return{width:p,height:m,nodes:r,edges:i,groups:a}}function yn(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,c=(s.y??0)+o,l=s.width??0,u=s.height??0;if(n.has(s.id)){let a=[];yn(s,t,n,r,a,e,c);let o=En(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:c,width:l,height:u,children:a,..._(s.id,t),...o?.region?{region:!0}:{},...o?.icon?{icon:o.icon}:{}})}else{let a=t.nodes.get(s.id);if(a){let n=D(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.icon===void 0?a.shape:`rectangle`,icon:a.icon,x:e,y:c,width:l,height:u,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&yn(s,t,n,r,i,e,c)}}}function bn(e){let t=/^e(\d+)$/.exec(e);if(t)return{edgeIndex:parseInt(t[1],10),role:`bridge`};let n=/^e(\d+)_([st])(\d+)$/.exec(e);if(n)return{edgeIndex:parseInt(n[1],10),role:n[2]===`s`?`source`:`target`,level:parseInt(n[3],10)}}function xn(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}let n=t/2;for(let t=1;t<e.length;t++){let r=e[t].x-e[t-1].x,i=e[t].y-e[t-1].y,a=Math.sqrt(r*r+i*i);if(n<=a){let o=n/a;return{x:e[t-1].x+o*r,y:e[t-1].y+o*i}}n-=a}return e[e.length-1]}function Sn(e,t,n,r,i,a){let o=new Map;Cn(e,o,0,0);let s=new Map;Tn(e,s,0,0,o);let c=0;for(let[e,r]of s){let i=t.edges[e];if(!i)continue;let o=[],s=e=>{!e||e.points.length===0||(o.length>0?o.push(...e.points.slice(1)):o.push(...e.points))},l=[...r.sourceHops.keys()].sort((e,t)=>t-e);for(let e of l)s(r.sourceHops.get(e));s(r.bridge);let u=[...r.targetHops.keys()].sort((e,t)=>e-t);for(let e of u)s(r.targetHops.get(e));let d;i.label&&o.length>=2&&(d=r.bridge?.labelPosition??xn(o));let f=wn(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=xn(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:vt(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:kn(e,t),headColor:On(t),id:i.id,animate:i.animate,startMarker:i.startMarker,endMarker:i.endMarker})}}function Cn(e,t,n,r){t.set(e.id,{x:n,y:r});for(let i of e.children??[]){let e=i.x??0,a=i.y??0;Cn(i,t,n+e,r+a)}}function wn(e,t,n=0){if(e.length<2)return e;let r=!1;for(let t=1;t<e.length;t++){let n=Math.abs(e[t].x-e[t-1].x),i=Math.abs(e[t].y-e[t-1].y);if(n>1&&i>1){r=!0;break}}if(!r)return e;let i=[e[0]];for(let r=1;r<e.length;r++){let a=i[i.length-1],o=e[r],s=Math.abs(o.x-a.x),c=Math.abs(o.y-a.y);if(s>1&&c>1){if(t){let e=n%2==0,r=Math.floor(n/2)*12,s=e?t.rightX+r:t.leftX-r;i.push({x:s,y:a.y}),i.push({x:s,y:o.y})}else{let e=(a.y+o.y)/2;i.push({x:a.x,y:e}),i.push({x:o.x,y:e})}}i.push(o)}return i}function Tn(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=bn(a.id);if(!e)continue;let{edgeIndex:o}=e,s=a.container,c=s?i.get(s):void 0,l=c?.x??n,u=c?.y??r,d=sn(a,l,u),f=cn(a,l,u),p=t.get(o)??{sourceHops:new Map,targetHops:new Map};t.set(o,p);let m={edgeIndex:o,points:d,labelPosition:f};e.role===`bridge`?p.bridge=m:e.role===`source`?p.sourceHops.set(e.level,m):p.targetHops.set(e.level,m)}if(e.children)for(let a of e.children)Tn(a,t,n+(a.x??0),r+(a.y??0),i)}function En(e,t){for(let n of e){if(n.id===t)return n;let e=En(n.children,t);if(e)return e}}function Dn(e,t){t.add(e.id);for(let n of e.children)Dn(n,t)}function On(e){return kn(-1,e)?.stroke}function kn(e,t){let n,r=t.linkStyles.get(`default`);r&&(n={...r});let i=t.linkStyles.get(e);return i&&(n=n?{...n,...i}:{...i}),n&&c(n)}var An=10,jn=14,Mn=14,Nn=10,Pn=24,Fn=400,In=new Set([`rectangle`,`rounded`,`subroutine`]);function Ln(e){let t=e===`TD`||e===`TB`||e===`BT`,n=e===`BT`||e===`RL`?-1:1;return{span:e=>{let[r,i]=t?[e.y,e.y+e.height]:[e.x,e.x+e.width],a=n*r,o=n*i;return{a0:Math.min(a,o),a1:Math.max(a,o),c0:t?e.x:e.y,c1:t?e.x+e.width:e.y+e.height}},toPoint:({a:e,c:r})=>t?{x:r,y:n*e}:{x:n*e,y:r}}}function Rn(e,t,n){let r=Math.min(e.a,t.a),i=Math.max(e.a,t.a),a=Math.min(e.c,t.c),o=Math.max(e.c,t.c);return i>n.a0&&r<n.a1&&o>n.c0&&a<n.c1}var zn=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function Bn(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function Vn(e,t,n){let r=e.c===t.c;for(let i=1;i<n.length;i++){let a=n[i-1],o=n[i];if(a.c===o.c===r){if(r){let n=Math.abs(e.c-a.c),r=Math.min(Math.max(e.a,t.a),Math.max(a.a,o.a))-Math.max(Math.min(e.a,t.a),Math.min(a.a,o.a));if(n<jn&&r>0)return!0}else{let n=Math.abs(e.a-a.a),r=Math.min(Math.max(e.c,t.c),Math.max(a.c,o.c))-Math.max(Math.min(e.c,t.c),Math.min(a.c,o.c));if(n<jn&&r>0)return!0}}}return!1}function Hn(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.a===n.a&&e.c===n.c||t.push(n)}for(let e=t.length-2;e>0;e--){let n=t[e-1],r=t[e],i=t[e+1];(n.a===r.a&&r.a===i.a||n.c===r.c&&r.c===i.c)&&t.splice(e,1)}return t}var Un=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.abs(e[n].a-e[n-1].a)+Math.abs(e[n].c-e[n-1].c);return t};function Wn(e,t,n,r,i,a=[]){let o=Ln(i),s=o.span(e),c=o.span(t),l=s.a1<=c.a0,u=c.a1<=s.a0;if(!l&&!u)return;let d=o.span(r),f={a0:d.a0+Nn,a1:d.a1-Nn,c0:d.c0+Nn,c1:d.c1-Nn},p=a.map(e=>e.map(e=>Bn(o,e))),m=n.map(e=>zn(o.span(e),An)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>In.has(e.shape),v=e=>{for(let t of e)if(t.a<f.a0||t.a>f.a1||t.c<f.c0||t.c>f.c1)return!1;for(let t=1;t<e.length;t++){let n=e[t-1],r=e[t];if(n.a!==r.a&&n.c!==r.c||m.some(e=>Rn(n,r,e))||Rn(n,r,s)||Rn(n,r,c)||p.some(e=>Vn(n,r,e)))return!1}return!0},y=new Set([h(s),h(c),f.c0,f.c1]);for(let e of m)y.add(e.c0-1),y.add(e.c1+1);for(let e of[s,c])y.add(e.c0-An),y.add(e.c1+An);let b=(e,t,n)=>_(e)?n>=t.c0+4&&n<=t.c1-4:Math.abs(n-h(t))<.5,x=[];if(l){let n=(c.a0-s.a1)/2,r=s.a1+Math.min(Mn,n),i=c.a0-Math.min(Mn,n);for(let n of y){b(e,s,n)&&b(t,c,n)&&x.push([{a:s.a1,c:n},{a:c.a0,c:n}]),x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]),b(t,c,n)&&x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:c.a0,c:n}]),b(e,s,n)&&x.push([{a:s.a1,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]);let a=n>=s.c1?s.c1:n<=s.c0?s.c0:void 0;if(a!==void 0){let e=b(t,c,n)?[{a:c.a0,c:n}]:[{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}];x.push([{a:g(s),c:a},{a:g(s),c:n},...e])}}}else for(let t of y){let n=t>=c.c1?c.c1:t<=c.c0?c.c0:void 0;if(n===void 0)continue;b(e,s,t)&&x.push([{a:s.a0,c:t},{a:g(c),c:t},{a:g(c),c:n}]);let r=n===c.c1?s.c1:s.c0;x.push([{a:g(s),c:r},{a:g(s),c:t},{a:g(c),c:t},{a:g(c),c:n}])}let S,C=1/0;for(let t of x){let n=Hn(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?Fn:0,i=Un(n)+Pn*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function Gn(e){let t={x:e[0].x,y:e[0].y},n=-1;for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.abs(a.x-i.x)+Math.abs(a.y-i.y);o>n&&(n=o,t={x:(i.x+a.x)/2,y:(i.y+a.y)/2})}return t}var Kn=`__zm_spine__`,qn=8,Jn=6,Yn=12,Xn=4,Zn=4,Qn=.25,$n=.02,er=40,tr=e=>e===`TD`||e===`TB`||e===`BT`,nr=e=>e.startsWith(Kn);function rr(e){return e.flatMap(e=>[e,...rr(e.children)])}function H(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of H(n))t.add(e);return t}function ir(e){if(e.subgraphs.length===0||pt(e)||Tt(e.subgraphs))return!1;for(let t of e.nodes.keys())if(nr(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=rr(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...H(t)].some(t=>e.nodes.has(t)))}function ar(e,t){let n=tr(t),r=e=>n?[e.y,e.y+e.height]:[e.x,e.x+e.width],i=[...e].sort((e,t)=>{let[n,i]=r(e),[a,o]=r(t);return(n+i)/2-(a+o)/2}),a=[];for(let e of i){let[t,n]=r(e),i=a[a.length-1];i&&t<i.end?(i.end=Math.min(i.end,n),i.ids.push(e.id)):a.push({end:n,ids:[e.id]})}(t===`BT`||t===`RL`)&&a.reverse();let o=new Map;return a.forEach((e,t)=>e.ids.forEach(e=>o.set(e,t))),o}function or(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...H(i)].filter(e=>t.has(e));if(e.length===0)continue;let a=e.map(e=>t.get(e)),o=Math.min(...a),s=Math.max(...a),c=new Map;for(let a=o;a<=s;a++){let o=e.filter(e=>t.get(e)===a).sort((e,t)=>n(e)-n(t));if(o.length>0)c.set(a,o[0]);else{let e=`${Kn}${i.id}__${a}`;r.ghosts.push({id:e,subgraph:i.id}),c.set(a,e)}}for(let e=o;e<s;e++){let t=c.get(e),n=c.get(e+1);!nr(t)&&!nr(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function sr(e,t,n,r=()=>!1,i=()=>!1){let a=e=>{let n=[...H(e)].filter(e=>t.has(e)).map(e=>t.get(e));return n.length>0?[Math.min(...n),Math.max(...n)]:void 0},o=e=>{let t=[...H(e)].filter(e=>n.has(e)).map(e=>n.get(e));return t.reduce((e,t)=>e+t,0)/t.length},s=e.map(e=>({sg:e,at:a(e)})).filter(e=>!!e.at).sort((e,t)=>e.at[0]-t.at[0]),c=[],l=-1/0;for(let{sg:e,at:t}of s){let n=c[c.length-1];n&&t[0]<=l?(n.push(e),l=Math.max(l,t[1])):(c.push([e]),l=t[1])}for(let t of c){if(t.length<2||t.some((e,n)=>t.slice(n+1).some(t=>r(e,t))))continue;let a=t.some(e=>e.region)||t.some((e,n)=>t.slice(n+1).some(t=>i(e,t)))?-1:1,s=[...t].sort((t,n)=>a*(e.indexOf(n)-e.indexOf(t))),c=t.map(o).sort((e,t)=>e-t),l=s.map((e,t)=>c[t]-o(e));s.forEach((e,t)=>{for(let r of H(e))n.has(r)&&n.set(r,n.get(r)+l[t])})}for(let a of e)sr(a.children,t,n,r,i)}function cr(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=H(t);for(let e of i.get(t.id)??[])r.add(e);let o=[...r].filter(e=>a.has(e)),s=o.filter(e=>n.has(e));if(s.length===0)continue;let c=Math.min(...s.map(e=>n.get(e))),l=Math.max(...s.map(e=>n.get(e))),u=o.map(e=>a.get(e)),d=Math.min(...u),f=Math.max(...u),p=(d+f)/2,m=0;for(let t of e){if(r.has(t)||nr(t))continue;let e=n.get(t);if(e===void 0||e<c||e>l)continue;m++;let i=a.get(t);a.set(t,i<=p?Math.min(i,d)-1-m*.001:Math.max(i,f)+1+m*.001)}}let o=new Map(e.map((e,t)=>[e,t]));return[...e].sort((e,t)=>a.get(e)-a.get(t)||o.get(e)-o.get(t))}var lr=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function ur(e,t,n,r){let i=t=>{let a=t.children.map(i),o=[...[...H(t)].flatMap(e=>{let t=n.get(e);return t?[t]:[]}),...a],s=t.region?mt:V,c=Math.min(...o.map(e=>e.x))-s.left,l=Math.min(...o.map(e=>e.y))-s.top,u=Math.max(...o.map(e=>e.x+e.width))+s.right,d=Math.max(...o.map(e=>e.y+e.height))+s.bottom,f=t.region?0:y(t.label,r.groupHeader,L.groupHeader).width+24;return{id:t.id,label:t.label,x:c,y:l,width:Math.max(u-c,f),height:d-l,children:a,..._(t.id,e),...t.region?{region:!0}:{},...t.icon?{icon:t.icon}:{}}};return t.map(i)}var dr=e=>e.flatMap(e=>[e,...dr(e.children)]);function fr(e,t,n,r,i,a){let o=tr(r),s=new Map(rr(t).map(e=>[e.id,H(e)])),c=new Map,l=!1,u=[],d=e=>o?[e.x,e.x+e.width]:[e.y,e.y+e.height],f=e=>o?[e.y,e.y+e.height]:[e.x,e.x+e.width],p=([e,t],[n,r])=>Math.max(0,Math.min(t,r)-Math.max(e,n)),m=e=>({x:e.x-er,y:e.y-er,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=dr(e),_=new Map(g.map(e=>[e,m(e)])),v=(e,t,n,r)=>{let i=p(d(e),d(t)),a=p(f(e),f(t));if(i<=0||a<=0)return;let s=i<=a,c=s===o,l=e=>c?e.x:e.y,m=e=>c?e.x+e.width:e.y+e.height,h=e=>(l(e)+m(e))/2,g=h(n)<=h(r)?n:r;u.push({axis:c?`x`:`y`,amount:s?i:a,after:m(g)})};for(let e of g){let t=s.get(e.id),r=[...t].filter(e=>a.has(e)).map(e=>a.get(e)),o=new Set(r);for(let[s,u]of n){if(t.has(s))continue;if(o.has(a.get(s))||!lr(r,a.get(s))){v(_.get(e),u,e,u);continue}let n=h(_.get(e),u);n<=0||(i.has(e.id)?c.set(e.id,Math.max(c.get(e.id)??0,n)):l=!0)}}let y=(e,t)=>dr(e.children).includes(t);for(let e=0;e<g.length;e++)for(let t=e+1;t<g.length;t++){let n=g[e],r=g[t];y(n,r)||y(r,n)||v(_.get(n),r,n,r)}return{penetration:c,stuck:l,requests:u}}function pr(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=ne(e),o=t(i,{feedbackEdges:a}),s=ar(o.nodes,e.direction),c=tr(e.direction),l=new Map(o.nodes.map(e=>[e.id,e])),u=e=>{let t=l.get(e);return c?t.x:t.y},d=rr(e.subgraphs),f=or(d,s,u),p=new Map;for(let e of f.ghosts)p.set(e.subgraph,[...p.get(e.subgraph)??[],e.id]);let m=new Map(o.nodes.map(e=>[e.id,u(e.id)]));sr(e.subgraphs,s,m,(t,n)=>{let r=H(t),i=H(n),a=(t,n)=>e.edges.some(e=>t.has(e.source)&&n.has(e.target));return a(r,i)&&a(i,r)},(t,n)=>re(e,t,n));for(let e of f.ghosts){let t=[...H(d.find(t=>t.id===e.subgraph))].filter(e=>m.has(e)).map(e=>m.get(e));m.set(e.id,t.reduce((e,t)=>e+t,0)/t.length)}let h=new Map(e.nodes);for(let e of f.ghosts)h.set(e.id,{id:e.id,label:` `,shape:`rectangle`});let g=cr([...h.keys()],m,s,d,p),_={...i,nodes:new Map(g.map(e=>[e,h.get(e)])),edges:[...e.edges,...f.edges]},v=new Set(f.edges.map((t,n)=>e.edges.length+n)),y=i=>{let o=new Map,c=new Map;for(let l=0;;l++){let u=new Map(f.ghosts.map(e=>[e.id,qn+(o.get(e.subgraph)??0)])),m=t(_,{fixedWidths:u,looseEdges:v,detachedEdges:i,walkOrder:r,feedbackEdges:a,forceNodeOrder:!0}),h=new Map(m.nodes.filter(e=>!nr(e.id)).map(e=>[e.id,e])),g=ur(e,e.subgraphs,h,n),y=fr(g,e.subgraphs,h,e.direction,new Set(p.keys()),s),{penetration:b,stuck:x}=y;if(x)return;if(b.size===0){for(let t=0;y.requests.length>0;t++){if(t===Yn)return;gr(y.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...h.values()],m.edges),g=ur(e,e.subgraphs,h,n),y=fr(g,e.subgraphs,h,e.direction,new Set(p.keys()),s)}let t=hr(e,i,h,g,d);return t&&yr(m,[...h.values()],g,t,e.direction)}if(l===Jn)return;for(let[e,t]of b){let n=o.get(e)??0,r=c.get(e),i=r?(r.overlap-t)/(n-r.width):0,a=i>$n?i:Qn;c.set(e,{width:n,overlap:t}),o.set(e,n+t/a+Zn)}}},b=mr(e,f,s,d);return(b.size>0?y(b):void 0)??y(new Set)}function mr(e,t,n,r){let i=r.map(e=>{let t=H(e);return{inside:t,layers:new Set([...t].filter(e=>n.has(e)).map(e=>n.get(e)))}}),a=e=>{let t=n.get(e.source),r=n.get(e.target);return t===void 0||r===void 0||e.source===e.target?!1:i.some(({inside:n,layers:i})=>n.has(e.source)&&n.has(e.target)&&Array.from({length:Math.max(0,Math.abs(r-t)-1)},(e,n)=>Math.min(t,r)+1+n).some(e=>!i.has(e)))},o=new Set;e.edges.forEach((e,t)=>{a(e)&&o.add(t)});let s=new Map,c=e=>{e.source!==e.target&&(s.set(e.source,(s.get(e.source)??0)+1),s.set(e.target,(s.get(e.target)??0)+1))};e.edges.forEach((e,t)=>{o.has(t)||c(e)}),t.edges.forEach(c);for(let t of[...o]){let n=e.edges[t];(!s.get(n.source)||!s.get(n.target))&&o.delete(t)}return o}function hr(e,t,n,r,i){let a=new Map(dr(r).map(e=>[e.id,e])),o=[];for(let r of t){let t=e.edges[r],s=n.get(t.source),c=n.get(t.target),l=i.filter(e=>{let n=H(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>H(e).size-H(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=Wn(s,c,[...n.values()].filter(e=>e!==s&&e!==c),u,e.direction,o.map(e=>e.points));if(!d)return;o.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:t.label?Gn(d):void 0,inlineStyle:kn(r,e),headColor:On(e),id:t.id,animate:t.animate,startMarker:t.startMarker,endMarker:t.endMarker})}return o}function gr(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+Xn,s=t.filter(e=>e[r]>=a),c=Math.min(...s.map(e=>e[r]));for(let e of s)e[r]+=o;let l=e=>{e[r]>=c&&(e[r]+=o)};for(let e of n)e.points.forEach(l),e.labelPosition&&l(e.labelPosition)}var _r=8;function vr(e,t,n,r){let i=tr(r)?`y`:`x`,a=i===`x`?`y`:`x`,o=i===`x`?`width`:`height`,s=i===`x`?`height`:`width`;for(let{points:r}of e)for(let e=1;e<r.length-1;){let c=e;for(;c+1<r.length-1&&r[c+1][i]===r[e][i];)c++;let l=r.slice(e,c+1),u=l[0],d=Math.min(...l.map(e=>e[a])),f=Math.max(...l.map(e=>e[a])),p=r[e-1][i],m=r[c+1][i],h=n.flatMap(e=>[e[i],e[i]+e[o]].map(t=>({g:e,s:t}))).find(({g:e,s:t})=>Math.abs(u[i]-t)<_r&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?_r:-8),n=(e-p)*(m-e)>0,r=t.every(t=>t[i]+t[o]<=e||t[i]>=e||t[a]+t[s]<=d||t[a]>=f);if(n&&r)for(let t of l)t[i]=e}e=c+1}}function yr(e,t,n,r,i){let a=[...e.edges.filter(e=>!nr(e.source)&&!nr(e.target)),...r],o=dr(n);vr(a,t,o,i);let s=[...t.map(e=>e.x),...o.map(e=>e.x),...a.flatMap(e=>e.points.map(e=>e.x))],c=[...t.map(e=>e.y),...o.map(e=>e.y),...a.flatMap(e=>e.points.map(e=>e.y))],l=B.padding-Math.min(...s),u=B.padding-Math.min(...c);for(let e of t)e.x+=l,e.y+=u;for(let e of o)e.x+=l,e.y+=u;for(let e of a){for(let t of e.points)t.x+=l,t.y+=u;e.labelPosition&&(e.labelPosition.x+=l,e.labelPosition.y+=u)}let d=0,f=0;for(let e of t)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of o)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of a){for(let t of e.points)d=Math.max(d,t.x+$e.width+B.padding),f=Math.max(f,t.y+$e.width+B.padding);e.labelPosition&&(d=Math.max(d,e.labelPosition.x+60+B.padding),f=Math.max(f,e.labelPosition.y+20+B.padding))}return{...e,nodes:t,edges:a,groups:n,width:d,height:f}}var br=12,xr=8,Sr=4;function Cr(e,t,n){let r=e.map(e=>({axis:e.axis,cross:e.cross,after:e.after??0,rank:0,real:!0})),i=e.map(()=>[]),a=e.map(()=>[]),o=t.flatMap((e,t)=>e.from===e.to?[]:[t]),s=m(o.map(e=>({source:String(t[e].from),target:String(t[e].to)})),e.map((e,t)=>String(t))),c=o.map((e,n)=>{let r=t[e];return s.has(n)?{index:e,u:r.to,v:r.from,reversed:!0}:{index:e,u:r.from,v:r.to,reversed:!1}}),l=e.map(()=>[]),u=e.map(()=>0);for(let e of c)l[e.u].push(e.v),u[e.v]++;let d=u.flatMap((e,t)=>e===0?[t]:[]);for(let e=0;e<d.length;e++){let t=d[e];for(let e of l[t])r[e].rank=Math.max(r[e].rank,r[t].rank+2),--u[e]===0&&d.push(e)}let f=c.map(e=>{let n=(r[e.v].rank-r[e.u].rank)/2,o=r[e.u].rank+2*Math.floor(n/2)+1,s=t[e.index].label,c=[e.u];for(let t=r[e.u].rank+1;t<r[e.v].rank;t++){let e=r.length,n=t===o&&s!==void 0;r.push({axis:n?s.axis:0,cross:n?s.cross:0,after:0,rank:t,real:!1}),i.push([]),a.push([]),c.push(e)}c.push(e.v);for(let e=1;e<c.length;e++)a[c[e-1]].push(c[e]),i[c[e]].push(c[e-1]);return{chain:c,labelRank:o}}),p=r.map((e,t)=>t),h=e=>{let t=e;for(;p[t]!==t;)t=p[t]=p[p[t]];return t};for(let{chain:e}of f)for(let t of e)p[h(t)]=h(e[0]);let g=new Map;r.forEach((e,t)=>{let n=h(t);g.set(n,[...g.get(n)??[],t])});let _=r.map(()=>0),v=[],y=[];for(let e of g.values()){let t=wr(e,r,i,a,n),o=1/0,s=-1/0;for(let n of e)_[n]=t.get(n),o=Math.min(o,_[n]-r[n].cross/2),s=Math.max(s,_[n]+r[n].cross/2+r[n].after);v.push({min:o,max:s}),y.push(e)}let b=0;y.forEach((e,t)=>{let r=b-v[t].min;for(let t of e)_[t]=_[t]+r;b+=v[t].max-v[t].min+n.nodeSep});let x=Math.max(0,b-n.nodeSep),S=r.reduce((e,t)=>Math.max(e,t.rank),0),C=Array(S+1).fill(0);for(let e of r)C[e.rank]=Math.max(C[e.rank],e.axis);let w=Array(S+1).fill(0);for(let e=1;e<=S;e++)w[e]=w[e-1]+C[e-1]+n.rankSep/2;let T=e=>w[r[e].rank]+C[r[e].rank]/2,E=t.map(()=>[]),D=t.map(()=>void 0);return c.forEach((e,n)=>{let{chain:i,labelRank:a}=f[n],o=i.slice(1,-1),s=o.map(e=>({axis:T(e),cross:_[e]}));if(E[e.index]=e.reversed?s.reverse():s,t[e.index].label){let t=o.find(e=>r[e].rank===a);D[e.index]={axis:T(t),cross:_[t]}}}),{nodes:e.map((e,t)=>({axis:w[r[t].rank]+(C[r[t].rank]-e.axis)/2,cross:_[t]-e.cross/2})),paths:E,labels:D,axisSize:w[S]+C[S],crossSize:x}}function wr(e,t,n,r,i){let a=[],o=new Set,s=[...e].sort((e,n)=>t[e].rank-t[n].rank||e-n);for(let e of s){if(o.has(e))continue;let n=[{s:e,next:0}];for(o.add(e),(a[t[e].rank]??=[]).push(e);n.length>0;){let e=n[n.length-1],i=r[e.s][e.next++];i===void 0?n.pop():o.has(i)||(o.add(i),(a[t[i].rank]??=[]).push(i),n.push({s:i,next:0}))}}let c=a.filter(e=>e!==void 0),l=new Map,u=()=>c.forEach(e=>e.forEach((e,t)=>l.set(e,t))),d=()=>{let e=0;for(let t=0;t+1<c.length;t++){let n=c[t].flatMap(e=>r[e].map(t=>[l.get(e),l.get(t)]));for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let[i,a]=n[t],[o,s]=n[r];(i-o)*(a-s)<0&&e++}}return e};u();let f=c.map(e=>[...e]),p=d();for(let e=0;e<xr&&p>0;e++){let t=e%2==0,i=c.map((e,t)=>t);t||i.reverse();for(let e of i){let i=t?n:r,a=e=>{let t=i[e];return t.length===0?l.get(e):t.reduce((e,t)=>e+l.get(t),0)/t.length},o=new Map(c[e].map(e=>[e,a(e)]));c[e].sort((e,t)=>o.get(e)-o.get(t)||l.get(e)-l.get(t)),c[e].forEach((e,t)=>l.set(e,t))}let a=d();a<p&&(p=a,f=c.map(e=>[...e]))}f.forEach((e,t)=>c[t]=e);let m=new Map,h=(e,n)=>(t[e].cross+t[n].cross)/2+t[e].after+(t[e].real&&t[n].real?i.nodeSep:Math.min(i.nodeSep,br)),g=(e,t)=>{let n=e.slice(1).map((t,n)=>h(e[n],t)),r=[0];n.forEach((e,t)=>r.push(r[t]+e)),Tr(e.map((e,n)=>{let i=(t[e]??[]).filter(e=>m.has(e));return(i.length===0?m.get(e)??0:i.reduce((e,t)=>e+m.get(t),0)/i.length)-r[n]})).forEach((t,n)=>m.set(e[n],t+r[n]))};for(let e of c)g(e,[]);for(let e=0;e<Sr;e++){for(let e=1;e<c.length;e++)g(c[e],n);for(let e=c.length-2;e>=0;e--)g(c[e],r)}return m}function Tr(e){let t=[];for(let n of e)for(t.push({sum:n,count:1});t.length>1;){let e=t[t.length-1],n=t[t.length-2];if(n.sum/n.count<=e.sum/e.count)break;t.splice(-2,2,{sum:n.sum+e.sum,count:n.count+e.count})}return t.flatMap(e=>Array(e.count).fill(e.sum/e.count))}var Er=28,Dr=18,Or=10,kr=32;function Ar(e,t={}){let n={...B,...t,fontSizes:Ye(t.fontSizes)},r=e.direction===`TB`||e.direction===`TD`||e.direction===`BT`,i=e.direction===`BT`||e.direction===`RL`,a=new Map,o=new Map,s=(e,t)=>{a.set(e.id,e),t!==void 0&&o.set(e.id,t);for(let t of e.nodeIds)o.has(t)||o.set(t,e.id);for(let t of e.children)s(t,e.id)};e.subgraphs.forEach(e=>s(e));let c=[...e.nodes.keys()].filter(e=>!a.has(e)),l=new Map(c.map((e,t)=>[e,t])),u=e=>Math.min(...e.nodeIds.map(e=>l.get(e)??1/0),...e.children.map(u)),d=e=>{let t=a.get(e);return t?u(t):l.get(e)??1/0},f=t=>[...c.filter(e=>o.get(e)===t),...(t===void 0?e.subgraphs:a.get(t).children).map(e=>e.id)].map((e,t)=>({id:e,i:t})).sort((e,t)=>d(e.id)-d(t.id)||e.i-t.i).map(e=>e.id),p=e=>{let t=[e];for(let n=o.get(e);n!==void 0;n=o.get(n))t.unshift(n);return t},m=t=>{let i=e.edges[t].label;if(!i)return;let a=y(i,n.fontSizes.edgeLabel,L.edgeLabel),o=a.width+8,s=a.height+6;return r?{axis:s,cross:o}:{axis:o,cross:s}},h=new Map,g=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target){g.set(e.source,[...g.get(e.source)??[],t]);return}let n=p(e.source),r=p(e.target),i=0;for(;n[i]!==void 0&&n[i]===r[i];)i++;if(i>=n.length||i>=r.length)return;let a=i===0?``:n[i-1];h.set(a,[...h.get(a)??[],{index:t,from:n[i],to:r[i]}])});let v=r?i?{axisStart:V.bottom,axisEnd:V.top,crossStart:V.left,crossEnd:V.right}:{axisStart:V.top,axisEnd:V.bottom,crossStart:V.left,crossEnd:V.right}:{axisStart:i?V.right:V.left,axisEnd:i?V.left:V.right,crossStart:V.top,crossEnd:V.bottom},b=(e,t)=>r?{aSize:t,cSize:e}:{aSize:e,cSize:t},x=new Map;for(let t of c){let r=e.nodes.get(t),i=Ct(t,r.label,r.shape,n.fontSizes.nodeLabel,r.icon,e.direction);x.set(t,b(i.width,i.height))}let S=e=>{let t=g.get(e);if(!r||!t)return 0;let n=Math.max(0,...t.map(e=>(m(e)?.cross??-10)+Or));return Er+(t.length-1)*Dr+n},C=e=>{let t=f(e),i=new Map,o=new Map,s=new Map;for(let e of t){let t=a.get(e);if(!t){o.set(e,x.get(e));continue}let c=C(e);i.set(e,c);let l=y(t.label,n.fontSizes.groupHeader,L.groupHeader).width,u=c.axisSize+v.axisStart+v.axisEnd,d=c.crossSize+v.crossStart+v.crossEnd,f=r?0:l+kr,p=r?l+kr:0,m=Math.max(0,f-u),h=Math.max(0,p-d);u+=m,d+=h,o.set(e,{aSize:u,cSize:d}),s.set(e,{axis:v.axisStart+m/2,cross:v.crossStart+h/2})}let c=new Map(t.map((e,t)=>[e,t])),l=h.get(e??``)??[],u=Cr(t.map(e=>({axis:o.get(e).aSize,cross:o.get(e).cSize,after:S(e)})),l.map(e=>({from:c.get(e.from),to:c.get(e.to),label:m(e.index)})),{nodeSep:n.nodeSpacing,rankSep:n.layerSpacing}),d=new Map;return l.forEach((e,t)=>d.set(e.index,{mids:u.paths[t],label:u.labels[t]})),{members:t,at:new Map(t.map((e,t)=>[e,u.nodes[t]])),sizes:o,inset:{axis:0,cross:0},axisSize:u.axisSize,crossSize:u.crossSize,routes:d,inner:new Map([...i].map(([e,t])=>[e,{...t,inset:s.get(e)}]))}},w=C(void 0),T=new Map,E=new Map,O=(t,n,r)=>{for(let[e,i]of t.routes)E.set(e,{mids:i.mids.map(e=>({axis:e.axis+n,cross:e.cross+r})),label:i.label&&{axis:i.label.axis+n,cross:i.label.cross+r}});let i=[];for(let o of t.members){let s=t.at.get(o),c=t.sizes.get(o),l={axis:n+s.axis,cross:r+s.cross,...c};T.set(o,l);let u=t.inner.get(o);if(u){let t=a.get(o),n=O(u,l.axis+u.inset.axis,l.cross+u.inset.cross);i.push({id:o,label:t.label,x:0,y:0,width:0,height:0,children:n,..._(o,e),...t.region?{region:!0}:{},...t.icon?{icon:t.icon}:{}})}}return i},k=O(w,0,0),A=n.padding,j=w.axisSize,ee=e=>{let t=i?j-e.axis:e.axis;return r?{x:e.cross+A,y:t+A}:{x:t+A,y:e.cross+A}},te=e=>{let t=i?j-e.axis-e.aSize:e.axis;return r?{x:e.cross+A,y:t+A,width:e.cSize,height:e.aSize}:{x:t+A,y:e.cross+A,width:e.aSize,height:e.cSize}},ne=e=>{for(let t of e)Object.assign(t,te(T.get(t.id))),ne(t.children)};ne(k);let re=c.map(t=>{let n=e.nodes.get(t);return{id:t,label:n.label,shape:n.icon===void 0?n.shape:`rectangle`,icon:n.icon,...te(T.get(t)),inlineStyle:D(t,e),className:e.classAssignments.get(t),interaction:e.interactions.get(t)}}),M=new Map(re.map(e=>[e.id,e])),N=[];e.edges.forEach((t,n)=>{let r=E.get(n);if(!r)return;let i=T.get(t.source),a=T.get(t.target),o=i.axis>a.axis,[s,c]=o?[a,i]:[i,a],l=[{axis:s.axis+s.aSize,cross:s.cross+s.cSize/2},...o?[...r.mids].reverse():r.mids,{axis:c.axis,cross:c.cross+c.cSize/2}],u=[l[0]];for(let e of l.slice(1)){let t=u[u.length-1];if(t.cross!==e.cross){let n=(t.axis+e.axis)/2;u.push({axis:n,cross:t.cross},{axis:n,cross:e.cross})}u.push(e)}let d=on(jr(u.map(ee)));o&&d.reverse();let f=M.get(t.source),p=M.get(t.target);f&&(d=It(d,f,!0)),p&&(d=It(d,p,!1)),N.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:r.label&&ee(r.label),inlineStyle:kn(n,e),headColor:On(e),id:t.id,animate:t.animate,startMarker:t.startMarker,endMarker:t.endMarker})}),hn(e,M,N);let P=(r?w.crossSize:w.axisSize)+A*2,ie=(r?w.axisSize:w.crossSize)+A*2;for(let e of N){for(let t of e.points)P=Math.max(P,t.x+$e.width+A),ie=Math.max(ie,t.y+$e.width+A);e.labelPosition&&(P=Math.max(P,e.labelPosition.x+60+A),ie=Math.max(ie,e.labelPosition.y+20+A))}return{width:P,height:ie,nodes:re,edges:N,groups:k}}function jr(e){return e.filter((t,n)=>{let r=e[n-1],i=e[n+1];return!r||!i||!(r.x===t.x&&t.x===i.x||r.y===t.y&&t.y===i.y)})}function Mr(e,t={}){return Nr(e,t)}function Nr(e,t,n){let r={...B,...t,fontSizes:Ye(t.fontSizes)};return vn(He(kt(e,r,n),t.layoutCache),e,r.mergeEdges)}function Pr(e,t={}){let n=ie(e);if(t.layout===`simple`&&!pt(n))return Ar(n,t);if(t.layout!==void 0&&t.layout!==`elk`&&t.layout!==`simple`)throw Error(`zombie-mermaid: unknown layout ${JSON.stringify(t.layout)}; use 'elk' or 'simple'.`);if(ir(n)){let e=pr(n,(e,n)=>Nr(e,t,n),Ye(t.fontSizes));if(e)return e}return Mr(n,t)}function Fr(e,t={}){return kt(e,{...B,...t,fontSizes:Ye(t.fontSizes)})}var Ir=12,Lr=2;function Rr(e){return e.flatMap(e=>[e,...Rr(e.children)])}function zr(e,t){let n=t.groupHeader+16;return Rr(e).filter(e=>e.label!==``).map(e=>{let r=y(e.label,t.groupHeader,L.groupHeader);return{x:e.x+Ir-Lr,y:e.y+n/2-r.height/2-Lr,width:r.width+4,height:r.height+4}})}function Br(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=[-r,r,-i,i],o=[e.x-n.x,n.x+n.width-e.x,e.y-n.y,n.y+n.height-e.y],s=0,c=1;for(let e=0;e<4;e++){let t=a[e],n=o[e];if(t===0){if(n<0)return!1}else{let e=n/t;if(t<0?s=Math.max(s,e):c=Math.min(c,e),s>c)return!1}}return!0}function Vr(e){return{x:e.x+Lr,y:e.y+Lr,width:e.width-4,height:e.height-4}}function Hr(e,t){let n=e.points,r=t.map(Vr);for(let e=0;e+1<n.length;e++)if(r.some(t=>Br(n[e],n[e+1],t)))return!0;return!1}function Ur(e){let t=2166136261;for(let n of e.map(e=>`${e.x},${e.y},${e.width},${e.height}`).join(`;`))t=Math.imul(t^n.charCodeAt(0),16777619);return(t>>>0).toString(36)}function Wr(e,t,n){let r=`zm-title-gap-${Ur(e)}`;return{id:r,markup:` <mask id="${r}" maskUnits="userSpaceOnUse" x="0" y="0" width="${t}" height="${n}">\n <rect x="0" y="0" width="${t}" height="${n}" fill="#fff" />\n${e.map(e=>` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" fill="#000" />`).join(`
9
+ `)}\n </mask>`}}function Gr(e,t,n=`Inter`,i=!1,a=Je,o=`linear`,s,c=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!O(e.interaction?.href));p.push($i(M(e.width,e.height,t,i,u,d,m,f.styleAttribute,f.description),s)),p.push(r(n,!1,f.nonce,f.bodyFont)),c&&e.edges.some(e=>e.animate)&&p.push(Kr(f.nonce)),p.push(`<defs>`),p.push(qr());let h=new Set;for(let t of e.edges){let e=Qr(t);e&&h.add(e)}for(let e of h)p.push(Jr(e));let g=new Set;for(let t of e.edges)t.startMarker&&g.add(t.startMarker),t.endMarker&&g.add(t.endMarker);for(let e of g)p.push(Zr(e));let _=zr(e.groups,a),v=new Set(e.edges.filter(e=>Hr(e,_))),y;if(v.size>0){let t=Wr(_,e.width,e.height);y=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(ti(t,n,a));for(let t of e.edges)p.push(ni(t,o,c,v.has(t)?y:void 0));for(let t of e.edges)t.label&&p.push(ii(t,n,a));for(let t of e.nodes)p.push(ci(t,n,a,l));return p.push(`</svg>`),p.join(`
10
+ `)}function Kr(e){return[ee(e),` @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }`,` .edge-animated { animation: zm-edge-dash 1s linear infinite; }`,` @media (prefers-reduced-motion: reduce) {`,` .edge-animated { animation: none; }`,` }`,`</style>`].join(`
11
+ `)}function qr(){return Xr(`var(--_arrow)`,``)}function Jr(e){return Xr(l(e),f`-${$r(e)}`)}var Yr=3.5;function Xr(e,t){let n=10.5,r=12.8,i=f`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,a=f`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${i} />`,o=(e,t)=>f` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${9.5}" refY="${r/2}" markerUnits="userSpaceOnUse" orient="${t}">`+f`\n ${a}`+`
12
12
  </marker>`;return o(f`arrowhead${t}`,`auto`)+`
13
- `+o(f`arrowhead-start${t}`,`auto-start-reverse`)}function Fr(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function Ir(e,t,n){let r=n.groupHeader+16,i=[];if(e.region){i.push(f`<g class="subgraph subgraph-region" data-id="${l(e.id)}">`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" stroke-dasharray="6 4" />`);for(let r of e.children)i.push(Ir(r,t,n));return i.push(`</g>`),i.join(`
14
- `)}i.push(f`<g class="subgraph" data-id="${l(e.id)}" data-label="${l(e.label)}">`),i.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),i.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),i.push(` `+w(e.label,e.x+12,e.y+r/2,n.groupHeader,f`font-size="${n.groupHeader}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.children)i.push(Ir(r,t,n));return i.push(`</g>`),i.join(`
15
- `)}function Lr(e,t,n=!0,r){if(e.points.length<2)return``;let i=n&&(e.animate??!1),a=t!==`linear`,o=e.style===`invisible`,s=e.style===`dotted`?` stroke-dasharray="2 2"`:``,c=e.style===`thick`?Nr:R.connector,u=o?`none`:l(e.inlineStyle?.stroke??`var(--_line)`),d=l(e.inlineStyle?.[`stroke-width`]??String(c)),p=e.headColor?f`-${Fr(e.headColor)}`:``,m=``;o||(e.hasArrowEnd&&(m+=f` marker-end="url(#arrowhead${p})"`),e.hasArrowStart&&(m+=f` marker-start="url(#arrowhead-start${p})"`));let h=[f`class="edge${i?` edge-animated`:``}"`,f`data-from="${l(e.source)}"`,f`data-to="${l(e.target)}"`,f`data-style="${e.style}"`,f`data-arrow-start="${e.hasArrowStart}"`,f`data-arrow-end="${e.hasArrowEnd}"`];e.label&&h.push(f`data-label="${l(e.label)}"`),e.id&&h.push(f`data-id="${l(e.id)}"`);let g=i&&!s?` stroke-dasharray="8 6"`:``,_=a?f`d="${Oe(e.points,t)}"`:f`points="${Rr(e.points)}"`;return f`<${a?`path`:`polyline`} ${h.join(` `)} ${_} `+f`fill="none" stroke="${u}" `+f`stroke-width="${d}"${s}${g}${m}`+(r?f` mask="url(#${r})"`:``)+` />`}function Rr(e){return e.map(e=>f`${e.x},${e.y}`).join(` `)}function zr(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??Vr(e.points),a=v(r,n.edgeLabel,L.edgeLabel),o=T(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return f`<g class="edge-label" data-from="${l(e.source)}" data-to="${l(e.target)}" data-label="${l(r)}">\n`+f` ${o.replace(/\n/g,`
16
- `)}\n`+`</g>`}function Br(e,t){let n=e[t];if(!n)throw Error(f`edgeMidpoint: missing point at index ${t}`);return n}function Vr(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++)t+=Hr(Br(e,n-1),Br(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=Br(e,t-1),i=Br(e,t),a=Hr(r,i);if(n<=a){let e=n/a;return{x:r.x+e*(i.x-r.x),y:r.y+e*(i.y-r.y)}}n-=a}return e[e.length-1]}function Hr(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Ur(e,t,n,r=!0){let i=Wr(e),a=Ti(e,t,n),o=[],s=O(e.className),c=s?f`node ${s}`:`node`,d=e.interaction,p=[f`class="${c}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`,f`data-shape="${e.shape}"`];o.push(f`<g ${p.join(` `)}>`);let m=r?D(d?.href):void 0,h=m?` `:` `;if(m){let e=d?.target?f` target="${l(d.target)}"`:``;o.push(f` <a href="${l(m)}"${e}>`)}return r&&d?.tooltip&&o.push(f`${h}<title>${u(d.tooltip)}</title>`),o.push(f`${h}${i.replace(/\n/g,f`\n${h}`)}`),a&&o.push(f`${h}${a.replace(/\n/g,f`\n${h}`)}`),m&&o.push(` </a>`),o.push(`</g>`),o.join(`
17
- `)}function Wr(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e,s=l(o?.fill??`var(--_node-fill)`),c=l(o?.stroke??`var(--_node-stroke)`),u=l(o?.[`stroke-width`]??String(R.innerBox));switch(a){case`diamond`:return Yr(t,n,r,i,s,c,u);case`rounded`:return Kr(t,n,r,i,s,c,u);case`stadium`:return qr(t,n,r,i,s,c,u);case`circle`:return Jr(t,n,r,i,s,c,u);case`subroutine`:return Xr(t,n,r,i,s,c,u);case`doublecircle`:return Zr(t,n,r,i,s,c,u);case`hexagon`:return Qr(t,n,r,i,s,c,u);case`cylinder`:return $r(t,n,r,i,s,c,u);case`asymmetric`:return ei(t,n,r,i,s,c,u);case`trapezoid`:return ti(t,n,r,i,s,c,u);case`trapezoid-alt`:return ni(t,n,r,i,s,c,u);case`parallelogram`:return ri(t,n,r,i,s,c,u);case`parallelogram-alt`:return ii(t,n,r,i,s,c,u);case`state-start`:return Ci(t,n,r,i);case`state-end`:return wi(t,n,r,i);case`document`:return ai(t,n,r,i,s,c,u);case`stacked-document`:return oi(t,n,r,i,s,c,u,!0);case`stacked-process`:return oi(t,n,r,i,s,c,u,!1);case`card`:return si(t,n,r,i,s,c,u);case`lined-process`:return ci(t,n,r,i,s,c,u);case`divided-process`:return li(t,n,r,i,s,c,u);case`window-pane`:return ui(t,n,r,i,s,c,u);case`triangle`:return di(t,n,r,i,s,c,u,!1);case`flipped-triangle`:return di(t,n,r,i,s,c,u,!0);case`filled-circle`:return fi(t,n,r,i,c);case`crossed-circle`:return pi(t,n,r,i,s,c,u);case`fork-join`:return mi(t,n,r,i,c);case`note`:return hi(t,n,r,i,l(o?.fill??`var(--bg)`),c,u);case`notched-pentagon`:return gi(t,n,r,i,s,c,u);case`sloped-rectangle`:return _i(t,n,r,i,s,c,u);case`flag`:return vi(t,n,r,i,s,c,u);case`bow-tie-rectangle`:return yi(t,n,r,i,s,c,u);case`half-rounded-rectangle`:return bi(t,n,r,i,s,c,u);case`brace`:return xi(t,n,r,i,s,c,u,`left`);case`brace-right`:return xi(t,n,r,i,s,c,u,`right`);case`braces`:return xi(t,n,r,i,s,c,u,`both`);case`bolt`:return Si(t,n,r,i,s,c,u);case`text`:case`anchor`:return``;default:return Gr(t,n,r,i,s,c,u)}}function Gr(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Kr(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function qr(e,t,n,r,i,a,o){let s=r/2;return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Jr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2;return f`<circle cx="${s}" cy="${c}" r="${l}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Yr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=n/2,u=r/2,d=[f`${s},${c-u}`,f`${s+l},${c}`,f`${s},${c+u}`,f`${s-l},${c}`].join(` `);return f`<polygon points="${d}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Xr(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+f`stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+f`stroke="${a}" stroke-width="${o}" />`}function Zr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2,u=l-5;return f`<circle cx="${s}" cy="${c}" r="${l}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<circle cx="${s}" cy="${c}" r="${u}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Qr(e,t,n,r,i,a,o){let s=r/4,c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r/2}`,f`${e+n-s},${t+r}`,f`${e+s},${t+r}`,f`${e},${t+r/2}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function $r(e,t,n,r,i,a,o){let s=e+n/2,c=t+7,l=r-14;return f`<rect x="${e}" y="${c}" width="${n}" height="${l}" `+f`fill="${i}" stroke="none" />`+f`\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+n}" y1="${c}" x2="${e+n}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+f`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<ellipse cx="${s}" cy="${c}" rx="${n/2}" ry="${7}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ei(e,t,n,r,i,a,o){let s=[f`${e},${t}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e+12},${t+r/2}`].join(` `);return f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ti(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ni(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e},${t}`,f`${e+n},${t}`,f`${e+n-s},${t+r}`,f`${e+s},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ri(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e+s},${t}`,f`${e+n},${t}`,f`${e+n-s},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ii(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r}`,f`${e+s},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function U(e,t,n){return f`fill="${e}" stroke="${t}" stroke-width="${n}"`}function ai(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),c=t+r-s,l=f`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${c} `+f`C ${e+n*.75} ${c+s*1.8} ${e+n*.25} ${c-s*.8} ${e} ${c} Z`;return f`<path d="${l}" ${U(i,a,o)} />`}function oi(e,t,n,r,i,a,o,s){let c=n-10,l=r-10,u=[];for(let n=2;n>=1;n--)u.push(f`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${c}" height="${l}" `+f`${U(i,a,o)} />`);return u.push(s?ai(e,t+10,c,l,i,a,o):f`<rect x="${e}" y="${t+10}" width="${c}" height="${l}" ${U(i,a,o)} />`),u.join(`
18
- `)}function si(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[f`${e+s},${t}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e},${t+s}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function ci(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function li(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function ui(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),c=t+Math.min(14,r*.28);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+f`<line x1="${e}" y1="${c}" x2="${e+n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`}function di(e,t,n,r,i,a,o,s){let c=s?[f`${e},${t}`,f`${e+n},${t}`,f`${e+n/2},${t+r}`]:[f`${e+n/2},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`];return f`<polygon points="${c.join(` `)}" ${U(i,a,o)} />`}function fi(e,t,n,r,i){let a=Math.min(n,r)/2-2;return f`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function pi(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2-2,u=l/Math.SQRT2;return f`<circle cx="${s}" cy="${c}" r="${l}" ${U(i,a,o)} />\n`+f`<line x1="${s-u}" y1="${c-u}" x2="${s+u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />\n`+f`<line x1="${s+u}" y1="${c-u}" x2="${s-u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />`}function mi(e,t,n,r,i){let a=Math.min(8,r);return f`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function hi(e,t,n,r,i,a,o){let s=[f`${e},${t}`,f`${e+n-6},${t}`,f`${e+n},${t+6}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n`+f`<polygon points="${e+n-6},${t} ${e+n},${t+6} ${e+n-6},${t+6}" fill="var(--_inner-stroke)" stroke="${a}" stroke-width="${o}" />`}function gi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+s}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e},${t+s}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function _i(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),c=[f`${e},${t+s}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function vi(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),c=f`M ${e} ${t+s} `+f`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+f`L ${e+n} ${t+r-s} `+f`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return f`<path d="${c}" ${U(i,a,o)} />`}function yi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),c=f`M ${e+s} ${t} L ${e+n} ${t} `+f`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+f`L ${e+s} ${t+r} `+f`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return f`<path d="${c}" ${U(i,a,o)} />`}function bi(e,t,n,r,i,a,o){let s=r/2,c=Math.max(0,n-s),l=f`M ${e} ${t} L ${e+c} ${t} `+f`A ${s} ${s} 0 0 1 ${e+c} ${t+r} `+f`L ${e} ${t+r} Z`;return f`<path d="${l}" ${U(i,a,o)} />`}function xi(e,t,n,r,i,a,o,s){let c=Math.min(10,n*.12),l=[f`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],u=f`M ${e+c} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+f`Q ${e} ${t+r/2} ${e-c*.4} ${t+r/2} `+f`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+f`Q ${e} ${t+r} ${e+c} ${t+r}`,d=f`M ${e+n-c} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+f`Q ${e+n} ${t+r/2} ${e+n+c*.4} ${t+r/2} `+f`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+f`Q ${e+n} ${t+r} ${e+n-c} ${t+r}`;return(s===`left`||s===`both`)&&l.push(f`<path d="${u}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&l.push(f`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`),l.join(`
19
- `)}function Si(e,t,n,r,i,a,o){let s=[f`${e+n*.42},${t}`,f`${e+n},${t}`,f`${e+n*.62},${t+r*.42}`,f`${e+n},${t+r*.42}`,f`${e+n*.3},${t+r}`,f`${e+n*.5},${t+r*.55}`,f`${e},${t+r*.55}`].join(` `);return f`<polygon points="${s}" ${U(i,a,o)} />`}function Ci(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function wi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return f`<circle cx="${i}" cy="${a}" r="${o}" `+f`fill="none" stroke="var(--_text)" stroke-width="${R.innerBox*2}" />`+f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function Ti(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2+(e.shape===`asymmetric`?6:0),i=e.y+e.height/2,a=l(e.inlineStyle?.color??g(e.inlineStyle?.fill,`var(--_text)`)),o=f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${L.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=f` style="font-family: ${l(s)};"`),w(e.label,r,i,n.nodeLabel,o)}function Ei(e){return l(e).replace(/\r/g,`&#13;`).replace(/\n/g,`&#10;`).replace(/\t/g,`&#9;`)}function Di(e,t){return t===void 0?e:e.replace(`<svg `,f`<svg data-src="${Ei(t)}" `)}var Oi=class{raw=new Map;resolved=new Map;inProgress=new Set;declare(e,t){this.raw.set(e,t),this.resolved.delete(e)}lookup(e){if(this.resolved.has(e))return this.resolved.get(e);let t=this.raw.get(e);if(t===void 0||this.inProgress.has(e))return;this.inProgress.add(e);let n=Fi(t,this).trim();this.inProgress.delete(e);let r=!/\bvar\(|\bcolor-mix\(/.test(n);return this.resolved.set(e,r?n:void 0),r?n:void 0}};function ki(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function Ai(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}var ji=`(?<![\\w-])(var|color-mix)\\(`;function Mi(e,t){let[n,...r]=Ai(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function Ni(e){let t=e.trim().split(/\s+/),n,r;for(let e of t)if(/^[\d.]+%$/.test(e)){if(r!==void 0)return null;r=Number(e.slice(0,-1))}else{if(n!==void 0)return null;n=e}return n===void 0?null:{color:n,pct:r}}function Pi(e){let t=Ai(e);if(t.length!==3)return null;let[n,r,i]=t;if(n===void 0||r===void 0||i===void 0||!/^\s*in\s+srgb\s*$/i.test(n))return null;let a=Ni(r),o=Ni(i);if(!a||!o)return null;let s=C(a.color),c=C(o.color);if(!s||!c)return null;let l=b(s,c,a.pct,o.pct);return l?h(l):null}function Fi(e,t){let n=``,r=0,i=new RegExp(ji,`g`),a;for(;(a=i.exec(e))!==null;){let o=a[1];if(o===void 0)continue;let s=a.index,c=s+o.length,l=ki(e,c);if(l===-1)break;let u=Fi(e.slice(c+1,l),t),d=o===`var`?Mi(u,t):Pi(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function Ii(e,t){let n=new Oi;for(let[e,r]of Object.entries(t))n.declare(e,r);return Fi(e,n)}var Li=/(--[\w-]+)\s*:\s*([^;{}]+)/g,Ri=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,zi=new Set([`data-src`]);function Bi(e,t){Li.lastIndex=0;let n;for(;(n=Li.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Vi(e,t){return e.replace(Ri,(e,n,r,i,a)=>{if(zi.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${Fi(a.slice(1,-1),t)}${o}`})}function Hi(e,t){let n=new Oi;n.declare(`--bg`,t.bg),n.declare(`--fg`,t.fg),t.line&&n.declare(`--line`,t.line),t.accent&&n.declare(`--accent`,t.accent),t.muted&&n.declare(`--muted`,t.muted),t.surface&&n.declare(`--surface`,t.surface),t.border&&n.declare(`--border`,t.border);for(let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)){let e=t[1];e!==void 0&&Bi(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&Bi(e.slice(1,-1),n)}let r=``,i=0;for(;i<e.length;){let t=e.indexOf(`<`,i);if(t===-1)break;if(r+=e.slice(i,t),e.startsWith(`<style`,t)){let a=e.indexOf(`>`,t),o=e.indexOf(`</style>`,t);if(a===-1||o===-1)break;r+=e.slice(t,a+1),r+=Fi(e.slice(a+1,o),n),r+=`</style>`,i=o+8;continue}let a=-1,o=null;for(let n=t+1;n<e.length;n++){let t=e[n];if(o!==null)t===o&&(o=null);else if(t===`"`||t===`'`)o=t;else if(t===`>`){a=n;break}}if(a===-1)break;let s=e.slice(t,a+1);r+=s.startsWith(`<!`)||s.startsWith(`<?`)||s.startsWith(`</`)?s:Vi(s,n),i=a+1}return r+e.slice(i)}var Ui=[.3013,.3672,.3247,.5244,.5244,.6001,.7061,.1597,.3672,.3672,.3672,.5244,.3672,.3672,.3672,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.3672,.3672,.5244,.5244,.5244,.3672,.7705,.5898,.5659,.5981,.6133,.5356,.5249,.6763,.6543,.2783,.4766,.5757,.5063,.7095,.6382,.6738,.5576,.6758,.582,.481,.5806,.6484,.5874,.8521,.5566,.5703,.5503,.3672,.3555,.3672,.5244,.5244,.5244,.5254,.5571,.4951,.5571,.5454,.3696,.502,.5464,.2852,.3667,.5044,.2949,.8301,.5464,.5366,.5571,.5571,.3887,.4048,.3965,.5464,.4897,.7441,.501,.4932,.4746,.3672,.5244,.3672,.5244],Wi=[.3013,.3672,.3667,.5859,.5859,.6841,.7061,.2295,.3672,.3672,.4321,.5859,.3672,.3672,.3672,.3901,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.3672,.3672,.5859,.5859,.5859,.438,.7705,.6333,.5952,.6118,.6426,.5688,.5835,.6714,.6836,.2783,.5327,.6172,.5527,.7451,.6675,.7031,.5869,.709,.6108,.5112,.6118,.6777,.6216,.8838,.6006,.6133,.5601,.4019,.3555,.4019,.5859,.5859,.5859,.5327,.5815,.5117,.5806,.5747,.3696,.502,.5928,.2983,.3667,.5479,.2949,.8594,.5903,.5659,.5825,.584,.4272,.4307,.3965,.5908,.5273,.7837,.5522,.5337,.5283,.4336,.5859,.4336,.5859];function Gi(e){return e>=4352?1:.6}function Ki(e,t){let n=t?Wi:Ui,r=t?.5859:.5244,i=0;for(let t of e){let e=t.codePointAt(0);i+=e>=32&&e<=126?n[e-32]:e===171||e===187?r:Gi(e)}return i*16}var W={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,mermaidPad:12,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6,namespaceTitleHeight:28,namespacePad:16,namespaceTitleFontSize:12,lollipopLabelHeight:32,lollipopLabelPadX:8};function qi(e){return`note ${e}`}function Ji(e){return`${e} link`}function Yi(e){return`namespace ${e}`}function Xi(e){let t=new Set(e.classes.map(e=>e.id)),n=new Set,r=[];for(let[i,a]of e.namespaces.entries()){let e=[];for(let r of a.classIds)!t.has(r)||n.has(r)||(n.add(r),e.push(r));e.length>0&&r.push({id:Yi(i),name:a.name,classIds:e})}return r}function Zi(e){let t=new Map,n=new Set,r=[],i=new Map,a=e.relationships.map((a,o)=>{if(a.type!==`lollipop`||a.markerAt===`both`)return a;let s=a.markerAt===`from`,c=s?a.from:a.to,l=`lollipop ${r.length}`;return t.set(o,l),i.set(l,s?a.to:a.from),n.add(c),r.push({id:l,label:e.classes.find(e=>e.id===c)?.label??c,attributes:[],methods:[]}),s?{...a,from:l}:{...a,to:l}}),o=new Map(r.map(e=>[e.id,e.label]));if(r.length===0)return{diagram:e,labels:o,byRelationship:t};let s=new Set(a.flatMap(e=>[e.from,e.to]));for(let t of e.notes)t.forClass&&s.add(t.forClass);for(let t of e.namespaces)for(let e of t.classIds)s.add(e);let c=e=>n.has(e.id)&&!s.has(e.id)&&!e.annotation&&e.attributes.length===0&&e.methods.length===0,l=[...e.classes.filter(e=>!c(e)),...r],u=e.namespaces.map(e=>({...e,classIds:[...e.classIds,...r.filter(t=>e.classIds.includes(i.get(t.id)??``)).map(e=>e.id)]}));return{diagram:{...e,classes:l,relationships:a,namespaces:u},labels:o,byRelationship:t}}function Qi(e){return m(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function $i(e,t,n){let r=new Map,i=new Map,a=Je(t.fontSizes);for(let t of e.classes){if(n.has(t.id)){r.set(t.id,{width:I(t.label,a.nodeLabel,L.edgeLabel)+W.lollipopLabelPadX*2,height:W.lollipopLabelHeight,headerHeight:W.lollipopLabelHeight,attrHeight:0,methodHeight:0});continue}let e=t.annotation?W.headerBaseHeight+W.annotationHeight:W.headerBaseHeight,i=t.attributes.length>0?t.attributes.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,o=t.methods.length>0?t.methods.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,s=I(t.label,a.nodeLabel,L.nodeLabel),c=aa(t.attributes),l=aa(t.methods),u=Math.max(ia(t),s+W.boxPadX*2,c+W.boxPadX*2,l+W.boxPadX*2),d=e+i+o;r.set(t.id,{width:u,height:d,headerHeight:e,attrHeight:i,methodHeight:o})}let o=Xi(e),s=new Map;for(let e of o)for(let t of e.classIds)s.set(t,e.id);let c=new Map,l=[];for(let e of o){let t=I(e.name,W.namespaceTitleFontSize,L.groupHeader)+W.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":nt({top:W.namespaceTitleHeight+W.namespacePad/2,left:W.namespacePad,bottom:W.namespacePad,right:W.namespacePad}),"elk.nodeSize.constraints":`MINIMUM_SIZE`,"elk.nodeSize.minimum":`(${Math.ceil(t)}, 0)`}};c.set(e.id,n),l.push(n)}for(let[e,t]of r){let n=it(e,t),r=c.get(s.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:a.edgeLabel},d=Qi(e),f=[];for(let[t,n]of e.relationships.entries()){let e=d.has(t);f.push(st({id:`e${t}`,source:e?n.to:n.from,target:e?n.from:n.to,label:n.label,labelStyle:u}))}let p=new Set(r.keys());for(let[t,n]of e.notes.entries()){let e=qi(t),r=v(n.text,a.edgeLabel,L.edgeLabel),o={width:r.width+W.notePadX*2,height:r.height+W.notePadY*2};i.set(e,o),l.push(it(e,o)),n.forClass!==void 0&&p.has(n.forClass)&&f.push(st({id:Ji(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...rt({direction:tt(e.direction,et.class),nodeSpacing:W.nodeSpacing,layerSpacing:W.layerSpacing,padding:W.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.separateConnectedComponents":`false`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:l,edges:f},classSizes:r,noteSizes:i,namespaces:o}}function ea(e,t,n,r,i,a){let o=new Map;for(let e of t.classes)o.set(e.id,e);let s=new Set(i.map(e=>e.id)),c=new Map,l=[];for(let t of e.children??[])if(s.has(t.id)){let e=t.x??0,n=t.y??0;c.set(t.id,{x:e,y:n});for(let r of t.children??[])l.push({...r,x:(r.x??0)+e,y:(r.y??0)+n})}else l.push(t);let u=e=>{let t=e.container;return t&&c.get(t)||{x:0,y:0}},d=[];for(let t of i){let n=(e.children??[]).find(e=>e.id===t.id);n&&d.push({name:t.name,classIds:t.classIds.filter(e=>!a.labels.has(e)),x:n.x??0,y:n.y??0,width:n.width??0,height:n.height??0})}let f=[];for(let e of l){let r=o.get(e.id);if(r){let i=n.get(r.id);if(!i)throw Error(`Missing computed size for class "${r.id}"`);f.push({id:r.id,label:r.label,annotation:r.annotation,attributes:r.attributes,methods:r.methods,x:e.x??0,y:e.y??0,width:e.width??i.width,height:e.height??i.height,headerHeight:i.headerHeight,attrHeight:i.attrHeight,methodHeight:i.methodHeight,interaction:t.interactions.get(r.id),inlineStyle:E(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=Qi(a.diagram),h=new Map;for(let e of l)h.set(e.id,e);let g=new Map;for(let[e,t]of a.labels){let n=h.get(e);g.set(e,{text:t,x:n?.x??0,y:n?.y??0,width:n?.width??0,height:n?.height??0})}let _=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=_[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=u(t),i=Gt(t,r.x,r.y),o=m.has(e)?i.reverse():i,s=Kt(t,r.x,r.y),c=g.get(a.byRelationship.get(e)??``);p.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:o,labelPosition:s,...c?{interfaceLabel:c}:{}})}let v=new Map;for(let e of _.slice(t.relationships.length))v.set(e.id,e);let y=[];for(let[e,n]of t.notes.entries()){let t=qi(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(Ji(t));y.push({id:t,text:n.text,...o&&n.forClass!==void 0?{forClass:n.forClass}:{},x:i.x??0,y:i.y??0,width:i.width??a.width,height:i.height??a.height,...o?{linkPoints:Gt(o,u(o).x,u(o).y)}:{}})}return{width:e.width??600,height:e.height??400,classes:f,relationships:p,notes:y,namespaces:d}}function ta(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let n=Zi(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=$i(n.diagram,t,n.labels);return ea(Ve(r,t.layoutCache),e,i,a,o,n)}function na(e){return e.length*Math.ceil(We(`M`,W.memberFontSize))}function ra(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function ia(e){let t=Ki(e.label,!0),n=e.annotation?Ki(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>Ki(ra(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+W.mermaidPad*2}function aa(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=na(ce(n));e>t&&(t=e)}return t}var oa={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function sa(e,t,n=`Inter`,r=!1,i=qe,a,o,s,c=!0,l={}){let u=[],d=c&&e.classes.some(e=>!!D(e.interaction?.href));u.push(Di(M(e.width,e.height,t,r,o,s,d,l.styleAttribute,l.description),a)),u.push($e(n,!0,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(la(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push(ca(t));for(let t of e.relationships)u.push(ga(t));for(let t of e.notes)u.push(ha(t));for(let t of e.classes)u.push(ua(t,i,c));for(let t of e.relationships){let e=_a(t,i);e&&u.push(e)}for(let t of e.notes)u.push(ma(t,i));for(let t of e.relationships)u.push(ba(t,i));return u.push(`</svg>`),u.join(`
20
- `)}function ca(e){let{x:t,y:n,width:r,height:i}=e,a=W.namespaceTitleHeight,o=R.outerBox;return[f`<g class="class-namespace" data-id="${l(e.name)}" data-label="${l(e.name)}">`,f` <rect x="${t}" y="${n}" width="${r}" height="${i}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,f` <rect x="${t}" y="${n}" width="${r}" height="${a}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,f` <text x="${t+W.namespacePad}" y="${n+a/2}" dy="${z}" font-size="${W.namespaceTitleFontSize}" font-weight="${L.groupHeader}" fill="var(--_text-sec)">${wa(e.name)}</text>`,`</g>`].join(`
21
- `)}function la(e){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
13
+ `+o(f`arrowhead-start${t}`,`auto-start-reverse`)}function Zr(e){let t=e===`circle`?`<circle cx="5" cy="5" r="5" fill="var(--_arrow)"/>`:`<path d="M1 1L9 9M1 9L9 1" stroke="var(--_arrow)" stroke-width="1.7"/>`,n=e===`circle`?14:12;return f`<marker id="${e}" viewBox="0 0 10 10" refX="12" refY="5" markerUnits="userSpaceOnUse" markerWidth="${n}" markerHeight="${n}" orient="auto-start-reverse">${t}</marker>`}function Qr(e){return e.headColor??e.inlineStyle?.stroke}function $r(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function ei(e){let t=e?.[`stroke-dasharray`];return t&&/^[\d.\s,]+$/.test(t)?f` stroke-dasharray="${t.trim()}"`:``}function ti(e,t,n){let r=n.groupHeader+16,i=[];if(e.region){i.push(f`<g class="subgraph subgraph-region" data-id="${l(e.id)}">`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" stroke-dasharray="6 4" />`);for(let r of e.children)i.push(ti(r,t,n));return i.push(`</g>`),i.join(`
14
+ `)}i.push(f`<g class="subgraph" data-id="${l(e.id)}" data-label="${l(e.label)}">`);let a=e.inlineStyle,o=l(a?.stroke??`var(--_node-stroke)`),s=l(a?.[`stroke-width`]??String(R.outerBox)),c=ei(a),u=l(a?.fill??`var(--_group-fill)`),d=l(a?.fill??`var(--_group-hdr)`);i.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="${u}" stroke="${o}" stroke-width="${s}"${c} />`),i.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+f`rx="0" ry="0" fill="${d}" stroke="${o}" stroke-width="${s}"${c} />`);let p=r-6;if(e.icon){let t=nt[e.icon]??`<text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;">?</text>`;i.push(f` <g transform="translate(${e.x+3} ${e.y+3}) scale(${p/80})"><rect width="${80}" height="${80}" fill="${tt}" />${t}</g>`)}let m=e.x+12+(e.icon?p+2:0);i.push(` `+T(e.label,m,e.y+r/2,n.groupHeader,f`font-size="${n.groupHeader}" font-weight="${L.groupHeader}" fill="${l(a?.color??`var(--_text-sec)`)}"`));for(let r of e.children)i.push(ti(r,t,n));return i.push(`</g>`),i.join(`
15
+ `)}function ni(e,t,n=!0,r){if(e.points.length<2)return``;let i=n&&(e.animate??!1),a=t!==`linear`,o=e.style===`invisible`,s=e.style===`dotted`?` stroke-dasharray="2 2"`:``,c=e.style===`thick`?Yr:R.connector,u=o?`none`:l(e.inlineStyle?.stroke??`var(--_line)`),d=l(e.inlineStyle?.[`stroke-width`]??String(c)),p=Qr(e),m=p?f`-${$r(p)}`:``,h=``;o||(e.hasArrowEnd&&(h+=f` marker-end="url(#${e.endMarker??f`arrowhead${m}`})"`),e.hasArrowStart&&(h+=f` marker-start="url(#${e.startMarker??f`arrowhead-start${m}`})"`));let g=[f`class="edge${i?` edge-animated`:``}"`,f`data-from="${l(e.source)}"`,f`data-to="${l(e.target)}"`,f`data-style="${e.style}"`,f`data-arrow-start="${e.hasArrowStart}"`,f`data-arrow-end="${e.hasArrowEnd}"`];e.label&&g.push(f`data-label="${l(e.label)}"`),e.id&&g.push(f`data-id="${l(e.id)}"`);let _=i&&!s?` stroke-dasharray="8 6"`:``,v=a?f`d="${ke(e.points,t)}"`:f`points="${ri(e.points)}"`;return f`<${a?`path`:`polyline`} ${g.join(` `)} ${v} `+f`fill="none" stroke="${u}" `+f`stroke-width="${d}"${s}${_}${h}`+(r?f` mask="url(#${r})"`:``)+` />`}function ri(e){return e.map(e=>f`${e.x},${e.y}`).join(` `)}function ii(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??oi(e.points),a=y(r,n.edgeLabel,L.edgeLabel),o=E(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return f`<g class="edge-label" data-from="${l(e.source)}" data-to="${l(e.target)}" data-label="${l(r)}">\n`+f` ${o.replace(/\n/g,`
16
+ `)}\n`+`</g>`}function ai(e,t){let n=e[t];if(!n)throw Error(f`edgeMidpoint: missing point at index ${t}`);return n}function oi(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++)t+=si(ai(e,n-1),ai(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=ai(e,t-1),i=ai(e,t),a=si(r,i);if(n<=a){let e=n/a;return{x:r.x+e*(i.x-r.x),y:r.y+e*(i.y-r.y)}}n-=a}return e[e.length-1]}function si(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function ci(e,t,n,r=!0){let i=di(e),a=Zi(e,t,n),o=[],s=k(e.className),c=s?f`node ${s}`:`node`,d=e.interaction,p=[f`class="${c}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`,f`data-shape="${e.shape}"`];o.push(f`<g ${p.join(` `)}>`);let m=r?O(d?.href):void 0,h=m?` `:` `;if(m){let e=d?.target?f` target="${l(d.target)}"`:``;o.push(f` <a href="${l(m)}"${e}>`)}return r&&d?.tooltip&&o.push(f`${h}<title>${u(d.tooltip)}</title>`),o.push(f`${h}${i.replace(/\n/g,f`\n${h}`)}`),a&&o.push(f`${h}${a.replace(/\n/g,f`\n${h}`)}`),m&&o.push(` </a>`),o.push(`</g>`),o.join(`
17
+ `)}var li=13;function ui(e,t,n){let r=f`transform="translate(${e} ${t})"`;if(n===``)return f`<path ${r} d="M0,80 V5 Q0,0 5,0 H75 Q80,0 80,5 V80 Z" fill="none" stroke="hsl(240, 60%, 86.3%)" stroke-width="2" stroke-dasharray="8" />`;let i=nt[n]??`<text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;">?</text>`;return f`<g ${r}><rect width="${80}" height="${80}" fill="${tt}" />${i}</g>`}function di(e){let t=fi(e),n=e.icon===void 0?ei(e.inlineStyle):``;return n&&t?f`<g${n}>${t}</g>`:t}function fi(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e;if(e.icon!==void 0)return ui(t,n,e.icon);let s=l(o?.fill??`var(--_node-fill)`),c=l(o?.stroke??`var(--_node-stroke)`),u=l(o?.[`stroke-width`]??String(R.innerBox)),d=e=>e&&/^\d+(\.\d+)?(px)?$/.test(e)?parseFloat(e):0,f=d(o?.rx),p={rx:f,ry:o?.ry===void 0?f:d(o.ry)};switch(a){case`diamond`:return _i(t,n,r,i,s,c,u);case`rounded`:return mi(t,n,r,i,s,c,u);case`stadium`:return hi(t,n,r,i,s,c,u);case`circle`:return gi(t,n,r,i,s,c,u);case`subroutine`:return vi(t,n,r,i,s,c,u);case`doublecircle`:return yi(t,n,r,i,s,c,u);case`hexagon`:return bi(t,n,r,i,s,c,u);case`cylinder`:return xi(t,n,r,i,s,c,u);case`asymmetric`:return Si(t,n,r,i,s,c,u);case`trapezoid`:return Ci(t,n,r,i,s,c,u);case`trapezoid-alt`:return wi(t,n,r,i,s,c,u);case`parallelogram`:return Ti(t,n,r,i,s,c,u);case`parallelogram-alt`:return Ei(t,n,r,i,s,c,u);case`state-start`:return Yi(t,n,r,i);case`state-end`:return Xi(t,n,r,i);case`document`:return Di(t,n,r,i,s,c,u);case`stacked-document`:return Oi(t,n,r,i,s,c,u,!0);case`stacked-process`:return Oi(t,n,r,i,s,c,u,!1);case`card`:return ki(t,n,r,i,s,c,u);case`lined-process`:return Ai(t,n,r,i,s,c,u);case`divided-process`:return ji(t,n,r,i,s,c,u);case`window-pane`:return Mi(t,n,r,i,s,c,u);case`triangle`:return Ni(t,n,r,i,s,c,u,!1);case`flipped-triangle`:return Ni(t,n,r,i,s,c,u,!0);case`junction`:return``;case`filled-circle`:return Pi(t,n,r,i,c);case`crossed-circle`:return Fi(t,n,r,i,s,c,u);case`fork-join`:return Ii(t,n,r,i,c);case`note`:return Vi(t,n,r,i,l(o?.fill??`var(--bg)`),c,u);case`notched-pentagon`:return Hi(t,n,r,i,s,c,u);case`sloped-rectangle`:return Ui(t,n,r,i,s,c,u);case`flag`:return Wi(t,n,r,i,s,c,u);case`bow-tie-rectangle`:return Gi(t,n,r,i,s,c,u);case`half-rounded-rectangle`:return Ki(t,n,r,i,s,c,u);case`brace`:return qi(t,n,r,i,s,c,u,`left`);case`brace-right`:return qi(t,n,r,i,s,c,u,`right`);case`braces`:return qi(t,n,r,i,s,c,u,`both`);case`bolt`:return Ji(t,n,r,i,s,c,u);case`cloud`:return Li(t,n,r,i,s,c,u);case`horizontal-cylinder`:return Ri(t,n,r,i,s,c,u);case`tagged-rectangle`:return zi(t,n,r,i,s,c,u);case`fork-bar`:return pi(t,n,r,i,s,c,u);case`small-circle`:return Bi(t,n,r,i,s,c,u);case`text`:case`anchor`:return``;default:return pi(t,n,r,i,s,c,u,p)}}function pi(e,t,n,r,i,a,o,s={rx:0,ry:0}){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="${s.rx}" ry="${s.ry}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function mi(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function hi(e,t,n,r,i,a,o){let s=r/2;return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function gi(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2;return f`<circle cx="${s}" cy="${c}" r="${l}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function _i(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=n/2,u=r/2,d=[f`${s},${c-u}`,f`${s+l},${c}`,f`${s},${c+u}`,f`${s-l},${c}`].join(` `);return f`<polygon points="${d}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function vi(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+f`stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+f`stroke="${a}" stroke-width="${o}" />`}function yi(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2,u=l-5;return f`<circle cx="${s}" cy="${c}" r="${l}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<circle cx="${s}" cy="${c}" r="${u}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function bi(e,t,n,r,i,a,o){let s=r/4,c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r/2}`,f`${e+n-s},${t+r}`,f`${e+s},${t+r}`,f`${e},${t+r/2}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function xi(e,t,n,r,i,a,o){let s=e+n/2,c=t+7,l=r-14;return f`<rect x="${e}" y="${c}" width="${n}" height="${l}" `+f`fill="${i}" stroke="none" />`+f`\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+n}" y1="${c}" x2="${e+n}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+f`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<ellipse cx="${s}" cy="${c}" rx="${n/2}" ry="${7}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Si(e,t,n,r,i,a,o){let s=[f`${e},${t}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e+12},${t+r/2}`].join(` `);return f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ci(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function wi(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e},${t}`,f`${e+n},${t}`,f`${e+n-s},${t+r}`,f`${e+s},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ti(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e+s},${t}`,f`${e+n},${t}`,f`${e+n-s},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ei(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r}`,f`${e+s},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function U(e,t,n){return f`fill="${e}" stroke="${t}" stroke-width="${n}"`}function Di(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),c=t+r-s,l=f`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${c} `+f`C ${e+n*.75} ${c+s*1.8} ${e+n*.25} ${c-s*.8} ${e} ${c} Z`;return f`<path d="${l}" ${U(i,a,o)} />`}function Oi(e,t,n,r,i,a,o,s){let c=n-10,l=r-10,u=[];for(let n=2;n>=1;n--)u.push(f`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${c}" height="${l}" `+f`${U(i,a,o)} />`);return u.push(s?Di(e,t+10,c,l,i,a,o):f`<rect x="${e}" y="${t+10}" width="${c}" height="${l}" ${U(i,a,o)} />`),u.join(`
18
+ `)}function ki(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[f`${e+s},${t}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e},${t+s}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function Ai(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function ji(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function Mi(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),c=t+Math.min(14,r*.28);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+f`<line x1="${e}" y1="${c}" x2="${e+n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`}function Ni(e,t,n,r,i,a,o,s){let c=s?[f`${e},${t}`,f`${e+n},${t}`,f`${e+n/2},${t+r}`]:[f`${e+n/2},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`];return f`<polygon points="${c.join(` `)}" ${U(i,a,o)} />`}function Pi(e,t,n,r,i){let a=Math.min(n,r)/2-2;return f`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function Fi(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2-2,u=l/Math.SQRT2;return f`<circle cx="${s}" cy="${c}" r="${l}" ${U(i,a,o)} />\n`+f`<line x1="${s-u}" y1="${c-u}" x2="${s+u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />\n`+f`<line x1="${s+u}" y1="${c-u}" x2="${s-u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />`}function Ii(e,t,n,r,i){let a=Math.min(8,r);return f`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function Li(e,t,n,r,i,a,o){let s=n/1.25,c=r-.48*s,[l,u,d,p]=[.15*s,.25*s,.35*s,.2*s],m=f`M0 0 a${l},${l} 0 0,1 ${.25*s},${-.1*s} `+f`a${d},${d} 1 0,1 ${.4*s},${-.1*s} `+f`a${u},${u} 1 0,1 ${.35*s},${.2*s} `+f`a${l},${l} 1 0,1 ${.15*s},${.35*c} `+f`a${p},${p} 1 0,1 ${-.15*s},${.65*c} `+f`a${u},${l} 1 0,1 ${-.25*s},${.15*s} `+f`a${d},${d} 1 0,1 ${-.5*s},0 `+f`a${l},${l} 1 0,1 ${-.25*s},${-.15*s} `+f`a${l},${l} 1 0,1 ${-.1*s},${-.35*c} `+f`a${p},${p} 1 0,1 ${.1*s},${-.65*c} H0 V0 Z`;return f`<path transform="translate(${e+.1*s} ${t+.225*s})" d="${m}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ri(e,t,n,r,i,a,o){let s=r/2,c=s/(2.5+r/50),l=n-2*c;return f`<path d="M${e+c},${t+r} a${c},${s} 0,0,1 0,${-r} l${l},0 a${c},${s} 0,0,1 0,${r} `+f`l${-l},0 Z" fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<path d="M${e+c+l},${t} a${c},${s} 0,0,0 0,${r}" fill="none" stroke="${a}" stroke-width="${o}" />`}function zi(e,t,n,r,i,a,o){let s=.2*r;return pi(e,t,n,r,i,a,o)+f`\n<polygon points="${e+n-s},${t+r} ${e+n},${t+r} ${e+n},${t+r-s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Bi(e,t,n,r,i,a,o){return f`<circle cx="${e+n/2}" cy="${t+r/2}" r="7" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Vi(e,t,n,r,i,a,o){let s=[f`${e},${t}`,f`${e+n-6},${t}`,f`${e+n},${t+6}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n`+f`<polygon points="${e+n-6},${t} ${e+n},${t+6} ${e+n-6},${t+6}" fill="var(--_inner-stroke)" stroke="${a}" stroke-width="${o}" />`}function Hi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+s}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e},${t+s}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function Ui(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),c=[f`${e},${t+s}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function Wi(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),c=f`M ${e} ${t+s} `+f`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+f`L ${e+n} ${t+r-s} `+f`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return f`<path d="${c}" ${U(i,a,o)} />`}function Gi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),c=f`M ${e+s} ${t} L ${e+n} ${t} `+f`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+f`L ${e+s} ${t+r} `+f`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return f`<path d="${c}" ${U(i,a,o)} />`}function Ki(e,t,n,r,i,a,o){let s=r/2,c=Math.max(0,n-s),l=f`M ${e} ${t} L ${e+c} ${t} `+f`A ${s} ${s} 0 0 1 ${e+c} ${t+r} `+f`L ${e} ${t+r} Z`;return f`<path d="${l}" ${U(i,a,o)} />`}function qi(e,t,n,r,i,a,o,s){let c=Math.min(10,n*.12),l=[f`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],u=f`M ${e+c} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+f`Q ${e} ${t+r/2} ${e-c*.4} ${t+r/2} `+f`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+f`Q ${e} ${t+r} ${e+c} ${t+r}`,d=f`M ${e+n-c} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+f`Q ${e+n} ${t+r/2} ${e+n+c*.4} ${t+r/2} `+f`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+f`Q ${e+n} ${t+r} ${e+n-c} ${t+r}`;return(s===`left`||s===`both`)&&l.push(f`<path d="${u}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&l.push(f`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`),l.join(`
19
+ `)}function Ji(e,t,n,r,i,a,o){let s=[f`${e+n*.42},${t}`,f`${e+n},${t}`,f`${e+n*.62},${t+r*.42}`,f`${e+n},${t+r*.42}`,f`${e+n*.3},${t+r}`,f`${e+n*.5},${t+r*.55}`,f`${e},${t+r*.55}`].join(` `);return f`<polygon points="${s}" ${U(i,a,o)} />`}function Yi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function Xi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return f`<circle cx="${i}" cy="${a}" r="${o}" `+f`fill="none" stroke="var(--_text)" stroke-width="${R.innerBox*2}" />`+f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function Zi(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2+(e.shape===`asymmetric`?6:0),i=e.icon===void 0?e.y+e.height/2:e.y+e.height+li,a=l(e.inlineStyle?.color??g(e.inlineStyle?.fill,`var(--_text)`)),o=f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${L.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=f` style="font-family: ${l(s)};"`),T(e.label,r,i,n.nodeLabel,o)}function Qi(e){return l(e).replace(/\r/g,`&#13;`).replace(/\n/g,`&#10;`).replace(/\t/g,`&#9;`)}function $i(e,t){return t===void 0?e:e.replace(`<svg `,f`<svg data-src="${Qi(t)}" `)}var ea=class{raw=new Map;resolved=new Map;inProgress=new Set;declare(e,t){this.raw.set(e,t),this.resolved.delete(e)}lookup(e){if(this.resolved.has(e))return this.resolved.get(e);let t=this.raw.get(e);if(t===void 0||this.inProgress.has(e))return;this.inProgress.add(e);let n=sa(t,this).trim();this.inProgress.delete(e);let r=!/\bvar\(|\bcolor-mix\(/.test(n);return this.resolved.set(e,r?n:void 0),r?n:void 0}};function ta(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function na(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}var ra=`(?<![\\w-])(var|color-mix)\\(`;function ia(e,t){let[n,...r]=na(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function aa(e){let t=e.trim().split(/\s+/),n,r;for(let e of t)if(/^[\d.]+%$/.test(e)){if(r!==void 0)return null;r=Number(e.slice(0,-1))}else{if(n!==void 0)return null;n=e}return n===void 0?null:{color:n,pct:r}}function oa(e){let t=na(e);if(t.length!==3)return null;let[n,r,i]=t;if(n===void 0||r===void 0||i===void 0||!/^\s*in\s+srgb\s*$/i.test(n))return null;let a=aa(r),o=aa(i);if(!a||!o)return null;let s=w(a.color),c=w(o.color);if(!s||!c)return null;let l=x(s,c,a.pct,o.pct);return l?h(l):null}function sa(e,t){let n=``,r=0,i=new RegExp(ra,`g`),a;for(;(a=i.exec(e))!==null;){let o=a[1];if(o===void 0)continue;let s=a.index,c=s+o.length,l=ta(e,c);if(l===-1)break;let u=sa(e.slice(c+1,l),t),d=o===`var`?ia(u,t):oa(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function ca(e,t){let n=new ea;for(let[e,r]of Object.entries(t))n.declare(e,r);return sa(e,n)}var la=/(--[\w-]+)\s*:\s*([^;{}]+)/g,ua=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,da=new Set([`data-src`]);function fa(e,t){la.lastIndex=0;let n;for(;(n=la.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function pa(e,t){return e.replace(ua,(e,n,r,i,a)=>{if(da.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${sa(a.slice(1,-1),t)}${o}`})}function ma(e,t){let n=new ea;n.declare(`--bg`,t.bg),n.declare(`--fg`,t.fg),t.line&&n.declare(`--line`,t.line),t.accent&&n.declare(`--accent`,t.accent),t.muted&&n.declare(`--muted`,t.muted),t.surface&&n.declare(`--surface`,t.surface),t.border&&n.declare(`--border`,t.border);for(let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)){let e=t[1];e!==void 0&&fa(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&fa(e.slice(1,-1),n)}let r=``,i=0;for(;i<e.length;){let t=e.indexOf(`<`,i);if(t===-1)break;if(r+=e.slice(i,t),e.startsWith(`<style`,t)){let a=e.indexOf(`>`,t),o=e.indexOf(`</style>`,t);if(a===-1||o===-1)break;r+=e.slice(t,a+1),r+=sa(e.slice(a+1,o),n),r+=`</style>`,i=o+8;continue}let a=-1,o=null;for(let n=t+1;n<e.length;n++){let t=e[n];if(o!==null)t===o&&(o=null);else if(t===`"`||t===`'`)o=t;else if(t===`>`){a=n;break}}if(a===-1)break;let s=e.slice(t,a+1);r+=s.startsWith(`<!`)||s.startsWith(`<?`)||s.startsWith(`</`)?s:pa(s,n),i=a+1}return r+e.slice(i)}var ha=[.3013,.3672,.3247,.5244,.5244,.6001,.7061,.1597,.3672,.3672,.3672,.5244,.3672,.3672,.3672,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.3672,.3672,.5244,.5244,.5244,.3672,.7705,.5898,.5659,.5981,.6133,.5356,.5249,.6763,.6543,.2783,.4766,.5757,.5063,.7095,.6382,.6738,.5576,.6758,.582,.481,.5806,.6484,.5874,.8521,.5566,.5703,.5503,.3672,.3555,.3672,.5244,.5244,.5244,.5254,.5571,.4951,.5571,.5454,.3696,.502,.5464,.2852,.3667,.5044,.2949,.8301,.5464,.5366,.5571,.5571,.3887,.4048,.3965,.5464,.4897,.7441,.501,.4932,.4746,.3672,.5244,.3672,.5244],ga=[.3013,.3672,.3667,.5859,.5859,.6841,.7061,.2295,.3672,.3672,.4321,.5859,.3672,.3672,.3672,.3901,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.3672,.3672,.5859,.5859,.5859,.438,.7705,.6333,.5952,.6118,.6426,.5688,.5835,.6714,.6836,.2783,.5327,.6172,.5527,.7451,.6675,.7031,.5869,.709,.6108,.5112,.6118,.6777,.6216,.8838,.6006,.6133,.5601,.4019,.3555,.4019,.5859,.5859,.5859,.5327,.5815,.5117,.5806,.5747,.3696,.502,.5928,.2983,.3667,.5479,.2949,.8594,.5903,.5659,.5825,.584,.4272,.4307,.3965,.5908,.5273,.7837,.5522,.5337,.5283,.4336,.5859,.4336,.5859];function _a(e){return e>=4352?1:.6}function va(e,t){let n=t?ga:ha,r=t?.5859:.5244,i=0;for(let t of e){let e=t.codePointAt(0);i+=e>=32&&e<=126?n[e-32]:e===171||e===187?r:_a(e)}return i*16}var W={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,mermaidPad:12,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6,namespaceTitleHeight:28,namespacePad:16,namespaceTitleFontSize:12,lollipopLabelHeight:32,lollipopLabelPadX:8};function ya(e){return`note ${e}`}function ba(e){return`${e} link`}function xa(e){return`namespace ${e}`}function Sa(e){let t=new Set(e.classes.map(e=>e.id)),n=new Set,r=[];for(let[i,a]of e.namespaces.entries()){let e=[];for(let r of a.classIds)!t.has(r)||n.has(r)||(n.add(r),e.push(r));e.length>0&&r.push({id:xa(i),name:a.name,classIds:e})}return r}function Ca(e){let t=new Map,n=new Set,r=[],i=new Map,a=e.relationships.map((a,o)=>{if(a.type!==`lollipop`||a.markerAt===`both`)return a;let s=a.markerAt===`from`,c=s?a.from:a.to,l=`lollipop ${r.length}`;return t.set(o,l),i.set(l,s?a.to:a.from),n.add(c),r.push({id:l,label:e.classes.find(e=>e.id===c)?.label??c,attributes:[],methods:[]}),s?{...a,from:l}:{...a,to:l}}),o=new Map(r.map(e=>[e.id,e.label]));if(r.length===0)return{diagram:e,labels:o,byRelationship:t};let s=new Set(a.flatMap(e=>[e.from,e.to]));for(let t of e.notes)t.forClass&&s.add(t.forClass);for(let t of e.namespaces)for(let e of t.classIds)s.add(e);let c=e=>n.has(e.id)&&!s.has(e.id)&&!e.annotation&&e.attributes.length===0&&e.methods.length===0,l=[...e.classes.filter(e=>!c(e)),...r],u=e.namespaces.map(e=>({...e,classIds:[...e.classIds,...r.filter(t=>e.classIds.includes(i.get(t.id)??``)).map(e=>e.id)]}));return{diagram:{...e,classes:l,relationships:a,namespaces:u},labels:o,byRelationship:t}}function wa(e){return m(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function Ta(e,t,n){let r=new Map,i=new Map,a=Ye(t.fontSizes);for(let t of e.classes){if(n.has(t.id)){r.set(t.id,{width:I(t.label,a.nodeLabel,L.edgeLabel)+W.lollipopLabelPadX*2,height:W.lollipopLabelHeight,headerHeight:W.lollipopLabelHeight,attrHeight:0,methodHeight:0});continue}let e=t.annotation?W.headerBaseHeight+W.annotationHeight:W.headerBaseHeight,i=t.attributes.length>0?t.attributes.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,o=t.methods.length>0?t.methods.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,s=I(t.label,a.nodeLabel,L.nodeLabel),c=ja(t.attributes),l=ja(t.methods),u=Math.max(Aa(t),s+W.boxPadX*2,c+W.boxPadX*2,l+W.boxPadX*2),d=e+i+o;r.set(t.id,{width:u,height:d,headerHeight:e,attrHeight:i,methodHeight:o})}let o=Sa(e),s=new Map;for(let e of o)for(let t of e.classIds)s.set(t,e.id);let c=new Map,l=[];for(let e of o){let t=I(e.name,W.namespaceTitleFontSize,L.groupHeader)+W.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":at({top:W.namespaceTitleHeight+W.namespacePad/2,left:W.namespacePad,bottom:W.namespacePad,right:W.namespacePad}),"elk.nodeSize.constraints":`MINIMUM_SIZE`,"elk.nodeSize.minimum":`(${Math.ceil(t)}, 0)`}};c.set(e.id,n),l.push(n)}for(let[e,t]of r){let n=st(e,t),r=c.get(s.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:a.edgeLabel},d=wa(e),f=[];for(let[t,n]of e.relationships.entries()){let e=d.has(t);f.push(ut({id:`e${t}`,source:e?n.to:n.from,target:e?n.from:n.to,label:n.label,labelStyle:u}))}let p=new Set(r.keys());for(let[t,n]of e.notes.entries()){let e=ya(t),r=y(n.text,a.edgeLabel,L.edgeLabel),o={width:r.width+W.notePadX*2,height:r.height+W.notePadY*2};i.set(e,o),l.push(st(e,o)),n.forClass!==void 0&&p.has(n.forClass)&&f.push(ut({id:ba(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...ot({direction:it(e.direction,rt.class),nodeSpacing:W.nodeSpacing,layerSpacing:W.layerSpacing,padding:W.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.separateConnectedComponents":`false`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:l,edges:f},classSizes:r,noteSizes:i,namespaces:o}}function Ea(e,t,n,r,i,a){let o=new Map;for(let e of t.classes)o.set(e.id,e);let s=new Set(i.map(e=>e.id)),c=new Map,l=[];for(let t of e.children??[])if(s.has(t.id)){let e=t.x??0,n=t.y??0;c.set(t.id,{x:e,y:n});for(let r of t.children??[])l.push({...r,x:(r.x??0)+e,y:(r.y??0)+n})}else l.push(t);let u=e=>{let t=e.container;return t&&c.get(t)||{x:0,y:0}},d=[];for(let t of i){let n=(e.children??[]).find(e=>e.id===t.id);n&&d.push({name:t.name,classIds:t.classIds.filter(e=>!a.labels.has(e)),x:n.x??0,y:n.y??0,width:n.width??0,height:n.height??0})}let f=[];for(let e of l){let r=o.get(e.id);if(r){let i=n.get(r.id);if(!i)throw Error(`Missing computed size for class "${r.id}"`);f.push({id:r.id,label:r.label,annotation:r.annotation,attributes:r.attributes,methods:r.methods,x:e.x??0,y:e.y??0,width:e.width??i.width,height:e.height??i.height,headerHeight:i.headerHeight,attrHeight:i.attrHeight,methodHeight:i.methodHeight,interaction:t.interactions.get(r.id),inlineStyle:D(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=wa(a.diagram),h=new Map;for(let e of l)h.set(e.id,e);let g=new Map;for(let[e,t]of a.labels){let n=h.get(e);g.set(e,{text:t,x:n?.x??0,y:n?.y??0,width:n?.width??0,height:n?.height??0})}let _=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=_[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=u(t),i=sn(t,r.x,r.y),o=m.has(e)?i.reverse():i,s=cn(t,r.x,r.y),c=g.get(a.byRelationship.get(e)??``);p.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:o,labelPosition:s,...c?{interfaceLabel:c}:{}})}let v=new Map;for(let e of _.slice(t.relationships.length))v.set(e.id,e);let y=[];for(let[e,n]of t.notes.entries()){let t=ya(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(ba(t));y.push({id:t,text:n.text,...o&&n.forClass!==void 0?{forClass:n.forClass}:{},x:i.x??0,y:i.y??0,width:i.width??a.width,height:i.height??a.height,...o?{linkPoints:sn(o,u(o).x,u(o).y)}:{}})}return{width:e.width??600,height:e.height??400,classes:f,relationships:p,notes:y,namespaces:d}}function Da(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let n=Ca(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=Ta(n.diagram,t,n.labels);return Ea(He(r,t.layoutCache),e,i,a,o,n)}function Oa(e){return e.length*Math.ceil(Ge(`M`,W.memberFontSize))}function ka(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function Aa(e){let t=va(e.label,!0),n=e.annotation?va(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>va(ka(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+W.mermaidPad*2}function ja(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=Oa(ue(n));e>t&&(t=e)}return t}var Ma={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function Na(e,t,n=`Inter`,r=!1,i=Je,a,o,s,c=!0,l={}){let u=[],d=c&&e.classes.some(e=>!!O(e.interaction?.href));u.push($i(M(e.width,e.height,t,r,o,s,d,l.styleAttribute,l.description),a)),u.push(et(n,!0,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(Fa(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push(Pa(t));for(let t of e.relationships)u.push(Ha(t));for(let t of e.notes)u.push(Va(t));for(let t of e.classes)u.push(Ia(t,i,c));for(let t of e.relationships){let e=Ua(t,i);e&&u.push(e)}for(let t of e.notes)u.push(Ba(t,i));for(let t of e.relationships)u.push(Ka(t,i));return u.push(`</svg>`),u.join(`
20
+ `)}function Pa(e){let{x:t,y:n,width:r,height:i}=e,a=W.namespaceTitleHeight,o=R.outerBox;return[f`<g class="class-namespace" data-id="${l(e.name)}" data-label="${l(e.name)}">`,f` <rect x="${t}" y="${n}" width="${r}" height="${i}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,f` <rect x="${t}" y="${n}" width="${r}" height="${a}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,f` <text x="${t+W.namespacePad}" y="${n+a/2}" dy="${z}" font-size="${W.namespaceTitleFontSize}" font-weight="${L.groupHeader}" fill="var(--_text-sec)">${Qa(e.name)}</text>`,`</g>`].join(`
21
+ `)}function Fa(e){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
22
22
  <polygon points="0 0, 12 5, 0 10" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
23
23
  </marker>
24
24
  <marker id="cls-composition" markerWidth="18" markerHeight="14" refX="16.5" refY="7" orient="auto-start-reverse">
@@ -32,54 +32,55 @@ import{DEFAULTS as e,LINE_HEIGHT_RATIO as t,applyThemeVariables as n,buildStyleB
32
32
  </marker>`+(e?`
33
33
  <marker id="cls-lollipop" markerWidth="12" markerHeight="12" refX="11" refY="6" orient="auto-start-reverse">
34
34
  <circle cx="6" cy="6" r="5" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
35
- </marker>`:``)}function ua(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:s,attrHeight:c,inlineStyle:u}=e,d=[],p=e.interaction,m=l(u?.fill??`var(--_node-fill)`),h=l(u?.stroke??`var(--_node-stroke)`),_=l(u?.[`stroke-width`]??String(R.outerBox)),v=u?.fill?m:`var(--_group-hdr)`,y=u?.color?l(u.color):u?.fill?l(g(u.fill,`var(--_text)`)):void 0,b=e.annotation?f` data-annotation="${l(e.annotation)}"`:``,x=O(e.className),S=[f`class="${x?f`class-node ${x}`:`class-node`}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`];d.push(f`<g ${S.join(` `)}${b}>`);let C=n?D(p?.href):void 0;if(C){let e=p?.target?f` target="${l(p.target)}"`:``;d.push(f` <a href="${l(C)}"${e}>`)}n&&p?.tooltip&&d.push(f` <title>${wa(p.tooltip)}</title>`),d.push(f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+f`rx="0" ry="0" fill="${m}" stroke="${h}" stroke-width="${_}" />`),d.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${v}" stroke="${h}" stroke-width="${_}" />`);let T=i+s/2;if(e.annotation){let t=i+12;d.push(f` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${z}" `+f`font-size="${oa.annotationSize}" font-weight="${oa.annotationWeight}" `+f`font-style="italic" fill="${y??`var(--_text-muted)`}">&lt;&lt;${wa(e.annotation)}&gt;&gt;</text>`),T=i+s/2+6}d.push(` `+w(e.label,r+a/2,T,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${y??`var(--_text)`}"`));let E=i+s;d.push(f` <line x1="${r}" y1="${E}" x2="${r+a}" y2="${E}" `+f`stroke="${h}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=E+4+t*20+10;d.push(` `+fa(n,r+W.boxPadX,i,y))}let k=E+c;d.push(f` <line x1="${r}" y1="${k}" x2="${r+a}" y2="${k}" `+f`stroke="${h}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=k+4+t*20+10;d.push(` `+fa(n,r+W.boxPadX,i,y))}return C&&d.push(` </a>`),d.push(`</g>`),d.join(`
36
- `)}var da=700;function fa(e,t,n,r){let i=e.isAbstract?` font-style="italic"`:``,a=e.isStatic?` text-decoration="underline"`:``,o=r??`var(--_text-faint)`,s=r??`var(--_text-sec)`,c=r??`var(--_text-muted)`,l=[];e.visibility&&l.push(f`<tspan fill="${s}" font-weight="${da}">${wa(e.visibility)}</tspan><tspan fill="${o}"> </tspan>`);let u=e.isMethod?f`${e.name}(${e.params||``})`:e.name;return l.push(f`<tspan fill="${s}">${wa(u)}</tspan>`),e.type&&(l.push(f`<tspan fill="${o}">: </tspan>`),l.push(f`<tspan fill="${c}">${wa(e.type)}</tspan>`)),f`<text x="${t}" y="${n}" class="mono" dy="${z}" `+f`font-size="${oa.memberSize}" font-weight="${oa.memberWeight}"${i}${a}>`+f`${l.join(``)}</text>`}var pa=6;function ma(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:f` data-for="${l(e.forClass)}"`,s=[f`${n},${r}`,f`${n+i-pa},${r}`,f`${n+i},${r+pa}`,f`${n+i},${r+a}`,f`${n},${r+a}`].join(` `),c=f`${n+i-pa},${r} ${n+i},${r+pa} `+f`${n+i-pa},${r+pa}`;return f`<g class="class-note"${o}>`+f`\n <polygon points="${s}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n <polygon points="${c}" `+f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n ${w(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
37
- </g>`}function ha(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>f`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:f` data-for="${l(e.forClass)}"`;return f`<polyline class="class-note-link"${n} points="${t}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.connector}" stroke-dasharray="2 3" />`}function ga(e){if(e.points.length<2)return``;let t=e.points.map(e=>f`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=va(e.type,e.markerAt),i=[`class="class-relationship"`,f`data-from="${l(e.from)}"`,f`data-to="${l(e.to)}"`,f`data-type="${e.type}"`,f`data-marker-at="${e.markerAt}"`];return e.label&&i.push(f`data-label="${l(e.label)}"`),e.fromCardinality&&i.push(f`data-from-cardinality="${l(e.fromCardinality)}"`),e.toCardinality&&i.push(f`data-to-cardinality="${l(e.toCardinality)}"`),f`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+f`stroke-width="${R.connector}"${n}${r} />`}function _a(e,t){let n=e.interfaceLabel;if(!n)return``;let r=e.markerAt===`from`?e.from:e.to;return f`<g class="class-interface" data-id="${l(r)}" data-label="${l(n.text)}">\n `+w(n.text,n.x+n.width/2,n.y+n.height/2,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text)"`)+`
38
- </g>`}function va(e,t){let n=ya(e);return n?(t===`to`?``:f` marker-start="url(#${n})"`)+(t===`from`?``:f` marker-end="url(#${n})"`):``}function ya(e){switch(e){case`inheritance`:case`realization`:return`cls-inherit`;case`composition`:return`cls-composition`;case`aggregation`:return`cls-aggregation`;case`association`:case`dependency`:return`cls-arrow`;case`lollipop`:return`cls-lollipop`;default:return null}}function ba(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=xa(e.points,e.labelPosition??Sa(e.points)),i=v(e.label,t.edgeLabel,L.edgeLabel);n.push(T(e.label,r.x,r.y,i.width,i.height,t.edgeLabel,4,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`,`class="class-relationship-label-bg" fill="var(--bg)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=Ca(r,i);n.push(w(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`))}if(e.toCardinality&&e.points.length>=2){let r=e.points[e.points.length-1],i=e.points[e.points.length-2],a=Ca(r,i);n.push(w(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
39
- `)}function xa(e,t){let n=e[0],r=1/0;for(let i=1;i<e.length;i++){let a=e[i-1],o=e[i],s=o.x-a.x,c=o.y-a.y,l=s*s+c*c,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)),d={x:a.x+u*s,y:a.y+u*c},f=(d.x-t.x)**2+(d.y-t.y)**2;f<r&&(r=f,n=d)}return n}function Sa(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function Ca(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>Math.abs(r)?{x:n>0?14:-14,y:-10}:{x:-14,y:r>0?14:-14}}var wa=u,G={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90,loopOut:20,loopHalf:10,loopLabelGap:4,loopNestGap:16,loopMargin:12};function Ta(e,t,n){let r=Je(n.fontSizes).edgeLabel,i=[];for(let[n,a]of e.relationships.entries()){if(a.entity1!==t||a.entity2!==t)continue;let e=i[i.length-1],o=a.label?v(a.label,r,L.edgeLabel).width+8:0;i.push({index:n,nest:i.length,out:e?e.out+G.loopLabelGap+e.labelW+G.loopNestGap:G.loopOut,labelW:o})}return i}function Ea(e){return e.length*Math.ceil(We(`M`,G.attrFontSize))}function Da(e,t){let n=new Map,r=Je(t.fontSizes);for(let t of e.entities){let e=I(t.label,r.nodeLabel,L.nodeLabel),i=0;for(let e of t.attributes){let t=Ea(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(G.minWidth,e+G.boxPadX*2,i+G.boxPadX*2),o=G.headerHeight+Math.max(t.attributes.length,1)*G.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(it(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())n.entity1!==n.entity2&&o.push(st({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));let s=0;for(let n of e.entities){let r=Ta(e,n.id,t),i=r[r.length-1];i&&(s=Math.max(s,i.out+i.labelW))}return{elkGraph:{id:`root`,layoutOptions:{...rt({direction:tt(e.direction,et.er),nodeSpacing:Math.max(G.nodeSpacing,s+20),layerSpacing:Math.max(G.layerSpacing,s+20),padding:G.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.separateConnectedComponents":`false`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:i,edges:o},entitySizes:n}}function Oa(e,t,n,r){let i=new Map;for(let e of t.entities)i.set(e.id,e);let a=[];for(let r of e.children??[]){let e=i.get(r.id);if(e){let i=n.get(e.id);if(!i)throw Error(`Missing computed size for entity "${e.id}"`);a.push({id:e.id,label:e.label,attributes:e.attributes,x:r.x??0,y:r.y??0,width:r.width??i.width,height:r.height??i.height,headerHeight:G.headerHeight,rowHeight:G.rowHeight,inlineStyle:E(e.id,t),className:t.classAssignments.get(e.id)})}}let o=new Map((e.edges??[]).map(e=>[e.id,e])),s=[],c=1/0;for(let[e,n]of t.relationships.entries()){let i={entity1:n.entity1,entity2:n.entity2,cardinality1:n.cardinality1,cardinality2:n.cardinality2,label:n.label,identifying:n.identifying};if(n.entity1!==n.entity2){s.push({...i,points:Gt(o.get(`e${e}`))});continue}let l=a.find(e=>e.id===n.entity1),u=Ta(t,n.entity1,r).find(t=>t.index===e),d=l.y+l.height/2,f=Math.max(G.loopHalf,l.height/8)+10*u.nest,p=l.x-u.out;s.push({...i,points:[{x:l.x,y:d-f},{x:p,y:d-f},{x:p,y:d+f},{x:l.x,y:d+f}],labelPoint:{x:p-G.loopLabelGap-u.labelW/2,y:d}}),c=Math.min(c,p-G.loopLabelGap-u.labelW)}let l=Math.max(0,G.loopMargin-c);if(l>0){for(let e of a)e.x+=l;for(let e of s){for(let t of e.points)t.x+=l;e.labelPoint&&(e.labelPoint.x+=l)}}return{width:(e.width??600)+l,height:e.height??400,entities:a,relationships:s}}function ka(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=Da(e,t);return Oa(Ve(n,t.layoutCache),e,r,t)}var Aa=70,ja={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function Ma(e,t,n=`Inter`,r=!1,i=qe,a,o,s,c={}){let l=[];l.push(Di(M(e.width,e.height,t,r,o,s,void 0,c.styleAttribute,c.description),a)),l.push($e(n,!0,c.nonce,c.bodyFont)),l.push(`<defs>`),l.push(`</defs>`);for(let t of e.relationships)l.push(Fa(t));for(let t of e.entities)l.push(Na(t,i));for(let t of e.relationships)l.push(La(t));for(let t of e.relationships)l.push(Ia(t,i));return l.push(`</svg>`),l.join(`
40
- `)}function Na(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:s,rowHeight:c,label:u,attributes:d,inlineStyle:p}=e,m=[],h=l(p?.fill??`var(--_node-fill)`),_=l(p?.stroke??`var(--_node-stroke)`),v=l(p?.[`stroke-width`]??String(R.outerBox)),y=l(p?.[`stroke-width`]??String(R.innerBox)),b=p?.fill?h:`var(--_group-hdr)`,x=p?.color?l(p.color):p?.fill?l(g(p.fill,`var(--_text)`)):void 0,S=O(e.className);m.push(f`<g class="${S?f`entity ${S}`:`entity`}" data-id="${l(n)}" data-label="${l(u)}">`),m.push(f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+f`rx="0" ry="0" fill="${h}" stroke="${_}" stroke-width="${v}" />`),m.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${b}" stroke="${_}" stroke-width="${v}" />`),m.push(` `+w(u,r+a/2,i+s/2,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${x??`var(--_text)`}"`));let C=i+s;m.push(f` <line x1="${r}" y1="${C}" x2="${r+a}" y2="${C}" `+f`stroke="${_}" stroke-width="${y}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=C+e*c+c/2;m.push(` `+Pa(t,r,n,a,x).replace(/\n/g,`
41
- `))}return d.length===0&&m.push(f` <text x="${r+a/2}" y="${C+c/2}" text-anchor="middle" dy="${z}" `+f`font-size="${ja.attrSize}" fill="${x??`var(--_text-muted)`}" font-style="italic">(no attributes)</text>`),m.push(`</g>`),m.join(`
42
- `)}function Pa(e,t,n,r,i){let a=[],o=e.comment&&e.comment.length>0;if(e.comment&&e.comment.length>0){let t=e.comment.replace(/<br\s*\/?>/gi,`
43
- `);a.push(f`<g><title>${Ba(t)}</title>`)}let s=0;e.keys.length>0&&(s=I(e.keys.join(`,`),ja.keySize,ja.keyWeight)+8,a.push(f`<rect x="${t+6}" y="${n-7}" width="${s}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),a.push(f`<text x="${t+6+s/2}" y="${n}" text-anchor="middle" dy="${z}" `+f`font-size="${ja.keySize}" font-weight="${ja.keyWeight}" fill="${i??`var(--_text-sec)`}">${e.keys.join(`,`)}</text>`));let c=t+8+(s>0?s+6:0);a.push(f`<text x="${c}" y="${n}" class="mono" dy="${z}" `+f`font-size="${ja.attrSize}" font-weight="${ja.attrWeight}">`+f`<tspan fill="${i??`var(--_text-muted)`}">${Ba(e.type)}</tspan></text>`);let l=t+r-8;return a.push(f`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${z}" `+f`font-size="${ja.attrSize}" font-weight="${ja.attrWeight}">`+f`<tspan fill="${i??`var(--_text-sec)`}">${Ba(e.name)}</tspan></text>`),o&&a.push(`</g>`),a.join(`
44
- `)}function Fa(e){if(e.points.length<2)return``;let t=e.points.map(e=>f`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?f` data-label="${l(e.label)}"`:``,i=[`class="er-relationship"`,f`data-entity1="${l(e.entity1)}"`,f`data-entity2="${l(e.entity2)}"`,f`data-cardinality1="${e.cardinality1}"`,f`data-cardinality2="${e.cardinality2}"`,f`data-identifying="${e.identifying}"`];return f`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+f`stroke-width="${R.connector}"${n} />`}function Ia(e,t){if(!e.label||e.points.length<2)return``;let n=e.labelPoint??za(e.points),r=v(e.label,t.edgeLabel,L.edgeLabel),i=r.width+8,a=r.height+6;return f`<rect x="${n.x-i/2}" y="${n.y-a/2}" width="${i}" height="${a}" rx="2" ry="2" `+`fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />`+f`\n${w(e.label,n.x,n.y,t.edgeLabel,f`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${L.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${Aa}%, var(--bg))"`)}`}function La(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(Ra(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(Ra(i,a,e.cardinality2)),t.join(`
45
- `)}function Ra(e,t,n){let r=[],i=R.connector+.25,a=e.x-t.x,o=e.y-t.y,s=Math.sqrt(a*a+o*o);if(s===0)return``;let c=a/s,l=o/s,u=-l,d=c,p=e.x-c*4,m=e.y-l*4,h=e.x-c*16,g=e.y-l*16,_=n===`one`||n===`zero-one`,v=n===`many`||n===`zero-many`,y=n===`zero-one`||n===`zero-many`;if(_){r.push(f`<line x1="${p+u*6}" y1="${m+d*6}" `+f`x2="${p-u*6}" y2="${m-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-c*4,t=m-l*4;r.push(f`<line x1="${e+u*6}" y1="${t+d*6}" `+f`x2="${e-u*6}" y2="${t-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(f`<line x1="${e+u*7}" y1="${t+d*7}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(f`<line x1="${e}" y1="${t}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(f`<line x1="${e-u*7}" y1="${t-d*7}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-c*20,n=e.y-l*20;r.push(f`<line x1="${t+u*6}" y1="${n+d*6}" `+f`x2="${t-u*6}" y2="${n-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(y){let t=v?20:12,n=e.x-c*t,a=e.y-l*t;r.push(f`<circle cx="${n}" cy="${a}" r="4" `+f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
46
- `)}function za(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}if(t===0)return e[0];let n=t/2,r=0;for(let t=1;t<e.length;t++){let i=e[t].x-e[t-1].x,a=e[t].y-e[t-1].y,o=Math.sqrt(i*i+a*a);if(r+o>=n){let s=o>0?(n-r)/o:0;return{x:e[t-1].x+i*s,y:e[t-1].y+a*s}}r+=o}return e[e.length-1]}var Ba=u,Va={padding:30,actorGap:140,actorHeight:40,actorPadX:16,headerGap:20,messageRowHeight:40,selfMessageHeight:30,activationWidth:10,blockPadX:10,blockPadTop:40,blockPadBottom:8,blockHeaderExtra:28,dividerExtra:24,noteWidth:60,notePadX:12,notePadY:6,noteGap:10,noteOffsetAfterMessage:8,noteStackGap:4,boxPad:10},Ha=60,Ua=45,Wa=20;function Ga(e){return e+8}var Ka=14,qa=new Set([`boundary`,`control`,`entity`,`database`]);function Ja(e){return e.type===`actor`||qa.has(e.participantType)}var Ya=4;function Xa(e,t,n){return 14+v(e,t,n).height/2}function Za(e){return{...Va,actorHeight:e?.actorHeight??Va.actorHeight,headerGap:e?.headerGap??Va.headerGap,messageRowHeight:e?.messageRowHeight??Va.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Va.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Va.noteStackGap}}var Qa=16;function $a(e,t,n=L.edgeLabel){return v(e,t,n).width}function eo(e,t){return e.type===`rect`&&e.color!==void 0?0:$a(`${e.type}${e.label?` [${e.label}]`:``}`.split(`
47
- `)[0],t,L.groupHeader)+16}function to(e){return e.map((t,n)=>e.slice(0,n).flatMap((e,n)=>e.startIndex>=t.startIndex&&e.endIndex<=t.endIndex?[n]:[]))}function no(e,t,n,r,i){let a=new Map(e.actors.map((e,t)=>[e.id,t])),o=(e,t,r)=>{if(e<0||t>=n.length)return;let i=0;for(let r=e+1;r<=t;r++)i+=n[r];if(i>=r)return;let a=(r-i)/(t-e);for(let r=e+1;r<=t;r++)n[r]+=a};for(let t of e.messages){if(!t.label)continue;let e=a.get(t.from),n=a.get(t.to),r=$a(t.label,i);e===n?(o(e-1,e,r/2+Qa),o(e,e+1,r/2+Qa)):o(Math.min(e,n),Math.max(e,n),r+32)}for(let n of e.notes){let e=a.get(n.actorIds[0]??``),s=Math.max(r.noteWidth,$a(n.text,i)+r.notePadX*2),c=t[e]/2+r.noteGap+s+Qa;n.position===`right`?o(e,e+1,c):n.position===`left`?o(e-1,e,c):n.actorIds.length===1&&(o(e,e+1,s/2+Qa),o(e-1,e,s/2+Qa))}for(let n of e.blocks){let s=e.actors.length;for(let t=n.startIndex;t<=n.endIndex;t++){let n=e.messages[t];n&&(s=Math.min(s,a.get(n.from),a.get(n.to)))}if(s===e.actors.length)continue;let c=-t[s]/2-r.blockPadX;o(s,s+1,c+eo(n,i)+Qa);for(let e of n.dividers)e.label&&o(s,s+1,c+8+$a(`[${e.label}]`,i)+Qa)}}function ro(e,n={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let r=Za(n.sequence),i=Je(n.fontSizes),a=e.actors.map(e=>{let t=I(e.label,i.nodeLabel,L.nodeLabel);return Math.max(t+r.actorPadX*2,80)}),o=a.map((e,t)=>t===0?0:Math.max(r.actorGap,(a[t-1]+e)/2+40));no(e,a,o,r,i.edgeLabel);let s=[],c=r.padding+a[0]/2;for(let t=0;t<e.actors.length;t++)c+=o[t],s.push(c);let l=new Map;for(let t=0;t<e.actors.length;t++)l.set(e.actors[t].id,t);let u=e.boxes.filter(e=>e.actorIds.length>0),d=u.some(e=>e.label!==``),f=u.length===0?0:r.boxPad+(d?Ga(i.edgeLabel):0),p=r.padding+f,m=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,...e.participantType!==void 0&&{participantType:e.participantType},x:s[t],y:p,width:a[t],height:r.actorHeight})),h=u.map(e=>{let t=e.actorIds.map(e=>l.get(e)??0),n=Math.min(...t),i=Math.max(...t),o=s[n]-a[n]/2-r.boxPad,c=s[i]+a[i]/2+r.boxPad,u={label:e.label,x:o,y:r.padding,width:c-o,height:0};return e.color!==void 0&&(u.color=e.color),u}),g=e.actors.map(e=>Ja(e)?Xa(e.label,i.nodeLabel,L.nodeLabel):0),_=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?g[t]:0)),v=i.edgeLabel+12,y=p+r.actorHeight+Math.max(r.headerGap,_>0?_+Ya+v:0),b=[],x=new Map,S=new Map;for(let t of e.blocks){x.set(t.startIndex,(x.get(t.startIndex)??0)+r.blockHeaderExtra);for(let e of t.dividers)S.set(e.index,r.dividerExtra)}let C=to(e.blocks),w=new Map;e.blocks.forEach((e,t)=>{let n=w.get(e.endIndex)??[];n.push(t),w.set(e.endIndex,n)});let T=[],E=t=>e.notes.slice(t.noteStartIndex,t.noteEndIndex),D=new Map;for(let t of e.notes){let e=D.get(t.afterIndex)??[];e.push(t),D.set(t.afterIndex,e)}let O=[],k=new Map,ee=(e,n)=>{let o=Math.max(r.noteWidth,$a(e.text,i.edgeLabel)+r.notePadX*2),c=e.text.split(`
48
- `).length,u=i.edgeLabel*(1+(c-1)*t)+r.notePadY*2,d=l.get(e.actorIds[0]??``)??0,f;if(e.position===`left`)f=s[d]-a[d]/2-o-r.noteGap;else if(e.position===`right`)f=s[d]+a[d]/2+r.noteGap;else if(e.actorIds.length>1){let t=l.get(e.actorIds[e.actorIds.length-1]??``)??d;f=(s[d]+s[t])/2-o/2}else f=s[d]-o/2;let p={text:e.text,x:f,y:n,width:o,height:u,position:e.position,actors:e.actorIds};return O.push(p),k.set(e,p),n+u+r.noteStackGap},A=D.get(-1);if(A&&A.length>0){let e=y;for(let t of A)e=ee(t,e);y=Math.max(y,e+r.messageRowHeight/2)}let j=new Map,te=[],ne=r.activationWidth/2;function M(e,t){let n=j.get(e)??[];j.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function re(e,t){let n=j.get(e);if(!n||n.length===0)return;let{startY:i,depth:a}=n.pop(),o=l.get(e)??0,c=a*ne;te.push({actorId:e,x:s[o]-r.activationWidth/2+c,topY:i,bottomY:t,width:r.activationWidth,depth:a})}let N=new Map;for(let t of e.activations){let e=N.get(t.afterIndex)??[];e.push(t),N.set(t.afterIndex,e)}function ie(e,t){for(let n of N.get(e)??[])n.kind===`start`?M(n.actorId,t):re(n.actorId,t)}ie(-1,y);for(let t=0;t<e.messages.length;t++){let n=e.messages[t],i=l.get(n.from)??0,o=l.get(n.to)??0,c=n.from===n.to;y+=(x.get(t)??0)+(S.get(t)??0);let u=s[i],d=s[o],f=!c&&e.actors[o].createdAt===t;if(f){let e=a[o]/2;d+=u<d?-e:e}b.push({from:n.from,to:n.to,label:n.label,lineStyle:n.lineStyle,arrowHead:n.arrowHead,x1:u,x2:d,y,isSelf:c,bidirectional:n.bidirectional??!1,seqNumber:n.seqNumber}),n.activate&&M(n.to,y),n.deactivate&&re(n.from,y),ie(t,y),y+=c?r.selfMessageHeight+r.messageRowHeight:r.messageRowHeight,f&&(y+=r.actorHeight/2);let p=n=>{let i=b[t].y+(c?20:0)+r.blockPadBottom+12;for(let t of E(e.blocks[n])){let e=k.get(t);i=Math.max(i,e.y+e.height+r.blockPadBottom)}for(let e of C[n])i=Math.max(i,T[e]+r.blockPadBottom);T[n]=i,y=Math.max(y,i+r.messageRowHeight/2)},m=w.get(t)??[],h=D.get(t);if(h&&h.length>0){let n=c?r.selfMessageHeight:0,i=b[t].y+n+r.noteOffsetAfterMessage;for(let t of h){let n=e.notes.indexOf(t);for(let t of m)T[t]===void 0&&e.blocks[t].noteEndIndex<=n&&(p(t),i=Math.max(i,T[t]+r.noteOffsetAfterMessage));i=ee(t,i)}y=Math.max(y,i+r.messageRowHeight/2)}for(let e of m)T[e]===void 0&&p(e)}for(let[e,t]of j)for(let{startY:n,depth:i}of t){let t=l.get(e)??0,a=i*ne;te.push({actorId:e,x:s[t]-r.activationWidth/2+a,topY:n,bottomY:y-r.messageRowHeight/2,width:r.activationWidth,depth:i})}te.sort((e,t)=>e.depth-t.depth);let ae=[];e.blocks.forEach((t,n)=>{let o=C[n].map(e=>ae[e]),c=(b[t.startIndex]?.y??y)-r.blockPadTop;for(let e of o)c=Math.min(c,e.y-r.blockHeaderExtra);let u=T[n]??y+r.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(l.get(t.from)??0),d.add(l.get(t.to)??0))}if(d.size===0)for(let t=0;t<e.actors.length;t++)d.add(t);let f=Math.min(...d),p=Math.max(...d),m=s[f]-a[f]/2-r.blockPadX,h=s[p]+a[p]/2+r.blockPadX;for(let e of E(t)){let t=k.get(e);m=Math.min(m,t.x-r.blockPadX),h=Math.max(h,t.x+t.width+r.blockPadX)}for(let e of o)m=Math.min(m,e.x-r.blockPadX),h=Math.max(h,e.x+e.width+r.blockPadX);h=Math.max(h,m+eo(t,i.edgeLabel)+r.blockPadX);for(let e of t.dividers)e.label&&(h=Math.max(h,m+8+$a(`[${e.label}]`,i.edgeLabel)+Qa));let g=t.dividers.map(t=>{let a=o.filter((r,i)=>e.blocks[C[n][i]].startIndex===t.index);if(a.length>0)return{y:Math.min(...a.map(e=>e.y))-r.dividerExtra,label:t.label};let s=b[t.index],c=s?.y??y,l=28;if(t.label&&s?.label){let e=I(`[${t.label}]`,i.edgeLabel,L.edgeLabel),n=m+8,r=n+e,a=I(s.label,i.edgeLabel,L.edgeLabel),o=(s.x1+s.x2)/2-a/2,c=o+a;r>o&&n<c&&(l=40)}return{y:c-l,label:t.label}});ae.push({type:t.type,label:t.label,...t.color===void 0?{}:{color:t.color},x:m,y:c,width:h-m,height:u-c,dividers:g})});let oe=O,se=y+r.padding,P=r.padding,F=0;for(let e of m)P=Math.min(P,e.x-e.width/2),F=Math.max(F,e.x+e.width/2);for(let e of ae)P=Math.min(P,e.x),F=Math.max(F,e.x+e.width);for(let e of oe)P=Math.min(P,e.x),F=Math.max(F,e.x+e.width);for(let e of h)P=Math.min(P,e.x),F=Math.max(F,e.x+e.width);for(let e of b)if(e.isSelf&&(F=Math.max(F,e.x1+45+8),e.label)){let t=I(e.label,i.edgeLabel,L.edgeLabel)/2+8;F=Math.max(F,e.x1+t),P=Math.min(P,e.x1-t)}let ce=P<r.padding?r.padding-P:0;if(ce>0){for(let e of m)e.x+=ce;for(let e of b)e.x1+=ce,e.x2+=ce;for(let e of te)e.x+=ce;for(let e of ae)e.x+=ce;for(let e of oe)e.x+=ce;for(let e of h)e.x+=ce;for(let e=0;e<s.length;e++)s[e]+=ce}for(let t=0;t<e.actors.length;t++){let n=e.actors[t].createdAt;n!==void 0&&(m[t].y=(b[n]?.y??y)-r.actorHeight/2)}let le=e.actors.map((e,t)=>{let n=e.destroyedAt,i={actorId:e.id,x:s[t],topY:m[t].y+r.actorHeight+(g[t]>0?g[t]+Ya:0),bottomY:n===void 0?se-r.padding:b[n]?.y??y};return n!==void 0&&(i.destroyed=!0),i});for(let e of h)e.height=se-r.padding+r.boxPad-e.y;let ue=F+ce+r.padding;return{width:Math.max(ue,200),height:Math.max(se,100),actors:m,lifelines:le,messages:b,activations:te,blocks:ae,notes:oe,boxes:h}}function io(e,t,n=`Inter`,i=!1,a=qe,o,s,c,l={}){let u=[];u.push(Di(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push(r(n,!1,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(ao()),u.push(`</defs>`);for(let t of e.boxes)u.push(So(t,a));for(let t of e.blocks)u.push(wo(t,a));let d=mo(e,a);for(let t of e.lifelines)u.push(go(t,d));for(let t of e.activations)u.push(vo(t));for(let t of e.messages)u.push(yo(t,a));for(let t of e.notes)u.push(To(t,a));for(let t of e.actors)u.push(so(t,a));return u.push(`</svg>`),u.join(`
49
- `)}function ao(){let e=Qe.width,t=Qe.height;return f` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+f`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
35
+ </marker>`:``)}function Ia(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:s,attrHeight:c,inlineStyle:u}=e,d=[],p=e.interaction,m=l(u?.fill??`var(--_node-fill)`),h=l(u?.stroke??`var(--_node-stroke)`),_=l(u?.[`stroke-width`]??String(R.outerBox)),v=u?.fill?m:`var(--_group-hdr)`,y=u?.color?l(u.color):u?.fill?l(g(u.fill,`var(--_text)`)):void 0,b=e.annotation?f` data-annotation="${l(e.annotation)}"`:``,x=k(e.className),S=[f`class="${x?f`class-node ${x}`:`class-node`}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`];d.push(f`<g ${S.join(` `)}${b}>`);let C=n?O(p?.href):void 0;if(C){let e=p?.target?f` target="${l(p.target)}"`:``;d.push(f` <a href="${l(C)}"${e}>`)}n&&p?.tooltip&&d.push(f` <title>${Qa(p.tooltip)}</title>`),d.push(f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+f`rx="0" ry="0" fill="${m}" stroke="${h}" stroke-width="${_}" />`),d.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${v}" stroke="${h}" stroke-width="${_}" />`);let w=i+s/2;if(e.annotation){let t=i+12;d.push(f` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${z}" `+f`font-size="${Ma.annotationSize}" font-weight="${Ma.annotationWeight}" `+f`font-style="italic" fill="${y??`var(--_text-muted)`}">«${Qa(e.annotation)}»</text>`),w=i+s/2+6}d.push(` `+T(e.label,r+a/2,w,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${y??`var(--_text)`}"`));let E=i+s;d.push(f` <line x1="${r}" y1="${E}" x2="${r+a}" y2="${E}" `+f`stroke="${h}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=E+4+t*20+10;d.push(` `+Ra(n,r+W.boxPadX,i,y))}let D=E+c;d.push(f` <line x1="${r}" y1="${D}" x2="${r+a}" y2="${D}" `+f`stroke="${h}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=D+4+t*20+10;d.push(` `+Ra(n,r+W.boxPadX,i,y))}return C&&d.push(` </a>`),d.push(`</g>`),d.join(`
36
+ `)}var La=700;function Ra(e,t,n,r){let i=e.isAbstract?` font-style="italic"`:``,a=e.isStatic?` text-decoration="underline"`:``,o=r??`var(--_text-faint)`,s=r??`var(--_text-sec)`,c=r??`var(--_text-muted)`,l=[];e.visibility&&l.push(f`<tspan fill="${s}" font-weight="${La}">${Qa(e.visibility)}</tspan>${e.visibilitySpace?f`<tspan fill="${o}"> </tspan>`:``}`);let u=e.isMethod?f`${e.name}(${e.params||``})`:e.name;return l.push(f`<tspan fill="${s}">${Qa(u)}</tspan>`),e.type&&(l.push(f`<tspan fill="${o}"> : </tspan>`),l.push(f`<tspan fill="${c}">${Qa(e.type)}</tspan>`)),f`<text x="${t}" y="${n}" class="mono" dy="${z}" `+f`font-size="${Ma.memberSize}" font-weight="${Ma.memberWeight}"${i}${a}>`+f`${l.join(``)}</text>`}var za=6;function Ba(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:f` data-for="${l(e.forClass)}"`,s=[f`${n},${r}`,f`${n+i-za},${r}`,f`${n+i},${r+za}`,f`${n+i},${r+a}`,f`${n},${r+a}`].join(` `),c=f`${n+i-za},${r} ${n+i},${r+za} `+f`${n+i-za},${r+za}`;return f`<g class="class-note"${o}>`+f`\n <polygon points="${s}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n <polygon points="${c}" `+f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n ${T(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
37
+ </g>`}function Va(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>f`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:f` data-for="${l(e.forClass)}"`;return f`<polyline class="class-note-link"${n} points="${t}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.connector}" stroke-dasharray="2 3" />`}function Ha(e){if(e.points.length<2)return``;let t=e.points.map(e=>f`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=Wa(e.type,e.markerAt),i=[`class="class-relationship"`,f`data-from="${l(e.from)}"`,f`data-to="${l(e.to)}"`,f`data-type="${e.type}"`,f`data-marker-at="${e.markerAt}"`];return e.label&&i.push(f`data-label="${l(e.label)}"`),e.fromCardinality&&i.push(f`data-from-cardinality="${l(e.fromCardinality)}"`),e.toCardinality&&i.push(f`data-to-cardinality="${l(e.toCardinality)}"`),f`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+f`stroke-width="${R.connector}"${n}${r} />`}function Ua(e,t){let n=e.interfaceLabel;if(!n)return``;let r=e.markerAt===`from`?e.from:e.to;return f`<g class="class-interface" data-id="${l(r)}" data-label="${l(n.text)}">\n `+T(n.text,n.x+n.width/2,n.y+n.height/2,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text)"`)+`
38
+ </g>`}function Wa(e,t){let n=Ga(e);return n?(t===`to`?``:f` marker-start="url(#${n})"`)+(t===`from`?``:f` marker-end="url(#${n})"`):``}function Ga(e){switch(e){case`inheritance`:case`realization`:return`cls-inherit`;case`composition`:return`cls-composition`;case`aggregation`:return`cls-aggregation`;case`association`:case`dependency`:return`cls-arrow`;case`lollipop`:return`cls-lollipop`;default:return null}}function Ka(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=qa(e.points,e.labelPosition??Ja(e.points)),i=y(e.label,t.edgeLabel,L.edgeLabel);n.push(E(e.label,r.x,r.y,i.width,i.height,t.edgeLabel,4,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`,`class="class-relationship-label-bg" fill="var(--bg)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=Ya(r,i,`start`);n.push(T(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="${a.anchor}" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`))}if(e.toCardinality&&e.points.length>=2){let r=e.points[e.points.length-1],i=e.points[e.points.length-2],a=Ya(r,i,`end`);n.push(T(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="${a.anchor}" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
39
+ `)}function qa(e,t){let n=e[0],r=1/0;for(let i=1;i<e.length;i++){let a=e[i-1],o=e[i],s=o.x-a.x,c=o.y-a.y,l=s*s+c*c,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)),d={x:a.x+u*s,y:a.y+u*c},f=(d.x-t.x)**2+(d.y-t.y)**2;f<r&&(r=f,n=d)}return n}function Ja(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function Ya(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.max(Math.hypot(r,i),1e-6),o=r/a,s=i/a,c=n===`start`?1:-1,[l,u]=[o*c,s*c],d=(n===`start`?-u:u)*Xa,f=(n===`start`?l:-l)*Xa,p=f+s*Xa;if(Math.abs(d)>Math.abs(f)){let e=Math.sign(d);return{x:e*Za+o*Xa,y:p,anchor:e>0?`start`:`end`}}return{x:d+o*Xa,y:p,anchor:`middle`}}var Xa=12,Za=5,Qa=u,G={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90,loopOut:20,loopHalf:10,loopLabelGap:4,loopNestGap:16,loopMargin:12};function $a(e,t,n){let r=Ye(n.fontSizes).edgeLabel,i=[];for(let[n,a]of e.relationships.entries()){if(a.entity1!==t||a.entity2!==t)continue;let e=i[i.length-1],o=a.label?y(a.label,r,L.edgeLabel).width+8:0;i.push({index:n,nest:i.length,out:e?e.out+G.loopLabelGap+e.labelW+G.loopNestGap:G.loopOut,labelW:o})}return i}function eo(e){return e.length*Math.ceil(Ge(`M`,G.attrFontSize))}function to(e,t){let n=new Map,r=Ye(t.fontSizes);for(let t of e.entities){let e=I(t.label,r.nodeLabel,L.nodeLabel),i=0;for(let e of t.attributes){let t=eo(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(G.minWidth,e+G.boxPadX*2,i+G.boxPadX*2),o=G.headerHeight+t.attributes.length*G.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(st(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())n.entity1!==n.entity2&&o.push(ut({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));let s=0;for(let n of e.entities){let r=$a(e,n.id,t),i=r[r.length-1];i&&(s=Math.max(s,i.out+i.labelW))}return{elkGraph:{id:`root`,layoutOptions:{...ot({direction:it(e.direction,rt.er),nodeSpacing:Math.max(G.nodeSpacing,s+20),layerSpacing:Math.max(G.layerSpacing,s+20),padding:G.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.separateConnectedComponents":`false`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:i,edges:o},entitySizes:n}}function no(e,t,n,r){let i=new Map;for(let e of t.entities)i.set(e.id,e);let a=[];for(let r of e.children??[]){let e=i.get(r.id);if(e){let i=n.get(e.id);if(!i)throw Error(`Missing computed size for entity "${e.id}"`);a.push({id:e.id,label:e.label,attributes:e.attributes,x:r.x??0,y:r.y??0,width:r.width??i.width,height:r.height??i.height,headerHeight:G.headerHeight,rowHeight:G.rowHeight,inlineStyle:D(e.id,t),className:t.classAssignments.get(e.id)})}}let o=new Map((e.edges??[]).map(e=>[e.id,e])),s=[],c=1/0;for(let[e,n]of t.relationships.entries()){let i={entity1:n.entity1,entity2:n.entity2,cardinality1:n.cardinality1,cardinality2:n.cardinality2,label:n.label,identifying:n.identifying};if(n.entity1!==n.entity2){s.push({...i,points:sn(o.get(`e${e}`))});continue}let l=a.find(e=>e.id===n.entity1),u=$a(t,n.entity1,r).find(t=>t.index===e),d=l.y+l.height/2,f=Math.max(G.loopHalf,l.height/8)+10*u.nest,p=l.x-u.out;s.push({...i,points:[{x:l.x,y:d-f},{x:p,y:d-f},{x:p,y:d+f},{x:l.x,y:d+f}],labelPoint:{x:p-G.loopLabelGap-u.labelW/2,y:d}}),c=Math.min(c,p-G.loopLabelGap-u.labelW)}let l=Math.max(0,G.loopMargin-c);if(l>0){for(let e of a)e.x+=l;for(let e of s){for(let t of e.points)t.x+=l;e.labelPoint&&(e.labelPoint.x+=l)}}return{width:(e.width??600)+l,height:e.height??400,entities:a,relationships:s}}function ro(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=to(e,t);return no(He(n,t.layoutCache),e,r,t)}var io=70,ao={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function oo(e,t,n=`Inter`,r=!1,i=Je,a,o,s,c={}){let l=[];l.push($i(M(e.width,e.height,t,r,o,s,void 0,c.styleAttribute,c.description),a)),l.push(et(n,!0,c.nonce,c.bodyFont)),l.push(`<defs>`),l.push(`</defs>`);for(let t of e.relationships)l.push(lo(t));for(let t of e.entities)l.push(so(t,i));for(let t of e.relationships)l.push(fo(t));for(let t of e.relationships)l.push(uo(t,i));return l.push(`</svg>`),l.join(`
40
+ `)}function so(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:s,rowHeight:c,label:u,attributes:d,inlineStyle:p}=e,m=[],h=l(p?.fill??`var(--_node-fill)`),_=l(p?.stroke??`var(--_node-stroke)`),v=l(p?.[`stroke-width`]??String(R.outerBox)),y=l(p?.[`stroke-width`]??String(R.innerBox)),b=p?.fill?h:`var(--_group-hdr)`,x=p?.color?l(p.color):p?.fill?l(g(p.fill,`var(--_text)`)):void 0,S=k(e.className);m.push(f`<g class="${S?f`entity ${S}`:`entity`}" data-id="${l(n)}" data-label="${l(u)}">`),m.push(f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+f`rx="0" ry="0" fill="${h}" stroke="${_}" stroke-width="${v}" />`),m.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${b}" stroke="${_}" stroke-width="${v}" />`),m.push(` `+T(u,r+a/2,i+s/2,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${x??`var(--_text)`}"`));let C=i+s;d.length>0&&m.push(f` <line x1="${r}" y1="${C}" x2="${r+a}" y2="${C}" `+f`stroke="${_}" stroke-width="${y}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=C+e*c+c/2;m.push(` `+co(t,r,n,a,x).replace(/\n/g,`
41
+ `))}return m.push(`</g>`),m.join(`
42
+ `)}function co(e,t,n,r,i){let a=[],o=e.comment&&e.comment.length>0;if(e.comment&&e.comment.length>0){let t=e.comment.replace(/<br\s*\/?>/gi,`
43
+ `);a.push(f`<g><title>${ho(t)}</title>`)}let s=0;e.keys.length>0&&(s=I(e.keys.join(`,`),ao.keySize,ao.keyWeight)+8,a.push(f`<rect x="${t+6}" y="${n-7}" width="${s}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),a.push(f`<text x="${t+6+s/2}" y="${n}" text-anchor="middle" dy="${z}" `+f`font-size="${ao.keySize}" font-weight="${ao.keyWeight}" fill="${i??`var(--_text-sec)`}">${e.keys.join(`,`)}</text>`));let c=t+8+(s>0?s+6:0);a.push(f`<text x="${c}" y="${n}" class="mono" dy="${z}" `+f`font-size="${ao.attrSize}" font-weight="${ao.attrWeight}">`+f`<tspan fill="${i??`var(--_text-muted)`}">${ho(e.type)}</tspan></text>`);let l=t+r-8;return a.push(f`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${z}" `+f`font-size="${ao.attrSize}" font-weight="${ao.attrWeight}">`+f`<tspan fill="${i??`var(--_text-sec)`}">${ho(e.name)}</tspan></text>`),o&&a.push(`</g>`),a.join(`
44
+ `)}function lo(e){if(e.points.length<2)return``;let t=e.points.map(e=>f`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?f` data-label="${l(e.label)}"`:``,i=[`class="er-relationship"`,f`data-entity1="${l(e.entity1)}"`,f`data-entity2="${l(e.entity2)}"`,f`data-cardinality1="${e.cardinality1}"`,f`data-cardinality2="${e.cardinality2}"`,f`data-identifying="${e.identifying}"`];return f`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+f`stroke-width="${R.connector}"${n} />`}function uo(e,t){if(!e.label||e.points.length<2)return``;let n=e.labelPoint??mo(e.points),r=y(e.label,t.edgeLabel,L.edgeLabel),i=r.width+8,a=r.height+6;return f`<rect x="${n.x-i/2}" y="${n.y-a/2}" width="${i}" height="${a}" rx="2" ry="2" `+`fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />`+f`\n${T(e.label,n.x,n.y,t.edgeLabel,f`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${L.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${io}%, var(--bg))"`)}`}function fo(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(po(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(po(i,a,e.cardinality2)),t.join(`
45
+ `)}function po(e,t,n){let r=[],i=R.connector+.25,a=e.x-t.x,o=e.y-t.y,s=Math.sqrt(a*a+o*o);if(s===0)return``;let c=a/s,l=o/s,u=-l,d=c,p=e.x-c*4,m=e.y-l*4,h=e.x-c*16,g=e.y-l*16,_=n===`one`||n===`zero-one`,v=n===`many`||n===`zero-many`,y=n===`zero-one`||n===`zero-many`;if(_){r.push(f`<line x1="${p+u*6}" y1="${m+d*6}" `+f`x2="${p-u*6}" y2="${m-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-c*4,t=m-l*4;r.push(f`<line x1="${e+u*6}" y1="${t+d*6}" `+f`x2="${e-u*6}" y2="${t-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(f`<line x1="${e+u*7}" y1="${t+d*7}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(f`<line x1="${e}" y1="${t}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(f`<line x1="${e-u*7}" y1="${t-d*7}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-c*20,n=e.y-l*20;r.push(f`<line x1="${t+u*6}" y1="${n+d*6}" `+f`x2="${t-u*6}" y2="${n-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(y){let t=v?20:12,n=e.x-c*t,a=e.y-l*t;r.push(f`<circle cx="${n}" cy="${a}" r="4" `+f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
46
+ `)}function mo(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}if(t===0)return e[0];let n=t/2,r=0;for(let t=1;t<e.length;t++){let i=e[t].x-e[t-1].x,a=e[t].y-e[t-1].y,o=Math.sqrt(i*i+a*a);if(r+o>=n){let s=o>0?(n-r)/o:0;return{x:e[t-1].x+i*s,y:e[t-1].y+a*s}}r+=o}return e[e.length-1]}var ho=u,go={padding:30,actorGap:140,actorHeight:40,actorPadX:16,headerGap:20,messageRowHeight:40,selfMessageHeight:30,activationWidth:10,blockPadX:10,blockPadTop:40,blockPadBottom:8,blockHeaderExtra:28,dividerExtra:24,noteWidth:60,notePadX:12,notePadY:6,noteGap:10,noteOffsetAfterMessage:8,noteStackGap:4,boxPad:10,titleBand:36},_o=60,vo=45,yo=20;function bo(e){return e+8}var xo=14,So=new Set([`boundary`,`control`,`entity`,`database`]);function Co(e){return e.type===`actor`||So.has(e.participantType)}var wo=4;function To(e,t,n){return 14+y(e,t,n).height/2}function Eo(e){return{...go,actorHeight:e?.actorHeight??go.actorHeight,headerGap:e?.headerGap??go.headerGap,messageRowHeight:e?.messageRowHeight??go.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??go.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??go.noteStackGap}}var Do=16;function Oo(e,t,n=L.edgeLabel){return y(e,t,n).width}function ko(e){return e.blockPadX+e.activationWidth/2}function Ao(e,t){return e.type===`rect`&&e.color!==void 0?0:Oo(e.type,t,L.groupHeader)+16}function jo(e,t){let n=e=>e?Oo(`[${e}]`,t)+16:0;return Math.max(Ao(e,t)+n(e.label),...e.dividers.map(e=>n(e.label)))}function Mo(e,n){return e?(e.split(`
47
+ `).length-1)*n*t:0}function No(e){return e.map((t,n)=>e.slice(0,n).flatMap((e,n)=>e.startIndex>=t.startIndex&&e.endIndex<=t.endIndex?[n]:[]))}function Po(e,t,n,r,i){let a=new Map(e.actors.map((e,t)=>[e.id,t])),o=(e,t,r)=>{if(e<0||t>=n.length)return;let i=0;for(let r=e+1;r<=t;r++)i+=n[r];if(i>=r)return;let a=(r-i)/(t-e);for(let r=e+1;r<=t;r++)n[r]+=a};for(let t of e.messages){if(!t.label)continue;let e=a.get(t.from),n=a.get(t.to),r=Oo(t.label,i);e===n?(o(e-1,e,r/2+Do),o(e,e+1,r/2+Do)):o(Math.min(e,n),Math.max(e,n),r+32)}for(let n of e.notes){let e=a.get(n.actorIds[0]??``),s=Math.max(r.noteWidth,Oo(n.text,i)+r.notePadX*2),c=t[e]/2+r.noteGap+s+Do;if(n.position===`right`)o(e,e+1,c);else if(n.position===`left`)o(e-1,e,c);else if(n.actorIds.length===1)o(e,e+1,s/2+Do),o(e-1,e,s/2+Do);else{let t=a.get(n.actorIds[n.actorIds.length-1]);o(Math.min(e,t),Math.max(e,t),s-50)}}for(let t of e.blocks){let n=e.messages.slice(t.startIndex,t.endIndex+1).flatMap(e=>[a.get(e.from),a.get(e.to)]);o(Math.min(...n),Math.max(...n),jo(t,i)-2*ko(r))}}function Fo(e,n={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[],footerActors:[]};let r=Eo(n.sequence),i=Ye(n.fontSizes),a=e.actors.map(e=>{let t=I(e.label,i.nodeLabel,L.nodeLabel);return Math.max(t+r.actorPadX*2,80)}),o=a.map((e,t)=>t===0?0:Math.max(r.actorGap,(a[t-1]+e)/2+40));Po(e,a,o,r,i.edgeLabel);let s=[],c=r.padding+a[0]/2;for(let t=0;t<e.actors.length;t++)c+=o[t],s.push(c);let l=new Map;for(let t=0;t<e.actors.length;t++)l.set(e.actors[t].id,t);let u=e.boxes.filter(e=>e.actorIds.length>0),d=u.some(e=>e.label!==``),f=u.length===0?0:r.boxPad+(d?bo(i.edgeLabel):0),p=e.title?r.titleBand:0,m=r.padding+p,h=m+f,g=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,...e.participantType!==void 0&&{participantType:e.participantType},x:s[t],y:h,width:a[t],height:r.actorHeight})),_=u.map(e=>{let t=e.actorIds.map(e=>l.get(e)??0),n=Math.min(...t),i=Math.max(...t),o=s[n]-a[n]/2-r.boxPad,c=s[i]+a[i]/2+r.boxPad,u={label:e.label,x:o,y:m,width:c-o,height:0};return e.color!==void 0&&(u.color=e.color),u}),v=e.actors.map(e=>Co(e)?To(e.label,i.nodeLabel,L.nodeLabel):0),b=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?v[t]:0)),x=i.edgeLabel+12,S=h+r.actorHeight+Math.max(r.headerGap,b>0?b+wo+x:0),C=[],w=new Map,T=new Map,E=new Map;for(let t of e.blocks){let e=Mo(t.label,i.edgeLabel);E.set(t.startIndex,(E.get(t.startIndex)??0)+e),w.set(t.startIndex,(w.get(t.startIndex)??0)+r.blockHeaderExtra+e);for(let e of t.dividers)T.set(e.index,r.dividerExtra+Mo(e.label,i.edgeLabel))}let D=No(e.blocks),O=new Map;e.blocks.forEach((e,t)=>{let n=O.get(e.endIndex)??[];n.push(t),O.set(e.endIndex,n)});let k=[],A=t=>e.notes.slice(t.noteStartIndex,t.noteEndIndex),j=new Map;for(let t of e.notes){let e=j.get(t.afterIndex)??[];e.push(t),j.set(t.afterIndex,e)}let ee=[],te=new Map,ne=(e,n)=>{let o=Math.max(r.noteWidth,Oo(e.text,i.edgeLabel)+r.notePadX*2),c=e.text.split(`
48
+ `).length,u=i.edgeLabel*(1+(c-1)*t)+r.notePadY*2,d=l.get(e.actorIds[0]??``)??0,f;if(e.position===`left`)f=s[d]-a[d]/2-o-r.noteGap;else if(e.position===`right`)f=s[d]+a[d]/2+r.noteGap;else if(e.actorIds.length>1){let t=l.get(e.actorIds[e.actorIds.length-1]??``)??d,n=s[d],r=s[t];o=Math.max(o,Math.abs(n-r)+50),f=(n+r)/2-o/2}else f=s[d]-o/2;let p={text:e.text,x:f,y:n,width:o,height:u,position:e.position,actors:e.actorIds};return ee.push(p),te.set(e,p),n+u+r.noteStackGap},re=j.get(-1);if(re&&re.length>0){let e=S;for(let t of re)e=ne(t,e);S=Math.max(S,e+r.messageRowHeight/2)}let M=new Map,N=[],P=r.activationWidth/2;function ie(e,t){let n=M.get(e)??[];M.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function ae(e,t){let n=M.get(e);if(!n||n.length===0)return;let{startY:i,depth:a}=n.pop(),o=l.get(e)??0,c=a*P;N.push({actorId:e,x:s[o]-r.activationWidth/2+c,topY:i,bottomY:t,width:r.activationWidth,depth:a})}let oe=new Map;for(let t of e.activations){let e=oe.get(t.afterIndex)??[];e.push(t),oe.set(t.afterIndex,e)}function se(e,t){for(let n of oe.get(e)??[])n.kind===`start`?ie(n.actorId,t):ae(n.actorId,t)}se(-1,S);let ce=[];for(let t=0;t<e.messages.length;t++){let n=e.messages[t],o=l.get(n.from)??0,c=l.get(n.to)??0,u=n.from===n.to;S+=(w.get(t)??0)+(T.get(t)??0);let d=Mo(n.label,i.edgeLabel);S+=d,ce[t]=d;let f=s[o],p=s[c],m=!u&&e.actors[c].createdAt===t;if(m){let e=a[c]/2;p+=f<p?-e:e}C.push({from:n.from,to:n.to,label:n.label,lineStyle:n.lineStyle,arrowHead:n.arrowHead,x1:f,x2:p,y:S,isSelf:u,bidirectional:n.bidirectional??!1,...n.isLost&&{isLost:!0},seqNumber:n.seqNumber}),n.activate&&ie(n.to,S),n.deactivate&&ae(n.from,S),se(t,S),S+=u?r.selfMessageHeight+r.messageRowHeight:r.messageRowHeight,m&&(S+=r.actorHeight/2);let h=n=>{let i=C[t].y+(u?20:0)+r.blockPadBottom+12;for(let t of A(e.blocks[n])){let e=te.get(t);i=Math.max(i,e.y+e.height+r.blockPadBottom)}for(let e of D[n])i=Math.max(i,k[e]+r.blockPadBottom);k[n]=i,S=Math.max(S,i+r.messageRowHeight/2)},g=O.get(t)??[],_=j.get(t);if(_&&_.length>0){let n=u?r.selfMessageHeight:0,i=C[t].y+n+r.noteOffsetAfterMessage;for(let t of _){let n=e.notes.indexOf(t);for(let t of g)k[t]===void 0&&e.blocks[t].noteEndIndex<=n&&(h(t),i=Math.max(i,k[t]+r.noteOffsetAfterMessage));i=ne(t,i)}S=Math.max(S,i+r.messageRowHeight/2)}for(let e of g)k[e]===void 0&&h(e)}for(let[e,t]of M)for(let{startY:n,depth:i}of t){let t=l.get(e)??0,a=i*P;N.push({actorId:e,x:s[t]-r.activationWidth/2+a,topY:n,bottomY:S-r.messageRowHeight/2,width:r.activationWidth,depth:i})}N.sort((e,t)=>e.depth-t.depth);let le=[];e.blocks.forEach((t,n)=>{let a=D[n].map(e=>le[e]),o=(C[t.startIndex]?.y??S)-r.blockPadTop-E.get(t.startIndex)-(ce[t.startIndex]??0);for(let e of a)o=Math.min(o,e.y-r.blockHeaderExtra);let c=k[n]??S+r.blockPadBottom+12,u=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(u.add(l.get(t.from)??0),u.add(l.get(t.to)??0))}if(u.size===0)for(let t=0;t<e.actors.length;t++)u.add(t);let d=Math.min(...u),f=Math.max(...u),p=ko(r),m=s[d]-p,h=s[f]+p;for(let n of e.messages.slice(t.startIndex,t.endIndex+1)){if(n.from!==n.to)continue;let e=s[l.get(n.from)],t=Oo(n.label,i.edgeLabel)/2;m=Math.min(m,e-t-r.blockPadX),h=Math.max(h,e+Math.max(45,t)+r.blockPadX)}for(let e of N){let t=l.get(e.actorId);t<d||t>f||e.topY>=c||e.bottomY<=o||(h=Math.max(h,e.x+e.width+r.blockPadX))}for(let e of A(t)){let t=te.get(e);m=Math.min(m,t.x-r.blockPadX),h=Math.max(h,t.x+t.width+r.blockPadX)}for(let e of a)m=Math.min(m,e.x-r.blockPadX),h=Math.max(h,e.x+e.width+r.blockPadX);let g=jo(t,i.edgeLabel)-(h-m);g>0&&(m-=g/2,h+=g/2);let _=t.dividers.map(t=>{let o=a.filter((r,i)=>e.blocks[D[n][i]].startIndex===t.index);if(o.length>0)return{y:Math.min(...o.map(e=>e.y))-r.dividerExtra,label:t.label};let s=C[t.index];return{y:(s?.y??S)-((t.label&&s?.label?40:28)+Mo(t.label,i.edgeLabel)+(ce[t.index]??0)),label:t.label}});le.push({type:t.type,label:t.label,...t.color===void 0?{}:{color:t.color},x:m,y:o,width:h-m,height:c-o,dividers:_})});let ue=ee,de=S,fe=e.mirrorActors!==!1,pe=Math.max(0,...e.actors.map((e,t)=>e.destroyedAt===void 0&&v[t]>0?v[t]+wo:0)),me=de+(fe?r.actorHeight+pe:0)+r.padding,he=r.padding,F=0;for(let e of g)he=Math.min(he,e.x-e.width/2),F=Math.max(F,e.x+e.width/2);for(let e of le)he=Math.min(he,e.x),F=Math.max(F,e.x+e.width);for(let e of ue)he=Math.min(he,e.x),F=Math.max(F,e.x+e.width);for(let e of _)he=Math.min(he,e.x),F=Math.max(F,e.x+e.width);for(let e of C)if(e.isSelf&&(F=Math.max(F,e.x1+45+8),e.label)){let t=I(e.label,i.edgeLabel,L.edgeLabel)/2+8;F=Math.max(F,e.x1+t),he=Math.min(he,e.x1-t)}let ge=he<r.padding?r.padding-he:0;if(ge>0){for(let e of g)e.x+=ge;for(let e of C)e.x1+=ge,e.x2+=ge;for(let e of N)e.x+=ge;for(let e of le)e.x+=ge;for(let e of ue)e.x+=ge;for(let e of _)e.x+=ge;for(let e=0;e<s.length;e++)s[e]+=ge}for(let t=0;t<e.actors.length;t++){let n=e.actors[t].createdAt;n!==void 0&&(g[t].y=(C[n]?.y??S)-r.actorHeight/2)}let _e=e.actors.map((e,t)=>{let n=e.destroyedAt,i={actorId:e.id,x:s[t],topY:g[t].y+r.actorHeight+(v[t]>0?v[t]+wo:0),bottomY:n===void 0?de:C[n]?.y??S};return n!==void 0&&(i.destroyed=!0),i}),ve=g.filter((t,n)=>fe&&e.actors[n].destroyedAt===void 0).map(e=>({...e,y:de}));for(let e of _)e.height=me-r.padding+r.boxPad-e.y;let ye=e.title?y(e.title,18,L.groupHeader).width+2*r.padding:0,be=F+ge+r.padding;return{width:Math.max(be,ye,200),height:Math.max(me,100),actors:g,lifelines:_e,messages:C,activations:N,blocks:le,notes:ue,boxes:_,footerActors:ve,...e.title&&{title:{text:e.title,y:r.padding+9}}}}function Io(e,t,n=`Inter`,i=!1,a=Je,o,s,c,l={}){let u=[];u.push($i(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push(r(n,!1,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(Lo()),u.push(`</defs>`);for(let t of e.boxes)u.push(ns(t,a));for(let t of e.blocks.toReversed())rs(t)&&u.push(is(t,a));let d=Jo(e,a);for(let t of e.lifelines)u.push(Xo(t,d));for(let t of e.activations)u.push(Qo(t));for(let t of e.blocks)rs(t)||u.push(is(t,a));for(let t of e.messages)u.push($o(t,a));for(let t of e.notes)u.push(as(t,a));for(let t of e.actors)u.push(zo(t,a));for(let t of e.footerActors)u.push(zo(t,a,`actor-footer`));return e.title&&u.push(`<g class="title">`+T(e.title.text,e.width/2,e.title.y,18,f`font-size="${18}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text)"`)+`</g>`),u.push(`</svg>`),u.join(`
49
+ `)}function Lo(){let e=$e.width,t=$e.height;return f` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+f`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
50
50
  </marker>`+f`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+f`\n <polyline points="0 0, ${e} ${t/2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
51
- </marker>`}var oo={boundary:(e,t)=>`\n <circle cx="15" cy="12" r="8" ${e} />\n <path d="M1 6V18M1 12H7" ${t} />`,control:(e,t)=>`\n <circle cx="12" cy="13" r="9" ${e} />\n <path d="M13 1L10 4L13 7" ${t} />`,entity:(e,t)=>`\n <circle cx="12" cy="11" r="9" ${e} />\n <path d="M3 22H21" ${t} />`,database:(e,t)=>`\n <path d="M2 5A10 3.5 0 0 1 22 5V19A10 3.5 0 0 1 2 19Z" ${e} />\n <path d="M2 5A10 3.5 0 0 0 22 5" ${t} />`};function so(e,t){let{id:n,x:r,y:i,width:a,height:o,label:s,type:c,participantType:u}=e,d=[],p=f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${L.nodeLabel}" fill="var(--_text)"`;if(d.push(f`<g class="actor" data-id="${l(n)}" data-label="${l(s)}" data-type="${c}">`),c===`actor`){let e=o/24*.9,n=r-12*e,a=i+(o-24*e)/2,c=R.outerBox/e,l=`var(--_line)`;d.push(f` <g transform="translate(${n},${a}) scale(${e})">`+f`\n <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" fill="none" stroke="${l}" stroke-width="${c}" />`+f`\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${l}" stroke-width="${c}" />`+f`\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${l}" stroke-width="${c}" />`+`
52
- </g>`),d.push(` `+w(s,r,i+o+14,t.nodeLabel,p))}else if(Ja(e)){let e=o/24*.9,n=R.outerBox/e,a=f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${n}"`,c=f`fill="none" stroke="var(--_node-stroke)" stroke-width="${n}"`,l=oo[u](a,c);d.push(f` <g transform="translate(${r-12*e},${i+(o-24*e)/2}) scale(${e})">${l}\n </g>`),d.push(` `+w(s,r,i+o+14,t.nodeLabel,p))}else{let e=r-a/2,n=f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}"`,c=r,l=i+o/2;if(u===`queue`){let t=o/2,r=e+8,s=e+a-8;d.push(f` <path d="M${r},${i}H${s}A${8},${t} 0 0 1 ${s},${i+o}H${r}A${8},${t} 0 0 1 ${r},${i}Z" ${n} />`,f` <path d="M${s},${i}A${8},${t} 0 0 0 ${s},${i+o}" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`)}else u===`collections`?(d.push(f` <rect x="${e+4}" y="${i}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`,f` <rect x="${e}" y="${i+4}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`),c=r-2,l=i+2+(o-4)/2):d.push(f` <rect x="${e}" y="${i}" width="${a}" height="${o}" rx="4" ry="4" ${n} />`);d.push(` `+w(s,c,l,t.nodeLabel,p))}return d.push(`</g>`),d.join(`
53
- `)}var co=10,lo=18,uo=3,fo=2,po=3;function mo(e,t){let n=[],r=e=>v(e,t.edgeLabel,L.edgeLabel),i=(e,t,i)=>{let a=r(e);n.push({x0:t-a.width/2,x1:t+a.width/2,y0:i-a.height/2,y1:i+a.height/2})},a=(e,t,i)=>{let a=r(e);n.push({x0:t,x1:t+a.width,y0:i-a.height/2,y1:i+a.height/2})};for(let t of e.messages)!t.label||t.isSelf||i(t.label,(t.x1+t.x2)/2,t.y-co);for(let r of e.blocks){if(Co(r))continue;let e=I(`${r.type}${r.label?` [${r.label}]`:``}`.split(`
54
- `)[0]??``,t.edgeLabel,L.groupHeader)+16;n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+lo});for(let e of r.dividers)e.label&&a(`[${e.label}]`,r.x+8,e.y+14)}return n}function ho(e,t){let n=t.filter(t=>e.x>t.x0-uo&&e.x<t.x1+uo&&t.y1+fo>e.topY&&t.y0-fo<e.bottomY).map(e=>[e.y0-fo,e.y1+fo]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=po&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=po&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function go(e,t){let n=ho(e,t).map(([t,n])=>f`<line class="lifeline" data-actor="${l(e.actorId)}" `+f`x1="${e.x}" y1="${t}" x2="${e.x}" y2="${n}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
55
- `);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=_o;return n+f`\n<path class="destroy" data-actor="${l(e.actorId)}" `+f`d="M${r-a} ${i-a} L${r+a} ${i+a} M${r+a} ${i-a} L${r-a} ${i+a}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.outerBox}" stroke-linecap="round" />`}var _o=8;function vo(e){return f`<rect class="activation" data-actor="${l(e.actorId)}" `+f`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`}function yo(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?f` marker-start="url(#${i})"`:``;return n.push(f`<g class="message" data-from="${l(e.from)}" data-to="${l(e.to)}" `+f`data-label="${l(e.label)}" data-line-style="${e.lineStyle}" `+f`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`),e.isSelf?n.push(f` <path d="M ${e.x1},${e.y} C ${e.x1+60},${e.y-10} ${e.x1+60},${e.y+20+10} ${e.x2},${e.y+20}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`):n.push(f` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+f`stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+w(e.label,(e.x1+e.x2)/2,e.y-co,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)),e.seqNumber!==void 0&&n.push(` `+bo(e,t)),n.push(`</g>`),n.join(`
56
- `)}function bo(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+Qe.width):e.x1;return`<g class="seq-number">`+f`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${R.innerBox}" />`+w(String(e.seqNumber),r,e.y,n,f`font-size="${n}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var xo=35;function So(e,t){let n=e.label?f` data-label="${l(e.label)}"`:``,r=e.color===void 0?``:f` data-color="${l(e.color)}"`,i=e.color===void 0?`none`:f`color-mix(in srgb, ${l(e.color)} ${xo}%, var(--bg))`,a=[f`<g class="participant-box"${n}${r}>`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+f`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`];return e.label&&a.push(` `+w(e.label,e.x+e.width/2,e.y+Ga(t.edgeLabel)/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
57
- `)}function Co(e){return e.type===`rect`&&e.color!==void 0}function wo(e,t){let n=[];if(Co(e))return[f`<g class="block" data-type="rect" data-color="${l(e.color)}">`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`fill="${l(e.color)}" />`,`</g>`].join(`
58
- `);let r=e.label?f` data-label="${l(e.label)}"`:``;n.push(f`<g class="block" data-type="${l(e.type)}"${r}>`),n.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`);let i=f`${e.type}${e.label?f` [${e.label}]`:``}`,a=i.split(`
59
- `)[0],o=I(a,t.edgeLabel,L.groupHeader)+16,s=lo;n.push(f` <rect x="${e.x}" y="${e.y}" width="${o}" height="${s}" `+f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),n.push(` `+w(i,e.x+6,e.y+s/2,t.edgeLabel,f`font-size="${t.edgeLabel}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(f` <line x1="${e.x}" y1="${r.y}" x2="${e.x+e.width}" y2="${r.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),r.label&&n.push(` `+w(f`[${r.label}]`,e.x+8,r.y+14,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
60
- `)}function To(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?f` data-actors="${e.actors.map(l).join(`,`)}"`:``,s=e.position?f` data-position="${l(e.position)}"`:``,c=[f`${n},${r}`,f`${n+i-6},${r}`,f`${n+i},${r+6}`,f`${n+i},${r+a}`,f`${n},${r+a}`].join(` `);return f`<g class="note"${s}${o}>`+f`\n <polygon points="${c}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n ${w(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
61
- </g>`}var K={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function Eo(e,t={}){return e.horizontal?Oo(e):Do(e)}function Do(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=S(a.min,a.max),s=Io(o),c=Math.max(...s.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight)),K.yLabelWidth),l=K.padding+(t?K.titleHeight:0)+(i?K.legendHeight:0),u=K.padding+K.xLabelHeight+(n?K.axisTitlePad:0),d=K.padding+c+K.yLabelGap+(r?K.axisTitlePad:0),f=K.padding,p=K.plotWidth,m=K.plotHeight,h=d+p+f,g=l+m+u,_={x:d,y:l,width:p,height:m},v=ko(e),y=e=>d+(e+.5)*(p/v),b=p/v,x=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},C=No(e,y,l+m,b),w=o.map((e,t)=>({label:s[t],x:d,y:x(e),tx:d-K.tickLength,ty:x(e),labelX:d-K.yLabelGap,labelY:x(e),textAnchor:`end`})),T=o.map(e=>({x1:d,y1:x(e),x2:d+p,y2:x(e)})),E=Ao(e,v),D=e.series.map((e,t)=>t),O=Po(e,y,x,b,a.min,E,D),k=Fo(e,y,x,E,D),ee=K.padding+(t?K.titleHeight:0)+K.legendHeight/2,A=i?Ro(e,h/2,ee,D):[],j={x1:d,y1:l+m,x2:d+p,y2:l+m},te={x1:d,y1:l,x2:d,y2:l+m},ne={ticks:C,line:j,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-K.padding}}:{}},M={ticks:w,line:te,...e.yAxis.title?{title:{text:e.yAxis.title,x:K.padding+4,y:l+m/2,rotate:-90}}:{}};return{width:h,height:g,title:e.title?{text:e.title,x:h/2,y:K.padding+K.titleFontSize}:void 0,xAxis:ne,yAxis:M,plotArea:_,bars:O,lines:k,gridLines:T,legend:A}}function Oo(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=S(a.min,a.max),s=Io(o),c=ko(e),l=Ao(e,c),u=Math.max(...l.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight)),40),d=K.padding+(t?K.titleHeight:0)+(i?K.legendHeight:0),f=K.padding+K.xLabelHeight+(r?K.axisTitlePad:0),p=K.padding+u+K.yLabelGap+(n?K.axisTitlePad:0),m=Math.max(K.padding,I(s[s.length-1],K.axisLabelFontSize,K.axisLabelFontWeight)/2+4),h=K.plotWidth,g=K.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},b=e=>{let t=(e-a.min)/(a.max-a.min||1);return p+t*h},x=g/c,C=e=>d+(e+.5)*x,w=o.map((e,t)=>({label:s[t],x:b(e),y:d+g,tx:b(e),ty:d+g+K.tickLength,labelX:b(e),labelY:d+g+18,textAnchor:`middle`})),T=l.map((e,t)=>({label:e,x:p,y:C(t),tx:p-K.tickLength,ty:C(t),labelX:p-K.yLabelGap,labelY:C(t),textAnchor:`end`})),E=o.map(e=>({x1:b(e),y1:d,x2:b(e),y2:d+g})),D=e.series.map((e,t)=>t),O=e.series.filter(e=>e.type===`bar`).length,k=[];if(O>0){let t=x*(1-K.barPadRatio),n=O>1?(t-(O-1)*K.barGroupGap)/O:t,r=Math.min(n,K.maxBarWidth),i=O>1?r*O+K.barGroupGap*(O-1):r,o=0,s=0;for(let t of e.series){if(t.type!==`bar`){s++;continue}for(let e=0;e<t.data.length;e++){let n=C(e)-i/2+o*(r+K.barGroupGap),c=b(Math.max(t.data[e],a.min)),u=b(Math.max(0,a.min));k.push({x:Math.min(u,c),y:n,width:Math.abs(c-u),height:r,value:t.data[e],label:l[e],seriesIndex:o,colorIndex:D[s]})}o++,s++}}let ee=[],A=0,j=0;for(let t of e.series){if(t.type!==`line`){j++;continue}let e=t.data.map((e,t)=>({x:b(e),y:C(t),value:e,label:l[t]}));ee.push({points:e,seriesIndex:A,colorIndex:D[j]}),A++,j++}let te={x1:p,y1:d+g,x2:p+h,y2:d+g},ne={x1:p,y1:d,x2:p,y2:d+g},M={ticks:w,line:te,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-K.padding}}:{}},re={ticks:T,line:ne,...e.xAxis.title?{title:{text:e.xAxis.title,x:K.padding+4,y:d+g/2,rotate:-90}}:{}},N=e.title?{text:e.title,x:_/2,y:K.padding+K.titleFontSize}:void 0,ie=K.padding+(t?K.titleHeight:0)+K.legendHeight/2;return{width:_,height:v,horizontal:!0,title:N,xAxis:M,yAxis:re,plotArea:y,bars:k,lines:ee,gridLines:E,legend:i?Ro(e,_/2,ie,D):[]}}function ko(e){if(e.xAxis.categories)return e.xAxis.categories.length;for(let t of e.series)if(t.data.length>0)return t.data.length;return 1}function Ao(e,t){if(e.xAxis.categories)return e.xAxis.categories;if(e.xAxis.range){let{min:n,max:r}=e.xAxis.range,i=t>1?(r-n)/(t-1):0;return Array.from({length:t},(e,t)=>Lo(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var jo=8;function Mo(e,t){let n=e.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight));for(let r=1;r<e.length;r++){let i=!0;for(let a=0;a+r<e.length;a+=r)if(r*t-(n[a]+n[a+r])/2<jo){i=!1;break}if(i)return r}return Math.max(1,e.length)}function No(e,t,n,r){let i=Ao(e,ko(e)),a=Mo(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+K.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function Po(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-K.barPadRatio),l=s>1?(c-(s-1)*K.barGroupGap)/s:c,u=Math.min(l,K.maxBarWidth),d=s>1?u*s+K.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+K.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function Fo(e,t,n,r,i){let a=[],o=0,s=0;for(let c of e.series){if(c.type!==`line`){s++;continue}let e=c.data.map((e,i)=>({x:t(i),y:n(e),value:e,label:r[i]}));a.push({points:e,seriesIndex:o,colorIndex:i[s]}),o++,s++}return a}function Io(e){let t=e.length>1?Math.abs(e[1]-e[0]):0,n=t>0&&t<1?Math.ceil(-Math.log10(t)-1e-9):0;return e.map(e=>String(Number.isInteger(e)&&n===0?e:Number(e.toFixed(n))))}function Lo(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Ro(e,t,n,r){let i=[],a=0,o=0;for(let t=0;t<e.series.length;t++){let s=e.series[t],c=s.type===`bar`?`Bar ${a+1}`:`Line ${o+1}`;i.push({label:c,x:0,y:n,type:s.type,seriesIndex:s.type===`bar`?a:o,colorIndex:r[t]}),s.type===`bar`?a++:o++}let s=i.map(e=>{let t=I(e.label,K.legendFontSize,K.legendFontWeight);return K.legendSwatchW+K.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*K.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+K.legendItemGap;return i}var q={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},J={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function zo(e,t,n=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=Di(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push(r(n,!1,l.nonce,l.bodyFont));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Bo(e,a,m,t.accent,t.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=e,v=e.xAxis.ticks.map(e=>e.x),y=e.horizontal?e.yAxis.ticks.map(e=>e.y):e.gridLines.map(e=>e.y1),b=v.length>1?Math.abs(v[1]-v[0]):_.width/6,x=y.length>1?Math.abs(y[1]-y[0]):_.height/6,S=b/Math.max(1,Math.round(b/20)),C=x/Math.max(1,Math.round(x/20)),w=v[0]??_.x,T=y[0]??_.y,E=w-Math.ceil((w-_.x)/S)*S,D=T-Math.ceil((T-_.y)/C)*C;for(let e=D;e<=_.y+_.height+.5;e+=C)for(let t=E;t<=_.x+_.width+.5;t+=S)u.push(`<circle cx="${Y(t)}" cy="${Y(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let t of e.bars){let n=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,r=e.horizontal?Ho(t.x,t.y,t.width,t.height,q.barRadius):Vo(t.x,t.y,t.width,t.height,q.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),a){let e=qo(t.value),n=t.label?`${t.label}: ${e}`:e,r=Ko(t.x+t.width/2,t.y,e);O.push(`<g class="xychart-bar-group"><rect x="${Y(t.x)}" y="${Y(t.y)}" width="${Y(t.width)}" height="${Y(t.height)}" fill="transparent"/><title>${X(n)}</title>`+r+`</g>`)}}for(let t of e.lines){if(t.points.length===0)continue;let n=e.horizontal?Uo(t.points):Wo(t.points);u.push(`<path d="${n}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${n}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(a||m){let t=new Map;for(let n of e.legend)n.type===`line`&&t.set(n.seriesIndex,n.label);let n=new Map;for(let t of e.lines)for(let e of t.points){let r=Y(e.x),i=n.get(r)??[];n.set(r,i),i.push({x:e.x,y:e.y,value:e.value,label:e.label,seriesIndex:t.seriesIndex,colorIndex:t.colorIndex})}for(let e of n.values()){let n=e[0].x,r=e[0].label||``;if(a&&e.length>1){let i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.map(e=>e.y)),o=q.dotRadius*3,s=`<rect x="${Y(n-o)}" y="${Y(i-o)}" width="${Y(o*2)}" height="${Y(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=e.map(e=>({text:qo(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Go(n,i-q.dotRadius,r,c),u=c.map(e=>e.text),d=r?`${r}: ${u.join(` · `)}`:u.join(` · `),f=`<g class="xychart-dot-group">${s}`;for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`;f+=`<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`}f+=`<title>${X(d)}</title>${l}</g>`,k.push(f)}else if(a){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,i=qo(t.value),a=t.label?`${t.label}: ${i}`:i,o=Ko(n,t.y-q.dotRadius,i),s=m?`<circle cx="${Y(n)}" cy="${Y(t.y)}" r="${q.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${X(a)}</title>${o}</g>`)}else for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`;u.push(`<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`)}}}for(let t of e.xAxis.ticks)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${z}" class="xychart-label">${X(t.label)}</text>`);for(let t of e.yAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${z}" class="xychart-label">${X(t.label)}</text>`);if(e.xAxis.title){let t=e.xAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${z}" class="xychart-axis-title">${X(t.text)}</text>`)}if(e.yAxis.title){let t=e.yAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${z}" class="xychart-axis-title">${X(t.text)}</text>`)}e.title&&u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${q.titleSize}" font-weight="${q.titleWeight}" dy="${z}" class="xychart-title">${X(e.title.text)}</text>`);for(let t of e.legend){if(t.type===`bar`)u.push(`<rect x="${t.x}" y="${t.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);else{let e=t.y;u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x+14}" y2="${e}" stroke-width="${q.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`)}u.push(`<text x="${t.x+14+6}" y="${t.y}" text-anchor="start" font-size="${q.legendSize}" font-weight="${q.legendWeight}" dy="${z}" class="xychart-label">${X(t.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
62
- `)}function Bo(e,t,n,r,i,a){let o=r??ae,s=new Set;for(let t of e.bars)s.add(t.colorIndex);for(let t of e.lines)s.add(t.colorIndex);let c=[];for(let e of[...s].sort((e,t)=>e-t)){let t=e===0?`var(--accent, ${ae})`:le(e,o,i);c.push(` --xychart-color-${e}: ${t};`),c.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let l=[];for(let e of[...s].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;l.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),l.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),l.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let u=t?`
51
+ </marker>`+f`\n <marker id="seq-lost" markerWidth="${t*2}" markerHeight="${t*2}" refX="${t}" refY="${t}" orient="auto">`+f`\n <path d="M${t/2} ${t/2} L${t*1.5} ${t*1.5} M${t*1.5} ${t/2} L${t/2} ${t*1.5}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
52
+ </marker>`}var Ro={boundary:(e,t)=>`\n <circle cx="15" cy="12" r="8" ${e} />\n <path d="M1 6V18M1 12H7" ${t} />`,control:(e,t)=>`\n <circle cx="12" cy="13" r="9" ${e} />\n <path d="M13 1L10 4L13 7" ${t} />`,entity:(e,t)=>`\n <circle cx="12" cy="11" r="9" ${e} />\n <path d="M3 22H21" ${t} />`,database:(e,t)=>`\n <path d="M2 5A10 3.5 0 0 1 22 5V19A10 3.5 0 0 1 2 19Z" ${e} />\n <path d="M2 5A10 3.5 0 0 0 22 5" ${t} />`};function zo(e,t,n=`actor`){let{id:r,x:i,y:a,width:o,height:s,label:c,type:u,participantType:d}=e,p=[],m=f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${L.nodeLabel}" fill="var(--_text)"`;if(p.push(f`<g class="${n}" data-id="${l(r)}" data-label="${l(c)}" data-type="${u}">`),u===`actor`){let e=s/24*.9,n=i-12*e,r=a+(s-24*e)/2,o=R.outerBox/e,l=`var(--_line)`;p.push(f` <g transform="translate(${n},${r}) scale(${e})">`+f`\n <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" fill="none" stroke="${l}" stroke-width="${o}" />`+f`\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${l}" stroke-width="${o}" />`+f`\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${l}" stroke-width="${o}" />`+`
53
+ </g>`),p.push(` `+T(c,i,a+s+14,t.nodeLabel,m))}else if(Co(e)){let e=s/24*.9,n=R.outerBox/e,r=f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${n}"`,o=f`fill="none" stroke="var(--_node-stroke)" stroke-width="${n}"`,l=Ro[d](r,o);p.push(f` <g transform="translate(${i-12*e},${a+(s-24*e)/2}) scale(${e})">${l}\n </g>`),p.push(` `+T(c,i,a+s+14,t.nodeLabel,m))}else{let e=i-o/2,n=f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}"`,r=i,l=a+s/2;if(d===`queue`){let t=s/2,r=e+8,i=e+o-8;p.push(f` <path d="M${r},${a}H${i}A${8},${t} 0 0 1 ${i},${a+s}H${r}A${8},${t} 0 0 1 ${r},${a}Z" ${n} />`,f` <path d="M${i},${a}A${8},${t} 0 0 0 ${i},${a+s}" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`)}else d===`collections`?(p.push(f` <rect x="${e+4}" y="${a}" width="${o-4}" height="${s-4}" rx="4" ry="4" ${n} />`,f` <rect x="${e}" y="${a+4}" width="${o-4}" height="${s-4}" rx="4" ry="4" ${n} />`),r=i-2,l=a+2+(s-4)/2):p.push(f` <rect x="${e}" y="${a}" width="${o}" height="${s}" rx="4" ry="4" ${n} />`);p.push(` `+T(c,r,l,t.nodeLabel,m))}return p.push(`</g>`),p.join(`
54
+ `)}var Bo=10;function Vo(e,t){return e.y-Bo-Mo(e.label,t.edgeLabel)/2}function Ho(e,t){return e.y+Wo/2+Mo(e.label,t.edgeLabel)/2}function Uo(e,t){return e.y+14+Mo(e.label,t.edgeLabel)/2}var Wo=18,Go=3,Ko=2,qo=3;function Jo(e,t){let n=[],r=e=>y(e,t.edgeLabel,L.edgeLabel),i=(e,t,i)=>{let a=r(e);n.push({x0:t-a.width/2,x1:t+a.width/2,y0:i-a.height/2,y1:i+a.height/2})};for(let n of e.messages)!n.label||n.isSelf||i(n.label,(n.x1+n.x2)/2,Vo(n,t));for(let r of e.blocks){if(rs(r))continue;let e=Ao(r,t.edgeLabel);n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+Wo}),r.label&&i(`[${r.label}]`,r.x+(e+r.width)/2,Ho(r,t));for(let e of r.dividers)e.label&&i(`[${e.label}]`,r.x+r.width/2,Uo(e,t))}return n}function Yo(e,t){let n=t.filter(t=>e.x>t.x0-Go&&e.x<t.x1+Go&&t.y1+Ko>e.topY&&t.y0-Ko<e.bottomY).map(e=>[e.y0-Ko,e.y1+Ko]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=qo&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=qo&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function Xo(e,t){let n=Yo(e,t).map(([t,n])=>f`<line class="lifeline" data-actor="${l(e.actorId)}" `+f`x1="${e.x}" y1="${t}" x2="${e.x}" y2="${n}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
55
+ `);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=Zo;return n+f`\n<path class="destroy" data-actor="${l(e.actorId)}" `+f`d="M${r-a} ${i-a} L${r+a} ${i+a} M${r+a} ${i-a} L${r-a} ${i+a}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.outerBox}" stroke-linecap="round" />`}var Zo=8;function Qo(e){return f`<rect class="activation" data-actor="${l(e.actorId)}" `+f`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`}function $o(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.isLost?`seq-lost`:e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?f` marker-start="url(#${i})"`:``;return n.push(f`<g class="message" data-from="${l(e.from)}" data-to="${l(e.to)}" `+f`data-label="${l(e.label)}" data-line-style="${e.lineStyle}" `+f`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}"${e.isLost?` data-lost="true"`:``}>`),e.isSelf?n.push(f` <path d="M ${e.x1},${e.y} C ${e.x1+60},${e.y-10} ${e.x1+60},${e.y+20+10} ${e.x2},${e.y+20}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`):n.push(f` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+f`stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+T(e.label,(e.x1+e.x2)/2,Vo(e,t),t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)),e.seqNumber!==void 0&&n.push(` `+es(e,t)),n.push(`</g>`),n.join(`
56
+ `)}function es(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+$e.width):e.x1;return`<g class="seq-number">`+f`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${R.innerBox}" />`+T(String(e.seqNumber),r,e.y,n,f`font-size="${n}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var ts=35;function ns(e,t){let n=e.label?f` data-label="${l(e.label)}"`:``,r=e.color===void 0?``:f` data-color="${l(e.color)}"`,i=e.color===void 0?`none`:f`color-mix(in srgb, ${l(e.color)} ${ts}%, var(--bg))`,a=[f`<g class="participant-box"${n}${r}>`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+f`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`];return e.label&&a.push(` `+T(e.label,e.x+e.width/2,e.y+bo(t.edgeLabel)/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
57
+ `)}function rs(e){return e.type===`rect`&&e.color!==void 0}function is(e,t){let n=[];if(rs(e))return[f`<g class="block" data-type="rect" data-color="${l(e.color)}">`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`fill="${l(e.color)}" />`,`</g>`].join(`
58
+ `);let r=e.label?f` data-label="${l(e.label)}"`:``;n.push(f`<g class="block" data-type="${l(e.type)}"${r}>`),n.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`);let i=Ao(e,t.edgeLabel),a=Wo;n.push(f` <rect x="${e.x}" y="${e.y}" width="${i}" height="${a}" `+f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),n.push(` `+T(e.type,e.x+6,e.y+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)),e.label&&n.push(` `+T(f`[${e.label}]`,e.x+(i+e.width)/2,Ho(e,t),t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(f` <line x1="${e.x}" y1="${r.y}" x2="${e.x+e.width}" y2="${r.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),r.label&&n.push(` `+T(f`[${r.label}]`,e.x+e.width/2,Uo(r,t),t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
59
+ `)}function as(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?f` data-actors="${e.actors.map(l).join(`,`)}"`:``,s=e.position?f` data-position="${l(e.position)}"`:``,c=[f`${n},${r}`,f`${n+i-6},${r}`,f`${n+i},${r+6}`,f`${n+i},${r+a}`,f`${n},${r+a}`].join(` `);return f`<g class="note"${s}${o}>`+f`\n <polygon points="${c}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n ${T(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
60
+ </g>`}var K={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelHeight:16,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16},os=.8;function ss(e,t,n){let{pad:r,bar:i}=cs(e,t,n);return t<2?i:e/t*i*(t-1)/(e-2*r)}function cs(e,t,n){let r=Math.min(n,.2*e),i=(e-2*r)/t,a=.7*i>2*r?Math.floor(.35*i):r;return{p0:r,pad:a,bar:.95*Math.min(2*a,(e-2*a)/t)}}function ls(e,t,n){let{min:r,max:i}=e.yAxis.range,a=e.series.flatMap(e=>e.data),o=a[0],s=o!==void 0&&a.every(e=>e===o)&&r===o-.1&&i===o+.1?{min:o,max:o}:{min:r,max:i},c=C(s.min,s.max),l=bs(c),u=Math.min(n(l)/2,.2*t),d=s.max-s.min;return{range:s,ticks:c,labels:l,pad:u,frac:e=>d>0?(e-s.min)/d:.5}}function us(e,t,n){let r=e.xAxis.categories?void 0:e.xAxis.range,i=e=>n?K.axisLabelFontSize/2:os*Math.max(...e.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight)))/2;if(!r){let n=ms(e),r=hs(e,n),a=e=>(e+.5)*(t/n);return{at:(e,t)=>a(t),ticks:r.map((e,t)=>({label:e,at:a(t)})),bar:ss(t,n,i(r))}}let a=C(r.min,r.max),o=bs(a),{p0:s,pad:c,bar:l}=cs(t,a.length,i(o)),u=e.series.some(e=>e.type===`bar`)?c:s,d=r.max-r.min,f=e=>{let i=d>0?(e-r.min)/d:.5;return u+(n?1-i:i)*(t-2*u)};return{at:(e,t)=>f(e<2?r.min:r.min+t*d/(e-1)),ticks:a.map((e,t)=>({label:o[t],at:f(e)})),bar:l}}function ds(e,t={}){return e.horizontal?ps(e):fs(e)}function fs(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1;if(!e.yAxis.range)throw Error(`XY chart: y-axis range was not set by the parser`);let a=ls(e,K.plotHeight,()=>K.axisLabelHeight),o=a.ticks,s=a.labels,c=Math.max(...s.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight)),K.yLabelWidth),l=K.padding+(t?K.titleHeight:0)+(i?K.legendHeight:0),u=K.padding+K.xLabelHeight+(n?K.axisTitlePad:0),d=K.padding+c+K.yLabelGap+(r?K.axisTitlePad:0),f=K.padding,p=K.plotWidth,m=K.plotHeight,h=d+p+f,g=l+m+u,_={x:d,y:l,width:p,height:m},v=ms(e),y=us(e,p,!1),b=(e,t)=>d+y.at(e,t),x=e=>l+m-a.pad-a.frac(e)*(m-2*a.pad),S=l+m,C=y.ticks.map(e=>({label:e.label,x:d+e.at,y:S,tx:d+e.at,ty:S+K.tickLength,labelX:d+e.at,labelY:S+18,textAnchor:`middle`})),w=o.map((e,t)=>({label:s[t],x:d,y:x(e),tx:d-K.tickLength,ty:x(e),labelX:d-K.yLabelGap,labelY:x(e),textAnchor:`end`})),T=o.map(e=>({x1:d,y1:x(e),x2:d+p,y2:x(e)})),E=hs(e,v),D=e.series.map((e,t)=>t),O=vs(e,b,x,y.bar,a.range.min>=0?l+m:x(0),E,D),k=ys(e,b,x,E,D),A=K.padding+(t?K.titleHeight:0)+K.legendHeight/2,j=i?Ss(e,h/2,A,D):[],ee={x1:d,y1:l+m,x2:d+p,y2:l+m},te={x1:d,y1:l,x2:d,y2:l+m},ne={ticks:C,line:ee,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-K.padding}}:{}},re={ticks:w,line:te,...e.yAxis.title?{title:{text:e.yAxis.title,x:K.padding+4,y:l+m/2,rotate:-90}}:{}};return{width:h,height:g,title:e.title?{text:e.title,x:h/2,y:K.padding+K.titleFontSize}:void 0,xAxis:ne,yAxis:re,plotArea:_,bars:O,lines:k,gridLines:T,legend:j}}function ps(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1;if(!e.yAxis.range)throw Error(`XY chart: y-axis range was not set by the parser`);let a=ls(e,K.plotWidth,e=>os*Math.max(...e.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight)))),o=a.ticks,s=a.labels,c=hs(e,ms(e)),l=us(e,K.plotHeight,!0),u=Math.max(...l.ticks.map(({label:e})=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight)),40),d=K.padding+(t?K.titleHeight:0)+(i?K.legendHeight:0),f=K.padding+K.xLabelHeight+(r?K.axisTitlePad:0),p=K.padding+u+K.yLabelGap+(n?K.axisTitlePad:0),m=Math.max(K.padding,I(s[s.length-1],K.axisLabelFontSize,K.axisLabelFontWeight)/2+4),h=K.plotWidth,g=K.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},b=e=>p+a.pad+a.frac(e)*(h-2*a.pad),x=(e,t)=>d+l.at(e,t),S=o.map((e,t)=>({label:s[t],x:b(e),y:d+g,tx:b(e),ty:d+g+K.tickLength,labelX:b(e),labelY:d+g+18,textAnchor:`middle`})),C=l.ticks.map(({label:e,at:t})=>({label:e,x:p,y:d+t,tx:p-K.tickLength,ty:d+t,labelX:p-K.yLabelGap,labelY:d+t,textAnchor:`end`})),w=o.map(e=>({x1:b(e),y1:d,x2:b(e),y2:d+g})),T=e.series.map((e,t)=>t),E=e.series.filter(e=>e.type===`bar`).length,D=[];if(E>0){let t=l.bar,n=t,r=0,i=0;for(let o of e.series){if(o.type!==`bar`){i++;continue}for(let e=0;e<o.data.length;e++){let s=x(o.data.length,e)-n/2,l=b(Math.max(o.data[e],a.range.min)),u=a.range.min>=0?p:b(0);D.push({x:Math.min(u,l),y:s,width:Math.abs(l-u),height:t,value:o.data[e],label:c[e],seriesIndex:r,colorIndex:T[i]})}r++,i++}}let O=[],k=0,A=0;for(let t of e.series){if(t.type!==`line`){A++;continue}let e=t.data.map((e,n)=>({x:b(e),y:x(t.data.length,n),value:e,label:c[n]}));O.push({points:e,seriesIndex:k,colorIndex:T[A]}),k++,A++}let j={x1:p,y1:d+g,x2:p+h,y2:d+g},ee={x1:p,y1:d,x2:p,y2:d+g},te={ticks:S,line:j,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-K.padding}}:{}},ne={ticks:C,line:ee,...e.xAxis.title?{title:{text:e.xAxis.title,x:K.padding+4,y:d+g/2,rotate:-90}}:{}},re=e.title?{text:e.title,x:_/2,y:K.padding+K.titleFontSize}:void 0,M=K.padding+(t?K.titleHeight:0)+K.legendHeight/2;return{width:_,height:v,horizontal:!0,title:re,xAxis:te,yAxis:ne,plotArea:y,bars:D,lines:O,gridLines:w,legend:i?Ss(e,_/2,M,T):[]}}function ms(e){if(e.xAxis.categories)return e.xAxis.categories.length;for(let t of e.series)if(t.data.length>0)return t.data.length;return 1}function hs(e,t){if(e.xAxis.categories)return e.xAxis.categories;if(e.xAxis.range){let{min:n,max:r}=e.xAxis.range,i=t>1?(r-n)/(t-1):0;return Array.from({length:t},(e,t)=>xs(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var gs=8;function _s(e,t){let n=e.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight));for(let r=1;r<e.length;r++){let i=!0;for(let a=0;a+r<e.length;a+=r)if(r*t-(n[a]+n[a+r])/2<gs){i=!1;break}if(i)return r}return Math.max(1,e.length)}function vs(e,t,n,r,i,a,o){if(e.series.filter(e=>e.type===`bar`).length===0)return[];let s=r,c=[],l=0,u=0;for(let d of e.series){if(d.type!==`bar`){u++;continue}for(let e=0;e<d.data.length;e++){let f=t(d.data.length,e)-s/2,p=n(d.data[e]);c.push({x:f,y:Math.min(p,i),width:r,height:Math.abs(i-p),value:d.data[e],label:a[e],seriesIndex:l,colorIndex:o[u]})}l++,u++}return c}function ys(e,t,n,r,i){let a=[],o=0,s=0;for(let c of e.series){if(c.type!==`line`){s++;continue}let e=c.data.map((e,i)=>({x:t(c.data.length,i),y:n(e),value:e,label:r[i]}));a.push({points:e,seriesIndex:o,colorIndex:i[s]}),o++,s++}return a}function bs(e){let t=e.length>1?Math.abs(e[1]-e[0]):0,n=t>0&&t<1?Math.ceil(-Math.log10(t)-1e-9):0;return e.map(e=>String(Number.isInteger(e)&&n===0?e:Number(e.toFixed(n))))}function xs(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Ss(e,t,n,r){let i=[],a=0,o=0;for(let t=0;t<e.series.length;t++){let s=e.series[t],c=s.type===`bar`?`Bar ${a+1}`:`Line ${o+1}`;i.push({label:c,x:0,y:n,type:s.type,seriesIndex:s.type===`bar`?a:o,colorIndex:r[t]}),s.type===`bar`?a++:o++}let s=i.map(e=>{let t=I(e.label,K.legendFontSize,K.legendFontWeight);return K.legendSwatchW+K.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*K.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+K.legendItemGap;return i}var q={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},J={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function Cs(e,t,n=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=$i(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push(r(n,!1,l.nonce,l.bodyFont));let{style:p,defs:m}=ws(e,a,t.accent,t.bg,l.nonce);u.push(p),m&&u.push(m);let{plotArea:h}=e,g=h.y+h.height;u.push(`<path d="M${Y(h.x)},${Y(h.y)} V${Y(g)} H${Y(h.x+h.width)}" class="xychart-axis"/>`);for(let t of[...e.xAxis.ticks,...e.yAxis.ticks])u.push(`<path d="M${Y(t.x)},${Y(t.y)} L${Y(t.tx)},${Y(t.ty)}" class="xychart-axis"/>`);let _=[];for(let t of e.bars){let n=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,r=e.horizontal?Es(t.x,t.y,t.width,t.height,q.barRadius):Ts(t.x,t.y,t.width,t.height,q.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),a){let n=js(t.value),r=t.label?`${t.label}: ${n}`:n,i=As(t.x+t.width/2,t.y,n);_.push({extent:e.horizontal?t.width:t.height,html:`<g class="xychart-bar-group"><rect x="${Y(t.x)}" y="${Y(t.y)}" width="${Y(t.width)}" height="${Y(t.height)}" fill="transparent"/><title>${X(r)}</title>`+i+`</g>`})}}_.sort((e,t)=>t.extent-e.extent);for(let t of e.lines){if(t.points.length===0)continue;let e=Ds(t.points);u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let v=Math.max(...e.lines.map(e=>e.points.length),0),y=v>0&&v<=12,b=[];if(a){let t=new Map;for(let n of e.legend)n.type===`line`&&t.set(n.seriesIndex,n.label);let n=new Map;for(let t of e.lines)for(let e of t.points){let r=Y(e.x),i=n.get(r)??[];n.set(r,i),i.push({x:e.x,y:e.y,value:e.value,label:e.label,seriesIndex:t.seriesIndex,colorIndex:t.colorIndex})}for(let e of n.values()){let n=e[0].x,r=e[0].label||``;if(a&&e.length>1){let i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.map(e=>e.y)),o=q.dotRadius*3,s=`<rect x="${Y(n-o)}" y="${Y(i-o)}" width="${Y(o*2)}" height="${Y(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=e.map(e=>({text:js(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=ks(n,i-q.dotRadius,r,c),u=c.map(e=>e.text),d=r?`${r}: ${u.join(` · `)}`:u.join(` · `),f=`<g class="xychart-dot-group">${s}`;for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`;f+=`<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`}f+=`<title>${X(d)}</title>${l}</g>`,b.push(f)}else if(a){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,i=js(t.value),a=t.label?`${t.label}: ${i}`:i,o=As(n,t.y-q.dotRadius,i),s=y?`<circle cx="${Y(n)}" cy="${Y(t.y)}" r="${q.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;b.push(`<g class="xychart-dot-group">${s}<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${X(a)}</title>${o}</g>`)}}}for(let t of e.xAxis.ticks)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${z}" class="xychart-label">${X(t.label)}</text>`);for(let t of e.yAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${z}" class="xychart-label">${X(t.label)}</text>`);if(e.xAxis.title){let t=e.xAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${z}" class="xychart-axis-title">${X(t.text)}</text>`)}if(e.yAxis.title){let t=e.yAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${z}" class="xychart-axis-title">${X(t.text)}</text>`)}e.title&&u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${q.titleSize}" font-weight="${q.titleWeight}" dy="${z}" class="xychart-title">${X(e.title.text)}</text>`);for(let t of e.legend){if(t.type===`bar`)u.push(`<rect x="${t.x}" y="${t.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);else{let e=t.y;u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x+14}" y2="${e}" stroke-width="${q.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`)}u.push(`<text x="${t.x+14+6}" y="${t.y}" text-anchor="start" font-size="${q.legendSize}" font-weight="${q.legendWeight}" dy="${z}" class="xychart-label">${X(t.label)}</text>`)}for(let e of _)u.push(e.html);for(let e of b)u.push(e);return u.push(`</svg>`),u.join(`
61
+ `)}function ws(e,t,n,r,i){let a=n??ae,o=new Set;for(let t of e.bars)o.add(t.colorIndex);for(let t of e.lines)o.add(t.colorIndex);let s=[];for(let e of[...o].sort((e,t)=>e-t)){let t=e===0?`var(--accent, ${ae})`:de(e,a,r);s.push(` --xychart-color-${e}: ${t};`),s.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let c=[];for(let e of[...o].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;c.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),c.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),c.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let l=t?`
62
+ .xychart-dot { opacity: 0; }
63
+ .xychart-dot-group:hover .xychart-dot { opacity: 1; }
63
64
  .xychart-tip { opacity: 0; pointer-events: none; }
64
65
  .xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
65
66
  .xychart-tip-text { fill: var(--bg); font-size: ${J.fontSize}px; font-weight: ${J.fontWeight}; }
66
67
  .xychart-tip-ptr { fill: var(--_text); }
67
68
  .xychart-bar-group:hover .xychart-tip,
68
- .xychart-dot-group:hover .xychart-tip { opacity: 1; }`:``,d=c.length>0?`\n svg {\n${c.join(`
69
- `)}\n }`:``;return{style:`${A(a)}
70
- .xychart-grid { fill: var(--_inner-stroke); stroke: none; opacity: 0.65; }
69
+ .xychart-dot-group:hover .xychart-tip { opacity: 1; }`:``,u=s.length>0?`\n svg {\n${s.join(`
70
+ `)}\n }`:``;return{style:`${ee(i)}
71
+ .xychart-axis { fill: none; stroke: var(--_text); stroke-width: 2; }
71
72
  .xychart-bar { stroke-width: 1.5; }
72
73
  .xychart-line { fill: none; stroke-width: ${q.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
73
74
  .xychart-line-shadow { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.12; }
74
75
  .xychart-dot { stroke: var(--bg); stroke-width: 2; }
75
76
  .xychart-label { fill: var(--_text-muted); }
76
77
  .xychart-axis-title { fill: var(--_text-sec); }
77
- .xychart-title { fill: var(--_text); }${d}
78
- ${l.join(`
79
- `)}${u}
80
- </style>`,defs:``}}function Vo(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`Z`].join(` `)}function Ho(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`L${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`Z`].join(` `)}function Uo(e){return e.map((e,t)=>`${t===0?`M`:`L`}${Y(e.x)},${Y(e.y)}`).join(` `)}function Wo(e){if(e.length===0)return``;if(e.length===1)return`M${Y(e[0].x)},${Y(e[0].y)}`;if(e.length===2)return`M${Y(e[0].x)},${Y(e[0].y)} L${Y(e[1].x)},${Y(e[1].y)}`;let t=e.length,n=[],r=[];for(let i=0;i<t-1;i++)n.push(e[i+1].x-e[i].x),r.push(n[i]===0?0:(e[i+1].y-e[i].y)/n[i]);let i=Array(t).fill(0);for(let e=1;e<t-1;e++){let t=r[e-1],a=r[e];if(t*a<=0)continue;let o=2*n[e]+n[e-1],s=n[e]+2*n[e-1];i[e]=(o+s)/(o/t+s/a)}let a=(e,t,n,r)=>{let i=((2*e+t)*n-e*r)/(e+t);return i*n<=0?i=0:n*r<=0&&Math.abs(i)>3*Math.abs(n)&&(i=3*n),i};i[0]=a(n[0],n[1],r[0],r[1]),i[t-1]=a(n[t-2],n[t-3],r[t-2],r[t-3]);let o=`M${Y(e[0].x)},${Y(e[0].y)}`;for(let r=0;r<t-1;r++){let t=n[r]/3,a=e[r].x+t,s=e[r].y+i[r]*t,c=e[r+1].x-t,l=e[r+1].y-i[r+1]*t;o+=` C${Y(a)},${Y(s)} ${Y(c)},${Y(l)} ${Y(e[r+1].x)},${Y(e[r+1].y)}`}return o}function Go(e,t,n,r){let i=I(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=I(e.legendLabel,J.fontSize,J.fontWeight),n=I(e.text,J.fontSize,J.fontWeight);return t+10+n})),o=Math.max(i,a)+J.padX*2,s=26+r.length*20+6,c=Math.max(J.minY,t-J.offsetY-s-J.pointerSize),l=e-o/2,u=e,d=c+s,f=J.pointerSize,p=`<polygon points="${Y(u-f)},${Y(d)} ${Y(u+f)},${Y(d)} ${Y(u)},${Y(d+f)}" class="xychart-tip xychart-tip-ptr"/>`,m=`<rect x="${Y(l)}" y="${Y(c)}" width="${Y(o)}" height="${s}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>`;m+=p;let h=c+6+10;m+=`<text x="${Y(e)}" y="${Y(h)}" text-anchor="middle" font-weight="600" font-size="${J.fontSize}" dy="${z}" class="xychart-tip xychart-tip-text">${X(n)}</text>`;let g=l+J.padX,_=l+o-J.padX;for(let e of r)h+=20,m+=`<text x="${Y(g)}" y="${Y(h)}" text-anchor="start" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${z}" class="xychart-tip xychart-tip-text">${X(e.legendLabel)}</text>`,m+=`<text x="${Y(_)}" y="${Y(h)}" text-anchor="end" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${z}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function Ko(e,t,n){let r=I(n,J.fontSize,J.fontWeight)+J.padX*2,i=J.height,a=Math.max(J.minY,t-J.offsetY-i-J.pointerSize),o=e-r/2,s=e,c=a+i/2,l=e,u=a+i,d=J.pointerSize,f=`<polygon points="${Y(l-d)},${Y(u)} ${Y(l+d)},${Y(u)} ${Y(l)},${Y(u+d)}" class="xychart-tip xychart-tip-ptr"/>`;return`<rect x="${Y(o)}" y="${Y(a)}" width="${Y(r)}" height="${i}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>`+f+`<text x="${Y(s)}" y="${Y(c)}" text-anchor="middle" dy="${z}" class="xychart-tip xychart-tip-text">${X(n)}</text>`}function qo(e){return Number.isInteger(e)?e.toLocaleString(`en-US`):e.toFixed(+(Math.abs(e)<10))}function Y(e){return String(Math.round(e*10)/10)}function X(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var Z={height:450,margin:40,legendRectSize:18,legendSpacing:4,textPosition:.75,outerStrokeWidth:2,titleFontSize:25,sectionFontSize:17,legendFontSize:17,fontWeight:400,paletteSize:12,highlightScale:1.05,minPercent:1},Jo=Math.PI*2;function Q(e){return String(Math.round(e*100)/100)}function Yo(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function Xo(e,t,n,r,i,a=0){if(i-r>=Jo-1e-9){let r=(n,r)=>`M${Q(e)},${Q(t-n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t+n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t-n)}`;return r(n,1)+(a>0?r(a,0):``)+`Z`}let o=Yo(e,t,n,r),s=Yo(e,t,n,i),c=+(i-r>Math.PI),l=`M${Q(o.x)},${Q(o.y)}A${Q(n)},${Q(n)},0,${c},1,${Q(s.x)},${Q(s.y)}`;if(a<=0)return`${l}L${Q(e)},${Q(t)}Z`;let u=Yo(e,t,a,i),d=Yo(e,t,a,r);return`${l}L${Q(u.x)},${Q(u.y)}A${Q(a)},${Q(a)},0,${c},0,${Q(d.x)},${Q(d.y)}Z`}function Zo(e,t,n){return n?`${e} [${String(t)}]`:e}function Qo(e,t={}){let n=Z.height,r=n,i=Math.min(r,n)/2-Z.margin,a=r/2,o=n/2,s=e.slices.reduce((e,t)=>e+t.value,0),c=e.slices.map((e,t)=>({slice:e,colorIndex:t%Z.paletteSize})).filter(({slice:e})=>e.value/s*100>=Z.minPercent),l=c.reduce((e,t)=>e+t.slice.value,0),u=Z.legendRectSize+Z.legendSpacing,d=e.slices.length,f=d>0?e.legendPosition??`right`:`right`,p=e.slices.map(t=>Zo(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>I(e,Z.legendFontSize,Z.fontWeight))),h=Z.legendRectSize+Z.legendSpacing,g=u*d,_=f===`left`?m+h:0,v=f===`top`?g+u:0,y=a-m/2-h,b=o-g/2,x={right:{x:a+12*Z.legendRectSize,y:b},left:{x:a-i-h,y:b},center:{x:y,y:b},top:{x:y,y:o-i},bottom:{x:y,y:o+i+u}}[f],S=h+m,C=d>0&&(f===`left`||f===`right`)?r+Z.margin+S:r+Z.margin,w=f===`top`||f===`bottom`?n+g:n,T=e.title??``,E=T.length>0?I(T,Z.titleFontSize,Z.fontWeight):0,D=a-E/2,O=a+E/2,k=x.x,ee=x.x+S,A=x.y,j=x.y+g-u+Z.legendRectSize,te=Math.min(0,D,d>0?k:0),ne=Math.max(C,O,d>0?ee:0),M=d>0?Math.min(0,A):0,re=d>0?Math.max(w,j):n,N=-te,ie=-M,ae=a+_+N,oe=o+v+ie,se=[],P=0,F=e.donutHole??0,ce=F>0&&F<=.9?F*i:0,le=i*(e.textPosition??Z.textPosition);for(let{slice:t,colorIndex:n}of c){let r=P,a=P+t.value/l*Jo;P=a;let o=Yo(ae,oe,le,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?Z.highlightScale:1;se.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:Xo(ae,oe,i*u,r,a,ce*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let ue=p.map((e,t)=>{let n=x.x+N,r=x.y+t*u+ie;return{text:e,colorIndex:t%Z.paletteSize,x:n,y:r,size:Z.legendRectSize,textX:n+Z.legendRectSize+Z.legendSpacing,textY:r+Z.legendRectSize-Z.legendSpacing}});return{width:Math.ceil(ne-te),height:Math.ceil(re-M),cx:ae,cy:oe,radius:i,outerRadius:i+Z.outerStrokeWidth/2,title:T.length>0?{text:T,x:a+N,y:o+ie-(n-50)/2}:void 0,slices:se,legend:ue,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function $o(e){return String(Math.round(e*100)/100)}function es(e,t,n){return e===0?`var(--accent, ${ae})`:le(e,t??ae,n)}function ts(e,t,n){let r=new Set;for(let t of e.slices)r.add(t.colorIndex);for(let t of e.legend)r.add(t.colorIndex);let i=[...r].sort((e,t)=>e-t),a=i.map(n=>` --pie-color-${n}: ${e.sliceColors?.[n]??es(n,t.accent,t.bg)};`),o=i.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),s=e.slices.some(e=>e.highlighted)?`
78
+ .xychart-title { fill: var(--_text); }${u}
79
+ ${c.join(`
80
+ `)}${l}
81
+ </style>`,defs:``}}function Ts(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`Z`].join(` `)}function Es(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`L${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`Z`].join(` `)}function Ds(e){return e.map((e,t)=>`${t===0?`M`:`L`}${Y(e.x)},${Y(e.y)}`).join(` `)}function Os(e){if(e.length===0)return``;if(e.length===1)return`M${Y(e[0].x)},${Y(e[0].y)}`;if(e.length===2)return`M${Y(e[0].x)},${Y(e[0].y)} L${Y(e[1].x)},${Y(e[1].y)}`;let t=e.length,n=[],r=[];for(let i=0;i<t-1;i++)n.push(e[i+1].x-e[i].x),r.push(n[i]===0?0:(e[i+1].y-e[i].y)/n[i]);let i=Array(t).fill(0);for(let e=1;e<t-1;e++){let t=r[e-1],a=r[e];if(t*a<=0)continue;let o=2*n[e]+n[e-1],s=n[e]+2*n[e-1];i[e]=(o+s)/(o/t+s/a)}let a=(e,t,n,r)=>{let i=((2*e+t)*n-e*r)/(e+t);return i*n<=0?i=0:n*r<=0&&Math.abs(i)>3*Math.abs(n)&&(i=3*n),i};i[0]=a(n[0],n[1],r[0],r[1]),i[t-1]=a(n[t-2],n[t-3],r[t-2],r[t-3]);let o=`M${Y(e[0].x)},${Y(e[0].y)}`;for(let r=0;r<t-1;r++){let t=n[r]/3,a=e[r].x+t,s=e[r].y+i[r]*t,c=e[r+1].x-t,l=e[r+1].y-i[r+1]*t;o+=` C${Y(a)},${Y(s)} ${Y(c)},${Y(l)} ${Y(e[r+1].x)},${Y(e[r+1].y)}`}return o}function ks(e,t,n,r){let i=I(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=I(e.legendLabel,J.fontSize,J.fontWeight),n=I(e.text,J.fontSize,J.fontWeight);return t+10+n})),o=Math.max(i,a)+J.padX*2,s=26+r.length*20+6,c=Math.max(J.minY,t-J.offsetY-s-J.pointerSize),l=e-o/2,u=e,d=c+s,f=J.pointerSize,p=`<polygon points="${Y(u-f)},${Y(d)} ${Y(u+f)},${Y(d)} ${Y(u)},${Y(d+f)}" class="xychart-tip xychart-tip-ptr"/>`,m=`<rect x="${Y(l)}" y="${Y(c)}" width="${Y(o)}" height="${s}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>`;m+=p;let h=c+6+10;m+=`<text x="${Y(e)}" y="${Y(h)}" text-anchor="middle" font-weight="600" font-size="${J.fontSize}" dy="${z}" class="xychart-tip xychart-tip-text">${X(n)}</text>`;let g=l+J.padX,_=l+o-J.padX;for(let e of r)h+=20,m+=`<text x="${Y(g)}" y="${Y(h)}" text-anchor="start" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${z}" class="xychart-tip xychart-tip-text">${X(e.legendLabel)}</text>`,m+=`<text x="${Y(_)}" y="${Y(h)}" text-anchor="end" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${z}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function As(e,t,n){let r=I(n,J.fontSize,J.fontWeight)+J.padX*2,i=J.height,a=Math.max(J.minY,t-J.offsetY-i-J.pointerSize),o=e-r/2,s=e,c=a+i/2,l=e,u=a+i,d=J.pointerSize,f=`<polygon points="${Y(l-d)},${Y(u)} ${Y(l+d)},${Y(u)} ${Y(l)},${Y(u+d)}" class="xychart-tip xychart-tip-ptr"/>`;return`<rect x="${Y(o)}" y="${Y(a)}" width="${Y(r)}" height="${i}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>`+f+`<text x="${Y(s)}" y="${Y(c)}" text-anchor="middle" dy="${z}" class="xychart-tip xychart-tip-text">${X(n)}</text>`}function js(e){return Number.isInteger(e)?e.toLocaleString(`en-US`):e.toFixed(+(Math.abs(e)<10))}function Y(e){return String(Math.round(e*10)/10)}function X(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var Z={height:450,margin:40,legendRectSize:18,legendSpacing:4,textPosition:.75,outerStrokeWidth:2,titleFontSize:25,sectionFontSize:17,legendFontSize:17,fontWeight:400,paletteSize:12,highlightScale:1.05,minPercent:1},Ms=Math.PI*2;function Q(e){return String(Math.round(e*100)/100)}function Ns(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function Ps(e,t,n,r,i,a=0){if(i-r>=Ms-1e-9){let r=(n,r)=>`M${Q(e)},${Q(t-n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t+n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t-n)}`;return r(n,1)+(a>0?r(a,0):``)+`Z`}let o=Ns(e,t,n,r),s=Ns(e,t,n,i),c=+(i-r>Math.PI),l=`M${Q(o.x)},${Q(o.y)}A${Q(n)},${Q(n)},0,${c},1,${Q(s.x)},${Q(s.y)}`;if(a<=0)return`${l}L${Q(e)},${Q(t)}Z`;let u=Ns(e,t,a,i),d=Ns(e,t,a,r);return`${l}L${Q(u.x)},${Q(u.y)}A${Q(a)},${Q(a)},0,${c},0,${Q(d.x)},${Q(d.y)}Z`}function Fs(e,t,n){return n?`${e} [${String(t)}]`:e}function Is(e,t={}){let n=Z.height,r=n,i=Math.min(r,n)/2-Z.margin,a=r/2,o=n/2,s=e.slices.reduce((e,t)=>e+t.value,0),c=e.slices.map((e,t)=>({slice:e,colorIndex:t%Z.paletteSize})).filter(({slice:e})=>e.value/s*100>=Z.minPercent),l=c.reduce((e,t)=>e+t.slice.value,0),u=Z.legendRectSize+Z.legendSpacing,d=e.slices.length,f=d>0?e.legendPosition??`right`:`right`,p=e.slices.map(t=>Fs(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>I(e,Z.legendFontSize,Z.fontWeight))),h=Z.legendRectSize+Z.legendSpacing,g=u*d,_=f===`left`?m+h:0,v=f===`top`?g+u:0,y=a-m/2-h,b=o-g/2,x={right:{x:a+12*Z.legendRectSize,y:b},left:{x:a-i-h,y:b},center:{x:y,y:b},top:{x:y,y:o-i},bottom:{x:y,y:o+i+u}}[f],S=h+m,C=d>0&&(f===`left`||f===`right`)?r+Z.margin+S:r+Z.margin,w=f===`top`||f===`bottom`?n+g:n,T=e.title??``,E=T.length>0?I(T,Z.titleFontSize,Z.fontWeight):0,D=a-E/2,O=a+E/2,k=x.x,A=x.x+S,j=x.y,ee=x.y+g-u+Z.legendRectSize,te=Math.min(0,D,d>0?k:0),ne=Math.max(C,O,d>0?A:0),re=d>0?Math.min(0,j):0,M=d>0?Math.max(w,ee):n,N=-te,P=-re,ie=a+_+N,ae=o+v+P,oe=[],se=0,ce=e.donutHole??0,le=ce>0&&ce<=.9?ce*i:0,ue=i*(e.textPosition??Z.textPosition);for(let{slice:t,colorIndex:n}of c){let r=se,a=se+t.value/l*Ms;se=a;let o=Ns(ie,ae,ue,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?Z.highlightScale:1;oe.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:Ps(ie,ae,i*u,r,a,le*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let de=p.map((e,t)=>{let n=x.x+N,r=x.y+t*u+P;return{text:e,colorIndex:t%Z.paletteSize,x:n,y:r,size:Z.legendRectSize,textX:n+Z.legendRectSize+Z.legendSpacing,textY:r+Z.legendRectSize-Z.legendSpacing}});return{width:Math.ceil(ne-te),height:Math.ceil(M-re),cx:ie,cy:ae,radius:i,outerRadius:i+Z.outerStrokeWidth/2,title:T.length>0?{text:T,x:a+N,y:o+P-(n-50)/2}:void 0,slices:oe,legend:de,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function Ls(e){return String(Math.round(e*100)/100)}function Rs(e,t,n){return e===0?`var(--accent, ${ae})`:de(e,t??ae,n)}function zs(e,t,n){let r=new Set;for(let t of e.slices)r.add(t.colorIndex);for(let t of e.legend)r.add(t.colorIndex);let i=[...r].sort((e,t)=>e-t),a=i.map(n=>` --pie-color-${n}: ${e.sliceColors?.[n]??Rs(n,t.accent,t.bg)};`),o=i.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),s=e.slices.some(e=>e.highlighted)?`
81
82
  .pie-slice.pie-highlight { opacity: 1; }`:``,c=a.length>0?`\n svg {\n${a.join(`
82
- `)}\n }`:``;return`${A(n)}
83
+ `)}\n }`:``;return`${ee(n)}
83
84
  .pie-outer { fill: none; stroke: var(--fg); stroke-width: ${Z.outerStrokeWidth}px; }
84
85
  .pie-slice { stroke: var(--fg); stroke-width: 2px; opacity: 0.7; }${s}
85
86
  .pie-slice-label { fill: var(--_text); font-size: ${Z.sectionFontSize}px; font-weight: ${Z.fontWeight}; }
@@ -87,21 +88,21 @@ ${l.join(`
87
88
  .pie-legend-text { fill: var(--_text); font-size: ${Z.legendFontSize}px; font-weight: ${Z.fontWeight}; }${c}
88
89
  ${o.join(`
89
90
  `)}
90
- </style>`}function ns(e,t,n=`Inter`,i=!1,a,o,s,c={}){let d=[];d.push(Di(M(e.width,e.height,t,i,o??e.accTitle,s,void 0,c.styleAttribute,e.accDescr),a)),d.push(r(n,!1,c.nonce,c.bodyFont)),d.push(ts(e,t,c.nonce)),d.push(`<circle cx="${$o(e.cx)}" cy="${$o(e.cy)}" r="${$o(e.outerRadius)}" class="pie-outer"/>`);for(let t of e.slices)d.push(`<path d="${t.path}" class="pie-slice${t.highlighted?` pie-highlight`:``} pie-color-${t.colorIndex}" data-label="${l(t.label)}" data-value="${t.value}"/>`);for(let t of e.slices)d.push(`<text x="${$o(t.labelX)}" y="${$o(t.labelY)}" text-anchor="middle" class="pie-slice-label">${u(t.percentText)}</text>`);e.title&&d.push(`<text x="${$o(e.title.x)}" y="${$o(e.title.y)}" text-anchor="middle" class="pie-title">${u(e.title.text)}</text>`);for(let t of e.legend)d.push(`<g class="pie-legend"><rect x="${$o(t.x)}" y="${$o(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${$o(t.textX)}" y="${$o(t.textY)}" class="pie-legend-text">${u(t.text)}</text></g>`);return d.push(`</svg>`),d.join(`
91
- `)}var rs={titlePadding:10,titleFontSize:20,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2,xAxisPosition:`top`,yAxisPosition:`left`,width:500,height:500,axisLabelPadding:5,axisLabelFontSize:16,internalBorderWidth:1,externalBorderWidth:2},is={chartWidth:500,chartHeight:500};function as(e){return{anchor:`middle`,baseline:`hanging`,rotation:0,...e}}function os(e){let t={...rs,...is,...e.config},n=e.points.length>0,r=!!(e.xAxisLeft||e.xAxisRight),i=!!(e.yAxisBottom||e.yAxisTop),a=!!e.title,o=t.xAxisLabelPadding*2+t.xAxisLabelFontSize,s=t.yAxisLabelPadding*2+t.yAxisLabelFontSize,c=a?t.titleFontSize+t.titlePadding*2:0,l=!n&&t.xAxisPosition===`top`,u=l&&r?o:0,d=!l&&r?o:0,f=t.yAxisPosition===`left`&&i?s:0,p=t.yAxisPosition===`right`&&i?s:0,m=t.quadrantPadding+f,h=t.quadrantPadding+u+c,g=t.chartWidth-t.quadrantPadding*2-f-p,_=t.chartHeight-t.quadrantPadding*2-u-d-c,v=g/2,y=_/2,b=[[m+v,h],[m,h],[m,h+y],[m+v,h+y]].map(([r,i],a)=>({index:a,x:r,y:i,width:v,height:y,text:as({text:e.quadrants[a],x:r+v/2,y:n?i+t.quadrantTextTopPadding:i+y/2,fontSize:t.quadrantLabelFontSize,baseline:n?`hanging`:`middle`})})),x=t.quadrantExternalBorderStrokeWidth/2,S=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantExternalBorderStrokeWidth,kind:`external`}),C=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantInternalBorderStrokeWidth,kind:`internal`}),w=[S(m-x,h,m+g+x,h),S(m+g,h+x,m+g,h+_-x),S(m-x,h+_,m+g+x,h+_),S(m,h+x,m,h+_-x),C(m+v,h+x,m+v,h+_-x),C(m+x,h+y,m+g-x,h+y)],T=[],E=l?t.xAxisLabelPadding+c:t.xAxisLabelPadding+h+_+t.quadrantPadding,D=!!e.xAxisRight,O=(e,n)=>T.push(as({text:e,x:n,y:E,fontSize:t.xAxisLabelFontSize,anchor:D?`middle`:`start`}));r&&e.xAxisLeft&&O(e.xAxisLeft,m+(D?v/2:0)),r&&e.xAxisRight&&O(e.xAxisRight,m+v+v/2);let k=t.yAxisPosition===`left`?t.yAxisLabelPadding:t.yAxisLabelPadding+m+g+t.quadrantPadding,ee=!!e.yAxisTop,A=(e,n)=>T.push(as({text:e,x:k,y:n,fontSize:t.yAxisLabelFontSize,anchor:ee?`middle`:`start`,rotation:-90}));i&&e.yAxisBottom&&A(e.yAxisBottom,h+_-(ee?y/2:0)),i&&e.yAxisTop&&A(e.yAxisTop,h+y-y/2);let j=[...e.points].reverse().map(e=>{let n=m+e.x*g,r=h+_-e.y*_;return{x:n,y:r,radius:e.radius??t.pointRadius,color:e.color,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth??`0px`,text:as({text:e.label,x:n,y:r+t.pointTextPadding,fontSize:t.pointLabelFontSize})}});return{width:t.chartWidth,height:t.chartHeight,themeColors:e.themeColors,title:a?as({text:e.title,x:t.chartWidth/2,y:t.titlePadding,fontSize:t.titleFontSize}):void 0,quadrants:b,lines:w,axisLabels:T,points:j}}function ss(e){return String(Math.round(e*100)/100)}var cs=[14,10,6,3];function ls(e,t){let n=`var(--accent, ${ae})`,r=`color-mix(in srgb, ${n} 35%, var(--bg))`,i=cs.map((e,t)=>` .quadrant-cell-${t} { fill: color-mix(in srgb, ${n} ${e}%, var(--bg)); }`),a=e.points.flatMap((e,t)=>{let n=[e.color&&`fill: ${e.color};`,e.strokeColor&&`stroke: ${e.strokeColor};`,e.strokeWidth!==`0px`&&`stroke-width: ${e.strokeWidth};`].filter(Boolean);return n.length>0?[` .quadrant-point-${t} { ${n.join(` `)} }`]:[]}),o=e.themeColors??{},s=[...[1,2,3,4].flatMap(e=>[o[`quadrant${e}Fill`]&&` .quadrant-cell-${e-1} { fill: ${o[`quadrant${e}Fill`]}; }`,o[`quadrant${e}TextFill`]&&` .quadrant:nth-child(${e}) .quadrant-label { fill: ${o[`quadrant${e}TextFill`]}; }`]),o.quadrantPointFill&&` .quadrant-point { fill: ${o.quadrantPointFill}; stroke: ${o.quadrantPointFill}; }`,o.quadrantPointTextFill&&` .quadrant-point-label { fill: ${o.quadrantPointTextFill}; }`,o.quadrantXAxisTextFill&&` .quadrant-axis-label[transform$="rotate(0)"] { fill: ${o.quadrantXAxisTextFill}; }`,o.quadrantYAxisTextFill&&` .quadrant-axis-label[transform$="rotate(-90)"] { fill: ${o.quadrantYAxisTextFill}; }`,o.quadrantTitleFill&&` .quadrant-title { fill: ${o.quadrantTitleFill}; }`,o.quadrantInternalBorderStrokeFill&&` .quadrant-line-internal { stroke: ${o.quadrantInternalBorderStrokeFill}; }`,o.quadrantExternalBorderStrokeFill&&` .quadrant-line-external { stroke: ${o.quadrantExternalBorderStrokeFill}; }`].filter(Boolean);return`${A(t)}
91
+ </style>`}function Bs(e,t,n=`Inter`,i=!1,a,o,s,c={}){let d=[];d.push($i(M(e.width,e.height,t,i,o??e.accTitle,s,void 0,c.styleAttribute,e.accDescr),a)),d.push(r(n,!1,c.nonce,c.bodyFont)),d.push(zs(e,t,c.nonce)),d.push(`<circle cx="${Ls(e.cx)}" cy="${Ls(e.cy)}" r="${Ls(e.outerRadius)}" class="pie-outer"/>`);for(let t of e.slices)d.push(`<path d="${t.path}" class="pie-slice${t.highlighted?` pie-highlight`:``} pie-color-${t.colorIndex}" data-label="${l(t.label)}" data-value="${t.value}"/>`);for(let t of e.slices)d.push(`<text x="${Ls(t.labelX)}" y="${Ls(t.labelY)}" text-anchor="middle" class="pie-slice-label">${u(t.percentText)}</text>`);e.title&&d.push(`<text x="${Ls(e.title.x)}" y="${Ls(e.title.y)}" text-anchor="middle" class="pie-title">${u(e.title.text)}</text>`);for(let t of e.legend)d.push(`<g class="pie-legend"><rect x="${Ls(t.x)}" y="${Ls(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${Ls(t.textX)}" y="${Ls(t.textY)}" class="pie-legend-text">${u(t.text)}</text></g>`);return d.push(`</svg>`),d.join(`
92
+ `)}var Vs={titlePadding:10,titleFontSize:20,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2,xAxisPosition:`top`,yAxisPosition:`left`,width:500,height:500,axisLabelPadding:5,axisLabelFontSize:16,internalBorderWidth:1,externalBorderWidth:2},Hs={chartWidth:500,chartHeight:500};function Us(e){return{anchor:`middle`,baseline:`hanging`,rotation:0,...e}}function Ws(e){let t={...Vs,...Hs,...e.config},n=e.points.length>0,r=!!(e.xAxisLeft||e.xAxisRight),i=!!(e.yAxisBottom||e.yAxisTop),a=!!e.title,o=t.xAxisLabelPadding*2+t.xAxisLabelFontSize,s=t.yAxisLabelPadding*2+t.yAxisLabelFontSize,c=a?t.titleFontSize+t.titlePadding*2:0,l=!n&&t.xAxisPosition===`top`,u=l&&r?o:0,d=!l&&r?o:0,f=t.yAxisPosition===`left`&&i?s:0,p=t.yAxisPosition===`right`&&i?s:0,m=t.quadrantPadding+f,h=t.quadrantPadding+u+c,g=t.chartWidth-t.quadrantPadding*2-f-p,_=t.chartHeight-t.quadrantPadding*2-u-d-c,v=g/2,y=_/2,b=[[m+v,h],[m,h],[m,h+y],[m+v,h+y]].map(([r,i],a)=>({index:a,x:r,y:i,width:v,height:y,text:Us({text:e.quadrants[a],x:r+v/2,y:n?i+t.quadrantTextTopPadding:i+y/2,fontSize:t.quadrantLabelFontSize,baseline:n?`hanging`:`middle`})})),x=t.quadrantExternalBorderStrokeWidth/2,S=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantExternalBorderStrokeWidth,kind:`external`}),C=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantInternalBorderStrokeWidth,kind:`internal`}),w=[S(m-x,h,m+g+x,h),S(m+g,h+x,m+g,h+_-x),S(m-x,h+_,m+g+x,h+_),S(m,h+x,m,h+_-x),C(m+v,h+x,m+v,h+_-x),C(m+x,h+y,m+g-x,h+y)],T=[],E=l?t.xAxisLabelPadding+c:t.xAxisLabelPadding+h+_+t.quadrantPadding,D=!!e.xAxisRight,O=(e,n)=>T.push(Us({text:e,x:n,y:E,fontSize:t.xAxisLabelFontSize,anchor:D?`middle`:`start`}));r&&e.xAxisLeft&&O(e.xAxisLeft,m+(D?v/2:0)),r&&e.xAxisRight&&O(e.xAxisRight,m+v+v/2);let k=t.yAxisPosition===`left`?t.yAxisLabelPadding:t.yAxisLabelPadding+m+g+t.quadrantPadding,A=!!e.yAxisTop,j=(e,n)=>T.push(Us({text:e,x:k,y:n,fontSize:t.yAxisLabelFontSize,anchor:A?`middle`:`start`,rotation:-90}));i&&e.yAxisBottom&&j(e.yAxisBottom,h+_-(A?y/2:0)),i&&e.yAxisTop&&j(e.yAxisTop,h+y-y/2);let ee=[...e.points].reverse().map(e=>{let n=m+e.x*g,r=h+_-e.y*_;return{x:n,y:r,radius:e.radius??t.pointRadius,color:e.color,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth??`0px`,text:Us({text:e.label,x:n,y:r+t.pointTextPadding,fontSize:t.pointLabelFontSize})}});return{width:t.chartWidth,height:t.chartHeight,themeColors:e.themeColors,title:a?Us({text:e.title,x:t.chartWidth/2,y:t.titlePadding,fontSize:t.titleFontSize}):void 0,quadrants:b,lines:w,axisLabels:T,points:ee}}function Gs(e){return String(Math.round(e*100)/100)}var Ks=[14,10,6,3];function qs(e,t){let n=`var(--accent, ${ae})`,r=`color-mix(in srgb, ${n} 35%, var(--bg))`,i=Ks.map((e,t)=>` .quadrant-cell-${t} { fill: color-mix(in srgb, ${n} ${e}%, var(--bg)); }`),a=e.points.flatMap((e,t)=>{let n=[e.color&&`fill: ${e.color};`,e.strokeColor&&`stroke: ${e.strokeColor};`,e.strokeWidth!==`0px`&&`stroke-width: ${e.strokeWidth};`].filter(Boolean);return n.length>0?[` .quadrant-point-${t} { ${n.join(` `)} }`]:[]}),o=e.themeColors??{},s=[...[1,2,3,4].flatMap(e=>[o[`quadrant${e}Fill`]&&` .quadrant-cell-${e-1} { fill: ${o[`quadrant${e}Fill`]}; }`,o[`quadrant${e}TextFill`]&&` .quadrant:nth-child(${e}) .quadrant-label { fill: ${o[`quadrant${e}TextFill`]}; }`]),o.quadrantPointFill&&` .quadrant-point { fill: ${o.quadrantPointFill}; stroke: ${o.quadrantPointFill}; }`,o.quadrantPointTextFill&&` .quadrant-point-label { fill: ${o.quadrantPointTextFill}; }`,o.quadrantXAxisTextFill&&` .quadrant-axis-label[transform$="rotate(0)"] { fill: ${o.quadrantXAxisTextFill}; }`,o.quadrantYAxisTextFill&&` .quadrant-axis-label[transform$="rotate(-90)"] { fill: ${o.quadrantYAxisTextFill}; }`,o.quadrantTitleFill&&` .quadrant-title { fill: ${o.quadrantTitleFill}; }`,o.quadrantInternalBorderStrokeFill&&` .quadrant-line-internal { stroke: ${o.quadrantInternalBorderStrokeFill}; }`,o.quadrantExternalBorderStrokeFill&&` .quadrant-line-external { stroke: ${o.quadrantExternalBorderStrokeFill}; }`].filter(Boolean);return`${ee(t)}
92
93
  ${i.join(`
93
94
  `)}
94
95
  .quadrant-line { stroke: ${r}; }
95
96
  .quadrant-text { fill: var(--_text); }
96
97
  .quadrant-point { fill: var(--fg); stroke: var(--fg); stroke-width: 0px; }${[...s,...a].map(e=>`
97
98
  `+e).join(``)}
98
- </style>`}function us(e,t){return e.text?`<text x="0" y="0" class="quadrant-text ${t}" font-size="${e.fontSize}" dominant-baseline="${e.baseline}" text-anchor="${e.anchor}" transform="translate(${ss(e.x)}, ${ss(e.y)}) rotate(${e.rotation})">${u(e.text)}</text>`:``}function ds(e,t,n=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push(Di(M(e.width,e.height,t,i,o,s,void 0,c.styleAttribute,c.description),a)),l.push(r(n,!1,c.nonce,c.bodyFont)),l.push(ls(e,c.nonce)),l.push(`<g class="quadrants">`);for(let t of e.quadrants)l.push(`<g class="quadrant"><rect x="${ss(t.x)}" y="${ss(t.y)}" width="${ss(t.width)}" height="${ss(t.height)}" class="quadrant-cell-${t.index}"/>${us(t.text,`quadrant-label`)}</g>`);l.push(`</g>`),l.push(`<g class="border">`);for(let t of e.lines)l.push(`<line x1="${ss(t.x1)}" y1="${ss(t.y1)}" x2="${ss(t.x2)}" y2="${ss(t.y2)}" stroke-width="${t.strokeWidth}" class="quadrant-line quadrant-line-${t.kind}"/>`);l.push(`</g>`),l.push(`<g class="data-points">`),e.points.forEach((e,t)=>{let n=e.color||e.strokeColor||e.strokeWidth!==`0px`?` quadrant-point-${t}`:``;l.push(`<g class="data-point"><circle cx="${ss(e.x)}" cy="${ss(e.y)}" r="${e.radius}" class="quadrant-point${n}"/>${us(e.text,`quadrant-point-label`)}</g>`)}),l.push(`</g>`),l.push(`<g class="labels">`);for(let t of e.axisLabels)l.push(`<g class="label">${us(t,`quadrant-axis-label`)}</g>`);return l.push(`</g>`),l.push(`<g class="title">`),e.title&&l.push(us(e.title,`quadrant-title`)),l.push(`</g>`),l.push(`</svg>`),l.join(`
99
- `)}var fs=2048,ps=[569,569,727,1139,1139,1821,1366,391,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,569,569,1196,1196,1196,1139,2079,1366,1366,1479,1479,1366,1251,1593,1479,569,1024,1366,1139,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,569,569,569,961,1139,682,1139,1139,1024,1139,1139,569,1139,1139,455,455,1024,455,1706,1139,1139,1139,1139,682,1024,569,1139,1024,1479,1024,1024,1024,684,532,684,1196],ms=[569,682,971,1139,1139,1821,1479,487,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,682,682,1196,1196,1196,1251,1992,1479,1479,1479,1479,1366,1251,1593,1479,569,1139,1479,1251,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,682,569,682,1196,1139,682,1139,1251,1139,1251,1139,682,1251,1251,569,569,1139,569,1821,1251,1251,1251,1251,797,1139,682,1251,1139,1593,1139,1139,1024,801,573,801,1196];function hs(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?ms:ps)[n-32]/fs}var $={width:216,diagramMarginX:50,diagramMarginY:10,shapeMargin:50,shapePadding:20,shapeInRow:4,boundaryInRow:2,nextLinePaddingX:0,screenWidth:1440,nameSize:14,typeSize:10.5,descrSize:11.5,messageSize:12,boundarySize:14,nameLine:15.35,typeLine:15.72,descrLine:17.1,descrExtraLine:12.48,textScale:.922,boundaryLabelHeight:18,boundaryTypeHeight:16.1,boundaryDescrHeight:14.4,rootHeadingHeight:47,titleExtra:60,cornerRadius:12,strokeWidth:2,personRx:.177,personRxMaxOfHeight:.45,personHeadRatio:.23,personHeadMin:16,personHeadMax:56,personHeadOverlap:.27,dbTrim:3.91,queueExtra:10},gs=$.width-2*$.shapePadding;function _s(e,t,n){let r=[];for(let i of e.split(`
100
- `)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&Cs(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function vs(e,t){let n=Math.min(Math.max(e*$.personHeadRatio,$.personHeadMin),$.personHeadMax),r=n*(2-$.personHeadOverlap),i=t===void 0?1/0:t-r;return{rx:Math.min(e*$.personRx,i*$.personRxMaxOfHeight),headRadius:n,pillTop:r}}function ys(e,t){return e*$.nameLine+$.typeLine+bs(t)}function bs(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function xs(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function Ss(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function Cs(e,t,n){let r=0;for(let i of e){let e=hs(i,n>=600);r+=e===void 0?I(i,t,n)*$.textScale:e*t}return r}function ws(e,t,n,r){let i=ys(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:vs(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=xs(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=Ss(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function Ts(e){let t=`#ffffff`;if(e.external)switch(e.kind){case`person`:return{fill:`#686868`,stroke:`#8a8a8a`,text:t};case`system`:return{fill:`#999999`,stroke:`#8a8a8a`,text:t};case`container`:return{fill:`#b3b3b3`,stroke:`#a6a6a6`,text:t};case`component`:return{fill:`#cccccc`,stroke:`#bfbfbf`,text:t}}switch(e.kind){case`person`:return{fill:`#08427b`,stroke:`#073b6f`,text:t};case`system`:return{fill:`#1168bd`,stroke:`#3c7fc0`,text:t};case`container`:return{fill:`#438dd5`,stroke:`#3c7fc0`,text:t};case`component`:return{fill:`#85bbf0`,stroke:`#78a8d8`,text:t}}}var Es=$.messageSize+5;function Ds(e){return e.labelLines??P(e)}function Os(e){let t=e.labelPosition;return t?Ds(e).map((n,r,i)=>({cx:e.technology!==void 0&&r===i.length-1&&e.technologyX!==void 0?e.technologyX:t.x,cy:t.y+r*Es,w:Cs(n,$.messageSize,400),h:$.messageSize})):[]}function ks(){return{next:{cnt:0}}}function As(e,t,n,r,i){e.next.startx=e.startx=t,e.next.stopx=e.stopx=n,e.next.starty=e.starty=r,e.next.stopy=e.stopy=i}function js(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function Ms(e,t){e.next.cnt+=1;let n=$.shapeMargin,r=e.next.startx===e.next.stopx?e.next.stopx+n:e.next.stopx+n*2,i=r+t.width,a=e.next.starty+n*2,o=a+t.height;(r>=e.widthLimit||i>=e.widthLimit||e.next.cnt>$.shapeInRow)&&(r=e.next.startx+n+$.nextLinePaddingX,a=e.next.stopy+n*2,e.next.stopx=i=r+t.width,e.next.starty=e.next.stopy,e.next.stopy=o=a+t.height,e.next.cnt=1),t.x=r,t.y=a,js(e,`startx`,r,Math.min),js(e,`starty`,a,Math.min),js(e,`stopx`,i,Math.max),js(e,`stopy`,o,Math.max),js(e.next,`startx`,r,Math.min),js(e.next,`starty`,a,Math.min),js(e.next,`stopx`,i,Math.max),js(e.next,`stopy`,o,Math.max)}function Ns(e){let t=_s(e.label,gs,$.nameSize),n=e.description?_s(e.description,gs,$.descrSize):[],r=Math.max(...t.map(e=>Cs(e,$.nameSize,700)),Cs(F(e),$.typeSize,400),...n.map(e=>Cs(e,$.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...ws(e,t.length,n.length,r)}}function Ps(e){let t=new Set,n=new Map(e.elements.map(e=>[e.alias,e])),r=e=>{let i=e.elementAliases.flatMap(e=>{t.add(e);let r=n.get(e);return r?[r]:[]});return{alias:e.alias,boundary:e,elements:i,children:e.children.map(r)}},i=e.boundaries.map(r);return{alias:`global`,elements:e.elements.filter(e=>!t.has(e.alias)),children:i}}function Fs(e){let t=new Map,n=[],r=$.diagramMarginX,i=$.diagramMarginY,a=(e,n)=>{for(let r of n){let n=Ns(r);t.set(r.alias,n),Ms(e,n)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},o=(e,t,s)=>{let c=ks();c.widthLimit=e.widthLimit/Math.min($.boundaryInRow,t.length);for(let[l,u]of t.entries()){let t=u.boundary,d=0,f=d+8;d=f+$.boundaryLabelHeight;let p;t&&se(t)&&(p=d+5,d=p+$.boundaryTypeHeight);let m;if(t?.description&&(m=d+20,d=m+$.boundaryDescrHeight),t||(d=$.rootHeadingHeight),l===0||l%$.boundaryInRow===0){let t=e.startx+$.diagramMarginX,n=e.stopy+$.diagramMarginY+d;As(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+$.diagramMarginX;As(c,e,e,c.starty,c.starty)}if(u.elements.length>0&&a(c,u.elements),u.children.length>0&&o(c,u.children,s+1),t){let e=c.stopx-c.startx,r=c.stopy-c.starty;e===0&&(e=$.width,c.stopx=c.startx+e),r===0&&(r=d+$.shapeMargin),n.push({alias:t.alias,label:t.label,...t.type?{type:t.type}:{},...t.description?{description:t.description}:{},x:c.startx,y:c.starty,width:e,height:r,depth:s,labelY:f,...p===void 0?{}:{typeY:p},...m===void 0?{}:{descrY:m}})}e.stopy=Math.max(c.stopy+$.shapeMargin,e.stopy),e.stopx=Math.max(c.stopx+$.shapeMargin,e.stopx),r=Math.max(r,e.stopx),i=Math.max(i,e.stopy)}},s=ks();return As(s,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),s.widthLimit=$.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function Is(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(i===0&&a===0)return{x:n,y:r};let c,l;if(Math.abs(a)*o>Math.abs(i)*s){let e=a<0?-s:s;c=e*i/a,l=e}else{let e=i<0?-o:o;c=e,l=e*a/i}return{x:n+c,y:r+l}}function Ls(e,t){let n=vs(e.width,e.height),r=e.x+e.width/2,i=e.y+e.height/2,a=e.width,o=e.height,s=-o/2+n.headRadius,c=-o/2+n.pillTop,l=n.rx,u=(e,t,n,r,i,a)=>Array.from({length:r},(o,s)=>{let c=(i+s*(a-i)/(r-1))*Math.PI/180;return{x:e-n*Math.cos(c),y:t-n*Math.sin(c)}}),d=Math.asin(Math.min(1,(c-s)/n.headRadius))*180/Math.PI,f=[...u(0,s,n.headRadius,24,180+d,-d),...u(-a/2+l,c+l,l,12,90,0),...u(-a/2+l,o/2-l,l,12,360,270),...u(a/2-l,o/2-l,l,12,270,180),...u(a/2-l,c+l,l,12,180,90)];return zs({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function Rs(e,t,n,r){let i=t.y-e.y,a=e.x-t.x,o=t.x*e.y-e.x*t.y,s=i*n.x+a*n.y+o,c=i*r.x+a*r.y+o;if(s!==0&&c!==0&&s*c>0)return;let l=r.y-n.y,u=n.x-r.x,d=r.x*n.y-n.x*r.y,f=l*e.x+u*e.y+d,p=l*t.x+u*t.y+d;if(f!==0&&p!==0&&f*p>0)return;let m=i*u-l*a;if(m===0)return;let h=Math.abs(m/2),g=a*d-u*o,_=g<0?(g-h)/m:(g+h)/m;return g=l*o-i*d,{x:_,y:g<0?(g-h)/m:(g+h)/m}}function zs(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=Rs(e,t,a,n[(o+1)%n.length]);if(!s)return;let c=Math.hypot(s.x-t.x,s.y-t.y);c<i&&(r=s,i=c)}),r??e}var Bs=1e-6;function Vs(e,t){let n=Is(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=xs(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-Bs||Math.abs(Math.abs(s)-e.width/2)<=Bs&&Math.abs(n.y-i)>e.height/2-o;if(a===0||!c)return n;let l=o*o*(1-s*s/(a*a)),u=o-(l>0?Math.sqrt(l):l);return t.y-i>0&&(u=-u),{x:n.x,y:n.y+u}}function Hs(e,t){let n=Is(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Ss(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-Bs||Math.abs(Math.abs(s)-e.height/2)<=Bs&&Math.abs(n.x-r)>e.width/2-a;if(o===0||!c)return n;let l=a*a*(1-s*s/(o*o)),u=a-Math.sqrt(Math.abs(l));return t.x-r>0&&(u=-u),{x:n.x+u,y:n.y}}function Us(e,t){let n=e.el;return n?.kind===`person`?Ls(e,t):n?.shape===`db`?Vs(e,t):n?.shape===`queue`?Hs(e,t):Is(e,t)}var Ws=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function Gs(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Us(i,Ws(a)),s=Us(a,Ws(i)),c=s.x-o.x,l=s.y-o.y,u=e=>({x:e.x,y:e.y+r}),d={...e,points:[u(o),u(s)]};if(t>0&&(d.curve=u({x:o.x+c/2-c/4,y:o.y+l/2})),P(e).length>0){let t={x:Math.min(o.x,s.x)+Math.abs(c)/2,y:Math.min(o.y,s.y)+Math.abs(l)/2},n=P(e)[0],r=e.label!==``||e.index!==void 0?Cs(n??``,$.messageSize,400):0;if(d.labelPosition=u({x:t.x+r/2,y:t.y}),e.technology){let n=Cs(`[${e.technology}]`,$.messageSize,400);d.technologyX=t.x+Math.max(r,n)/2}}return d}var Ks=2,qs=6,Js=2,Ys=[0,14,-14,28,-28],Xs=[.75,.55,.4],Zs=1e3,Qs=100,$s=10,ec=2,tc=5,nc=4,rc=e=>({x0:e.cx-e.w/2,x1:e.cx+e.w/2,y0:e.cy-e.h/2,y1:e.cy+e.h/2}),ic=(e,t)=>e.x0<t.x1+Ks&&e.x1>t.x0-Ks&&e.y0<t.y1+Ks&&e.y1>t.y0-Ks;function ac(e){let t=e.points[0],n=e.points[e.points.length-1],r=e.curve,i=Math.hypot(n.x-t.x,n.y-t.y),a=Math.max(1,Math.ceil(i/nc));return Array.from({length:a+1},(e,i)=>{let o=i/a;if(!r)return{x:t.x+(n.x-t.x)*o,y:t.y+(n.y-t.y)*o};let s=1-o;return{x:s*s*t.x+2*s*o*r.x+o*o*n.x,y:s*s*t.y+2*s*o*r.y+o*o*n.y}})}function oc(e){return e.flatMap(e=>{let t=(e,t,n,r,i)=>({x0:e-i,x1:t+i,y0:n-i,y1:r+i,weight:Qs}),n=(n,r,i,a)=>{let o=Cs(n,i,a),s=e.x+e.width/2;return t(s-o/2,s+o/2,e.y+r-i/2,e.y+r+i/2,tc)},r=se({...e,elementAliases:[],children:[]});return[t(e.x,e.x+e.width,e.y,e.y,ec),t(e.x,e.x+e.width,e.y+e.height,e.y+e.height,ec),t(e.x,e.x,e.y,e.y+e.height,ec),t(e.x+e.width,e.x+e.width,e.y,e.y+e.height,ec),n(e.label,e.labelY,$.boundarySize+2,700),...r?[n(r,e.typeY,$.boundarySize,400)]:[],...e.description?[n(e.description,e.descrY,$.boundarySize-2,400)]:[]]})}function sc(e,t){return Os({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(rc)}function cc(e,t,n,r){let i=e.points[0],a=e.points[e.points.length-1],o=e.labelPosition;if(!o||!i||!a)return;let s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c),u=P(e),d=e.label!==``||e.index!==void 0,f=d?Cs(u[0],$.messageSize,400):0,p=o.x-f/2,m=[{variant:{lines:u,position:o,...e.technologyX===void 0?{}:{technologyX:e.technologyX}},cost:0}];if(d){let t=e.technology?[`[${e.technology}]`]:[],n=new Set([u.join(`
101
- `)]);Xs.forEach((e,r)=>{let i=_s(u[0],f*e,$.messageSize),a=[...i,...t].join(`
102
- `);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>Cs(e,$.messageSize,400)));m.push({variant:{lines:[...i,...t],position:{x:p+s/2,y:o.y}},cost:25*(r+1)})})}let h=l===0?0:s/l,g=l===0?0:c/l,_=l/2+Math.max(...Ys)+Ks,v=m.flatMap(t=>sc(e,t.variant)),y={x0:Math.min(...v.map(e=>e.x0))-_,x1:Math.max(...v.map(e=>e.x1))+_,y0:Math.min(...v.map(e=>e.y0))-_,y1:Math.max(...v.map(e=>e.y1))+_},b=e=>e.x0<y.x1&&e.x1>y.x0&&e.y0<y.y1&&e.y1>y.y0,x=[...t,...r].filter(b),S=Math.max(Js,l/200),C=n.filter(e=>b({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),w=C.map(e=>({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),T,E=e=>T?.penalty===0&&e>=T.cost;for(let{variant:t,cost:n}of m){let r=sc(e,t);for(let e of Ys)if(!E(n+2*Math.abs(e)))for(let i=0;i<=l/2&&!E(n+2*Math.abs(e)+i);i+=S)for(let a of i===0?[1]:[1,-1]){let o=a*i,s={x:o*h-e*g,y:o*g+e*h},c=r.map(e=>({x0:e.x0+s.x,x1:e.x1+s.x,y0:e.y0+s.y,y1:e.y1+s.y})),l=0,u=T?.penalty??1/0;for(let e of c){if(l>u)break;for(let t of x)if(ic(e,t)&&(l+=t.weight),l>u)break;if(l>u)break;for(let[t,n]of C.entries()){let r=w[t];r.x1<=e.x0||r.x0>=e.x1||r.y1<=e.y0||r.y0>=e.y1||n.some(t=>t.x>e.x0&&t.x<e.x1&&t.y>e.y0&&t.y<e.y1)&&(l+=$s)}}let d=n+i+2*Math.abs(e);(!T||l<T.penalty||l===T.penalty&&d<T.cost)&&(T={v:t,at:s,penalty:l,cost:d})}}let{v:D,at:O}=T;e.labelPosition={x:D.position.x+O.x,y:D.position.y+O.y},D.lines!==u&&(e.labelLines=D.lines),D.technologyX===void 0?delete e.technologyX:e.technologyX=D.technologyX+O.x,r.push(...Os(e).map(e=>({...rc(e),weight:Qs})))}function lc(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};if(e.title){let n=2*$.diagramMarginY+$.titleExtra;t.title=e.title,t.width=Math.ceil(2*$.diagramMarginX+Cs(e.title,16,400)),t.height=n,t.titlePosition={x:$.diagramMarginX,y:n/2}}return t}let n=Fs(Ps(e)),r=e.title?$.titleExtra:0,i=$.diagramMarginY+r,a=e.elements.flatMap(e=>{let t=n.elements.get(e.alias);return t?[{...e,x:t.x,y:t.y+i,width:t.width,height:t.height,nameLines:t.nameLines,descriptionLines:t.descriptionLines}]:[]}),o=[...n.boundaries].sort((e,t)=>e.depth-t.depth).map(e=>({...e,y:e.y+i})),s=new Map;for(let e of n.elements.values())s.set(e.el.alias,e);for(let e of n.boundaries)s.set(e.alias,e);let c=e.relationships.map((e,t)=>Gs(e,t,s,i)),l=[...a.map(e=>({x0:e.x-qs,x1:e.x+e.width+qs,y0:e.y-qs,y1:e.y+e.height+qs,weight:Zs})),...oc(o)],u=c.map(ac),d=[];c.forEach((e,t)=>cc(e,l,u.filter((e,n)=>n!==t),d));let f=n.maxX+$.diagramMarginX,p=n.maxY+$.diagramMarginY+r,m={variant:e.variant,width:f,height:p,elements:a,boundaries:o,relationships:c};return e.title&&(m.title=e.title,m.titlePosition={x:(n.maxX-$.diagramMarginX)/2-4*$.diagramMarginX,y:$.diagramMarginY+$.diagramMarginY+i}),m}function uc(e,t,n=`Inter`,i=!1,a=qe,o,s,c,l={}){let d=[];d.push(Di(M(e.width,e.height,t,i,s??e.title,c,void 0,l.styleAttribute,l.description),o)),d.push(r(n,!1,l.nonce,l.bodyFont)),e.title&&e.titlePosition&&d.push(f`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${z}" `+f`font-size="16" fill="var(--_text)">${u(e.title)}</text>`);for(let t of e.boundaries)d.push(fc(t));for(let t of e.elements)d.push(pc(t));for(let t of e.relationships)d.push(xc(t));for(let t of e.relationships)d.push(Sc(t));return d.push(`</svg>`),d.filter(Boolean).join(`
103
- `)}function dc(e,t,n,r,i){return f` <text x="${t}" y="${n}" text-anchor="middle" dy="${z}" font-size="${r}" `+f`${i}>${u(e)}</text>`}function fc(e){let t=[];t.push(f`<g class="c4-boundary" data-id="${l(e.alias)}" data-label="${l(e.label)}" data-depth="${e.depth}">`),t.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let n=e.x+e.width/2;t.push(dc(e.label,n,e.y+(e.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=se({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push(dc(r,n,e.y+e.typeY,$.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push(dc(e.description,n,e.y+e.descrY,$.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
104
- `)}function pc(e){let t=Ts(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=ys(e.nameLines.length,e.descriptionLines.length),c=[];c.push(f`<g class="c4-element" data-id="${l(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+f`data-external="${e.external}" data-label="${l(e.label)}">`);let u,d=o;if(e.kind===`person`)c.push(...hc(e,t)),u=r+vs(i).pillTop+$.shapePadding;else if(e.shape===`db`){c.push(...gc(e,t));let{ry:n}=xs(i);u=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){c.push(..._c(e,t));let{rx:n}=Ss(a);d=o-n,u=r+a/2-s/2}else c.push(f` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`),u=r+$.shapePadding;let p=u;for(let n of e.nameLines)c.push(dc(n,d,p+$.nameLine/2,$.nameSize,f`font-weight="700" fill="${t.text}"`)),p+=$.nameLine;return c.push(dc(F(e),d,p+$.typeLine/2,$.typeSize,f`fill="${t.text}"`)),p+=$.typeLine,e.descriptionLines.forEach((e,n)=>{c.push(dc(e,d,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,f`fill="${t.text}"`))}),p+=bs(e.descriptionLines.length),c.push(`</g>`),c.join(`
105
- `)}function mc(e){let{x:t,y:n,width:r,height:i}=e,{rx:a,headRadius:o,pillTop:s}=vs(r,i),c=t+r/2,l=n+s,u=n+i,d=Math.sqrt(Math.max(0,o*o-(l-(n+o))**2));return f`M ${t+a} ${l} H ${c-d} A ${o} ${o} 0 1 1 ${c+d} ${l} `+f`H ${t+r-a} A ${a} ${a} 0 0 1 ${t+r} ${l+a} V ${u-a} `+f`A ${a} ${a} 0 0 1 ${t+r-a} ${u} H ${t+a} `+f`A ${a} ${a} 0 0 1 ${t} ${u-a} V ${l+a} `+f`A ${a} ${a} 0 0 1 ${t+a} ${l} Z`}function hc(e,t){return[f` <path class="c4-person-shape" d="${mc(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`]}function gc(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=xs(i),c=f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[f` <path d="M ${n} ${r+s} L ${n} ${r+a-s} A ${o} ${s} 0 0 0 ${n+i} ${r+a-s} L ${n+i} ${r+s} Z" ${c} />`,f` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function _c(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=Ss(a),c=f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[f` <path d="M ${n+i-o} ${r} H ${n+o} A ${o} ${s} 0 0 0 ${n+o} ${r+a} H ${n+i-o} Z" ${c} />`,f` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function vc(e,t){let n=e.x-t.x,r=e.y-t.y,i=Math.hypot(n,r);if(i===0)return``;let a=n/i,o=r/i,s=e.x-a*10,c=e.y-o*10;return f`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s-o*5},${c+a*5} ${s+o*5},${c-a*5}" `+`fill="var(--_text)" />`}var yc=3,bc=1;function xc(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,f`data-from="${l(e.from)}"`,f`data-to="${l(e.to)}"`];e.label&&r.push(f`data-label="${l(e.label)}"`),e.technology&&r.push(f`data-technology="${l(e.technology)}"`);let i=e.curve?f`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:f`M ${t.x},${t.y} L ${n.x},${n.y}`,a=f`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,s=e.curve??n,c=vc(n,o),u=vc(t,s);return[a,...e.bidirectional?[c,u]:[e.reversed?u:c]].filter(Boolean).join(`
106
- `)}function Sc(e){let t=Ds(e),n=Os(e);if(n.length===0)return``;let r=[f`<g class="c4-relationship-label" data-from="${l(e.from)}" data-to="${l(e.to)}">`],i=Math.min(...n.map(e=>e.cx-e.w/2))-yc,a=Math.max(...n.map(e=>e.cx+e.w/2))+yc,o=n[0].cy-n[0].h/2-bc,s=n[n.length-1],c=s.cy+s.h/2+bc;return r.push(f` <rect class="c4-label-plate" x="${i}" y="${o}" width="${a-i}" height="${c-o}" rx="2" ry="2" fill="var(--bg)" />`),t.forEach((i,a)=>{let o=e.technology!==void 0&&a===t.length-1,s=n[a];r.push(dc(i,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),r.push(`</g>`),r.join(`
107
- `)}var Cc={type:`xychart`,parse:ve,layoutForSvg:Eo,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return zo(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},wc={type:`sequence`,parse:_e,layoutForSvg:ro,renderSvg(e,t){return io(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function Tc(e){return(e.interactivity??`static`)!==`none`}function Ec(e){return(e.interactivity??`static`)===`full`}var Dc={type:`class`,parse:fe,layoutForSvg:ta,renderSvg(e,t,n){return sa(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,Tc(n),t.emit)}},Oc={type:`er`,parse:pe,layoutForSvg(e,t){return ka(N(e,t.direction),t)},renderSvg(e,t){return Ma(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},kc={type:`flowchart`,parse:(e,t)=>me(t),layoutForSvg(e,t){return{graph:vr(N(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return kr(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,Ec(n),Tc(n),t.title,t.decorative,t.emit)}},Ac={type:`c4`,parse:de,layoutForSvg(e,t){return lc(e,t)},renderSvg(e,t){return uc(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},jc={xychart:Cc,er:Oc,sequence:wc,class:Dc,flowchart:kc,architecture:{type:`architecture`,parse:ue,layoutForSvg(e,t){return{graph:gr(N(oe(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:kc.renderSvg},c4:Ac,pie:{type:`pie`,parse:(e,t)=>he(t),layoutForSvg:(e,t)=>Qo(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return ns(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}},quadrant:{type:`quadrant`,parse:(e,t)=>ge(t),layoutForSvg:(e,t)=>os(t.honorThemeVariables?e:{...e,themeColors:void 0}),renderSvg(e,t){return ds(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function Mc(t){return{bg:t.bg??e.bg,fg:t.fg??e.fg,line:t.line,accent:t.accent,muted:t.muted??(t.bg||t.fg?void 0:e.muted),surface:t.surface,border:t.border}}function Nc(e={}){return re(Mc(e),e.transparent)}function Pc(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute,bodyFont:Se(e)}}function Fc(e,t={}){let{svg:n,colors:r}=Rc(e,t),i=Ic(n);return t.resolveColors?Hi(i,r):i}function Ic(e){let t=new Set(Array.from(e.matchAll(/\sid="([^"]+)"/g),e=>e[1]??``));if(t.size===0)return e;let n=2166136261;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),16777619);let r=`zm${(n>>>0).toString(36)}-`,i=e=>t.has(e)&&!e.startsWith(`zm-`)?r+e:e;return e.replace(/(\sid=")([^"]+)"/g,(e,t,n)=>`${t}${i(n)}"`).replace(/url\(#([^)]+)\)/g,(e,t)=>`url(#${i(t)})`).replace(/(href=")#([^"]+)"/g,(e,t,n)=>`${t}#${i(n)}"`)}function Lc(e){let t=d(ye(e)).text;jc[s(t)].parse(ee(t),t)}function Rc(e,t){a(`maxInputLength`,e.length,t.limits),o(e,t.limits);let r=d(ye(e)),c=r.text,l=t.font??`Inter`;k(_(l));let u=t.transparent??!1,f=Je(t.fontSizes),p=s(c),m=t.embedSource?e:void 0,h=t.title??r.accTitle,g=t.decorative,v={...Pc(t),description:r.accDescr},y=ee(c),b=jc[p],x=b.parse(y,c),S=x;S.nodes instanceof Map&&Array.isArray(S.edges)&&i(S.nodes.size,S.edges.length,t.limits);let C=b.layoutForSvg(x,t),w=Mc(t.honorThemeVariables?n(t,x.initConfig):t),T={colors:w,font:l,transparent:u,fontSizes:f,embedSource:m,title:h,decorative:g,emit:v};return{svg:b.renderSvg(C,T,t),colors:w}}async function zc(e,t={}){return t.embedFont===`subset`&&await xe(),Fc(e,t)}var Bc=Fc,Vc=zc;export{Ka as ACTOR_LABEL_OFFSET,Qe as ARROW_HEAD,Xe as ASYMMETRIC_NOTCH,W as CLS,et as ELK_DIRECTION_FALLBACK,Ne as ElkNotRegisteredError,qe as FONT_SIZES,L as FONT_WEIGHTS,Ye as GROUP_HEADER_CONTENT_PAD,at as INLINE_CENTERED_EDGE_LABEL,Ge as MONO_FONT,Ke as MONO_FONT_STACK,Ze as NODE_PADDING,Z as PIE,rs as QUADRANT,Ha as SELF_LOOP_CONTROL,Ua as SELF_LOOP_EXTENT,Wa as SELF_LOOP_HEIGHT,R as STROKE_WIDTHS,z as TEXT_BASELINE_SHIFT,rt as baseElkLayoutOptions,Ga as boxLabelHeight,st as buildElkEdge,ot as buildElkEdgeLabel,it as buildElkLeafNode,$e as buildSvgStyleBlock,Qi as classBackEdges,qi as classNoteId,kt as clipEdgeToShape,yr as convertToElkFormat,Re as createLayoutCache,tt as directionToElk,Ve as elkLayoutSync,nt as elkPadding,We as estimateMonoTextWidth,I as estimateTextWidth,Ii as evaluateCssColorValue,Kt as extractEdgeLabelPosition,Gt as extractEdgePoints,Io as formatTickLabels,Ja as hasLabelBelowIcon,ta as layoutClassDiagramSync,ka as layoutErDiagramSync,vr as layoutFlowchartSync,gr as layoutGraphSync,Qo as layoutPieChart,os as layoutQuadrantChart,ro as layoutSequenceDiagram,Eo as layoutXYChart,xe as loadEmbeddedFont,x as niceTickValues,es as pieColorValue,Oe as pointsToPath,Pe as registerElk,sa as renderClassSvg,Ma as renderErSvg,Vc as renderMermaid,Fc as renderMermaidSVG,zc as renderMermaidSVGAsync,Bc as renderMermaidSync,ns as renderPieSvg,ds as renderQuadrantSvg,io as renderSequenceSvg,kr as renderSvg,zo as renderXYChartSvg,Hi as resolveCssColors,Je as resolveFontSizes,Wo as smoothCurvePath,Uo as straightLinePath,Nc as themeCssVariables,Lc as validateMermaid,Di as withDataSrc,Mo as xLabelStep};
99
+ </style>`}function Js(e,t){return e.text?`<text x="0" y="0" class="quadrant-text ${t}" font-size="${e.fontSize}" dominant-baseline="${e.baseline}" text-anchor="${e.anchor}" transform="translate(${Gs(e.x)}, ${Gs(e.y)}) rotate(${e.rotation})">${u(e.text)}</text>`:``}function Ys(e,t,n=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push($i(M(e.width,e.height,t,i,o,s,void 0,c.styleAttribute,c.description),a)),l.push(r(n,!1,c.nonce,c.bodyFont)),l.push(qs(e,c.nonce)),l.push(`<g class="quadrants">`);for(let t of e.quadrants)l.push(`<g class="quadrant"><rect x="${Gs(t.x)}" y="${Gs(t.y)}" width="${Gs(t.width)}" height="${Gs(t.height)}" class="quadrant-cell-${t.index}"/>${Js(t.text,`quadrant-label`)}</g>`);l.push(`</g>`),l.push(`<g class="border">`);for(let t of e.lines)l.push(`<line x1="${Gs(t.x1)}" y1="${Gs(t.y1)}" x2="${Gs(t.x2)}" y2="${Gs(t.y2)}" stroke-width="${t.strokeWidth}" class="quadrant-line quadrant-line-${t.kind}"/>`);l.push(`</g>`),l.push(`<g class="data-points">`),e.points.forEach((e,t)=>{let n=e.color||e.strokeColor||e.strokeWidth!==`0px`?` quadrant-point-${t}`:``;l.push(`<g class="data-point"><circle cx="${Gs(e.x)}" cy="${Gs(e.y)}" r="${e.radius}" class="quadrant-point${n}"/>${Js(e.text,`quadrant-point-label`)}</g>`)}),l.push(`</g>`),l.push(`<g class="labels">`);for(let t of e.axisLabels)l.push(`<g class="label">${Js(t,`quadrant-axis-label`)}</g>`);return l.push(`</g>`),l.push(`<g class="title">`),e.title&&l.push(Js(e.title,`quadrant-title`)),l.push(`</g>`),l.push(`</svg>`),l.join(`
100
+ `)}var Xs=2048,Zs=[569,569,727,1139,1139,1821,1366,391,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,569,569,1196,1196,1196,1139,2079,1366,1366,1479,1479,1366,1251,1593,1479,569,1024,1366,1139,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,569,569,569,961,1139,682,1139,1139,1024,1139,1139,569,1139,1139,455,455,1024,455,1706,1139,1139,1139,1139,682,1024,569,1139,1024,1479,1024,1024,1024,684,532,684,1196],Qs=[569,682,971,1139,1139,1821,1479,487,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,682,682,1196,1196,1196,1251,1992,1479,1479,1479,1479,1366,1251,1593,1479,569,1139,1479,1251,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,682,569,682,1196,1139,682,1139,1251,1139,1251,1139,682,1251,1251,569,569,1139,569,1821,1251,1251,1251,1251,797,1139,682,1251,1139,1593,1139,1139,1024,801,573,801,1196];function $s(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?Qs:Zs)[n-32]/Xs}var $={width:216,diagramMarginX:50,diagramMarginY:10,shapeMargin:50,shapePadding:20,shapeInRow:4,boundaryInRow:2,nextLinePaddingX:0,screenWidth:1440,nameSize:14,typeSize:10.5,descrSize:11.5,messageSize:12,boundarySize:14,nameLine:15.35,typeLine:15.72,descrLine:17.1,descrExtraLine:12.48,textScale:.922,boundaryLabelHeight:18,boundaryTypeHeight:16.1,boundaryDescrHeight:14.4,rootHeadingHeight:47,titleExtra:60,cornerRadius:12,strokeWidth:2,personRx:.177,personRxMaxOfHeight:.45,personHeadRatio:.23,personHeadMin:16,personHeadMax:56,personHeadOverlap:.27,dbTrim:3.91,queueExtra:10},ec=$.width-2*$.shapePadding;function tc(e,t,n){let r=[];for(let i of e.split(`
101
+ `)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&sc(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function nc(e,t){let n=Math.min(Math.max(e*$.personHeadRatio,$.personHeadMin),$.personHeadMax),r=n*(2-$.personHeadOverlap),i=t===void 0?1/0:t-r;return{rx:Math.min(e*$.personRx,i*$.personRxMaxOfHeight),headRadius:n,pillTop:r}}function rc(e,t){return e*$.nameLine+$.typeLine+ic(t)}function ic(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function ac(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function oc(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function sc(e,t,n){let r=0;for(let i of e){let e=$s(i,n>=600);r+=e===void 0?I(i,t,n)*$.textScale:e*t}return r}function cc(e,t,n,r){let i=rc(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:nc(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=ac(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=oc(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function lc(e){let t=`#ffffff`;if(e.external)switch(e.kind){case`person`:return{fill:`#686868`,stroke:`#8a8a8a`,text:t};case`system`:return{fill:`#999999`,stroke:`#8a8a8a`,text:t};case`container`:return{fill:`#b3b3b3`,stroke:`#a6a6a6`,text:t};case`component`:return{fill:`#cccccc`,stroke:`#bfbfbf`,text:t}}switch(e.kind){case`person`:return{fill:`#08427b`,stroke:`#073b6f`,text:t};case`system`:return{fill:`#1168bd`,stroke:`#3c7fc0`,text:t};case`container`:return{fill:`#438dd5`,stroke:`#3c7fc0`,text:t};case`component`:return{fill:`#85bbf0`,stroke:`#78a8d8`,text:t}}}var uc=$.messageSize+5;function dc(e){return e.labelLines??ce(e)}function fc(e){let t=e.labelPosition;return t?dc(e).map((n,r,i)=>({cx:e.technology!==void 0&&r===i.length-1&&e.technologyX!==void 0?e.technologyX:t.x,cy:t.y+r*uc,w:sc(n,$.messageSize,400),h:$.messageSize})):[]}function pc(){return{next:{cnt:0}}}function mc(e,t,n,r,i){e.next.startx=e.startx=t,e.next.stopx=e.stopx=n,e.next.starty=e.starty=r,e.next.stopy=e.stopy=i}function hc(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function gc(e,t){e.next.cnt+=1;let n=$.shapeMargin,r=e.next.startx===e.next.stopx?e.next.stopx+n:e.next.stopx+n*2,i=r+t.width,a=e.next.starty+n*2,o=a+t.height;(r>=e.widthLimit||i>=e.widthLimit||e.next.cnt>$.shapeInRow)&&(r=e.next.startx+n+$.nextLinePaddingX,a=e.next.stopy+n*2,e.next.stopx=i=r+t.width,e.next.starty=e.next.stopy,e.next.stopy=o=a+t.height,e.next.cnt=1),t.x=r,t.y=a,hc(e,`startx`,r,Math.min),hc(e,`starty`,a,Math.min),hc(e,`stopx`,i,Math.max),hc(e,`stopy`,o,Math.max),hc(e.next,`startx`,r,Math.min),hc(e.next,`starty`,a,Math.min),hc(e.next,`stopx`,i,Math.max),hc(e.next,`stopy`,o,Math.max)}function _c(e){let t=tc(e.label,ec,$.nameSize),n=e.description?tc(e.description,ec,$.descrSize):[],r=Math.max(...t.map(e=>sc(e,$.nameSize,700)),sc(le(e),$.typeSize,400),...n.map(e=>sc(e,$.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...cc(e,t.length,n.length,r)}}function vc(e){let t=new Set,n=new Map(e.elements.map(e=>[e.alias,e])),r=e=>{let i=e.elementAliases.flatMap(e=>{t.add(e);let r=n.get(e);return r?[r]:[]});return{alias:e.alias,boundary:e,elements:i,children:e.children.map(r)}},i=e.boundaries.map(r);return{alias:`global`,elements:e.elements.filter(e=>!t.has(e.alias)),children:i}}function yc(e){let t=new Map,n=[],r=$.diagramMarginX,i=$.diagramMarginY,a=(e,n)=>{for(let r of n){let n=_c(r);t.set(r.alias,n),gc(e,n)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},o=(e,t,s)=>{let c=pc();c.widthLimit=e.widthLimit/Math.min($.boundaryInRow,t.length);for(let[l,u]of t.entries()){let t=u.boundary,d=0,f=d+8;d=f+$.boundaryLabelHeight;let p;t&&se(t)&&(p=d+5,d=p+$.boundaryTypeHeight);let m;if(t?.description&&(m=d+20,d=m+$.boundaryDescrHeight),t||(d=$.rootHeadingHeight),l===0||l%$.boundaryInRow===0){let t=e.startx+$.diagramMarginX,n=e.stopy+$.diagramMarginY+d;mc(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+$.diagramMarginX;mc(c,e,e,c.starty,c.starty)}if(u.elements.length>0&&a(c,u.elements),u.children.length>0&&o(c,u.children,s+1),t){let e=c.stopx-c.startx,r=c.stopy-c.starty;e===0&&(e=$.width,c.stopx=c.startx+e),r===0&&(r=d+$.shapeMargin),n.push({alias:t.alias,label:t.label,...t.type?{type:t.type}:{},...t.description?{description:t.description}:{},x:c.startx,y:c.starty,width:e,height:r,depth:s,labelY:f,...p===void 0?{}:{typeY:p},...m===void 0?{}:{descrY:m}})}e.stopy=Math.max(c.stopy+$.shapeMargin,e.stopy),e.stopx=Math.max(c.stopx+$.shapeMargin,e.stopx),r=Math.max(r,e.stopx),i=Math.max(i,e.stopy)}},s=pc();return mc(s,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),s.widthLimit=$.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function bc(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(i===0&&a===0)return{x:n,y:r};let c,l;if(Math.abs(a)*o>Math.abs(i)*s){let e=a<0?-s:s;c=e*i/a,l=e}else{let e=i<0?-o:o;c=e,l=e*a/i}return{x:n+c,y:r+l}}function xc(e,t){let n=nc(e.width,e.height),r=e.x+e.width/2,i=e.y+e.height/2,a=e.width,o=e.height,s=-o/2+n.headRadius,c=-o/2+n.pillTop,l=n.rx,u=(e,t,n,r,i,a)=>Array.from({length:r},(o,s)=>{let c=(i+s*(a-i)/(r-1))*Math.PI/180;return{x:e-n*Math.cos(c),y:t-n*Math.sin(c)}}),d=Math.asin(Math.min(1,(c-s)/n.headRadius))*180/Math.PI,f=[...u(0,s,n.headRadius,24,180+d,-d),...u(-a/2+l,c+l,l,12,90,0),...u(-a/2+l,o/2-l,l,12,360,270),...u(a/2-l,o/2-l,l,12,270,180),...u(a/2-l,c+l,l,12,180,90)];return Cc({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function Sc(e,t,n,r){let i=t.y-e.y,a=e.x-t.x,o=t.x*e.y-e.x*t.y,s=i*n.x+a*n.y+o,c=i*r.x+a*r.y+o;if(s!==0&&c!==0&&s*c>0)return;let l=r.y-n.y,u=n.x-r.x,d=r.x*n.y-n.x*r.y,f=l*e.x+u*e.y+d,p=l*t.x+u*t.y+d;if(f!==0&&p!==0&&f*p>0)return;let m=i*u-l*a;if(m===0)return;let h=Math.abs(m/2),g=a*d-u*o,_=g<0?(g-h)/m:(g+h)/m;return g=l*o-i*d,{x:_,y:g<0?(g-h)/m:(g+h)/m}}function Cc(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=Sc(e,t,a,n[(o+1)%n.length]);if(!s)return;let c=Math.hypot(s.x-t.x,s.y-t.y);c<i&&(r=s,i=c)}),r??e}var wc=1e-6;function Tc(e,t){let n=bc(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=ac(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-wc||Math.abs(Math.abs(s)-e.width/2)<=wc&&Math.abs(n.y-i)>e.height/2-o;if(a===0||!c)return n;let l=o*o*(1-s*s/(a*a)),u=o-(l>0?Math.sqrt(l):l);return t.y-i>0&&(u=-u),{x:n.x,y:n.y+u}}function Ec(e,t){let n=bc(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=oc(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-wc||Math.abs(Math.abs(s)-e.height/2)<=wc&&Math.abs(n.x-r)>e.width/2-a;if(o===0||!c)return n;let l=a*a*(1-s*s/(o*o)),u=a-Math.sqrt(Math.abs(l));return t.x-r>0&&(u=-u),{x:n.x+u,y:n.y}}function Dc(e,t){let n=e.el;return n?.kind===`person`?xc(e,t):n?.shape===`db`?Tc(e,t):n?.shape===`queue`?Ec(e,t):bc(e,t)}var Oc=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function kc(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Dc(i,Oc(a)),s=Dc(a,Oc(i)),c=s.x-o.x,l=s.y-o.y,u=e=>({x:e.x,y:e.y+r}),d={...e,points:[u(o),u(s)]};if(t>0&&(d.curve=u({x:o.x+c/2-c/4,y:o.y+l/2})),ce(e).length>0){let t={x:Math.min(o.x,s.x)+Math.abs(c)/2,y:Math.min(o.y,s.y)+Math.abs(l)/2},n=ce(e)[0],r=e.label!==``||e.index!==void 0?sc(n??``,$.messageSize,400):0;if(d.labelPosition=u({x:t.x+r/2,y:t.y}),e.technology){let n=sc(`[${e.technology}]`,$.messageSize,400);d.technologyX=t.x+Math.max(r,n)/2}}return d}var Ac=2,jc=6,Mc=2,Nc=[0,14,-14,28,-28],Pc=[.75,.55,.4],Fc=1e3,Ic=100,Lc=10,Rc=2,zc=5,Bc=4,Vc=e=>({x0:e.cx-e.w/2,x1:e.cx+e.w/2,y0:e.cy-e.h/2,y1:e.cy+e.h/2}),Hc=(e,t)=>e.x0<t.x1+Ac&&e.x1>t.x0-Ac&&e.y0<t.y1+Ac&&e.y1>t.y0-Ac;function Uc(e){let t=e.points[0],n=e.points[e.points.length-1],r=e.curve,i=Math.hypot(n.x-t.x,n.y-t.y),a=Math.max(1,Math.ceil(i/Bc));return Array.from({length:a+1},(e,i)=>{let o=i/a;if(!r)return{x:t.x+(n.x-t.x)*o,y:t.y+(n.y-t.y)*o};let s=1-o;return{x:s*s*t.x+2*s*o*r.x+o*o*n.x,y:s*s*t.y+2*s*o*r.y+o*o*n.y}})}function Wc(e){return e.flatMap(e=>{let t=(e,t,n,r,i)=>({x0:e-i,x1:t+i,y0:n-i,y1:r+i,weight:Ic}),n=(n,r,i,a)=>{let o=sc(n,i,a),s=e.x+e.width/2;return t(s-o/2,s+o/2,e.y+r-i/2,e.y+r+i/2,zc)},r=se({...e,elementAliases:[],children:[]});return[t(e.x,e.x+e.width,e.y,e.y,Rc),t(e.x,e.x+e.width,e.y+e.height,e.y+e.height,Rc),t(e.x,e.x,e.y,e.y+e.height,Rc),t(e.x+e.width,e.x+e.width,e.y,e.y+e.height,Rc),n(e.label,e.labelY,$.boundarySize+2,700),...r?[n(r,e.typeY,$.boundarySize,400)]:[],...e.description?[n(e.description,e.descrY,$.boundarySize-2,400)]:[]]})}function Gc(e,t){return fc({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(Vc)}function Kc(e,t,n,r){let i=e.points[0],a=e.points[e.points.length-1],o=e.labelPosition;if(!o||!i||!a)return;let s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c),u=ce(e),d=e.label!==``||e.index!==void 0,f=d?sc(u[0],$.messageSize,400):0,p=o.x-f/2,m=[{variant:{lines:u,position:o,...e.technologyX===void 0?{}:{technologyX:e.technologyX}},cost:0}];if(d){let t=e.technology?[`[${e.technology}]`]:[],n=new Set([u.join(`
102
+ `)]);Pc.forEach((e,r)=>{let i=tc(u[0],f*e,$.messageSize),a=[...i,...t].join(`
103
+ `);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>sc(e,$.messageSize,400)));m.push({variant:{lines:[...i,...t],position:{x:p+s/2,y:o.y}},cost:25*(r+1)})})}let h=l===0?0:s/l,g=l===0?0:c/l,_=l/2+Math.max(...Nc)+Ac,v=m.flatMap(t=>Gc(e,t.variant)),y={x0:Math.min(...v.map(e=>e.x0))-_,x1:Math.max(...v.map(e=>e.x1))+_,y0:Math.min(...v.map(e=>e.y0))-_,y1:Math.max(...v.map(e=>e.y1))+_},b=e=>e.x0<y.x1&&e.x1>y.x0&&e.y0<y.y1&&e.y1>y.y0,x=[...t,...r].filter(b),S=Math.max(Mc,l/200),C=n.filter(e=>b({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),w=C.map(e=>({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),T,E=e=>T?.penalty===0&&e>=T.cost;for(let{variant:t,cost:n}of m){let r=Gc(e,t);for(let e of Nc)if(!E(n+2*Math.abs(e)))for(let i=0;i<=l/2&&!E(n+2*Math.abs(e)+i);i+=S)for(let a of i===0?[1]:[1,-1]){let o=a*i,s={x:o*h-e*g,y:o*g+e*h},c=r.map(e=>({x0:e.x0+s.x,x1:e.x1+s.x,y0:e.y0+s.y,y1:e.y1+s.y})),l=0,u=T?.penalty??1/0;for(let e of c){if(l>u)break;for(let t of x)if(Hc(e,t)&&(l+=t.weight),l>u)break;if(l>u)break;for(let[t,n]of C.entries()){let r=w[t];r.x1<=e.x0||r.x0>=e.x1||r.y1<=e.y0||r.y0>=e.y1||n.some(t=>t.x>e.x0&&t.x<e.x1&&t.y>e.y0&&t.y<e.y1)&&(l+=Lc)}}let d=n+i+2*Math.abs(e);(!T||l<T.penalty||l===T.penalty&&d<T.cost)&&(T={v:t,at:s,penalty:l,cost:d})}}let{v:D,at:O}=T;e.labelPosition={x:D.position.x+O.x,y:D.position.y+O.y},D.lines!==u&&(e.labelLines=D.lines),D.technologyX===void 0?delete e.technologyX:e.technologyX=D.technologyX+O.x,r.push(...fc(e).map(e=>({...Vc(e),weight:Ic})))}function qc(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};if(e.title){let n=2*$.diagramMarginY+$.titleExtra;t.title=e.title,t.width=Math.ceil(2*$.diagramMarginX+sc(e.title,16,400)),t.height=n,t.titlePosition={x:$.diagramMarginX,y:n/2}}return t}let n=yc(vc(e)),r=e.title?$.titleExtra:0,i=$.diagramMarginY+r,a=e.elements.flatMap(e=>{let t=n.elements.get(e.alias);return t?[{...e,x:t.x,y:t.y+i,width:t.width,height:t.height,nameLines:t.nameLines,descriptionLines:t.descriptionLines}]:[]}),o=[...n.boundaries].sort((e,t)=>e.depth-t.depth).map(e=>({...e,y:e.y+i})),s=new Map;for(let e of n.elements.values())s.set(e.el.alias,e);for(let e of n.boundaries)s.set(e.alias,e);let c=e.relationships.map((e,t)=>kc(e,t,s,i)),l=[...a.map(e=>({x0:e.x-jc,x1:e.x+e.width+jc,y0:e.y-jc,y1:e.y+e.height+jc,weight:Fc})),...Wc(o)],u=c.map(Uc),d=[];c.forEach((e,t)=>Kc(e,l,u.filter((e,n)=>n!==t),d));let f=n.maxX+$.diagramMarginX,p=n.maxY+$.diagramMarginY+r,m={variant:e.variant,width:f,height:p,elements:a,boundaries:o,relationships:c};return e.title&&(m.title=e.title,m.titlePosition={x:(n.maxX-$.diagramMarginX)/2-4*$.diagramMarginX,y:$.diagramMarginY+$.diagramMarginY+i}),m}function Jc(e,t,n=`Inter`,i=!1,a=Je,o,s,c,l={}){let d=[];d.push($i(M(e.width,e.height,t,i,s??e.title,c,void 0,l.styleAttribute,l.description),o)),d.push(r(n,!1,l.nonce,l.bodyFont)),e.title&&e.titlePosition&&d.push(f`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${z}" `+f`font-size="16" fill="var(--_text)">${u(e.title)}</text>`);for(let t of e.boundaries)d.push(Xc(t));for(let t of e.elements)d.push(Zc(t));for(let t of e.relationships)d.push(al(t));for(let t of e.relationships)d.push(ol(t));return d.push(`</svg>`),d.filter(Boolean).join(`
104
+ `)}function Yc(e,t,n,r,i){return f` <text x="${t}" y="${n}" text-anchor="middle" dy="${z}" font-size="${r}" `+f`${i}>${u(e)}</text>`}function Xc(e){let t=[];t.push(f`<g class="c4-boundary" data-id="${l(e.alias)}" data-label="${l(e.label)}" data-depth="${e.depth}">`),t.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let n=e.x+e.width/2;t.push(Yc(e.label,n,e.y+(e.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=se({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push(Yc(r,n,e.y+e.typeY,$.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push(Yc(e.description,n,e.y+e.descrY,$.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
105
+ `)}function Zc(e){let t=lc(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=rc(e.nameLines.length,e.descriptionLines.length),c=[];c.push(f`<g class="c4-element" data-id="${l(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+f`data-external="${e.external}" data-label="${l(e.label)}">`);let u,d=o;if(e.kind===`person`)c.push(...$c(e,t)),u=r+nc(i).pillTop+$.shapePadding;else if(e.shape===`db`){c.push(...el(e,t));let{ry:n}=ac(i);u=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){c.push(...tl(e,t));let{rx:n}=oc(a);d=o-n,u=r+a/2-s/2}else c.push(f` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`),u=r+$.shapePadding;let p=u;for(let n of e.nameLines)c.push(Yc(n,d,p+$.nameLine/2,$.nameSize,f`font-weight="700" fill="${t.text}"`)),p+=$.nameLine;return c.push(Yc(le(e),d,p+$.typeLine/2,$.typeSize,f`fill="${t.text}"`)),p+=$.typeLine,e.descriptionLines.forEach((e,n)=>{c.push(Yc(e,d,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,f`fill="${t.text}"`))}),p+=ic(e.descriptionLines.length),c.push(`</g>`),c.join(`
106
+ `)}function Qc(e){let{x:t,y:n,width:r,height:i}=e,{rx:a,headRadius:o,pillTop:s}=nc(r,i),c=t+r/2,l=n+s,u=n+i,d=Math.sqrt(Math.max(0,o*o-(l-(n+o))**2));return f`M ${t+a} ${l} H ${c-d} A ${o} ${o} 0 1 1 ${c+d} ${l} `+f`H ${t+r-a} A ${a} ${a} 0 0 1 ${t+r} ${l+a} V ${u-a} `+f`A ${a} ${a} 0 0 1 ${t+r-a} ${u} H ${t+a} `+f`A ${a} ${a} 0 0 1 ${t} ${u-a} V ${l+a} `+f`A ${a} ${a} 0 0 1 ${t+a} ${l} Z`}function $c(e,t){return[f` <path class="c4-person-shape" d="${Qc(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`]}function el(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=ac(i),c=f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[f` <path d="M ${n} ${r+s} L ${n} ${r+a-s} A ${o} ${s} 0 0 0 ${n+i} ${r+a-s} L ${n+i} ${r+s} Z" ${c} />`,f` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function tl(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=oc(a),c=f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[f` <path d="M ${n+i-o} ${r} H ${n+o} A ${o} ${s} 0 0 0 ${n+o} ${r+a} H ${n+i-o} Z" ${c} />`,f` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function nl(e,t){let n=e.x-t.x,r=e.y-t.y,i=Math.hypot(n,r);if(i===0)return``;let a=n/i,o=r/i,s=e.x-a*10,c=e.y-o*10;return f`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s-o*5},${c+a*5} ${s+o*5},${c-a*5}" `+`fill="var(--_text)" />`}var rl=3,il=1;function al(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,f`data-from="${l(e.from)}"`,f`data-to="${l(e.to)}"`];e.label&&r.push(f`data-label="${l(e.label)}"`),e.technology&&r.push(f`data-technology="${l(e.technology)}"`);let i=e.curve?f`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:f`M ${t.x},${t.y} L ${n.x},${n.y}`,a=f`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,s=e.curve??n,c=nl(n,o),u=nl(t,s);return[a,...e.bidirectional?[c,u]:[e.reversed?u:c]].filter(Boolean).join(`
107
+ `)}function ol(e){let t=dc(e),n=fc(e);if(n.length===0)return``;let r=[f`<g class="c4-relationship-label" data-from="${l(e.from)}" data-to="${l(e.to)}">`],i=Math.min(...n.map(e=>e.cx-e.w/2))-rl,a=Math.max(...n.map(e=>e.cx+e.w/2))+rl,o=n[0].cy-n[0].h/2-il,s=n[n.length-1],c=s.cy+s.h/2+il;return r.push(f` <rect class="c4-label-plate" x="${i}" y="${o}" width="${a-i}" height="${c-o}" rx="2" ry="2" fill="var(--bg)" />`),t.forEach((i,a)=>{let o=e.technology!==void 0&&a===t.length-1,s=n[a];r.push(Yc(i,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),r.push(`</g>`),r.join(`
108
+ `)}var sl={type:`xychart`,parse:ye,layoutForSvg:ds,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Cs(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},cl={type:`sequence`,parse:ve,layoutForSvg:Fo,renderSvg(e,t){return Io(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function ll(e){return(e.interactivity??`static`)!==`none`}function ul(e){return(e.interactivity??`static`)===`full`}var dl={type:`class`,parse:me,layoutForSvg:Da,renderSvg(e,t,n){return Na(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,ll(n),t.emit)}},fl={type:`er`,parse:he,layoutForSvg(e,t){return ro(P(e,t.direction),t)},renderSvg(e,t){return oo(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},pl={type:`flowchart`,parse:(e,t)=>F(t),layoutForSvg(e,t){return{graph:Pr(P(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return Gr(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,ul(n),ll(n),t.title,t.decorative,t.emit)}},ml={type:`c4`,parse:pe,layoutForSvg(e,t){return qc(e,t)},renderSvg(e,t){return Jc(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},hl={xychart:sl,er:fl,sequence:cl,class:dl,flowchart:pl,architecture:{type:`architecture`,parse:fe,layoutForSvg(e,t){return{graph:Mr(P(oe(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:pl.renderSvg},c4:ml,pie:{type:`pie`,parse:(e,t)=>ge(t),layoutForSvg:(e,t)=>Is(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return Bs(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}},quadrant:{type:`quadrant`,parse:(e,t)=>_e(t),layoutForSvg:(e,t)=>Ws(t.honorThemeVariables?e:{...e,themeColors:void 0}),renderSvg(e,t){return Ys(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function gl(t){return{bg:t.bg??e.bg,fg:t.fg??e.fg,line:t.line,accent:t.accent,muted:t.muted??(t.bg||t.fg?void 0:e.muted),surface:t.surface,border:t.border}}function _l(e={}){return N(gl(e),e.transparent)}function vl(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute,bodyFont:Ce(e)}}function yl(e,t={}){let{svg:n,colors:r}=Sl(e,t),i=bl(n);return t.resolveColors?ma(i,r):i}function bl(e){let t=new Set(Array.from(e.matchAll(/\sid="([^"]+)"/g),e=>e[1]??``));if(t.size===0)return e;let n=2166136261;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),16777619);let r=`zm${(n>>>0).toString(36)}-`,i=e=>t.has(e)&&!e.startsWith(`zm-`)?r+e:e;return e.replace(/(\sid=")([^"]+)"/g,(e,t,n)=>`${t}${i(n)}"`).replace(/url\(#([^)]+)\)/g,(e,t)=>`url(#${i(t)})`).replace(/(href=")#([^"]+)"/g,(e,t,n)=>`${t}#${i(n)}"`)}function xl(e){let t=d(be(e)).text;hl[s(t)].parse(j(t),t)}function Sl(e,t){a(`maxInputLength`,e.length,t.limits),o(e,t.limits);let r=d(be(e)),c=r.text,l=t.font??`Inter`;A(v(l));let u=t.transparent??!1,f=Ye(t.fontSizes),p=s(c),m=t.embedSource?e:void 0,h=t.title??r.accTitle,g=t.decorative,_={...vl(t),description:r.accDescr},y=j(c),b=hl[p],x=b.parse(y,c),S=x;S.nodes instanceof Map&&Array.isArray(S.edges)&&i(S.nodes.size,S.edges.length,t.limits);let C=b.layoutForSvg(x,t),w=gl(t.honorThemeVariables?n(t,x.initConfig):t),T={colors:w,font:l,transparent:u,fontSizes:f,embedSource:m,title:h,decorative:g,emit:_};return{svg:b.renderSvg(C,T,t),colors:w}}async function Cl(e,t={}){return t.embedFont===`subset`&&await Se(),yl(e,t)}var wl=yl,Tl=Cl;export{xo as ACTOR_LABEL_OFFSET,$e as ARROW_HEAD,Ze as ASYMMETRIC_NOTCH,W as CLS,rt as ELK_DIRECTION_FALLBACK,Pe as ElkNotRegisteredError,Je as FONT_SIZES,L as FONT_WEIGHTS,Xe as GROUP_HEADER_CONTENT_PAD,ct as INLINE_CENTERED_EDGE_LABEL,Ke as MONO_FONT,qe as MONO_FONT_STACK,Qe as NODE_PADDING,Z as PIE,Vs as QUADRANT,_o as SELF_LOOP_CONTROL,vo as SELF_LOOP_EXTENT,yo as SELF_LOOP_HEIGHT,R as STROKE_WIDTHS,z as TEXT_BASELINE_SHIFT,ot as baseElkLayoutOptions,bo as boxLabelHeight,ut as buildElkEdge,lt as buildElkEdgeLabel,st as buildElkLeafNode,et as buildSvgStyleBlock,wa as classBackEdges,ya as classNoteId,It as clipEdgeToShape,Fr as convertToElkFormat,ze as createLayoutCache,it as directionToElk,He as elkLayoutSync,at as elkPadding,Ge as estimateMonoTextWidth,I as estimateTextWidth,ca as evaluateCssColorValue,cn as extractEdgeLabelPosition,sn as extractEdgePoints,bs as formatTickLabels,Co as hasLabelBelowIcon,Da as layoutClassDiagramSync,ro as layoutErDiagramSync,Pr as layoutFlowchartSync,Mr as layoutGraphSync,Is as layoutPieChart,Ws as layoutQuadrantChart,Fo as layoutSequenceDiagram,ds as layoutXYChart,Se as loadEmbeddedFont,S as niceTickValues,Rs as pieColorValue,ke as pointsToPath,Fe as registerElk,Na as renderClassSvg,oo as renderErSvg,Tl as renderMermaid,yl as renderMermaidSVG,Cl as renderMermaidSVGAsync,wl as renderMermaidSync,Bs as renderPieSvg,Ys as renderQuadrantSvg,Io as renderSequenceSvg,Gr as renderSvg,Cs as renderXYChartSvg,ma as resolveCssColors,Ye as resolveFontSizes,Os as smoothCurvePath,Ds as straightLinePath,_l as themeCssVariables,xl as validateMermaid,$i as withDataSrc,_s as xLabelStep};