@zombie-mermaid/svg-renderer 5.14.2 → 5.14.4
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.cjs +70 -62
- package/dist/index.js +71 -63
- package/dist/shared/index.d.ts +8 -6
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
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,
|
|
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,groupStyle 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 A,styleOpenTag as j,subgraphDirectionIsHonored as ee,subgraphFeedbackEdges as te,svgOpenTag as M,themeStyleDeclarations as ne,withDirectionOverride as re,withoutOwnClusterEdges as N}from"@zombie-mermaid/core";import{CHART_ACCENT_FALLBACK as P,architectureToGraph as ie,c4BoundaryTypeLine as ae,c4RelLabelLines as oe,c4TypeLine as se,formatClassMember as ce,getSeriesColor as le,parseArchitecture as ue,parseC4Diagram as de,parseClassDiagram as fe,parseErDiagram as pe,parseMermaid as me,parsePieChart as F,parseQuadrantChart as I,parseSequenceDiagram as he,parseXYChart as ge}from"@zombie-mermaid/mermaid-parser";import{decodeXML as _e}from"entities";var ve;async function ye(){if(ve)return;let e=await import(`./inter-font-subset-DT2grXy3.js`);ve={family:e.INTER_FONT_FAMILY,faceCss:e.INTER_FONT_FACE_CSS}}function be(e){if(e.embedFont===`subset`){if(!ve)throw Error("embedFont: 'subset' needs its font data loaded first: use renderMermaidSVGAsync(), or `await loadEmbeddedFont()` before renderMermaidSVG().");return ve}}function xe(e){return f`M ${e.x} ${e.y}`}function Se(e){return xe(e[0])+e.slice(1).map(e=>f` L ${e.x} ${e.y}`).join(``)}function Ce(e){if(e.length<3)return Se(e);let t=e[e.length-1],n=[xe(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 we(e){return Ee(e,12)}var Te=5*Math.SQRT2;function Ee(e,t){if(e.length<3)return Se(e);let n=t,r=[xe(e[0])];for(let t=1;t<e.length-1;t++){let i=e[t-1],a=e[t],o=e[t+1],s=Math.hypot(a.x-i.x,a.y-i.y),c=Math.hypot(o.x-a.x,o.y-a.y);if(s===0||c===0){r.push(f` L ${a.x} ${a.y}`);continue}let l=Math.min(n,s/2,c/2),u=a.x-(a.x-i.x)/s*l,d=a.y-(a.y-i.y)/s*l,p=a.x+(o.x-a.x)/c*l,m=a.y+(o.y-a.y)/c*l;r.push(f` L ${u} ${d}`),r.push(f` Q ${a.x} ${a.y}, ${p} ${m}`)}let i=e[e.length-1];return r.push(f` L ${i.x} ${i.y}`),r.join(``)}function De(e,t){let n=[xe(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 xe(e[0]);switch(t){case`basis`:return Ce(e);case`natural`:return we(e);case`step`:return De(e,`mid`);case`stepBefore`:return De(e,`before`);case`stepAfter`:return De(e,`after`);default:return Se(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 or ER 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 {
|
|
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=`#087ebf`,tt={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>`},nt={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function rt(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 it(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 at(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":it(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function ot(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var st={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function ct(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 lt(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[ct(e.label,e.labelStyle)]),t}var ut={"state-start":`FIRST`},dt={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function ft(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},pt={top:16,left:16,bottom:16,right:16};function mt(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 ht=new WeakMap;function gt(e,t){let n=ht.get(e);return n||(n=ft(e)||Ct(e.subgraphs)?new Set:p(e,t?.walkOrder,t?.feedbackEdges??te(e)),ht.set(e,n)),n}function _t(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 vt(e){return rt(e,nt.flowchart)}function yt(e){return{...at(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 bt(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:st}}function xt(e,t,n,r,i){if(i!==void 0)return{width:80,height:80};let a=v(t,r,L.nodeLabel),o=a.width+Ze.horizontal*2,s=a.height+Ze.vertical*2;if(n===`diamond`){let e=Math.max(o,s)+Ze.diamondExtra;o=e,s=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(o*o+s*s))+8;o=n===`doublecircle`?e+12:e,s=o}return n===`hexagon`&&(o+=Ze.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(o+=Ze.horizontal),n===`asymmetric`&&(o+=12),n===`cylinder`&&(s+=14),n===`state-start`||n===`state-end`||t===``&&n===`diamond`?{width:28,height:28}:t===``&&n===`fork-join`?{width:70,height:10}:(o=Math.max(o,60),s=Math.max(s,36),{width:o,height:s})}var St=` root`;function Ct(e){for(let t of e)if(t.direction!==void 0||Ct(t.children))return!0;return!1}function wt(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)wt(n,t)}function Tt(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 Et(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function Dt(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),Mt(t,i,a);let o=Nt(e.subgraphs),s=Tt(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];if(n.acrossFlow)continue;let 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=Ct(e.subgraphs),f=[],p=[],m={...yt({direction:vt(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||mt(e))&&!n?.forceNodeOrder?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...mt(e)?{"elk.spacing.edgeEdge":`40`}:{},...n?.forceNodeOrder||At(e)?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...ft(e)?dt:{},"elk.layered.wrapping.strategy":`OFF`,...At(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=Et(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]:St,lt({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:bt(r)}))}let y=At(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=xt(t,o.label,o.shape,r.fontSizes.nodeLabel,o.icon),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=ot(t,i,o.label),c=ft(e)?ut[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),o.gridLayer!==void 0&&(s.layoutOptions={...s.layoutOptions,...kt(o,e.direction)}),f.push(s)}let b=ft(e),x=f.length,S=b?e.subgraphs:[...e.subgraphs].reverse();for(let t of S)f.push(Ot(t,e,r,l,h,g,e.direction));if(b&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<x)return _t(e,new Set([t.id]));let r=e.subgraphs[n-x],i=_t(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return wt(r,a),_t(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=gt(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=lt({id:`e${e}`,source:C.has(e)?t.target:t.source,target:C.has(e)?t.source:t.target,label:t.label,labelStyle:bt(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(St)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(lt({id:`e${e}`,source:C.has(e)?t.target:t.source,target:C.has(e)?t.source:t.target,label:t.label,labelStyle:bt(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function Ot(e,t,n,r,i,a,o){let s=e.direction!==void 0&&j(e,t)?e.direction:o,c=yt({direction:vt(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:e.region?pt: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=ot(r,xt(r,e.label,e.shape,n.fontSizes.nodeLabel,e.icon),e.label);e.gridLayer!==void 0&&(i.layoutOptions=kt(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(Ot(e,t,n,r,i,a,s));let m=[],h=r.get(e.id)??[],g=gt(t);for(let{index:e,edge:t}of h)t.source!==t.target&&m.push(lt({id:`e${e}`,source:g.has(e)?t.target:t.source,target:g.has(e)?t.source:t.target,label:t.label,labelStyle:bt(n)}));for(let t of a.get(e.id)??[])m.push(t);if(At(t)){c[`elk.partitioning.activate`]=`true`;let n=jt(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 kt(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 At(e){for(let t of e.nodes.values())if(t.gridLayer!==void 0)return!0;return!1}function jt(e,t){let n=[...e.nodeIds.map(e=>t.nodes.get(e)?.gridLayer),...e.children.map(e=>jt(e,t))].filter(e=>e!==void 0);return n.length>0?Math.min(...n):void 0}function Mt(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),Mt(r,t,n)}function Nt(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 Pt(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]=Ft(e[0],e[1],t);else{let n=e.length-1;r[n]=Ft(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 Ft(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?Lt(t,c,a)??a:Lt(t,a,o)??a:t<=r?Lt(t,s,c)??s:Lt(t,o,s)??s}{let t=e.y;return l>0?t<=i?It(t,a,c)??c:It(t,c,s)??c:t<=i?It(t,a,o)??o:It(t,o,s)??o}}function It(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 Lt(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 Rt=12;function zt(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,Rt-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 Bt=.5;function Vt(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+Bt,r=e.x+e.width-Bt,i=e.y+Bt,a=e.y+e.height-Bt;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Ht(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(...Ht(e,t,i.children)));return r}function Ut(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Ht(t,n,r).map(e=>e.id)),u=Ht(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 Wt=2;function Gt(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)<=Wt)return!0}return!1}function Kt(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(Gt(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=Ut(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}];Vt(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(Gt(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=Ut(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}];Vt(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(Gt(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=Ut(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}];Vt(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(Gt(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=Ut(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}];Vt(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 qt=1.5,Jt=.01;function Yt(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)<Jt&&Math.abs(i.x-a.x)<Jt&&Math.abs(r.y-i.y)<Jt&&Math.abs(r.x-i.x)<=qt&&Math.abs(r.x-i.x)>=Jt,s=Math.abs(e.y-r.y)<Jt&&Math.abs(i.y-a.y)<Jt&&Math.abs(r.x-i.x)<Jt&&Math.abs(r.y-i.y)<=qt&&Math.abs(r.y-i.y)>=Jt;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 Xt(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 Zt(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,$t=28,en=18,tn=28,nn=10;function rn(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(tn,e.height*.6)/2,a=$t+t*en,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+nn,y:r}}}function an(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}=rn(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:yn(i,e),headColor:vn(e),id:a.id,animate:a.animate})}}function on(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:yn(a,e),headColor:vn(e),id:i.id,animate:i.animate})})}function sn(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(...sn(n.children));return t}function cn(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)_n(e,o);ln(e,t,o,r,a,0,0);let s=sn(a);fn(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),zt(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));an(t,c,i),on(t,c,i),n&&Kt(i,r,a,t.direction);for(let e of i){e.points=Yt(e.points);let t=c.get(e.source),n=c.get(e.target);t&&(e.points=Pt(e.points,t,!0)),n&&(e.points=Pt(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 ln(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=[];ln(s,t,n,r,a,e,c);let o=gn(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.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&&ln(s,t,n,r,i,e,c)}}}function un(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 dn(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 fn(e,t,n,r,i,a){let o=new Map;pn(e,o,0,0);let s=new Map;hn(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??dn(o));let f=mn(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=dn(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:gt(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:yn(e,t),headColor:vn(t),id:i.id,animate:i.animate})}}function pn(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;pn(i,t,n+e,r+a)}}function mn(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 hn(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=un(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=Xt(a,l,u),f=Zt(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)hn(a,t,n+(a.x??0),r+(a.y??0),i)}function gn(e,t){for(let n of e){if(n.id===t)return n;let e=gn(n.children,t);if(e)return e}}function _n(e,t){t.add(e.id);for(let n of e.children)_n(n,t)}function vn(e){return yn(-1,e)?.stroke}function yn(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 bn=10,xn=14,Sn=14,Cn=10,wn=24,Tn=400,En=new Set([`rectangle`,`rounded`,`subroutine`]);function Dn(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 On(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 kn=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function An(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function jn(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<xn&&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<xn&&r>0)return!0}}}return!1}function Mn(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 Nn=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 Pn(e,t,n,r,i,a=[]){let o=Dn(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+Cn,a1:d.a1-Cn,c0:d.c0+Cn,c1:d.c1-Cn},p=a.map(e=>e.map(e=>An(o,e))),m=n.map(e=>kn(o.span(e),bn)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>En.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=>On(n,r,e))||On(n,r,s)||On(n,r,c)||p.some(e=>jn(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-bn),y.add(e.c1+bn);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(Sn,n),i=c.a0-Math.min(Sn,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=Mn(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?Tn:0,i=Nn(n)+wn*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function Fn(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 In=`__zm_spine__`,Ln=8,Rn=6,zn=12,Bn=4,Vn=4,Hn=.25,Un=.02,Wn=40,Gn=e=>e===`TD`||e===`TB`||e===`BT`,Kn=e=>e.startsWith(In);function qn(e){return e.flatMap(e=>[e,...qn(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 Jn(e){if(e.subgraphs.length===0||ft(e)||Ct(e.subgraphs))return!1;for(let t of e.nodes.keys())if(Kn(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=qn(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...H(t)].some(t=>e.nodes.has(t)))}function Yn(e,t){let n=Gn(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 Xn(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=`${In}${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);!Kn(t)&&!Kn(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function Zn(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)Zn(a.children,t,n,r,i)}function Qn(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)||Kn(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 $n=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function er(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?pt: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 tr=e=>e.flatMap(e=>[e,...tr(e.children)]);function nr(e,t,n,r,i,a){let o=Gn(r),s=new Map(qn(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-Wn,y:e.y-Wn,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=tr(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))||!$n(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)=>tr(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 rr(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=te(e),o=t(i,{feedbackEdges:a}),s=Yn(o.nodes,e.direction),c=Gn(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=qn(e.subgraphs),f=Xn(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)]));Zn(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=Qn([...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,Ln+(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=>!Kn(e.id)).map(e=>[e.id,e])),g=er(e.subgraphs,h,n),y=nr(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===zn)return;or(y.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...h.values()],m.edges),g=er(e.subgraphs,h,n),y=nr(g,e.subgraphs,h,e.direction,new Set(p.keys()),s)}let t=ar(e,i,h,g,d);return t&&lr(m,[...h.values()],g,t,e.direction)}if(l===Rn)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>Un?i:Hn;c.set(e,{width:n,overlap:t}),o.set(e,n+t/a+Vn)}}},b=ir(e,f,s,d);return(b.size>0?y(b):void 0)??y(new Set)}function ir(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 ar(e,t,n,r,i){let a=new Map(tr(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=Pn(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?Fn(d):void 0,inlineStyle:yn(r,e),headColor:vn(e),id:t.id,animate:t.animate})}return o}function or(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+Bn,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 sr=8;function cr(e,t,n,r){let i=Gn(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)<sr&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?sr:-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 lr(e,t,n,r,i){let a=[...e.edges.filter(e=>!Kn(e.source)&&!Kn(e.target)),...r],o=tr(n);cr(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 ur=12,dr=8,fr=4;function pr(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=mr(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 mr(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<dr&&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,ur)),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)),hr(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<fr;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 hr(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 gr=28,_r=18,vr=10,yr=32;function br(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=xt(t,r.label,r.shape,n.fontSizes.nodeLabel,r.icon);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)+vr));return gr+(t.length-1)*_r+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+yr,p=r?l+yr: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=pr(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.icon===void 0?n.shape:`rectangle`,icon:n.icon,...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=Yt(xr(u.map(A)));o&&d.reverse();let f=M.get(t.source),p=M.get(t.target);f&&(d=Pt(d,f,!0)),p&&(d=Pt(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:yn(n,e),headColor:vn(e),id:t.id,animate:t.animate})}),an(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 xr(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 Sr(e,t={}){return Cr(e,t)}function Cr(e,t,n){let r={...B,...t,fontSizes:Je(t.fontSizes)};return cn(Ve(Dt(e,r,n),t.layoutCache),e,r.mergeEdges)}function wr(e,t={}){let n=ie(e);if(t.layout===`simple`&&!ft(n))return br(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(Jn(n)){let e=rr(n,(e,n)=>Cr(e,t,n),Je(t.fontSizes));if(e)return e}return Sr(n,t)}function Tr(e,t={}){return Dt(e,{...B,...t,fontSizes:Je(t.fontSizes)})}var Er=12,Dr=2;function Or(e){return e.flatMap(e=>[e,...Or(e.children)])}function kr(e,t){let n=t.groupHeader+16;return Or(e).filter(e=>e.label!==``).map(e=>{let r=v(e.label,t.groupHeader,L.groupHeader);return{x:e.x+Er-Dr,y:e.y+n/2-r.height/2-Dr,width:r.width+4,height:r.height+4}})}function Ar(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 jr(e){return{x:e.x+Dr,y:e.y+Dr,width:e.width-4,height:e.height-4}}function Mr(e,t){let n=e.points,r=t.map(jr);for(let e=0;e+1<n.length;e++)if(r.some(t=>Ar(n[e],n[e+1],t)))return!0;return!1}function Nr(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 Pr(e,t,n){let r=`zm-title-gap-${Nr(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
|
|
10
|
-
`)}function
|
|
11
|
-
`)}function
|
|
12
|
-
</marker>`;return
|
|
13
|
-
`+
|
|
14
|
-
|
|
15
|
-
`)}function
|
|
16
|
-
|
|
17
|
-
`)}
|
|
18
|
-
`)}
|
|
19
|
-
`)}function Ai(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 ji(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 Mi(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 Ni(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+Xr,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 Pi(e){return l(e).replace(/\r/g,` `).replace(/\n/g,` `).replace(/\t/g,`	`)}function Fi(e,t){return t===void 0?e:e.replace(`<svg `,f`<svg data-src="${Pi(t)}" `)}var Ii=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=Ui(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 Li(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 Ri(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 zi=`(?<![\\w-])(var|color-mix)\\(`;function Bi(e,t){let[n,...r]=Ri(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function Vi(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 Hi(e){let t=Ri(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=Vi(r),o=Vi(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 Ui(e,t){let n=``,r=0,i=new RegExp(zi,`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=Li(e,c);if(l===-1)break;let u=Ui(e.slice(c+1,l),t),d=o===`var`?Bi(u,t):Hi(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function Wi(e,t){let n=new Ii;for(let[e,r]of Object.entries(t))n.declare(e,r);return Ui(e,n)}var Gi=/(--[\w-]+)\s*:\s*([^;{}]+)/g,Ki=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,qi=new Set([`data-src`]);function Ji(e,t){Gi.lastIndex=0;let n;for(;(n=Gi.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Yi(e,t){return e.replace(Ki,(e,n,r,i,a)=>{if(qi.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${Ui(a.slice(1,-1),t)}${o}`})}function Xi(e,t){let n=new Ii;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&&Ji(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&Ji(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+=Ui(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:Yi(s,n),i=a+1}return r+e.slice(i)}var Zi=[.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],Qi=[.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 $i(e){return e>=4352?1:.6}function ea(e,t){let n=t?Qi:Zi,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:$i(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 ta(e){return`note ${e}`}function na(e){return`${e} link`}function ra(e){return`namespace ${e}`}function ia(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:ra(i),name:a.name,classIds:e})}return r}function aa(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 oa(e){return m(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function sa(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=pa(t.attributes),l=pa(t.methods),u=Math.max(fa(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=ia(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":it({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=ot(e,t),r=c.get(s.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:a.edgeLabel},d=oa(e),f=[];for(let[t,n]of e.relationships.entries()){let e=d.has(t);f.push(lt({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=ta(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(ot(e,o)),n.forClass!==void 0&&p.has(n.forClass)&&f.push(lt({id:na(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...at({direction:rt(e.direction,nt.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 ca(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=oa(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=Xt(t,r.x,r.y),o=m.has(e)?i.reverse():i,s=Zt(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=ta(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(na(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:Xt(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 la(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let n=aa(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=sa(n.diagram,t,n.labels);return ca(Ve(r,t.layoutCache),e,i,a,o,n)}function ua(e){return e.length*Math.ceil(We(`M`,W.memberFontSize))}function da(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function fa(e){let t=ea(e.label,!0),n=e.annotation?ea(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>ea(da(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+W.mermaidPad*2}function pa(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=ua(ce(n));e>t&&(t=e)}return t}var ma={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function ha(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(Fi(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(_a(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push(ga(t));for(let t of e.relationships)u.push(wa(t));for(let t of e.notes)u.push(Ca(t));for(let t of e.classes)u.push(va(t,i,c));for(let t of e.relationships){let e=Ta(t,i);e&&u.push(e)}for(let t of e.notes)u.push(Sa(t,i));for(let t of e.relationships)u.push(Oa(t,i));return u.push(`</svg>`),u.join(`
|
|
20
|
-
`)}function
|
|
21
|
-
`)}function
|
|
8
|
+
}`;function L(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 R={nodeLabel:500,edgeLabel:400,groupHeader:600},Ye=12,Xe=12,Ze={horizontal:20,vertical:10,diamondExtra:24},z={outerBox:1,innerBox:.75,connector:1},B=`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 et={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!1,thoroughness:3,fontSizes:qe},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=v(e,t.fontSize,R.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 mt={top:51,left:24,bottom:24,right:24},ht={top:51,left:24,bottom:24,right:24},V={top:44,left:16,bottom:16,right:16},gt={top:16,left:16,bottom:16,right:16};function _t(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}function H(e){return e.subgraphs.length>0&&!pt(e)}function vt(e,t,n){if(!(!H(e)||t.nodeSpacing!==et.nodeSpacing||t.layerSpacing!==et.layerSpacing))return n===`root`?{"spacing.baseValue":`40`}:{"spacing.baseValue":`24`,"elk.spacing.nodeNode":`50`,"elk.layered.spacing.edgeNodeBetweenLayers":`30`,"elk.spacing.edgeEdge":`20`}}var yt=[`elk.spacing.nodeNode`,`elk.layered.spacing.nodeNodeBetweenLayers`,`elk.spacing.edgeEdge`,`elk.layered.spacing.edgeEdgeBetweenLayers`,`elk.layered.spacing.edgeNodeBetweenLayers`,`elk.contentAlignment`];function bt(e,t){if(!t)return e;let n={...e};for(let e of yt)delete n[e];return{...n,...t}}function xt(e){let t=new Map,n=(e,r)=>{for(let i of e){r&&t.set(i.id,r);for(let e of i.nodeIds)t.set(e,i.id);n(i.children,i.id)}};n(e.subgraphs);let r=(e,n)=>{for(let r=t.get(e);r!==void 0;r=t.get(r))if(r===n)return!0;return!1},i=e.edges,a=i.map((e,t)=>t);return i.forEach(({source:e,target:t},n)=>{let o=a.indexOf(n),s=a.findIndex((n,a)=>{let s=i[n];return a<o&&(s.target===t&&r(e,s.source)||s.source===e&&r(t,s.target))});s!==-1&&(a.splice(o,1),a.splice(s,0,n))}),a}var St=`[top=12,left=12,bottom=12,right=12]`,Ct=new WeakMap;function wt(e){let t=Ct.get(e);return t||(t=Nt(e.subgraphs)?new Set:H(e)?te(e):p(e,void 0,te(e)),Ct.set(e,t)),t}function Tt(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 Et(e){return it(e,rt.flowchart)}function Dt(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 Ot(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:ct}}var kt=136,At=40;function jt(e,t,n,r,i,a,o=!1){if(i!==void 0)return{width:80,height:80};let s=v(t,r,R.nodeLabel),c=s.width+Ze.horizontal*2,l=s.height+Ze.vertical*2;if(n===`diamond`){let e=Math.max(c,l)+Ze.diamondExtra;c=e,l=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(c*c+l*l))+8;c=n===`doublecircle`?e+12:e,l=c}if(n===`hexagon`&&(c+=Ze.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(c+=Ze.horizontal),n===`asymmetric`&&(c+=12),n===`cylinder`&&(l+=14),n===`cloud`){let e=Math.max(c,l*2.5);return{width:e*1.25,height:l+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:14,height:14}:n===`junction`?{width:2,height:2}:t===``&&n===`diamond`?{width:28,height:28}:t===``&&n===`fork-join`?{width:70,height:10}:(c=Math.max(c,o?kt:60),l=Math.max(l,o?At:36),{width:c,height:l})}var Mt=` root`;function Nt(e){for(let t of e)if(t.direction!==void 0||Nt(t.children))return!0;return!1}function Pt(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)Pt(n,t)}function Ft(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 It(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function Lt(e,t){let n=t,r=new Set,i=new Set;for(let t of e.subgraphs)i.add(t.id),zt(t,r,i);let a=Bt(e.subgraphs),o=Ft(e.subgraphs),s=e=>e?o.get(e)??[]:[],c=new Map;c.set(null,[]);let l=[];for(let t=0;t<e.edges.length;t++){let n=e.edges[t],r=a.get(n.source),i=a.get(n.target);if(r&&r===i){let e=c.get(r)??[];c.set(r,e),e.push({index:t,edge:n})}else!r&&!i?c.get(null).push({index:t,edge:n}):l.push({index:t,edge:n,srcChain:s(r),tgtChain:s(i)})}let u=Nt(e.subgraphs),d=[],f=[],p={...bt(Dt({direction:Et(e.direction),nodeSpacing:n.nodeSpacing,layerSpacing:pt(e)&&n.layerSpacing===et.layerSpacing?40:n.layerSpacing,padding:n.padding}),vt(e,n,`root`)),...H(e)?{}:{"elk.layered.thoroughness":String(et.thoroughness)},"elk.layered.highDegreeNodes.treatment":`false`,"elk.layered.compaction.postCompaction.strategy":e.subgraphs.length===0||_t(e)||H(e)?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...H(e)?{"elk.layered.cycleBreaking.strategy":`DEPTH_FIRST`}:{},..._t(e)?{"elk.spacing.edgeEdge":H(e)?`50`:`40`}:{},...pt(e)?ft:{},"elk.layered.wrapping.strategy":`OFF`,"elk.hierarchyHandling":u?`SEPARATE`:`INCLUDE_CHILDREN`},m=new Map,h=new Map;function g(e,t){let n=m.get(e)??new Set;m.set(e,n),n.add(t)}function _(e,t){let n=h.get(e)??[];h.set(e,n),n.push(t)}if(u)for(let{index:e,edge:t,srcChain:r,tgtChain:i}of l){let a=It(r,i),o=t.source;if(r.length>a){for(let n=r.length-1;n>=a;n--){let i=r[n],a=`${i}_out_${e}`;g(i,a);let o=n===r.length-1?t.source:`${r[n+1]}_out_${e}`;_(i,{id:`e${e}_s${n}`,sources:[o],targets:[a]})}o=`${r[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}`;g(r,a);let o=n===i.length-1?t.target:`${i[n+1]}_in_${e}`;_(r,{id:`e${e}_t${n}`,sources:[a],targets:[o]})}s=`${i[a]}_in_${e}`}_(a>0?r[a-1]:Mt,ut({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:Ot(n)}))}for(let[t,a]of e.nodes)if(!r.has(t)&&!i.has(t)){let r=st(t,jt(t,a.label,a.shape,n.fontSizes.nodeLabel,a.icon,e.direction,pt(e)),a.label),i=pt(e)?dt[a.shape]:void 0;i!==void 0&&(r.layoutOptions={"elk.layered.layering.layerConstraint":i}),d.push(r)}let v=pt(e),y=d.length,b=v?e.subgraphs:[...e.subgraphs].reverse();for(let t of b)d.push(Rt(t,e,n,c,m,h,e.direction));if(H(e)&&d.unshift(...d.splice(y)),v&&e.subgraphs.length>0){let t=d.map((t,n)=>{if(n<y)return Tt(e,new Set([t.id]));let r=e.subgraphs[n-y],i=Tt(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return Pt(r,a),Tt(e,a)}),n=d.map((e,t)=>t).sort((e,n)=>t[e]-t[n]||e-n).map(e=>d[e]);d.splice(0,d.length,...n)}let x=wt(e),S=H(e)&&!u,C=c.get(null);if(S)for(let t of xt(e)){let r=e.edges[t];f.push(ut({id:`e${t}`,source:x.has(t)?r.target:r.source,target:x.has(t)?r.source:r.target,label:r.label,labelStyle:Ot(n)}))}for(let{index:e,edge:t}of S?[]:C)t.source!==t.target&&f.push(ut({id:`e${e}`,source:x.has(e)?t.target:t.source,target:x.has(e)?t.source:t.target,label:t.label,labelStyle:Ot(n)}));if(u)for(let e of h.get(Mt)??[])f.push(e);else for(let{index:e,edge:t}of S?[]:l)f.push(ut({id:`e${e}`,source:x.has(e)?t.target:t.source,target:x.has(e)?t.source:t.target,label:t.label,labelStyle:Ot(n)}));return{id:`root`,layoutOptions:p,children:d,edges:f}}function Rt(e,t,n,r,i,a,o){let s=e.direction!==void 0&&ee(e,t)?e.direction:o,c=bt(Dt({direction:Et(s),nodeSpacing:n.nodeSpacing,layerSpacing:pt(t)&&n.layerSpacing===et.layerSpacing?24:n.layerSpacing,padding:e.region?gt:pt(t)?mt:H(t)?ht:V}),vt(t,n,`subgraph`));if(H(t)&&!e.region){let t=v(e.label,n.fontSizes.groupHeader,R.groupHeader).width+24;c[`elk.nodeSize.constraints`]=`[MINIMUM_SIZE]`,c[`elk.nodeSize.minimum`]=s===`TD`||s===`TB`||s===`BT`?`(0, ${t})`:`(${t}, 0)`}H(t)&&(c[`elk.layered.cycleBreaking.strategy`]=`DEPTH_FIRST`,c[`elk.spacing.portsSurrounding`]=St);let l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[],f=H(t),p=f?[...t.nodes.keys()].filter(t=>e.nodeIds.includes(t)):e.nodeIds;for(let e of p){let r=t.nodes.get(e);if(r){let i=st(e,jt(e,r.label,r.shape,n.fontSizes.nodeLabel,r.icon,t.direction,pt(t)),r.label);d.push(i)}}let m=e.children.some(e=>e.region)?e.children:[...e.children].reverse(),h=d.length;for(let e of m)d.push(Rt(e,t,n,r,i,a,s));f&&d.unshift(...d.splice(h));let g=[],_=r.get(e.id)??[],y=wt(t);for(let{index:e,edge:r}of H(t)&&!Nt(t.subgraphs)?[]:_)r.source!==r.target&&g.push(ut({id:`e${e}`,source:y.has(e)?r.target:r.source,target:y.has(e)?r.source:r.target,label:r.label,labelStyle:Ot(n)}));for(let t of a.get(e.id)??[])g.push(t);return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:g}}function zt(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),zt(r,t,n)}function Bt(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 Vt(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]=Ht(e[0],e[1],t);else{let n=e.length-1;r[n]=Ht(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 Ht(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?Wt(t,c,a)??a:Wt(t,a,o)??a:t<=r?Wt(t,s,c)??s:Wt(t,o,s)??s}{let t=e.y;return l>0?t<=i?Ut(t,a,c)??c:Ut(t,c,s)??c:t<=i?Ut(t,a,o)??o:Ut(t,o,s)??o}}function Ut(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 Wt(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 Gt=12;function Kt(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=et.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&&qt(t,l,r?`x`:`y`)}function qt(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,Gt-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 Jt=.5;function Yt(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+Jt,r=e.x+e.width-Jt,i=e.y+Jt,a=e.y+e.height-Jt;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Xt(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(...Xt(e,t,i.children)));return r}function Zt(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Xt(t,n,r).map(e=>e.id)),u=Xt(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 Qt=2;function $t(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)<=Qt)return!0}return!1}function en(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($t(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=Zt(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}];Yt(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($t(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=Zt(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}];Yt(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($t(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=Zt(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}];Yt(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($t(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=Zt(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}];Yt(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 tn=1.5,nn=.01;function rn(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)<nn&&Math.abs(i.x-a.x)<nn&&Math.abs(r.y-i.y)<nn&&Math.abs(r.x-i.x)<=tn&&Math.abs(r.x-i.x)>=nn,s=Math.abs(e.y-r.y)<nn&&Math.abs(i.y-a.y)<nn&&Math.abs(r.x-i.x)<nn&&Math.abs(r.y-i.y)<=tn&&Math.abs(r.y-i.y)>=nn;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 an(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 on(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 sn=16,cn=28,ln=18,un=28,dn=10;function fn(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(un,e.height*.6)/2,a=cn+t*ln,o=[];for(let e=0;e<=sn;e++){let t=Math.PI*e/sn;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+dn,y:r}}}function pn(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}=fn(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:En(i,e),headColor:Tn(e),id:a.id,animate:a.animate,startMarker:a.startMarker,endMarker:a.endMarker})}}function mn(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(...mn(n.children));return t}function hn(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)wn(e,o);gn(e,t,o,r,a,0,0);let s=mn(a);yn(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),Kt(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));pn(t,c,i),n&&en(i,r,a,t.direction);for(let e of i){e.points=rn(e.points);let t=c.get(e.source),n=c.get(e.target);t&&(e.points=Vt(e.points,t,!0)),n&&(e.points=Vt(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=Qe.width,f=et.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 gn(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=[];gn(s,t,n,r,a,e,c);let o=Cn(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:c,width:l,height:u,children:a,...g(s.id,t),...o?.region?{region:!0}:{},...o?.icon?{icon:o.icon}:{}})}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.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&&gn(s,t,n,r,i,e,c)}}}function _n(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 vn(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 yn(e,t,n,r,i,a){let o=new Map;bn(e,o,0,0);let s=new Map;Sn(e,s,0,0,o);let c=0;for(let[e,r]of s){let i=t.edges[e];if(!i||i.source===i.target)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??vn(o));let f=xn(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=vn(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:wt(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:En(e,t),headColor:Tn(t),id:i.id,animate:i.animate,startMarker:i.startMarker,endMarker:i.endMarker})}}function bn(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;bn(i,t,n+e,r+a)}}function xn(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 Sn(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=_n(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=an(a,l,u),f=on(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)Sn(a,t,n+(a.x??0),r+(a.y??0),i)}function Cn(e,t){for(let n of e){if(n.id===t)return n;let e=Cn(n.children,t);if(e)return e}}function wn(e,t){t.add(e.id);for(let n of e.children)wn(n,t)}function Tn(e){return En(-1,e)?.stroke}function En(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 Dn=e=>e===`TD`||e===`TB`||e===`BT`,On=8;function kn(e,t,n,r){let i=Dn(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)<On&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?On:-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}}var An=12,jn=8,Mn=4;function Nn(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=Pn(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 Pn(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<jn&&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,An)),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)),Fn(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<Mn;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 Fn(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 In=28,Ln=18,Rn=10,zn=32;function Bn(e,t={}){let n={...et,...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,R.edgeLabel),o=a.width+8,s=a.height+6;return r?{axis:s,cross:o}:{axis:o,cross:s}},h=new Map,_=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target){_.set(e.source,[..._.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 y=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=jt(t,r.label,r.shape,n.fontSizes.nodeLabel,r.icon,e.direction,pt(e));x.set(t,b(i.width,i.height))}let S=e=>{let t=_.get(e);if(!r||!t)return 0;let n=Math.max(0,...t.map(e=>(m(e)?.cross??-10)+Rn));return In+(t.length-1)*Ln+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=v(t.label,n.fontSizes.groupHeader,R.groupHeader).width,u=c.axisSize+y.axisStart+y.axisEnd,d=c.crossSize+y.crossStart+y.crossEnd,f=r?0:l+zn,p=r?l+zn: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:y.axisStart+m/2,cross:y.crossStart+h/2})}let c=new Map(t.map((e,t)=>[e,t])),l=h.get(e??``)??[],u=Nn(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,D=new Map,O=(t,n,r)=>{for(let[e,i]of t.routes)D.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,...g(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}},M=e=>{for(let t of e)Object.assign(t,te(T.get(t.id))),M(t.children)};M(k);let ne=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:E(t,e),className:e.classAssignments.get(t),interaction:e.interactions.get(t)}}),re=new Map(ne.map(e=>[e.id,e])),N=[];e.edges.forEach((t,n)=>{let r=D.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=rn(Vn(u.map(ee)));o&&d.reverse();let f=re.get(t.source),p=re.get(t.target);f&&(d=Vt(d,f,!0)),p&&(d=Vt(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:En(n,e),headColor:Tn(e),id:t.id,animate:t.animate,startMarker:t.startMarker,endMarker:t.endMarker})}),pn(e,re,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+Qe.width+A),ie=Math.max(ie,t.y+Qe.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:ne,edges:N,groups:k}}function Vn(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 Hn(e,t={}){let n={...et,...t,fontSizes:Je(t.fontSizes)};return hn(Ve(Lt(e,n),t.layoutCache),e,n.mergeEdges)}function Un(e,t={}){let n=Wn(e,t),r=new Set,i=e=>{for(let t of e)t.stateComposite&&r.add(t.id),i(t.children)};i(e.subgraphs);let a=e=>{for(let t of e)!t.region&&!r.has(t.id)&&(t.bandless=!0),a(t.children)};return a(n.groups),e.stateDiagram&&(n.stateDiagram=!0),n}function Wn(e,t){let n=N(e);if(t.layout===`simple`&&!pt(n))return Bn(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'.`);let r=Hn(n,t);if(H(n)){let e=t=>t.flatMap(t=>[t,...e(t.children)]);kn(r.edges,r.nodes,e(r.groups),n.direction)}return r}function Gn(e,t={}){return Lt(e,{...et,...t,fontSizes:Je(t.fontSizes)})}var Kn=2;function qn(e){return e.flatMap(e=>[e,...qn(e.children)])}function Jn(e,t){let n=t.groupHeader+16;return qn(e).filter(e=>e.label!==``).map(e=>{let r=v(e.label,t.groupHeader,400);return{x:e.x+e.width/2-r.width/2-Kn,y:e.y+(e.bandless?n:26)/2-r.height/2-Kn,width:r.width+4,height:r.height+4}})}function Yn(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 Xn(e){return{x:e.x+Kn,y:e.y+Kn,width:e.width-4,height:e.height-4}}function Zn(e,t){let n=e.points,r=t.map(Xn);for(let e=0;e+1<n.length;e++)if(r.some(t=>Yn(n[e],n[e+1],t)))return!0;return!1}function Qn(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 $n(e,t,n){let r=`zm-title-gap-${Qn(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 er(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(gi(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(tr(f.nonce)),p.push(`<defs>`),p.push(nr(e.stateDiagram===!0));let h=new Set;for(let t of e.edges){let e=ur(t);e&&h.add(e)}for(let t of h)p.push(rr(t,e.stateDiagram===!0));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(sr(e));let _=Jn(e.groups,a),v=new Set(e.edges.filter(e=>Zn(e,_))),y;if(v.size>0){let t=$n(_,e.width,e.height);y=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(mr(t,n,a));for(let t of e.edges)p.push(hr(t,o,c,v.has(t)?y:void 0,e.stateDiagram===!0));for(let t of e.edges)t.label&&p.push(gr(t,n,a));for(let t of e.nodes)p.push(br(t,n,a,l,e.stateDiagram===!0));return p.push(`</svg>`),p.join(`
|
|
10
|
+
`)}function tr(e){return[j(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 nr(e){return ar(`var(--_arrow)`,``,e)}function rr(e,t){return ar(l(e),f`-${dr(e)}`,t)}var ir=3.5;function ar(e,t,n){if(n)return or(e,t);let r=10.5,i=12.8,a=f`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,o=f`<polygon points="0 0, ${r} ${i/2}, 0 ${i}" ${a} />`,s=(e,t)=>f` <marker id="${e}" markerWidth="${r}" markerHeight="${i}" refX="${9.5}" refY="${i/2}" markerUnits="userSpaceOnUse" orient="${t}">`+f`\n ${o}`+`
|
|
12
|
+
</marker>`;return s(f`arrowhead${t}`,`auto`)+`
|
|
13
|
+
`+s(f`arrowhead-start${t}`,`auto-start-reverse`)}function or(e,t){let n=(t,n)=>f` <marker id="${t}" markerWidth="20" markerHeight="14" refX="17" refY="7" markerUnits="userSpaceOnUse" orient="${n}">`+f`\n <path d="M 19,7 L11,14 L13,7 L11,0 Z" fill="${e}" />`+`
|
|
14
|
+
</marker>`;return n(f`arrowhead${t}`,`auto`)+`
|
|
15
|
+
`+n(f`arrowhead-start${t}`,`auto-start-reverse`)}function sr(e){return e===`circle`?f`<marker id="circle" viewBox="0 0 10 10" refX="12.25" refY="5" markerUnits="userSpaceOnUse" markerWidth="14" markerHeight="14" orient="auto-start-reverse"><circle cx="5" cy="5" r="5" fill="var(--_arrow)"/></marker>`:f`<marker id="cross" viewBox="0 0 15 15" refX="17.7" refY="7.5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto-start-reverse"><path d="M1 1L14 14M1 14L14 1" stroke="var(--_arrow)" stroke-width="2.5"/></marker>`}var cr=5.5;function lr(e){let t=e.points.map(e=>({...e})),n=(e,n)=>{let r=t[e],i=t[n],a=Math.hypot(i.x-r.x,i.y-r.y);a<=cr||(r.x+=(i.x-r.x)/a*cr,r.y+=(i.y-r.y)/a*cr)};return e.hasArrowEnd&&!e.endMarker&&n(t.length-1,t.length-2),e.hasArrowStart&&!e.startMarker&&n(0,1),t}function ur(e){return e.headColor??e.inlineStyle?.stroke}function dr(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function fr(e){let t=e?.[`stroke-dasharray`];return t&&/^[\d.\s,]+$/.test(t)?f` stroke-dasharray="${t.trim()}"`:``}var pr=30;function mr(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="${z.outerBox}" stroke-dasharray="6 4" />`);for(let r of e.children)i.push(mr(r,t,n));return i.push(`</g>`),i.join(`
|
|
16
|
+
`)}if(e.architecture){let r=e.icon&&(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 class="subgraph" data-id="${l(e.id)}" data-label="${l(e.label)}">`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" fill="none" stroke="var(--_node-stroke)" stroke-width="${Tr}" stroke-dasharray="${Er}" />`),r&&i.push(f` <g transform="translate(${e.x+1} ${e.y+1}) scale(${pr/80})"><rect width="${80}" height="${80}" fill="${tt}" />${r}</g>`),i.push(` `+w(e.label,e.x+(r?34:6),e.y+1+pr/2,n.groupHeader,f`font-size="${n.groupHeader}" font-weight="400" fill="var(--_text)"`));for(let r of e.children)i.push(mr(r,t,n));return i.push(`</g>`),i.join(`
|
|
17
|
+
`)}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(z.outerBox)),c=fr(a),u=l(a?.fill??`var(--_group-fill)`),d=l(a?.fill??`var(--_group-hdr)`),p=e.bandless===!0;if(i.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="${p?0:Sr}" ry="${p?0:Sr}" fill="${p?u:d}" stroke="${o}" stroke-width="${s}"${c} />`),e.bandless){i.push(` `+w(e.label,e.x+e.width/2,e.y+r/2,n.groupHeader,f`text-anchor="middle" font-size="${n.groupHeader}" font-weight="${400}" fill="${l(a?.color??`var(--_text-sec)`)}"`));for(let r of e.children)i.push(mr(r,t,n));return i.push(`</g>`),i.join(`
|
|
18
|
+
`)}i.push(f` <rect x="${e.x}" y="${e.y+26}" width="${e.width}" height="${Math.max(0,e.height-26-wr)}" `+f`rx="0" ry="0" fill="${u}" stroke="${o}" stroke-width="${s}"${c} />`);let m=e.x+e.width/2;i.push(` `+w(e.label,m,e.y+13,n.groupHeader,f`text-anchor="middle" font-size="${n.groupHeader}" font-weight="${400}" fill="${l(a?.color??`var(--_text-sec)`)}"`));for(let r of e.children)i.push(mr(r,t,n));return i.push(`</g>`),i.join(`
|
|
19
|
+
`)}function hr(e,t,n=!0,r,i=!1){if(e.points.length<2)return``;let a=n&&(e.animate??!1),o=e.style===`invisible`,s=e.style===`dotted`?` stroke-dasharray="2 2"`:``,c=e.style===`thick`?ir:z.connector,u=o?`none`:l(e.inlineStyle?.stroke??`var(--_line)`),d=l(e.inlineStyle?.[`stroke-width`]??String(c)),p=ur(e),m=p?f`-${dr(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${a?` 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 _=a&&!s?` stroke-dasharray="8 6"`:``,v=i?lr(e):e.points,y=t===`linear`?Ee(v,Te):Oe(v,t);return f`<path ${g.join(` `)} d="${y}" `+f`fill="none" stroke="${u}" `+f`stroke-width="${d}"${s}${_}${h}`+(r?f` mask="url(#${r})"`:``)+` />`}function gr(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??vr(e.points),a=v(r,n.edgeLabel,R.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="${R.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,`
|
|
20
|
+
`)}\n`+`</g>`}function _r(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+=yr(_r(e,n-1),_r(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=_r(e,t-1),i=_r(e,t),a=yr(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 yr(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function br(e,t,n,r=!0,i=!1){let a=Or(e,i),o=mi(e,t,n),s=[],c=O(e.className),d=c?f`node ${c}`:`node`,p=e.interaction,m=[f`class="${d}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`,f`data-shape="${e.shape}"`];s.push(f`<g ${m.join(` `)}>`);let h=r?D(p?.href):void 0,g=h?` `:` `;if(h){let e=p?.target?f` target="${l(p.target)}"`:``;s.push(f` <a href="${l(h)}"${e}>`)}return r&&p?.tooltip&&s.push(f`${g}<title>${u(p.tooltip)}</title>`),s.push(f`${g}${a.replace(/\n/g,f`\n${g}`)}`),o&&s.push(f`${g}${o.replace(/\n/g,f`\n${g}`)}`),h&&s.push(` </a>`),s.push(`</g>`),s.join(`
|
|
21
|
+
`)}var xr=13,Sr=5,Cr=5,wr=4,Tr=2,Er=8;function Dr(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="var(--_node-stroke)" stroke-width="${Tr}" stroke-dasharray="${Er}" />`;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 Or(e,t){let n=kr(e,t),r=e.icon===void 0?fr(e.inlineStyle):``;return r&&n?f`<g${r}>${n}</g>`:n}function kr(e,t){let{x:n,y:r,width:i,height:a,shape:o,inlineStyle:s}=e;if(e.icon!==void 0)return Dr(n,r,e.icon);let c=l(s?.fill??`var(--_node-fill)`),u=l(s?.stroke??`var(--_node-stroke)`),d=l(s?.[`stroke-width`]??String(z.innerBox)),f=e=>e&&/^\d+(\.\d+)?(px)?$/.test(e)?parseFloat(e):0,p=f(s?.rx),m={rx:p,ry:s?.ry===void 0?p:f(s.ry)};switch(o){case`diamond`:return Pr(n,r,i,a,c,u,d);case`rounded`:return jr(n,r,i,a,c,u,d,t?Cr:6);case`stadium`:return Mr(n,r,i,a,c,u,d);case`circle`:return Nr(n,r,i,a,c,u,d);case`subroutine`:return Fr(n,r,i,a,c,u,d);case`doublecircle`:return Ir(n,r,i,a,c,u,d);case`hexagon`:return Lr(n,r,i,a,c,u,d);case`cylinder`:return Rr(n,r,i,a,c,u,d);case`asymmetric`:return zr(n,r,i,a,c,u,d);case`trapezoid`:return Br(n,r,i,a,c,u,d);case`trapezoid-alt`:return Vr(n,r,i,a,c,u,d);case`parallelogram`:return Hr(n,r,i,a,c,u,d);case`parallelogram-alt`:return Ur(n,r,i,a,c,u,d);case`state-start`:return fi(n,r,i,a);case`state-end`:return pi(n,r,i,a);case`document`:return Wr(n,r,i,a,c,u,d);case`stacked-document`:return Gr(n,r,i,a,c,u,d,!0);case`stacked-process`:return Gr(n,r,i,a,c,u,d,!1);case`card`:return Kr(n,r,i,a,c,u,d);case`lined-process`:return qr(n,r,i,a,c,u,d);case`divided-process`:return Jr(n,r,i,a,c,u,d);case`window-pane`:return Yr(n,r,i,a,c,u,d);case`triangle`:return Xr(n,r,i,a,c,u,d,!1);case`flipped-triangle`:return Xr(n,r,i,a,c,u,d,!0);case`junction`:return``;case`filled-circle`:return Zr(n,r,i,a,u);case`crossed-circle`:return Qr(n,r,i,a,c,u,d);case`fork-join`:return $r(n,r,i,a,u);case`note`:return ii(n,r,i,a,l(s?.fill??`var(--bg)`),u,d);case`notched-pentagon`:return ai(n,r,i,a,c,u,d);case`sloped-rectangle`:return oi(n,r,i,a,c,u,d);case`flag`:return si(n,r,i,a,c,u,d);case`bow-tie-rectangle`:return ci(n,r,i,a,c,u,d);case`half-rounded-rectangle`:return li(n,r,i,a,c,u,d);case`brace`:return ui(n,r,i,a,c,u,d,`left`);case`brace-right`:return ui(n,r,i,a,c,u,d,`right`);case`braces`:return ui(n,r,i,a,c,u,d,`both`);case`bolt`:return di(n,r,i,a,c,u,d);case`cloud`:return ei(n,r,i,a,c,u,d);case`horizontal-cylinder`:return ti(n,r,i,a,c,u,d);case`tagged-rectangle`:return ni(n,r,i,a,c,u,d);case`fork-bar`:return Ar(n,r,i,a,c,u,d);case`small-circle`:return ri(n,r,i,a,c,u,d);case`text`:case`anchor`:return``;default:return Ar(n,r,i,a,c,u,d,m)}}function Ar(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 jr(e,t,n,r,i,a,o,s){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Mr(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 Nr(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 Pr(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 Fr(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 Ir(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 Lr(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 Rr(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 zr(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 Br(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 Vr(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 Hr(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 Ur(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 Wr(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 Gr(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?Wr(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(`
|
|
22
|
+
`)}function Kr(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 qr(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 Jr(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 Yr(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 Xr(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 Zr(e,t,n,r,i){let a=Math.min(n,r)/2;return f`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function Qr(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 $r(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 ei(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 ti(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 ni(e,t,n,r,i,a,o){let s=.2*r;return Ar(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 ri(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 ii(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 ai(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 oi(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 si(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 ci(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 li(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 ui(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(`
|
|
23
|
+
`)}function di(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 fi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2;return f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function pi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2,s=o*5/14;return f`<circle cx="${i}" cy="${a}" r="${o}" `+f`fill="none" stroke="var(--_text)" stroke-width="2" />`+f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function mi(e,n,r){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let i=e.x+e.width/2+(e.shape===`asymmetric`?6:0),a=e.label.split(`
|
|
24
|
+
`).length,o=e.icon===void 0?e.y+e.height/2:e.y+e.height+xr+(a-1)/2*r.nodeLabel*t,s=l(e.inlineStyle?.color??`var(--_text)`),c=f`text-anchor="middle" font-size="${r.nodeLabel}" font-weight="${R.nodeLabel}" fill="${s}"`,u=e.inlineStyle?.[`font-family`];return u&&(c+=f` style="font-family: ${l(u)};"`),w(e.label,i,o,r.nodeLabel,c)}function hi(e){return l(e).replace(/\r/g,` `).replace(/\n/g,` `).replace(/\t/g,`	`)}function gi(e,t){return t===void 0?e:e.replace(`<svg `,f`<svg data-src="${hi(t)}" `)}var _i=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=wi(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 vi(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 yi(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 bi=`(?<![\\w-])(var|color-mix)\\(`;function xi(e,t){let[n,...r]=yi(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function Si(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 Ci(e){let t=yi(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=Si(r),o=Si(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 wi(e,t){let n=``,r=0,i=new RegExp(bi,`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=vi(e,c);if(l===-1)break;let u=wi(e.slice(c+1,l),t),d=o===`var`?xi(u,t):Ci(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function Ti(e,t){let n=new _i;for(let[e,r]of Object.entries(t))n.declare(e,r);return wi(e,n)}var Ei=/(--[\w-]+)\s*:\s*([^;{}]+)/g,Di=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,Oi=new Set([`data-src`]);function ki(e,t){Ei.lastIndex=0;let n;for(;(n=Ei.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Ai(e,t){return e.replace(Di,(e,n,r,i,a)=>{if(Oi.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${wi(a.slice(1,-1),t)}${o}`})}function ji(e,t){let n=new _i;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&&ki(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&ki(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+=wi(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:Ai(s,n),i=a+1}return r+e.slice(i)}var Mi=[.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],Ni=[.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 Pi(e){return e>=4352?1:.6}function Fi(e,t){let n=t?Ni:Mi,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:Pi(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 Ii(e){return`note ${e}`}function Li(e){return`${e} link`}function Ri(e){return`namespace ${e}`}function zi(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:Ri(i),name:a.name,classIds:e})}return r}function Bi(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 Vi(e){return m(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function Hi(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:L(t.label,a.nodeLabel,R.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=L(t.label,a.nodeLabel,R.nodeLabel),c=Ji(t.attributes),l=Ji(t.methods),u=Math.max(qi(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=zi(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=L(e.name,W.namespaceTitleFontSize,R.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=Vi(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=Ii(t),r=v(n.text,a.edgeLabel,R.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:Li(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 Ui(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=Vi(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=an(t,r.x,r.y),o=m.has(e)?i.reverse():i,s=on(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=Ii(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(Li(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:an(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 Wi(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let n=Bi(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=Hi(n.diagram,t,n.labels);return Ui(Ve(r,t.layoutCache),e,i,a,o,n)}function Gi(e){return e.length*Math.ceil(We(`M`,W.memberFontSize))}function Ki(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function qi(e){let t=Fi(e.label,!0),n=e.annotation?Fi(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>Fi(Ki(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+W.mermaidPad*2}function Ji(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=Gi(ce(n));e>t&&(t=e)}return t}var Yi={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function Xi(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(gi(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(Qi(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push(Zi(t));for(let t of e.relationships)u.push(aa(t));for(let t of e.notes)u.push(ia(t));for(let t of e.classes)u.push($i(t,i,c));for(let t of e.relationships){let e=oa(t,i);e&&u.push(e)}for(let t of e.notes)u.push(ra(t,i));for(let t of e.relationships)u.push(la(t,i));return u.push(`</svg>`),u.join(`
|
|
25
|
+
`)}function Zi(e){let{x:t,y:n,width:r,height:i}=e,a=W.namespaceTitleHeight,o=z.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="${B}" font-size="${W.namespaceTitleFontSize}" font-weight="${R.groupHeader}" fill="var(--_text-sec)">${ha(e.name)}</text>`,`</g>`].join(`
|
|
26
|
+
`)}function Qi(e){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
|
|
22
27
|
<polygon points="0 0, 12 5, 0 10" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
|
|
23
28
|
</marker>
|
|
24
29
|
<marker id="cls-composition" markerWidth="18" markerHeight="14" refX="16.5" refY="7" orient="auto-start-reverse">
|
|
@@ -32,54 +37,55 @@ import{DEFAULTS as e,LINE_HEIGHT_RATIO as t,applyThemeVariables as n,buildStyleB
|
|
|
32
37
|
</marker>`+(e?`
|
|
33
38
|
<marker id="cls-lollipop" markerWidth="12" markerHeight="12" refX="11" refY="6" orient="auto-start-reverse">
|
|
34
39
|
<circle cx="6" cy="6" r="5" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
|
|
35
|
-
</marker>`:``)}function
|
|
36
|
-
`)}var
|
|
37
|
-
</g>`}function
|
|
38
|
-
</g>`}function
|
|
39
|
-
`)}function
|
|
40
|
-
`)}function
|
|
41
|
-
|
|
42
|
-
`)}function
|
|
43
|
-
`)
|
|
44
|
-
`)}function
|
|
45
|
-
`)}function
|
|
46
|
-
`)}function
|
|
47
|
-
`)
|
|
48
|
-
`).length
|
|
49
|
-
`)}function
|
|
40
|
+
</marker>`:``)}function $i(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)`),g=l(u?.[`stroke-width`]??String(z.outerBox)),_=u?.fill?m:`var(--_group-hdr)`,v=u?.color?l(u.color):void 0,y=e.annotation?f` data-annotation="${l(e.annotation)}"`:``,b=O(e.className),x=[f`class="${b?f`class-node ${b}`:`class-node`}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`];d.push(f`<g ${x.join(` `)}${y}>`);let S=n?D(p?.href):void 0;if(S){let e=p?.target?f` target="${l(p.target)}"`:``;d.push(f` <a href="${l(S)}"${e}>`)}n&&p?.tooltip&&d.push(f` <title>${ha(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="${g}" />`),d.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${_}" stroke="${h}" stroke-width="${g}" />`);let C=i+s/2;if(e.annotation){let t=i+12;d.push(f` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${B}" `+f`font-size="${Yi.annotationSize}" font-weight="${Yi.annotationWeight}" `+f`font-style="italic" fill="${v??`var(--_text-muted)`}">«${ha(e.annotation)}»</text>`),C=i+s/2+6}d.push(` `+w(e.label,r+a/2,C,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${v??`var(--_text)`}"`));let T=i+s;d.push(f` <line x1="${r}" y1="${T}" x2="${r+a}" y2="${T}" `+f`stroke="${h}" stroke-width="${z.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=T+4+t*20+10;d.push(` `+ta(n,r+W.boxPadX,i,v))}let E=T+c;d.push(f` <line x1="${r}" y1="${E}" x2="${r+a}" y2="${E}" `+f`stroke="${h}" stroke-width="${z.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=E+4+t*20+10;d.push(` `+ta(n,r+W.boxPadX,i,v))}return S&&d.push(` </a>`),d.push(`</g>`),d.join(`
|
|
41
|
+
`)}var ea=700;function ta(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="${ea}">${ha(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}">${ha(u)}</tspan>`),e.type&&(l.push(f`<tspan fill="${o}"> : </tspan>`),l.push(f`<tspan fill="${c}">${ha(e.type)}</tspan>`)),f`<text x="${t}" y="${n}" class="mono" dy="${B}" `+f`font-size="${Yi.memberSize}" font-weight="${Yi.memberWeight}"${i}${a}>`+f`${l.join(``)}</text>`}var na=6;function ra(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-na},${r}`,f`${n+i},${r+na}`,f`${n+i},${r+a}`,f`${n},${r+a}`].join(` `),c=f`${n+i-na},${r} ${n+i},${r+na} `+f`${n+i-na},${r+na}`;return f`<g class="class-note"${o}>`+f`\n <polygon points="${s}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />`+f`\n <polygon points="${c}" `+f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />`+f`\n ${w(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${R.edgeLabel}" fill="var(--_text-muted)"`)}`+`
|
|
42
|
+
</g>`}function ia(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="${z.connector}" stroke-dasharray="2 3" />`}function aa(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=sa(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="${z.connector}"${n}${r} />`}function oa(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="${R.edgeLabel}" fill="var(--_text)"`)+`
|
|
43
|
+
</g>`}function sa(e,t){let n=ca(e);return n?(t===`to`?``:f` marker-start="url(#${n})"`)+(t===`from`?``:f` marker-end="url(#${n})"`):``}function ca(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 la(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=ua(e.points,e.labelPosition??da(e.points)),i=v(e.label,t.edgeLabel,R.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="${R.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=fa(r,i,`start`);n.push(w(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="${a.anchor}" font-weight="${R.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=fa(r,i,`end`);n.push(w(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="${a.anchor}" font-weight="${R.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
|
|
44
|
+
`)}function ua(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 da(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function fa(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)*pa,f=(n===`start`?l:-l)*pa,p=f+s*pa;if(Math.abs(d)>Math.abs(f)){let e=Math.sign(d);return{x:e*ma+o*pa,y:p,anchor:e>0?`start`:`end`}}return{x:d+o*pa,y:p,anchor:`middle`}}var pa=12,ma=5,ha=u,G={padding:40,boxPadX:14,cellPadX:10,headerHeight:34,bareHeight:68,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90,loopOut:20,loopHalf:10,loopLabelGap:4,loopNestGap:16,loopMargin:12};function ga(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,R.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 _a(e){return e.replace(/<br\s{0,8}\/?>/gi,`
|
|
45
|
+
`)}function va(e){let t=e.attributes.map(ya);return[0,1,2,3].filter(e=>e<2||t.some(t=>t[e].length>0)).map(e=>({cell:e,width:Math.max(...t.map(t=>ba(t[e])))+G.cellPadX*2}))}function ya(e){return[e.type,e.name,e.keys.join(`,`),_a(e.comment??``).split(`
|
|
46
|
+
`).map(e=>e.trim()).join(` `)]}function ba(e){return[...e].reduce((e,t)=>e+(t.codePointAt(0)>=11904?2:1),0)*Math.ceil(We(`M`,G.attrFontSize))}function xa(e,t){let n=new Map,r=Je(t.fontSizes);for(let t of e.entities){let e=L(t.label,r.nodeLabel,R.nodeLabel),i=t.attributes.length===0,a=va(t).reduce((e,t)=>e+t.width,0),o=e+G.boxPadX*2,s=i?o:Math.max(G.minWidth,o,a),c=i?G.bareHeight:G.headerHeight+t.attributes.length*G.rowHeight;n.set(t.id,{width:s,height:c})}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=ga(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 Sa(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:e.attributes.length===0?i.height: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:an(o.get(`e${e}`))});continue}let l=a.find(e=>e.id===n.entity1),u=ga(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 Ca(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=xa(e,t);return Sa(Ve(n,t.layoutCache),e,r,t)}var wa=70,Ta={attrSize:11,attrWeight:400};function Ea(e,t,n=`Inter`,r=!1,i=qe,a,o,s,c={}){let l=[];l.push(gi(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(ka(t));for(let t of e.entities)l.push(Da(t,i));for(let t of e.relationships)l.push(ja(t));for(let t of e.relationships)l.push(Aa(t,i));return l.push(`</svg>`),l.join(`
|
|
47
|
+
`)}function Da(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)`),g=l(p?.stroke??`var(--_node-stroke)`),_=l(p?.[`stroke-width`]??String(z.outerBox)),v=l(p?.[`stroke-width`]??String(z.innerBox)),y=p?.fill?h:`var(--_group-hdr)`,b=p?.color?l(p.color):void 0,x=O(e.className);m.push(f`<g class="${x?f`entity ${x}`:`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="${g}" stroke-width="${_}" />`),m.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${y}" stroke="${g}" stroke-width="${_}" />`),m.push(` `+w(u,r+a/2,i+s/2,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${b??`var(--_text)`}"`));let S=i+s;if(d.length>0){let t=i+o,n=va(e),s=(a-n.reduce((e,t)=>e+t.width,0))/n.length,l=[r];for(let e of n)l.push(l[l.length-1]+e.width+s);for(let e=1;!p?.fill&&e<d.length;e+=2)m.push(f` <rect x="${r}" y="${S+e*c}" width="${a}" height="${c}" `+f`fill="var(--_key-badge)" />`);let u=(e,t,n,r)=>f` <line x1="${e}" y1="${t}" x2="${n}" y2="${r}" stroke="${g}" stroke-width="${v}" />`;m.push(u(r,S,r+a,S));for(let e=1;e<d.length;e++){let t=S+e*c;m.push(u(r,t,r+a,t))}for(let e=1;e<n.length;e++)m.push(u(l[e],S,l[e],t));for(let e=0;e<d.length;e++){let t=S+e*c+c/2,r=ya(d[e]);m.push(` `+Oa(d[e],n.map((e,t)=>({x:l[t]+G.cellPadX,text:r[e.cell]})),t,b).replace(/\n/g,`
|
|
48
|
+
`))}}return m.push(`</g>`),m.join(`
|
|
49
|
+
`)}function Oa(e,t,n,r){let i=[];if(e.comment&&e.comment.length>0){let t=_a(e.comment);i.push(f`<g><title>${Pa(t)}</title>`)}return t.forEach((e,t)=>{if(!e.text)return;let a=t===1?`--_text-sec`:`--_text-muted`;i.push(f`<text x="${e.x}" y="${n}" class="mono" dy="${B}" `+f`font-size="${Ta.attrSize}" font-weight="${Ta.attrWeight}">`+f`<tspan fill="${r??`var(${a})`}">${Pa(e.text)}</tspan></text>`)}),e.comment&&e.comment.length>0&&i.push(`</g>`),i.join(`
|
|
50
|
+
`)}function ka(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="${z.connector}"${n} />`}function Aa(e,t){if(!e.label||e.points.length<2)return``;let n=e.labelPoint??Na(e.points),r=v(e.label,t.edgeLabel,R.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="${R.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${wa}%, var(--bg))"`)}`}function ja(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(Ma(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(Ma(i,a,e.cardinality2)),t.join(`
|
|
51
|
+
`)}function Ma(e,t,n){let r=[],i=z.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(`
|
|
52
|
+
`)}function Na(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 Pa=u,Fa={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},Ia=60,La=45,Ra=20;function za(e){return e+8}var Ba=14,Va=new Set([`boundary`,`control`,`entity`,`database`]);function Ha(e){return e.type===`actor`||Va.has(e.participantType)}var Ua=4;function Wa(e,t,n){return 14+v(e,t,n).height/2}function Ga(e){return{...Fa,actorHeight:e?.actorHeight??Fa.actorHeight,headerGap:e?.headerGap??Fa.headerGap,messageRowHeight:e?.messageRowHeight??Fa.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Fa.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Fa.noteStackGap}}var Ka=16;function qa(e,t,n=R.edgeLabel){return v(e,t,n).width}function Ja(e){return e.blockPadX+1}var Ya=.2,Xa=.24;function Za(e,t,n){let r=18*Xa,i=18*Ya;return[[e,t],[e+n,t],[e+n,t+18-i],[e+n-r,t+18],[e,t+18]]}function Qa(e,t){return e.type===`rect`&&e.color!==void 0?0:qa(e.type,t,R.groupHeader)+16}function $a(e,t){let n=e=>e?qa(`[${e}]`,t)+16:0;return Math.max(Qa(e,t)+n(e.label),...e.dividers.map(e=>n(e.label)))}function eo(e,n){return e?(e.split(`
|
|
53
|
+
`).length-1)*n*t:0}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=qa(t.label,i);e===n?(o(e-1,e,r/2+Ka),o(e,e+1,r/2+Ka)):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,qa(n.text,i)+r.notePadX*2),c=t[e]/2+r.noteGap+s+Ka;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+Ka),o(e-1,e,s/2+Ka);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),$a(t,i)-2*Ja(r))}}function ro(e,n={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[],footerActors:[]};let r=Ga(n.sequence),i=Je(n.fontSizes),a=e.actors.map(e=>{let t=L(e.label,i.nodeLabel,R.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?za(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}),y=e.actors.map(e=>Ha(e)?Wa(e.label,i.nodeLabel,R.nodeLabel):0),b=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?y[t]:0)),x=i.edgeLabel+12,S=h+r.actorHeight+Math.max(r.headerGap,b>0?b+Ua+x:0),C=[],w=new Map,T=new Map,E=new Map;for(let t of e.blocks){let e=eo(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+eo(e.label,i.edgeLabel))}let D=to(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,M=(e,n)=>{let o=Math.max(r.noteWidth,qa(e.text,i.edgeLabel)+r.notePadX*2),c=e.text.split(`
|
|
54
|
+
`).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},ne=j.get(-1);if(ne&&ne.length>0){let e=S;for(let t of ne)e=M(t,e);S=Math.max(S,e+r.messageRowHeight/2)}let re=new Map,N=[],P=r.activationWidth/2;function ie(e,t){let n=re.get(e)??[];re.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function ae(e,t){let n=re.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=eo(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=M(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 re)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=Ja(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=qa(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=$a(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)+eo(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&&y[t]>0?y[t]+Ua:0)),me=de+(fe?r.actorHeight+pe:0)+r.padding,F=r.padding,I=0;for(let e of g)F=Math.min(F,e.x-e.width/2),I=Math.max(I,e.x+e.width/2);for(let e of le)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of ue)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of _)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of C)if(e.isSelf&&(I=Math.max(I,e.x1+45+8),e.label)){let t=L(e.label,i.edgeLabel,R.edgeLabel)/2+8;I=Math.max(I,e.x1+t),F=Math.min(F,e.x1-t)}let he=F<r.padding?r.padding-F:0;if(he>0){for(let e of g)e.x+=he;for(let e of C)e.x1+=he,e.x2+=he;for(let e of N)e.x+=he;for(let e of le)e.x+=he;for(let e of ue)e.x+=he;for(let e of _)e.x+=he;for(let e=0;e<s.length;e++)s[e]+=he}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 ge=e.actors.map((e,t)=>{let n=e.destroyedAt,i={actorId:e.id,x:s[t],topY:g[t].y+r.actorHeight+(y[t]>0?y[t]+Ua:0),bottomY:n===void 0?de:C[n]?.y??S};return n!==void 0&&(i.destroyed=!0),i}),_e=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 ve=e.title?v(e.title,18,R.groupHeader).width+2*r.padding:0,ye=I+he+r.padding;return{width:Math.max(ye,ve,200),height:Math.max(me,100),actors:g,lifelines:ge,messages:C,activations:N,blocks:le,notes:ue,boxes:_,footerActors:_e,...e.title&&{title:{text:e.title,y:r.padding+9}}}}function io(e,t,n=`Inter`,i=!1,a=qe,o,s,c,l={}){let u=[];u.push(gi(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(Eo(t,a));for(let t of e.blocks.toReversed())Do(t)&&u.push(Oo(t,a));let d=vo(e,a);for(let t of e.lifelines)u.push(bo(t,d));for(let t of e.activations)u.push(So(t));for(let t of e.blocks)Do(t)||u.push(Oo(t,a));for(let t of e.messages)u.push(Co(t,a));for(let t of e.notes)u.push(ko(t,a));for(let t of e.actors)u.push(so(t,a));for(let t of e.footerActors)u.push(so(t,a,`actor-footer`));return e.title&&u.push(`<g class="title">`+w(e.title.text,e.width/2,e.title.y,18,f`font-size="${18}" text-anchor="middle" font-weight="${R.groupHeader}" fill="var(--_text)"`)+`</g>`),u.push(`</svg>`),u.join(`
|
|
55
|
+
`)}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)" />`+`
|
|
50
56
|
</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
|
|
52
|
-
</
|
|
53
|
-
|
|
54
|
-
`)[
|
|
55
|
-
`);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=
|
|
56
|
-
`)}function
|
|
57
|
-
`)}function
|
|
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="${
|
|
59
|
-
`)
|
|
60
|
-
`)}function No(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,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function Po(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,o=e-2*a,s=.95*Math.min(2*a,o/t);return t<2?s:e/t*s*(t-1)/o}function Fo(e,t={}){return e.horizontal?Lo(e):Io(e)}function Io(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=Go(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=Ro(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=Ho(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=zo(e,v),D=e.series.map((e,t)=>t),O=Uo(e,y,x,b,a.min,E,D),k=Wo(e,y,x,E,D),ee=K.padding+(t?K.titleHeight:0)+K.legendHeight/2,A=i?qo(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 Lo(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=Go(o),c=Ro(e),l=zo(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=Po(g,c,K.axisLabelFontSize/2),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=C(e)-n/2,c=b(Math.max(o.data[e],a.min)),u=b(Math.max(0,a.min));k.push({x:Math.min(u,c),y:s,width:Math.abs(c-u),height:t,value:o.data[e],label:l[e],seriesIndex:r,colorIndex:D[i]})}r++,i++}}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?qo(e,_/2,ie,D):[]}}function Ro(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 zo(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)=>Ko(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var Bo=8;function Vo(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<Bo){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Ho(e,t,n,r){let i=zo(e,Ro(e)),a=Vo(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 Uo(e,t,n,r,i,a,o){if(e.series.filter(e=>e.type===`bar`).length===0)return[];let s=Math.max(...a.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight))),c=Po(r*a.length,a.length,s/2),l=c,u=[],d=0,f=0;for(let r of e.series){if(r.type!==`bar`){f++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-l/2,p=n(r.data[e]),m=n(Math.max(0,i));u.push({x:s,y:Math.min(p,m),width:c,height:Math.abs(m-p),value:r.data[e],label:a[e],seriesIndex:d,colorIndex:o[f]})}d++,f++}return u}function Wo(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 Go(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 Ko(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function qo(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 Jo(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=Fi(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}=Yo(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?Zo(t.x,t.y,t.width,t.height,q.barRadius):Xo(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=ns(t.value),r=t.label?`${t.label}: ${n}`:n,i=ts(t.x+t.width/2,t.y,n);O.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>`})}}O.sort((e,t)=>t.extent-e.extent);for(let t of e.lines){if(t.points.length===0)continue;let n=e.horizontal?Qo(t.points):$o(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:ns(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=es(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=ns(t.value),a=t.label?`${t.label}: ${i}`:i,o=ts(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.html);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
|
|
62
|
-
|
|
57
|
+
</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" />`+`
|
|
58
|
+
</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,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="${R.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=z.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}" />`+`
|
|
59
|
+
</g>`),p.push(` `+w(c,i,a+s+14,t.nodeLabel,m))}else if(Ha(e)){let e=s/24*.9,n=z.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=oo[d](r,o);p.push(f` <g transform="translate(${i-12*e},${a+(s-24*e)/2}) scale(${e})">${l}\n </g>`),p.push(` `+w(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="${z.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="${z.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(` `+w(c,r,l,t.nodeLabel,m))}return p.push(`</g>`),p.join(`
|
|
60
|
+
`)}var co=10;function lo(e,t){return e.y-co-eo(e.label,t.edgeLabel)/2}function uo(e,t){return e.y+9+eo(e.label,t.edgeLabel)/2}function fo(e,t){return e.y+14+eo(e.label,t.edgeLabel)/2}var po=`2 2`,mo=`3 3`,ho=3,go=2,_o=3;function vo(e,t){let n=[],r=e=>v(e,t.edgeLabel,R.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,lo(n,t));for(let r of e.blocks){if(Do(r))continue;let e=Qa(r,t.edgeLabel);n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+18}),r.label&&i(`[${r.label}]`,r.x+(e+r.width)/2,uo(r,t));for(let e of r.dividers)e.label&&i(`[${e.label}]`,r.x+r.width/2,fo(e,t))}return n}function yo(e,t){let n=t.filter(t=>e.x>t.x0-ho&&e.x<t.x1+ho&&t.y1+go>e.topY&&t.y0-go<e.bottomY).map(e=>[e.y0-go,e.y1+go]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=_o&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=_o&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function bo(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(`
|
|
61
|
+
`);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=xo;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="${z.outerBox}" stroke-linecap="round" />`}var xo=8;function So(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="${z.innerBox}" />`}function Co(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="${z.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="${z.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+w(e.label,(e.x1+e.x2)/2,lo(e,t),t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${R.edgeLabel}" fill="var(--_text-muted)"`)),e.seqNumber!==void 0&&n.push(` `+wo(e,t)),n.push(`</g>`),n.join(`
|
|
62
|
+
`)}function wo(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="${z.innerBox}" />`+w(String(e.seqNumber),r,e.y,n,f`font-size="${n}" text-anchor="middle" font-weight="${R.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var To=35;function Eo(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)} ${To}%, 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="${z.innerBox}" />`];return e.label&&a.push(` `+w(e.label,e.x+e.width/2,e.y+za(t.edgeLabel)/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${R.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
|
|
63
|
+
`)}function Do(e){return e.type===`rect`&&e.color!==void 0}function Oo(e,t){let n=[];if(Do(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(`
|
|
64
|
+
`);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="${2}" stroke-dasharray="${po}" />`);let i=Qa(e,t.edgeLabel),{x:a,y:o}=e,s=Za(a,o,i).map(([e,t])=>f`${e},${t}`).join(` `);n.push(f` <polygon points="${s}" `+f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`),n.push(` `+w(e.type,e.x+6,e.y+9,t.edgeLabel,f`font-size="${t.edgeLabel}" font-weight="${R.groupHeader}" fill="var(--_text-sec)"`)),e.label&&n.push(` `+w(f`[${e.label}]`,e.x+(i+e.width)/2,uo(e,t),t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${R.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="2" stroke-dasharray="${mo}" />`),r.label&&n.push(` `+w(f`[${r.label}]`,e.x+e.width/2,fo(r,t),t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${R.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
|
|
65
|
+
`)}function ko(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)}"`:``;return f`<g class="note"${s}${o}>`+f`\n <rect x="${n}" y="${r}" width="${i}" height="${a}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`+f`\n ${w(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${R.edgeLabel}" fill="var(--_text-muted)"`)}`+`
|
|
66
|
+
</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},Ao=.8;function jo(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 Mo(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=S(s.min,s.max),l=Uo(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 No(e,t,n){let r=e.xAxis.categories?void 0:e.xAxis.range,i=e=>n?K.axisLabelFontSize/2:Ao*Math.max(...e.map(e=>L(e,K.axisLabelFontSize,K.axisLabelFontWeight)))/2,a=e.series.some(e=>e.type===`bar`);if(!r){let n=Lo(e),r=Ro(e,n),{p0:o,pad:s,bar:c}=jo(t,n,i(r)),l=a?s:o,u=e=>n<2?t/2:l+e*(t-2*l)/(n-1);return{at:(e,t)=>u(t),ticks:r.map((e,t)=>({label:e,at:u(t)})),bar:c}}let o=S(r.min,r.max),s=Uo(o),{p0:c,pad:l,bar:u}=jo(t,o.length,i(s)),d=a?l:c,f=r.max-r.min,p=e=>{let i=f>0?(e-r.min)/f:.5;return d+(n?1-i:i)*(t-2*d)};return{at:(e,t)=>p(e<2?r.min:r.min+t*f/(e-1)),ticks:o.map((e,t)=>({label:s[t],at:p(e)})),bar:u}}function Po(e,t={}){return e.horizontal?Io(e):Fo(e)}function Fo(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title;if(!e.yAxis.range)throw Error(`XY chart: y-axis range was not set by the parser`);let i=Mo(e,K.plotHeight,()=>K.axisLabelHeight),a=i.ticks,o=i.labels,s=Math.max(...o.map(e=>L(e,K.axisLabelFontSize,K.axisLabelFontWeight)),K.yLabelWidth),c=K.padding+(t?K.titleHeight:0),l=K.padding+K.xLabelHeight+(n?K.axisTitlePad:0),u=K.padding+s+K.yLabelGap+(r?K.axisTitlePad:0),d=K.padding,f=K.plotWidth,p=K.plotHeight,m=u+f+d,h=c+p+l,g={x:u,y:c,width:f,height:p},_=Lo(e),v=No(e,f,!1),y=(e,t)=>u+v.at(e,t),b=e=>c+p-i.pad-i.frac(e)*(p-2*i.pad),x=c+p,S=v.ticks.map(e=>({label:e.label,x:u+e.at,y:x,tx:u+e.at,ty:x+K.tickLength,labelX:u+e.at,labelY:x+18,textAnchor:`middle`})),C=a.map((e,t)=>({label:o[t],x:u,y:b(e),tx:u-K.tickLength,ty:b(e),labelX:u-K.yLabelGap,labelY:b(e),textAnchor:`end`})),w=a.map(e=>({x1:u,y1:b(e),x2:u+f,y2:b(e)})),T=Ro(e,_),E=e.series.map((e,t)=>t),D=Vo(e,y,b,v.bar,i.range.min>=0?c+p:b(0),T,E),O=Ho(e,y,b,T,E),k=Go(e,E),A={x1:u,y1:c+p,x2:u+f,y2:c+p},j={x1:u,y1:c,x2:u,y2:c+p},ee={ticks:S,line:A,...e.xAxis.title?{title:{text:e.xAxis.title,x:u+f/2,y:h-K.padding}}:{}},te={ticks:C,line:j,...e.yAxis.title?{title:{text:e.yAxis.title,x:K.padding+4,y:c+p/2,rotate:-90}}:{}};return{width:m,height:h,title:e.title?{text:e.title,x:m/2,y:K.padding+K.titleFontSize}:void 0,xAxis:ee,yAxis:te,plotArea:g,bars:D,lines:O,gridLines:w,legend:k}}function Io(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title;if(!e.yAxis.range)throw Error(`XY chart: y-axis range was not set by the parser`);let i=Mo(e,K.plotWidth,e=>Ao*Math.max(...e.map(e=>L(e,K.axisLabelFontSize,K.axisLabelFontWeight)))),a=i.ticks,o=i.labels,s=Ro(e,Lo(e)),c=No(e,K.plotHeight,!0),l=Math.max(...c.ticks.map(({label:e})=>L(e,K.axisLabelFontSize,K.axisLabelFontWeight)),40),u=K.padding+(t?K.titleHeight:0)+(r?K.axisTitlePad:0)+K.xLabelHeight,d=K.padding,f=K.padding+l+K.yLabelGap+(n?K.axisTitlePad:0),p=Math.max(K.padding,L(o[o.length-1],K.axisLabelFontSize,K.axisLabelFontWeight)/2+4),m=K.plotWidth,h=K.plotHeight,g=f+m+p,_=u+h+d,v={x:f,y:u,width:m,height:h},y=e=>f+i.pad+i.frac(e)*(m-2*i.pad),b=(e,t)=>u+c.at(e,t),x=a.map((e,t)=>({label:o[t],x:y(e),y:u,tx:y(e),ty:u-K.tickLength,labelX:y(e),labelY:u-18,textAnchor:`middle`})),S=c.ticks.map(({label:e,at:t})=>({label:e,x:f,y:u+t,tx:f-K.tickLength,ty:u+t,labelX:f-K.yLabelGap,labelY:u+t,textAnchor:`end`})),C=a.map(e=>({x1:y(e),y1:u,x2:y(e),y2:u+h})),w=e.series.map((e,t)=>t),T=e.series.filter(e=>e.type===`bar`).length,E=[];if(T>0){let t=c.bar,n=t,r=0,a=0;for(let o of e.series){if(o.type!==`bar`){a++;continue}for(let e=0;e<o.data.length;e++){let c=b(o.data.length,e)-n/2,l=y(Math.max(o.data[e],i.range.min)),u=i.range.min>=0?f:y(0);E.push({x:Math.min(u,l),y:c,width:Math.abs(l-u),height:t,value:o.data[e],label:s[e],seriesIndex:r,colorIndex:w[a]})}r++,a++}}let D=[],O=0,k=0;for(let t of e.series){if(t.type!==`line`){k++;continue}let e=t.data.map((e,n)=>({x:y(e),y:b(t.data.length,n),value:e,label:s[n]}));D.push({points:e,seriesIndex:O,colorIndex:w[k]}),O++,k++}let A={x1:f,y1:u,x2:f+m,y2:u},j={x1:f,y1:u,x2:f,y2:u+h},ee={ticks:x,line:A,...e.yAxis.title?{title:{text:e.yAxis.title,x:f+m/2,y:K.padding+(t?K.titleHeight:0)+K.axisTitlePad/2}}:{}},te={ticks:S,line:j,...e.xAxis.title?{title:{text:e.xAxis.title,x:K.padding+4,y:u+h/2,rotate:-90}}:{}};return{width:g,height:_,horizontal:!0,title:e.title?{text:e.title,x:g/2,y:K.padding+K.titleFontSize}:void 0,xAxis:ee,yAxis:te,plotArea:v,bars:E,lines:D,gridLines:C,legend:Go(e,w)}}function Lo(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 Ro(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)=>Wo(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var zo=8;function Bo(e,t){let n=e.map(e=>L(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<zo){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Vo(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 Ho(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 Uo(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 Wo(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Go(e,t){let n=0,r=0;return e.series.map((e,i)=>{let a=e.type===`bar`?n++:r++;return{label:`${e.type===`bar`?`Bar`:`Line`} ${a+1}`,x:0,y:0,type:e.type,seriesIndex:a,colorIndex:t[i]}})}var q={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,dotRadius:5,lineWidth:2.5},J={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function Ko(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=gi(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}=qo(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(e.horizontal?`<path d="M${Y(h.x)},${Y(g)} V${Y(h.y)} H${Y(h.x+h.width)}" class="xychart-axis"/>`:`<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=Math.max(t.x,h.x),i=Math.min(t.x+t.width,h.x+h.width),o=Math.max(t.y,h.y),s=Math.min(t.y+t.height,h.y+h.height);if(i<=r||s<=o)continue;let c=`M${Y(r)},${Y(o)} H${Y(i)} V${Y(s)} H${Y(r)} Z`;if(u.push(`<path d="${c}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),a){let n=Qo(t.value),a=t.label?`${t.label}: ${n}`:n,c=Zo((r+i)/2,o,n);_.push({extent:e.horizontal?i-r:s-o,html:`<g class="xychart-bar-group"><rect x="${Y(r)}" y="${Y(o)}" width="${Y(i-r)}" height="${Y(s-o)}" fill="transparent"/><title>${X(a)}</title>`+c+`</g>`})}}_.sort((e,t)=>t.extent-e.extent);for(let t of e.lines){if(t.points.length===0)continue;let e=Jo(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:Qo(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Xo(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=Qo(t.value),a=t.label?`${t.label}: ${i}`:i,o=Zo(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="${B}" 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="${B}" 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="${B}" 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="${B}" 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="${B}" class="xychart-title">${X(e.title.text)}</text>`);for(let e of _)u.push(e.html);for(let e of b)u.push(e);return u.push(`</svg>`),u.join(`
|
|
67
|
+
`)}function qo(e,t,n,r,i){let a=n??P,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, ${P})`:le(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: none; 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?`
|
|
68
|
+
.xychart-dot { opacity: 0; }
|
|
69
|
+
.xychart-dot-group:hover .xychart-dot { opacity: 1; }
|
|
63
70
|
.xychart-tip { opacity: 0; pointer-events: none; }
|
|
64
71
|
.xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
|
|
65
72
|
.xychart-tip-text { fill: var(--bg); font-size: ${J.fontSize}px; font-weight: ${J.fontWeight}; }
|
|
66
73
|
.xychart-tip-ptr { fill: var(--_text); }
|
|
67
74
|
.xychart-bar-group:hover .xychart-tip,
|
|
68
|
-
.xychart-dot-group:hover .xychart-tip { opacity: 1; }`:``,
|
|
69
|
-
`)}\n }`:``;return{style:`${
|
|
70
|
-
.xychart-
|
|
71
|
-
.xychart-bar { stroke-width: 1.5; }
|
|
75
|
+
.xychart-dot-group:hover .xychart-tip { opacity: 1; }`:``,u=s.length>0?`\n svg {\n${s.join(`
|
|
76
|
+
`)}\n }`:``;return{style:`${j(i)}
|
|
77
|
+
.xychart-axis { fill: none; stroke: var(--_text); stroke-width: 2; }
|
|
72
78
|
.xychart-line { fill: none; stroke-width: ${q.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
|
|
73
79
|
.xychart-line-shadow { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.12; }
|
|
74
80
|
.xychart-dot { stroke: var(--bg); stroke-width: 2; }
|
|
75
81
|
.xychart-label { fill: var(--_text-muted); }
|
|
76
82
|
.xychart-axis-title { fill: var(--_text-sec); }
|
|
77
|
-
.xychart-title { fill: var(--_text); }${
|
|
78
|
-
${
|
|
79
|
-
`)}${
|
|
80
|
-
</style>`,defs:``}}function
|
|
83
|
+
.xychart-title { fill: var(--_text); }${u}
|
|
84
|
+
${c.join(`
|
|
85
|
+
`)}${l}
|
|
86
|
+
</style>`,defs:``}}function Jo(e){return e.map((e,t)=>`${t===0?`M`:`L`}${Y(e.x)},${Y(e.y)}`).join(` `)}function Yo(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 Xo(e,t,n,r){let i=L(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=L(e.legendLabel,J.fontSize,J.fontWeight),n=L(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="${B}" 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="${B}" 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="${B}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function Zo(e,t,n){let r=L(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="${B}" 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,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}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},$o=Math.PI*2;function Q(e){return String(Math.round(e*100)/100)}function es(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function ts(e,t,n,r,i,a=0){if(i-r>=$o-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=es(e,t,n,r),s=es(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=es(e,t,a,i),d=es(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 ns(e,t,n){return n?`${e} [${String(t)}]`:e}function rs(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=>ns(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>L(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?L(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),M=Math.max(C,O,d>0?A:0),ne=d>0?Math.min(0,j):0,re=d>0?Math.max(w,ee):n,N=-te,P=-ne,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*$o;se=a;let o=es(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:ts(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(M-te),height:Math.ceil(re-ne),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 is(e){return String(Math.round(e*100)/100)}function as(e,t,n){return e===0?`var(--accent, ${P})`:le(e,t??P,n)}function os(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]??as(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
87
|
.pie-slice.pie-highlight { opacity: 1; }`:``,c=a.length>0?`\n svg {\n${a.join(`
|
|
82
|
-
`)}\n }`:``;return`${
|
|
88
|
+
`)}\n }`:``;return`${j(n)}
|
|
83
89
|
.pie-outer { fill: none; stroke: var(--fg); stroke-width: ${Z.outerStrokeWidth}px; }
|
|
84
90
|
.pie-slice { stroke: var(--fg); stroke-width: 2px; opacity: 0.7; }${s}
|
|
85
91
|
.pie-slice-label { fill: var(--_text); font-size: ${Z.sectionFontSize}px; font-weight: ${Z.fontWeight}; }
|
|
@@ -87,21 +93,23 @@ ${l.join(`
|
|
|
87
93
|
.pie-legend-text { fill: var(--_text); font-size: ${Z.legendFontSize}px; font-weight: ${Z.fontWeight}; }${c}
|
|
88
94
|
${o.join(`
|
|
89
95
|
`)}
|
|
90
|
-
</style>`}function
|
|
91
|
-
`)}var
|
|
96
|
+
</style>`}function ss(e,t,n=`Inter`,i=!1,a,o,s,c={}){let d=[];d.push(gi(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(os(e,t,c.nonce)),d.push(`<circle cx="${is(e.cx)}" cy="${is(e.cy)}" r="${is(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="${is(t.labelX)}" y="${is(t.labelY)}" text-anchor="middle" class="pie-slice-label">${u(t.percentText)}</text>`);e.title&&d.push(`<text x="${is(e.title.x)}" y="${is(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="${is(t.x)}" y="${is(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${is(t.textX)}" y="${is(t.textY)}" class="pie-legend-text">${u(t.text)}</text></g>`);return d.push(`</svg>`),d.join(`
|
|
97
|
+
`)}var cs={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},ls={chartWidth:500,chartHeight:500};function us(e){return{anchor:`middle`,baseline:`hanging`,rotation:0,...e}}function ds(e){let t={...cs,...ls,...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 fs(e){return String(Math.round(e*100)/100)}var ps=[14,10,6,3];function ms(e,t){let n=`var(--accent, ${P})`,r=`color-mix(in srgb, ${n} 35%, var(--bg))`,i=ps.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`${j(t)}
|
|
92
98
|
${i.join(`
|
|
93
99
|
`)}
|
|
94
100
|
.quadrant-line { stroke: ${r}; }
|
|
95
101
|
.quadrant-text { fill: var(--_text); }
|
|
96
102
|
.quadrant-point { fill: var(--fg); stroke: var(--fg); stroke-width: 0px; }${[...s,...a].map(e=>`
|
|
97
103
|
`+e).join(``)}
|
|
98
|
-
</style>`}function
|
|
99
|
-
`)}var
|
|
100
|
-
`)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&
|
|
101
|
-
`)]);
|
|
102
|
-
`);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>
|
|
103
|
-
`)}function
|
|
104
|
-
`)}function
|
|
105
|
-
`)}function
|
|
106
|
-
`)}function
|
|
107
|
-
`)}var
|
|
104
|
+
</style>`}function hs(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(${fs(e.x)}, ${fs(e.y)}) rotate(${e.rotation})">${u(e.text)}</text>`:``}function gs(e,t,n=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push(gi(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(ms(e,c.nonce)),l.push(`<g class="quadrants">`);for(let t of e.quadrants)l.push(`<g class="quadrant"><rect x="${fs(t.x)}" y="${fs(t.y)}" width="${fs(t.width)}" height="${fs(t.height)}" class="quadrant-cell-${t.index}"/>${hs(t.text,`quadrant-label`)}</g>`);l.push(`</g>`),l.push(`<g class="border">`);for(let t of e.lines)l.push(`<line x1="${fs(t.x1)}" y1="${fs(t.y1)}" x2="${fs(t.x2)}" y2="${fs(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="${fs(e.x)}" cy="${fs(e.y)}" r="${e.radius}" class="quadrant-point${n}"/>${hs(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">${hs(t,`quadrant-axis-label`)}</g>`);return l.push(`</g>`),l.push(`<g class="title">`),e.title&&l.push(hs(e.title,`quadrant-title`)),l.push(`</g>`),l.push(`</svg>`),l.join(`
|
|
105
|
+
`)}var _s=2048,vs=[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],ys=[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 bs(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?ys:vs)[n-32]/_s}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},xs=$.width-2*$.shapePadding;function Ss(e,t,n){let r=[];for(let i of e.split(`
|
|
106
|
+
`)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&Os(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function Cs(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 ws(e,t){return e*$.nameLine+$.typeLine+Ts(t)}function Ts(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function Es(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function Ds(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function Os(e,t,n){let r=0;for(let i of e){let e=bs(i,n>=600);r+=e===void 0?L(i,t,n)*$.textScale:e*t}return r}function ks(e,t,n,r){let i=ws(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:Cs(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=Es(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=Ds(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function As(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 js=$.messageSize+5;function Ms(e){return e.labelLines??oe(e)}function Ns(e){let t=e.labelPosition;return t?Ms(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*js,w:Os(n,$.messageSize,400),h:$.messageSize})):[]}function Ps(){return{next:{cnt:0}}}function Fs(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 Is(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function Ls(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,Is(e,`startx`,r,Math.min),Is(e,`starty`,a,Math.min),Is(e,`stopx`,i,Math.max),Is(e,`stopy`,o,Math.max),Is(e.next,`startx`,r,Math.min),Is(e.next,`starty`,a,Math.min),Is(e.next,`stopx`,i,Math.max),Is(e.next,`stopy`,o,Math.max)}function Rs(e){let t=Ss(e.label,xs,$.nameSize),n=e.description?Ss(e.description,xs,$.descrSize):[],r=Math.max(...t.map(e=>Os(e,$.nameSize,700)),Os(se(e),$.typeSize,400),...n.map(e=>Os(e,$.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...ks(e,t.length,n.length,r)}}function zs(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 Bs(e){let t=new Map,n=[],r=$.diagramMarginX,i=$.diagramMarginY,a=(e,n)=>{for(let r of n){let n=Rs(r);t.set(r.alias,n),Ls(e,n)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},o=(e,t,s)=>{let c=Ps();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&&ae(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;Fs(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+$.diagramMarginX;Fs(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=Ps();return Fs(s,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),s.widthLimit=$.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function Vs(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 Hs(e,t){let n=Cs(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 Ws({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function Us(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 Ws(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=Us(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 Gs=1e-6;function Ks(e,t){let n=Vs(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Es(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-Gs||Math.abs(Math.abs(s)-e.width/2)<=Gs&&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 qs(e,t){let n=Vs(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Ds(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-Gs||Math.abs(Math.abs(s)-e.height/2)<=Gs&&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 Js(e,t){let n=e.el;return n?.kind===`person`?Hs(e,t):n?.shape===`db`?Ks(e,t):n?.shape===`queue`?qs(e,t):Vs(e,t)}var Ys=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function Xs(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Js(i,Ys(a)),s=Js(a,Ys(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})),oe(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=oe(e)[0],r=e.label!==``||e.index!==void 0?Os(n??``,$.messageSize,400):0;if(d.labelPosition=u({x:t.x+r/2,y:t.y}),e.technology){let n=Os(`[${e.technology}]`,$.messageSize,400);d.technologyX=t.x+Math.max(r,n)/2}}return d}var Zs=2,Qs=6,$s=2,ec=[0,14,-14,28,-28],tc=[.75,.55,.4],nc=1e3,rc=100,ic=10,ac=2,oc=5,sc=4,cc=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}),lc=(e,t)=>e.x0<t.x1+Zs&&e.x1>t.x0-Zs&&e.y0<t.y1+Zs&&e.y1>t.y0-Zs;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/sc));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 dc(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:rc}),n=(n,r,i,a)=>{let o=Os(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,oc)},r=ae({...e,elementAliases:[],children:[]});return[t(e.x,e.x+e.width,e.y,e.y,ac),t(e.x,e.x+e.width,e.y+e.height,e.y+e.height,ac),t(e.x,e.x,e.y,e.y+e.height,ac),t(e.x+e.width,e.x+e.width,e.y,e.y+e.height,ac),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 fc(e,t){return Ns({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(cc)}function pc(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=oe(e),d=e.label!==``||e.index!==void 0,f=d?Os(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(`
|
|
107
|
+
`)]);tc.forEach((e,r)=>{let i=Ss(u[0],f*e,$.messageSize),a=[...i,...t].join(`
|
|
108
|
+
`);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>Os(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(...ec)+Zs,v=m.flatMap(t=>fc(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($s,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=fc(e,t);for(let e of ec)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(lc(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+=ic)}}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(...Ns(e).map(e=>({...cc(e),weight:rc})))}function mc(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+Os(e.title,16,400)),t.height=n,t.titlePosition={x:$.diagramMarginX,y:n/2}}return t}let n=Bs(zs(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)=>Xs(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:nc})),...dc(o)],u=c.map(uc),d=[];c.forEach((e,t)=>pc(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 hc(e,t,n=`Inter`,i=!1,a=qe,o,s,c,l={}){let d=[];d.push(gi(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="${B}" `+f`font-size="16" fill="var(--_text)">${u(e.title)}</text>`);for(let t of e.boundaries)d.push(_c(t));for(let t of e.elements)d.push(vc(t));for(let t of e.relationships)d.push(Ec(t));for(let t of e.relationships)d.push(Dc(t));return d.push(`</svg>`),d.filter(Boolean).join(`
|
|
109
|
+
`)}function gc(e,t,n,r,i){return f` <text x="${t}" y="${n}" text-anchor="middle" dy="${B}" font-size="${r}" `+f`${i}>${u(e)}</text>`}function _c(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(gc(e.label,n,e.y+(e.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=ae({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push(gc(r,n,e.y+e.typeY,$.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push(gc(e.description,n,e.y+e.descrY,$.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
|
|
110
|
+
`)}function vc(e){let t=As(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=ws(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(...bc(e,t)),u=r+Cs(i).pillTop+$.shapePadding;else if(e.shape===`db`){c.push(...xc(e,t));let{ry:n}=Es(i);u=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){c.push(...Sc(e,t));let{rx:n}=Ds(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(gc(n,d,p+$.nameLine/2,$.nameSize,f`font-weight="700" fill="${t.text}"`)),p+=$.nameLine;return c.push(gc(se(e),d,p+$.typeLine/2,$.typeSize,f`fill="${t.text}"`)),p+=$.typeLine,e.descriptionLines.forEach((e,n)=>{c.push(gc(e,d,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,f`fill="${t.text}"`))}),p+=Ts(e.descriptionLines.length),c.push(`</g>`),c.join(`
|
|
111
|
+
`)}function yc(e){let{x:t,y:n,width:r,height:i}=e,{rx:a,headRadius:o,pillTop:s}=Cs(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 bc(e,t){return[f` <path class="c4-person-shape" d="${yc(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`]}function xc(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=Es(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 Sc(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=Ds(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 Cc(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 wc=3,Tc=1;function Ec(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=Cc(n,o),u=Cc(t,s);return[a,...e.bidirectional?[c,u]:[e.reversed?u:c]].filter(Boolean).join(`
|
|
112
|
+
`)}function Dc(e){let t=Ms(e),n=Ns(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))-wc,a=Math.max(...n.map(e=>e.cx+e.w/2))+wc,o=n[0].cy-n[0].h/2-Tc,s=n[n.length-1],c=s.cy+s.h/2+Tc;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(gc(i,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),r.push(`</g>`),r.join(`
|
|
113
|
+
`)}var Oc=200,kc=40,Ac=20,jc=120,Mc=`3`,Nc=e=>y(e,qe.nodeLabel,R.nodeLabel);function Pc(e){let t=[];for(let n of e.split(`
|
|
114
|
+
`)){let e=``;for(let r of n.split(/\s+/).filter(Boolean)){let n=e?`${e} ${r}`:r;e&&Nc(n)>jc?(t.push(e),e=r):e=n}t.push(e)}return t}var Fc=(e,t)=>{if(!e)return t;let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}};function Ic(e,t){let n=new Map([...t.keys()].map(e=>[e,e])),r=e=>{let t=e;for(;n.get(t)!==t;)t=n.get(t);return t};for(let t of e.edges)n.has(t.source)&&n.has(t.target)&&n.set(r(t.source),r(t.target));let i=new Map;for(let e of t.keys()){let t=r(e);i.set(t,[...i.get(t)??[],e])}let a=0;for(let e of i.values()){let n=Math.min(...e.map(e=>t.get(e)[0])),r=Math.max(...e.map(e=>t.get(e)[0]));for(let r of e)t.get(r)[0]+=a-n;a+=r-n+1}}function Lc(e,t){for(let n of e){if(n.nodeIds.includes(t))return[n.id];let e=Lc(n.children,t);if(e.length>0)return[...e,n.id]}return[]}function Rc(e,t,n){let r=[0];for(let i=t;i<n;i++){let t=0;for(let[n,r]of e.values())(n<=i!=n<=i+1||r>=i!=r>=i+1)&&t++;r.push(r[r.length-1]+Oc+kc*t)}return r}function zc(e,t=et.padding){let n=e.direction===`LR`||e.direction===`RL`,r=new Map;for(let[t,i]of e.nodes){let e=i.gridLayer??0,a=i.gridOrder??0;r.set(t,n?[e,a]:[a,e])}Ic(e,r);let i=new Map,a=new Map;for(let[t,[n,o]]of r)for(let r of Lc(e.subgraphs,t)){let e=i.get(r)??[n,n],t=a.get(r)??[o,o];i.set(r,[Math.min(e[0],n),Math.max(e[1],n)]),a.set(r,[Math.min(t[0],o),Math.max(t[1],o)])}let o=[...r.values()].map(e=>e[0]),s=[...r.values()].map(e=>e[1]),c=Math.min(...o),l=Math.min(...s),u=Rc(i,c,Math.max(...o)),d=Rc(a,l,Math.max(...s)),f=[],p=new Map,m=new Map;for(let[t,n]of e.nodes){let[i,a]=r.get(t),o=n.shape===`junction`?2:80,s=u[i-c]-o/2,h=d[a-l]-o/2,g={x:s,y:h,width:o,height:o};m.set(t,g);let _=n.icon===void 0?[]:Pc(n.label),v=Math.max(0,..._.map(Nc)),y=Math.max(0,(v-o)/2);p.set(t,n.icon===void 0?g:{x:s-y,y:h,width:o+y*2,height:o+Ac}),f.push({id:t,label:n.icon===void 0?n.label:_.join(`
|
|
115
|
+
`),shape:n.icon===void 0?n.shape:`rectangle`,icon:n.icon,...g,className:e.classAssignments.get(t),interaction:e.interactions.get(t)})}let h=e=>{let t=e.children.map(h),n;for(let t of e.nodeIds)n=Fc(n,p.get(t));for(let e of t)n=Fc(n,e);let r=n??{x:0,y:0,width:0,height:0},i={x:r.x-kc,y:r.y-kc,width:r.width+80,height:r.height+80};return m.set(e.id,i),{id:e.id,label:e.label,...i,children:t,...e.icon===void 0?{}:{icon:e.icon},...e.architecture?{architecture:!0}:{}}},g=e.subgraphs.map(h),_=e.edges.map(e=>{let t=m.get(e.source),n=m.get(e.target);return{source:e.source,target:e.target,label:e.label,style:e.style,hasArrowStart:e.hasArrowStart,hasArrowEnd:e.hasArrowEnd,points:Vc(t,n),inlineStyle:{"stroke-width":Mc}}}),v=1/0,y=1/0,b=-1/0,x=-1/0;for(let e of p.values())v=Math.min(v,e.x),y=Math.min(y,e.y),b=Math.max(b,e.x+e.width),x=Math.max(x,e.y+e.height);for(let e of m.values())v=Math.min(v,e.x),y=Math.min(y,e.y),b=Math.max(b,e.x+e.width),x=Math.max(x,e.y+e.height);let S=t-v,C=t-y,w=e=>{e.x+=S,e.y+=C,e.children.forEach(w)};for(let e of f)e.x+=S,e.y+=C;g.forEach(w);for(let e of _)e.points=e.points.map(e=>({x:e.x+S,y:e.y+C}));return{width:b-v+t*2,height:x-y+t*2,nodes:f,edges:_,groups:g}}var Bc=(e,t,n,r)=>{let i=Math.max(e,n),a=Math.min(t,r);return i<a||i===a&&e===t?(i+a)/2:void 0};function Vc(e,t){let n=Bc(e.y,e.y+e.height,t.y,t.y+t.height);if(n!==void 0){let[r,i]=e.x<=t.x?[e,t]:[t,e],a=[{x:r.x+r.width,y:n},{x:i.x,y:n}];return r===e?a:a.reverse()}let r=Bc(e.x,e.x+e.width,t.x,t.x+t.width);if(r!==void 0){let[n,i]=e.y<=t.y?[e,t]:[t,e],a=[{x:r,y:n.y+n.height},{x:r,y:i.y}];return n===e?a:a.reverse()}let i=e.y+e.height/2,a=t.x+t.width/2;return[{x:t.x>e.x?e.x+e.width:e.x,y:i},{x:a,y:i},{x:a,y:t.y>e.y?t.y:t.y+t.height}]}var Hc={type:`xychart`,parse:ge,layoutForSvg:Po,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Ko(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},Uc={type:`sequence`,parse:he,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 Wc(e){return(e.interactivity??`static`)!==`none`}function Gc(e){return(e.interactivity??`static`)===`full`}var Kc={type:`class`,parse:fe,layoutForSvg:Wi,renderSvg(e,t,n){return Xi(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,Wc(n),t.emit)}},qc={type:`er`,parse:pe,layoutForSvg(e,t){return Ca(re(e,t.direction),t)},renderSvg(e,t){return Ea(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Jc={type:`flowchart`,parse:(e,t)=>me(t),layoutForSvg(e,t){return{graph:Un(re(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return er(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,Gc(n),Wc(n),t.title,t.decorative,t.emit)}},Yc={type:`c4`,parse:de,layoutForSvg(e,t){return mc(e,t)},renderSvg(e,t){return hc(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Xc={xychart:Hc,er:qc,sequence:Uc,class:Kc,flowchart:Jc,architecture:{type:`architecture`,parse:ue,layoutForSvg(e,t){return{graph:zc(re(ie(e),t.direction),t.padding),curve:`linear`}},renderSvg:Jc.renderSvg},c4:Yc,pie:{type:`pie`,parse:(e,t)=>F(t),layoutForSvg:(e,t)=>rs(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return ss(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}},quadrant:{type:`quadrant`,parse:(e,t)=>I(t),layoutForSvg:(e,t)=>ds(t.honorThemeVariables?e:{...e,themeColors:void 0}),renderSvg(e,t){return gs(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function Zc(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 Qc(e={}){return ne(Zc(e),e.transparent)}function $c(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute,bodyFont:be(e)}}function el(e,t={}){let{svg:n,colors:r}=rl(e,t),i=tl(n);return t.resolveColors?ji(i,r):i}function tl(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 nl(e){let t=d(_e(e)).text;Xc[s(t)].parse(A(t),t)}function rl(e,t){a(`maxInputLength`,e.length,t.limits),o(e,t.limits);let r=d(_e(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={...$c(t),description:r.accDescr},y=A(c),b=Xc[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=Zc(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 il(e,t={}){return t.embedFont===`subset`&&await ye(),el(e,t)}var al=el,ol=il;export{Ba as ACTOR_LABEL_OFFSET,Qe as ARROW_HEAD,Xe as ASYMMETRIC_NOTCH,W as CLS,rt as ELK_DIRECTION_FALLBACK,Ne as ElkNotRegisteredError,qe as FONT_SIZES,R as FONT_WEIGHTS,Ye as GROUP_HEADER_CONTENT_PAD,ct as INLINE_CENTERED_EDGE_LABEL,Ge as MONO_FONT,Ke as MONO_FONT_STACK,Ze as NODE_PADDING,Z as PIE,cs as QUADRANT,Ia as SELF_LOOP_CONTROL,La as SELF_LOOP_EXTENT,Ra as SELF_LOOP_HEIGHT,z as STROKE_WIDTHS,B as TEXT_BASELINE_SHIFT,ot as baseElkLayoutOptions,za as boxLabelHeight,ut as buildElkEdge,lt as buildElkEdgeLabel,st as buildElkLeafNode,$e as buildSvgStyleBlock,Vi as classBackEdges,Ii as classNoteId,Vt as clipEdgeToShape,Gn as convertToElkFormat,Re as createLayoutCache,it as directionToElk,Ve as elkLayoutSync,at as elkPadding,We as estimateMonoTextWidth,L as estimateTextWidth,Ti as evaluateCssColorValue,on as extractEdgeLabelPosition,an as extractEdgePoints,Uo as formatTickLabels,Ha as hasLabelBelowIcon,Wi as layoutClassDiagramSync,Ca as layoutErDiagramSync,Un as layoutFlowchartSync,Hn as layoutGraphSync,rs as layoutPieChart,ds as layoutQuadrantChart,ro as layoutSequenceDiagram,Po as layoutXYChart,ye as loadEmbeddedFont,x as niceTickValues,as as pieColorValue,Oe as pointsToPath,Pe as registerElk,Xi as renderClassSvg,Ea as renderErSvg,ol as renderMermaid,el as renderMermaidSVG,il as renderMermaidSVGAsync,al as renderMermaidSync,ss as renderPieSvg,gs as renderQuadrantSvg,io as renderSequenceSvg,er as renderSvg,Ko as renderXYChartSvg,ji as resolveCssColors,Je as resolveFontSizes,Yo as smoothCurvePath,Jo as straightLinePath,Qc as themeCssVariables,nl as validateMermaid,gi as withDataSrc,Bo as xLabelStep};
|