@zombie-mermaid/svg-renderer 5.8.0 → 5.8.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@zombie-mermaid/core"),t=require("@zombie-mermaid/mermaid-parser"),n=require("entities");function r(t){return e.f`M ${t.x} ${t.y}`}function i(t){return r(t[0])+t.slice(1).map(t=>e.f` L ${t.x} ${t.y}`).join(``)}function a(t){if(t.length<3)return i(t);let n=t[t.length-1],a=[r(t[0])],o=(t,n,r)=>e.f` C ${(2*t.x+n.x)/3} ${(2*t.y+n.y)/3},`+e.f` ${(t.x+2*n.x)/3} ${(t.y+2*n.y)/3},`+e.f` ${(t.x+4*n.x+r.x)/6} ${(t.y+4*n.y+r.y)/6}`;a.push(e.f` L ${(5*t[0].x+t[1].x)/6}`+e.f` ${(5*t[0].y+t[1].y)/6}`);for(let e=2;e<t.length;e++)a.push(o(t[e-2],t[e-1],t[e]));return a.push(o(t[t.length-2],n,n)),a.push(e.f` L ${n.x} ${n.y}`),a.join(``)}function o(t){if(t.length<3)return i(t);let n=[r(t[0])];for(let r=1;r<t.length-1;r++){let i=t[r-1],a=t[r],o=t[r+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){n.push(e.f` L ${a.x} ${a.y}`);continue}let l=Math.min(12,s/2,c/2),u=a.x-(a.x-i.x)/s*l,d=a.y-(a.y-i.y)/s*l,f=a.x+(o.x-a.x)/c*l,p=a.y+(o.y-a.y)/c*l;n.push(e.f` L ${u} ${d}`),n.push(e.f` Q ${a.x} ${a.y}, ${f} ${p}`)}let a=t[t.length-1];return n.push(e.f` L ${a.x} ${a.y}`),n.join(``)}function s(t,n){let i=[r(t[0])],a=t.length-1;for(let r=0;r<a;r++){let o=t[r],s=t[r+1];if(r===a-1){i.push(e.f` L ${s.x} ${s.y}`);break}if(n===`before`)i.push(e.f` L ${o.x} ${s.y} L ${s.x} ${s.y}`);else if(n===`after`)i.push(e.f` L ${s.x} ${o.y} L ${s.x} ${s.y}`);else{let t=(o.y+s.y)/2;i.push(e.f` L ${o.x} ${t} L ${s.x} ${t} L ${s.x} ${s.y}`)}}return i.join(``)}function c(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return r(e[0]);switch(t){case`basis`:return a(e);case`natural`:return o(e);case`step`:return s(e,`mid`);case`stepBefore`:return s(e,`before`);case`stepAfter`:return s(e,`after`);default:return i(e)}}function l(e){let t=e?.worker?.worker;return typeof t==`object`&&!!t&&`dispatcher`in t}var u=null,d=null,f=null,p=class extends Error{constructor(){super("zombie-mermaid: rendering a flowchart, state, class, ER or architecture diagram needs the optional peer dependency \"elkjs\". Install it (npm i elkjs) and call registerElk(ELK) once at startup with `import ELK from 'elkjs/lib/elk.bundled.js'`. Sequence, pie, xychart, C4 and ASCII output do not need it. A flowchart can also pass `layout: 'simple'` to skip elkjs."),this.name=`ElkNotRegisteredError`}};function m(e){u=e,d=null,f=null}function h(){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:{}.url,new URL(`file://${g(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 g(e){let t=e.cwd;return typeof t==`function`?t.call(e):`/`}var _=20;function v(e=_){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function y(e){if(Array.isArray(e))return`[${e.map(y).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${y(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function b(){if(d&&f)return f;let e=u??=h();if(!e)throw new p;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;a&&Object.defineProperty(r,"self",{value:void 0,configurable:!0,writable:!0});let o;try{o=new e}finally{a&&(i?Object.defineProperty(r,"self",i):delete r.self),globalThis.setTimeout=n}if(!l(o))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 d=o,t.forEach(e=>e()),f=d.worker.worker,f}function x(e,t){let n=t,r=n?y(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=b(),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 S=`JetBrains Mono NL`,C=`@font-face {
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@zombie-mermaid/core"),t=require("@zombie-mermaid/mermaid-parser"),n=require("entities");function r(t){return e.f`M ${t.x} ${t.y}`}function i(t){return r(t[0])+t.slice(1).map(t=>e.f` L ${t.x} ${t.y}`).join(``)}function a(t){if(t.length<3)return i(t);let n=t[t.length-1],a=[r(t[0])],o=(t,n,r)=>e.f` C ${(2*t.x+n.x)/3} ${(2*t.y+n.y)/3},`+e.f` ${(t.x+2*n.x)/3} ${(t.y+2*n.y)/3},`+e.f` ${(t.x+4*n.x+r.x)/6} ${(t.y+4*n.y+r.y)/6}`;a.push(e.f` L ${(5*t[0].x+t[1].x)/6}`+e.f` ${(5*t[0].y+t[1].y)/6}`);for(let e=2;e<t.length;e++)a.push(o(t[e-2],t[e-1],t[e]));return a.push(o(t[t.length-2],n,n)),a.push(e.f` L ${n.x} ${n.y}`),a.join(``)}function o(t){if(t.length<3)return i(t);let n=[r(t[0])];for(let r=1;r<t.length-1;r++){let i=t[r-1],a=t[r],o=t[r+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){n.push(e.f` L ${a.x} ${a.y}`);continue}let l=Math.min(12,s/2,c/2),u=a.x-(a.x-i.x)/s*l,d=a.y-(a.y-i.y)/s*l,f=a.x+(o.x-a.x)/c*l,p=a.y+(o.y-a.y)/c*l;n.push(e.f` L ${u} ${d}`),n.push(e.f` Q ${a.x} ${a.y}, ${f} ${p}`)}let a=t[t.length-1];return n.push(e.f` L ${a.x} ${a.y}`),n.join(``)}function s(t,n){let i=[r(t[0])],a=t.length-1;for(let r=0;r<a;r++){let o=t[r],s=t[r+1];if(r===a-1){i.push(e.f` L ${s.x} ${s.y}`);break}if(n===`before`)i.push(e.f` L ${o.x} ${s.y} L ${s.x} ${s.y}`);else if(n===`after`)i.push(e.f` L ${s.x} ${o.y} L ${s.x} ${s.y}`);else{let t=(o.y+s.y)/2;i.push(e.f` L ${o.x} ${t} L ${s.x} ${t} L ${s.x} ${s.y}`)}}return i.join(``)}function c(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return r(e[0]);switch(t){case`basis`:return a(e);case`natural`:return o(e);case`step`:return s(e,`mid`);case`stepBefore`:return s(e,`before`);case`stepAfter`:return s(e,`after`);default:return i(e)}}function l(e){let t=e?.worker?.worker;return typeof t==`object`&&!!t&&`dispatcher`in t}var u=null,d=null,f=null,p=class extends Error{constructor(){super("zombie-mermaid: rendering a flowchart, state, class, ER or architecture diagram needs the optional peer dependency \"elkjs\". Install it (npm i elkjs) and call registerElk(ELK) once at startup with `import ELK from 'elkjs/lib/elk.bundled.js'`. Sequence, pie, xychart, C4 and ASCII output do not need it. A flowchart can also pass `layout: 'simple'` to skip elkjs."),this.name=`ElkNotRegisteredError`}};function m(e){u=e,d=null,f=null}function h(){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:{}.url,new URL(`file://${g(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 g(e){let t=e.cwd;return typeof t==`function`?t.call(e):`/`}var _=20;function v(e=_){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function y(e){if(Array.isArray(e))return`[${e.map(y).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${y(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function b(){if(d&&f)return f;let e=u??=h();if(!e)throw new p;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(!l(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 d=s,t.forEach(e=>e()),f=d.worker.worker,f}function x(e,t){let n=t,r=n?y(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=b(),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 S=`JetBrains Mono NL`,C=`@font-face {
2
2
  font-family: 'JetBrains Mono NL';
3
3
  font-style: normal;
4
4
  font-weight: 400;
@@ -36,37 +36,38 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
36
36
  `)}var oi=700;function si(t,n,r,i){let a=t.isAbstract?` font-style="italic"`:``,o=t.isStatic?` text-decoration="underline"`:``,s=i??`var(--_text-faint)`,c=i??`var(--_text-sec)`,l=i??`var(--_text-muted)`,u=[];t.visibility&&u.push(e.f`<tspan fill="${c}" font-weight="${oi}">${vi(t.visibility)}</tspan><tspan fill="${s}"> </tspan>`);let d=t.isMethod?e.f`${t.name}(${t.params||``})`:t.name;return u.push(e.f`<tspan fill="${c}">${vi(d)}</tspan>`),t.type&&(u.push(e.f`<tspan fill="${s}">: </tspan>`),u.push(e.f`<tspan fill="${l}">${vi(t.type)}</tspan>`)),e.f`<text x="${n}" y="${r}" class="mono" dy="${N}" `+e.f`font-size="${ti.memberSize}" font-weight="${ti.memberWeight}"${a}${o}>`+e.f`${u.join(``)}</text>`}var ci=6;function li(t,n){let{x:r,y:i,width:a,height:o}=t,s=t.forClass===void 0?``:e.f` data-for="${(0,e.escapeAttr)(t.forClass)}"`,c=[e.f`${r},${i}`,e.f`${r+a-ci},${i}`,e.f`${r+a},${i+ci}`,e.f`${r+a},${i+o}`,e.f`${r},${i+o}`].join(` `),l=e.f`${r+a-ci},${i} ${r+a},${i+ci} `+e.f`${r+a-ci},${i+ci}`;return e.f`<g class="class-note"${s}>`+e.f`\n <polygon points="${c}" `+e.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`+e.f`\n <polygon points="${l}" `+e.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`+e.f`\n ${(0,e.renderMultilineText)(t.text,r+a/2,i+o/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`)}`+`
37
37
  </g>`}function ui(t){if(!t.linkPoints||t.linkPoints.length<2)return``;let n=t.linkPoints.map(t=>e.f`${t.x},${t.y}`).join(` `),r=t.forClass===void 0?``:e.f` data-for="${(0,e.escapeAttr)(t.forClass)}"`;return e.f`<polyline class="class-note-link"${r} points="${n}" `+e.f`fill="none" stroke="var(--_line)" stroke-width="${M.connector}" stroke-dasharray="2 3" />`}function di(t){if(t.points.length<2)return``;let n=t.points.map(t=>e.f`${t.x},${t.y}`).join(` `),r=t.type===`dependency`||t.type===`realization`?` stroke-dasharray="6 4"`:``,i=pi(t.type,t.markerAt),a=[`class="class-relationship"`,e.f`data-from="${(0,e.escapeAttr)(t.from)}"`,e.f`data-to="${(0,e.escapeAttr)(t.to)}"`,e.f`data-type="${t.type}"`,e.f`data-marker-at="${t.markerAt}"`];return t.label&&a.push(e.f`data-label="${(0,e.escapeAttr)(t.label)}"`),t.fromCardinality&&a.push(e.f`data-from-cardinality="${(0,e.escapeAttr)(t.fromCardinality)}"`),t.toCardinality&&a.push(e.f`data-to-cardinality="${(0,e.escapeAttr)(t.toCardinality)}"`),e.f`<polyline ${a.join(` `)} points="${n}" fill="none" stroke="var(--_line)" `+e.f`stroke-width="${M.connector}"${r}${i} />`}function fi(t,n){let r=t.interfaceLabel;if(!r)return``;let i=t.markerAt===`from`?t.from:t.to;return e.f`<g class="class-interface" data-id="${(0,e.escapeAttr)(i)}" data-label="${(0,e.escapeAttr)(r.text)}">\n `+(0,e.renderMultilineText)(r.text,r.x+r.width/2,r.y+r.height/2,n.nodeLabel,e.f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${A.edgeLabel}" fill="var(--_text)"`)+`
38
38
  </g>`}function pi(t,n){let r=mi(t);return r?(n===`to`?``:e.f` marker-start="url(#${r})"`)+(n===`from`?``:e.f` marker-end="url(#${r})"`):``}function mi(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 hi(t,n){if(!t.label&&!t.fromCardinality&&!t.toCardinality||t.points.length<2)return``;let r=[];if(t.label){let i=t.labelPosition??gi(t.points);r.push((0,e.renderMultilineText)(t.label,i.x,i.y-8,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`))}if(t.fromCardinality&&t.points.length>=2){let i=t.points[0],a=t.points[1],o=_i(i,a);r.push((0,e.renderMultilineText)(t.fromCardinality,i.x+o.x,i.y+o.y,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`))}if(t.toCardinality&&t.points.length>=2){let i=t.points[t.points.length-1],a=t.points[t.points.length-2],o=_i(i,a);r.push((0,e.renderMultilineText)(t.toCardinality,i.x+o.x,i.y+o.y,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`))}return r.join(`
39
- `)}function gi(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function _i(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>Math.abs(r)?{x:n>0?14:-14,y:-10}:{x:-14,y:r>0?14:-14}}var vi=e.escapeXml,G={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90};function yi(e){return e.length*Math.ceil(T(`M`,G.attrFontSize))}function bi(e,t){let n=new Map,r=k(t.fontSizes);for(let t of e.entities){let e=w(t.label,r.nodeLabel,A.nodeLabel),i=0;for(let e of t.attributes){let t=yi(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(G.minWidth,e+G.boxPadX*2,i+G.boxPadX*2),o=G.headerHeight+Math.max(t.attributes.length,1)*G.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(te(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())o.push(ie({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));return{elkGraph:{id:`root`,layoutOptions:{...B({direction:R(e.direction,L.er),nodeSpacing:G.nodeSpacing,layerSpacing:G.layerSpacing,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 xi(t,n,r){let i=new Map;for(let e of n.entities)i.set(e.id,e);let a=[];for(let o of t.children??[]){let t=i.get(o.id);if(t){let i=r.get(t.id);if(!i)throw Error(`Missing computed size for entity "${t.id}"`);a.push({id:t.id,label:t.label,attributes:t.attributes,x:o.x??0,y:o.y??0,width:o.width??i.width,height:o.height??i.height,headerHeight:G.headerHeight,rowHeight:G.rowHeight,inlineStyle:(0,e.resolveNodeStyle)(t.id,n),className:n.classAssignments.get(t.id)})}}let o=[];for(let[e,r]of(t.edges??[]).entries()){let t=n.relationships[e],i=He(r);o.push({entity1:t.entity1,entity2:t.entity2,cardinality1:t.cardinality1,cardinality2:t.cardinality2,label:t.label,identifying:t.identifying,points:i})}return{width:t.width??600,height:t.height??400,entities:a,relationships:o}}function Si(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=bi(e,t);return xi(x(n,t.layoutCache),e,r)}var Ci=70,wi={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function Ti(t,n,r=`Inter`,i=!1,a=O,o,s,c,l={}){let u=[];u.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push(F(r,!0,l.nonce)),u.push(`<defs>`),u.push(`</defs>`);for(let e of t.relationships)u.push(Oi(e));for(let e of t.entities)u.push(Ei(e,a));for(let e of t.relationships)u.push(Ai(e));for(let e of t.relationships)u.push(ki(e,a));return u.push(`</svg>`),u.join(`
40
- `)}function Ei(t,n){let{id:r,x:i,y:a,width:o,height:s,headerHeight:c,rowHeight:l,label:u,attributes:d,inlineStyle:f}=t,p=[],m=(0,e.escapeAttr)(f?.fill??`var(--_node-fill)`),h=(0,e.escapeAttr)(f?.stroke??`var(--_node-stroke)`),g=(0,e.escapeAttr)(f?.[`stroke-width`]??String(M.outerBox)),_=(0,e.escapeAttr)(f?.[`stroke-width`]??String(M.innerBox)),v=f?.fill?m:`var(--_group-hdr)`,y=f?.color?(0,e.escapeAttr)(f.color):f?.fill?(0,e.escapeAttr)((0,e.getReadableTextColor)(f.fill,`var(--_text)`)):void 0,b=(0,e.sanitizeClassName)(t.className);p.push(e.f`<g class="${b?e.f`entity ${b}`:`entity`}" data-id="${(0,e.escapeAttr)(r)}" data-label="${(0,e.escapeAttr)(u)}">`),p.push(e.f` <rect x="${i}" y="${a}" width="${o}" height="${s}" `+e.f`rx="0" ry="0" fill="${m}" stroke="${h}" stroke-width="${g}" />`),p.push(e.f` <rect x="${i}" y="${a}" width="${o}" height="${c}" `+e.f`rx="0" ry="0" fill="${v}" stroke="${h}" stroke-width="${g}" />`),p.push(` `+(0,e.renderMultilineText)(u,i+o/2,a+c/2,n.nodeLabel,e.f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="700" fill="${y??`var(--_text)`}"`));let x=a+c;p.push(e.f` <line x1="${i}" y1="${x}" x2="${i+o}" y2="${x}" `+e.f`stroke="${h}" stroke-width="${_}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=x+e*l+l/2;p.push(` `+Di(t,i,n,o,y).replace(/\n/g,`
41
- `))}return d.length===0&&p.push(e.f` <text x="${i+o/2}" y="${x+l/2}" text-anchor="middle" dy="${N}" `+e.f`font-size="${wi.attrSize}" fill="${y??`var(--_text-muted)`}" font-style="italic">(no attributes)</text>`),p.push(`</g>`),p.join(`
42
- `)}function Di(t,n,r,i,a){let o=[],s=t.comment&&t.comment.length>0;if(t.comment&&t.comment.length>0){let n=t.comment.replace(/<br\s*\/?>/gi,`
43
- `);o.push(e.f`<g><title>${Ni(n)}</title>`)}let c=0;t.keys.length>0&&(c=w(t.keys.join(`,`),wi.keySize,wi.keyWeight)+8,o.push(e.f`<rect x="${n+6}" y="${r-7}" width="${c}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),o.push(e.f`<text x="${n+6+c/2}" y="${r}" text-anchor="middle" dy="${N}" `+e.f`font-size="${wi.keySize}" font-weight="${wi.keyWeight}" fill="${a??`var(--_text-sec)`}">${t.keys.join(`,`)}</text>`));let l=n+8+(c>0?c+6:0);o.push(e.f`<text x="${l}" y="${r}" class="mono" dy="${N}" `+e.f`font-size="${wi.attrSize}" font-weight="${wi.attrWeight}">`+e.f`<tspan fill="${a??`var(--_text-muted)`}">${Ni(t.type)}</tspan></text>`);let u=n+i-8;return o.push(e.f`<text x="${u}" y="${r}" class="mono" text-anchor="end" dy="${N}" `+e.f`font-size="${wi.attrSize}" font-weight="${wi.attrWeight}">`+e.f`<tspan fill="${a??`var(--_text-sec)`}">${Ni(t.name)}</tspan></text>`),s&&o.push(`</g>`),o.join(`
44
- `)}function Oi(t){if(t.points.length<2)return``;let n=t.points.map(t=>e.f`${t.x},${t.y}`).join(` `),r=t.identifying?``:` stroke-dasharray="6 4"`,i=t.label?e.f` data-label="${(0,e.escapeAttr)(t.label)}"`:``,a=[`class="er-relationship"`,e.f`data-entity1="${(0,e.escapeAttr)(t.entity1)}"`,e.f`data-entity2="${(0,e.escapeAttr)(t.entity2)}"`,e.f`data-cardinality1="${t.cardinality1}"`,e.f`data-cardinality2="${t.cardinality2}"`,e.f`data-identifying="${t.identifying}"`];return e.f`<polyline ${a.join(` `)}${i} points="${n}" fill="none" stroke="var(--_line)" `+e.f`stroke-width="${M.connector}"${r} />`}function ki(t,n){if(!t.label||t.points.length<2)return``;let r=Mi(t.points),i=(0,e.measureMultilineText)(t.label,n.edgeLabel,A.edgeLabel),a=i.width+8,o=i.height+6;return e.f`<rect x="${r.x-a/2}" y="${r.y-o/2}" width="${a}" height="${o}" rx="2" ry="2" `+`fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />`+e.f`\n${(0,e.renderMultilineText)(t.label,r.x,r.y,n.edgeLabel,e.f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${A.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${Ci}%, var(--bg))"`)}`}function Ai(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(ji(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(ji(i,a,e.cardinality2)),t.join(`
45
- `)}function ji(t,n,r){let i=[],a=M.connector+.25,o=t.x-n.x,s=t.y-n.y,c=Math.sqrt(o*o+s*s);if(c===0)return``;let l=o/c,u=s/c,d=-u,f=l,p=t.x-l*4,m=t.y-u*4,h=t.x-l*16,g=t.y-u*16,_=r===`one`||r===`zero-one`,v=r===`many`||r===`zero-many`,y=r===`zero-one`||r===`zero-many`;if(_){i.push(e.f`<line x1="${p+d*6}" y1="${m+f*6}" `+e.f`x2="${p-d*6}" y2="${m-f*6}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`);let t=p-l*4,n=m-u*4;i.push(e.f`<line x1="${t+d*6}" y1="${n+f*6}" `+e.f`x2="${t-d*6}" y2="${n-f*6}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`)}if(v){let t=p,n=m;i.push(e.f`<line x1="${t+d*7}" y1="${n+f*7}" `+e.f`x2="${h}" y2="${g}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`),i.push(e.f`<line x1="${t}" y1="${n}" `+e.f`x2="${h}" y2="${g}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`),i.push(e.f`<line x1="${t-d*7}" y1="${n-f*7}" `+e.f`x2="${h}" y2="${g}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`)}if(r===`many`){let n=t.x-l*20,r=t.y-u*20;i.push(e.f`<line x1="${n+d*6}" y1="${r+f*6}" `+e.f`x2="${n-d*6}" y2="${r-f*6}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`)}if(y){let n=v?20:12,r=t.x-l*n,o=t.y-u*n;i.push(e.f`<circle cx="${r}" cy="${o}" r="4" `+e.f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${a}" />`)}return i.join(`
46
- `)}function Mi(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 Ni=e.escapeXml,Pi={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};function Fi(e){return e+8}var Ii=14,Li=new Set([`boundary`,`control`,`entity`,`database`]);function Ri(e){return e.type===`actor`||Li.has(e.participantType)}var zi=4;function Bi(t,n,r){return 14+(0,e.measureMultilineText)(t,n,r).height/2}function Vi(e){return{...Pi,actorHeight:e?.actorHeight??Pi.actorHeight,headerGap:e?.headerGap??Pi.headerGap,messageRowHeight:e?.messageRowHeight??Pi.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Pi.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Pi.noteStackGap}}function Hi(e,t={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let n=Vi(t.sequence),r=k(t.fontSizes),i=e.actors.map(e=>{let t=w(e.label,r.nodeLabel,A.nodeLabel);return Math.max(t+n.actorPadX*2,80)}),a=[],o=n.padding+i[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=Math.max(n.actorGap,(i[t-1]+i[t])/2+40);o+=e}a.push(o)}let s=new Map;for(let t=0;t<e.actors.length;t++)s.set(e.actors[t].id,t);let c=e.boxes.filter(e=>e.actorIds.length>0),l=c.some(e=>e.label!==``),u=c.length===0?0:n.boxPad+(l?Fi(r.edgeLabel):0),d=n.padding+u,f=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,...e.participantType!==void 0&&{participantType:e.participantType},x:a[t],y:d,width:i[t],height:n.actorHeight})),p=c.map(e=>{let t=e.actorIds.map(e=>s.get(e)??0),r=Math.min(...t),o=Math.max(...t),c=a[r]-i[r]/2-n.boxPad,l=a[o]+i[o]/2+n.boxPad,u={label:e.label,x:c,y:n.padding,width:l-c,height:0};return e.color!==void 0&&(u.color=e.color),u}),m=e.actors.map(e=>Ri(e)?Bi(e.label,r.nodeLabel,A.nodeLabel):0),h=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?m[t]:0)),g=r.edgeLabel+12,_=d+n.actorHeight+Math.max(n.headerGap,h>0?h+zi+g:0),v=[],y=new Map;for(let t of e.blocks){let e=y.get(t.startIndex)??0;y.set(t.startIndex,Math.max(e,n.blockHeaderExtra));for(let e of t.dividers){let t=y.get(e.index)??0;y.set(e.index,Math.max(t,n.dividerExtra))}}let b=new Map;for(let t of e.notes){let e=b.get(t.afterIndex)??[];e.push(t),b.set(t.afterIndex,e)}let x=[],S=b.get(-1);if(S&&S.length>0){let e=_;for(let t of S){let o=Math.max(n.noteWidth,w(t.text,r.edgeLabel,A.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(t.actorIds[0]??``)??0,u;if(t.position===`left`)u=a[l]-i[l]/2-o-n.noteGap;else if(t.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(t.actorIds.length>1){let e=s.get(t.actorIds[t.actorIds.length-1]??``)??l;u=(a[l]+a[e])/2-o/2}else u=a[l]-o/2;x.push({text:t.text,x:u,y:e,width:o,height:c,position:t.position,actors:t.actorIds}),e+=c+n.noteStackGap}_=Math.max(_,e+n.messageRowHeight/2)}let C=new Map,T=[],E=n.activationWidth/2;function D(e,t){let n=C.get(e)??[];C.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function O(e,t){let r=C.get(e);if(!r||r.length===0)return;let{startY:i,depth:o}=r.pop(),c=s.get(e)??0,l=o*E;T.push({actorId:e,x:a[c]-n.activationWidth/2+l,topY:i,bottomY:t,width:n.activationWidth,depth:o})}let ee=new Map;for(let t of e.activations){let e=ee.get(t.afterIndex)??[];e.push(t),ee.set(t.afterIndex,e)}function j(e,t){for(let n of ee.get(e)??[])n.kind===`start`?D(n.actorId,t):O(n.actorId,t)}j(-1,_);for(let t=0;t<e.messages.length;t++){let o=e.messages[t],c=s.get(o.from)??0,l=s.get(o.to)??0,u=o.from===o.to,d=y.get(t)??0;d>0&&(_+=d);let f=a[c],p=a[l],m=!u&&e.actors[l].createdAt===t;if(m){let e=i[l]/2;p+=f<p?-e:e}v.push({from:o.from,to:o.to,label:o.label,lineStyle:o.lineStyle,arrowHead:o.arrowHead,x1:f,x2:p,y:_,isSelf:u,bidirectional:o.bidirectional??!1,seqNumber:o.seqNumber}),o.activate&&D(o.to,_),o.deactivate&&O(o.from,_),j(t,_),_+=u?n.selfMessageHeight+n.messageRowHeight:n.messageRowHeight,m&&(_+=n.actorHeight/2);let h=b.get(t);if(h&&h.length>0){let e=u?n.selfMessageHeight:0,o=v[t].y+e+n.noteOffsetAfterMessage;for(let e of h){let t=Math.max(n.noteWidth,w(e.text,r.edgeLabel,A.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(e.actorIds[0]??``)??0,u;if(e.position===`left`)u=a[l]-i[l]/2-t-n.noteGap;else if(e.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(e.actorIds.length>1){let n=s.get(e.actorIds[e.actorIds.length-1]??``)??l;u=(a[l]+a[n])/2-t/2}else u=a[l]-t/2;x.push({text:e.text,x:u,y:o,width:t,height:c,position:e.position,actors:e.actorIds}),o+=c+n.noteStackGap}_=Math.max(_,o+n.messageRowHeight/2)}}for(let[e,t]of C)for(let{startY:r,depth:i}of t){let t=s.get(e)??0,o=i*E;T.push({actorId:e,x:a[t]-n.activationWidth/2+o,topY:r,bottomY:_-n.messageRowHeight/2,width:n.activationWidth,depth:i})}T.sort((e,t)=>e.depth-t.depth);let M=e.blocks.map(t=>{let o=v[t.startIndex],c=v[t.endIndex],l=(o?.y??_)-n.blockPadTop,u=(c?.y??_)+n.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(s.get(t.from)??0),d.add(s.get(t.to)??0))}if(d.size===0)for(let t=0;t<e.actors.length;t++)d.add(t);let f=Math.min(...d),p=Math.max(...d),m=a[f]-i[f]/2-n.blockPadX,h=a[p]+i[p]/2+n.blockPadX,g=t.dividers.map(e=>{let t=v[e.index],n=t?.y??_,i=28;if(e.label&&t?.label){let n=w(`[${e.label}]`,r.edgeLabel,A.edgeLabel),a=m+8,o=a+n,s=w(t.label,r.edgeLabel,A.edgeLabel),c=t.isSelf?t.x1+36:(t.x1+t.x2)/2-s/2,l=c+s;o>c&&a<l&&(i=36)}return{y:n-i,label:e.label}});return{type:t.type,label:t.label,x:m,y:l,width:h-m,height:u-l,dividers:g}}),N=x,P=_+n.padding,F=n.padding,I=0;for(let e of f)F=Math.min(F,e.x-e.width/2),I=Math.max(I,e.x+e.width/2);for(let e of M)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of N)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of p)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of v)if(e.isSelf&&e.label){let t=e.x1+30+8,n=w(e.label,r.edgeLabel,A.edgeLabel);I=Math.max(I,t+n+8)}let L=F<n.padding?n.padding-F:0;if(L>0){for(let e of f)e.x+=L;for(let e of v)e.x1+=L,e.x2+=L;for(let e of T)e.x+=L;for(let e of M)e.x+=L;for(let e of N)e.x+=L;for(let e of p)e.x+=L;for(let e=0;e<a.length;e++)a[e]+=L}for(let t=0;t<e.actors.length;t++){let r=e.actors[t].createdAt;r!==void 0&&(f[t].y=(v[r]?.y??_)-n.actorHeight/2)}let R=e.actors.map((e,t)=>{let r=e.destroyedAt,i={actorId:e.id,x:a[t],topY:f[t].y+n.actorHeight+(m[t]>0?m[t]+zi:0),bottomY:r===void 0?P-n.padding:v[r]?.y??_};return r!==void 0&&(i.destroyed=!0),i});for(let e of p)e.height=P-n.padding+n.boxPad-e.y;let z=I+L+n.padding;return{width:Math.max(z,200),height:Math.max(P,100),actors:f,lifelines:R,messages:v,activations:T,blocks:M,notes:N,boxes:p}}function Ui(t,n,r=`Inter`,i=!1,a=O,o,s,c,l={}){let u=[];u.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push((0,e.buildStyleBlock)(r,!1,l.nonce)),u.push(`<defs>`),u.push(Wi()),u.push(`</defs>`);for(let e of t.boxes)u.push(la(e,a));for(let e of t.blocks)u.push(ua(e,a));let d=ta(t,a);for(let e of t.lifelines)u.push(ra(e,d));for(let e of t.activations)u.push(aa(e));for(let e of t.messages)u.push(oa(e,a));for(let e of t.notes)u.push(da(e,a));for(let e of t.actors)u.push(Ki(e,a));return u.push(`</svg>`),u.join(`
47
- `)}function Wi(){let t=P.width,n=P.height;return e.f` <marker id="seq-arrow" markerWidth="${t}" markerHeight="${n}" refX="${t}" refY="${n/2}" orient="auto-start-reverse">`+e.f`\n <polygon points="0 0, ${t} ${n/2}, 0 ${n}" fill="var(--_arrow)" />`+`
39
+ `)}function gi(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function _i(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>Math.abs(r)?{x:n>0?14:-14,y:-10}:{x:-14,y:r>0?14:-14}}var vi=e.escapeXml,yi={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90};function bi(e){return e.length*Math.ceil(T(`M`,yi.attrFontSize))}function xi(e,t){let n=new Map,r=k(t.fontSizes);for(let t of e.entities){let e=w(t.label,r.nodeLabel,A.nodeLabel),i=0;for(let e of t.attributes){let t=bi(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(yi.minWidth,e+yi.boxPadX*2,i+yi.boxPadX*2),o=yi.headerHeight+Math.max(t.attributes.length,1)*yi.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(te(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())o.push(ie({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));return{elkGraph:{id:`root`,layoutOptions:{...B({direction:R(e.direction,L.er),nodeSpacing:yi.nodeSpacing,layerSpacing:yi.layerSpacing,padding:yi.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 Si(t,n,r){let i=new Map;for(let e of n.entities)i.set(e.id,e);let a=[];for(let o of t.children??[]){let t=i.get(o.id);if(t){let i=r.get(t.id);if(!i)throw Error(`Missing computed size for entity "${t.id}"`);a.push({id:t.id,label:t.label,attributes:t.attributes,x:o.x??0,y:o.y??0,width:o.width??i.width,height:o.height??i.height,headerHeight:yi.headerHeight,rowHeight:yi.rowHeight,inlineStyle:(0,e.resolveNodeStyle)(t.id,n),className:n.classAssignments.get(t.id)})}}let o=[];for(let[e,r]of(t.edges??[]).entries()){let t=n.relationships[e],i=He(r);o.push({entity1:t.entity1,entity2:t.entity2,cardinality1:t.cardinality1,cardinality2:t.cardinality2,label:t.label,identifying:t.identifying,points:i})}return{width:t.width??600,height:t.height??400,entities:a,relationships:o}}function Ci(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=xi(e,t);return Si(x(n,t.layoutCache),e,r)}var wi=70,Ti={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function Ei(t,n,r=`Inter`,i=!1,a=O,o,s,c,l={}){let u=[];u.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push(F(r,!0,l.nonce)),u.push(`<defs>`),u.push(`</defs>`);for(let e of t.relationships)u.push(ki(e));for(let e of t.entities)u.push(Di(e,a));for(let e of t.relationships)u.push(ji(e));for(let e of t.relationships)u.push(Ai(e,a));return u.push(`</svg>`),u.join(`
40
+ `)}function Di(t,n){let{id:r,x:i,y:a,width:o,height:s,headerHeight:c,rowHeight:l,label:u,attributes:d,inlineStyle:f}=t,p=[],m=(0,e.escapeAttr)(f?.fill??`var(--_node-fill)`),h=(0,e.escapeAttr)(f?.stroke??`var(--_node-stroke)`),g=(0,e.escapeAttr)(f?.[`stroke-width`]??String(M.outerBox)),_=(0,e.escapeAttr)(f?.[`stroke-width`]??String(M.innerBox)),v=f?.fill?m:`var(--_group-hdr)`,y=f?.color?(0,e.escapeAttr)(f.color):f?.fill?(0,e.escapeAttr)((0,e.getReadableTextColor)(f.fill,`var(--_text)`)):void 0,b=(0,e.sanitizeClassName)(t.className);p.push(e.f`<g class="${b?e.f`entity ${b}`:`entity`}" data-id="${(0,e.escapeAttr)(r)}" data-label="${(0,e.escapeAttr)(u)}">`),p.push(e.f` <rect x="${i}" y="${a}" width="${o}" height="${s}" `+e.f`rx="0" ry="0" fill="${m}" stroke="${h}" stroke-width="${g}" />`),p.push(e.f` <rect x="${i}" y="${a}" width="${o}" height="${c}" `+e.f`rx="0" ry="0" fill="${v}" stroke="${h}" stroke-width="${g}" />`),p.push(` `+(0,e.renderMultilineText)(u,i+o/2,a+c/2,n.nodeLabel,e.f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="700" fill="${y??`var(--_text)`}"`));let x=a+c;p.push(e.f` <line x1="${i}" y1="${x}" x2="${i+o}" y2="${x}" `+e.f`stroke="${h}" stroke-width="${_}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=x+e*l+l/2;p.push(` `+Oi(t,i,n,o,y).replace(/\n/g,`
41
+ `))}return d.length===0&&p.push(e.f` <text x="${i+o/2}" y="${x+l/2}" text-anchor="middle" dy="${N}" `+e.f`font-size="${Ti.attrSize}" fill="${y??`var(--_text-muted)`}" font-style="italic">(no attributes)</text>`),p.push(`</g>`),p.join(`
42
+ `)}function Oi(t,n,r,i,a){let o=[],s=t.comment&&t.comment.length>0;if(t.comment&&t.comment.length>0){let n=t.comment.replace(/<br\s*\/?>/gi,`
43
+ `);o.push(e.f`<g><title>${Pi(n)}</title>`)}let c=0;t.keys.length>0&&(c=w(t.keys.join(`,`),Ti.keySize,Ti.keyWeight)+8,o.push(e.f`<rect x="${n+6}" y="${r-7}" width="${c}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),o.push(e.f`<text x="${n+6+c/2}" y="${r}" text-anchor="middle" dy="${N}" `+e.f`font-size="${Ti.keySize}" font-weight="${Ti.keyWeight}" fill="${a??`var(--_text-sec)`}">${t.keys.join(`,`)}</text>`));let l=n+8+(c>0?c+6:0);o.push(e.f`<text x="${l}" y="${r}" class="mono" dy="${N}" `+e.f`font-size="${Ti.attrSize}" font-weight="${Ti.attrWeight}">`+e.f`<tspan fill="${a??`var(--_text-muted)`}">${Pi(t.type)}</tspan></text>`);let u=n+i-8;return o.push(e.f`<text x="${u}" y="${r}" class="mono" text-anchor="end" dy="${N}" `+e.f`font-size="${Ti.attrSize}" font-weight="${Ti.attrWeight}">`+e.f`<tspan fill="${a??`var(--_text-sec)`}">${Pi(t.name)}</tspan></text>`),s&&o.push(`</g>`),o.join(`
44
+ `)}function ki(t){if(t.points.length<2)return``;let n=t.points.map(t=>e.f`${t.x},${t.y}`).join(` `),r=t.identifying?``:` stroke-dasharray="6 4"`,i=t.label?e.f` data-label="${(0,e.escapeAttr)(t.label)}"`:``,a=[`class="er-relationship"`,e.f`data-entity1="${(0,e.escapeAttr)(t.entity1)}"`,e.f`data-entity2="${(0,e.escapeAttr)(t.entity2)}"`,e.f`data-cardinality1="${t.cardinality1}"`,e.f`data-cardinality2="${t.cardinality2}"`,e.f`data-identifying="${t.identifying}"`];return e.f`<polyline ${a.join(` `)}${i} points="${n}" fill="none" stroke="var(--_line)" `+e.f`stroke-width="${M.connector}"${r} />`}function Ai(t,n){if(!t.label||t.points.length<2)return``;let r=Ni(t.points),i=(0,e.measureMultilineText)(t.label,n.edgeLabel,A.edgeLabel),a=i.width+8,o=i.height+6;return e.f`<rect x="${r.x-a/2}" y="${r.y-o/2}" width="${a}" height="${o}" rx="2" ry="2" `+`fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />`+e.f`\n${(0,e.renderMultilineText)(t.label,r.x,r.y,n.edgeLabel,e.f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${A.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${wi}%, var(--bg))"`)}`}function ji(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(Mi(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(Mi(i,a,e.cardinality2)),t.join(`
45
+ `)}function Mi(t,n,r){let i=[],a=M.connector+.25,o=t.x-n.x,s=t.y-n.y,c=Math.sqrt(o*o+s*s);if(c===0)return``;let l=o/c,u=s/c,d=-u,f=l,p=t.x-l*4,m=t.y-u*4,h=t.x-l*16,g=t.y-u*16,_=r===`one`||r===`zero-one`,v=r===`many`||r===`zero-many`,y=r===`zero-one`||r===`zero-many`;if(_){i.push(e.f`<line x1="${p+d*6}" y1="${m+f*6}" `+e.f`x2="${p-d*6}" y2="${m-f*6}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`);let t=p-l*4,n=m-u*4;i.push(e.f`<line x1="${t+d*6}" y1="${n+f*6}" `+e.f`x2="${t-d*6}" y2="${n-f*6}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`)}if(v){let t=p,n=m;i.push(e.f`<line x1="${t+d*7}" y1="${n+f*7}" `+e.f`x2="${h}" y2="${g}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`),i.push(e.f`<line x1="${t}" y1="${n}" `+e.f`x2="${h}" y2="${g}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`),i.push(e.f`<line x1="${t-d*7}" y1="${n-f*7}" `+e.f`x2="${h}" y2="${g}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`)}if(r===`many`){let n=t.x-l*20,r=t.y-u*20;i.push(e.f`<line x1="${n+d*6}" y1="${r+f*6}" `+e.f`x2="${n-d*6}" y2="${r-f*6}" `+e.f`stroke="var(--_line)" stroke-width="${a}" />`)}if(y){let n=v?20:12,r=t.x-l*n,o=t.y-u*n;i.push(e.f`<circle cx="${r}" cy="${o}" r="4" `+e.f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${a}" />`)}return i.join(`
46
+ `)}function Ni(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 Pi=e.escapeXml,Fi={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};function Ii(e){return e+8}var Li=14,Ri=new Set([`boundary`,`control`,`entity`,`database`]);function zi(e){return e.type===`actor`||Ri.has(e.participantType)}var Bi=4;function Vi(t,n,r){return 14+(0,e.measureMultilineText)(t,n,r).height/2}function Hi(e){return{...Fi,actorHeight:e?.actorHeight??Fi.actorHeight,headerGap:e?.headerGap??Fi.headerGap,messageRowHeight:e?.messageRowHeight??Fi.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Fi.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Fi.noteStackGap}}function Ui(e,t={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let n=Hi(t.sequence),r=k(t.fontSizes),i=e.actors.map(e=>{let t=w(e.label,r.nodeLabel,A.nodeLabel);return Math.max(t+n.actorPadX*2,80)}),a=[],o=n.padding+i[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=Math.max(n.actorGap,(i[t-1]+i[t])/2+40);o+=e}a.push(o)}let s=new Map;for(let t=0;t<e.actors.length;t++)s.set(e.actors[t].id,t);let c=e.boxes.filter(e=>e.actorIds.length>0),l=c.some(e=>e.label!==``),u=c.length===0?0:n.boxPad+(l?Ii(r.edgeLabel):0),d=n.padding+u,f=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,...e.participantType!==void 0&&{participantType:e.participantType},x:a[t],y:d,width:i[t],height:n.actorHeight})),p=c.map(e=>{let t=e.actorIds.map(e=>s.get(e)??0),r=Math.min(...t),o=Math.max(...t),c=a[r]-i[r]/2-n.boxPad,l=a[o]+i[o]/2+n.boxPad,u={label:e.label,x:c,y:n.padding,width:l-c,height:0};return e.color!==void 0&&(u.color=e.color),u}),m=e.actors.map(e=>zi(e)?Vi(e.label,r.nodeLabel,A.nodeLabel):0),h=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?m[t]:0)),g=r.edgeLabel+12,_=d+n.actorHeight+Math.max(n.headerGap,h>0?h+Bi+g:0),v=[],y=new Map;for(let t of e.blocks){let e=y.get(t.startIndex)??0;y.set(t.startIndex,Math.max(e,n.blockHeaderExtra));for(let e of t.dividers){let t=y.get(e.index)??0;y.set(e.index,Math.max(t,n.dividerExtra))}}let b=new Map;for(let t of e.notes){let e=b.get(t.afterIndex)??[];e.push(t),b.set(t.afterIndex,e)}let x=[],S=b.get(-1);if(S&&S.length>0){let e=_;for(let t of S){let o=Math.max(n.noteWidth,w(t.text,r.edgeLabel,A.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(t.actorIds[0]??``)??0,u;if(t.position===`left`)u=a[l]-i[l]/2-o-n.noteGap;else if(t.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(t.actorIds.length>1){let e=s.get(t.actorIds[t.actorIds.length-1]??``)??l;u=(a[l]+a[e])/2-o/2}else u=a[l]-o/2;x.push({text:t.text,x:u,y:e,width:o,height:c,position:t.position,actors:t.actorIds}),e+=c+n.noteStackGap}_=Math.max(_,e+n.messageRowHeight/2)}let C=new Map,T=[],E=n.activationWidth/2;function D(e,t){let n=C.get(e)??[];C.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function O(e,t){let r=C.get(e);if(!r||r.length===0)return;let{startY:i,depth:o}=r.pop(),c=s.get(e)??0,l=o*E;T.push({actorId:e,x:a[c]-n.activationWidth/2+l,topY:i,bottomY:t,width:n.activationWidth,depth:o})}let ee=new Map;for(let t of e.activations){let e=ee.get(t.afterIndex)??[];e.push(t),ee.set(t.afterIndex,e)}function j(e,t){for(let n of ee.get(e)??[])n.kind===`start`?D(n.actorId,t):O(n.actorId,t)}j(-1,_);for(let t=0;t<e.messages.length;t++){let o=e.messages[t],c=s.get(o.from)??0,l=s.get(o.to)??0,u=o.from===o.to,d=y.get(t)??0;d>0&&(_+=d);let f=a[c],p=a[l],m=!u&&e.actors[l].createdAt===t;if(m){let e=i[l]/2;p+=f<p?-e:e}v.push({from:o.from,to:o.to,label:o.label,lineStyle:o.lineStyle,arrowHead:o.arrowHead,x1:f,x2:p,y:_,isSelf:u,bidirectional:o.bidirectional??!1,seqNumber:o.seqNumber}),o.activate&&D(o.to,_),o.deactivate&&O(o.from,_),j(t,_),_+=u?n.selfMessageHeight+n.messageRowHeight:n.messageRowHeight,m&&(_+=n.actorHeight/2);let h=b.get(t);if(h&&h.length>0){let e=u?n.selfMessageHeight:0,o=v[t].y+e+n.noteOffsetAfterMessage;for(let e of h){let t=Math.max(n.noteWidth,w(e.text,r.edgeLabel,A.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(e.actorIds[0]??``)??0,u;if(e.position===`left`)u=a[l]-i[l]/2-t-n.noteGap;else if(e.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(e.actorIds.length>1){let n=s.get(e.actorIds[e.actorIds.length-1]??``)??l;u=(a[l]+a[n])/2-t/2}else u=a[l]-t/2;x.push({text:e.text,x:u,y:o,width:t,height:c,position:e.position,actors:e.actorIds}),o+=c+n.noteStackGap}_=Math.max(_,o+n.messageRowHeight/2)}}for(let[e,t]of C)for(let{startY:r,depth:i}of t){let t=s.get(e)??0,o=i*E;T.push({actorId:e,x:a[t]-n.activationWidth/2+o,topY:r,bottomY:_-n.messageRowHeight/2,width:n.activationWidth,depth:i})}T.sort((e,t)=>e.depth-t.depth);let M=e.blocks.map(t=>{let o=v[t.startIndex],c=v[t.endIndex],l=(o?.y??_)-n.blockPadTop,u=(c?.y??_)+n.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(s.get(t.from)??0),d.add(s.get(t.to)??0))}if(d.size===0)for(let t=0;t<e.actors.length;t++)d.add(t);let f=Math.min(...d),p=Math.max(...d),m=a[f]-i[f]/2-n.blockPadX,h=a[p]+i[p]/2+n.blockPadX,g=t.dividers.map(e=>{let t=v[e.index],n=t?.y??_,i=28;if(e.label&&t?.label){let n=w(`[${e.label}]`,r.edgeLabel,A.edgeLabel),a=m+8,o=a+n,s=w(t.label,r.edgeLabel,A.edgeLabel),c=t.isSelf?t.x1+36:(t.x1+t.x2)/2-s/2,l=c+s;o>c&&a<l&&(i=36)}return{y:n-i,label:e.label}});return{type:t.type,label:t.label,...t.color===void 0?{}:{color:t.color},x:m,y:l,width:h-m,height:u-l,dividers:g}}),N=x,P=_+n.padding,F=n.padding,I=0;for(let e of f)F=Math.min(F,e.x-e.width/2),I=Math.max(I,e.x+e.width/2);for(let e of M)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of N)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of p)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of v)if(e.isSelf&&e.label){let t=e.x1+30+8,n=w(e.label,r.edgeLabel,A.edgeLabel);I=Math.max(I,t+n+8)}let L=F<n.padding?n.padding-F:0;if(L>0){for(let e of f)e.x+=L;for(let e of v)e.x1+=L,e.x2+=L;for(let e of T)e.x+=L;for(let e of M)e.x+=L;for(let e of N)e.x+=L;for(let e of p)e.x+=L;for(let e=0;e<a.length;e++)a[e]+=L}for(let t=0;t<e.actors.length;t++){let r=e.actors[t].createdAt;r!==void 0&&(f[t].y=(v[r]?.y??_)-n.actorHeight/2)}let R=e.actors.map((e,t)=>{let r=e.destroyedAt,i={actorId:e.id,x:a[t],topY:f[t].y+n.actorHeight+(m[t]>0?m[t]+Bi:0),bottomY:r===void 0?P-n.padding:v[r]?.y??_};return r!==void 0&&(i.destroyed=!0),i});for(let e of p)e.height=P-n.padding+n.boxPad-e.y;let z=I+L+n.padding;return{width:Math.max(z,200),height:Math.max(P,100),actors:f,lifelines:R,messages:v,activations:T,blocks:M,notes:N,boxes:p}}function Wi(t,n,r=`Inter`,i=!1,a=O,o,s,c,l={}){let u=[];u.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push((0,e.buildStyleBlock)(r,!1,l.nonce)),u.push(`<defs>`),u.push(Gi()),u.push(`</defs>`);for(let e of t.boxes)u.push(ua(e,a));for(let e of t.blocks)u.push(fa(e,a));let d=na(t,a);for(let e of t.lifelines)u.push(ia(e,d));for(let e of t.activations)u.push(oa(e));for(let e of t.messages)u.push(sa(e,a));for(let e of t.notes)u.push(pa(e,a));for(let e of t.actors)u.push(qi(e,a));return u.push(`</svg>`),u.join(`
47
+ `)}function Gi(){let t=P.width,n=P.height;return e.f` <marker id="seq-arrow" markerWidth="${t}" markerHeight="${n}" refX="${t}" refY="${n/2}" orient="auto-start-reverse">`+e.f`\n <polygon points="0 0, ${t} ${n/2}, 0 ${n}" fill="var(--_arrow)" />`+`
48
48
  </marker>`+e.f`\n <marker id="seq-arrow-open" markerWidth="${t}" markerHeight="${n}" refX="${t}" refY="${n/2}" orient="auto-start-reverse">`+e.f`\n <polyline points="0 0, ${t} ${n/2}, 0 ${n}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
49
- </marker>`}var Gi={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 Ki(t,n){let{id:r,x:i,y:a,width:o,height:s,label:c,type:l,participantType:u}=t,d=[],f=e.f`font-size="${n.nodeLabel}" text-anchor="middle" font-weight="${A.nodeLabel}" fill="var(--_text)"`;if(d.push(e.f`<g class="actor" data-id="${(0,e.escapeAttr)(r)}" data-label="${(0,e.escapeAttr)(c)}" data-type="${l}">`),l===`actor`){let t=s/24*.9,r=i-12*t,o=a+(s-24*t)/2,l=M.outerBox/t,u=`var(--_line)`;d.push(e.f` <g transform="translate(${r},${o}) scale(${t})">`+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="${u}" stroke-width="${l}" />`+e.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="${u}" stroke-width="${l}" />`+e.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="${u}" stroke-width="${l}" />`+`
50
- </g>`),d.push(` `+(0,e.renderMultilineText)(c,i,a+s+14,n.nodeLabel,f))}else if(Ri(t)){let t=s/24*.9,r=M.outerBox/t,o=e.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${r}"`,l=e.f`fill="none" stroke="var(--_node-stroke)" stroke-width="${r}"`,p=Gi[u](o,l);d.push(e.f` <g transform="translate(${i-12*t},${a+(s-24*t)/2}) scale(${t})">${p}\n </g>`),d.push(` `+(0,e.renderMultilineText)(c,i,a+s+14,n.nodeLabel,f))}else{let t=i-o/2,r=e.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}"`,l=i,p=a+s/2;if(u===`queue`){let n=s/2,i=t+8,c=t+o-8;d.push(e.f` <path d="M${i},${a}H${c}A${8},${n} 0 0 1 ${c},${a+s}H${i}A${8},${n} 0 0 1 ${i},${a}Z" ${r} />`,e.f` <path d="M${c},${a}A${8},${n} 0 0 0 ${c},${a+s}" fill="none" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}" />`)}else u===`collections`?(d.push(e.f` <rect x="${t+4}" y="${a}" width="${o-4}" height="${s-4}" rx="4" ry="4" ${r} />`,e.f` <rect x="${t}" y="${a+4}" width="${o-4}" height="${s-4}" rx="4" ry="4" ${r} />`),l=i-2,p=a+2+(s-4)/2):d.push(e.f` <rect x="${t}" y="${a}" width="${o}" height="${s}" rx="4" ry="4" ${r} />`);d.push(` `+(0,e.renderMultilineText)(c,l,p,n.nodeLabel,f))}return d.push(`</g>`),d.join(`
51
- `)}var qi=30,Ji=20,Yi=8,Xi=10,Zi=18,Qi=3,$i=2,ea=3;function ta(t,n){let r=[],i=t=>(0,e.measureMultilineText)(t,n.edgeLabel,A.edgeLabel),a=(e,t,n)=>{let a=i(e);r.push({x0:t-a.width/2,x1:t+a.width/2,y0:n-a.height/2,y1:n+a.height/2})},o=(e,t,n)=>{let a=i(e);r.push({x0:t,x1:t+a.width,y0:n-a.height/2,y1:n+a.height/2})};for(let e of t.messages)e.label&&(e.isSelf?o(e.label,e.x1+qi+Yi,e.y+Ji/2):a(e.label,(e.x1+e.x2)/2,e.y-Xi));for(let e of t.blocks){let t=w(`${e.type}${e.label?` [${e.label}]`:``}`.split(`
52
- `)[0]??``,n.edgeLabel,A.groupHeader)+16;r.push({x0:e.x,x1:e.x+t,y0:e.y,y1:e.y+Zi});for(let t of e.dividers)t.label&&o(`[${t.label}]`,e.x+8,t.y+14)}return r}function na(e,t){let n=t.filter(t=>e.x>t.x0-Qi&&e.x<t.x1+Qi&&t.y1+$i>e.topY&&t.y0-$i<e.bottomY).map(e=>[e.y0-$i,e.y1+$i]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=ea&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=ea&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function ra(t,n){let r=na(t,n).map(([n,r])=>e.f`<line class="lifeline" data-actor="${(0,e.escapeAttr)(t.actorId)}" `+e.f`x1="${t.x}" y1="${n}" x2="${t.x}" y2="${r}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
53
- `);if(!t.destroyed)return r;let{x:i,bottomY:a}=t,o=ia;return r+e.f`\n<path class="destroy" data-actor="${(0,e.escapeAttr)(t.actorId)}" `+e.f`d="M${i-o} ${a-o} L${i+o} ${a+o} M${i+o} ${a-o} L${i-o} ${a+o}" `+e.f`fill="none" stroke="var(--_line)" stroke-width="${M.outerBox}" stroke-linecap="round" />`}var ia=8;function aa(t){return e.f`<rect class="activation" data-actor="${(0,e.escapeAttr)(t.actorId)}" `+e.f`x="${t.x}" y="${t.topY}" width="${t.width}" height="${t.bottomY-t.topY}" `+e.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`}function oa(t,n){let r=[],i=t.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,a=t.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,o=t.bidirectional?e.f` marker-start="url(#${a})"`:``;if(r.push(e.f`<g class="message" data-from="${(0,e.escapeAttr)(t.from)}" data-to="${(0,e.escapeAttr)(t.to)}" `+e.f`data-label="${(0,e.escapeAttr)(t.label)}" data-line-style="${t.lineStyle}" `+e.f`data-arrow-head="${t.arrowHead}" data-self="${t.isSelf}" data-bidirectional="${t.bidirectional}">`),t.isSelf){let s=qi,c=Ji,l=Yi;r.push(e.f` <polyline points="${t.x1},${t.y} ${t.x1+s},${t.y} ${t.x1+s},${t.y+c} ${t.x2},${t.y+c}" `+e.f`fill="none" stroke="var(--_line)" stroke-width="${M.connector}"${i} marker-end="url(#${a})"${o} />`),r.push(` `+(0,e.renderMultilineText)(t.label,t.x1+s+l,t.y+c/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="start" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`))}else{r.push(e.f` <line x1="${t.x1}" y1="${t.y}" x2="${t.x2}" y2="${t.y}" `+e.f`stroke="var(--_line)" stroke-width="${M.connector}"${i} marker-end="url(#${a})"${o} />`);let s=(t.x1+t.x2)/2;r.push(` `+(0,e.renderMultilineText)(t.label,s,t.y-Xi,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`))}return t.seqNumber!==void 0&&r.push(` `+sa(t,n)),r.push(`</g>`),r.join(`
54
- `)}function sa(t,n){let r=Math.max(n.edgeLabel-2,8),i=t.bidirectional?t.x1+Math.sign(t.x2-t.x1)*(8+P.width):t.x1;return`<g class="seq-number">`+e.f`<circle cx="${i}" cy="${t.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${M.innerBox}" />`+(0,e.renderMultilineText)(String(t.seqNumber),i,t.y,r,e.f`font-size="${r}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var ca=35;function la(t,n){let r=t.label?e.f` data-label="${(0,e.escapeAttr)(t.label)}"`:``,i=t.color===void 0?``:e.f` data-color="${(0,e.escapeAttr)(t.color)}"`,a=t.color===void 0?`none`:e.f`color-mix(in srgb, ${(0,e.escapeAttr)(t.color)} ${ca}%, var(--bg))`,o=[e.f`<g class="participant-box"${r}${i}>`,e.f` <rect x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" rx="4" ry="4" `+e.f`fill="${a}" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`];return t.label&&o.push(` `+(0,e.renderMultilineText)(t.label,t.x+t.width/2,t.y+Fi(n.edgeLabel)/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.groupHeader}" fill="var(--_text-sec)"`)),o.push(`</g>`),o.join(`
55
- `)}function ua(t,n){let r=[],i=t.label?e.f` data-label="${(0,e.escapeAttr)(t.label)}"`:``;r.push(e.f`<g class="block" data-type="${(0,e.escapeAttr)(t.type)}"${i}>`),r.push(e.f` <rect x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" `+e.f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}" />`);let a=e.f`${t.type}${t.label?e.f` [${t.label}]`:``}`,o=a.split(`
56
- `)[0],s=w(o,n.edgeLabel,A.groupHeader)+16,c=Zi;r.push(e.f` <rect x="${t.x}" y="${t.y}" width="${s}" height="${c}" `+e.f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}" />`),r.push(` `+(0,e.renderMultilineText)(a,t.x+6,t.y+c/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" font-weight="${A.groupHeader}" fill="var(--_text-sec)"`));for(let i of t.dividers)r.push(e.f` <line x1="${t.x}" y1="${i.y}" x2="${t.x+t.width}" y2="${i.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),i.label&&r.push(` `+(0,e.renderMultilineText)(e.f`[${i.label}]`,t.x+8,i.y+14,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="start" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`));return r.push(`</g>`),r.join(`
57
- `)}function da(t,n){let{x:r,y:i,width:a,height:o}=t,s=t.actors&&t.actors.length>0?e.f` data-actors="${t.actors.map(e.escapeAttr).join(`,`)}"`:``,c=t.position?e.f` data-position="${(0,e.escapeAttr)(t.position)}"`:``,l=[e.f`${r},${i}`,e.f`${r+a-6},${i}`,e.f`${r+a},${i+6}`,e.f`${r+a},${i+o}`,e.f`${r},${i+o}`].join(` `);return e.f`<g class="note"${c}${s}>`+e.f`\n <polygon points="${l}" `+e.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`+e.f`\n <polygon points="${r+a-6},${i} ${r+a},${i+6} ${r+a-6},${i+6}" `+e.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`+e.f`\n ${(0,e.renderMultilineText)(t.text,r+a/2,i+o/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`)}`+`
58
- </g>`}var K={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function fa(e,t={}){return e.horizontal?ma(e):pa(e)}function pa(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=Sa(s),l=Math.max(...c.map(e=>w(e,K.axisLabelFontSize,K.axisLabelFontWeight)),K.yLabelWidth),u=K.padding+(n?K.titleHeight:0)+(a?K.legendHeight:0),d=K.padding+K.xLabelHeight+(r?K.axisTitlePad:0),f=K.padding+l+K.yLabelGap+(i?K.axisTitlePad:0),p=K.padding,m=K.plotWidth,h=K.plotHeight,g=f+m+p,_=u+h+d,v={x:f,y:u,width:m,height:h},y=ha(t),b=e=>f+(e+.5)*(m/y),x=m/y,S=e=>{let t=(e-o.min)/(o.max-o.min||1);return u+h-t*h},C=ya(t,b,u+h,x),T=s.map((e,t)=>({label:c[t],x:f,y:S(e),tx:f-K.tickLength,ty:S(e),labelX:f-K.yLabelGap,labelY:S(e),textAnchor:`end`})),E=s.map(e=>({x1:f,y1:S(e),x2:f+m,y2:S(e)})),D=ga(t,y),O=t.series.map((e,t)=>t),k=ba(t,b,S,x,o.min,D,O),A=xa(t,b,S,D,O),ee=K.padding+(n?K.titleHeight:0)+K.legendHeight/2,j=a?wa(t,g/2,ee,O):[],M={x1:f,y1:u+h,x2:f+m,y2:u+h},N={x1:f,y1:u,x2:f,y2:u+h},P={ticks:C,line:M,...t.xAxis.title?{title:{text:t.xAxis.title,x:f+m/2,y:_-K.padding}}:{}},F={ticks:T,line:N,...t.yAxis.title?{title:{text:t.yAxis.title,x:K.padding+4,y:u+h/2,rotate:-90}}:{}};return{width:g,height:_,title:t.title?{text:t.title,x:g/2,y:K.padding+K.titleFontSize}:void 0,xAxis:P,yAxis:F,plotArea:v,bars:k,lines:A,gridLines:E,legend:j}}function ma(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=Sa(s),l=ha(t),u=ga(t,l),d=Math.max(...u.map(e=>w(e,K.axisLabelFontSize,K.axisLabelFontWeight)),40),f=K.padding+(n?K.titleHeight:0)+(a?K.legendHeight:0),p=K.padding+K.xLabelHeight+(i?K.axisTitlePad:0),m=K.padding+d+K.yLabelGap+(r?K.axisTitlePad:0),h=K.padding,g=K.plotWidth,_=K.plotHeight,v=m+g+h,y=f+_+p,b={x:m,y:f,width:g,height:_},x=e=>{let t=(e-o.min)/(o.max-o.min||1);return m+t*g},S=_/l,C=e=>f+(e+.5)*S,T=s.map((e,t)=>({label:c[t],x:x(e),y:f+_,tx:x(e),ty:f+_+K.tickLength,labelX:x(e),labelY:f+_+18,textAnchor:`middle`})),E=u.map((e,t)=>({label:e,x:m,y:C(t),tx:m-K.tickLength,ty:C(t),labelX:m-K.yLabelGap,labelY:C(t),textAnchor:`end`})),D=s.map(e=>({x1:x(e),y1:f,x2:x(e),y2:f+_})),O=t.series.map((e,t)=>t),k=t.series.filter(e=>e.type===`bar`).length,A=[];if(k>0){let e=S*(1-K.barPadRatio),n=k>1?(e-(k-1)*K.barGroupGap)/k:e,r=Math.min(n,K.maxBarWidth),i=k>1?r*k+K.barGroupGap*(k-1):r,a=0,s=0;for(let e of t.series){if(e.type!==`bar`){s++;continue}for(let t=0;t<e.data.length;t++){let n=C(t)-i/2+a*(r+K.barGroupGap),c=x(Math.max(e.data[t],o.min)),l=x(Math.max(0,o.min));A.push({x:Math.min(l,c),y:n,width:Math.abs(c-l),height:r,value:e.data[t],label:u[t],seriesIndex:a,colorIndex:O[s]})}a++,s++}}let ee=[],j=0,M=0;for(let e of t.series){if(e.type!==`line`){M++;continue}let t=e.data.map((e,t)=>({x:x(e),y:C(t),value:e,label:u[t]}));ee.push({points:t,seriesIndex:j,colorIndex:O[M]}),j++,M++}let N={x1:m,y1:f+_,x2:m+g,y2:f+_},P={x1:m,y1:f,x2:m,y2:f+_},F={ticks:T,line:N,...t.yAxis.title?{title:{text:t.yAxis.title,x:m+g/2,y:y-K.padding}}:{}},I={ticks:E,line:P,...t.xAxis.title?{title:{text:t.xAxis.title,x:K.padding+4,y:f+_/2,rotate:-90}}:{}},L=t.title?{text:t.title,x:v/2,y:K.padding+K.titleFontSize}:void 0,R=K.padding+(n?K.titleHeight:0)+K.legendHeight/2;return{width:v,height:y,horizontal:!0,title:L,xAxis:F,yAxis:I,plotArea:b,bars:A,lines:ee,gridLines:D,legend:a?wa(t,v/2,R,O):[]}}function ha(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 ga(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)=>Ca(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var _a=8;function va(e,t){let n=e.map(e=>w(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<_a){i=!1;break}if(i)return r}return Math.max(1,e.length)}function ya(e,t,n,r){let i=ga(e,ha(e)),a=va(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 ba(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-K.barPadRatio),l=s>1?(c-(s-1)*K.barGroupGap)/s:c,u=Math.min(l,K.maxBarWidth),d=s>1?u*s+K.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+K.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function xa(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 Sa(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 Ca(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function wa(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=w(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 Ta(t,n,r=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...t.bars.map(e=>e.colorIndex),...t.lines.map(e=>e.colorIndex)),f=Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push((0,e.buildStyleBlock)(r,!1,l.nonce));let p=Math.max(...t.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Ea(t,a,m,n.accent,n.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=t,v=t.xAxis.ticks.map(e=>e.x),y=t.horizontal?t.yAxis.ticks.map(e=>e.y):t.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 e of t.bars){let n=` data-value="${e.value}"${e.label?` data-label="${X(e.label)}"`:``}`,r=t.horizontal?Oa(e.x,e.y,e.width,e.height,q.barRadius):Da(e.x,e.y,e.width,e.height,q.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${e.colorIndex}"${n}/>`),a){let t=Ma(e.value),n=e.label?`${e.label}: ${t}`:t,r=ja(e.x+e.width/2,e.y,t);O.push(`<g class="xychart-bar-group"><rect x="${Y(e.x)}" y="${Y(e.y)}" width="${Y(e.width)}" height="${Y(e.height)}" fill="transparent"/><title>${X(n)}</title>`+r+`</g>`)}}for(let e of t.lines){if(e.points.length===0)continue;let t=ka(e.points);u.push(`<path d="${t}" class="xychart-line-shadow xychart-color-${e.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${t}" class="xychart-line xychart-color-${e.colorIndex}"/>`)}let k=[];if(a||m){let e=new Map;for(let n of t.legend)n.type===`line`&&e.set(n.seriesIndex,n.label);let n=new Map;for(let e of t.lines)for(let t of e.points){let r=Y(t.x),i=n.get(r)??[];n.set(r,i),i.push({x:t.x,y:t.y,value:t.value,label:t.label,seriesIndex:e.seriesIndex,colorIndex:e.colorIndex})}for(let t of n.values()){let n=t[0].x,r=t[0].label||``;if(a&&t.length>1){let i=Math.min(...t.map(e=>e.y)),a=Math.max(...t.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=t.map(t=>({text:Ma(t.value),legendLabel:e.get(t.seriesIndex)||`Line ${t.seriesIndex+1}`})),l=Aa(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 e of t){let t=` data-value="${e.value}"${e.label?` data-label="${X(e.label)}"`:``}`;f+=`<circle cx="${Y(e.x)}" cy="${Y(e.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`}f+=`<title>${X(d)}</title>${l}</g>`,k.push(f)}else if(a){let e=t[0],r=` data-value="${e.value}"${e.label?` data-label="${X(e.label)}"`:``}`,i=Ma(e.value),a=e.label?`${e.label}: ${i}`:i,o=ja(n,e.y-q.dotRadius,i),s=m?`<circle cx="${Y(n)}" cy="${Y(e.y)}" r="${q.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${Y(e.x)}" cy="${Y(e.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${r}/><title>${X(a)}</title>${o}</g>`)}else for(let e of t){let t=` data-value="${e.value}"${e.label?` data-label="${X(e.label)}"`:``}`;u.push(`<circle cx="${Y(e.x)}" cy="${Y(e.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`)}}}for(let e of t.xAxis.ticks)e.label!==``&&u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${N}" class="xychart-label">${X(e.label)}</text>`);for(let e of t.yAxis.ticks)u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${N}" class="xychart-label">${X(e.label)}</text>`);if(t.xAxis.title){let e=t.xAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${N}" class="xychart-axis-title">${X(e.text)}</text>`)}if(t.yAxis.title){let e=t.yAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${N}" class="xychart-axis-title">${X(e.text)}</text>`)}t.title&&u.push(`<text x="${t.title.x}" y="${t.title.y}" text-anchor="middle" font-size="${q.titleSize}" font-weight="${q.titleWeight}" dy="${N}" class="xychart-title">${X(t.title.text)}</text>`);for(let e of t.legend){if(e.type===`bar`)u.push(`<rect x="${e.x}" y="${e.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${e.colorIndex}"/>`);else{let t=e.y;u.push(`<line x1="${e.x}" y1="${t}" x2="${e.x+14}" y2="${t}" stroke-width="${q.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${e.colorIndex}"/>`)}u.push(`<text x="${e.x+14+6}" y="${e.y}" text-anchor="start" font-size="${q.legendSize}" font-weight="${q.legendWeight}" dy="${N}" class="xychart-label">${X(e.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
59
- `)}function Ea(n,r,i,a,o,s){let c=a??t.CHART_ACCENT_FALLBACK,l=new Set;for(let e of n.bars)l.add(e.colorIndex);for(let e of n.lines)l.add(e.colorIndex);let u=[];for(let e of[...l].sort((e,t)=>e-t)){let n=e===0?`var(--accent, ${t.CHART_ACCENT_FALLBACK})`:(0,t.getSeriesColor)(e,c,o);u.push(` --xychart-color-${e}: ${n};`),u.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let d=[];for(let e of[...l].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;d.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),d.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),d.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let f=r?`
49
+ </marker>`}var Ki={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 qi(t,n){let{id:r,x:i,y:a,width:o,height:s,label:c,type:l,participantType:u}=t,d=[],f=e.f`font-size="${n.nodeLabel}" text-anchor="middle" font-weight="${A.nodeLabel}" fill="var(--_text)"`;if(d.push(e.f`<g class="actor" data-id="${(0,e.escapeAttr)(r)}" data-label="${(0,e.escapeAttr)(c)}" data-type="${l}">`),l===`actor`){let t=s/24*.9,r=i-12*t,o=a+(s-24*t)/2,l=M.outerBox/t,u=`var(--_line)`;d.push(e.f` <g transform="translate(${r},${o}) scale(${t})">`+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="${u}" stroke-width="${l}" />`+e.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="${u}" stroke-width="${l}" />`+e.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="${u}" stroke-width="${l}" />`+`
50
+ </g>`),d.push(` `+(0,e.renderMultilineText)(c,i,a+s+14,n.nodeLabel,f))}else if(zi(t)){let t=s/24*.9,r=M.outerBox/t,o=e.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${r}"`,l=e.f`fill="none" stroke="var(--_node-stroke)" stroke-width="${r}"`,p=Ki[u](o,l);d.push(e.f` <g transform="translate(${i-12*t},${a+(s-24*t)/2}) scale(${t})">${p}\n </g>`),d.push(` `+(0,e.renderMultilineText)(c,i,a+s+14,n.nodeLabel,f))}else{let t=i-o/2,r=e.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}"`,l=i,p=a+s/2;if(u===`queue`){let n=s/2,i=t+8,c=t+o-8;d.push(e.f` <path d="M${i},${a}H${c}A${8},${n} 0 0 1 ${c},${a+s}H${i}A${8},${n} 0 0 1 ${i},${a}Z" ${r} />`,e.f` <path d="M${c},${a}A${8},${n} 0 0 0 ${c},${a+s}" fill="none" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}" />`)}else u===`collections`?(d.push(e.f` <rect x="${t+4}" y="${a}" width="${o-4}" height="${s-4}" rx="4" ry="4" ${r} />`,e.f` <rect x="${t}" y="${a+4}" width="${o-4}" height="${s-4}" rx="4" ry="4" ${r} />`),l=i-2,p=a+2+(s-4)/2):d.push(e.f` <rect x="${t}" y="${a}" width="${o}" height="${s}" rx="4" ry="4" ${r} />`);d.push(` `+(0,e.renderMultilineText)(c,l,p,n.nodeLabel,f))}return d.push(`</g>`),d.join(`
51
+ `)}var Ji=30,Yi=20,Xi=8,Zi=10,Qi=18,$i=3,ea=2,ta=3;function na(t,n){let r=[],i=t=>(0,e.measureMultilineText)(t,n.edgeLabel,A.edgeLabel),a=(e,t,n)=>{let a=i(e);r.push({x0:t-a.width/2,x1:t+a.width/2,y0:n-a.height/2,y1:n+a.height/2})},o=(e,t,n)=>{let a=i(e);r.push({x0:t,x1:t+a.width,y0:n-a.height/2,y1:n+a.height/2})};for(let e of t.messages)e.label&&(e.isSelf?o(e.label,e.x1+Ji+Xi,e.y+Yi/2):a(e.label,(e.x1+e.x2)/2,e.y-Zi));for(let e of t.blocks){if(da(e))continue;let t=w(`${e.type}${e.label?` [${e.label}]`:``}`.split(`
52
+ `)[0]??``,n.edgeLabel,A.groupHeader)+16;r.push({x0:e.x,x1:e.x+t,y0:e.y,y1:e.y+Qi});for(let t of e.dividers)t.label&&o(`[${t.label}]`,e.x+8,t.y+14)}return r}function ra(e,t){let n=t.filter(t=>e.x>t.x0-$i&&e.x<t.x1+$i&&t.y1+ea>e.topY&&t.y0-ea<e.bottomY).map(e=>[e.y0-ea,e.y1+ea]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=ta&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=ta&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function ia(t,n){let r=ra(t,n).map(([n,r])=>e.f`<line class="lifeline" data-actor="${(0,e.escapeAttr)(t.actorId)}" `+e.f`x1="${t.x}" y1="${n}" x2="${t.x}" y2="${r}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
53
+ `);if(!t.destroyed)return r;let{x:i,bottomY:a}=t,o=aa;return r+e.f`\n<path class="destroy" data-actor="${(0,e.escapeAttr)(t.actorId)}" `+e.f`d="M${i-o} ${a-o} L${i+o} ${a+o} M${i+o} ${a-o} L${i-o} ${a+o}" `+e.f`fill="none" stroke="var(--_line)" stroke-width="${M.outerBox}" stroke-linecap="round" />`}var aa=8;function oa(t){return e.f`<rect class="activation" data-actor="${(0,e.escapeAttr)(t.actorId)}" `+e.f`x="${t.x}" y="${t.topY}" width="${t.width}" height="${t.bottomY-t.topY}" `+e.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`}function sa(t,n){let r=[],i=t.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,a=t.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,o=t.bidirectional?e.f` marker-start="url(#${a})"`:``;if(r.push(e.f`<g class="message" data-from="${(0,e.escapeAttr)(t.from)}" data-to="${(0,e.escapeAttr)(t.to)}" `+e.f`data-label="${(0,e.escapeAttr)(t.label)}" data-line-style="${t.lineStyle}" `+e.f`data-arrow-head="${t.arrowHead}" data-self="${t.isSelf}" data-bidirectional="${t.bidirectional}">`),t.isSelf){let s=Ji,c=Yi,l=Xi;r.push(e.f` <polyline points="${t.x1},${t.y} ${t.x1+s},${t.y} ${t.x1+s},${t.y+c} ${t.x2},${t.y+c}" `+e.f`fill="none" stroke="var(--_line)" stroke-width="${M.connector}"${i} marker-end="url(#${a})"${o} />`),r.push(` `+(0,e.renderMultilineText)(t.label,t.x1+s+l,t.y+c/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="start" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`))}else{r.push(e.f` <line x1="${t.x1}" y1="${t.y}" x2="${t.x2}" y2="${t.y}" `+e.f`stroke="var(--_line)" stroke-width="${M.connector}"${i} marker-end="url(#${a})"${o} />`);let s=(t.x1+t.x2)/2;r.push(` `+(0,e.renderMultilineText)(t.label,s,t.y-Zi,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`))}return t.seqNumber!==void 0&&r.push(` `+ca(t,n)),r.push(`</g>`),r.join(`
54
+ `)}function ca(t,n){let r=Math.max(n.edgeLabel-2,8),i=t.bidirectional?t.x1+Math.sign(t.x2-t.x1)*(8+P.width):t.x1;return`<g class="seq-number">`+e.f`<circle cx="${i}" cy="${t.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${M.innerBox}" />`+(0,e.renderMultilineText)(String(t.seqNumber),i,t.y,r,e.f`font-size="${r}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var la=35;function ua(t,n){let r=t.label?e.f` data-label="${(0,e.escapeAttr)(t.label)}"`:``,i=t.color===void 0?``:e.f` data-color="${(0,e.escapeAttr)(t.color)}"`,a=t.color===void 0?`none`:e.f`color-mix(in srgb, ${(0,e.escapeAttr)(t.color)} ${la}%, var(--bg))`,o=[e.f`<g class="participant-box"${r}${i}>`,e.f` <rect x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" rx="4" ry="4" `+e.f`fill="${a}" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`];return t.label&&o.push(` `+(0,e.renderMultilineText)(t.label,t.x+t.width/2,t.y+Ii(n.edgeLabel)/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.groupHeader}" fill="var(--_text-sec)"`)),o.push(`</g>`),o.join(`
55
+ `)}function da(e){return e.type===`rect`&&e.color!==void 0}function fa(t,n){let r=[];if(da(t))return[e.f`<g class="block" data-type="rect" data-color="${(0,e.escapeAttr)(t.color)}">`,e.f` <rect x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" `+e.f`fill="${(0,e.escapeAttr)(t.color)}" />`,`</g>`].join(`
56
+ `);let i=t.label?e.f` data-label="${(0,e.escapeAttr)(t.label)}"`:``;r.push(e.f`<g class="block" data-type="${(0,e.escapeAttr)(t.type)}"${i}>`),r.push(e.f` <rect x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" `+e.f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}" />`);let a=e.f`${t.type}${t.label?e.f` [${t.label}]`:``}`,o=a.split(`
57
+ `)[0],s=w(o,n.edgeLabel,A.groupHeader)+16,c=Qi;r.push(e.f` <rect x="${t.x}" y="${t.y}" width="${s}" height="${c}" `+e.f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${M.outerBox}" />`),r.push(` `+(0,e.renderMultilineText)(a,t.x+6,t.y+c/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" font-weight="${A.groupHeader}" fill="var(--_text-sec)"`));for(let i of t.dividers)r.push(e.f` <line x1="${t.x}" y1="${i.y}" x2="${t.x+t.width}" y2="${i.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),i.label&&r.push(` `+(0,e.renderMultilineText)(e.f`[${i.label}]`,t.x+8,i.y+14,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="start" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`));return r.push(`</g>`),r.join(`
58
+ `)}function pa(t,n){let{x:r,y:i,width:a,height:o}=t,s=t.actors&&t.actors.length>0?e.f` data-actors="${t.actors.map(e.escapeAttr).join(`,`)}"`:``,c=t.position?e.f` data-position="${(0,e.escapeAttr)(t.position)}"`:``,l=[e.f`${r},${i}`,e.f`${r+a-6},${i}`,e.f`${r+a},${i+6}`,e.f`${r+a},${i+o}`,e.f`${r},${i+o}`].join(` `);return e.f`<g class="note"${c}${s}>`+e.f`\n <polygon points="${l}" `+e.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`+e.f`\n <polygon points="${r+a-6},${i} ${r+a},${i+6} ${r+a-6},${i+6}" `+e.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${M.innerBox}" />`+e.f`\n ${(0,e.renderMultilineText)(t.text,r+a/2,i+o/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${A.edgeLabel}" fill="var(--_text-muted)"`)}`+`
59
+ </g>`}var G={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function ma(e,t={}){return e.horizontal?ga(e):ha(e)}function ha(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=wa(s),l=Math.max(...c.map(e=>w(e,G.axisLabelFontSize,G.axisLabelFontWeight)),G.yLabelWidth),u=G.padding+(n?G.titleHeight:0)+(a?G.legendHeight:0),d=G.padding+G.xLabelHeight+(r?G.axisTitlePad:0),f=G.padding+l+G.yLabelGap+(i?G.axisTitlePad:0),p=G.padding,m=G.plotWidth,h=G.plotHeight,g=f+m+p,_=u+h+d,v={x:f,y:u,width:m,height:h},y=_a(t),b=e=>f+(e+.5)*(m/y),x=m/y,S=e=>{let t=(e-o.min)/(o.max-o.min||1);return u+h-t*h},C=xa(t,b,u+h,x),T=s.map((e,t)=>({label:c[t],x:f,y:S(e),tx:f-G.tickLength,ty:S(e),labelX:f-G.yLabelGap,labelY:S(e),textAnchor:`end`})),E=s.map(e=>({x1:f,y1:S(e),x2:f+m,y2:S(e)})),D=va(t,y),O=t.series.map((e,t)=>t),k=Sa(t,b,S,x,o.min,D,O),A=Ca(t,b,S,D,O),ee=G.padding+(n?G.titleHeight:0)+G.legendHeight/2,j=a?Ea(t,g/2,ee,O):[],M={x1:f,y1:u+h,x2:f+m,y2:u+h},N={x1:f,y1:u,x2:f,y2:u+h},P={ticks:C,line:M,...t.xAxis.title?{title:{text:t.xAxis.title,x:f+m/2,y:_-G.padding}}:{}},F={ticks:T,line:N,...t.yAxis.title?{title:{text:t.yAxis.title,x:G.padding+4,y:u+h/2,rotate:-90}}:{}};return{width:g,height:_,title:t.title?{text:t.title,x:g/2,y:G.padding+G.titleFontSize}:void 0,xAxis:P,yAxis:F,plotArea:v,bars:k,lines:A,gridLines:E,legend:j}}function ga(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=wa(s),l=_a(t),u=va(t,l),d=Math.max(...u.map(e=>w(e,G.axisLabelFontSize,G.axisLabelFontWeight)),40),f=G.padding+(n?G.titleHeight:0)+(a?G.legendHeight:0),p=G.padding+G.xLabelHeight+(i?G.axisTitlePad:0),m=G.padding+d+G.yLabelGap+(r?G.axisTitlePad:0),h=G.padding,g=G.plotWidth,_=G.plotHeight,v=m+g+h,y=f+_+p,b={x:m,y:f,width:g,height:_},x=e=>{let t=(e-o.min)/(o.max-o.min||1);return m+t*g},S=_/l,C=e=>f+(e+.5)*S,T=s.map((e,t)=>({label:c[t],x:x(e),y:f+_,tx:x(e),ty:f+_+G.tickLength,labelX:x(e),labelY:f+_+18,textAnchor:`middle`})),E=u.map((e,t)=>({label:e,x:m,y:C(t),tx:m-G.tickLength,ty:C(t),labelX:m-G.yLabelGap,labelY:C(t),textAnchor:`end`})),D=s.map(e=>({x1:x(e),y1:f,x2:x(e),y2:f+_})),O=t.series.map((e,t)=>t),k=t.series.filter(e=>e.type===`bar`).length,A=[];if(k>0){let e=S*(1-G.barPadRatio),n=k>1?(e-(k-1)*G.barGroupGap)/k:e,r=Math.min(n,G.maxBarWidth),i=k>1?r*k+G.barGroupGap*(k-1):r,a=0,s=0;for(let e of t.series){if(e.type!==`bar`){s++;continue}for(let t=0;t<e.data.length;t++){let n=C(t)-i/2+a*(r+G.barGroupGap),c=x(Math.max(e.data[t],o.min)),l=x(Math.max(0,o.min));A.push({x:Math.min(l,c),y:n,width:Math.abs(c-l),height:r,value:e.data[t],label:u[t],seriesIndex:a,colorIndex:O[s]})}a++,s++}}let ee=[],j=0,M=0;for(let e of t.series){if(e.type!==`line`){M++;continue}let t=e.data.map((e,t)=>({x:x(e),y:C(t),value:e,label:u[t]}));ee.push({points:t,seriesIndex:j,colorIndex:O[M]}),j++,M++}let N={x1:m,y1:f+_,x2:m+g,y2:f+_},P={x1:m,y1:f,x2:m,y2:f+_},F={ticks:T,line:N,...t.yAxis.title?{title:{text:t.yAxis.title,x:m+g/2,y:y-G.padding}}:{}},I={ticks:E,line:P,...t.xAxis.title?{title:{text:t.xAxis.title,x:G.padding+4,y:f+_/2,rotate:-90}}:{}},L=t.title?{text:t.title,x:v/2,y:G.padding+G.titleFontSize}:void 0,R=G.padding+(n?G.titleHeight:0)+G.legendHeight/2;return{width:v,height:y,horizontal:!0,title:L,xAxis:F,yAxis:I,plotArea:b,bars:A,lines:ee,gridLines:D,legend:a?Ea(t,v/2,R,O):[]}}function _a(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 va(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)=>Ta(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var ya=8;function ba(e,t){let n=e.map(e=>w(e,G.axisLabelFontSize,G.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<ya){i=!1;break}if(i)return r}return Math.max(1,e.length)}function xa(e,t,n,r){let i=va(e,_a(e)),a=ba(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+G.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function Sa(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-G.barPadRatio),l=s>1?(c-(s-1)*G.barGroupGap)/s:c,u=Math.min(l,G.maxBarWidth),d=s>1?u*s+G.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+G.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function Ca(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 wa(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 Ta(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Ea(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=w(e.label,G.legendFontSize,G.legendFontWeight);return G.legendSwatchW+G.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*G.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+G.legendItemGap;return i}var K={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},q={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function Da(t,n,r=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...t.bars.map(e=>e.colorIndex),...t.lines.map(e=>e.colorIndex)),f=Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push((0,e.buildStyleBlock)(r,!1,l.nonce));let p=Math.max(...t.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Oa(t,a,m,n.accent,n.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=t,v=t.xAxis.ticks.map(e=>e.x),y=t.horizontal?t.yAxis.ticks.map(e=>e.y):t.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="${J(t)}" cy="${J(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let e of t.bars){let n=` data-value="${e.value}"${e.label?` data-label="${Y(e.label)}"`:``}`,r=t.horizontal?Aa(e.x,e.y,e.width,e.height,K.barRadius):ka(e.x,e.y,e.width,e.height,K.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${e.colorIndex}"${n}/>`),a){let t=Pa(e.value),n=e.label?`${e.label}: ${t}`:t,r=Na(e.x+e.width/2,e.y,t);O.push(`<g class="xychart-bar-group"><rect x="${J(e.x)}" y="${J(e.y)}" width="${J(e.width)}" height="${J(e.height)}" fill="transparent"/><title>${Y(n)}</title>`+r+`</g>`)}}for(let e of t.lines){if(e.points.length===0)continue;let t=ja(e.points);u.push(`<path d="${t}" class="xychart-line-shadow xychart-color-${e.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${t}" class="xychart-line xychart-color-${e.colorIndex}"/>`)}let k=[];if(a||m){let e=new Map;for(let n of t.legend)n.type===`line`&&e.set(n.seriesIndex,n.label);let n=new Map;for(let e of t.lines)for(let t of e.points){let r=J(t.x),i=n.get(r)??[];n.set(r,i),i.push({x:t.x,y:t.y,value:t.value,label:t.label,seriesIndex:e.seriesIndex,colorIndex:e.colorIndex})}for(let t of n.values()){let n=t[0].x,r=t[0].label||``;if(a&&t.length>1){let i=Math.min(...t.map(e=>e.y)),a=Math.max(...t.map(e=>e.y)),o=K.dotRadius*3,s=`<rect x="${J(n-o)}" y="${J(i-o)}" width="${J(o*2)}" height="${J(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=t.map(t=>({text:Pa(t.value),legendLabel:e.get(t.seriesIndex)||`Line ${t.seriesIndex+1}`})),l=Ma(n,i-K.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 e of t){let t=` data-value="${e.value}"${e.label?` data-label="${Y(e.label)}"`:``}`;f+=`<circle cx="${J(e.x)}" cy="${J(e.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`}f+=`<title>${Y(d)}</title>${l}</g>`,k.push(f)}else if(a){let e=t[0],r=` data-value="${e.value}"${e.label?` data-label="${Y(e.label)}"`:``}`,i=Pa(e.value),a=e.label?`${e.label}: ${i}`:i,o=Na(n,e.y-K.dotRadius,i),s=m?`<circle cx="${J(n)}" cy="${J(e.y)}" r="${K.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${J(e.x)}" cy="${J(e.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${r}/><title>${Y(a)}</title>${o}</g>`)}else for(let e of t){let t=` data-value="${e.value}"${e.label?` data-label="${Y(e.label)}"`:``}`;u.push(`<circle cx="${J(e.x)}" cy="${J(e.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`)}}}for(let e of t.xAxis.ticks)e.label!==``&&u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${N}" class="xychart-label">${Y(e.label)}</text>`);for(let e of t.yAxis.ticks)u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${N}" class="xychart-label">${Y(e.label)}</text>`);if(t.xAxis.title){let e=t.xAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${N}" class="xychart-axis-title">${Y(e.text)}</text>`)}if(t.yAxis.title){let e=t.yAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${N}" class="xychart-axis-title">${Y(e.text)}</text>`)}t.title&&u.push(`<text x="${t.title.x}" y="${t.title.y}" text-anchor="middle" font-size="${K.titleSize}" font-weight="${K.titleWeight}" dy="${N}" class="xychart-title">${Y(t.title.text)}</text>`);for(let e of t.legend){if(e.type===`bar`)u.push(`<rect x="${e.x}" y="${e.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${e.colorIndex}"/>`);else{let t=e.y;u.push(`<line x1="${e.x}" y1="${t}" x2="${e.x+14}" y2="${t}" stroke-width="${K.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${e.colorIndex}"/>`)}u.push(`<text x="${e.x+14+6}" y="${e.y}" text-anchor="start" font-size="${K.legendSize}" font-weight="${K.legendWeight}" dy="${N}" class="xychart-label">${Y(e.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
60
+ `)}function Oa(n,r,i,a,o,s){let c=a??t.CHART_ACCENT_FALLBACK,l=new Set;for(let e of n.bars)l.add(e.colorIndex);for(let e of n.lines)l.add(e.colorIndex);let u=[];for(let e of[...l].sort((e,t)=>e-t)){let n=e===0?`var(--accent, ${t.CHART_ACCENT_FALLBACK})`:(0,t.getSeriesColor)(e,c,o);u.push(` --xychart-color-${e}: ${n};`),u.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let d=[];for(let e of[...l].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;d.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),d.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),d.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let f=r?`
60
61
  .xychart-tip { opacity: 0; pointer-events: none; }
61
62
  .xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
62
- .xychart-tip-text { fill: var(--bg); font-size: ${J.fontSize}px; font-weight: ${J.fontWeight}; }
63
+ .xychart-tip-text { fill: var(--bg); font-size: ${q.fontSize}px; font-weight: ${q.fontWeight}; }
63
64
  .xychart-tip-ptr { fill: var(--_text); }
64
65
  .xychart-bar-group:hover .xychart-tip,
65
66
  .xychart-dot-group:hover .xychart-tip { opacity: 1; }`:``,p=u.length>0?`\n svg {\n${u.join(`
66
67
  `)}\n }`:``;return{style:`${(0,e.styleOpenTag)(s)}
67
68
  .xychart-grid { fill: var(--_inner-stroke); stroke: none; opacity: 0.65; }
68
69
  .xychart-bar { stroke-width: 1.5; }
69
- .xychart-line { fill: none; stroke-width: ${q.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
70
+ .xychart-line { fill: none; stroke-width: ${K.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
70
71
  .xychart-line-shadow { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.12; }
71
72
  .xychart-dot { stroke: var(--bg); stroke-width: 2; }
72
73
  .xychart-label { fill: var(--_text-muted); }
@@ -74,23 +75,23 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
74
75
  .xychart-title { fill: var(--_text); }${p}
75
76
  ${d.join(`
76
77
  `)}${f}
77
- </style>`,defs:``}}function Da(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`Z`].join(` `)}function Oa(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z`:[`M${Y(e+a)},${Y(t)}`,`L${Y(e+n-a)},${Y(t)}`,`Q${Y(e+n)},${Y(t)} ${Y(e+n)},${Y(t+a)}`,`L${Y(e+n)},${Y(t+r-a)}`,`Q${Y(e+n)},${Y(t+r)} ${Y(e+n-a)},${Y(t+r)}`,`L${Y(e+a)},${Y(t+r)}`,`Q${Y(e)},${Y(t+r)} ${Y(e)},${Y(t+r-a)}`,`L${Y(e)},${Y(t+a)}`,`Q${Y(e)},${Y(t)} ${Y(e+a)},${Y(t)}`,`Z`].join(` `)}function ka(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 Aa(e,t,n,r){let i=w(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=w(e.legendLabel,J.fontSize,J.fontWeight),n=w(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="${N}" 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="${N}" 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="${N}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function ja(e,t,n){let r=w(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="${N}" class="xychart-tip xychart-tip-text">${X(n)}</text>`}function Ma(e){return Number.isInteger(e)?e.toLocaleString(`en-US`):e.toFixed(+(Math.abs(e)<10))}function Y(e){return String(Math.round(e*10)/10)}function X(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var Z={height:450,margin:40,legendRectSize:18,legendSpacing:4,textPosition:.75,outerStrokeWidth:2,titleFontSize:25,sectionFontSize:17,legendFontSize:17,fontWeight:400,paletteSize:12,highlightScale:1.05,minPercent:1},Na=Math.PI*2;function Q(e){return String(Math.round(e*100)/100)}function Pa(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function Fa(e,t,n,r,i,a=0){if(i-r>=Na-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=Pa(e,t,n,r),s=Pa(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=Pa(e,t,a,i),d=Pa(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 Ia(e,t,n){return n?`${e} [${String(t)}]`:e}function La(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=>Ia(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>w(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,T=f===`top`||f===`bottom`?n+g:n,E=e.title??``,D=E.length>0?w(E,Z.titleFontSize,Z.fontWeight):0,O=a-D/2,k=a+D/2,A=x.x,ee=x.x+S,j=x.y,M=x.y+g-u+Z.legendRectSize,N=Math.min(0,O,d>0?A:0),P=Math.max(C,k,d>0?ee:0),F=d>0?Math.min(0,j):0,I=d>0?Math.max(T,M):n,L=-N,R=-F,z=a+_+L,B=o+v+R,te=[],ne=0,re=e.donutHole??0,ie=re>0&&re<=.9?re*i:0,ae=i*(e.textPosition??Z.textPosition);for(let{slice:t,colorIndex:n}of c){let r=ne,a=ne+t.value/l*Na;ne=a;let o=Pa(z,B,ae,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?Z.highlightScale:1;te.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:Fa(z,B,i*u,r,a,ie*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let oe=p.map((e,t)=>{let n=x.x+L,r=x.y+t*u+R;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(P-N),height:Math.ceil(I-F),cx:z,cy:B,radius:i,outerRadius:i+Z.outerStrokeWidth/2,title:E.length>0?{text:E,x:a+L,y:o+R-(n-50)/2}:void 0,slices:te,legend:oe,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function Ra(e){return String(Math.round(e*100)/100)}function za(e,n,r){return e===0?`var(--accent, ${t.CHART_ACCENT_FALLBACK})`:(0,t.getSeriesColor)(e,n??t.CHART_ACCENT_FALLBACK,r)}function Ba(t,n,r){let i=new Set;for(let e of t.slices)i.add(e.colorIndex);for(let e of t.legend)i.add(e.colorIndex);let a=[...i].sort((e,t)=>e-t),o=a.map(e=>` --pie-color-${e}: ${t.sliceColors?.[e]??za(e,n.accent,n.bg)};`),s=a.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),c=t.slices.some(e=>e.highlighted)?`
78
+ </style>`,defs:``}}function ka(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${J(e)},${J(t)} h${J(n)} v${J(r)} h${J(-n)} Z`:[`M${J(e)},${J(t+a)}`,`Q${J(e)},${J(t)} ${J(e+a)},${J(t)}`,`L${J(e+n-a)},${J(t)}`,`Q${J(e+n)},${J(t)} ${J(e+n)},${J(t+a)}`,`L${J(e+n)},${J(t+r-a)}`,`Q${J(e+n)},${J(t+r)} ${J(e+n-a)},${J(t+r)}`,`L${J(e+a)},${J(t+r)}`,`Q${J(e)},${J(t+r)} ${J(e)},${J(t+r-a)}`,`Z`].join(` `)}function Aa(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${J(e)},${J(t)} h${J(n)} v${J(r)} h${J(-n)} Z`:[`M${J(e+a)},${J(t)}`,`L${J(e+n-a)},${J(t)}`,`Q${J(e+n)},${J(t)} ${J(e+n)},${J(t+a)}`,`L${J(e+n)},${J(t+r-a)}`,`Q${J(e+n)},${J(t+r)} ${J(e+n-a)},${J(t+r)}`,`L${J(e+a)},${J(t+r)}`,`Q${J(e)},${J(t+r)} ${J(e)},${J(t+r-a)}`,`L${J(e)},${J(t+a)}`,`Q${J(e)},${J(t)} ${J(e+a)},${J(t)}`,`Z`].join(` `)}function ja(e){if(e.length===0)return``;if(e.length===1)return`M${J(e[0].x)},${J(e[0].y)}`;if(e.length===2)return`M${J(e[0].x)},${J(e[0].y)} L${J(e[1].x)},${J(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${J(e[0].x)},${J(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${J(a)},${J(s)} ${J(c)},${J(l)} ${J(e[r+1].x)},${J(e[r+1].y)}`}return o}function Ma(e,t,n,r){let i=w(n,q.fontSize,600),a=Math.max(...r.map(e=>{let t=w(e.legendLabel,q.fontSize,q.fontWeight),n=w(e.text,q.fontSize,q.fontWeight);return t+10+n})),o=Math.max(i,a)+q.padX*2,s=26+r.length*20+6,c=Math.max(q.minY,t-q.offsetY-s-q.pointerSize),l=e-o/2,u=e,d=c+s,f=q.pointerSize,p=`<polygon points="${J(u-f)},${J(d)} ${J(u+f)},${J(d)} ${J(u)},${J(d+f)}" class="xychart-tip xychart-tip-ptr"/>`,m=`<rect x="${J(l)}" y="${J(c)}" width="${J(o)}" height="${s}" rx="${q.rx}" class="xychart-tip xychart-tip-bg"/>`;m+=p;let h=c+6+10;m+=`<text x="${J(e)}" y="${J(h)}" text-anchor="middle" font-weight="600" font-size="${q.fontSize}" dy="${N}" class="xychart-tip xychart-tip-text">${Y(n)}</text>`;let g=l+q.padX,_=l+o-q.padX;for(let e of r)h+=20,m+=`<text x="${J(g)}" y="${J(h)}" text-anchor="start" font-size="${q.fontSize}" font-weight="${q.fontWeight}" dy="${N}" class="xychart-tip xychart-tip-text">${Y(e.legendLabel)}</text>`,m+=`<text x="${J(_)}" y="${J(h)}" text-anchor="end" font-size="${q.fontSize}" font-weight="${q.fontWeight}" dy="${N}" class="xychart-tip xychart-tip-text">${Y(e.text)}</text>`;return m}function Na(e,t,n){let r=w(n,q.fontSize,q.fontWeight)+q.padX*2,i=q.height,a=Math.max(q.minY,t-q.offsetY-i-q.pointerSize),o=e-r/2,s=e,c=a+i/2,l=e,u=a+i,d=q.pointerSize,f=`<polygon points="${J(l-d)},${J(u)} ${J(l+d)},${J(u)} ${J(l)},${J(u+d)}" class="xychart-tip xychart-tip-ptr"/>`;return`<rect x="${J(o)}" y="${J(a)}" width="${J(r)}" height="${i}" rx="${q.rx}" class="xychart-tip xychart-tip-bg"/>`+f+`<text x="${J(s)}" y="${J(c)}" text-anchor="middle" dy="${N}" class="xychart-tip xychart-tip-text">${Y(n)}</text>`}function Pa(e){return Number.isInteger(e)?e.toLocaleString(`en-US`):e.toFixed(+(Math.abs(e)<10))}function J(e){return String(Math.round(e*10)/10)}function Y(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var X={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},Fa=Math.PI*2;function Z(e){return String(Math.round(e*100)/100)}function Ia(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function La(e,t,n,r,i,a=0){if(i-r>=Fa-1e-9){let r=(n,r)=>`M${Z(e)},${Z(t-n)}A${Z(n)},${Z(n)},0,1,${r},${Z(e)},${Z(t+n)}A${Z(n)},${Z(n)},0,1,${r},${Z(e)},${Z(t-n)}`;return r(n,1)+(a>0?r(a,0):``)+`Z`}let o=Ia(e,t,n,r),s=Ia(e,t,n,i),c=+(i-r>Math.PI),l=`M${Z(o.x)},${Z(o.y)}A${Z(n)},${Z(n)},0,${c},1,${Z(s.x)},${Z(s.y)}`;if(a<=0)return`${l}L${Z(e)},${Z(t)}Z`;let u=Ia(e,t,a,i),d=Ia(e,t,a,r);return`${l}L${Z(u.x)},${Z(u.y)}A${Z(a)},${Z(a)},0,${c},0,${Z(d.x)},${Z(d.y)}Z`}function Ra(e,t,n){return n?`${e} [${String(t)}]`:e}function za(e,t={}){let n=X.height,r=n,i=Math.min(r,n)/2-X.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%X.paletteSize})).filter(({slice:e})=>e.value/s*100>=X.minPercent),l=c.reduce((e,t)=>e+t.slice.value,0),u=X.legendRectSize+X.legendSpacing,d=e.slices.length,f=d>0?e.legendPosition??`right`:`right`,p=e.slices.map(t=>Ra(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>w(e,X.legendFontSize,X.fontWeight))),h=X.legendRectSize+X.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*X.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+X.margin+S:r+X.margin,T=f===`top`||f===`bottom`?n+g:n,E=e.title??``,D=E.length>0?w(E,X.titleFontSize,X.fontWeight):0,O=a-D/2,k=a+D/2,A=x.x,ee=x.x+S,j=x.y,M=x.y+g-u+X.legendRectSize,N=Math.min(0,O,d>0?A:0),P=Math.max(C,k,d>0?ee:0),F=d>0?Math.min(0,j):0,I=d>0?Math.max(T,M):n,L=-N,R=-F,z=a+_+L,B=o+v+R,te=[],ne=0,re=e.donutHole??0,ie=re>0&&re<=.9?re*i:0,ae=i*(e.textPosition??X.textPosition);for(let{slice:t,colorIndex:n}of c){let r=ne,a=ne+t.value/l*Fa;ne=a;let o=Ia(z,B,ae,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?X.highlightScale:1;te.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:La(z,B,i*u,r,a,ie*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let oe=p.map((e,t)=>{let n=x.x+L,r=x.y+t*u+R;return{text:e,colorIndex:t%X.paletteSize,x:n,y:r,size:X.legendRectSize,textX:n+X.legendRectSize+X.legendSpacing,textY:r+X.legendRectSize-X.legendSpacing}});return{width:Math.ceil(P-N),height:Math.ceil(I-F),cx:z,cy:B,radius:i,outerRadius:i+X.outerStrokeWidth/2,title:E.length>0?{text:E,x:a+L,y:o+R-(n-50)/2}:void 0,slices:te,legend:oe,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function Q(e){return String(Math.round(e*100)/100)}function Ba(e,n,r){return e===0?`var(--accent, ${t.CHART_ACCENT_FALLBACK})`:(0,t.getSeriesColor)(e,n??t.CHART_ACCENT_FALLBACK,r)}function Va(t,n,r){let i=new Set;for(let e of t.slices)i.add(e.colorIndex);for(let e of t.legend)i.add(e.colorIndex);let a=[...i].sort((e,t)=>e-t),o=a.map(e=>` --pie-color-${e}: ${t.sliceColors?.[e]??Ba(e,n.accent,n.bg)};`),s=a.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),c=t.slices.some(e=>e.highlighted)?`
78
79
  .pie-slice.pie-highlight { opacity: 1; }`:``,l=o.length>0?`\n svg {\n${o.join(`
79
80
  `)}\n }`:``;return`${(0,e.styleOpenTag)(r)}
80
- .pie-outer { fill: none; stroke: var(--fg); stroke-width: ${Z.outerStrokeWidth}px; }
81
+ .pie-outer { fill: none; stroke: var(--fg); stroke-width: ${X.outerStrokeWidth}px; }
81
82
  .pie-slice { stroke: var(--fg); stroke-width: 2px; opacity: 0.7; }${c}
82
- .pie-slice-label { fill: var(--_text); font-size: ${Z.sectionFontSize}px; font-weight: ${Z.fontWeight}; }
83
- .pie-title { fill: var(--_text); font-size: ${Z.titleFontSize}px; font-weight: ${Z.fontWeight}; }
84
- .pie-legend-text { fill: var(--_text); font-size: ${Z.legendFontSize}px; font-weight: ${Z.fontWeight}; }${l}
83
+ .pie-slice-label { fill: var(--_text); font-size: ${X.sectionFontSize}px; font-weight: ${X.fontWeight}; }
84
+ .pie-title { fill: var(--_text); font-size: ${X.titleFontSize}px; font-weight: ${X.fontWeight}; }
85
+ .pie-legend-text { fill: var(--_text); font-size: ${X.legendFontSize}px; font-weight: ${X.fontWeight}; }${l}
85
86
  ${s.join(`
86
87
  `)}
87
- </style>`}function Va(t,n,r=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,o??t.accTitle,s,void 0,c.styleAttribute,t.accDescr),a)),l.push((0,e.buildStyleBlock)(r,!1,c.nonce)),l.push(Ba(t,n,c.nonce)),l.push(`<circle cx="${Ra(t.cx)}" cy="${Ra(t.cy)}" r="${Ra(t.outerRadius)}" class="pie-outer"/>`);for(let n of t.slices)l.push(`<path d="${n.path}" class="pie-slice${n.highlighted?` pie-highlight`:``} pie-color-${n.colorIndex}" data-label="${(0,e.escapeAttr)(n.label)}" data-value="${n.value}"/>`);for(let n of t.slices)l.push(`<text x="${Ra(n.labelX)}" y="${Ra(n.labelY)}" text-anchor="middle" class="pie-slice-label">${(0,e.escapeXml)(n.percentText)}</text>`);t.title&&l.push(`<text x="${Ra(t.title.x)}" y="${Ra(t.title.y)}" text-anchor="middle" class="pie-title">${(0,e.escapeXml)(t.title.text)}</text>`);for(let n of t.legend)l.push(`<g class="pie-legend"><rect x="${Ra(n.x)}" y="${Ra(n.y)}" width="${n.size}" height="${n.size}" class="pie-legend-swatch pie-color-${n.colorIndex}"/><text x="${Ra(n.textX)}" y="${Ra(n.textY)}" class="pie-legend-text">${(0,e.escapeXml)(n.text)}</text></g>`);return l.push(`</svg>`),l.join(`
88
- `)}var Ha=2048,Ua=[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],Wa=[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 Ga(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?Wa:Ua)[n-32]/Ha}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},Ka=$.width-2*$.shapePadding;function qa(e,t,n){let r=[];for(let i of e.split(`
89
- `)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&$a(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function Ja(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 Ya(e,t){return e*$.nameLine+$.typeLine+Xa(t)}function Xa(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function Za(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function Qa(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function $a(e,t,n){let r=0;for(let i of e){let e=Ga(i,n>=600);r+=e===void 0?w(i,t,n)*$.textScale:e*t}return r}function eo(e,t,n,r){let i=Ya(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:Ja(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=Za(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=Qa(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function to(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 no=$.messageSize+5;function ro(e){return e.labelLines??(0,t.c4RelLabelLines)(e)}function io(e){let t=e.labelPosition;return t?ro(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*no,w:$a(n,$.messageSize,400),h:$.messageSize})):[]}function ao(){return{next:{cnt:0}}}function oo(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 so(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function co(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,so(e,`startx`,r,Math.min),so(e,`starty`,a,Math.min),so(e,`stopx`,i,Math.max),so(e,`stopy`,o,Math.max),so(e.next,`startx`,r,Math.min),so(e.next,`starty`,a,Math.min),so(e.next,`stopx`,i,Math.max),so(e.next,`stopy`,o,Math.max)}function lo(e){let n=qa(e.label,Ka,$.nameSize),r=e.description?qa(e.description,Ka,$.descrSize):[],i=Math.max(...n.map(e=>$a(e,$.nameSize,700)),$a((0,t.c4TypeLine)(e),$.typeSize,400),...r.map(e=>$a(e,$.descrSize,400)));return{el:e,nameLines:n,descriptionLines:r,x:0,y:0,...eo(e,n.length,r.length,i)}}function uo(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 fo(e){let n=new Map,r=[],i=$.diagramMarginX,a=$.diagramMarginY,o=(e,t)=>{for(let r of t){let t=lo(r);n.set(r.alias,t),co(e,t)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},s=(e,n,c)=>{let l=ao();l.widthLimit=e.widthLimit/Math.min($.boundaryInRow,n.length);for(let[u,d]of n.entries()){let n=d.boundary,f=0,p=f+8;f=p+$.boundaryLabelHeight;let m;n&&(0,t.c4BoundaryTypeLine)(n)&&(m=f+5,f=m+$.boundaryTypeHeight);let h;if(n?.description&&(h=f+20,f=h+$.boundaryDescrHeight),n||(f=$.rootHeadingHeight),u===0||u%$.boundaryInRow===0){let t=e.startx+$.diagramMarginX,n=e.stopy+$.diagramMarginY+f;oo(l,t,t,n,n)}else{let e=l.stopx===l.startx?l.startx:l.stopx+$.diagramMarginX;oo(l,e,e,l.starty,l.starty)}if(d.elements.length>0&&o(l,d.elements),d.children.length>0&&s(l,d.children,c+1),n){let e=l.stopx-l.startx,t=l.stopy-l.starty;e===0&&(e=$.width,l.stopx=l.startx+e),t===0&&(t=f+$.shapeMargin),r.push({alias:n.alias,label:n.label,...n.type?{type:n.type}:{},...n.description?{description:n.description}:{},x:l.startx,y:l.starty,width:e,height:t,depth:c,labelY:p,...m===void 0?{}:{typeY:m},...h===void 0?{}:{descrY:h}})}e.stopy=Math.max(l.stopy+$.shapeMargin,e.stopy),e.stopx=Math.max(l.stopx+$.shapeMargin,e.stopx),i=Math.max(i,e.stopx),a=Math.max(a,e.stopy)}},c=ao();return oo(c,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),c.widthLimit=$.screenWidth,s(c,[e],-1),{elements:n,boundaries:r,maxX:i,maxY:a}}function po(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 mo(e,t){let n=Ja(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 go({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function ho(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 go(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=ho(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 _o=1e-6;function vo(e,t){let n=po(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Za(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-_o||Math.abs(Math.abs(s)-e.width/2)<=_o&&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 yo(e,t){let n=po(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Qa(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-_o||Math.abs(Math.abs(s)-e.height/2)<=_o&&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 bo(e,t){let n=e.el;return n?.kind===`person`?mo(e,t):n?.shape===`db`?vo(e,t):n?.shape===`queue`?yo(e,t):po(e,t)}var xo=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function So(e,n,r,i){let a=r.get(e.from),o=r.get(e.to),s=bo(a,xo(o)),c=bo(o,xo(a)),l=c.x-s.x,u=c.y-s.y,d=e=>({x:e.x,y:e.y+i}),f={...e,points:[d(s),d(c)]};if(n>0&&(f.curve=d({x:s.x+l/2-l/4,y:s.y+u/2})),(0,t.c4RelLabelLines)(e).length>0){let n={x:Math.min(s.x,c.x)+Math.abs(l)/2,y:Math.min(s.y,c.y)+Math.abs(u)/2},r=(0,t.c4RelLabelLines)(e)[0],i=e.label!==``||e.index!==void 0?$a(r??``,$.messageSize,400):0;if(f.labelPosition=d({x:n.x+i/2,y:n.y}),e.technology){let t=$a(`[${e.technology}]`,$.messageSize,400);f.technologyX=n.x+Math.max(i,t)/2}}return f}var Co=2,wo=6,To=2,Eo=[0,14,-14,28,-28],Do=[.75,.55,.4],Oo=1e3,ko=100,Ao=10,jo=2,Mo=5,No=4,Po=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}),Fo=(e,t)=>e.x0<t.x1+Co&&e.x1>t.x0-Co&&e.y0<t.y1+Co&&e.y1>t.y0-Co;function Io(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/No));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 Lo(e){return e.flatMap(e=>{let n=(e,t,n,r,i)=>({x0:e-i,x1:t+i,y0:n-i,y1:r+i,weight:ko}),r=(t,r,i,a)=>{let o=$a(t,i,a),s=e.x+e.width/2;return n(s-o/2,s+o/2,e.y+r-i/2,e.y+r+i/2,Mo)},i=(0,t.c4BoundaryTypeLine)({...e,elementAliases:[],children:[]});return[n(e.x,e.x+e.width,e.y,e.y,jo),n(e.x,e.x+e.width,e.y+e.height,e.y+e.height,jo),n(e.x,e.x,e.y,e.y+e.height,jo),n(e.x+e.width,e.x+e.width,e.y,e.y+e.height,jo),r(e.label,e.labelY,$.boundarySize+2,700),...i?[r(i,e.typeY,$.boundarySize,400)]:[],...e.description?[r(e.description,e.descrY,$.boundarySize-2,400)]:[]]})}function Ro(e,t){return io({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(Po)}function zo(e,n,r,i){let a=e.points[0],o=e.points[e.points.length-1],s=e.labelPosition;if(!s||!a||!o)return;let c=o.x-a.x,l=o.y-a.y,u=Math.hypot(c,l),d=(0,t.c4RelLabelLines)(e),f=e.label!==``||e.index!==void 0,p=f?$a(d[0],$.messageSize,400):0,m=s.x-p/2,h=[{variant:{lines:d,position:s,...e.technologyX===void 0?{}:{technologyX:e.technologyX}},cost:0}];if(f){let t=e.technology?[`[${e.technology}]`]:[],n=new Set([d.join(`
90
- `)]);Do.forEach((e,r)=>{let i=qa(d[0],p*e,$.messageSize),a=[...i,...t].join(`
91
- `);if(n.has(a))return;n.add(a);let o=Math.max(...i.map(e=>$a(e,$.messageSize,400)));h.push({variant:{lines:[...i,...t],position:{x:m+o/2,y:s.y}},cost:25*(r+1)})})}let g=u===0?0:c/u,_=u===0?0:l/u,v=u/2+Math.max(...Eo)+Co,y=h.flatMap(t=>Ro(e,t.variant)),b={x0:Math.min(...y.map(e=>e.x0))-v,x1:Math.max(...y.map(e=>e.x1))+v,y0:Math.min(...y.map(e=>e.y0))-v,y1:Math.max(...y.map(e=>e.y1))+v},x=e=>e.x0<b.x1&&e.x1>b.x0&&e.y0<b.y1&&e.y1>b.y0,S=[...n,...i].filter(x),C=Math.max(To,u/200),w=r.filter(e=>x({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=w.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))})),E,D=e=>E?.penalty===0&&e>=E.cost;for(let{variant:t,cost:n}of h){let r=Ro(e,t);for(let e of Eo)if(!D(n+2*Math.abs(e)))for(let i=0;i<=u/2&&!D(n+2*Math.abs(e)+i);i+=C)for(let a of i===0?[1]:[1,-1]){let o=a*i,s={x:o*g-e*_,y:o*_+e*g},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=E?.penalty??1/0;for(let e of c){if(l>u)break;for(let t of S)if(Fo(e,t)&&(l+=t.weight),l>u)break;if(l>u)break;for(let[t,n]of w.entries()){let r=T[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+=Ao)}}let d=n+i+2*Math.abs(e);(!E||l<E.penalty||l===E.penalty&&d<E.cost)&&(E={v:t,at:s,penalty:l,cost:d})}}let{v:O,at:k}=E;e.labelPosition={x:O.position.x+k.x,y:O.position.y+k.y},O.lines!==d&&(e.labelLines=O.lines),O.technologyX===void 0?delete e.technologyX:e.technologyX=O.technologyX+k.x,i.push(...io(e).map(e=>({...Po(e),weight:ko})))}function Bo(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};return e.title&&(t.title=e.title),t}let n=fo(uo(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)=>So(e,t,s,i)),l=[...a.map(e=>({x0:e.x-wo,x1:e.x+e.width+wo,y0:e.y-wo,y1:e.y+e.height+wo,weight:Oo})),...Lo(o)],u=c.map(Io),d=[];c.forEach((e,t)=>zo(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 Vo(t,n,r=`Inter`,i=!1,a=O,o,s,c,l={}){let u=[];u.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s??t.title,c,void 0,l.styleAttribute,l.description),o)),u.push((0,e.buildStyleBlock)(r,!1,l.nonce)),t.title&&t.titlePosition&&u.push(e.f`<text class="c4-title" x="${t.titlePosition.x}" y="${t.titlePosition.y}" dy="${N}" `+e.f`font-size="16" fill="var(--_text)">${(0,e.escapeXml)(t.title)}</text>`);for(let e of t.boundaries)u.push(Uo(e));for(let e of t.elements)u.push(Wo(e));for(let e of t.relationships)u.push(Qo(e));for(let e of t.relationships)u.push($o(e));return u.push(`</svg>`),u.filter(Boolean).join(`
92
- `)}function Ho(t,n,r,i,a){return e.f` <text x="${n}" y="${r}" text-anchor="middle" dy="${N}" font-size="${i}" `+e.f`${a}>${(0,e.escapeXml)(t)}</text>`}function Uo(n){let r=[];r.push(e.f`<g class="c4-boundary" data-id="${(0,e.escapeAttr)(n.alias)}" data-label="${(0,e.escapeAttr)(n.label)}" data-depth="${n.depth}">`),r.push(e.f` <rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let i=n.x+n.width/2;r.push(Ho(n.label,i,n.y+(n.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let a=(0,t.c4BoundaryTypeLine)({alias:n.alias,label:n.label,...n.type?{type:n.type}:{},elementAliases:[],children:[]});return a&&n.typeY!==void 0&&r.push(Ho(a,i,n.y+n.typeY,$.boundarySize,`fill="var(--_text)"`)),n.description&&n.descrY!==void 0&&r.push(Ho(n.description,i,n.y+n.descrY,$.boundarySize-2,`fill="var(--_text)"`)),r.push(`</g>`),r.join(`
93
- `)}function Wo(n){let r=to(n),{x:i,y:a,width:o,height:s}=n,c=i+o/2,l=Ya(n.nameLines.length,n.descriptionLines.length),u=[];u.push(e.f`<g class="c4-element" data-id="${(0,e.escapeAttr)(n.alias)}" data-kind="${n.kind}" data-shape="${n.shape}" `+e.f`data-external="${n.external}" data-label="${(0,e.escapeAttr)(n.label)}">`);let d,f=c;if(n.kind===`person`)u.push(...Ko(n,r)),d=a+Ja(o).pillTop+$.shapePadding;else if(n.shape===`db`){u.push(...qo(n,r));let{ry:e}=Za(o);d=a+(2*e+s)/2-l/2}else if(n.shape===`queue`){u.push(...Jo(n,r));let{rx:e}=Qa(s);f=c-e,d=a+s/2-l/2}else u.push(e.f` <rect x="${i}" y="${a}" width="${o}" height="${s}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+e.f`fill="${r.fill}" stroke="${r.stroke}" stroke-width="${$.strokeWidth}" />`),d=a+$.shapePadding;let p=d;for(let t of n.nameLines)u.push(Ho(t,f,p+$.nameLine/2,$.nameSize,e.f`font-weight="700" fill="${r.text}"`)),p+=$.nameLine;return u.push(Ho((0,t.c4TypeLine)(n),f,p+$.typeLine/2,$.typeSize,e.f`fill="${r.text}"`)),p+=$.typeLine,n.descriptionLines.forEach((t,n)=>{u.push(Ho(t,f,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,e.f`fill="${r.text}"`))}),p+=Xa(n.descriptionLines.length),u.push(`</g>`),u.join(`
94
- `)}function Go(t){let{x:n,y:r,width:i,height:a}=t,{rx:o,headRadius:s,pillTop:c}=Ja(i,a),l=n+i/2,u=r+c,d=r+a,f=Math.sqrt(Math.max(0,s*s-(u-(r+s))**2));return e.f`M ${n+o} ${u} H ${l-f} A ${s} ${s} 0 1 1 ${l+f} ${u} `+e.f`H ${n+i-o} A ${o} ${o} 0 0 1 ${n+i} ${u+o} V ${d-o} `+e.f`A ${o} ${o} 0 0 1 ${n+i-o} ${d} H ${n+o} `+e.f`A ${o} ${o} 0 0 1 ${n} ${d-o} V ${u+o} `+e.f`A ${o} ${o} 0 0 1 ${n+o} ${u} Z`}function Ko(t,n){return[e.f` <path class="c4-person-shape" d="${Go(t)}" fill="${n.fill}" stroke="${n.stroke}" stroke-width="${$.strokeWidth}" />`]}function qo(t,n){let{x:r,y:i,width:a,height:o}=t,{rx:s,ry:c}=Za(a),l=e.f`fill="${n.fill}" stroke="${n.stroke}" stroke-width="${$.strokeWidth}"`;return[e.f` <path d="M ${r} ${i+c} L ${r} ${i+o-c} A ${s} ${c} 0 0 0 ${r+a} ${i+o-c} L ${r+a} ${i+c} Z" ${l} />`,e.f` <ellipse cx="${r+s}" cy="${i+c}" rx="${s}" ry="${c}" ${l} />`]}function Jo(t,n){let{x:r,y:i,width:a,height:o}=t,{rx:s,ry:c}=Qa(o),l=e.f`fill="${n.fill}" stroke="${n.stroke}" stroke-width="${$.strokeWidth}"`;return[e.f` <path d="M ${r+a-s} ${i} H ${r+s} A ${s} ${c} 0 0 0 ${r+s} ${i+o} H ${r+a-s} Z" ${l} />`,e.f` <ellipse cx="${r+a-s}" cy="${i+c}" rx="${s}" ry="${c}" ${l} />`]}function Yo(t,n){let r=t.x-n.x,i=t.y-n.y,a=Math.hypot(r,i);if(a===0)return``;let o=r/a,s=i/a,c=t.x-o*10,l=t.y-s*10;return e.f`<polygon class="c4-arrowhead" points="${t.x},${t.y} ${c-s*5},${l+o*5} ${c+s*5},${l-o*5}" `+`fill="var(--_text)" />`}var Xo=3,Zo=1;function Qo(t){let[n,r]=[t.points[0],t.points[t.points.length-1]];if(!n||!r||n===r)return``;let i=[`class="c4-relationship"`,e.f`data-from="${(0,e.escapeAttr)(t.from)}"`,e.f`data-to="${(0,e.escapeAttr)(t.to)}"`];t.label&&i.push(e.f`data-label="${(0,e.escapeAttr)(t.label)}"`),t.technology&&i.push(e.f`data-technology="${(0,e.escapeAttr)(t.technology)}"`);let a=t.curve?e.f`M ${n.x},${n.y} Q ${t.curve.x},${t.curve.y} ${r.x},${r.y}`:e.f`M ${n.x},${n.y} L ${r.x},${r.y}`,o=e.f`<path ${i.join(` `)} d="${a}" fill="none" stroke="var(--_text)" stroke-width="1" />`,s=t.curve??n,c=t.curve??r,l=Yo(r,s),u=Yo(n,c);return[o,...t.bidirectional?[l,u]:[t.reversed?u:l]].filter(Boolean).join(`
95
- `)}function $o(t){let n=ro(t),r=io(t);if(r.length===0)return``;let i=[e.f`<g class="c4-relationship-label" data-from="${(0,e.escapeAttr)(t.from)}" data-to="${(0,e.escapeAttr)(t.to)}">`],a=Math.min(...r.map(e=>e.cx-e.w/2))-Xo,o=Math.max(...r.map(e=>e.cx+e.w/2))+Xo,s=r[0].cy-r[0].h/2-Zo,c=r[r.length-1],l=c.cy+c.h/2+Zo;return i.push(e.f` <rect class="c4-label-plate" x="${a}" y="${s}" width="${o-a}" height="${l-s}" rx="2" ry="2" fill="var(--bg)" />`),n.forEach((e,a)=>{let o=t.technology!==void 0&&a===n.length-1,s=r[a];i.push(Ho(e,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),i.push(`</g>`),i.join(`
96
- `)}var es={type:`xychart`,parse:t.parseXYChart,layoutForSvg:fa,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Ta(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},ts={type:`sequence`,parse:t.parseSequenceDiagram,layoutForSvg:Hi,renderSvg(e,t){return Ui(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function ns(e){return(e.interactivity??`static`)!==`none`}function rs(e){return(e.interactivity??`static`)===`full`}var is={type:`class`,parse:t.parseClassDiagram,layoutForSvg:Xr,renderSvg(e,t,n){return ni(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,ns(n),t.emit)}},as={type:`er`,parse:t.parseErDiagram,layoutForSvg(t,n){return Si((0,e.withDirectionOverride)(t,n.direction),n)},renderSvg(e,t){return Ti(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},os={type:`flowchart`,parse:(e,n)=>(0,t.parseMermaid)(n),layoutForSvg(t,n){return{graph:mn((0,e.withDirectionOverride)(t,n.direction),n),curve:n.curve??t.initConfig?.curve??`linear`}},renderSvg(e,t,n){return Tn(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,rs(n),ns(n),t.title,t.decorative,t.emit)}},ss={type:`c4`,parse:t.parseC4Diagram,layoutForSvg(e,t){return Bo(e,t)},renderSvg(e,t){return Vo(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},cs={xychart:es,er:as,sequence:ts,class:is,flowchart:os,architecture:{type:`architecture`,parse:t.parseArchitecture,layoutForSvg(n,r){return{graph:fn((0,e.withDirectionOverride)((0,t.architectureToGraph)(n),r.direction),r),curve:r.curve??`linear`}},renderSvg:os.renderSvg},c4:ss,pie:{type:`pie`,parse:(e,n)=>(0,t.parsePieChart)(n),layoutForSvg:(e,t)=>La(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return Va(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function ls(t){return{bg:t.bg??e.DEFAULTS.bg,fg:t.fg??e.DEFAULTS.fg,line:t.line,accent:t.accent,muted:t.muted??(t.bg||t.fg?void 0:e.DEFAULTS.muted),surface:t.surface,border:t.border}}function us(t={}){return(0,e.themeStyleDeclarations)(ls(t),t.transparent)}function ds(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute}}function fs(e,t={}){let{svg:n,colors:r}=hs(e,t),i=ps(n);return t.resolveColors?Lr(i,r):i}function ps(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 ms(t){let r=(0,e.extractAccessibility)((0,n.decodeXML)(t)).text;cs[(0,e.detectDiagramType)(r)].parse((0,e.splitStatements)(r),r)}function hs(t,r){(0,e.checkLimit)(`maxInputLength`,t.length,r.limits);let i=(0,e.extractAccessibility)((0,n.decodeXML)(t)),a=i.text,o=r.font??`Inter`;(0,e.setMonospaceMetrics)((0,e.isMonospaceFont)(o));let s=r.transparent??!1,c=k(r.fontSizes),l=(0,e.detectDiagramType)(a),u=r.embedSource?t:void 0,d=r.title??i.accTitle,f=r.decorative,p={...ds(r),description:i.accDescr},m=(0,e.splitStatements)(a),h=cs[l],g=h.parse(m,a),_=g;_.nodes instanceof Map&&Array.isArray(_.edges)&&(0,e.checkGraphSize)(_.nodes.size,_.edges.length,r.limits);let v=h.layoutForSvg(g,r),y=ls(r.honorThemeVariables?(0,e.applyThemeVariables)(r,g.initConfig):r),b={colors:y,font:o,transparent:s,fontSizes:c,embedSource:u,title:d,decorative:f,emit:p};return{svg:h.renderSvg(v,b,r),colors:y}}async function gs(e,t={}){return fs(e,t)}var _s=fs,vs=gs;exports.ACTOR_LABEL_OFFSET=Ii,exports.ARROW_HEAD=P,exports.CLS=W,exports.ELK_DIRECTION_FALLBACK=L,exports.ElkNotRegisteredError=p,exports.FONT_SIZES=O,exports.FONT_WEIGHTS=A,exports.GROUP_HEADER_CONTENT_PAD=ee,exports.INLINE_CENTERED_EDGE_LABEL=ne,exports.MONO_FONT=E,exports.MONO_FONT_STACK=D,exports.NODE_PADDING=j,exports.PIE=Z,exports.STROKE_WIDTHS=M,exports.TEXT_BASELINE_SHIFT=N,exports.baseElkLayoutOptions=B,exports.boxLabelHeight=Fi,exports.buildElkEdge=ie,exports.buildElkEdgeLabel=re,exports.buildElkLeafNode=te,exports.buildSvgStyleBlock=F,exports.classBackEdges=qr,exports.classNoteId=Hr,exports.clipEdgeToShape=Ee,exports.convertToElkFormat=hn,exports.createLayoutCache=v,exports.directionToElk=R,exports.elkLayoutSync=x,exports.elkPadding=z,exports.estimateMonoTextWidth=T,exports.estimateTextWidth=w,exports.evaluateCssColorValue=jr,exports.extractEdgeLabelPosition=Ue,exports.extractEdgePoints=He,exports.formatTickLabels=Sa,exports.hasLabelBelowIcon=Ri,exports.layoutClassDiagramSync=Xr,exports.layoutErDiagramSync=Si,exports.layoutFlowchartSync=mn,exports.layoutGraphSync=fn,exports.layoutPieChart=La,exports.layoutSequenceDiagram=Hi,exports.layoutXYChart=fa,Object.defineProperty(exports,"niceTickValues",{enumerable:!0,get:function(){return e.niceTickValues}}),exports.pieColorValue=za,exports.pointsToPath=c,exports.registerElk=m,exports.renderClassSvg=ni,exports.renderErSvg=Ti,exports.renderMermaid=vs,exports.renderMermaidSVG=fs,exports.renderMermaidSVGAsync=gs,exports.renderMermaidSync=_s,exports.renderPieSvg=Va,exports.renderSequenceSvg=Ui,exports.renderSvg=Tn,exports.renderXYChartSvg=Ta,exports.resolveCssColors=Lr,exports.resolveFontSizes=k,exports.smoothCurvePath=ka,exports.themeCssVariables=us,exports.validateMermaid=ms,exports.withDataSrc=Sr,exports.xLabelStep=va;
88
+ </style>`}function Ha(t,n,r=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,o??t.accTitle,s,void 0,c.styleAttribute,t.accDescr),a)),l.push((0,e.buildStyleBlock)(r,!1,c.nonce)),l.push(Va(t,n,c.nonce)),l.push(`<circle cx="${Q(t.cx)}" cy="${Q(t.cy)}" r="${Q(t.outerRadius)}" class="pie-outer"/>`);for(let n of t.slices)l.push(`<path d="${n.path}" class="pie-slice${n.highlighted?` pie-highlight`:``} pie-color-${n.colorIndex}" data-label="${(0,e.escapeAttr)(n.label)}" data-value="${n.value}"/>`);for(let n of t.slices)l.push(`<text x="${Q(n.labelX)}" y="${Q(n.labelY)}" text-anchor="middle" class="pie-slice-label">${(0,e.escapeXml)(n.percentText)}</text>`);t.title&&l.push(`<text x="${Q(t.title.x)}" y="${Q(t.title.y)}" text-anchor="middle" class="pie-title">${(0,e.escapeXml)(t.title.text)}</text>`);for(let n of t.legend)l.push(`<g class="pie-legend"><rect x="${Q(n.x)}" y="${Q(n.y)}" width="${n.size}" height="${n.size}" class="pie-legend-swatch pie-color-${n.colorIndex}"/><text x="${Q(n.textX)}" y="${Q(n.textY)}" class="pie-legend-text">${(0,e.escapeXml)(n.text)}</text></g>`);return l.push(`</svg>`),l.join(`
89
+ `)}var Ua=2048,Wa=[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],Ga=[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 Ka(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?Ga:Wa)[n-32]/Ua}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},qa=$.width-2*$.shapePadding;function Ja(e,t,n){let r=[];for(let i of e.split(`
90
+ `)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&eo(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function Ya(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 Xa(e,t){return e*$.nameLine+$.typeLine+Za(t)}function Za(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function Qa(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function $a(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function eo(e,t,n){let r=0;for(let i of e){let e=Ka(i,n>=600);r+=e===void 0?w(i,t,n)*$.textScale:e*t}return r}function to(e,t,n,r){let i=Xa(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:Ya(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=Qa(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=$a(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function no(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 ro=$.messageSize+5;function io(e){return e.labelLines??(0,t.c4RelLabelLines)(e)}function ao(e){let t=e.labelPosition;return t?io(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*ro,w:eo(n,$.messageSize,400),h:$.messageSize})):[]}function oo(){return{next:{cnt:0}}}function so(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 co(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function lo(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,co(e,`startx`,r,Math.min),co(e,`starty`,a,Math.min),co(e,`stopx`,i,Math.max),co(e,`stopy`,o,Math.max),co(e.next,`startx`,r,Math.min),co(e.next,`starty`,a,Math.min),co(e.next,`stopx`,i,Math.max),co(e.next,`stopy`,o,Math.max)}function uo(e){let n=Ja(e.label,qa,$.nameSize),r=e.description?Ja(e.description,qa,$.descrSize):[],i=Math.max(...n.map(e=>eo(e,$.nameSize,700)),eo((0,t.c4TypeLine)(e),$.typeSize,400),...r.map(e=>eo(e,$.descrSize,400)));return{el:e,nameLines:n,descriptionLines:r,x:0,y:0,...to(e,n.length,r.length,i)}}function fo(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 po(e){let n=new Map,r=[],i=$.diagramMarginX,a=$.diagramMarginY,o=(e,t)=>{for(let r of t){let t=uo(r);n.set(r.alias,t),lo(e,t)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},s=(e,n,c)=>{let l=oo();l.widthLimit=e.widthLimit/Math.min($.boundaryInRow,n.length);for(let[u,d]of n.entries()){let n=d.boundary,f=0,p=f+8;f=p+$.boundaryLabelHeight;let m;n&&(0,t.c4BoundaryTypeLine)(n)&&(m=f+5,f=m+$.boundaryTypeHeight);let h;if(n?.description&&(h=f+20,f=h+$.boundaryDescrHeight),n||(f=$.rootHeadingHeight),u===0||u%$.boundaryInRow===0){let t=e.startx+$.diagramMarginX,n=e.stopy+$.diagramMarginY+f;so(l,t,t,n,n)}else{let e=l.stopx===l.startx?l.startx:l.stopx+$.diagramMarginX;so(l,e,e,l.starty,l.starty)}if(d.elements.length>0&&o(l,d.elements),d.children.length>0&&s(l,d.children,c+1),n){let e=l.stopx-l.startx,t=l.stopy-l.starty;e===0&&(e=$.width,l.stopx=l.startx+e),t===0&&(t=f+$.shapeMargin),r.push({alias:n.alias,label:n.label,...n.type?{type:n.type}:{},...n.description?{description:n.description}:{},x:l.startx,y:l.starty,width:e,height:t,depth:c,labelY:p,...m===void 0?{}:{typeY:m},...h===void 0?{}:{descrY:h}})}e.stopy=Math.max(l.stopy+$.shapeMargin,e.stopy),e.stopx=Math.max(l.stopx+$.shapeMargin,e.stopx),i=Math.max(i,e.stopx),a=Math.max(a,e.stopy)}},c=oo();return so(c,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),c.widthLimit=$.screenWidth,s(c,[e],-1),{elements:n,boundaries:r,maxX:i,maxY:a}}function mo(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 ho(e,t){let n=Ya(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 _o({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function go(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 _o(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=go(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 vo=1e-6;function yo(e,t){let n=mo(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Qa(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-vo||Math.abs(Math.abs(s)-e.width/2)<=vo&&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 bo(e,t){let n=mo(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=$a(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-vo||Math.abs(Math.abs(s)-e.height/2)<=vo&&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 xo(e,t){let n=e.el;return n?.kind===`person`?ho(e,t):n?.shape===`db`?yo(e,t):n?.shape===`queue`?bo(e,t):mo(e,t)}var So=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function Co(e,n,r,i){let a=r.get(e.from),o=r.get(e.to),s=xo(a,So(o)),c=xo(o,So(a)),l=c.x-s.x,u=c.y-s.y,d=e=>({x:e.x,y:e.y+i}),f={...e,points:[d(s),d(c)]};if(n>0&&(f.curve=d({x:s.x+l/2-l/4,y:s.y+u/2})),(0,t.c4RelLabelLines)(e).length>0){let n={x:Math.min(s.x,c.x)+Math.abs(l)/2,y:Math.min(s.y,c.y)+Math.abs(u)/2},r=(0,t.c4RelLabelLines)(e)[0],i=e.label!==``||e.index!==void 0?eo(r??``,$.messageSize,400):0;if(f.labelPosition=d({x:n.x+i/2,y:n.y}),e.technology){let t=eo(`[${e.technology}]`,$.messageSize,400);f.technologyX=n.x+Math.max(i,t)/2}}return f}var wo=2,To=6,Eo=2,Do=[0,14,-14,28,-28],Oo=[.75,.55,.4],ko=1e3,Ao=100,jo=10,Mo=2,No=5,Po=4,Fo=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}),Io=(e,t)=>e.x0<t.x1+wo&&e.x1>t.x0-wo&&e.y0<t.y1+wo&&e.y1>t.y0-wo;function Lo(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/Po));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 Ro(e){return e.flatMap(e=>{let n=(e,t,n,r,i)=>({x0:e-i,x1:t+i,y0:n-i,y1:r+i,weight:Ao}),r=(t,r,i,a)=>{let o=eo(t,i,a),s=e.x+e.width/2;return n(s-o/2,s+o/2,e.y+r-i/2,e.y+r+i/2,No)},i=(0,t.c4BoundaryTypeLine)({...e,elementAliases:[],children:[]});return[n(e.x,e.x+e.width,e.y,e.y,Mo),n(e.x,e.x+e.width,e.y+e.height,e.y+e.height,Mo),n(e.x,e.x,e.y,e.y+e.height,Mo),n(e.x+e.width,e.x+e.width,e.y,e.y+e.height,Mo),r(e.label,e.labelY,$.boundarySize+2,700),...i?[r(i,e.typeY,$.boundarySize,400)]:[],...e.description?[r(e.description,e.descrY,$.boundarySize-2,400)]:[]]})}function zo(e,t){return ao({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(Fo)}function Bo(e,n,r,i){let a=e.points[0],o=e.points[e.points.length-1],s=e.labelPosition;if(!s||!a||!o)return;let c=o.x-a.x,l=o.y-a.y,u=Math.hypot(c,l),d=(0,t.c4RelLabelLines)(e),f=e.label!==``||e.index!==void 0,p=f?eo(d[0],$.messageSize,400):0,m=s.x-p/2,h=[{variant:{lines:d,position:s,...e.technologyX===void 0?{}:{technologyX:e.technologyX}},cost:0}];if(f){let t=e.technology?[`[${e.technology}]`]:[],n=new Set([d.join(`
91
+ `)]);Oo.forEach((e,r)=>{let i=Ja(d[0],p*e,$.messageSize),a=[...i,...t].join(`
92
+ `);if(n.has(a))return;n.add(a);let o=Math.max(...i.map(e=>eo(e,$.messageSize,400)));h.push({variant:{lines:[...i,...t],position:{x:m+o/2,y:s.y}},cost:25*(r+1)})})}let g=u===0?0:c/u,_=u===0?0:l/u,v=u/2+Math.max(...Do)+wo,y=h.flatMap(t=>zo(e,t.variant)),b={x0:Math.min(...y.map(e=>e.x0))-v,x1:Math.max(...y.map(e=>e.x1))+v,y0:Math.min(...y.map(e=>e.y0))-v,y1:Math.max(...y.map(e=>e.y1))+v},x=e=>e.x0<b.x1&&e.x1>b.x0&&e.y0<b.y1&&e.y1>b.y0,S=[...n,...i].filter(x),C=Math.max(Eo,u/200),w=r.filter(e=>x({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=w.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))})),E,D=e=>E?.penalty===0&&e>=E.cost;for(let{variant:t,cost:n}of h){let r=zo(e,t);for(let e of Do)if(!D(n+2*Math.abs(e)))for(let i=0;i<=u/2&&!D(n+2*Math.abs(e)+i);i+=C)for(let a of i===0?[1]:[1,-1]){let o=a*i,s={x:o*g-e*_,y:o*_+e*g},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=E?.penalty??1/0;for(let e of c){if(l>u)break;for(let t of S)if(Io(e,t)&&(l+=t.weight),l>u)break;if(l>u)break;for(let[t,n]of w.entries()){let r=T[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+=jo)}}let d=n+i+2*Math.abs(e);(!E||l<E.penalty||l===E.penalty&&d<E.cost)&&(E={v:t,at:s,penalty:l,cost:d})}}let{v:O,at:k}=E;e.labelPosition={x:O.position.x+k.x,y:O.position.y+k.y},O.lines!==d&&(e.labelLines=O.lines),O.technologyX===void 0?delete e.technologyX:e.technologyX=O.technologyX+k.x,i.push(...ao(e).map(e=>({...Fo(e),weight:Ao})))}function Vo(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};return e.title&&(t.title=e.title),t}let n=po(fo(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)=>Co(e,t,s,i)),l=[...a.map(e=>({x0:e.x-To,x1:e.x+e.width+To,y0:e.y-To,y1:e.y+e.height+To,weight:ko})),...Ro(o)],u=c.map(Lo),d=[];c.forEach((e,t)=>Bo(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 Ho(t,n,r=`Inter`,i=!1,a=O,o,s,c,l={}){let u=[];u.push(Sr((0,e.svgOpenTag)(t.width,t.height,n,i,s??t.title,c,void 0,l.styleAttribute,l.description),o)),u.push((0,e.buildStyleBlock)(r,!1,l.nonce)),t.title&&t.titlePosition&&u.push(e.f`<text class="c4-title" x="${t.titlePosition.x}" y="${t.titlePosition.y}" dy="${N}" `+e.f`font-size="16" fill="var(--_text)">${(0,e.escapeXml)(t.title)}</text>`);for(let e of t.boundaries)u.push(Wo(e));for(let e of t.elements)u.push(Go(e));for(let e of t.relationships)u.push($o(e));for(let e of t.relationships)u.push(es(e));return u.push(`</svg>`),u.filter(Boolean).join(`
93
+ `)}function Uo(t,n,r,i,a){return e.f` <text x="${n}" y="${r}" text-anchor="middle" dy="${N}" font-size="${i}" `+e.f`${a}>${(0,e.escapeXml)(t)}</text>`}function Wo(n){let r=[];r.push(e.f`<g class="c4-boundary" data-id="${(0,e.escapeAttr)(n.alias)}" data-label="${(0,e.escapeAttr)(n.label)}" data-depth="${n.depth}">`),r.push(e.f` <rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let i=n.x+n.width/2;r.push(Uo(n.label,i,n.y+(n.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let a=(0,t.c4BoundaryTypeLine)({alias:n.alias,label:n.label,...n.type?{type:n.type}:{},elementAliases:[],children:[]});return a&&n.typeY!==void 0&&r.push(Uo(a,i,n.y+n.typeY,$.boundarySize,`fill="var(--_text)"`)),n.description&&n.descrY!==void 0&&r.push(Uo(n.description,i,n.y+n.descrY,$.boundarySize-2,`fill="var(--_text)"`)),r.push(`</g>`),r.join(`
94
+ `)}function Go(n){let r=no(n),{x:i,y:a,width:o,height:s}=n,c=i+o/2,l=Xa(n.nameLines.length,n.descriptionLines.length),u=[];u.push(e.f`<g class="c4-element" data-id="${(0,e.escapeAttr)(n.alias)}" data-kind="${n.kind}" data-shape="${n.shape}" `+e.f`data-external="${n.external}" data-label="${(0,e.escapeAttr)(n.label)}">`);let d,f=c;if(n.kind===`person`)u.push(...qo(n,r)),d=a+Ya(o).pillTop+$.shapePadding;else if(n.shape===`db`){u.push(...Jo(n,r));let{ry:e}=Qa(o);d=a+(2*e+s)/2-l/2}else if(n.shape===`queue`){u.push(...Yo(n,r));let{rx:e}=$a(s);f=c-e,d=a+s/2-l/2}else u.push(e.f` <rect x="${i}" y="${a}" width="${o}" height="${s}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+e.f`fill="${r.fill}" stroke="${r.stroke}" stroke-width="${$.strokeWidth}" />`),d=a+$.shapePadding;let p=d;for(let t of n.nameLines)u.push(Uo(t,f,p+$.nameLine/2,$.nameSize,e.f`font-weight="700" fill="${r.text}"`)),p+=$.nameLine;return u.push(Uo((0,t.c4TypeLine)(n),f,p+$.typeLine/2,$.typeSize,e.f`fill="${r.text}"`)),p+=$.typeLine,n.descriptionLines.forEach((t,n)=>{u.push(Uo(t,f,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,e.f`fill="${r.text}"`))}),p+=Za(n.descriptionLines.length),u.push(`</g>`),u.join(`
95
+ `)}function Ko(t){let{x:n,y:r,width:i,height:a}=t,{rx:o,headRadius:s,pillTop:c}=Ya(i,a),l=n+i/2,u=r+c,d=r+a,f=Math.sqrt(Math.max(0,s*s-(u-(r+s))**2));return e.f`M ${n+o} ${u} H ${l-f} A ${s} ${s} 0 1 1 ${l+f} ${u} `+e.f`H ${n+i-o} A ${o} ${o} 0 0 1 ${n+i} ${u+o} V ${d-o} `+e.f`A ${o} ${o} 0 0 1 ${n+i-o} ${d} H ${n+o} `+e.f`A ${o} ${o} 0 0 1 ${n} ${d-o} V ${u+o} `+e.f`A ${o} ${o} 0 0 1 ${n+o} ${u} Z`}function qo(t,n){return[e.f` <path class="c4-person-shape" d="${Ko(t)}" fill="${n.fill}" stroke="${n.stroke}" stroke-width="${$.strokeWidth}" />`]}function Jo(t,n){let{x:r,y:i,width:a,height:o}=t,{rx:s,ry:c}=Qa(a),l=e.f`fill="${n.fill}" stroke="${n.stroke}" stroke-width="${$.strokeWidth}"`;return[e.f` <path d="M ${r} ${i+c} L ${r} ${i+o-c} A ${s} ${c} 0 0 0 ${r+a} ${i+o-c} L ${r+a} ${i+c} Z" ${l} />`,e.f` <ellipse cx="${r+s}" cy="${i+c}" rx="${s}" ry="${c}" ${l} />`]}function Yo(t,n){let{x:r,y:i,width:a,height:o}=t,{rx:s,ry:c}=$a(o),l=e.f`fill="${n.fill}" stroke="${n.stroke}" stroke-width="${$.strokeWidth}"`;return[e.f` <path d="M ${r+a-s} ${i} H ${r+s} A ${s} ${c} 0 0 0 ${r+s} ${i+o} H ${r+a-s} Z" ${l} />`,e.f` <ellipse cx="${r+a-s}" cy="${i+c}" rx="${s}" ry="${c}" ${l} />`]}function Xo(t,n){let r=t.x-n.x,i=t.y-n.y,a=Math.hypot(r,i);if(a===0)return``;let o=r/a,s=i/a,c=t.x-o*10,l=t.y-s*10;return e.f`<polygon class="c4-arrowhead" points="${t.x},${t.y} ${c-s*5},${l+o*5} ${c+s*5},${l-o*5}" `+`fill="var(--_text)" />`}var Zo=3,Qo=1;function $o(t){let[n,r]=[t.points[0],t.points[t.points.length-1]];if(!n||!r||n===r)return``;let i=[`class="c4-relationship"`,e.f`data-from="${(0,e.escapeAttr)(t.from)}"`,e.f`data-to="${(0,e.escapeAttr)(t.to)}"`];t.label&&i.push(e.f`data-label="${(0,e.escapeAttr)(t.label)}"`),t.technology&&i.push(e.f`data-technology="${(0,e.escapeAttr)(t.technology)}"`);let a=t.curve?e.f`M ${n.x},${n.y} Q ${t.curve.x},${t.curve.y} ${r.x},${r.y}`:e.f`M ${n.x},${n.y} L ${r.x},${r.y}`,o=e.f`<path ${i.join(` `)} d="${a}" fill="none" stroke="var(--_text)" stroke-width="1" />`,s=t.curve??n,c=t.curve??r,l=Xo(r,s),u=Xo(n,c);return[o,...t.bidirectional?[l,u]:[t.reversed?u:l]].filter(Boolean).join(`
96
+ `)}function es(t){let n=io(t),r=ao(t);if(r.length===0)return``;let i=[e.f`<g class="c4-relationship-label" data-from="${(0,e.escapeAttr)(t.from)}" data-to="${(0,e.escapeAttr)(t.to)}">`],a=Math.min(...r.map(e=>e.cx-e.w/2))-Zo,o=Math.max(...r.map(e=>e.cx+e.w/2))+Zo,s=r[0].cy-r[0].h/2-Qo,c=r[r.length-1],l=c.cy+c.h/2+Qo;return i.push(e.f` <rect class="c4-label-plate" x="${a}" y="${s}" width="${o-a}" height="${l-s}" rx="2" ry="2" fill="var(--bg)" />`),n.forEach((e,a)=>{let o=t.technology!==void 0&&a===n.length-1,s=r[a];i.push(Uo(e,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),i.push(`</g>`),i.join(`
97
+ `)}var ts={type:`xychart`,parse:t.parseXYChart,layoutForSvg:ma,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Da(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},ns={type:`sequence`,parse:t.parseSequenceDiagram,layoutForSvg:Ui,renderSvg(e,t){return Wi(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function rs(e){return(e.interactivity??`static`)!==`none`}function is(e){return(e.interactivity??`static`)===`full`}var as={type:`class`,parse:t.parseClassDiagram,layoutForSvg:Xr,renderSvg(e,t,n){return ni(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,rs(n),t.emit)}},os={type:`er`,parse:t.parseErDiagram,layoutForSvg(t,n){return Ci((0,e.withDirectionOverride)(t,n.direction),n)},renderSvg(e,t){return Ei(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},ss={type:`flowchart`,parse:(e,n)=>(0,t.parseMermaid)(n),layoutForSvg(t,n){return{graph:mn((0,e.withDirectionOverride)(t,n.direction),n),curve:n.curve??t.initConfig?.curve??`linear`}},renderSvg(e,t,n){return Tn(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,is(n),rs(n),t.title,t.decorative,t.emit)}},cs={type:`c4`,parse:t.parseC4Diagram,layoutForSvg(e,t){return Vo(e,t)},renderSvg(e,t){return Ho(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},ls={xychart:ts,er:os,sequence:ns,class:as,flowchart:ss,architecture:{type:`architecture`,parse:t.parseArchitecture,layoutForSvg(n,r){return{graph:fn((0,e.withDirectionOverride)((0,t.architectureToGraph)(n),r.direction),r),curve:r.curve??`linear`}},renderSvg:ss.renderSvg},c4:cs,pie:{type:`pie`,parse:(e,n)=>(0,t.parsePieChart)(n),layoutForSvg:(e,t)=>za(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return Ha(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function us(t){return{bg:t.bg??e.DEFAULTS.bg,fg:t.fg??e.DEFAULTS.fg,line:t.line,accent:t.accent,muted:t.muted??(t.bg||t.fg?void 0:e.DEFAULTS.muted),surface:t.surface,border:t.border}}function ds(t={}){return(0,e.themeStyleDeclarations)(us(t),t.transparent)}function fs(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute}}function ps(e,t={}){let{svg:n,colors:r}=gs(e,t),i=ms(n);return t.resolveColors?Lr(i,r):i}function ms(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 hs(t){let r=(0,e.extractAccessibility)((0,n.decodeXML)(t)).text;ls[(0,e.detectDiagramType)(r)].parse((0,e.splitStatements)(r),r)}function gs(t,r){(0,e.checkLimit)(`maxInputLength`,t.length,r.limits);let i=(0,e.extractAccessibility)((0,n.decodeXML)(t)),a=i.text,o=r.font??`Inter`;(0,e.setMonospaceMetrics)((0,e.isMonospaceFont)(o));let s=r.transparent??!1,c=k(r.fontSizes),l=(0,e.detectDiagramType)(a),u=r.embedSource?t:void 0,d=r.title??i.accTitle,f=r.decorative,p={...fs(r),description:i.accDescr},m=(0,e.splitStatements)(a),h=ls[l],g=h.parse(m,a),_=g;_.nodes instanceof Map&&Array.isArray(_.edges)&&(0,e.checkGraphSize)(_.nodes.size,_.edges.length,r.limits);let v=h.layoutForSvg(g,r),y=us(r.honorThemeVariables?(0,e.applyThemeVariables)(r,g.initConfig):r),b={colors:y,font:o,transparent:s,fontSizes:c,embedSource:u,title:d,decorative:f,emit:p};return{svg:h.renderSvg(v,b,r),colors:y}}async function _s(e,t={}){return ps(e,t)}var vs=ps,ys=_s;exports.ACTOR_LABEL_OFFSET=Li,exports.ARROW_HEAD=P,exports.CLS=W,exports.ELK_DIRECTION_FALLBACK=L,exports.ElkNotRegisteredError=p,exports.FONT_SIZES=O,exports.FONT_WEIGHTS=A,exports.GROUP_HEADER_CONTENT_PAD=ee,exports.INLINE_CENTERED_EDGE_LABEL=ne,exports.MONO_FONT=E,exports.MONO_FONT_STACK=D,exports.NODE_PADDING=j,exports.PIE=X,exports.STROKE_WIDTHS=M,exports.TEXT_BASELINE_SHIFT=N,exports.baseElkLayoutOptions=B,exports.boxLabelHeight=Ii,exports.buildElkEdge=ie,exports.buildElkEdgeLabel=re,exports.buildElkLeafNode=te,exports.buildSvgStyleBlock=F,exports.classBackEdges=qr,exports.classNoteId=Hr,exports.clipEdgeToShape=Ee,exports.convertToElkFormat=hn,exports.createLayoutCache=v,exports.directionToElk=R,exports.elkLayoutSync=x,exports.elkPadding=z,exports.estimateMonoTextWidth=T,exports.estimateTextWidth=w,exports.evaluateCssColorValue=jr,exports.extractEdgeLabelPosition=Ue,exports.extractEdgePoints=He,exports.formatTickLabels=wa,exports.hasLabelBelowIcon=zi,exports.layoutClassDiagramSync=Xr,exports.layoutErDiagramSync=Ci,exports.layoutFlowchartSync=mn,exports.layoutGraphSync=fn,exports.layoutPieChart=za,exports.layoutSequenceDiagram=Ui,exports.layoutXYChart=ma,Object.defineProperty(exports,"niceTickValues",{enumerable:!0,get:function(){return e.niceTickValues}}),exports.pieColorValue=Ba,exports.pointsToPath=c,exports.registerElk=m,exports.renderClassSvg=ni,exports.renderErSvg=Ei,exports.renderMermaid=ys,exports.renderMermaidSVG=ps,exports.renderMermaidSVGAsync=_s,exports.renderMermaidSync=vs,exports.renderPieSvg=Ha,exports.renderSequenceSvg=Wi,exports.renderSvg=Tn,exports.renderXYChartSvg=Da,exports.resolveCssColors=Lr,exports.resolveFontSizes=k,exports.smoothCurvePath=ja,exports.themeCssVariables=ds,exports.validateMermaid=hs,exports.withDataSrc=Sr,exports.xLabelStep=ba;